instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>Wrote the following in PowersHell as a quick iTunes demonstration:</p> <pre><code>$iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource foreach ($PList in $LibrarySource.Playlists) { write-host $PList.name } </code></pre> <p>This works well and pulls back a list of playlist names. However on trying to close iTunes a warning appears</p> <blockquote> <p>One or more applications are using the iTunes scripting interface. Are you sure you want to quit?</p> </blockquote> <p>Obviously I can just ignore the message and press [Quit] or just wait the 20 seconds or so, but is there a clean way to tell iTunes that I've finished working with it?</p> <pre><code>Itunes 7.7.1, Windows XP </code></pre>
<p>Here is one thing that I did on my a Powershell script that adds podcasts to iTunes. I use Juice on a server to download all the podcasts that I listen to. The script uses .Net methods to release the COM objects. When I wrote my iTunes script I had read a couple of articles that stated you should release your COM objects using .NET.</p> <pre><code> [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$LibrarySource) [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$iTunes) </code></pre> <p>I also run my scripts the majority of time from a shortcut, not from the powershell prompt. </p> <p>Based on your comments, I did some testing and I determined that I would get the message when running against iTunes, if I ran my script in a way that leaves powershell running. iTunes seems to keep track of that. Running the script in a manner that exits it's process after running, eliminated the message.</p> <p>One method of running your script from powershell, is to prefix your script with powershell.</p> <pre><code>powershell .\scriptname.ps1</code></pre> <p>The above command will launch your script and then exit the process that was used to run it, but still leaving you at the powershell prompt.</p>
<p>You should be able to set $itunes to $null. Alternatively, $itunes should have a quit method you can call. $itunes.quit()</p>
7,551
<p>What is the "<em>best</em>" way to store international addresses in a database? Answer in the form of a schema and an explanation of the reasons why you chose to normalize (or not) the way you did. Also explain why you chose the type and length of each field.</p> <p><strong>Note: You decide what fields you think are necessary.</strong></p>
<p>Plain freeform text.</p> <p>Validating all the world's post/zip codes is too hard; a fixed list of countries is too politically sensitive; mandatory state/region/other administrative subdivision is just plain inappropriate (all too often I'm asked which county I live in--when I don't, because Greater London is not a county at all).</p> <p>More to the point, it's simply unnecessary. Your application is highly unlikely to be modelling addresses in any serious way. If you want a postal address, ask for the postal address. Most people aren't so stupid as to put in something other than a postal address, and if they do, they can kiss their newly purchased item bye-bye.</p> <p>The exception to this is if you're doing something that's naturally constrained to one country anyway. In this situation, you should ask for, say, the { postcode, house number } pair, which is enough to identify a postal address. I imagine you could achieve similar things with the extended zip code in the US.</p>
<p>You need to provide a bit more details about how you are planning to use the data. For example, fields like City, State, Country can either be text in the single table, or be codes which are linked to a separate table with a Foreign Key.</p> <p>Simplest would be</p> <p>Address_Line_01 (Required, Non blank) Address_Line_02 Address_Line_03 Landmark City (Required) Pin (Required) Province_District State (Required) Country (Required)</p> <p>All the above can be Text/Unicode with appropriate field lengths.</p> <p>Phone Numbers as applicable.</p>
4,409
<p>I have been getting clogs and believe that it may be due to a damaged PTFE tube inside my hot end. I have a replacement (it came with my printer), but I can't seem to fit the tube into the nozzle.</p> <p>I also tried to turn the original PTFE tube around, and I can't get the other end to fit into the nozzle either.</p> <p>Is there a trick to it?</p>
<p>Yes, with the proper equipment.</p> <p>Printing wax filament (at 51 seconds): <a href="https://youtu.be/tibkVZB_n9c?t=51s" rel="noreferrer">https://youtu.be/tibkVZB_n9c?t=51s</a></p> <p>There are also options for melting wax, filling a heated reservoir head, and printing with that. I recommend doing this with a cold ambient temperature, so that the wax solidifies quickly. There's no point in just printing a puddle. :)</p>
<p>Just make a silicone mold of any of your prints and pour you wax in the silicone,you silicone putty is pretty cheap so is wax ,no need to break the bank as printers have become less expensive and can do a pretty good job </p>
633
<p>I like putting shortcuts of the form "g - google.lnk" in my start menu so google is two keystrokes away. Win, g.</p> <p>My eight or so most frequent applications go there.</p> <p>I also make links to my solution files I am always opening "x - Popular Project.lnk"</p> <p>Are there any better ways to automate opening frequently used applications?</p>
<p><a href="http://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotkey</a> is a reasonably good program for implementing windows key shortcuts. You might instead define WIN + G to be "open browser to google" which gives you a better response time (don't have to wait for start menu to popup, etc)</p> <p>There are macro programs that change the macros used based on the window that's in focus. I've never needed that much control, but you might want to look into that.</p> <p>-Adam</p>
<p>For shortcuts I use <strong>Launchy</strong></p> <p>For macros I use <strong>AutoHotKey</strong></p> <p>Others will suggest <strong>SlickRun</strong> for shortcuts also.</p>
6,608
<p>I intend and would like to print a transparent hemisphere. I have a Taulman T-Glase clear 1.75 mm filament and I have XTC-3D.</p> <p>You can read this interesting page, <a href="http://taulman3d.com/t-glase-optics.html" rel="nofollow noreferrer">Hacking t-glase to look more like glass!</a></p> <p>First question, what kind of printing settings should I use? Should I go for a low infill percentage or a high one? Should I go for line or hexagon? I would say 5% line but perhaps there is a better setting.</p> <p>Then, how should I use XTC-3D as mentioned on the above link? I'm a little bit confused how it can make the part more transparent.</p>
<p>First I would hedge your expectations.. I am very familiar with t-glase. It is very translucent but it is not clear and no amount of post treatment will make it 100% clear. Their example is the only exception where you have a simple print where it has only a single layer. By applying the clear coating they have normalized the wall and made the surface even. Thus no more light diffusion. </p> <p>You could likely get the same effect with good sanding but good luck sanding a 1 wall thick print. Also note they do not show any solid parts. If they cannot get a solid part to look good and clear, then really you shouldn't expect to be able to. </p> <p>Any infill will cause it to be non clear. Any extra shells will also create air pockets, lines, etc and make it non clear. If you really want clear, FDM is not the way to go. The only way I could imagine to print an item clear with FDM is to create a cast, then cast it with resin or glass.. </p> <p>If you consider how the plastic is applied, you can see there is no real way make it 100% air pocket free.. See below,</p> <p><a href="https://i.stack.imgur.com/8gd6j.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8gd6j.jpg" alt="FDM"></a></p> <p>Image taken from <a href="http://3devo.eu/guide-fdm-printable-plastics-3d-printing-filament/" rel="nofollow noreferrer">here</a>. </p> <p>The best I can recommend for settings. Make your temp spot on. If you boil the material you will have less translucency. Play with over extruding (too much material) in a Limited amount. Might reduce gaps. I would also try to print in BIG THICK lines. Less lines, less diffusions.</p>
<p>You will not get perfectly clear prints with FDM because of the mechanics of FDM printing there will always be tiny gaps. But, you can get pretty close as demonstrated by a <a href="https://learn.colorfabb.com/lets-make-something-clear/" rel="nofollow noreferrer">ColorFabb tutorial</a>.</p> <p>A clear filament and printing an object at an elevated temperature (more than normal) and enough material to close the gaps (e.g. 110%) should be able to produce transparent prints, for example:</p> <p><a href="https://i.stack.imgur.com/Kmn2Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kmn2Q.jpg" alt="Transparent printed parts"></a></p>
506
<p>I have been looking into IKVMing Apache's FOP project to use with our .NET app. It's a commercial product, and looking into licensing, IKVM runs into some sticky areas because of its use of GNU Classpath. From what I've seen, no one can say for sure if this stuff can be used in a commercial product. Has anyone used IKVM, or an IKVM'd product, in a commercial product? Here's what I've found so far:</p> <p><a href="https://web.archive.org/web/20040202014857/http://weblog.ikvm.net:80/story.aspx/license" rel="nofollow noreferrer">IKVM license page</a>, which notes that one dll contains code from other projects, their license <a href="https://openjdk.java.net/legal/gplv2+ce.html" rel="nofollow noreferrer">GPLv2 + Classpath Exception</a></p> <p><a href="http://saxon.sourceforge.net/" rel="nofollow noreferrer">Saxon for .NET</a> is generated with IKVM, but released under the Apache license...</p> <p>Anyone have experience with this?</p>
<p>There are multiple issues here as ikvm is currently being transitioned away from the GNU classpath system to Sun's OpenJDK. Both are licensed as GPL+Exceptions to state explicitly that applications which merely use the OpenJDK libraries will not be considered derived works.</p> <p>Generally speaking, applications which rely upon components with defined specs such as this do not fall under the GPL anyway. For example, linking against public POSIX APIs does not trigger GPL reliance in a Linux application, despite the kernel being GPL. A similar principal will usually (the details can be tricky) apply to replacing Sun's Java with a FOSS/GPL implementation.</p>
<p>I'm not a lawyer but all licenses mentioned are okay to be used in commercial products as long as you don't make any changes and claim the code is yours. </p> <p>I think if you don't wanna risk anything you should consult a lawyer.</p>
3,217
<p>I am new to the <code>.Net</code> Compact Framework and have been unable to find an answer via Google. Gasp! Yes, it's true, but that is part of why StackOverflow is here, right?</p> <p>I have a form that is longer than the screen, so a vertical scroll-bar appears as expected. However, this appears to force a horizontal scroll-bar to appear as well. (If I scroll to the right, there is nothing visible except white space ... about the size of a scroll-bar.)</p> <p>Is this a "feature" that is unavoidable? Anyone have experience in this area? ­­­­­­­­­­­­­­­­­­­­</p>
<p>Place your controls within a panel or equivalent and then reduce the width of the panel by the size of a vertical scrollbar. That means that when the vertical scrollbar appears then it will no longer require the horizontal scrollbar to make up for the lost width that the vertical scrollbar took.</p>
<p>Yes - I've got experience with that - unfortunately it was no different from your own. I've generally avoided scrolling forms and used paging wherever possible on .Net CF. If this is an option for you, I'd recommend it.</p> <p>I'd assume the scroll bar issue is to do with the form size being fixed to the width of the available screen (regardless of design-time settings) so the introduction of a vertical scroll bar obscures part of the (not needed) full-width form.</p>
5,115
<p>It's not just a capture I'm looking to do here. I want to first capture the packet, then in real time, check the payload for specific data, remove it, inject a signature and reinject the packet into the stack to be sent on as before.</p> <p>I had a read of the ipfw divert sockets using IPFW and it looks very promising. What about examples in modifying packets and reinjecting them back into the stack using divert sockets? Also, as a matter of curiosity, would it be possible to read the data from the socket using Java or would this restrict me with packing mangling and reinjecting etc?</p>
<p>See divert sockets: <a href="http://www.faqs.org/docs/Linux-mini/Divert-Sockets-mini-HOWTO.html" rel="nofollow noreferrer">Divert Sockets mini HOWTO</a>.</p> <p>They work by passing traffic matching a certain ipfw rule to a special raw socket that can then reinject altered traffic into the network layers.</p>
<p>If you're just looking for packet capture, libpcap is very popular. It's used in basic tools such as tcpdump and ethereal. As far as "hooking into the stack", unless you plan on fundamentally changing the way the way the networking is implemented (i.e. add your own layer or alter the behavior of TCP), your idea of using IPF for packet modification or intervention seems like the best bet. In Linux they have a specific redirection target for userspace modules, IPF probably has something similar or you could modify IPF to do something similar.</p> <p>If you are just interested in seeing the packets, then libpcap is the way to go. You can find it at: <a href="http://www.tcpdump.org/" rel="nofollow noreferrer">http://www.tcpdump.org/</a></p>
8,873
<p>I'm about to build a <a href="https://toms3d.org/2017/02/23/building-cheapest-possible-prusa-i3-mk2/" rel="noreferrer">Prusa i3 dolly</a>. I am confused whether to use RAMPS 1.4 or 1.5 or 1.6.</p> <p>What is the big difference? Is it only the MOSFETs and the poly-fuses? If that is the case, would it be advisable to upgrade a RAMPS 1.4 board (replacing the MOSFETs, connectors, and fuses)?</p>
<p>One of the thermistor wires had come loose from the crimp ferrules. I re-crimped it and it works fine now. </p>
<p>This can come from several sources:</p> <h1>Hardware</h1> <p>The thermistor or its connections might be damaged, and the fault is only observable when the hotend is hot or moved to a certain area. Start by checking the wiring! You may be able to repair a bad connection easily, but depending what was broken, you may need to replace something. In some cases squishing a thermistor cartridge too much can destroy the internals, so a replacement is needed.</p> <p>A mainboard failure is more likely to just show a static temperature, and a heater failure would show as maybe not getting past a certain point.</p> <h1>Firmware</h1> <p>If it had not worked before or you changed the firmware, the firmware should also be a suspect. The firmware can 'fail' when using the wrong thermistor type/table which can result in a very big offset or bad slope, resulting in wrong or unaccurate readings.</p>
845
<p>Is it possible to create a trigger that will not be in a transaction? </p> <p>I want to update data on a linked server with a trigger but due to firewall issues we can't create a distributed transaction between the two servers.</p>
<p>What you probably want is a combination of a queue that contains updates for the linked server and a process that reads data from the queue and updates the remote server. The trigger will then insert a message into the queue as part of the normal transaction. This data will be read by the separate process and used to update the remote server. Logic will needed in the process handle errors (and possibly retries).</p> <p>The queue can be implemented with one or more tables.</p>
<p>I know it's not helpful, so I'll probably get downvoted for this, but really, the solution is to fix the firewall problem.</p> <p>I think if you use remote (not linked) servers (which are not the preferred option these days) then you can use SET REMOTE_PROC_TRANSACTIONS OFF to prevent the use of DTC for remote transactions, which might do the right thing here. But that probably doesn't help you with a linked server anyway.</p>
4,012
<p>I like how SQLite library can be included into an application and the application has a full-fledged database to use.</p> <p>Similarly, is there an open source versioning library that I can include into my application so that I can save versions of files as well as do diffs and merges?</p>
<p>SVN doesn't require any prerequisites on end user machine. You can embed SVN right into you app. To learn more on subversion integration, visit "<a href="http://www.svnforum.org/2017/viewforum.php?f=17&amp;sid=643adb11d5f8edd09544aa435b6f5732" rel="nofollow noreferrer">Application Integration/Embedding</a>" thread on SVN forum.</p>
<p>In my opinion <a href="http://www.firebirdsql.org/" rel="nofollow noreferrer">Firebird</a> is one of the best choices for embedded DB scenarios.<br> Also <a href="http://www.microsoft.com/sql/editions/compact/default.mspx" rel="nofollow noreferrer">Microsoft SQL Server Compact</a> (closed source, but free) might be suitable, however it less capable than Firebird.</p> <p><strong>EDIT:</strong> I misread you question. If you don't need RDBMS, you can try to embed <a href="http://subversion.tigris.org" rel="nofollow noreferrer">SVN</a> to your application.</p>
6,956
<p>Thanks to a Q&amp;A on stackoverflow. I just found out how to determine the installed version on my hosting provider's server. Now I need to know what that number means.</p> <p>Using <code>&lt;%=Environment.Version%&gt;</code> on my local machine returns 2.0.50727.3053.</p> <p>Can someone give me a list of the version 1, 1.1, 2, etc. to the actual <code>Environment.Version</code> codes or break down what that code means?</p>
<p><a href="https://en.wikipedia.org/wiki/.NET_Framework_version_history" rel="nofollow noreferrer">List of .NET Framework versions</a>.</p>
<p>When you refer to a given .NET framework then all below can have different version at a given point of time:</p> <ul> <li>.NET Framework</li> <li>Common Language Run-time(CLR): Virtual Execution Environment of a process running a .NET EXE</li> <li>C#: The programming language you're using to write code</li> <li>ASP.NET (Part of .NET Framework library used for web development)</li> </ul> <p>The code <code>&lt;%=Environment.Version%&gt;</code> referred in your post gives the version of CLR (2nd bullet point above) while you seem to be interested in version of ASP.NET library. </p> <p>Each release of .NET Framework has ASP.NET library pre-built in it. All its versions can be found in below link:</p> <p><a href="https://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/ASP.NET</a> </p>
5,821
<p>I've got a web application working using VB and Ajax. I'm using updatepanels to avoid the irritating "flicker" on postbacks to the server. </p> <p>I would like to have a button control defined within the updatepanel itself (tried moving it outside and got some catastrophic error, so left it there) that makes the current panel not visible and a sibling panel visible. This works with the exception that the button must be clicked twice. Not double clicked, but clicked once than clicked again. </p> <p>In setting breakpoints I discovered the code behind that's attached to the button is actually being executed on the first click, but the panels don't switch as expected. If I click the same button OR worse yet, a different button, the expected behavior of the second panel appearing occurs. However, with the second button being clicked there's an unwanted bonus of a third panel being displayed, the third panel being made visible due to the second button being clicked.</p> <p>I'm assuming this behavior is due to the updatepanel and its Ajax nature. Is there a way to avoid the second click? Am I misusing the updatepanel? I really wanted to use a modal popup (right out of the AjaxToolKit) but had problems with posting back the data so I opted for this approach. Any insights, assistance, even criticism would be welcome as this has plagued me long enough. Thanks</p>
<p>If you get rid of the UpdatePanels do things work as expected with PostBacks? Chances are something in your Page_Load or other event higher up the chain are "resetting" things in some way before it gets to your click event. Could this be the case?</p>
<p>I have run into this before and resolved it, I just can't remember how. I will try to find my old code and get back to you. one thought, do you have EnablePartialRendering enabled in your scriptmanager? maybe try wrapping both containers in a third panel.</p>
6,621
<p>input: phrase 1, phrase 2</p> <p>output: semantic similarity value (between 0 and 1), or the probability these two phrases are talking about the same thing</p>
<hr> <p>You might want to check out this paper:</p> <p><a href="http://ants.iis.sinica.edu.tw/3BkMJ9lTeWXTSrrvNoKNFDxRm3zFwRR/55/Sentence%20Similarity%20Based%20on%20Semantic%20Nets%20and%20corpus%20statistics.pdf" rel="noreferrer">Sentence similarity based on semantic nets and corpus statistics (PDF)</a></p> <p>I've implemented the algorithm described. Our context was very general (effectively any two English sentences) and we found the approach taken was too slow and the results, while promising, not good enough (or likely to be so without considerable, extra, effort).</p> <p>You don't give a lot of context so I can't necessarily recommend this but reading the paper could be useful for you in understanding how to tackle the problem.</p> <p>Regards,</p> <p>Matt.</p>
<p>Take a look at <a href="http://mkusner.github.io/publications/WMD.pdf" rel="nofollow noreferrer">http://mkusner.github.io/publications/WMD.pdf</a> This paper describes an algorithm called Word Mover distance that tries to uncover semantic similarity. It relies on the similarity scores as dictated by word2vec. Integrating this with GoogleNews-vectors-negative300 yields desirable results. </p>
8,771
<p>I'm currently evaluating the <code>MSF for CMMI</code> process template under <strong>TFS</strong> for use on my development team, and I'm having trouble understanding the need for separate bug and change request work item types.</p> <p>I understand that it is beneficial to be able to differentiate between bugs (errors) and change requests (changing requirements) when generating reports.</p> <p>In our current system, however, we only have a single type of change request and just use a field to indicate whether it is a bug, requirement change, etc (this field can be used to build report queries).</p> <p>What are the benefits of having a separate workflow for bugs?</p> <p>I'm also confused by the fact that developers can submit work against a bug <strong>or</strong> a change request, I thought the intended workflow was for bugs to generate change requests which are what the developer references when making changes.</p>
<p>@Luke</p> <p>I don't disagree with you, but this difference is typically the explanation given for why there is two different processes available for handling the two types of issues.</p> <p>I'd say that if the color of the home page was originally designed to be red, and for some reason it is blue, that's easily a quick fix and doesn't need to involve many people or man-hours to do the change. Just check out the file, change the color, check it back in and update the bug.</p> <p>However, if the color of the home page was designed to be red, and is red, but someone thinks it needs to be blue, that is, to me anyway, a different type of change. For instance, have someone thought about the impact this might have on other parts of the page, like images and logos overlaying the blue background? Could there be borders of things that looks bad? Link underlining is blue, will that show up?</p> <p>As an example, I am red/green color blind, changing the color of something is, for me, not something I take lightly. There are enough webpages on the web that gives me problems. Just to make a point that even the most trivial change can be nontrivial if you consider everything.</p> <p>The actual end implementation change is probably much of the same, but to me a change request <strong>is</strong> a different beast, precisely because it needs to be thought about more to make sure it will work as expected.</p> <p>A bug, however, is that someone said <strong>this is how we're going to do it</strong> and then someone did it differently.</p> <p>A change request is more like <strong>but we need to consider this other thing as well... hmm...</strong>.</p> <p>There are exceptions of course, but let me take your examples apart.</p> <p>If the server was <em>designed</em> to handle more than 300,000,000,000 pageviews, then yes, it is a bug that it doesn't. But designing a server to handle that many pageviews is more than just saying <em>our server should handle 300,000,000,000 pageviews</em>, it should contain a <strong>very</strong> detailed specification for how it can do that, right down to processing time guarantees and disk access average times. If the code is then implemented exactly as designed, and unable to perform as expected, then the question becomes: <em>did we design it incorrectly or did we implement it incorrectly?</em>.</p> <p>I agree that in this case, wether it is to be considered a design flaw or a implementation flaw depends on the actual reason for why it fails to live up to expectations. For instance, if someone assumed disks were 100x times as fast as they actually are, and this is deemed to be the reason for why the server fails to perform as expected, I'd say this is a design bug, and someone needs to redesign. If the original requirement of that many pageviews is still to be held, a major redesign with more in-memory data and similar might have to be undertaken.</p> <p>However, if someone has just failed to take into account how raid disks operate and how to correctly benefit from striped media, that's a bug and might not need that big of a change to fix.</p> <p>Again, there will of course be exceptions.</p> <p>In any case, the original difference I stated is the one I have found to be true in most cases.</p>
<p>Is my assumption incorrect then that change requests should be generated from bugs? I'm confused because I don't think all bugs should be automatically approved for implementation -- they may be trivial and at least in our case will go through the same review process as a change request before being assigned to a developer.</p>
2,729
<p>I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?</p>
<p>A great example illustrating LSP (given by Uncle Bob in a podcast I heard recently) was how sometimes something that sounds right in natural language doesn't quite work in code.</p> <p>In mathematics, a <code>Square</code> is a <code>Rectangle</code>. Indeed it is a specialization of a rectangle. The &quot;is a&quot; makes you want to model this with inheritance. However if in code you made <code>Square</code> derive from <code>Rectangle</code>, then a <code>Square</code> should be usable anywhere you expect a <code>Rectangle</code>. This makes for some strange behavior.</p> <p>Imagine you had <code>SetWidth</code> and <code>SetHeight</code> methods on your <code>Rectangle</code> base class; this seems perfectly logical. However if your <code>Rectangle</code> reference pointed to a <code>Square</code>, then <code>SetWidth</code> and <code>SetHeight</code> doesn't make sense because setting one would change the other to match it. In this case <code>Square</code> fails the Liskov Substitution Test with <code>Rectangle</code> and the abstraction of having <code>Square</code> inherit from <code>Rectangle</code> is a bad one.</p> <p><a href="https://i.stack.imgur.com/ilxzO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ilxzO.jpg" alt="enter image description here" /></a></p> <p>Y'all should check out the other priceless <a href="https://www.globalnerdy.com/2009/07/15/the-solid-principles-explained-with-motivational-posters/" rel="noreferrer">SOLID Principles Explained With Motivational Posters</a>.</p>
<p>Let me try, consider an interface: </p> <pre><code>interface Planet{ } </code></pre> <p>This is implemented by class:</p> <pre><code>class Earth implements Planet { public $radius; public function construct($radius) { $this-&gt;radius = $radius; } } </code></pre> <p>You will use Earth as:</p> <pre><code>$planet = new Earth(6371); $calc = new SurfaceAreaCalculator($planet); $calc-&gt;output(); </code></pre> <p>Now consider one more class which extends Earth:</p> <pre><code>class LiveablePlanet extends Earth{ public function color(){ } } </code></pre> <p>Now according to LSP, you should be able to use LiveablePlanet in place of Earth and it should not break your system. Like:</p> <pre><code>$planet = new LiveablePlanet(6371); // Earlier we were using Earth here $calc = new SurfaceAreaCalculator($planet); $calc-&gt;output(); </code></pre> <p>Examples taken from <a href="https://bootsity.com/php/understanding-the-solid-principles-of-software-engineering" rel="nofollow noreferrer">here</a></p>
8,097
<p>I've done <em>some</em> research on this matter however I cannot find any clear answers. </p> <p>How does a SolidWorks CAD file get 'converted' into a file format suitable for 3D printing, in detail?</p>
<p>Any and all CAD files can be converted to STL (Standard Triangle Language). In this file format, surfaces are parsed to be combinations of triangles. For example a flat rectangular surface gets represented as two triangles in the same plane. </p> <p>As the complexity of the solid increases more triangles are required to adequately approximate the surface. Flat surfaced models are simpler to convert and will have smaller file sizes whereas curved solids will be more complex and larger file sizes (for the most part). The dimensions of your part do not translate to the STL file technically. The STL version of your part is based on unit vectors and a scaling factor is included in the file. So none of the vertices of the STL file are dimensioned, but the file is then scaled appropriately when opened.</p> <p>If you think of something as simple as a large diameter cylinder, you would need a relatively large number of triangles to approximate the curved surface. With a low number of triangles the curved surface would come out quite blocky, however increasing the resolution and the number of triangles used the blocky surfaces begin to approximate a curved surface. In theory if you had infinite resolution your curved surface would be exactly represented. The resolution of the file is something that you can choose when you save the file in STL format. The higher the resolution the more triangles will be required and the file size will also increase. </p> <p>The specific algorithm on how to complete this task will be proprietary to each CAD software, however if you're just curious on the math involved or the general process of converting them, I did a quick google search for "STL format algorithm" and found several useful links on the first page that could be useful. </p> <p>Here are a few links to a few sites with good information:</p> <ul> <li><p>The TL;DR version: <a href="https://www.cs.cmu.edu/afs/cs/academic/class/15294-s15/lectures/stl/stl.pdf" rel="nofollow noreferrer">15-294 Rapid Prototyping Technologies: STL Files and Slicing Software</a>;</p></li> <li><p>A Published paper on the algorithm: <a href="https://www.researchgate.net/profile/Okan_Topcu2/publication/259843304_A_method_for_slicing_cad_models_in_binary_stl_format/links/0deec52fd258c68deb000000.pdf" rel="nofollow noreferrer">A method for slicing cad models in binary stl format</a>, and;</p></li> <li><p>A rehash of what I wrote above: <a href="https://all3dp.com/what-is-stl-file-format-extension-3d-printing/" rel="nofollow noreferrer">STL File Format for 3D Printing – Explained in Simple Terms</a>.</p></li> </ul>
<p>When you convert it to, let's say, a .stl (3d object file) file, I believe it converts the geometry of the parts into binary and saves the sets. These matrices can be used by the software of 3d printer in order to give the appropriate Trajectory for the extruder. And then the motion of the extruder is 'divided' amongst the available stepper motors and it generates equations of motion for the motors in electrical signals. That's what I've learned so far by using a 3d printer. </p>
577
<p>How can I get programmatic access to the call stack?</p>
<p>Try <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx" rel="noreferrer">System.Diagnostics.StackTrace</a>.</p>
<p>The right way is to use the <code>StackTrace</code> and <code>StackFrame</code> classes. Throwing an exception just to get the stack trace is completely misusing exceptions.</p>
3,436
<p>I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly.</p> <p>I did some search to try to find a pythonic way to do this task. Generally I got quite much nothing - <a href="http://mail.python.org/pipermail/python-list/2000-March/028122.html" rel="noreferrer">this old discussion list link</a> has a way to check if domain exist. Quite not what I was looking for... But still, it was best anwser Google gave me - everything else is just a bunch of unanwsered questions.</p> <p>Any of you have succeeded to get some method up and running? I'd very much appreciate some tips, or should I just do it the opensource-way, sit down and code something by myself? :) </p>
<p>There's nothing wrong with using a command line utility to do what you want. If you put a nice wrapper around the service, you can implement the internals however you want! For example:</p> <pre><code>class Whois(object): _whois_by_query_cache = {} def __init__(self, query): """Initializes the instance variables to defaults. See :meth:`lookup` for details on how to submit the query.""" self.query = query self.domain = None # ... other fields. def lookup(self): """Submits the `whois` query and stores results internally.""" # ... implementation </code></pre> <p>Now, whether or not you roll your own using urllib, wrap around a command line utility (like you're doing), or import a third party library and use that (like <a href="https://stackoverflow.com/questions/50394#50423">you're saying</a>), this interface stays the same.</p> <p>This approach is generally not considered ugly at all -- <strong>sometimes command utilities do what you want and you should be able to leverage them</strong>. If speed ends up being a bottleneck, your abstraction makes the process of switching to a native Python implementation transparent to your client code.</p> <p><a href="http://www.python.org/dev/peps/pep-0020/" rel="nofollow noreferrer">Practicality beats purity</a> -- that's what's Pythonic. :)</p>
<pre><code>import socket socket.gethostbyname_ex('url.com') </code></pre> <p>if it returns a gaierror you know know it's not registered with any DNS</p>
7,319
<p>I get the concept of automatic bed leveling...the printer moves around the bed and uses a sensor to identify high and low spots, then "software compensates for differences". </p> <p>But what exactly does "compensates" mean? </p> <p>It is extruding more material in the low spots to build them up and thinning out the high spots? Is it adding or removing layers? Is it shifting layers as it goes up to compensate tilt? Or...? </p> <p>In what ways will this affect the final outcome? Would it be valid to say that if you wanted an automatically leveled bed and dimensional accuracy you should always print to a raft?</p>
<p>Last first: use of a raft has nothing to do with bed levelling. It depends only on the features/shape/etc of the object being printed.</p> <p>Now, as to what the auto-levelling does: the answer is, sadly "it depends." A simple algorithm will just find the Z-height of the four corners and apply a bilinear correction to Z as a function of {x,y} coordinates. A really good algorithm would map the entire build plate to some designated precision (perhaps 5 mm) and create a 2-dimensional lookup table to adjust Z over a curved build plate. What your printer's levelling software does is more likely the former. </p> <p>Why? because if you try to correct over curves &amp; bumps, then you will end up distorting your entire printed object (basically forcing every layer to follow those distorted axes). Far better to have some flattened or "fat" spots in the first layer printed, and then print proper planar layers after that. </p> <p>Example: I know my bed (AnetA8 aluminum) is slightly bowed, peak in the center; so after levelling the overall bed I try to set the Z-zero so the outer extremes of my object have good adhesion, even if the center region of the first couple layers ends up non-extruding because the nozzle touches the bed. </p>
<p>A probe or even manual (e.g. through LCD panel) leveling results in either a reference plane or mesh. This depends on the firmware and the options set in the firmware. Basically, this process maps the geometry of your build plate. Once it knows this geometry, printing an object results in the head following the height contours of the mapped build plate. Generally the following of the height contours is levelled out in the first few millimeters, which is also set in the firmware. This means that after a few millimeters of printing the height is not adjusted anymore, but is kept at a single level.</p>
1,017
<p>After a long time tweaking my new 3D printer I solved all the unexpected errors and I can print succesful pieces but I am facing a "problem", they are over sized, I found this problem trying to print a Raspberry Pi Case and an smartphone case, the printed pieces are bigger than the objects. </p> <p>Here some related information</p> <p><strong>Printer</strong>: Geeetech Prusa i3 Pro B</p> <p><strong>Firmware</strong>: <a href="https://github.com/amendezcabrera/geeetech-prusa-i3-pro-b-firmware" rel="noreferrer">My GitHub</a> (Marlin)</p> <p><strong>Software</strong>: Repetier Host with Slic3r</p> <p>Does somebody know how could I solve it? Thank you very much</p>
<p>You have to know:</p> <ul> <li>distance between belt teeth (usually 2mm)</li> <li>number of teeth on pulley</li> <li>motor step angle 1.8 deg?</li> <li>microstepping count, probably 16?</li> </ul> <p>Then you can enter all these numbers info the calculator here: <a href="https://www.prusaprinters.org/calculator/" rel="nofollow noreferrer">https://www.prusaprinters.org/calculator/</a></p>
<p>I finally solved it by manually adjusting the <code>steps per unit</code> in the printer firmware. </p> <p>The process is easy just move the extruder to one position and draw two marks, one at the extruder position and another one 10 cm in the X axis from the extruder position then with Repetier or with the the printer controls move the X axis 100 mm, if the extruder stops after the mark reduce the <code>steps per unit</code> or increase them if the extruder stops before the mark, do until the movement matches both marks. Repeat for the Y axis.</p> <p>You can see the changes I made to the firmware in my <a href="https://github.com/amendezcabrera/geeetech-prusa-i3-pro-b-firmware/commit/f6ba29998ccfd0dc0f0e2cba2c3ef3176f6e487f" rel="nofollow noreferrer">GitHub</a></p>
784
<p>Looking at the C# project templates in VS2008 and the offerings are WPF User Control Library, WPF Custom Control Library and Windows Forms Control Library. Which of these would you use if you wanted to move a legacy active control written in c++ into the world of C# and .NET?</p>
<p>It sounds like you are trying to do several different things all at once:</p> <ol> <li>Migrate your code to building in a newer version of visual studio.</li> <li>Migrate your use of technology to a newer technology (ActiveX to .net)</li> <li>Migrate your language (c++ to c#).</li> </ol> <p>If you have a small codebase you are probably as well to start from scratch and port functionality into the new codebase as required.</p> <p>For a larger codebase you need to realize that this is an expensive task both in effort and defect rate.</p> <p>An order might be:</p> <ol> <li>Import your code into the newer version of visual studio. Get it compiling. Review the project settings for each project.</li> <li>Refactor your code to isolate the mfc and activex code as much as possible. Follow good refactoring practices especially if don't have many unit tests before you start.</li> <li>Consider replacing your ActiveX layer with .net.</li> <li>Consider which GUI toolkit is best for replacing MFC.</li> <li>Language - consider moving first to managed c++.</li> <li>Consider moving from managed c++ to c#.</li> </ol> <p>Most importantly be able to justify doing all of the above!</p>
<p>There is no project template that will do this for you. You might as well read up and start with a usercontrol.</p>
7,924
<p>I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My question is what is the best way organize all the classes (such as buttons and textboxes) into one GUI class?</p> <p>Here's one way I thought of but it doesn't seem right:</p> <p><strong>Edit:</strong> I'm using C++.</p> <pre><code>class Gui { public: void update_all(); void draw_all() const; int add_button(Button *button); // Returns button id void remove_button(int button_id); private: Button *buttons[10]; int num_buttons; } </code></pre> <p>This code has a few problems, but I just wanted to give you an idea of what I want.</p>
<p>This question is very similar to one I was going to post, only mine is for Sony PSP programming.</p> <p>I've been toying with something for a while, I've consulted some books and <a href="http://www.3dbuzz.com/xcart/product.php?productid=30&amp;cat=12&amp;page=1" rel="nofollow noreferrer">VTMs</a>, and so far this is a rough idea of a simple ui systems.</p> <pre><code>class uiElement() { ... virtual void Update() = 0; virtual void Draw() = 0; ... } class uiButton() public : uiElement { ... virtual void Update(); virtual void Draw(); ... } class uiTextbox() public : uiElement { ... virtual void Update(); virtual void Draw(); ... } ... // Other ui Elements class uiWindow() { ... void Update(); void Draw(); void AddElement(uiElement *Element); void RemoveElement(uiElement *Element); std::list &lt;uiElement*&gt; Elements; ... } void uiWindow::Update() { ... for (list &lt;uiElement*&gt;::iterator it = Elements.begin(); it != Elements.end(); it++ ) it-&gt;Update(); ... } void uiWindow::Draw() { ... for (list &lt;uiElement*&gt;::iterator it = Elements.begin(); it != Elements.end(); it++ ) it-&gt;Draw(); ... } </code></pre> <p>The princple is to create a window and attact ui Elements to it, and call the draw and update methods from the respective main functions.</p> <p>I don't have anything working yet, as I have issues with drawing code. With different APIs on the PC and PSP, I'm looking at some wrapper code for OpenGL and psp gu. </p> <p>Hope this helps.</p> <p>thing2k</p>
<p>One useful strategy to keep in mind might be the <a href="http://en.wikipedia.org/wiki/Composite_pattern" rel="nofollow noreferrer">composite pattern</a>. At a low level, it might allow you to treat all GUI objects (and collections of objects) more easily once built. But I have no idea what's involved in GUI framework design, so one place to find general inspiration is in the source code of an existing project. <a href="http://www.wxwidgets.org/downloads/" rel="nofollow noreferrer">WxWidgets</a> is a cross-platform GUI framework with source available. Good luck with your project!</p>
2,902
<p>I'd like to make some custom MenuHeaders in WPF so I can have (for example), an icon and text in a menu item.</p> <p>Normally using MenuItems, if you populate the Header field with straight text, you can add an accelerator by using an underscore. eg, _File</p> <p>However, if I wanted to put in a UserControl, I believe this function would break, how would I do something similar to the following?</p> <pre><code>&lt;Menu&gt; &lt;MenuItem&gt; &lt;MenuItem.Header&gt; &lt;UserControl&gt; &lt;Image Source="..." /&gt; &lt;Label Text="_Open" /&gt; &lt;/UserControl&gt; &lt;/MenuItem.Header&gt; &lt;/MenuItem&gt; ... </code></pre>
<p>I think the Icon property fits your needs.<br> However to answer the original question, it is possible to retain the Accelerator functionality when you compose the content of your menuitem. <strong>If you have nested content in a MenuItem you need to define the AccessText property explicitly</strong> like in the first one below. When you use the inline form, this is automagically taken care of.</p> <pre><code> &lt;Menu&gt; &lt;MenuItem&gt; &lt;MenuItem.Header&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Image Source="Images/Open.ico" /&gt; &lt;AccessText&gt;_Open..&lt;/AccessText&gt; &lt;/StackPanel&gt; &lt;/MenuItem.Header&gt; &lt;/MenuItem&gt; &lt;MenuItem Header="_Close" /&gt; &lt;/Menu&gt; </code></pre>
<p>@a7an: Ah, I didn't notice the Icon property before. That's a good start.</p> <p>However, specifically I wanted to add an extra 'button' to some MenuItems so I could have a 'Pin' feature (see the recently loaded Documents list in Office 2007 for the feature idea).</p> <p>Since there needs to be code as well, will I probably need to subclass the control and add the code for the button? (Not affraid of messing with the MenuItem template, have already had to do it once and I'd do it again if I had to! ;) )</p>
8,406
<p>What is the proper way to give printer settings to CuraEngine? Is it possible to put all these settings into a file (like Json formatted)?</p> <pre><code>CuraEngine.exe -v -o "c:\3d\test.gcode" "c:\3d\test.stl" </code></pre>
<p>I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link, <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/settings/settings.cpp" rel="nofollow noreferrer"> CuraEngine/src/settings/settings.cpp</a> helpful. </p> <p>The latest release has more speed customization. You can change first layer speed, outer shell speed, inner shell speed, infill speed, and top and bottom speed.</p> <p>You can cut objects, its just a little wonky. In the advanced tab there is a "cut off object at Z height" that you can use to cut objects in half.</p> <p>Theoretically, you can put all settings into a JSON formatted file. </p>
<p>I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link, <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/settings/settings.cpp" rel="nofollow noreferrer"> CuraEngine/src/settings/settings.cpp</a> helpful. </p> <p>The latest release has more speed customization. You can change first layer speed, outer shell speed, inner shell speed, infill speed, and top and bottom speed.</p> <p>You can cut objects, its just a little wonky. In the advanced tab there is a "cut off object at Z height" that you can use to cut objects in half.</p> <p>Theoretically, you can put all settings into a JSON formatted file. </p>
213
<p>What Python libraries do folks use for querying Amazon product data? (Amazon Associates Web Service - used to be called E-Commerce API, or something along those lines).</p> <p>Based on my research, <a href="http://pyaws.sourceforge.net/" rel="noreferrer">PyAWS</a> seems okay, but still pretty raw (and hasn't been updated in a while). Wondering if there's an obvious canonical library that I'm just missing.</p>
<p>I'm using <a href="https://github.com/aurorasoftware/bottlenose">Bottlenose</a>, Dan Loewenherz's "super awesome Python wrapper for the Amazon Product Advertising API". It doesn't parse the XML, so I'm using <a href="http://codespeak.net/lxml/objectify.html">lxml.objectify</a>:</p> <pre><code>ACCESS_KEY_ID = "..." SECRET_KEY = "..." ASSOC_TAG = "..." import bottlenose amazon = bottlenose.Amazon(ACCESS_KEY_ID, SECRET_KEY, ASSOC_TAG) response=amazon.ItemLookup(ItemId="B0018AFK38", ResponseGroup="OfferSummary") from lxml import objectify root = objectify.fromstring(response) root.Items.Item.OfferSummary.LowestNewPrice.FormattedPrice </code></pre>
<p>pyaws is the best in my opinion. The most available version is 0.2.0, but there is also a version 0.3.0 that is somewhat harder to find. The best maintained version of it that I have found though, which is based on 0.3.0, is on <a href="http://bitbucket.org/johnpaulett/pyaws/overview/" rel="nofollow noreferrer">bitbucket</a>.</p>
7,130
<p>The company I work for has an old Access 2000 application that was using a SQL Server 2000 back-end. We were tasked with moving the back-end to a SQL Server 2005 database on a new server. Unfortunately, the application was not functioning correctly while trying to do any inserts or updates. My research has found many forum posts that Access 2000 -> SQL 2005 is not supported by Microsoft, but I cannot find any Microsoft documentation to verify that. </p> <p>Can anyone either link me to some official documentation, or has anyone used this setup and can confirm that this should be working and our problems lie somewhere else?</p> <p>Not sure if it matters, but the app is an ADP compiled into an ADE. </p>
<p>I've had a similar problem before when using ODBC linked tables to connect to an Sql Server. The solution was to relink the tables and specify the primary key to the table. If Access doesn't know the primary key it cannot perform inserts or updates.</p> <p>I haven't any experience with ADPs but it could be a similar thing, theres a knowledge base article about it here <a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B235267&amp;x=15&amp;y=13" rel="nofollow noreferrer">http://support.microsoft.com/?scid=kb%3Ben-us%3B235267&amp;x=15&amp;y=13</a></p>
<p>I'd say check the VBA in the Macros to see how it is doing it. It is probably using some form of VB connection to the Database in the back. I love the fact a Database is contacting a Database for it's data... :)</p>
3,588
<p>What is the best way to localise a date format descriptor?</p> <p>As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation support, so it's trivial to parse dates according to the users culture, but you often want to also display a helpful hint as to the format required (especially to distinguish between yy and yyyy which is interchangeable in most cultures).</p> <p>What is the best way to do this in a way that make sense to most users (e.g. dd/M/yyy is confusing because of the change in case and the switching between one and two letters).</p>
<p>Here is my current method. Any suggestions?</p> <pre><code>Regex singleMToDoubleRegex = new Regex("(?&lt;!m)m(?!m)"); Regex singleDToDoubleRegex = new Regex("(?&lt;!d)d(?!d)"); CultureInfo currentCulture = CultureInfo.CurrentUICulture; // If the culture is netural there is no date pattern to use, so use the default. if (currentCulture.IsNeutralCulture) { currentCulture = CultureInfo.InvariantCulture; } // Massage the format into a more general user friendly form. string shortDatePattern = CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern.ToLower(); shortDatePattern = singleMToDoubleRegex.Replace(shortDatePattern, "mm"); shortDatePattern = singleDToDoubleRegex.Replace(shortDatePattern, "dd"); </code></pre>
<p><strong>Best option</strong>: I would instead recommend to use a standard date picker.</p> <p><strong>Alternative</strong>: every time the content of the edit control changes, parse it and display (in a separate control?) the long format of the date (ie: input "03/04/09" display "Your input: March 4, 2009")</p>
2,318
<p>I fired up my printer again last night to print something (Printrbot LC that I have customized), and happened to notice the Octopi instance still had a file that I printed ~5 years ago. Also, I noticed i had files from ~2013 when I got started. My printer is from that time, so keep that in mind.</p> <p>I've noticed that sometimes I will see a Y axis shift, and then the print will correct itself. It did it again last night. Since this had happened before, I thought maybe the wires for the heated beds were getting snagged on something, so I made sure they were out of the way, and made sure they had proper strain relief before printing <a href="https://www.thingiverse.com/thing:3086428/files" rel="nofollow noreferrer">this thing</a>.</p> <p>However, about 1 cm up the Z axis, my print had a 1-2 mm shift of the Y axis for ~2-3 mm, and then corrected* itself somehow.</p> <h2><strong>The Question</strong></h2> <p>What is this kind of problem called? What should I look for to try to troubleshoot it? Let's make sure to include the possibility that one of my upgrades has gone awry to leave no stone unturned.</p> <h2>Stay on Target</h2> <p>My printer probably also has other problems, and that's fine to point them out after addressing my primary concern.</p> <p>*Almost completely corrected itself. Maybe .5-1 mm off.</p> <h2>This is the print.</h2> <p>It'll be serviceable after some filing. It's from this thing.</p> <p><a href="https://i.stack.imgur.com/hNd6N.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hNd6N.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/JY1sE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JY1sE.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/7N2kh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7N2kh.jpg" alt="enter image description here" /></a></p> <h2>This is my printer</h2> <p><a href="https://i.stack.imgur.com/VGxe3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VGxe3.jpg" alt="enter image description here" /></a></p> <h2>Upgrades</h2> <ul> <li>Printrbot LC, I want to say I bought in 2010. It was a kit and I assembled it.</li> <li>This pic is from 2014 and it's about the same.</li> <li>I've extended the physical Z height, but supposedly the firmware needs to be updated to make use of it. I would still need to adjust the wiring too.</li> <li>I've extended the Y axis (front to back).</li> <li>As part of extending the Y axis, I added a 2nd heated bed. It's not plugged in, and I only use the one which is the one closest to the camera. There is room for a 3rd bed, but that was an accidental bit of engineering.</li> <li>There was a lot of bow in the bed, even with the added support. I manually adapted <a href="https://www.thingiverse.com/thing:55053" rel="nofollow noreferrer">this thing</a> to add in a bearing to support the bed near where the hotend was. Manually with a dremel, super glue, etc.</li> <li>I have noticed a clicking where the support bearing touches a screw holding the aluminum rail to the wood, but that would only impact prints for the second bed. The print I am asking about was in the middle of the primary bed, and far away from this.</li> <li>I updated the belt and pulley to the G2(?) belts. Those are standard now, but this was an upgrade for this bot.</li> <li>I added an additional support bearing for the hotends, which reduced the X axis slightly.</li> <li>Added fans for the part and the incoming filament.</li> </ul> <h2>Misc</h2> <ul> <li>Bed is manually leveled by adjusting screws and nuts</li> <li>Glass is held to the bed by small aligator clips</li> <li>I print on bare glass with purple glue</li> <li>I am using PLA+, hotend at 220 °C, and bed at 60 °C</li> <li>I have an old version of OctoPi on a Raspberry Pi 1 controlling the printer</li> <li>I sliced last night with Cura 4.1.0</li> <li>I use 3 mm filament</li> <li>Printer has a .4 or .5 mm hotend, whatever was stock (I don't recall, and I don't see the setting in Cura)</li> <li>Printing at .2 mm height</li> <li>I have noticed some wear on the 3D printed gears for the extruder, but they still seem to be working. I've been meaning to print some spares, and have printed a spare bigger one in case they fail.</li> <li>The printer has wooden 1x4 supports in one corner, so none of the PVC cage moves at all now. It didn't move much before unless I was pushing on it.</li> <li>I printed and screwed in some stops that go around the feet of the printer to prevent it from moving around.</li> <li>The printer is very rigid with the above feet stops, the wooden supports, and the ~20lb roll of filament on top of the Z axis.</li> <li>The y axis has some friction and some spots are tighter than others, so I will keep looking at the mechanics of the bed to see what I can do.</li> </ul> <h2>Things I have tried so far</h2> <ul> <li>Tried multiple things at a time, because screw science lol. Close to order of operations below, but not perfect.</li> <li>Upgraded Cura to 4.5.0</li> <li>Printed multiple times. Still have the problem.</li> <li>Rotated print by 180 degrees. Same problem in same direction, at same height. Towards the Y axis zero.</li> <li>Adjusted flow to 97%, so now I'm not overextruding. The screw holes come out as screw holes, and the top surface looks mostly normal. Once I'm done with this print, I might try 95%.</li> <li>Cut a zip tie that may have been catching on bed clips.</li> <li>Added more clips to hold the glass to the bed. Removed old clips that were worn out and may have been impacting the gantry.</li> <li>Adjusted the tension on the screw that holds the bed and the guide rods, to reduce friction of the guide rods and their bearings. This reduced friction, but did not have an effect on the print.</li> <li>Rotated print by 90 degrees. Same problem in same direction, at same height.</li> <li>Watched the printer as it was printing the strange part. There were no mechanical collisions, and things seemed normal.</li> </ul> <h2>More thoughts</h2> <ul> <li>I will look into spinning up a new Octoprint server on a newer Raspberry Pi to see if that helps.</li> <li>I am having a hard time finding examples of layer shift that didn't 100% kill the print. The fact that this corrects itself makes me think it's not the usual mechanical problems associated with layer shift.</li> <li>I have added the other thing to the print (from the same designer and thing page), and we'll see if they both have the problem, or what else might happen.</li> </ul> <h2>Updated pics</h2> <p><a href="https://i.stack.imgur.com/OJzOR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OJzOR.jpg" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/9tVqp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9tVqp.jpg" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/Yd97B.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yd97B.jpg" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/QPShI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QPShI.jpg" alt="enter image description here" /></a></p>
<p>This is clearly overextrusion relative to the volume the material is being deposited into, but that doesn't necessarily mean your extrusion rate is wrong. It could be:</p> <ul> <li>Nozzle smashed down into the bed (bed way too high) but somehow still extruding</li> <li>Problem in Z axis movement preventing the head from moving up the right amount for each layer (possibly not moving up at all?)</li> <li>Extrusion (flow) increased significantly above 100% in slicer</li> <li>Wrong extruder steps/mm setting (usually controlled on printer not slicer, though you can send a setting in the start gcode)</li> <li>Misconfigued filament diameter (unlikely since there's no common setting smaller than 1.75 mm; larger setting would under-extrude)</li> </ul>
<p>Bad filament is my answer. I bought PRLine and both print terrible like your picture. Suspect 2 factors, one is that the line is less than 1.75, so they underextrude and so you see those lines and in some cases gaps, second is the material itself is slippery suggesting to me that it has florinated additives.</p>
1,623
<p>I've noticed that after my Anet A8 completes a print, the right hand Z mount ends up 1-2&nbsp;mm lower than the left, even though I make sure both the left and right hand Z mounts of the X-axis are at the same height before switching on the printer.</p> <p>Does anyone know what the cause of this might be?</p> <p>I'm guessing something is causing the right hand Z to skip steps. I can't see or hear any obvious mechanical issues. I checked all guide and threaded rods were straight before assembly. </p> <p>Could it be a faulty stepper or control electronics?</p>
<p>My guess is your Z guides are not strictly parallel because there's no instruction how to install X guides correctly. When you install X guides, you can easily make horizontal distance between two Z-mounts either too small or too large, which puts extra stress on one of the Z motors. Move your extruder to home position, measure distance between bottom ends of Z threaded rods and between top ends, and try to adjust right Z-mount position on X guides so that these two distances become equal. Use hammer, but be accurate with plastic.</p>
<p>Try winding the Z axis all the up and down a few times using the front panel controls. Does it still go out of alignment? Is it out of alignment at the top? Does it come back into alignment when you wind it back down?</p> <p>The principle is: if you have a dodgy motor drive chip, or a mechanical fault, it will skip some steps on the way up and the two motors will be out of synch. Then, on the way back down, it will skip an (approximately equal) number of steps and the motors will return to something resembling similar places.</p>
619
<p>I need to test a serial port application on Linux, however, my test machine only has one serial port. </p> <p>Is there a way to add a virtual serial port to Linux and test my application by emulating a device through a shell or script?</p> <p>Note: I cannot remap the port, it hard coded on ttys2 and I need to test the application as it is written.</p>
<p>Complementing the @slonik's answer.</p> <p>You can test socat to create Virtual Serial Port doing the following procedure (tested on Ubuntu 12.04):</p> <p><strong>Open a terminal (let's call it Terminal 0) and execute it:</strong></p> <pre><code>socat -d -d pty,raw,echo=0 pty,raw,echo=0 </code></pre> <p><strong>The code above returns:</strong></p> <pre><code>2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/2 2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/3 2013/11/01 13:47:27 socat[2506] N starting data transfer loop with FDs [3,3] and [5,5] </code></pre> <p><strong>Open another terminal and write (Terminal 1):</strong></p> <pre><code>cat &lt; /dev/pts/2 </code></pre> <p>this command's port name can be changed according to the pc. it's depends on the previous output.</p> <pre><code>2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/**2** 2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/**3** 2013/11/01 13:47:27 socat[2506] N starting data transfer loop with FDs </code></pre> <p>you should use the number available on highlighted area.</p> <p><strong>Open another terminal and write (Terminal 2):</strong></p> <pre><code>echo "Test" &gt; /dev/pts/3 </code></pre> <p>Now back to Terminal 1 and you'll see the string "Test".</p>
<p>Combining all other amazingly useful answers, I found the below command to be VERY useful for testing on different types of Linux distros where there's no guarantee you're <a href="https://unix.stackexchange.com/questions/590302/getting-the-virtual-comport-addr-from-socat-command-with-grep?newreg=03ecb0aa86ea426d847f58952f48aa1b">going to get the same /dev/pts/#'s every time</a> and/or you need to test multiple psuedo serial devices and connections at once.</p> <pre><code>parallel 'i=&quot;{1}&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty{1} pty,raw,echo=0,link=$HOME/pty$(($i+1))' ::: $(seq 0 2 3;) </code></pre> <p>Breaking this down:</p> <p><code>parallel</code> runs the same command for each argument supplied to it. So for example if we run it with the <code>--dryrun</code> flag it gives us:</p> <pre><code>i=&quot;0&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty0 pty,raw,echo=0,link=$HOME/pty$(($i+1)) i=&quot;2&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty2 pty,raw,echo=0,link=$HOME/pty$(($i+1)) </code></pre> <p>This is due to the <code>$(seq x y z;)</code> at the end, where x = start #, y = increment by, and z = end # (or # of devices you need to spawn)</p> <p><code>parallel 'i=&quot;{1}&quot;; echo &quot;make psuedo_devices {1} $(($i+1))&quot;' ::: $(seq 0 2 3;)</code></p> <p>Outputs:</p> <pre><code>make psuedo_devices 0 1 make psuedo_devices 2 3 </code></pre> <p>Gathering all this together the final above command symlinks the proper psuedo devices together regardless of whats in /dev/pts/ to whatever directory supplied to socat via the <code>link</code> flag.</p> <p><code>pstree -c -a $PROC_ID</code> gives:</p> <pre><code>perl /usr/bin/parallel i=&quot;{1}&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty{1} pty,raw,echo=0,link=$HOME/pty$(($i+1)) ::: 0 2 ├─bash -c i=&quot;0&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty0 pty,raw,echo=0,link=$HOME/pty$(($i+1)) │ └─socat -d -d pty,raw,echo=0,link=/home/user/pty0 pty,raw,echo=0,link=/home/user/pty1 └─bash -c i=&quot;2&quot;; socat -d -d pty,raw,echo=0,link=$HOME/pty2 pty,raw,echo=0,link=$HOME/pty$(($i+1)) └─socat -d -d pty,raw,echo=0,link=/home/user/pty2 pty,raw,echo=0,link=/home/user/pty3 </code></pre> <p>ls -l $HOME/pty* yield:</p> <pre><code>lrwxrwxrwx 1 user user 10 Sep 7 11:46 /home/user/pty0 -&gt; /dev/pts/4 lrwxrwxrwx 1 user user 10 Sep 7 11:46 /home/user/pty1 -&gt; /dev/pts/6 lrwxrwxrwx 1 user user 10 Sep 7 11:46 /home/user/pty2 -&gt; /dev/pts/7 lrwxrwxrwx 1 user user 10 Sep 7 11:46 /home/user/pty3 -&gt; /dev/pts/8 </code></pre> <p>This was all because I was trying running tests against a platform where I needed to generated a lot of mach-serial connections and to test their input/output via containerization (Docker). Hopefully someone finds it useful.</p>
7,545
<p>Is it "taboo" to programatically create system restore points? I would be doing this before I perform a software update. If there is a better method to create a restore point with just my software's files and data, please let me know.</p> <p>I would like a means by which I can get the user back to a known working state if everything goes kaput during an update (closes/kills the update app, power goes out, user pulls the plug, etc.)</p> <pre><code> private void CreateRestorePoint(string description) { ManagementScope oScope = new ManagementScope("\\\\localhost\\root\\default"); ManagementPath oPath = new ManagementPath("SystemRestore"); ObjectGetOptions oGetOp = new ObjectGetOptions(); ManagementClass oProcess = new ManagementClass(oScope, oPath, oGetOp); ManagementBaseObject oInParams = oProcess.GetMethodParameters("CreateRestorePoint"); oInParams["Description"] = description; oInParams["RestorePointType"] = 12; // MODIFY_SETTINGS oInParams["EventType"] = 100; ManagementBaseObject oOutParams = oProcess.InvokeMethod("CreateRestorePoint", oInParams, null); } </code></pre>
<blockquote> <p>Is it "taboo" to programatically create system restore points?</p> </blockquote> <p>No. That's why the API is there; so that you can have pseudo-atomic updates of the system.</p>
<p>I don't think a complete system restore would be a good plan. Two reasons that quickly come to mind:</p> <ul> <li>Wasted disk space</li> <li>Unintended consequences from a rollback</li> </ul>
5,284
<p>I know this sounds like a point-whoring question but let me explain where I'm coming from.</p> <p>Out of college I got a job at a PHP shop. I worked there for a year and a half and thought that I had learned all there was to learn about programming.</p> <p>Then I got a job as a one-man internal development shop at a sizable corporation where all the work was in C#. In my commitment to the position I started reading a ton of blogs and books and quickly realized how wrong I was to think I knew everything. I learned about unit testing, dependency injection and decorator patterns, the design principle of loose coupling, the composition over inheritance debate, and so on and on and on - I am still very much absorbing it all. Needless to say my programming style has changed entirely in the last year.</p> <p>Now I find myself picking up a php project doing some coding for a friend's start-up and I feel completely constrained as opposed to programming in C#. It really bothers me that all variables at a class scope have to be referred to by appending '$this->' . It annoys me that none of the IDEs that I've tried have very good intellisense and that my SimpleTest unit tests methods have to start with the word 'test'. It drives me crazy that dynamic typing keeps me from specifying implicitly which parameter type a method expects, and that you have to write a switch statement to do method overloads. I can't stand that you can't have nested namespaces and have to use the :: operator to call the base class's constructor.</p> <p>Now I have no intention of starting a PHP vs C# debate, rather what I mean to say is that I'm sure there are some PHP features that I either don't know about or know about yet fail to use properly. I am set in my C# universe and having trouble seeing outside the glass bowl.</p> <p>So I'm asking, what are your favorite features of PHP? What are things you can do in it that you can't or are more difficult in the .Net languages?</p>
<p><strong>Documentation</strong>. The <a href="http://www.php.net/manual/en/" rel="noreferrer">documentation</a> gets my vote. I haven't encountered a more thorough online documentation for a programming language - everything else I have to piece together from various websites and man pages.</p>
<p>Boolean casting, which is particularly helpful for redwall_hp's first example, above.</p> <p>Instead of:</p> <pre><code>$var = ($_POST['my_checkbox']=='checked') ? TRUE : FALSE; </code></pre> <p>You can type:</p> <pre><code>$var = !!($_POST['my_checkbox']=='checked'); </code></pre>
8,661
<p>Imagine an object you are working with has a collection of other objects associated with it, for example, the Controls collection on a WinForm. You want to check for a certain object in the collection, but the collection doesn't have a <code>Contains()</code> method. There are several ways of dealing with this.</p> <ul> <li>Implement your own <code>Contains()</code> method by looping through all items in the collection to see if one of them is what you are looking for. This seems to be the "best practice" approach.</li> <li>I recently came across some code where instead of a loop, there was an attempt to access the object inside a try statement, as follows:</li> </ul> <blockquote> <pre><code>try { Object aObject = myCollection[myObject]; } catch(Exception e) { //if this is thrown, then the object doesn't exist in the collection } </code></pre> </blockquote> <p>My question is how poor of a programming practice do you consider the second option be and why? How is the performance of it compared to a loop through the collection?</p>
<p>I would have to say that this is pretty bad practice. Whilst some people might be happy to say that looping through the collection is less efficient to throwing an exception, there is an overhead to throwing an exception. I would also question why you are using a collection to access an item by key when you would be better suited to using a dictionary or hashtable.</p> <p>My main problem with this code however, is that regardless of the type of exception thrown, you are always going to be left with the same result.</p> <p>For example, an exception could be thrown because the object doesn't exist in the collection, or because the collection itself is null or because you can't cast myCollect[myObject] to aObject.</p> <p>All of these exceptions will get handled in the same way, which may not be your intention.</p> <p>These are a couple of nice articles on when and where it is usally considered acceptable to throw exceptions:</p> <ul> <li><a href="http://codebetter.com/blogs/karlseguin/archive/2008/05/29/foundations-of-programming-pt-8-back-to-basics-exceptions.aspx" rel="nofollow noreferrer">Foundations of Programming</a></li> <li><a href="http://www.blackwasp.co.uk/CSharpThrowingExceptions.aspx" rel="nofollow noreferrer">Throwing exceptions in c#</a></li> </ul> <p>I particularly like this quote from the second article:</p> <blockquote> <p>It is important that exceptions are thrown only when an unexpected or invalid activity occurs that prevents a method from completing its normal function. Exception handling introduces a small overhead and lowers performance so should not be used for normal program flow instead of conditional processing. It can also be difficult to maintain code that misuses exception handling in this way.</p> </blockquote>
<p>The latter is an acceptable solution. Although I would definitely catch on the specific exception (ElementNotFound?) that the collection throws in that case.</p> <p>Speedwise, it depends on the common case. If you're more likely to find the element than not, the exception solution will be faster. If you're more likely to fail, then it would depend on size of the collection and its iteration speed. Either way, you'd want to measure against normal use to see if this is actually a bottle neck before worrying about speed like this. Go for clarity first, and the latter solution is far more clear than the former.</p>
2,977
<p>I discovered <a href="http://en.wikipedia.org/wiki/Template_metaprogramming" rel="noreferrer">template metaprogramming</a> more than 5 years ago and got a huge kick out of reading <a href="https://rads.stackoverflow.com/amzn/click/com/0201704315" rel="noreferrer" rel="nofollow noreferrer">Modern C++ Design</a> but I never found an opertunity to use it in real life.</p> <p>Have <em>you</em> ever used this technique in real code?</p> <blockquote> <p>Contributors to <a href="http://www.boost.org/" rel="noreferrer">Boost</a> need not apply ;o)</p> </blockquote>
<p>I once used template metaprogramming in C++ to implement a technique called "symbolic perturbation" for dealing with degenerate input in geometric algorithms. By representing arithmetic expressions as nested templates (i.e. basically by writing out the parse trees by hand) I was able to hand off all the expression analysis to the template processor. </p> <p>Doing this kind of thing with templates is more efficient than, say, writing expression trees using objects and doing the analysis at runtime. It's faster because the modified (perturbed) expression tree is then available to the optimizer at the same level as the rest of your code, so you get the full benefits of optimization, both within your expressions but also (where possible) between your expressions and the surrounding code.</p> <p>Of course you could accomplish the same thing by implementing a small DSL (domain specific language) for your expressions and the pasting the translated C++ code into your regular program. That would get you all the same optimization benefits and also be more legible -- but the tradeoff is that you have to maintain a parser.</p>
<p>Many programmers don't use templates much because of the poor compiler support up until recently. However, while templates have had a lot of issues in the pas, newer compilers have much better support. I write code that has to work with GCC on Mac and Linux as well as Microsoft Visual C++ and it's only with GCC 4 and VC++ 2005 that these compiler have supported the standard really well. </p> <p>Generic programming via templates is not something you need all the time but is definitely a useful code to have in your toolbox.</p> <p>The obvious example container classes but templates are also useful for many other things. Two examples from my own work are:</p> <ul> <li>Smart pointers ( e.g. Reference-counted, copy-on-write, etc.)</li> <li>Math support classes such as Matrices, vectors, splines, etc. that need to support a variety of data types and still be efficient.</li> </ul>
8,895
<p>I'm looking for a post processing method for increasing the functional strength of a 3d printed part originally made by FDM. I've tried printing my part with solid infill but the layer separation is still the primary failure point. I'm looking for a way to get something closer to a cast or injection molded part. Obviously less strength but there is a pretty big gap in material properties.</p> <p>The only method I've thought of that might work is drilling a small hole, or series of holes in my part to inject an epoxy into the part. Haven't tried it.</p> <p>I'm open to any possible ideas or advice if someone has tried something like this. Not sure if this is necessarily the best place but thought it's a good place to start.</p>
<p>Recognizing that the posting party feels that FDM constructed parts are of insufficient strength for his purpose and allowing for proper layer bonding, one can understand that the model can be perfectly constructed and not reach the strength objective.</p> <p>Filling a model with an epoxy or a casting resin will provide additional strength. Testing smaller, non-critical models is recommended to determine the level of increase. The design has to be re-engineered to provide for resin/epoxy flow within the model. Some epoxy and resin formulations generate heat when curing and may soften the model. The solution in such cases is to mix and pour small amounts, allowing for a pause between pours.</p> <p>An alternative to filling a model is to reduce the perimeter (if applicable) and apply a reinforcing layer. I've constructed satisfactorily printed models with insufficient strength for my purposes, but then applied fiberglass cloth and epoxy resin to the outside. A single layer provided the necessary strength in my case.</p> <p>One could apply sufficient layers to provide all the necessary strength, effectively turning the model into a positive mold. This is commonly done with amateur-built aircraft of the Burt Rutan design style. More recently, an article appeared on the internet of a model being printed with wash-away support material only, covered in carbon fiber. The wash-away was washed away and the wing structure became the product. For your application, it may not be necessary or practical to remove the inner model.</p> <p>Just as with the injection concept, one must re-engineer the model to allow for this type of reinforcement. Edges will have to be radiused or the sharp termination of reinforcement layer will become a weak point. Tight inside angles will have a similar problem.</p> <p>Fiberglass cloth comes in various weights, measured in ounces per square foot (US). The lighter cloth is more capable of "turning corners" and fitting into tight angles.</p>
<p>Layer separation will always be the primary failure point of FDM. So your best action would be to design parts in such a way that forces are applied across the Z axis, not along it. </p> <p>If layer bonding is too weak, this is a problem that should be solved during printing. Possible reasons are: </p> <ul> <li>Nozzle temperature too low</li> <li>Filament contains moisture from the air</li> <li>Filament covered with dust</li> <li>Inappropriate ratio of nozzle diameter/layer height. We usually use 2 (0.4 nozzle for 0.2 layer) while theory suggests it should be more than 3.</li> <li>Inappropriate cooling of part during printing, drafts. </li> </ul> <p>If all this things are set right, no post-process treatment will improve the part. If not, you could reduce inner tensions by blasting the part with hot air gun, but it is better to solve the problem, not the consequences. </p>
544
<p>I am using Apache Axis to connect my Java app to a web server. I used wsdl2java to create the stubs for me, but when I try to use the stubs, I get the following exception:</p> <blockquote> <p>org.apache.axis.ConfigurationException: No service named <code>&lt;web service name&gt;</code> is available</p> </blockquote> <p>any idea?</p>
<p>According to the <a href="http://wiki.apache.org/ws/FrontPage/Axis/DealingWithCommonExceptions">documentation</a> linked to by @arnonym, this exception is somewhat misleading. In the first attempt to find the service a ConfigurationException is thrown and caught. It is logged at DEBUG level by the ConfigurationException class. Then another attempt is made using a different method to find the service that may then succeed. The workaround for this is to just change the log level on the ConfigurationException class to INFO in your log4j.properties:</p> <pre><code>log4j.logger.org.apache.axis.ConfigurationException = INFO </code></pre>
<p>This is what my code looks like. It seems to work fine. Are you using a service locator or just creating your service?</p> <pre><code>SomeServiceLocator locator = new SomeServiceLocator(); SomeService service = null; try { service = locator.getSomeServiceImplPort(); } catch (ServiceException e) { e.printStackTrace(); } </code></pre>
9,107
<p>I have had my Ender 3 v2 for just over two months and have had a blast working with it. I have printed some mods to personalize it.</p> <p>One of the things that I have done to help mitigate the vibrational noise is to place my Ender 3 on a concrete paver that sits on top of 3 inches of upholstery foam. This has made a huge difference.</p> <p>With the vibration noise down, now I can hear the fan on the extruder like never before.</p> <p>Both fans are listed as &quot;brushless&quot; EFS-04D24L; of course, they look different in the pictures below:</p> <p><a href="https://i.stack.imgur.com/3xxsc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3xxsc.jpg" alt="Fans label side" /></a></p> <p><a href="https://i.stack.imgur.com/CDnem.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CDnem.jpg" alt="Fans back side" /></a></p> <p>What options are there to help reduce the fan noise? I wasn't sure if a baffle or enclosure would help. Or would it be easier to replace the fans with quieter ones?</p>
<p>There are companies making fans with blade design based on owl wings to make the blades quieter. Here's an example <a href="https://www.moduflow.co.uk/owlet-fans/" rel="nofollow noreferrer">https://www.moduflow.co.uk/owlet-fans/</a> and I've seen other designs. I don't know which design ended up being the quietest. First, you would need to find out who makes these fans the right size and flow rate for you, then try to find out which is quietest.</p> <p>Here is another example: <a href="https://www.bequiet.com/en/casefans/718" rel="nofollow noreferrer">https://www.bequiet.com/en/casefans/718</a></p>
<p>Fans driven by brushless (BLDC or BL) motors<sup>1</sup> are the quieter option (when compared to cheaper brushed motors).</p> <p>Mounting the fans using rubber anti-vibration standoffs/mounts<sup>2</sup>, instead of bolts, would also reduce vibration (and hence noise).</p> <p><a href="https://i.stack.imgur.com/rRS7h.jpg" rel="nofollow noreferrer" title="Rubber anti-vibration mounts"><img src="https://i.stack.imgur.com/rRS7h.jpg" alt="Rubber anti-vibration mounts" title="Rubber anti-vibration mounts" /></a></p> <p>Or, failing that, if using bolts, at least use rubber washers/grommets, between the fan case and the frame/mount (maybe on both sides - frame side and bolt head side).</p> <p>A baffle or enclosure <em>would</em> reduce the noise, but would also reduce airflow, which may not be desirable, and even detrimental to the cooling, and longevity of the electronics (assuming your fans are cooling a RAMPS board, or whatever).</p> <p>Alternatively (and I don't necessarily recommend these courses of action):</p> <ul> <li>Put up with the noise. After a while, you'll get used to it, or become sufficiently deaf, so as not to hear it so much;</li> <li>Try to reduce the <em>number</em> of fans somehow. Maybe use passive cooling more - using larger heatsinks on active electronic devices maybe remove the requirement for a fan altogether.</li> </ul> <hr /> <h3>Footnotes</h3> <p><sup>1</sup> Also known as electronically commutated (EC) motor and synchronous DC motors. Source: <a href="https://en.wikipedia.org/wiki/Brushless_DC_electric_motor" rel="nofollow noreferrer">Wikipedia</a></p> <p><sup>2</sup> Also known as pin, rivet, nipple, peg, etc.</p>
1,873
<p>Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?</p> <p>Edit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their 'add' page. I want to be able to create a link/button on my site's page that will fill in those values and submit the info without having to copy/paste them across and click the submit button.</p> <p>Further clarification: How do automated spam bots fill out forms and click the submit button if they were written in C#?</p>
<p>The code will look something like this: </p> <pre><code>WebRequest req = WebRequest.Create("http://mysite/myform.aspx"); string postData = "item1=11111&amp;item2=22222&amp;Item3=33333"; byte[] send = Encoding.Default.GetBytes(postData); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = send.Length; Stream sout = req.GetRequestStream(); sout.Write(send, 0, send.Length); sout.Flush(); sout.Close(); WebResponse res = req.GetResponse(); StreamReader sr = new StreamReader(res.GetResponseStream()); string returnvalue = sr.ReadToEnd(); </code></pre>
<p>I had a situation where I needed to post free text from a html textarea programmatically and I had issues where I was getting <code>&lt;br /&gt;</code> in my param list i was building.</p> <p>My solution was a replace of the br tags with linebreak characters and htmlencoding just to be safe.</p> <pre><code>Regex.Replace( HttpUtility.HtmlDecode( test ), "(&lt;br.*?&gt;)", "\r\n" ,RegexOptions.IgnoreCase); </code></pre>
4,650
<p>When I want to make a copy of a database, I always create a new empty database, and then restore a backup of the existing database into it. However, I'm wondering if this is really the least error-prone, least complicated, and most efficient way to do this?</p>
<p>It is possible to skip the step of creating the empty database. You can create the new database as part of the restore process.</p> <p>This is actually the easiest and best way I know of to clone a database. You can eliminate errors by scripting the backup and restore process rather than running it through the SQL Server Management Studio</p> <p>There are two other options you could explore:</p> <ol> <li>Detach the database, copy the .mdf file and re-attach.</li> <li>Use SQL Server Integration Services (SSIS) to copy all the objects over</li> </ol> <p>I suggest sticking with backup and restore and automating if necessary.</p>
<p>The <strong>Publish to Provider</strong> functionality has worked great for me. See <a href="http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx" rel="nofollow noreferrer">Scott Gu's Blog Entry</a>.</p> <p>If you need something really robust look at redgate software's tools <a href="http://www.red-gate.com/" rel="nofollow noreferrer">here</a>...if you are doing much SQL at all, these are worth the $$.</p>
2,392
<p>I've never gotten a 3D printer, nor do I know very much about them, but I'm thinking of buying a delta 3D printer kit for around $450. When I looked online of some disadvantages of Delta printers I found that they typically don't have Bowden extruders. I'm wondering what are the advantages of a Bowden extruder and should I spend more money in a 3D printer just to get one.</p>
<p>My FLSUN Kossel 3D Delta printer ($224) has a bowden extruder. It works really well too.</p> <p>The main advantage of having one is that it reduces the mass of the hot end. That means less inertia, and it's easier on the driver motors as well. All this leads to (hopefully) greater and more precise control at the extruder tip, and, best of all, faster printing.</p>
<p>The only advantage of Bowden extruder is a reduced mass of moving parts attached to the effector.</p> <p>All other differences from direct extruder are to the Bowden's disadvantages. Generally speaking, Bowden-type extruder has much worse control of filament extrusion than direct one.</p> <p>Since most of the modern consumer-grade printers suffer from low rigidity, reducing mass seems as a good trade-off to the printers' manufacturers.</p> <p>Unfortunately, for the Delta printers trading speed for quality may not be so effective. Delta construction is used with the only goal to achieve highest possible speed of printing. As a contrary, Bowden extruder becomes less precise with the speed increase. This makes it unreasonable to increase print speed at some point when printing quality degrades below acceptable.</p> <p>As a result, at this moment of time, Delta printers with Bowden extruder is a clear sign of under-performing device.</p> <p>To answer your question: there is no reason to pay extra for the Delta printer with Bowden extruder, although I doubt that a printer with similar characteristics and a direct extruder would be cheaper.</p>
561
<p>I have a very specific problem using C# and a Windows MDI Form application. I want to display two (or more) images to the user, a 'left' and a 'right' image. The names of the images are concealed from the user, and then the user selects which image they prefer (this is part of a study involving medical image quality, so the user has to be blinded from possibly relevant capture parameters which might be revealed in the image name). Instead of showing the actual names, substitute names like 'image 0' and 'image 1' (etc) are shown to the user.</p> <p>Whenever I use the standard <code>MDILayout.TileVertical</code> or <code>TileHorizontal</code>, the images are loaded in reverse order. For example, if I have image 0 and image 1, they are displayed </p> <p>Image 1 Image 0</p> <p>Three or more images would be something like</p> <p>2 1 0</p> <p>or</p> <p>3 2</p> <p>1 0</p> <p>And so forth. The problem is, my users are confused by this right to leftness, and if I have another dialog box that asks them which image is better (or to rate the displayed images), they always confuse the order of images on the screen with the order of images in the dialog box. That is, if I just order the images 0 1 2 3 etc in a ratings dialog, they assume that image 3 as it's displayed is image 0 in the MDI parent window, image 2 is image 1, etc-- they read left to right, and the images are being displayed right to left. If I reorder the tabs in the ratings dialog box to reflect the order on the screen, that just confuses them further ("Why is image 3 before image 2?") and the results come out in the wrong order, and are generally unusable.</p> <p>So, how do I force the ordering of displayed windows using <code>MDILayout</code> in <code>C#</code>? Do I have to do it by hand, or is there some switch I can send to the layout manager?</p> <p>Thanks!</p>
<p>Why are you using an MDI interface? Surely a single window with a TableLayoutPanel or similar providing layout would be more suitable. The only reason you'd want to use a MDI layout is to allow the users to move the windows, which as far as I can tell from your description of the problem isn't desirable anyway?</p>
<p>Could you avoid this problem by (before displaying the images) you:</p> <ol> <li><p>Put the image references in a structure (array or similar).</p></li> <li><p>Have a recursive function build a reverse order structure (or reorder the original).</p></li> <li><p>Use the new reversed order structure to build your child windows as before.</p></li> </ol> <p>It would add one more layer but might solve your problem if no one finds the reverse layout order switch soon enough.</p>
8,950
<p>More out of interest than anything else, but can you compile a DirectX app under linux?</p> <p>Obviously there's no official SDK, but I was thinking it might be possible with wine.</p> <p>Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that? (edit: This is called winelib)</p> <p>Failing that, maybe a mingw cross compiler with the app running under wine.</p> <p>Half answered my own question here, but wondered if anyone had heard of anything like this being done?</p>
<p>I've had some luck with this. I've managed to compile <a href="http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B5.aspx" rel="nofollow noreferrer">this simple Direct3D example</a>.</p> <p>I used winelib for this (wine-dev package on Ubuntu). Thanks to <a href="https://stackoverflow.com/users/9554/alastair">alastair</a> for pointing me to winelib.</p> <p>I modified the source slightly to convert the wchars to chars (1 on line 52, 2 on line 55, by removing the L before the string literals). There may be a way around this, but this got it up and running.</p> <p>I then compiled the source with the following:</p> <pre><code>wineg++ -ld3d9 -ld3dx9 triangle.cpp </code></pre> <p>This generates an a.out.exe.so binary, as well as an a.out script to run it under wine.</p>
<p>There is currently no way to compile DirectX code to directly target Linux. You would build your application like you normally would, then run it using a compatibility layer like Wine/Cedega.</p>
7,032
<p>I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework. JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing framework that supports testing Tomcat servlets? Eclipse integration is nice but not necessary. </p>
<p>Check out <a href="http://httpunit.sourceforge.net/doc/servletunit-intro.html" rel="noreferrer">ServletUnit</a>, which is part of HttpUnit. In a nutshell, ServletUnit provides a library of mocks and utilities you can use in ordinary JUnit tests to mock out a servlet container and other servlet-related objects like request and response objects. The link above contains examples.</p>
<p>Updated Feb 2018: <a href="https://closingbraces.net/openbrace/" rel="nofollow noreferrer">OpenBrace Limited has closed down</a>, and its ObMimic product is no longer supported.</p> <p>If you want a newer alternative to ServletUnit for JUnit testing of Servlets, you might find my company's <a href="http://www.openbrace.com" rel="nofollow noreferrer">ObMimic</a> library useful. It's available for free from the website's <a href="http://www.openbrace.com/main/pages/download/download-current.html" rel="nofollow noreferrer">downloads</a> page.</p> <p>As with ServletUnit, it provides a library of classes that you can use in normal JUnit or TestNG tests outside of any servlet container to simulate the Servlet API.</p> <p>Its Servlet API objects have no-argument constructors, are fully configurable and inspectable for all relevant Servlet API data and settings, and provide a complete simulation of all of the behaviour specified by the Servlet API's javadoc. To help with testing there's support for selective recording of Servlet API calls, control over any container-dependent behaviour, checks for any ambiguous calls (i.e. where the Servlet API behavour isn't fully defined), and an in-memory JNDI simulation for any servlet code that relies on JNDI lookups.</p> <p>For full details, example code, "how to" guides, Javadoc etc, see the website.</p>
7,703
<p>Is there a way to find the name of the program that is running in Java? The class of the main method would be good enough.</p>
<p>Try this:</p> <pre><code> StackTraceElement[] stack = Thread.currentThread ().getStackTrace (); StackTraceElement main = stack[stack.length - 1]; String mainClass = main.getClassName (); </code></pre> <p>Of course, this only works if you're running from the main thread. Unfortunately I don't think there's a system property you can query to find this out.</p> <p><strong>Edit:</strong> Pulling in @John Meagher's comment, which is a great idea:</p> <blockquote> <p>To expand on @jodonnell you can also get all stack traces in the system using Thread.getAllStackTraces(). From this you can search all the stack traces for the "main" Thread to determine what the main class is. This will work even if your class is not running in the main thread.</p> </blockquote>
<p>Or you could just use getClass(). You can do something like:</p> <pre><code>public class Foo { public static final String PROGNAME = new Foo().getClass().getName(); } </code></pre> <p>And then PROGNAME will be available anywhere inside Foo. If you're not in a static context, it gets easier as you could use this:</p> <pre><code>String myProgramName = this.getClass().getName(); </code></pre>
6,329
<p>When exchanging the mainboard of my Ultimaker Original, I found the new (unoriginal) mainboard to have a condensator that is quite a little higher than on the original, which means the fan duct doesn't fit any more.</p> <p>I read somewhere that those A4988 stepper motor drivers don't have to be actively cooled, but a heatsink will be sufficient:</p> <p><a href="https://i.stack.imgur.com/oJmlL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJmlL.jpg" alt="A4988 stepper motor driver with heatsink"></a></p> <p>After testing the theory I found the heatsinks to be really hot, but not too hot to touch. Sadly I do not have any means of temperature measurement other than my fingers...</p> <p>How hot do they normally get, when should I abort printing and look for a different solution?</p> <p>Are there any good solutions other than the original cooler &amp; cooling duct?</p>
<p>This may not be your cuppa tea, but if you're willing to learn to use <a href="http://www.openscad.org/" rel="nofollow noreferrer">OpenSCAD</a> or already know how, there's a <a href="https://www.thingiverse.com/thing:1668883/" rel="nofollow noreferrer">Thingiverse</a> post that appears to directly address your objective.</p> <p>Correction, this particular post on Thingiverse consists of a series of Python files, of which I have zero experience/qualifications. It may still be of value, if you are Python capable.</p> <p><a href="https://i.stack.imgur.com/i9Fkh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i9Fkh.jpg" alt="santa on a mug"></a></p> <p>Another resource that is strictly OpenSCAD is from Eric Buijs, a rather talented 3D design person. His YouTube channel has a number of useful tutorials for both OpenSCAD and Solvespace. <a href="https://www.youtube.com/watch?v=PNcGNqMUl5I" rel="nofollow noreferrer">This video</a> in particular describes applying a flat object to a curved one using OpenSCAD, resulting in a lithophane.</p> <p><a href="https://i.stack.imgur.com/MbyOa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbyOa.png" alt="curved lithophane"></a></p> <p>As I created this answer, I did not re-watch the 12+ minute video, but I recall how he explains clearly how the program dissects the surface into a number of flat panels and then superimposes the image on each segment. From this presentation, I suspect one could expand to a full cylinder.</p>
<p>This is the best and simplest way I've found to transform a flat design into a 3D object that you can then save as an STL file: <a href="https://www.youtube.com/watch?v=ows2QTiMRPg" rel="nofollow noreferrer">Blender-Converting 2D Image to 3D Object</a></p> <p>This solution requires you to use <a href="https://www.blender.org/" rel="nofollow noreferrer">Blender</a> and <a href="https://inkscape.org/" rel="nofollow noreferrer">Inkscape</a>, both softwares are open-source and available for free at this time.</p> <p>As suggested below by @Greenonline, I will provide a step by step in case the video is removed from Youtube. I'm sorry that I cannot provide screenshots at the moment, but I'm on a trip and writing from an old laptop that cannot run either Blender or Inkscape.</p> <ol> <li><p>Load your image in Inkscape.</p> <ul> <li>Format is unimportant as long as Inkscape can read it. It works with black and white and color images, but please note that color information won't be sent to Blender in the end, you'll have to add color materials yourself once the picture has been converted to a 3D object.</li> </ul></li> <li><p>Select the image or the portion of it that you want to turn into a 3D object.</p> <ul> <li>For some unknown reason, Inkscape doesn't automatically select the image you loaded into it, so you have to do it manually. When the image is selected, it will be surrounded by a dotted line and you'll see arrows appear on the sides and corners.</li> </ul></li> <li><p>Go to Path > Trace Bitmap, or use Shift+Alt+B, and a pop-up window will appear. Keep the default settings, just make sure that the 'Remove background' option, located at the bottom of the window, is checked, then click OK.</p> <ul> <li>You can see the result of the operation in the 'Preview' window. If the 'Preview' is empty, just click on the 'Update' button located below 'Preview'. If it is still empty after you clicked on 'Update', then you haven't selected your picture as indicated in Step 2!</li> </ul></li> <li><p>Got to File > Save As and save your file as 'Plain svg'.</p> <ul> <li>Saving as 'Inkscape svg' should work as well, but it's always best to use the standard format.</li> </ul></li> </ol> <p>And you're done with Inkscape, time to switch to Blender.</p> <ol start="5"> <li><p>Go to File > Import > Scalable Vector Graphics (.svg) and import the picture you just created in Inkscape.</p> <ul> <li>If you do not see Scalable Vector Graphics (.svg) in the list of importable files, it means the add-on hasn't been activated. You can do it by going to File > User Preferences > Add-ons then typing 'svg' in the search field will bring up the relevant add-on (Import-Export: Scalable Vector Graphics (SVG) format). Clicking the checkbox next to it's name will automatically activate it. </li> <li>The picture will usually appear very small in Blender. Press 5 on the numeric keyboard to home onto it, then you can stretch it to the desired size by using the relevant tools in Blender. </li> <li>It might be a good idea to move the object center into the middle of the geometry, although, from personal experience, you can do it after it becomes 3D without too much trouble.</li> </ul></li> <li><p>Your picture has been loaded in Blender as a Curve object. Go to the 'Curve' tab and in the 'Geometry' sub-menu you can use the 'Extrude' slider to give depth to your picture.</p></li> <li><p>Finally, once you've extruded your curve to your satisfaction, go to Object > Convert To > Mesh from Curve/Meta/Surf/Text, or use Alt+C, and voila, you're done!</p></li> </ol> <p>You know have a nice 3D object made of polygons that you can modify at your leisure using Blender's tools.</p>
1,032
<p>Is there a way?</p> <p>I need all types that implement a specific interface to have a parameterless constructor, can it be done?</p> <p>I am developing the base code for other developers in my company to use in a specific project.</p> <p>There's a proccess which will create instances of types (in different threads) that perform certain tasks, and I need those types to follow a specific contract (ergo, the interface).</p> <p>The interface will be internal to the assembly</p> <p>If you have a suggestion for this scenario without interfaces, I'll gladly take it into consideration...</p>
<p>Not to be too blunt, but you've misunderstood the purpose of interfaces.</p> <p>An interface means that several people can implement it in their own classes, and then pass instances of those classes to other classes to be used. Creation creates an unnecessary strong coupling.</p> <p>It sounds like you really need some kind of registration system, either to have people register instances of usable classes that implement the interface, or of factories that can create said items upon request.</p>
<p>I don't think so. </p> <p>You also can't use an abstract class for this.</p>
4,657
<p>I've recently been working with a MySQL database, and using MySQL workbench to design the Database.</p> <p>When I use the export to SQL function, so I can actually get the layout in to the Database, I get:</p> <blockquote> <p>"Error 1005: Cannot create table"</p> </blockquote> <p>This appears to be related to Foreign Keys in the create table statement.</p> <p>Does anybody have a work around for this that doesn't involve taking the constraints out and putting them back in later? That's a less than ideal solution given the size of the database.</p>
<p>When you get this (and other errors out of the InnoDB engine) issue:</p> <pre><code>SHOW ENGINE INNODB STATUS; </code></pre> <p>It will give a more detailed reason why the operation couldn't be completed. Make sure to run that from something that'll allow you to scroll or copy the data, as the response is quite long.</p>
<p>I ran into this situation recently when I attempted (in InnoDB tables) to make a foreign key reference to a column that had a different data type.</p> <p><a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html" rel="nofollow noreferrer">MySQL 5.1 Documentation</a></p>
5,488
<p>I am completely new to 3D printing. I need to build a calibration plate, which I was told can be built using vero back plastic and a 3d printer. But I am afraid I need to know more if I give this to someone for fabrication. In particular, I am wondering how to get the white dots on the surfaces. My question is probably ill-posed, but I am trying to get as much info as I can before I consult any 3d printing vendors. Thanks</p> <p><a href="https://i.stack.imgur.com/32GtS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/32GtS.jpg" alt="Calibration plate"></a></p>
<p>The photo is too small to be clear about the entire objective and there are no dimensions provided. A quick google search returns nothing 3d printer related to "black vera plastics" other than a reference to vera bradley, vera wang and an obscure reference to a woven black carpet with white spots of increasing size. </p> <p>Even within those limitations, one can certainly print a strip of black with white dots. One method involves a dual extruder printer, enabling two colors to be printed, one layer at a time. The black layer would be extruded with suitable holes and the white layer would be place within those holes.</p> <p>Another method involves printing the black layer with holes, swapping out the filament with white and creating white plugs of appropriate sizes for the necessary fit.</p> <p>You've used the term calibration plate, which implies some level of precision. Is the precision related to spacing, dot size, dot color, or a combination of the above?</p> <p>Such requirements may make the cost slightly higher, but not excessively. I can print up to to 290 mm long strip, possibly longer by going diagonal on my 290 mm print bed, with or without the two colors done simultaneously.</p> <p>If you require crisp edges to the white/black transition, the holes-and-plugs method will give best results and require a bit of post processing. It may be necessary to ream the holes to correct diameter and sand the plugs to fit. Dual extrusion rarely provides sharp delineation from one color to the next.</p>
<p>What are the characteristics of the white dots? (That is, are the dots small raised bumps, do they denote where a hole will be drilled, are they integral to a piece-to-piece connection, etc...) </p> <p>If these are small bumps that need to be added to the top of the black surfaces, your most time-effective solution is probably print the black component first (with placement references for where the white dots are to go), then switch materials and print the dots, and attach them to the black component.</p> <p>Otherwise, you'll need a machine capable of printing in two materials simultaneously(ish). See some of the newer Stratasys machines if you have a good budget ha!</p>
435
<p>I'm using <code>M80</code> and <code>M81</code> G-codes to power on/off power supply. </p> <p>Is there a G-code to know the actual state of the power supply?</p>
<p>I don't have this specific printer but this used to happen to me as well on my D-Bot. The reason being bed not being leveled properly. Ensure that your bed is leveled such that the distance between the nozzle and bed is about 0.2mm after homing. Also coat your bed with something sticky like glue or hairspray. You won't need this if you are using a PEI sheet. </p>
<p>I've cleaned the heated bed as suggested using ethanol, then I've tested the Z distance of the nozzle from the bed with a paper sheet and it was ok. Lastly, I tried to raise the temperature of the extruder for the first layer to 215°C. I think that this did the trick.</p>
592
<p>In SQL Server I have a <code>DATETIME</code> column which includes a time element.</p> <p>Example: </p> <pre><code>'14 AUG 2008 14:23:019' </code></pre> <p>What is the <strong>best</strong> method to only select the records for a particular day, ignoring the time part?</p> <p>Example: (Not safe, as it does not match the time part and returns no rows)</p> <pre><code>DECLARE @p_date DATETIME SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 ) SELECT * FROM table1 WHERE column_datetime = @p_date </code></pre> <p><em>Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.</em></p> <hr> <p><strong>Update</strong> Clarified example to be more specific.</p> <hr> <p><strong>Edit</strong> Sorry, But I've had to down-mod WRONG answers (answers that return wrong results).</p> <p>@Jorrit: <code>WHERE (date&gt;'20080813' AND date&lt;'20080815')</code> will return the 13th and the 14th.</p> <p>@wearejimbo: <em>Close, but no cigar!</em> badge awarded to you. You missed out records written at 14/08/2008 23:59:001 to 23:59:999 (i.e. Less than 1 second before midnight.)</p>
<p>Technique 1:</p> <pre><code> DECLARE @p_date DATETIME SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 ) SELECT * FROM table1 WHERE column_datetime &gt;= @p_date AND column_datetime &lt; DATEADD(d, 1, @p_date) </code></pre> <p>The advantage of this is that it will use any index on 'column_datetime' if it exists.</p>
<p>In sqlserver</p> <pre><code>DECLARE @p_date DATE SELECT * FROM table1 WHERE column_dateTime=@p_date </code></pre> <p>In C# Pass the short string of date value using ToShortDateString() function. sample: DateVariable.ToShortDateString();</p>
3,200
<p>Before it stopped working, the stepper motor worked very well and didn't show any problem. I experienced this after I fixed a filament problem. The filament got stuck soI retracted to pull the filament out of the heat nozzle. But when I finished this, the extruder didn't work anymore...</p> <p>I restarted the system but it didn't work. All the motors work fine, even the extruder motor. The A4988 driver has the right voltage at 1.0&nbsp;-&nbsp;1.2&nbsp;V. I have already replaced my RAMPS shield and AtMega board, but it still does not work! I changed the extruder motor to another axis port and it worked good. The voltage input is stable at 11.2&nbsp;V</p> <p>I can't figure out why the extruder motor is not working for the extruder port?</p>
<p>I have found an answer. So dumb‍♂️‍♂️. It need to heat up nozzle before use extrude or retract command</p>
<p>When you pulled the filament out of the extruder you most likely induced a voltage back into the stepper driver which fried it.</p>
1,642
<p>For a project I'm working on. I need to look for an executable on the filesystem. For UNIX derivatives, I assume the user has the file in the mighty $PATH variable, but there is no such thing on Windows.</p> <p>I can safely assume the file is at most 2 levels deep into the filesystem, but I don't know on what drive it will be. I have to try all drives, but I can't figure out how to list all available drives (which have a letter assigned to it).</p> <p>Any help?</p> <p><strong>EDIT:</strong> I know there is a %PATH% variable, but it is not as integrated as in UNIX systems. For instance, the application I'm looking for is OpenOffice. Such software would not be in %PATH%, typically.</p>
<p><a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()" rel="noreferrer">http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()</a></p> <pre><code>File[] roots = File.listRoots(); for(int i = 0; i &lt; roots.length ; i++) System.out.println("Root["+i+"]:" + roots[i]); </code></pre> <p>google: list drives java, first hit:-)</p>
<p>Of course there is a <code>PATH</code> environment variable <a href="http://en.wikipedia.org/wiki/Environment_variable#System_path_variables" rel="nofollow noreferrer">in Windows</a>.</p> <blockquote> <blockquote> <p><code>%PATH%</code> This variable contains a semicolon-delimited list of directories in which the command interpreter will search for executable files. Equivalent to the UNIX $PATH variable.</p> </blockquote> </blockquote>
7,436
<p>I know that there is no official API for Google Analytics but is there a way to access Google Analytics Reports with C#?</p>
<p><strong>Update</strong>: Google launched a Google Analytics API today. <a href="http://analytics.blogspot.com/2009/04/attention-developers-google-analytics.html" rel="noreferrer">Google Analytics Blog - API Launched</a></p>
<p>Yet another analytics API for C# <a href="https://github.com/igooana/igooana" rel="nofollow">https://github.com/igooana/igooana</a></p> <p>This project is aimed at C# 5 and uses <code>async/await</code> and <code>dynamic</code> extensively. I tried to make this API as simple as possible and maximum type-safe.</p>
3,657
<p>I often have trouble with prints being especially difficult to remove from the build plate on my Micro3D printer. My wife suggested using a hair dryer on the underside of the plate. I was initially appalled at the idea, but now I think she may be on to something. Is this safe? Good idea? Bad idea? Heresay?</p>
<p>Typically, people <em>cool down</em> their build plates to get parts to release, rather than heat them up. That said, I doubt a hair drier will get hot enough to do any damage to the build plate. You could try it with no harm done.</p>
<p>cold wind can help to acceleratory cool down and dry the build plates to make it easy to part them.</p>
352
<p>We currently deploy web applications by creating a database and running SQL scripts through query analyzer. Then we copy the output from "publish website" and set up that website in IIS.</p> <p>We have seen websetup in visual studio, but that part seems to be thinly documented. For example, we are not clear how to ask the user for IP and password of SQL server. We also tend to get websites deployed this way coming up under folders like <a href="http://example.com/project" rel="noreferrer">http://example.com/project</a>, instead of just <a href="http://example.com" rel="noreferrer">http://example.com</a>.</p> <p>Then there are issues with AJAX.Net not being installed or some or the other patch not applied.</p> <p>So far, we have physical access to the servers. Pretty soon though we are going to be shipping CDROMs. What is the practical tradeoff between manual intervention and automation?</p>
<p>Avoid Visual Studio deployment, and automate as much as possible. Web Deployment Projects and NAnt can be your friends! </p> <p>Briefly, our deployment setup:</p> <ol> <li><p>We use RedGate SQL to script differences between dev and live database.</p></li> <li><p>An NAnt build file which calls MSBUILD to build the web deployment project (.wdproj), zips up the resulting compiled web app (along with the SQL change script) and then uploads the zip file to the server. </p></li> <li><p>On the server side, there is another NAnt build file which takes the application offline, backs up the database, backs up the website. runs the SQL change script, unzips the new version and brings the app online. </p></li> </ol> <p>Step 3 is usually run "manually" (one double-click), but sometimes scheduled for late at night. You could do exactly the same from a CDROM, or even write a pretty little Windows Forms app as a wrapper. </p> <p>Quite happy to give details of the NAnt script if you're interested.</p>
<p>I deploy mostly ASP.NET apps to Linux servers. Here is my standard workflow:</p> <ul> <li>I use a source code repository (like Subversion)</li> <li>On the server, I have a bash script that does the following: <ul> <li>Checks out the latest code</li> <li>Does a build (creates the DLLs)</li> <li>Filters the files down to the essentials (removes code files for example)</li> <li>Backs up the database</li> <li>Deploys the files to the web server in a directory named with the current date</li> <li>Updates the database if a new schema is included in the deployment</li> <li>Makes the new installation the default one so it will be served with the next hit</li> </ul></li> </ul> <p>Checkout is done with the command-line version of Subversion and building is done with xbuild (msbuild work-alike from the Mono project). Most of the magic is done in ReleaseIt.</p> <p>On my dev server I essentially have continuous integration but on the production side I actually SSH into the server and initiate the deployment manually by running the script. My script is cleverly called 'deploy' so that is what I type at the bash prompt. I am very creative. Not.</p> <p>In production, I have to type 'deploy' twice: once to check-out, build, and deploy to a dated directory and once to make that directory the default instance. Since the directories are dated, I can revert to any previous deployment simply by typing 'deploy' from within the relevant directory.</p> <p>Initial deployment takes a couple of minutes and reversion to a prior version takes a few seconds.</p> <p>It has been a nice solution for me and relies only on the three command-line utilities (svn, xbuild, and releaseit), the DB client, SSH, and Bash.</p> <p>I really need to update the copy of ReleaseIt on CodePlex sometime:</p> <p><a href="http://releaseit.codeplex.com/" rel="nofollow noreferrer">http://releaseit.codeplex.com/</a></p>
8,832
<p>When installing subversion as a service, I used this command:</p> <pre><code>c:\&gt;svnservice -install --daemon --root "c:\documents and settings\my_repository" </code></pre> <p>And then I got this error:</p> <pre><code>Could not create service in service control manager. </code></pre> <p>After looking at some MSDN docs on the service control manager, I tried granting full control to everyone in the permissions on the registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, but that hasn't had any effect.</p> <p>Anybody know what I did wrong, or how to overcome this?</p> <p><em>Note #1: I am running as an administrator on this box</em></p> <p>*Note #2: I was following the instructions given <a href="http://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16/Setting_up_a_Subversion_Server_under_Windows.aspx" rel="nofollow noreferrer">here</a>, so maybe my choice of directory is misguided. And my repository is not actually called "my_repository". I used the name of an actual project which is currently under source control in <em>gasp</em> VSS.*</p>
<p><a href="http://www.visualsvn.com/server" rel="nofollow noreferrer">VisualSVN Server</a> installs as a Windows service. It is free, includes Apache, OpenSSL, and a repository / permission management tool. It can also integrate with Active Directory for user authentication. I highly recommend it for hosting SVN on Windows.</p>
<p>I've never used the command line installer for this. I assume you are downloading the latest from:</p> <p><a href="http://svnservice.tigris.org/" rel="nofollow noreferrer">http://svnservice.tigris.org/</a></p> <p>I run the installer, and then use the configuration tool (in the Start Menu, SVN Service, SVN Service Administration) to set it up.</p>
3,383
<p>I have been using an Anycubic i3 Mega for about a month now and it worked fine. But when I designed a simple model in Fusion 360 and sliced it with Cura it started to have issues sticking to the bed. I thought the problem was the model so I tried to print a Benchy, but the same problem occurred. I readjusted the bed but it's still not working. I'm not sure how I can trouble shoot this.</p>
<p>The proper answer could be not related to Fusion, as you already noticed.</p> <p>I suppose the issue is that the Ultrabase surface (or any other glass surface you have installed) was <strong>not cleaned during the first month</strong>? So it should be cleaned from grease and possibly dust. The general cleaning method is to use isopropyl alcohol (IPA) from time to time (btw. I am curious if it is advised in a printer's manual). If it does not fully help, I suppose using a dish soap with hot water prior to IPA is good step. Though I do not own this bed, so could not be 100 % sure of impact. (Definitely do not use any extra adhesion helpers for Ultrabed, because it has some specific microstructure which will get stuffed.)</p> <p>You could want review other threads like this <a href="/q/15327/">How to get Sunlu PLA to adhere to the printing bed?</a> to get other hints and supplement your checklist. One thing to check first (and regularly) is proper bed levelling at current moment - and compare to initial layer settings in Cura (thickness, width, flow percentage).</p>
<p>A &quot;hack&quot; I used was to print with a raft. I decreased the width of the raft in Cura so I'm not printing with excess plastic and the raft ensures my print always sticks.</p> <p>Another thing to look at is to look at the print speed, a slightly slower speed might help with the build plate adhesion. This is something I noticed from printing with a raft</p> <p>For reference, I print with a glass bed and the plastic failed to adhere to the bed even after washing it and using sanitizer to clean it off. IPA is the real deal though but I didn't give it a try.</p>
1,883
<p>Is there a simple way of getting a HTML textarea and an input type="text" to render with (approximately) equal width (in pixels), that works in different browsers?</p> <p>A CSS/HTML solution would be brilliant. I would prefer not to have to use Javascript.</p> <p>Thanks /Erik</p>
<p>You should be able to use</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.mywidth { width: 100px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input class="mywidth"&gt; &lt;br&gt; &lt;textarea class="mywidth"&gt;&lt;/textarea&gt;</code></pre> </div> </div> </p>
<p>you can also use the following CSS: </p> <pre><code>.mywidth{ width:100px; } textarea{ width:100px; } </code></pre> <p>HTML:</p> <pre><code>&lt;input class="mywidth" &gt; &lt;textarea&gt;&lt;/textarea&gt; </code></pre>
4,833
<p>Do you refactor your SQL first? Your architecture? or your code base? Do you change languages? Do you throw everything away and start from scratch? [Not refactoring]</p>
<p>I'm adding unit testing to a large, legacy spaghetti codebase. </p> <p>My approach is, when asked to solve a problem, I try to create a new wrapper around the part of the code-base which is relevant to my current task. This new wrapper is developed using TTD (writing the test first). Some of the time calling <em>into</em> the non-unit tested legacy code. At other times I make a new copy of an existing module and start to do serious violence to it. Sometimes I rewrite functionality from scratch. </p> <p>But as I'm keeping it fairly well tested I feel pretty in control.</p> <p>What I find with this code-base, which has been developed with far too much copy and pasting, is that once I get an understanding a particular part, and extract some functions from it (which are done test-first) ... these functions often turn out to be usable in many other places and so the rate of replacing the legacy code with my own, unit tested libraries increases.</p> <p>I don't (and have no authority to) try to rewrite or add tests to parts of the code that are not touched by my current problem (usually a bug I'm trying to fix) but I do have a fairly aggressive proactive stance on anything that is touched and might be relevant.</p> <p>Update : Penguinix asked : "What languages do you work in? Is there a specific Testing Harness you recommend?" </p> <p>Right now I'm working in ... er ... Mumps! But the same principle works anywhere. </p> <p>Something that transformed my understanding of UT was MinUnit : <a href="http://www.jera.com/techinfo/jtns/jtn002.html" rel="nofollow noreferrer">http://www.jera.com/techinfo/jtns/jtn002.html</a> </p> <p>When I saw MinUnit, that was kind of a "zen" moment of enlightenment for me. It stripped away the misunderstandings I had about unit testing being something complicated requiring sophisticated OO frameworks etc. I understood that UT was just about writing a bunch of tests. The "harness" you can write yourself, in about 3 minutes, in any language you like. Just get on and do it.</p>
<p>This really depends on the state of the codebase... are there massive classes? one class with mega-methods? Are the classes tightly coupled? is configuration a burden?</p> <p>Considering this, I suggest reading <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="nofollow noreferrer" rel="nofollow noreferrer">Working Effectively with Legacy Code</a>, picking out your problems, and applying the recommendations.</p>
9,187
<p>I'm new to 3D printing and I recently got a LulzBot Taz 6 printer.</p> <p>I'm interested in doing dual extrusion printing (especially with dissolvable supports), but I'm also interested in doing single extrusion prints. In particular, I would like to experiment with printing flexible filament.</p> <p>The <a href="https://www.lulzbot.com/store/tool-heads/lulzbot-taz-dual-extruder-v3-tool-head" rel="noreferrer">LulzBot TAZ Dual Extruder v3 Tool Head</a> says that it can handle all the filament types that I am interested in.</p> <p>Here is the question: can I use a dual extruder (in particular, the LulzBot TAZ Dual Extruder v3 Tool Head) for general purpose printing (read single extrusion) or do I need to use a single extrusion head for single extrusion print jobs.</p> <p>If you can use a dual for single use, why buy single extruders (I've been looking at <a href="https://www.lulzbot.com/store/tool-heads/lulzbot-taz-aerostruder-tool-head" rel="noreferrer">LulzBot TAZ Aerostruder Tool Head</a> for flexy prints) if you can get the same performance out of a dual head?</p> <p>If you should use a single extruder for non-dual prints, please explain the shortcomings of using a dual print head for general purpose use.</p>
<p>Not an expert by any means but I can’t see any reason you couldn’t use one half of a dual extruder. The benefits of not using one though would be decreased extruder weight. Especially given that this is a direct drive so there will be two stepper motors I believe. Reduced weight means faster print times and a reduction in certain print artifacts such as ringing etc.</p> <p>Short answer, if your only ever going to need one extruder probably avoid a dual but if you want the flexibility this should work when a single extruder is required.</p>
<p>This may be too late to help, but I wanted to describe my own experience with the Lulzbot Taz Dual Extruder v3. It was...<a href="https://www.amazon.com/gp/customer-reviews/R259P3UB6DJYQ3?ref=pf_ov_at_pdctrvw_srp" rel="nofollow noreferrer">not good</a>.</p> <p>In terms of your question, I spent a fair amount of time trying to do exactly this. It is possible, but there are some major caveats:</p> <ul> <li><p>If you are not printing with both extruders, you need to leave the one not in use unloaded. The reason for this is that, at least with PLA, the extruder not in use will get hot enough to drip.</p></li> <li><p>The Cura-Lulzbot software, at least when I used it last year, doesn't deal well with this. It tends to default to printing with both extruders, and it made slicing much more complicated than it was with a single extruder.</p></li> </ul> <p>As such, I personally gave up and swapped my old single extruder back in.</p> <p>This isn't meant to contradict the other answer. In theory it should be workable. But in practice, with the device you mention, it's not.</p>
808
<p>I'm looking to find alternatives to <a href="http://lucene.apache.org/solr/" rel="noreferrer">Solr</a> from the Apache Software Foundation. </p> <p>For those that don't know, Solr is an enterprise search server. A client application uses a web-services like interface to submit documents for indexing and also to perform search queries. Solr has other features built in like caching and replication. I believe it was originally started by CNet and then open-sourced. </p> <p>I'm looking for other search servers out there that might be seen as the competition. </p>
<p>I wrote a long post about my experiences and features of all the engines I listed below but I scrapped it because formatting is a pita. But quite simply if you don't want to shell out money Solr/Lucene or Fast (now MSSE) is really about the best you can do.</p> <p>Excluded because I have no experience of this product: Seamark,</p> <h3>Price High to Low</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>Google Mini,</li> <li>Microsoft Search Server,</li> <li>Autonomy,</li> <li>Microsoft Search Server Express,</li> <li>Solr/Lucene</li> </ul> <h3>Speed Fast to Slow</h3> <ul> <li>Google Mini/Endeca,</li> <li>FredHopper,</li> <li>Autonomy,</li> <li>Solr/MSS/MSSE</li> </ul> <h3>Features High to Low</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>Solr,</li> <li>Autonomy,</li> <li>Lucene,</li> <li>MSS/MSSE,</li> <li>Google Mini</li> </ul> <h3>Extensibility High to Low</h3> <ul> <li>Solr/Lucene,</li> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>Autonomy,</li> <li>MSS/MSSE,</li> <li>Google Mini</li> </ul> <h3>Java API</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Autonomy,</li> <li>Solr/Lucene</li> </ul> <h3>.NET API</h3> <ul> <li>Endeca,</li> <li>Solr/Lucene,</li> <li>MSS/MSSE,</li> <li>Autonomy</li> </ul> <h3>XML API</h3> <ul> <li>FredHopper,</li> <li>Mercado,</li> <li>Solr/Lucene,</li> <li>Autonomy,</li> <li>Google Mini (limited)</li> </ul> <h3>Faceted Search</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Seamark,</li> <li>Solr</li> </ul> <h3>Natural Language Search</h3> <ul> <li>Endeca,</li> <li>Fred Hopper,</li> <li>Solr,</li> <li>Mercado,</li> <li>MSS/MSSE,</li> <li>Autonomy,</li> <li>Google Mini</li> </ul> <h3>Document Crawling</h3> <ul> <li>Endeca,</li> <li>Mercado,</li> <li>MSS/MSSE,</li> <li>Autonomy,</li> <li>Google Mini</li> </ul> <h3>ITL</h3> <ul> <li>Endeca,</li> <li>FredHopper</li> </ul> <h3>Merchandizing/Content Spotlighting</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado</li> </ul> <h3>Distributed Search</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>Solr/Lucene,</li> <li>Autonomy,</li> <li>Google Mini</li> </ul> <h3>Analytics</h3> <ul> <li>Endeca</li> </ul> <h3>Platform x86 Windows</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>MSS/MSSE,</li> <li>Solr/Lucene,</li> <li>Autonomy</li> </ul> <h3>Platform x64 Windows</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Solr/Lucene</li> </ul> <h3>Platform x86 Unix Variants</h3> <ul> <li>Endeca,</li> <li>FredHopper,</li> <li>Mercado,</li> <li>Solr/Lucene,</li> <li>Autonomy</li> </ul> <h3>Platform x64 Unix Variants</h3> <ul> <li>Endeca,</li> <li>Solr/Lucene</li> </ul> <h3>Other</h3> <ul> <li>Google Mini</li> </ul>
<p><a href="http://omnifind.ibm.yahoo.net/" rel="nofollow noreferrer">IBM Omnifind Yahoo Edition</a> is an Enterprise search server which uses <a href="http://lucene.apache.org/" rel="nofollow noreferrer">Apache Lucene</a> for indexing. It is simple, easy to install and administer. It also has a built in Open Search API. It has multi-platform support and its Free!!</p> <p>This product was launched by IBM to compete with <a href="http://www.google.com/enterprise/mini/" rel="nofollow noreferrer">Google Mini</a> in the Enterprise Search market.</p>
9,250
<p>I want to create a draggable and resizable window in JavaScript for cross browser use, but I want to try and avoid using a framework if I can.</p> <p>Has anyone got a link or some code that I can use?</p>
<p>JQuery is more focused on a lot of nice utility functions, and makes DOM manipulation a whole lot easier. Basically, I consider it to be Javascript as it should have been. It's a supremely helpful addition to the Javascript language itself.</p> <p>ExtJS is a suite of GUI components with specific APIs... Use it if you want to easily create components that look like that, otherwise, go with a more flexible framework.</p>
<p>Avoiding a framework altogether will leave you with lots of code and a bunch of tedious browser-testing.</p> <p>If you would consider a framework I'd suggest jQuery with the <a href="http://dev.iceburg.net/jquery/jqDnR/" rel="nofollow noreferrer">jqDnR</a> plugin. I think it will solve your problem or perhaps you could combine the functionality of the <a href="http://docs.jquery.com/UI/Draggables" rel="nofollow noreferrer">jQuery draggables</a> with the <a href="http://docs.jquery.com/UI/Resizables" rel="nofollow noreferrer">jQuery resizables</a></p>
5,057
<p>What is the Java analogue of .NET's XML serialization?</p>
<p><strong>2008 Answer</strong> The "Official" Java API for this is now JAXB - Java API for XML Binding. See <a href="http://docs.oracle.com/javase/tutorial/jaxb/TOC.html" rel="noreferrer">Tutorial by Oracle</a>. The reference implementation lives at <a href="http://jaxb.java.net/" rel="noreferrer">http://jaxb.java.net/</a></p> <p><strong>2018 Update</strong> Note that <a href="http://openjdk.java.net/jeps/320" rel="noreferrer">the Java EE and CORBA Modules are deprecated in SE in JDK9 and to be removed from SE in JDK11</a>. Therefore, to use JAXB it will either need to be in your existing enterprise class environment bundled by your e.g. app server, or you will need to bring it in manually.</p>
<pre><code>public static String genXmlTag(String tagName, String innerXml, String properties ) { return String.format("&lt;%s %s&gt;%s&lt;/%s&gt;", tagName, properties, innerXml, tagName); } public static String genXmlTag(String tagName, String innerXml ) { return genXmlTag(tagName, innerXml, ""); } public static &lt;T&gt; String serializeXML(List&lt;T&gt; list) { String result = ""; if (list.size() &gt; 0) { T tmp = list.get(0); String clsName = tmp.getClass().getName(); String[] splitCls = clsName.split("\\."); clsName = splitCls[splitCls.length - 1]; Field[] fields = tmp.getClass().getFields(); for (T t : list) { String row = ""; try { for (Field f : fields) { Object value = f.get(t); row += genXmlTag(f.getName(), value == null ? "" : value.toString()); } } catch (IllegalAccessException e) { e.printStackTrace(); } row = genXmlTag(clsName, row); result += row; } } result = genXmlTag("root", result); return result; } </code></pre>
5,636
<p>I have a rails application where each user has a separate database. (taking Joel Spolsky's advice on this). I want to run DB migrations from the rails application to create a new database and tables for this user. </p> <p>What is the easiest way to do this? </p> <p>Maybe the db migration is not the best for this type of thing. Thanks!</p> <hr> <p>It would be nice if it could be a completely automated process. The following process would be ideal.</p> <ol> <li>A user signs up on our site to use this web app</li> <li>Migrations are run to create this users database and get tables setup correctly</li> </ol> <p>Is there a way of calling a rake task from a ruby application?</p>
<p>To answer part of your question, here's how you'd run a rake task from inside Rails code:</p> <pre><code>require 'rake' load 'path/to/task.rake' Rake::Task['foo:bar:baz'].invoke </code></pre> <p>Mind you, I have no idea how (or why) you could have one database per user.</p>
<p>Actually I have discovered a good way to run DB migrations from an application:</p> <blockquote> <p>ActiveRecord::Migrator.migrate("db/migrate/")</p> </blockquote>
5,992
<p>I want to use a specific foreign language font for a Blackberry application. How is such a font created and loaded onto the Blackberry device?</p> <p>For example: ਪੰਜਾਬੀ </p>
<p>A quick google search shows that the same thing has been asked at <a href="http://www.blackberryforums.com/developer-forum/100107-using-custom-fonts.html" rel="nofollow noreferrer">blackberry forums</a>.</p> <p>The solution they came up with is a class for loading the font from a <a href="http://www.fileinfo.net/extension/fnt" rel="nofollow noreferrer">fnt file</a>.</p> <p>There are <a href="http://www.google.com/search?hl=en&amp;q=free+.fnt+editor&amp;btnG=Search" rel="nofollow noreferrer">programs available</a> to import and edit fnt files.</p>
<p>A quick google search shows that the same thing has been asked at <a href="http://www.blackberryforums.com/developer-forum/100107-using-custom-fonts.html" rel="nofollow noreferrer">blackberry forums</a>.</p> <p>The solution they came up with is a class for loading the font from a <a href="http://www.fileinfo.net/extension/fnt" rel="nofollow noreferrer">fnt file</a>.</p> <p>There are <a href="http://www.google.com/search?hl=en&amp;q=free+.fnt+editor&amp;btnG=Search" rel="nofollow noreferrer">programs available</a> to import and edit fnt files.</p>
9,887
<p>Just last night the heat bed stopped working. It was fine up to 75&nbsp;% of the print, then when it was done the bed was not on anymore. The display said it was set to 50&nbsp;&deg;C, but it was at 18&nbsp;&deg;C. I did try moving the pins, and that is not loose (very simple thing to try). </p> <p>I want to know what could have happened and what to look for when I try to fix the heat bed. </p> <p>Please note: I do have a multi-meter. I do not use a MOSFET (I do have plans to install on)</p> <p>Upon further investigation, I tested the mother board for any voltage were the bed hooks up and there is nothing. I had the printer trying to heat the bed when I was testing. But the thermistor is working, when I unhooked the connection the thermistor went to 0&nbsp;&deg;C, when plugged in it went to 18&nbsp;&deg;C. </p> <p>Is it the motherboard? How can I fix this knowing no power is being supplied to the bed from the motherboard? Do I need a new motherboard?</p>
<p>This is a shot in the dark, but the vast majority of problems with a heating bed stopping to work is usually at the cables/connectors interface.</p> <p>This is because in printers like the A6, the cable/connector is subject to constant mechanical stress, and - since <a href="https://en.m.wikipedia.org/wiki/Metal_Fatigue" rel="nofollow noreferrer">metal fatigue</a> is a thing - either the solder or the cable core cracks.</p> <p>You should make good use of your tester to verify the integrity of the circuit in the bed and if it is not toasted you should be able to just repair the connection.</p> <p>For many printers there exist "strain relief mods" to prevent this type of failure to happen. The first one showing up for the A6 is <a href="https://www.thingiverse.com/thing:2020947" rel="nofollow noreferrer">a full chain</a>, but normally is enough the have a small enclosure for the connector like <a href="https://www.thingiverse.com/thing:2186203" rel="nofollow noreferrer">this one</a> for the CR-10.</p>
<p>The bed stopped working yesterday. I used the multimeter on the bed plug. The bed heater reads 1.7-1.8&nbsp;Ohm.</p> <p>There was no 12&nbsp;V supplied from the mainboard and I read its terminals. There were 12&nbsp;V there. I tightened the screws and the plug received 12&nbsp;V.</p> <p>The bed heated for one print. Today I repeated the troubleshooting and found that the bed plug still had 12&nbsp;V. When I pulled it, the Red terminal was burnt and melted into the plug. After cleaning it by inserting and removing it several times, the bed started working again. The Red and Black wires are hot to touch though.</p> <p>This is the troubleshooting procedure one should follow. What remains to be confirmed is whether the resistance of the bed heater is correct; 1.8&nbsp;Ohm at 12&nbsp;V is about 80&nbsp;W. Sounds about right, so the wires should not overheat.</p> <p>I suspected a possibility of the shorting to the aluminum bed, but then the bed would be heated only in some areas, but mine is heated evenly across the entire surface area.</p> <p>Edit: For now I ended up cutting the Red wire's terminal from the plug and soldering the wire directly to the bed. I might order the new bed harness from Anet, or not.</p>
822
<p>I have the following situation: I built an Access form with a subform (which records are linked to the records of main form via certain key). When I try to delete any record in the subform, I get the following message: “Access has suspended the action because you and another user tried to change the data” (approximate translation from German). Does anyone know how to delete those records from the subform (and, respectively, from the table behind the form).</p>
<p>If you are currently 'editing' the current form then it will not allow the action. Editing a record can sometimes be triggered by simply clicking inside a field, or other simple actions you wouldn't normally consider 'editing'.</p> <p>This is usually avoided in Access by using the RunCommand method to undo any edits before deleting the record:</p> <pre><code>DoCmd.RunCommand acCmdUndo </code></pre>
<p>Also check the "row locking mechanism" that you have. I haven't used Access in a while but I remember that you could use set that in the table properties. You can access those properties clicking in the famous "dot" in the upper left corner of the table to bring up its properties. Well if you're using Access, you know what I'm talking about.</p>
5,435
<p>How can I get a user-defined function to re-evaluate itself based on changed data in the spreadsheet?</p> <p>I tried <strong><kbd>F9</kbd></strong> and <strong><kbd>Shift</kbd>+<kbd>F9</kbd></strong>.</p> <p>The only thing that seems to work is editing the cell with the function call and then pressing Enter.</p>
<p>You should use <code>Application.Volatile</code> in the top of your function:</p> <pre><code>Function doubleMe(d) Application.Volatile doubleMe = d * 2 End Function </code></pre> <p>It will then reevaluate whenever the workbook changes (if your calculation is set to automatic).</p>
<pre><code>Public Sub UpdateMyFunctions() Dim myRange As Range Dim rng As Range 'Considering The Functions are in Range A1:B10 Set myRange = ActiveSheet.Range("A1:B10") For Each rng In myRange rng.Formula = rng.Formula Next End Sub </code></pre>
3,223
<p>How do I escape the underscore character?</p> <p>I am writing something like the following where clause and want to be able to find actual entries with _d at the end.</p> <pre><code>Where Username Like '%_d' </code></pre>
<p><a href="https://learn.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql?view=sql-server-ver15#using-wildcard-characters-as-literals" rel="noreferrer">T-SQL Reference for LIKE</a>:</p> <blockquote> <p>You can use the wildcard pattern matching characters as literal characters. To use a wildcard character as a literal character, enclose the wildcard character in brackets. The following table shows several examples of using the LIKE keyword and the [ ] wildcard characters.</p> </blockquote> <p>For your case:</p> <pre><code>... LIKE '%[_]d' </code></pre>
<p>Adding to <a href="https://stackoverflow.com/a/10415670/12221876">Gerardo Lima's answer</a>, I was having problems when trying to use backslash as my escape character for the ESCAPE clause. This caused issues:</p> <pre><code>SELECT * FROM table WHERE email LIKE '%@%\_%' ESCAPE '\' </code></pre> <p>It was resolved by switching to an exclamation point. This worked:</p> <pre><code>SELECT * FROM table WHERE email LIKE '%@%!_%' ESCAPE '!' </code></pre>
2,765
<p>What are in your opinion big differences between areas of usage for "Astoria" (ADO.NET data services) and SQL Server Data Services?</p>
<p>They are similiar but very different technologies. Astoria or what is now called at <a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" rel="nofollow noreferrer">Microsoft ADO.NET Data Services</a> is a programming library that will allow data to be passed through RESTful web services. You develop these web services to be run against data you have access to. ADO.NET Data Services is now included in the .NET 3.5 SP1 updates.</p> <p><a href="http://www.microsoft.com/sql/dataservices/default.mspx" rel="nofollow noreferrer">SQL Server Data Services</a> is a new service provided by Microsoft. The following is a decription:</p> <blockquote> <p><em>"SQL Server Data Services (SSDS) are highly scalable, on-demand data storage and query processing utility services. Built on robust SQL Server database and Windows Server technologies, these services provide high availability, security and support standards-based web interfaces for easy programming and quick provisioning."</em></p> </blockquote> <p>SQL Server Data Services is very similair to Amazon S3 service.</p>
<p>I'm pretty sure you can call both Astoria and SQL Data Services with the same code in your app. So it depends on where you want your data - on your servers or in the cloud.</p>
9,510
<p>Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share?</p>
<p>Don't do it. You're practically guaranteed to fail. Use <code>PreparedStatement</code> (or its equivalent) instead.</p>
<p>I don't have a regex but my understanding is that the most important thing is to detect the single quote. All the injection attacks start from there. They probably have the -- in there too to comment out and other SQL that might be after the string.</p>
6,690
<p>Using the Windows API, how can I get a list of domains on my network?</p>
<p>Answered my own question:</p> <p>Use the <a href="http://msdn.microsoft.com/en-us/library/aa370623(VS.85).aspx" rel="nofollow noreferrer">NetServerEnum</a> function, passing in the <code>SV_TYPE_DOMAIN_ENUM</code> constant for the "servertype" argument.</p> <p>In Delphi, the code looks like this:</p> <pre><code>&lt;snip&gt; type NET_API_STATUS = DWORD; PSERVER_INFO_100 = ^SERVER_INFO_100; SERVER_INFO_100 = packed record sv100_platform_id : DWORD; sv100_name : PWideChar; end; function NetServerEnum( //get a list of pcs on the network (same as DOS cmd "net view") const servername : PWideChar; const level : DWORD; const bufptr : Pointer; const prefmaxlen : DWORD; const entriesread : PDWORD; const totalentries : PDWORD; const servertype : DWORD; const domain : PWideChar; const resume_handle : PDWORD ) : NET_API_STATUS; stdcall; external 'netapi32.dll'; function NetApiBufferFree( //memory mgmt routine const Buffer : Pointer ) : NET_API_STATUS; stdcall; external 'netapi32.dll'; const MAX_PREFERRED_LENGTH = DWORD(-1); NERR_Success = 0; SV_TYPE_ALL = $FFFFFFFF; SV_TYPE_DOMAIN_ENUM = $80000000; function TNetwork.ComputersInDomain: TStringList; var pBuffer : PSERVER_INFO_100; pWork : PSERVER_INFO_100; dwEntriesRead : DWORD; dwTotalEntries : DWORD; i : integer; dwResult : NET_API_STATUS; begin Result := TStringList.Create; Result.Clear; dwResult := NetServerEnum(nil,100,@pBuffer,MAX_PREFERRED_LENGTH, @dwEntriesRead,@dwTotalEntries,SV_TYPE_DOMAIN_ENUM, PWideChar(FDomainName),nil); if dwResult = NERR_SUCCESS then begin try pWork := pBuffer; for i := 1 to dwEntriesRead do begin Result.Add(pWork.sv100_name); inc(pWork); end; //for i finally NetApiBufferFree(pBuffer); end; //try-finally end //if no error else begin raise Exception.Create('Error while retrieving computer list from domain ' + FDomainName + #13#10 + SysErrorMessage(dwResult)); end; end; &lt;snip&gt; </code></pre>
<p>Answered my own question:</p> <p>Use the <a href="http://msdn.microsoft.com/en-us/library/aa370623(VS.85).aspx" rel="nofollow noreferrer">NetServerEnum</a> function, passing in the <code>SV_TYPE_DOMAIN_ENUM</code> constant for the "servertype" argument.</p> <p>In Delphi, the code looks like this:</p> <pre><code>&lt;snip&gt; type NET_API_STATUS = DWORD; PSERVER_INFO_100 = ^SERVER_INFO_100; SERVER_INFO_100 = packed record sv100_platform_id : DWORD; sv100_name : PWideChar; end; function NetServerEnum( //get a list of pcs on the network (same as DOS cmd "net view") const servername : PWideChar; const level : DWORD; const bufptr : Pointer; const prefmaxlen : DWORD; const entriesread : PDWORD; const totalentries : PDWORD; const servertype : DWORD; const domain : PWideChar; const resume_handle : PDWORD ) : NET_API_STATUS; stdcall; external 'netapi32.dll'; function NetApiBufferFree( //memory mgmt routine const Buffer : Pointer ) : NET_API_STATUS; stdcall; external 'netapi32.dll'; const MAX_PREFERRED_LENGTH = DWORD(-1); NERR_Success = 0; SV_TYPE_ALL = $FFFFFFFF; SV_TYPE_DOMAIN_ENUM = $80000000; function TNetwork.ComputersInDomain: TStringList; var pBuffer : PSERVER_INFO_100; pWork : PSERVER_INFO_100; dwEntriesRead : DWORD; dwTotalEntries : DWORD; i : integer; dwResult : NET_API_STATUS; begin Result := TStringList.Create; Result.Clear; dwResult := NetServerEnum(nil,100,@pBuffer,MAX_PREFERRED_LENGTH, @dwEntriesRead,@dwTotalEntries,SV_TYPE_DOMAIN_ENUM, PWideChar(FDomainName),nil); if dwResult = NERR_SUCCESS then begin try pWork := pBuffer; for i := 1 to dwEntriesRead do begin Result.Add(pWork.sv100_name); inc(pWork); end; //for i finally NetApiBufferFree(pBuffer); end; //try-finally end //if no error else begin raise Exception.Create('Error while retrieving computer list from domain ' + FDomainName + #13#10 + SysErrorMessage(dwResult)); end; end; &lt;snip&gt; </code></pre>
3,036
<p>In evaluating different systems integration strategies, I've come across some words of encouragement, but also some words of frustration over BizTalk Server. </p> <p>What are some pros and cons to using BizTalk Server (both from a developer standpoint and a business user), and should companies also consider open source alternatives? What viable alternatives are out there?</p> <p>EDIT: <a href="http://www.jitterbit.com/" rel="noreferrer">Jitterbit</a> seems like an interesting choice. Open Source and seems to be nicely engineered. Anyone on here have any experience working with it?</p>
<p>My experience with BizTalk was basically a frustrating waste of time.</p> <p>There are so many edge cases and weird little business logic tweaks you have to make when you are doing B2B data integration (which is probably the hardest part of any enterprise application) that you just need to roll your own solution.</p> <p>How hard is it to parse data files and convert them to a different format? Not that hard. Unless you're trying to inject a bloated middleware system like Biztalk into the middle of it.</p>
<p>I have no direct experience with JitterBit, but I have heard very good things from coworkers.</p>
8,666
<p>First, a little background. A couple of years ago, I was researching making my own candy, and I came across this page: <a href="http://www.instructables.com/id/LeGummies-brick-shaped-gummy-candies/" rel="nofollow">Lego brick shaped gummy candies</a>, describing how to use real Lego bricks as a positive to make silicone molds for Lego brick shaped candy. Now that I have a 3D printer, and inspired by the usual description of ABS filament ("It's the same plastic used to make Lego bricks") it occurs to me that I can now make any positive I want.</p> <p>The question is, would that be safe? I know the filament I'm using is not food safe, but if I create positives for a food safe silicone mold, would toxins leech into the mold? And if so, is there a barrier I can use to prevent this, such as some kind of coating?</p>
<p>In principle, ABS is safe for contact with (cold or room-temperature) food. The two main concerns specific to 3D printing are, assuming you start with a filament that is not itself contaminated:</p> <ol> <li><p>Pores and holes in the printed part which may harbor bacteria</p></li> <li><p>Impurities introduced into the plastic during the printing process</p></li> </ol> <p>I doubt that the silicone mold will capture the pores and holes with sufficient detail to be of any concern (it certainly won't capture the internal structure, only the surface).</p> <p>That leaves us with 2. It has been noted that brass nozzles contain trace amounts of lead. This lead can contaminate the printed part, which may in turn contaminate your mold, which may in turn contaminate your food. I don't think this is of realistic concern, since we're looking at trace amounts of trace amounts of lead. The nozzle might also have burnt plastic stuck to it (which might be carcinogenic) so you should make sure to do the print with a very clean nozzle and at a temperature that is not too high.</p> <p>ABS is food safe for contact with cold or room-temperature food. It is however not food safe for contact with hot food, because at higher temperatures the food may leach certain chemicals out of the plastic. Your application is one of low temperature, but silicone is not food and might perhaps leach some contaminants out of the plastic, regardless of temperature. However, this concern is not specific to 3D printing, as it applies to the method of making moulds out of Lego bricks as well. Therefore, making moulds from 3D printed positives does not appear to be different in a food safety perspective from making them out of LEGO blocks.</p>
<p>The plastic is not quite your main concern (though it still can be). You should worry about the cracks and crevices in FDM prints. Bacteria loves to hide there. For most people, this is the first concern when it comes to "Is X 3D printed food-safe?" If the end product is a hard material, you should sand or smooth your print to prevent the layer crevices from appearing in the end use product. Also consider food-safe epoxies for filling in gaps. If the end product is made of a flexible silicone, then this is less of a concern.</p> <p>ABS is not food safe. PLA as a material is considered food safe by the 3D printing community, but I have not seen a scientific study on this. However, many filament makers do not extrude pure PLA. Therefore, the answer to your question is that it depends on the manufacturer. You will need to contact the company to know what is in the filament first. Beware of untrustworthy manufacturers that claim food safety without backing that up.</p>
308
<p>Can you have a multicolumn listview control where one of the columns is a checkbox? Example code or links would be greatly appreciated.</p> <p>I am using visual studio 2005</p>
<p>Better use grid view control, but if you want <strong>only</strong> one column with checkboxes and that column is the <strong>first</strong> one you can just write: </p> <pre><code>this.listView1.CheckBoxes = true; </code></pre>
<p>You can try <a href="http://www.codeproject.com/KB/tree/treeviewadv.aspx" rel="nofollow noreferrer">TreeViewAdv</a>. It is open source and hosted on sourceforge.</p>
8,567
<p>I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just another thread in the current one). This means that web servers (like IIS) which are waiting for the process to finish continue waiting until the 'background' process finishes.</p> <p>Is there a way of forking off a background process from a CGI script under Windows? Even better, is there a single function I can call which will do this in a cross platform way?</p> <p>(And just to make life extra difficult, I'd really like a good way to redirect the forked processes output to a file at the same time).</p>
<p>If you want to do this in a platform independent way, <a href="http://search.cpan.org/~bzajac/Proc-Background/lib/Proc/Background.pm" rel="nofollow noreferrer">Proc::Background</a> is probably the best way.</p>
<p><a href="http://www.xav.com/perl/lib/Pod/perlfork.html" rel="nofollow noreferrer">perlfork</a>:</p> <blockquote> <p>Perl provides a fork() keyword that corresponds to the Unix system call of the same name. On most Unix-like platforms where the fork() system call is available, Perl's fork() simply calls it.</p> <p>On some platforms such as Windows where the fork() system call is not available, Perl can be built to emulate fork() at the interpreter level. While the emulation is designed to be as compatible as possible with the real fork() at the the level of the Perl program, there are certain important differences that stem from the fact that all the pseudo child ``processes'' created this way live in the same real process as far as the operating system is concerned.</p> </blockquote>
6,779
<p>Is there a tool that allows one to monitor GDI calls?</p>
<p>Tools like <a href="http://www.automatedqa.com/products/aqtime/index.asp" rel="nofollow noreferrer">AutomatedQA AQTime</a> can help you diagnose GDI usage. A much simpler, but free tool one can be found <a href="http://msdn.microsoft.com/en-us/magazine/cc188782.aspx" rel="nofollow noreferrer">here</a>.</p>
<p>Good advice, Lars. I've had a similar problem. Now use deleaker and do not worry;) GDI do not lose!</p>
6,887
<p>I want to show a chromeless modal window with a close button in the upper right corner. Is this possible?</p>
<p>You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like this:</p> <pre><code>&lt;Window WindowStyle="None"&gt; </code></pre> <p>That will still have a resize border. If you want to make the window non-resizable then add ResizeMode="NoResize" to the declaration.</p>
<pre><code>&lt;Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" WindowStyle="None" ResizeMode="NoResize"&gt; &lt;Button HorizontalAlignment="Right" Name="button1" VerticalAlignment="Top" &gt;Close&lt;/Button&gt; &lt;/Window&gt; </code></pre>
5,868
<p>What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance?</p>
<p><H2>Python CE</H2> Python port for Windows CE (Pocket PC) devices. Intended to be as close to desktop version as possible (console, current directory support, testsuite passed). </p> <p><a href="http://pythonce.sourceforge.net/" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NQmKI.jpg" alt="Python CE"></a><br> <sub>(source: <a href="http://pythonce.sourceforge.net/images/python-logo.jpg" rel="nofollow noreferrer">sourceforge.net</a>)</sub> </p> <p><img src="https://sourceforge.net/dbimage.php?id=76454" alt="alt text"></p>
<p>Just found this: <a href="http://ejr44.blogspot.com/2008/05/python-for-windows-mobile-cab.html" rel="nofollow noreferrer">http://ejr44.blogspot.com/2008/05/python-for-windows-mobile-cab.html</a></p> <p>Looks like a complete set of .CAB files to provide Python on Windows Mobile.</p>
8,531
<p>I changed the filament (PLA) in my Wanhao Duplicator I3+. I ended the first try to print when I saw that the 'lines' were too thin. I re-sliced with a higher temperature (195°C instead of 190°C). Now the print started without a problem but after about 25% no more filament came out of the extruder. What can be the reason and how can I resolve it?</p> <p>The filament is from Vertex, grey. The object that I use to test is a 20&nbsp;mm hollow cube from Thingiverse that I have used for the previous filament too.</p> <p>I am not sure that this is a clogging problem since the print starts with no problems. It just stopped after 25%. When I started another print I was able to finish by increasing the temperature. </p>
<p>I redid the print in order to reply to some questions posed in the answer of @kdtop. The print started but the output was not consistent and sometimes stopped. The temperature is 195°C and sometimes 'drop' to 194°C. First I pushed the new real so that the extruder did not need to pull so much. When this did not solve the problem I changed the temperature to 200°C. Now the output became consistent and my print finished. It was not as good as the one that I did with my previous filament. The top was not as neatly closed. Only the last 2 layers covered more or less for 100% the surface (perhaps 200°C is too high for this?).</p> <p>For me the solution is to higher the temperature to 200°C (or perhaps 205°C).</p>
<p>My slicer (Cura-lulzbot) has a setting for initial printing temp, and then printing temp after the first few layers. Is it possible that your temp is initially OK, but then drops too low? Does your printer have a readout that shows the current temp? Is the temp still OK when it stops?</p> <p>It sounds like you are printing a sample cube, so I assume not too large. Could you simulate this by just directly command your printer to extrude 500 mm of filament, or longer? Then see if it clogs. That would tell you if it was a physical problem with your printer instead of some change specified by the G-code for a sliced print. </p>
926
<p>I have a little routine that's run under Linux and Windows written in C and displays output on the console. I'm not linking in any form of curses or anything like that.</p> <p>Currently I clear the screen using</p> <pre><code>#ifdef __WIN32 system( "cls" ); #else system( "clear" ); #endif </code></pre> <p>Then I have a bunch of printf statements to update the status. What I'd like just reset the screenpointer to 0,0 so I can then just overlay my printfs. I'd rather avoid compiling in any more extensions especially since I'm coding for 2 different OS'.</p>
<p>Looks like I may have found a windows specific way of doing it <a href="http://msdn.microsoft.com/en-us/library/ms686025(VS.85).aspx" rel="nofollow noreferrer">SetConsoleCursorPosition</a></p> <p>Ansi escape sequence \033[0;0H for Linux - just printf that to the console.</p>
<p>Yes, for unix platforms, curses (or ncurses, these days) is the way to go. And there are versions that work under windows, so you could do it the same way on both systems.</p>
8,021
<p>So I am really fed up with inductive probes. The one I am using keeps getting shifted slightly every time I switch nozzles or run an oozy print. That means I have to autolevel again, then manually set a Z-offset (as I would have anyway if I didn't have an inductive probe).</p> <p>On my Lulzbot Mini there is a different scenario. There are four washers at each part of the bed. The nozzle is "grounded" so that when the Mini touches the washers, a current is created that seems to act as the Z-stop. Surprisingly there isn't much out there for a DIY implementation of this.</p> <p>Since I have an aluminum bed (and aluminum is conductive), I am thinking of doing the following:</p> <p>1) Put one wire from the Z-stop ground pin to the aluminum bed. Make sure it is away from the wires for the heater / thermister (?)</p> <p>2) Put one wire from the Z-stop 5V into the heating block of my nozzle.</p> <p>When the nozzle probes the bed, a current will be created from the 5V heating block, through the conductive nozzle, into the conductive bed, to the Z-stop ground.</p> <p>I'm always unsure when it comes to circuitry. Will there be any dangerous interference from this technique from, say, the bed heating circuit? I'm not sure what kind of protection circuitry are on each of the Arduino's pins, and I'd rather not fry my board if this sounds like a bad idea to someone.</p> <p>I figure most people don't do this because they have sheets of PEI or some other non-conductive material on their bed. I can use PET tape but still leave holes in the tape for this autobed leveling probe. It would be really great if it worked and wasn't dangerous. </p> <p>I shouldn't even need the third pin?</p>
<p>Aluminium is conductive, but aluminium oxide is not, which is just so what there (unavoidably, since aluminium rapidly oxidises in air) happens to be a thin layer of on top of your bed. The coating is very thin, but it might foul your plans. It would work better with a sharp probe (that can puncture the layer) than with a 3D printer nozzle. You should be careful, because your probing method might be unreliable (which could cause the nozzle to crash into the bed).</p> <p>Wiring the endstop 5V directly to ground will create a short circuit which will damage your printer. You should use the third (signal) pin and ground instead.</p>
<p>This will not work reliably.</p> <p>I know, I have tried it, for a couple of years, with poor consistency.</p> <p>Now, I will tell you that it worked better than the parallax IR sensors. It worked better than trying to slam the head into the bed and listen for the click.</p> <p>I used the brass nozzle and the aluminum bed as a switch to detect the bed position.</p> <p>I used ABS slurry on the bed. With a 100°C bed the ABS was soft enough for the nozzle to make contact. Elmer's Glue for PLA also was soft enough.</p> <p>But, with the elasticity I had in the synthetic Z-axis of the delta machine, the time delay to much the bed adhesive out of the way, and the general problem of trying to conduct electricity through an aluminum oxide layer, I had variability of about 0.1 mm, which was far to much to give a reliable first layer.</p> <p>To "level" the delta bed, I would touch each point several times (with a clean bed) and fit my leveling function to the noisy data. For finding my zero reference at the beginning of a print, I would touch off three time and only use the third one. This helped, but it was still super noisy.</p> <p>I have subsequently incorporated a strain gauge in the triangular delta-bit. It gives much more accurate contact information and is not effected by the bed glue not does the aluminum oxide layer cause problems.</p>
1,409
<p>I'm wondering what the best practice is for handling the problem with having to "include" so many files in my PHP scripts in order to ensure that all the classes I need to use are accessible to my script. </p> <p>Currently, I'm just using <a href="http://php.net/manual/en/function.include-once.php" rel="nofollow noreferrer">include_once</a> to include the classes I access directly. Each of those would <code>include_once</code> the classes that they access. </p> <p>I've looked into using the <code>__autoload</code> function, but hat doesn't seem to work well if you plan to have your class files organized in a directory tree. If you did this, it seems like you'd end up walking the directory tree until you found the class you were looking for. <strong><em>Also, I'm not sure how this effects classes with the same name in different namespaces.</em></strong> </p> <p><strong>Is there an easier way to handle this?</strong> </p> <p>Or is PHP just not suited to "<strong>enterprisey</strong>" type applications with lots of different objects all located in separate files that can be in many different directories.</p>
<p>I my applications I usually have <code>setup.php</code> file that includes all core classes (i.e. framework and accompanying libraries). My custom classes are loaded using autoloader aided by directory layout map.</p> <p>Each time new class is added I run command line builder script that scans whole directory tree in search for model classes then builds associative array with class names as keys and paths as values. Then, __autoload function looks up class name in that array and gets include path. Here's the code:</p> <p><strong>autobuild.php</strong></p> <pre><code>define('MAP', 'var/cache/autoload.map'); error_reporting(E_ALL); require 'setup.php'; print(buildAutoloaderMap() . " classes mapped\n"); function buildAutoloaderMap() { $dirs = array('lib', 'view', 'model'); $cache = array(); $n = 0; foreach ($dirs as $dir) { foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $entry) { $fn = $entry-&gt;getFilename(); if (!preg_match('/\.class\.php$/', $fn)) continue; $c = str_replace('.class.php', '', $fn); if (!class_exists($c)) { $cache[$c] = ($pn = $entry-&gt;getPathname()); ++$n; } } } ksort($cache); file_put_contents(MAP, serialize($cache)); return $n; } </code></pre> <p><strong>autoload.php</strong></p> <pre><code>define('MAP', 'var/cache/autoload.map'); function __autoload($className) { static $map; $map or ($map = unserialize(file_get_contents(MAP))); $fn = array_key_exists($className, $map) ? $map[$className] : null; if ($fn and file_exists($fn)) { include $fn; unset($map[$className]); } } </code></pre> <p>Note that file naming convention must be [class_name].class.php. Alter the directories classes will be looked in <code>autobuild.php</code>. You can also run autobuilder from autoload function when class not found, but that may get your program into infinite loop.</p> <p>Serialized arrays are darn fast.</p> <p>@JasonMichael: PHP 4 is dead. Get over it.</p>
<p><code>__autoload</code> works well if you have a consistent naming convention for your classes that tell the function where they're found inside the directory tree. MVC lends itself particularly well for this kind of thing because you can easily split the classes into models, views and controllers.</p> <p>Alternatively, keep an associative array of names to file locations for your class and let <code>__autoload</code> query this array.</p>
4,365
<p>I am messing around with <a href="http://code.google.com/p/zemscript/" rel="noreferrer">a toy interpreter in Java</a> and I was considering trying to write a simple compiler that can generate bytecode for the Java Virtual Machine. Which got me thinking, how much optimization needs to be done by compilers that target virtual machines such as JVM and CLI?</p> <p>Do Just In Time (JIT) compilers do constant folding, peephole optimizations etc?</p>
<p>I'm just gonna add two links which explain <a href="http://www.ibm.com/developerworks/ibm/library/it-haggar_bytecode/" rel="nofollow noreferrer">Java's bytecode</a> pretty well and some of the <a href="http://www.ibm.com/developerworks/java/library/j-benchmark1.html" rel="nofollow noreferrer">various optimization</a> of the JVM during runtime.</p>
<p>Optimising bytecode is probably an oxymoron in most cases. Unless you control the VM, you have no idea what it does to speed up code execution, if anything. The compiler would need to know the details of the VM in order to generate optimised code.</p>
4,047
<p>How does one <strong>reliably</strong> determine a file's type? File extension analysis is not acceptable. There must be a rubyesque tool similar to the UNIX file(1) command?</p> <p>This is regarding MIME or content type, not file system classifications, such as directory, file, or socket.</p>
<p>There is a ruby binding to <code>libmagic</code> that does what you need. It is available as a gem named <a href="https://rubygems.org/gems/ruby-filemagic/versions/0.7.1" rel="noreferrer">ruby-filemagic</a>:</p> <pre><code>gem install ruby-filemagic </code></pre> <p>Require <code>libmagic-dev</code>.</p> <p>The documentation seems a little thin, but this should get you started:</p> <pre><code>$ irb irb(main):001:0&gt; require 'filemagic' =&gt; true irb(main):002:0&gt; fm = FileMagic.new =&gt; #&lt;FileMagic:0x7fd4afb0&gt; irb(main):003:0&gt; fm.file('foo.zip') =&gt; "Zip archive data, at least v2.0 to extract" irb(main):004:0&gt; </code></pre>
<p>You could give a go with <a href="http://mime-types.rubyforge.org/" rel="nofollow noreferrer">MIME::Types for Ruby</a>.</p> <blockquote> <p>This library allows for the identification of a file’s likely MIME content type. The identification of MIME content type is based on a file’s filename extensions.</p> </blockquote>
7,469
<p>I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it was using before the attempt to modernize this beast began... but I digress. =) )</p> <p>In this same editing process, users can define (and change) a list of valid values that can be stored in these user created fields (if the user wants to limit what can be in the field).</p> <p>When the user changes the list of valid entries for a field, if they remove one of the valid values, they are allowed to choose a new "valid value" to map any rows that have this (now invalid) value in it, so that they now have a valid value again.</p> <p>In looking through the old code, I noticed that it is extremely vulnerable to putting the system into an invalid state, because the changes mentioned above are not done within a transaction (so if someone else came along halfway through the process mentioned above and made their own changes... well, you can imagine the problems that might cause).</p> <p>The problem is, I've been trying to get them to update under a single transaction, but whenever the code gets to the part where it changes the schema of that table, all of the other changes (updating values in rows, be it in the table where the schema changed or not... they can be completely unrelated tables even) made up to that point in the transaction appear to be silently dropped. I receive no error message indicating that they were dropped, and when I commit the transaction at the end no error is raised... but when I go to look in the tables that were supposed to be updated in the transaction, only the new columns are there. None of the non-schema changes made are saved.</p> <p>Looking on the net for answers has, thus far, proved to be a waste of a couple hours... so I turn here for help. Has anyone ever tried to perform a transaction through ADO that both updates the schema of a table and updates rows in tables (be it that same table, or others)? Is it not allowed? Is there any documentation out there that could be helpful in this situation?</p> <p>EDIT:</p> <p>Okay, I did a trace, and these commands were sent to the database (explanations in parenthesis)</p> <p><strong>(I don't know what's happening here, looks like it's creating a temporary stored procedure...?)</strong></p> <pre><code> declare @p1 int set @p1=180150003 declare @p3 int set @p3=2 declare @p4 int set @p4=4 declare @p5 int set @p5=-1 </code></pre> <p><strong>(Retreiving the table that holds definition information for the user-generated fields)</strong></p> <pre><code> exec sp_cursoropen @p1 output,N'SELECT * FROM CustomFieldDefs ORDER BY Sequence',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5 go </code></pre> <p><strong>(I think my code was iterating through the list of them here, grabbing the current information)</strong></p> <pre><code> exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursorfetch 180150003,1025,1,1 go exec sp_cursorfetch 180150003,1028,1,1 go exec sp_cursorfetch 180150003,32,1,1 go </code></pre> <p><strong>(This appears to be where I'm entering the modified data for the definitions, I go through each and update any changes that occurred in the definitions for the custom fields themselves)</strong></p> <pre><code> exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=1,@Description='asdf',@Format='U|',@IsLookUp=1,@Length=50,@Properties='U|',@Required=1,@Title='__asdf',@Type='',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=2,@Description='give',@Format='Y',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_give',@Type='B',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=3,@Description='up',@Format='###-##-####',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_up',@Type='N',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=4,@Description='Testy',@Format='',@IsLookUp=0,@Length=50,@Properties='',@Required=0,@Title='_Testy',@Type='',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=5,@Description='you',@Format='U|',@IsLookUp=0,@Length=250,@Properties='U|',@Required=0,@Title='_you',@Type='',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=6,@Description='never',@Format='mm/dd/yyyy',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_never',@Type='D',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go exec sp_cursor 180150003,33,1,N'[CustomFieldDefs]',@Sequence=7,@Description='gonna',@Format='###-###-####',@IsLookUp=0,@Length=0,@Properties='',@Required=0,@Title='_gonna',@Type='C',@_Version=1 go exec sp_cursorfetch 180150003,32,1,1 go </code></pre> <p><strong>(This is where my code removes the deleted through the interface before this saving began]... it is also the ONLY thing as far as I can tell that actually happens during this transaction)</strong> </p> <pre><code> ALTER TABLE CustomizableTable DROP COLUMN _weveknown; </code></pre> <p><strong>(Now if any of the definitions were altered in such a way that the user-created column's properties need to be changed or indexes on the columns need to be added/removed, it is done here, along with giving a default value to any rows that didn't have a value yet for the given column... note that, as far as I can tell, NONE of this actually happens when the stored procedure finishes.)</strong></p> <p><code><pre> go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '__asdf' go ALTER TABLE CustomizableTable ALTER COLUMN __asdf VarChar(50) NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx___asdf') CREATE NONCLUSTERED INDEX idx___asdf ON CustomizableTable ( __asdf ASC) WITH (PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF); go select * from IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx___asdf') CREATE NONCLUSTERED INDEX idx___asdf ON CustomizableTable ( __asdf ASC) WITH (PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF); go UPDATE CustomizableTable SET [__asdf] = '' WHERE [__asdf] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_give' go ALTER TABLE CustomizableTable ALTER COLUMN _give Bit NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__give') DROP INDEX idx__give ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_give] = 0 WHERE [_give] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_up' go ALTER TABLE CustomizableTable ALTER COLUMN _up Int NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__up') DROP INDEX idx__up ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_up] = 0 WHERE [_up] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_Testy' go ALTER TABLE CustomizableTable ADD _Testy VarChar(50) NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__Testy') DROP INDEX idx__Testy ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_Testy] = '' WHERE [_Testy] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_you' go ALTER TABLE CustomizableTable ALTER COLUMN _you VarChar(250) NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__you') DROP INDEX idx__you ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_you] = '' WHERE [_you] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_never' go ALTER TABLE CustomizableTable ALTER COLUMN _never DateTime NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__never') DROP INDEX idx__never ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_never] = '1/1/1900' WHERE [_never] IS NULL go SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'CustomizableTable') AND name = '_gonna' go ALTER TABLE CustomizableTable ALTER COLUMN _gonna Money NULL go IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CustomizableTable]') AND name = N'idx__gonna') DROP INDEX idx__gonna ON CustomizableTable WITH ( ONLINE = OFF ); go UPDATE CustomizableTable SET [_gonna] = 0 WHERE [_gonna] IS NULL go </pre></code></p> <p><strong>(Closing the Transaction...?)</strong></p> <p><code><pre> exec sp_cursorclose 180150003 go </pre></code></p> <p>After all that ado above, only the deletion of the column occurs. Everything before and after it in the transaction appears to be ignored, and there were no messages in the SQL Trace to indicate that something went wrong during the transaction.</p>
<p>The code is using a server-side cursor, that's what those calls are for. The first set of calls is preparing/opening the cursor. Then fetching rows from the cursor. Finally closing the cursor. Those sprocs are analogous to the OPEN CURSOR, FETCH NEXT, CLOSE CURSOR T-SQL statements.</p> <p>I'd have to take a closer look (which I will), but my guess is there is something going on with the server-side cursor, the encapsulating transaction, and the DDL.</p> <p>Some more questions:</p> <ol> <li>Are you meaning to use server-side cursors in this case?</li> <li>Are the ADO Commands all using the same active connection?</li> </ol> <p><strong>Update:</strong></p> <p>I'm not exactly sure what's going on.</p> <p>It looks like you're using server-side cursors so you can use Recordset.Update() to push changes back to the server, in addition to executing generated SQL statements to alter schema and update data in the dynamic table(s). Using the same connection, inside an explicit transaction.</p> <p>I'm not sure what effect the cursor operations will have on the rest of the transaction, or vice-versa, and to be honest I'm surprised this isn't working.</p> <p>I don't know how large of a change it would be, but I would recommend moving away from the server-side cursors and building the UPDATE statements for your table updates.</p> <p>Sorry I couldn't be of more help.</p> <p>BTW- I found the following information on the sp_cursor calls:</p> <p><a href="http://jtds.sourceforge.net/apiCursors.html" rel="nofollow noreferrer">http://jtds.sourceforge.net/apiCursors.html</a></p>
<p>The behavior you describe is allowed. How is the code making the schema changes? Building SQL on the fly and executing through an ADO Command? Or using ADOX?</p> <p>If you have access to the database server, try running a SQL Profiler trace while testing the scenario you outlined. See if the trace logs any errors/rollbacks.</p>
8,235
<p>I've been banging my head against <code>SQL Server 2005</code> trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with any row that has a string with a comma in it (or whatever you use as a delimiter) and I would still have to hand write all of the create table statements, as obviously CSV doesn't tell you anything about the data types.</p> <p>What would be better is if there was some tool that could connect to both SQL Server and MySQL, then do a copy. You lose views, stored procedures, trigger, etc, but it isn't hard to copy a table that only uses base types from one DB to another... is it?</p> <p>Does anybody know of such a tool? I don't mind how many assumptions it makes or what simplifications occur, as long as it supports integer, float, datetime and string. I have to do a lot of pruning, normalising, etc. anyway so I don't care about keeping keys, relationships or anything like that, but I need the initial set of data in fast!</p>
<p>The best way that I have found is the <a href="http://www.mysql.com/products/tools/migration-toolkit/" rel="noreferrer">MySQL Migration Toolkit</a> provided by MySQL. I have used it successfully for some large migration projects.</p>
<p>Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question).</p> <p>If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would recommend using PHP 5.2+ and the PDO libraries. You'll be able to connect using PDO ODBC (and use MSSQL drivers). I had a lot of problems getting large text fields and multi-byte characters from MSSQL into PHP using other libraries.</p>
2,259
<p>Has anyone been able to get an NHibernate-based project up and running on a shared web host?</p> <p>NHibernate does a whole lot of fancy stuff with reflection behind the scenes but the host that I'm using at the moment only allows applications to run in medium trust, which limits what you can do with reflection, and it's throwing up all sorts of security permission errors. This is the case even though I'm only using public properties in my mapping files, though I do have some classes defined as proxies.</p> <p>Which companies offer decent (and reasonably priced) web hosting that allows NHibernate to run without complaining?</p> <p><strong>Update:</strong> It seems from these answers (and my experimentation -- sorry Ayende, but I still can't get it to work on my web host even after going through the article you linked to) is to choose your hosting provider wisely and shop around. It seems that WebHost4Life are pretty good in this respect. However, has anyone tried NHibernate with Windows shared hosting with 1and1? I have a Linux account with them already and I'm fairly satisfied on that front, and if I could get NHibernate to work seamlessly with Windows I'd probably stick with them.</p>
<p>I have had no issues with running NHibernate based apps on WebHost4Life, although I don't like them.</p> <p>Getting NHibernate to run on medium trust is possible. A full description on how this can be done is found here:</p> <p><a href="http://blechie.com/WPierce/archive/2008/02/17/Lazy-Loading-with-nHibernate-Under-Medium-Trust.aspx" rel="noreferrer">http://blechie.com/WPierce/archive/2008/02/17/Lazy-Loading-with-nHibernate-Under-Medium-Trust.aspx</a></p>
<p>I'm using a Finnish host called <a href="http://www.nebula.fi" rel="nofollow noreferrer">Nebula</a> that happily runs my NHibernate-leveraging applications. I had an issue once with trust levels; the machine.config on the host was configured to deny reflection but I successfully overrode it in the web.config.</p>
8,684
<p>I have an incoming project and the only 3D printer available to me is the TronXY X1. </p> <p>So the question is: Can it handle at least four days of continuous load or should I search for an alternate solution? </p> <p><em>I don't want to damage (my only) 3D printer for this project.</em></p>
<p>I have the same Printer - a TronXY X1, and I feel confident that with a little upgrade here and there, it can handle long prints without problems.</p> <p>The most needed upgrade is a quality power brick. Mine died after some month. For replacement I have chosen a 12&nbsp;V/10&nbsp;A output one of a reputable supplier with warranty and it runs without any warming since.</p> <p>Then, I did upgrade the hotend itself. The built in hotend can become leaky under long prints. I did fix this by exchanging it for a genuine e3d-v6 lite. Yes, only a lite, because this machine can only print PLA anyways for a lack of a heated bed - and there is little size one can add to the machine's print surface due to design limitations (one can only extend Y and Z to some degree without generating problems).</p> <p>Tighteners for the X on the Z-axis and the bed are a very good idea to make the printer a little more reliable, resulting in less misprints or lost prints at upper heights due to wobble or layer shift.</p> <p>Generally, I have printed some quite long prints (several 16 hours, one 28 hours), and with a reliable hotend and good filament feed (in once case the spool got jammed by a pen falling into it), the TronXY X1 did do its work quite good. Mind, that I tend to always print at 0.1 mm layer hight.</p> <p>I do not know how 4 days of continuous load would work out, but my X1 has some summed up 2 weeks of prints under its belt by now, so... I <em>think</em> it can do this, but I would give it a general check (for example inspect if the bed is still settled tight) between prints.</p>
<p>I know that this is a bit <em>wishy-washy</em> but some can, some can't.</p> <p>The TronXY has a bit of an issue with the power supply to start with. The <em>power brick</em> is a (<em>reportedly</em>) bit suspect, for long jobs, see <a href="https://3dprinting.stackexchange.com/questions/5798/ramps-1-4-with-a-power-brick/6171#6171">my answer</a> to the question, <a href="https://3dprinting.stackexchange.com/questions/5798/ramps-1-4-with-a-power-brick">Ramps 1.4 with a power brick</a>.</p> <p>It could be worth upgrading the power supply to a higher current rated PSU (20&nbsp;A - 35&nbsp;A), with an aluminium enclosure, i.e. those PSUs which are marketed as LED power supplies, such as this, <a href="https://www.aliexpress.com/item/Tronxy-3D-printer-accessoires-power-supply-240W-AC110-220V-DC-12V-20A-for-3D-print-DIY/32723053329.html" rel="nofollow noreferrer">Tronxy 3D printer accessoires power supply 240W AC110/220V DC 12V 20A for 3D print DIY kit part</a> on AliExpress. </p> <p>Then you can add your heatbed (that you refer to in your other question), without worrying.</p> <p>It all depends on how critical your 24/7 project is. Is it a serious production run or just a hobby-like project that is a bit of a fun endurance test? How important is it that the print run goes without a hitch? Would a power supply failure mid-print be catastrophic or easily shrugged off? Would the delay incurred by trying to find a replacement power brick actually matter that much?</p> <p>A simple analogy would be driving from Germany to Mauritania across the Western Sahara, with some serious, and urgent medical supplies. You could either either buy a well maintained, and carefully run in, Mercedes, which will most likely last the entire journey and then some, <em>or</em> you could buy a clapped out old Lada, with 500000 km on the clock, with the vain hope of getting there. The Mercedes would seem to be the better option.</p> <p>However, if you are delivering a <a href="https://en.wikipedia.org/wiki/Dundee_cake" rel="nofollow noreferrer">Dundee cake</a> for an Aunt, which is neither time critical nor particularly important and you aren't even sure that your Aunt will be at home when you get there, then maybe the Lada will suffice. </p> <p>Into which category does your 24/7 print project fall in? It sounds like the former.</p> <p>Apart from the power supply, i.e. w.r.t. the stepper motors and hotend, unfortunately, I don't know the answer and can not answer your question.</p>
949
<p>I have started printing about a month ago on an Ender 5 (using mostly PLA but recently also PETG) and it seems it's about time to give the print bed a more thorough cleaning than what I usually do after most prints. I'm using the flexible magnetic mat that came with the printer which has a slightly rough surface, but all of the cleaning suggestions I found so far either did not mention the bed material or were specifically for glass beds.</p> <p>Can/should I use stuff like acetone or rubbing alcohol on this? Or should I stick to warm soap water? I have had some fairly decent results with spectacle cleaning tissues but that will only remove grease, not filament residue.</p> <p>Also, I am occasionally having some first layer adhesion issues (especially with the PETG or when printing things with a circular base) and I was wondering whether common suggestions like glue sticks or hairspray to prepare the bed for printing can also be applied to the flex mat?</p>
<p>I have the WhamBam system which uses a PEX layer over flex steel (which sticks to a magnetic sheet on the printer bed). To clean old material off, I use a "brass sponge" intended for cleaning soldering iron tips to remove the old plastic, then give it a wipe with a paper towel with some isopropyl alchohol (I have 99.99 anhydrous on hand as I use that for cleaning printed circuit boards as well).</p> <p>The brass sponge is fairly soft, does a good job of grabbing the old plastic without tearing up the PEX layer.</p>
<p>I have the WhamBam system which uses a PEX layer over flex steel (which sticks to a magnetic sheet on the printer bed). To clean old material off, I use a "brass sponge" intended for cleaning soldering iron tips to remove the old plastic, then give it a wipe with a paper towel with some isopropyl alchohol (I have 99.99 anhydrous on hand as I use that for cleaning printed circuit boards as well).</p> <p>The brass sponge is fairly soft, does a good job of grabbing the old plastic without tearing up the PEX layer.</p>
1,396
<p>I see <code>__all__</code> in <code>__init__.py</code> files. What does it do?</p>
<p>It's a list of public objects of that module, as interpreted by <code>import *</code>. It overrides the default of hiding everything that begins with an underscore.</p>
<p>This is defined in PEP8 <a href="https://www.python.org/dev/peps/pep-0008/#global-variable-names" rel="nofollow noreferrer">here</a>:</p> <blockquote> <p>Global Variable Names</p> <p>(Let's hope that these variables are meant for use inside one module only.) The conventions are about the same as those for functions.</p> <p>Modules that are designed for use via <code>from M import *</code> should use the <code>__all__</code> mechanism to prevent exporting globals, or use the older convention of prefixing such globals with an underscore (which you might want to do to indicate these globals are &quot;module non-public&quot;).</p> </blockquote> <p>PEP8 provides coding conventions for the Python code comprising the standard library in the main Python distribution. The more you follow this, closer you are to the original intent.</p>
6,662
<p>So, in Java, the first line of your constructor HAS to be a call to super... be it implicitly calling super(), or explicitly calling another constructor. What I want to know is, why can't I put a try block around that?</p> <p>My specific case is that I have a mock class for a test. There is no default constructor, but I want one to make the tests simpler to read. I also want to wrap the exceptions thrown from the constructor into a RuntimeException.</p> <p>So, what I want to do is effectively this:</p> <pre><code>public class MyClassMock extends MyClass { public MyClassMock() { try { super(0); } catch (Exception e) { throw new RuntimeException(e); } } // Mocked methods } </code></pre> <p>But Java complains that super isn't the first statement.</p> <p>My workaround:</p> <pre><code>public class MyClassMock extends MyClass { public static MyClassMock construct() { try { return new MyClassMock(); } catch (Exception e) { throw new RuntimeException(e); } } public MyClassMock() throws Exception { super(0); } // Mocked methods } </code></pre> <p>Is this the best workaround? Why doesn't Java let me do the former?</p> <hr> <p>My best guess as to the "why" is that Java doesn't want to let me have a constructed object in a potentially inconsistent state... however, in doing a mock, I don't care about that. It seems I should be able to do the above... or at least I know that the above is safe for my case... or seems as though it should be anyways.</p> <p>I am overriding any methods I use from the tested class, so there is no risk that I am using uninitialized variables.</p>
<p>Unfortunately, compilers can't work on theoretical principles, and even though you may know that it is safe in your case, if they allowed it, it would have to be safe for all cases.</p> <p>In other words, the compiler isn't stopping just you, it's stopping everyone, including all those that don't know that it is unsafe and needs special handling. There are probably other reasons for this as well, as all languages usually have ways to do <em>unsafe</em> things if one knows how to deal with them.</p> <p>In C# .NET there are similar provisions, and the only way to declare a constructor that calls a base constructor is this:</p> <pre><code>public ClassName(...) : base(...) </code></pre> <p>in doing so, the base constructor will be called before the body of the constructor, and you cannot change this order.</p>
<p>One way to get around it is by calling a private static function. The try-catch can then be placed in the function body.</p> <pre><code>public class Test { public Test() { this(Test.getObjectThatMightThrowException()); } public Test(Object o) { //... } private static final Object getObjectThatMightThrowException() { try { return new ObjectThatMightThrowAnException(); } catch(RuntimeException rtx) { throw new RuntimeException("It threw an exception!!!", rtx); } } } </code></pre>
2,728
<p>I'm trying to install some Ruby Gems so I can use Ruby to notify me when I get twitter messages. However, after doing a <code>gem update --system</code>, I now get a zlib error every time I try and do a <code>gem install</code> of anything. below is the console output I get when trying to install ruby gems. (along with the output from <code>gem environment</code>).</p> <pre><code>C:\data\ruby&gt;gem install twitter ERROR: While executing gem ... (Zlib::BufError) buffer error C:\data\ruby&gt;gem update --system Updating RubyGems ERROR: While executing gem ... (Zlib::BufError) buffer error C:\data\ruby&gt;gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.2.0 - RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] - INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8 - RUBY EXECUTABLE: c:/ruby/bin/ruby.exe - EXECUTABLE DIRECTORY: c:/ruby/bin - RUBYGEMS PLATFORMS: - ruby - x86-mswin32-60 - GEM PATHS: - c:/ruby/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources =&gt; true - :verbose =&gt; true - :benchmark =&gt; false - :backtrace =&gt; false - :bulk_threshold =&gt; 1000 - REMOTE SOURCES: - http://gems.rubyforge.org/ </code></pre>
<p>I just started getting this tonight as well. Googling turned up a bunch of suggestions that didn't deliver results</p> <pre><code>gem update --system </code></pre> <p>and some paste in code from jamis that is supposed to replace a function in package.rb but the original it is supposed to replace is nowhere to be found.</p> <p>Reinstalling rubygems didn't help. I'm reinstalling ruby right now.........and it is fixed. Pain though.</p>
<p>Try updating <a href="http://gnuwin32.sourceforge.net/packages/zlib.htm" rel="nofollow noreferrer">ZLib</a> before you do anything else. I had a similar problem on OS X and updating <a href="http://search.cpan.org/~pmqs/IO-Compress-2.020/lib/Compress/Zlib.pm" rel="nofollow noreferrer">Compress::Zlib</a> (a Perl interface to ZLib) cured it - so I think an old version of <a href="http://www.zlib.net/" rel="nofollow noreferrer">ZLib</a> (is now 1.2.3) may be where your problem lies...</p>
4,791
<p>We are currently using the ExtJS tree view in an application - a requirement has arisen requiring a user to select multiple nodes (which the tree view supports currently through a pluggable selection model) - but you can not then drag the multiple selections to another part of the tree.</p> <p>Does anyone know of an ajax control (commercial or non-commercial) that supports multiple-selection drag / drop - or a example of enabling this functionality in ExtJS?</p>
<p>Check out this post in the ExtJS forum that details how you can enable multi-select in a Javascript tree.</p> <p><a href="http://extjs.com/forum/showthread.php?t=28115" rel="nofollow noreferrer">http://extjs.com/forum/showthread.php?t=28115</a></p>
<p>Ha i just asked the exact same question in their forum... want to acheive the goal without using the Custom User-Extension tough.</p> <p><a href="http://www.extjs.com/forum/showthread.php?97463-3.2.0-Treepanel-MultiSelectionModel-and-Dragdrop&amp;p=459962" rel="nofollow noreferrer">http://www.extjs.com/forum/showthread.php?97463-3.2.0-Treepanel-MultiSelectionModel-and-Dragdrop&amp;p=459962</a></p> <p>Just for reference.</p> <p>Regards, Fabian Loibl</p>
6,926
<p>With respect to <a href="https://3dprinting.stackexchange.com/questions/7172/dual-extruder-clogging-problem#comment11340_7172">Himanshu's comment</a> about applying a lubricant to PLA filament, and then having read the Reddit thread, <a href="https://www.reddit.com/r/3Dprinting/comments/52xjcg/seasoning_allmetal_hot_ends_with_oil/" rel="nofollow noreferrer">Seasoning all-metal hot ends with oil?</a>, pointed to in <a href="https://3dprinting.stackexchange.com/questions/7172/dual-extruder-clogging-problem/7181#7181">0scar's answer</a>, I was wondering if any studies have been done on the topic?</p> <p>If so, what is the general consensus? From the Reddit thread it seems as if the better quality branded hotends, such as E3D do not require it, whereas the older, or less well finished clones, may well benefit from such treatment.</p> <p>In addition, which oil is preferable, animal, vegetable or mineral? Is vaseline a good idea?</p> <p>Also, would the advice differ if ABS filament is used, or would the same conditions apply?</p>
<p>I'm gonna go out on a limb here and say this is probably not a good idea in any capacity.</p> <p>First off, if you take a look at <a href="https://en.wikipedia.org/wiki/Template:Smoke_point_of_cooking_oils" rel="noreferrer">this list</a> of cooking oils, you'll notice that pretty much all of them have smoke points below the printing temperature of ABS, with a handful of exceptions that have smoke points just barely above that temperature. All that means is that the hydrocarbon chains are going to break down inside your extruder, which really accomplishes nothing helpful for you. As the compounds break down further and oxidize with the small amounts of air coming into the extruder, you're going to get carbon fouling on all surfaces, including the filament itself as it extrudes.</p> <p>Second, and this depends entirely on the amount of oil present, but I'd expect to see oil actually coating the filament somewhat as it comes out of the nozzle, and acting as a separating agent between the lines of filament on the print itself. I'm not sure how much you'd actually experience this, but again, best case scenario is it doesn't happen, and the oil doesn't give you any real advantage here.</p> <p>Third, the process of seasoning cast iron works because the surface of the cast iron should be smooth for minimal food sticking, and any kind of rusting causes pits and porosity in the metal. Seasoning just ensures that oil stays in the metal to prevent moisture from interacting with it, and to provide a very thin oil layer that somewhat separates food from the metal until the food is hot enough that its own fats have started to lubricate it against the pan. Extruders on the other hand really shouldn't have porous surfaces nor be made of easily oxidized materials. Stainless heatbreaks, aluminum blocks, brass nozzles, all of these really aren't going to rust readily and probably won't benefit much from an oil coating.</p> <p>Fourth, if you're looking for a nonstick coating for the interior of the extruder, a PTFE liner has been known to give excellent results for a very long time now. If you're printing above the temperatures PTFE can survive at, then unfortunately you're also printing above the temperatures that pretty much any cooking oil (or petroleum jelly) will survive without rapidly breaking down.</p> <p>So to summarize, you're not going to find many oils that can even survive inside an extruder, and they wouldn't really give you many benefits for the duration of time that they weren't just a charcoal slurry.</p>
<p>W.R.T <a href="https://3dprinting.stackexchange.com/a/10247/4762">Nach0z's answer</a>:</p> <blockquote> <p>Third, the process of seasoning cast iron works because the surface of the cast iron should be smooth for minimal food sticking, and any kind of rusting causes pits and porosity in the metal.</p> </blockquote> <p>You season a cast iron pan to create a carbon layer on top of the metal. Water should not be left standing in a cast iron skillet. For my 3D printers I replace the Bowden tube once a year. It cures many problems for me. I suspect that over time the filament cause abrasion in the tube that increases friction. I also do a teardown and cleaning of the extruder in the same interval.</p>
1,072
<p>I'm using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, how do I access them from, for example, another stored procedure?</p> <pre><code>CREATE PROCEDURE getOrder (@orderId as numeric) AS BEGIN select order_address, order_number from order_table where order_id = @orderId select item, number_of_items, cost from order_line where order_id = @orderId END </code></pre> <p>I need to be able to iterate through both result sets individually.</p> <p>EDIT: Just to clarify the question, I want to test the stored procedures. I have a set of stored procedures which are used from a VB.NET client, which return multiple result sets. These are not going to be changed to a table valued function, I can't in fact change the procedures at all. Changing the procedure is not an option.</p> <p>The result sets returned by the procedures are not the same data types or number of columns.</p>
<p>The short answer is: you can't do it.</p> <p>From T-SQL there is no way to access multiple results of a nested stored procedure call, without changing the stored procedure as others have suggested.</p> <p>To be complete, if the procedure were returning a single result, you could insert it into a temp table or table variable with the following syntax:</p> <pre><code>INSERT INTO #Table (...columns...) EXEC MySproc ...parameters... </code></pre> <p>You can use the same syntax for a procedure that returns multiple results, but it will only process the first result, the rest will be discarded.</p>
<p>You could select them into temp tables or write table valued functions to return result sets. Are asking how to iterate through the result sets?</p>
8,341
<p>I'm quite new to 3D-printing. I need to build a curved piece with a hole pattern and I was wondering whether it was possible to print such a hole pattern accurately, with such a thin (3 mm) thickness of the piece. In the past, when I tried printing thinner pieces with holes, the piece warped and holes were not printed properly. Therefore is there any changes to the model I need to make to improve the quality of the print, or add any supports? I am using an Ender 3 Pro, with PLA.</p> <p><a href="https://i.stack.imgur.com/o2h6A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o2h6A.png" alt="enter image description here" /></a></p>
<p>People like PLA for dimensional accuracy. It's disadvantage is it becomes brittle, which can be an issue especially with thin prints if the application tends to bend it (applying force). Working with settings and with a 0.4 mm nozzle, typical for most printers using PLA, you can print walls as thin as 1 mm, but strength may be an issue.</p> <p>To prevent warping, you need the PLA to stick to the build surface; something like a PEI tape surface. glue stick, or hair spray. Slowing down the print speed decreases warping. With a heated bed, you can print you first layer hotter (e.g. 75 °C) so that the PLA sticks well to the build surface, then use a lower temperature for subsequent layers (e.g. 60-65 °C) so that the PLA is stiffer. A level bed is also important to prevent warping. Using a brim also helps prevent warping.</p> <p>Your print orientation is good for the print accuracy of your curved ends, but not as good for keeping a perfect circular shape of your holes. However, the smaller the holes the better the circular shape as long as they are large enough to print with your printer.</p>
<p>That depends on the printer, the print material and your experience level (and maybe print orientation, but that depends on the load case), but, the depicted part should be printed very well at a thickness of 3 mm (that is not really &quot;thin&quot;). PLA will be easier than higher temp materials like ABS and PETG, but not impossible.</p>
1,863
<p>I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that?</p>
<p>The Ajaxian blog had a post about this today.</p> <p><a href="http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer" rel="nofollow noreferrer">http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer</a></p>
<p>The Ajaxian blog had a post about this today.</p> <p><a href="http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer" rel="nofollow noreferrer">http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer</a></p>
5,291
<p>I've created a script that runs every night on my Linux server that uses <code>mysqldump</code> to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file. The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping. I've been able to send the raw script in the body an email by piping the backup text file to <code>mailx</code> like so:</p> <pre><code>$ cat mysqldbbackup.sql | mailx backup@email.example </code></pre> <p><code>cat</code> echoes the backup file's text which is piped into the <code>mailx</code> program with the recipient's email address passed as an argument.</p> <p>While this accomplishes what I need, I think it could be one step better, <strong>Is there any way, using shell scripts or otherwise, to send the compressed .tar file to an outgoing email message as an <em>attachment</em>?</strong> This would beat having to deal with very long email messages which contain header data and often have word-wrapping issues etc.</p>
<p>None of the mutt ones worked for me. It was thinking the email address was part of the attachment. Had to do:</p> <pre><code>echo &quot;This is the message body&quot; | mutt -a &quot;/path/to/file.to.attach&quot; -s &quot;subject of message&quot; -- recipient@domain.example </code></pre>
<p>If mutt is not working or not installed,try this-</p> <pre><code>*#!/bin/sh FilePath=$1 FileName=$2 Message=$3 MailList=$4 cd $FilePath Rec_count=$(wc -l &lt; $FileName) if [ $Rec_count -gt 0 ] then (echo "The attachment contains $Message" ; uuencode $FileName $FileName.csv ) | mailx -s "$Message" $MailList fi* </code></pre>
3,802