instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated.</p> <p>Thanks</p>
<p><a href="http://www.junlu.com/msg/179368.html" rel="nofollow noreferrer">This page</a> seems to imply that the correct configuration element is:</p> <pre><code>&lt;attribute name="MaxCapacity">20000&lt;/attribute></code></pre> <p>However, I've only ever used EHCache myself.</p>
<p>In the version I am working on (JBossCache 1.4.1), it looks like it is not possible to configure this parameter.</p>
8,386
<p>I've moved from TFS to SVN (TortoiseSVN) with my current company. I really miss the "Shelve" feature of TFS. I've read various articles on how to "Shelve" with SVN, but I've read nothing that gives a very simple experience to "shelve" work.</p> <p>Ideally, I'd like extra items added to the TortoiseSVN context menu - "Shelve" &amp; "Unshelve". "Shelve" would remove the current shelve-set, and upload the working directory under a suitable path defined by user options. "Unshelve" would merge the set with the working copy.</p> <p>Does something like this exist? Can anyone suggest any ways to "hack" this feature in the GUI?</p> <p>Note: The following link doesn't really achieve the user experience I was looking for:</p> <p><a href="http://mikemason.ca/2005/03/30/" rel="noreferrer">Shelving Subversion</a></p> <p>One of the greatest things about TFS Shelve is how easy it is to use...</p>
<p>I don't believe that SVN has this feature built into the server product. I also don't believe anything like this emulated in any clients that I have used, including TortoiseSVN.</p> <p>To get around this problem, I have resorted to using a DVCS such as <a href="http://git.or.cz/" rel="nofollow noreferrer">Git</a> or <a href="http://www.selenic.com/mercurial/" rel="nofollow noreferrer">Mercurial</a>, to allow me to branch/merge/shelve locally before pushing the content back to SVN. It's arguably a bit of a kludge, but it works really well.</p>
<h2>Support Feature</h2> <p>SVN supports for shelves is <strong>experimental</strong> means, it doesn't promise backward compatibility for future releases, either its disabled by default.</p> <p>it has been <a href="https://subversion.apache.org/docs/release-notes/1.10.html#shelving" rel="nofollow noreferrer">started with version 1.10</a></p> <p>but the shelves create with 1.10 &amp; 1.11 <a href="https://subversion.apache.org/docs/release-notes/1.12.html#cmdline" rel="nofollow noreferrer">is not supported by newer version</a>, as it didn't promises so.</p> <p>so there are different underlying and you have to pay attention that this is an experimental feature and is going to be improved over the time.</p> <p>the 1.10 shelve commands start with <code>svn shelve</code> but the 1.11 &amp; 1.12 starts with <code>svn x-shelve</code>.</p> <h2>Commands</h2> <p>the <a href="https://subversion.apache.org/docs/release-notes/1.14.html#shelving" rel="nofollow noreferrer">commands</a> for new shelve are:</p> <pre class="lang-sh prettyprint-override"><code> svn x-shelf-diff svn x-shelf-drop svn x-shelf-list, x-shelves svn x-shelf-list-by-paths svn x-shelf-log svn x-shelf-save svn x-shelve svn x-unshelve </code></pre> <h2>Activating</h2> <p>for activating using this feature you have to run the command by setting the enviourment variable:</p> <pre class="lang-sh prettyprint-override"><code>#Shelving-v3, as introduced in 1.12 SVN_EXPERIMENTAL_COMMANDS=shelf3 #Shelving-v2, as introduced in 1.11 SVN_EXPERIMENTAL_COMMANDS=shelf2 </code></pre> <p>further information can be found here:</p> <p><a href="https://subversion.apache.org/docs/release-notes/1.14.html#shelving" rel="nofollow noreferrer">https://subversion.apache.org/docs/release-notes/1.14.html#shelving</a></p>
2,994
<p>This might be a dumb question, but can a 60 watt heater be used on a 40 watt unit?</p> <p>Simply put, I was wrong in thinking that more power was simply stuffed into the same dimensions.</p> <p>It extends about 5 millimeters beyond my heating block. Can it be used in general or will it lead to some consequences?</p> <p><a href="https://i.stack.imgur.com/sz0R4.jpg" rel="nofollow noreferrer" title="Photo showing heating element protruding from heater block"><img src="https://i.stack.imgur.com/sz0R4.jpg" alt="Photo showing heating element protruding from heater block" title="Photo showing heating element protruding from heater block" /></a></p>
<p>I'd expect the heater sticking out as pictured to cause problems -- the exposed part of the heater will tend to overheat (it's not conducting heat away into the heat block) and isn't protected by the thermistor and software PID acting as a smart thermostat.</p> <p>It <em>might</em> be possible to install the heater in a more centered position, so less of it protrudes beyond the block, but this is likely to leave the wire end sticking out instead. I'd have to recommend either getting the correct heater, or upgrading your entire hot end to accommodate the larger heater (which involves also verifying the driver circuitry on your control board can handle 50% higher current, resetting your nozzle offsets so you don't print off the build surface on prints that run close to Ymin, and likely modifying or replacing your part cooling fan and/or its shroud).</p>
<p>One simple consequence is that you're going to have a hard time finding a sock that fits properly. If you cut one, or have one that has a hole where the heater protrudes, it will physically fit but then not do its job preventing radiative/convective heat loss and transfer to your printed part, or preventing stray material from sticking to the heater. You could make a custom one with molded RTV silicone, of course.</p>
2,093
<p>I am interested in choosing a good structure for an online message board-type application. I will use SO as an example, as I think it's an example that we are all familiar with, but my question is more general; it is about how to achieve the right balance between organization and flexibility in online message boards.</p> <p>The questions page is a load of random stuff. It moves quickly (some might say, too quickly) and contains a huge number of questions that I'm not interested in.</p> <p>The idea, I imagine, is that we can use tags to find questions that we're interested in. However, I'm not sure that this works: you can't use tags negatively. I'm <em>not</em> interested in PHP or perl or web development. I want to <em>exclude</em> such posts. But with the tags, I can't.</p> <p>Although discrete subforums are in a sense less flexible, as they generally force you to pick a category even if a question might fit into two (if SO had, say, areas for "Web Development", "Games development", "Computer Science", "Systems Programming", "Databases", etc. then sure, some people might want to post about developing of web-based games, for example) is it worth sacrificing some of that flexibility in order to make it easier to find the content that you are interested in, and hide the content that you are not interested in?</p> <p>Is there any way with a pure tagging system to achieve the greater ease of use that subforums provide?</p>
<p>The real problem with subforums comes when you guess wrong about which topics have enough interest to get their own subforums. While some topics end up with their own vibrant subcommunities others end up as empty ghettos, with little activity or feeling of community. Topics that might flourish as occasional subjects in a larger forum end up fragmented among many subforums, none of which has the critical mass of people necessary to have an active, vibrant community.</p>
<p>Though I think that tagging is supperior to grouping, people tend to think hierarchically. In general it depends on the target group for the forum. </p> <p>Maybe you can go with a mixture: use tagging and later use tag groups to order to posts. Delicious uses this, for example, and I find it rather helpful.</p>
7,079
<p>How can you implement trackbacks on a custom-coded blog (written in C#)?</p>
<p>The TrackBack specification was created by Six Apart back in the day for their <a href="http://www.movabletype.org/" rel="nofollow noreferrer">Movable Type</a> blogging system. After some corporate changes it seems to be no longer available, but here's an archived version:</p> <p><a href="http://web.archive.org/web/20081228043036/http://www.sixapart.com/pronet/docs/trackback_spec" rel="nofollow noreferrer">http://web.archive.org/web/20081228043036/http://www.sixapart.com/pronet/docs/trackback_spec</a></p>
<p>If you're custom coding your own blog you have too much time on your hands. Start with something like <a href="http://www.dasblog.info/" rel="nofollow noreferrer">dasBlog</a> or <a href="http://subtextproject.com/" rel="nofollow noreferrer">SubText</a> and customize that to your needs. Then you get trackbacks for free.</p>
5,321
<p>I am working with a PC based automation software package called Think'n'Do created by <a href="http://www.phoenixcontact.com" rel="nofollow noreferrer">Phoenix Contact</a> It does real time processing, read inputs/ control logic / write outputs all done in a maximum of 50ms. We have an OPC server that is reading/writing tags from a PLC every 10ms. There is a long delay in writing a tag to the PLC and reading back the written value (Think'n'Do (50ms) > OPC Server (10ms) > PLC (10ms) > OPC Server (10ms) > Think'n'Do (50ms) ) that process takes up to 6 seconds to complete when it should by my math only take 130ms.</p> <p>Any ideas of where to look or why it might be taking so much longer would be helpful.</p>
<p>It depends on how you have your OPC client configured to pull data. When you subscribe to a group in OPC, you get to specify a refresh rate. This might default to 1s or even 5s, depending on the OPC client. There's also a limit the OPC server might put on the frequency of updated data. This only applies if you have your OPC client subscribing to data change events.</p> <p>The other way you can go is to do async or sync reads / writes to the OPC server. There are several reading modes as well. Since you are using OPC, you can use any OPC compatible client to test your server, this will tell you if the problem is with a setting in Think'n'Do or is it something with the PLC / server.</p> <p>The best general purpose OPC client I've used is OPC Quick Client. You can get it with TOP Server here: <a href="http://www.toolboxopc.com/Features/Demo/demo.shtml" rel="noreferrer">http://www.toolboxopc.com/Features/Demo/demo.shtml</a>. Just grab the TOP Server demo and install the OPC Quick Client. You can use it to connect to your OPC server and browse the tags and see what the data looks like. The second best OPC client I've used is from ICONICS (called OPC Data Spy) available here: <a href="http://www.iconics.com/support/free_tools.asp" rel="noreferrer">http://www.iconics.com/support/free_tools.asp</a>.</p> <p>Use the OPC client to see how fast you can read the data. Make sure you set the group refresh rate correctly. I think the tools might provide some timing information for you as well (but you'll be able to figure out a 6 second delay pretty easily).</p>
<p>Here are a few places to look: OPC Client configuration, OPC Client itself, OPC Server, or the PLC itself. </p> <p>Here are things you should check:</p> <ol> <li>OPC Client configuration - The OPC Group you've added the OPC tags to should have a fast scan rate (ie. 100 ms to 1 sec depending on what you use it for). With the act of writing values, do you notice if the values come in faster? If not, then there might be a DCOM or network configuration issue.</li> <li>OPC Client - Download a free OPC Client software(probably from the OPC Foundation website or major OPC Server software vendors) to see if you get the values back faster. If so, there might be a problem with your client.</li> <li>OPC Server - Some OPC Server have diagnostic tools. Turn those on and see what is the time the writes actually occur and what time the reads actually take place. If you can answer those questions, you can probably identify whether the culprit of the delay is from the PLC or the OPC Server. Also observe the CPU usage of the OPC Server, if you notice it is using more CPU than normal, it probably means that the OPC Server is loaded down which might deteriorate performance.</li> <li>Others - Finally check PLC, network are working properly.</li> </ol>
6,118
<p>I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the server. For example, if the server returns 404, the data from the iframe will be copied as normal and treated as a regular response.</p> <p>I've tried poking around in the iframe objects looking for some sort of <code>status_code</code> attribute, but haven't been able to find anything like that.</p> <hr> <p>The <code>$.ajax()</code> function can't be used, because it does not support uploading files. The only way to asynchronously upload files that I know of is using the hidden <code>iframe</code> method.</p>
<p>You can't get page headers by JS, but you can distinguish error from success: Try something like this:</p> <pre><code>&lt;script type="text/javascript"&gt; var uploadStarted = false; function OnUploadStart(){ uploadStarted = true; } function OnUploadComplete(state,message){ if(state == 1) alert("Success: "+message); else if(state == 0 &amp;&amp; uploadStarted) alert("Error:"+( message ? message : "unknow" )); } &lt;/script&gt; &lt;iframe id="uploader" name="uploader" onload="OnUploadComplete(0)" style="width:0px;height:0px;border:none;"&gt;&lt;/iframe&gt; &lt;form id="sender" action="/upload.php" method="post" target="uploader" enctype="multipart/form-data" onsubmit="OnUploadStart()"&gt; &lt;input type="file" name="files[upload]"/&gt; &lt;input type="submit" value="Upload"/&gt; &lt;/form&gt; </code></pre> <p>On server side:</p> <pre><code>/* file: upload.php */ &lt;?php // do some stuff with file print '&lt;script type="text/javascript"&gt;'; if(success) print 'window.parent.OnUploadComplete(1,"File uploaded!");'; else print 'window.parent.OnUploadComplete(0, "File too large!");'; print '&lt;/script&gt;'; ?&gt; </code></pre>
<p>You can't retrieving HTTP status code from loaded "iframe" directly. But when an http error occured, the server will returned nothing to the "iframe". So the iframe has not content. you can check the iframe body, when the body of iframe is blank, use ajax with the same url to get the response from server. Then you can retrieve the http status code from response.</p>
5,569
<p>One of the problems I have come across having complex tasks on the browser is with automatic timeouts.</p> <p>Currently our site has a sliding expiration of 30 minutes. Normally, this isn't a problem because we use asp.net and most of the time the users update one or two fields and then submit the form. This obviously keeps the session active. I have struggled with how to handle this with significantly more complex forms/user interaction where there are few if no round trips to the server. </p> <p>Now users can view reports, type emails etc. on our site, and I am struggling with how to keep their session active while they're actually using browser but they are not actively posting information back. I would dispense with the sliding expiration, but it's a requirement, so I am stuck with it. Most of our users are outside of the organization, so I can't use any form of <em>SSO</em>. </p> <p>Does anyone have an elegant solution (I'll even go for an ugly one if it works), or am I out of luck?</p>
<p>We recently went through this in my organization. Although it is not the best solution, and hitting the right session across multiple browser windows is rough, we put a countdown timer on our page, included a button that just went back and hit the server to restart the session, and also provided the user with a JavaScript popup (the user's favorite part of the solution) with a message saying that the session was, say, five minutes from timing out and to hit the "OK" button to restart. Then the button would hit the server to restart the session, restart the timer on the base page, close the popup and the base page didn't need to be refreshed at all. </p>
<p>Ah, the age old problem of not wanting to increase the session time because of higher memory usage. </p> <p>One answer is to also set a cookie that expires after more like a day that will tell the system to still remember the user. That's what eBay does, among others.</p>
6,854
<p>I obtained the following wire 22 Gauge Stranded Hookup Wire from Radio Shack:</p> <pre><code>Type/Style: AWM/1007 Wire Gauge: 22 AWG Insulation Thickness: AVE. 0.42 mm Rated Voltage: 300V Temperature Rating: 80°C / 176°F </code></pre> <blockquote> <p>Use Limitation: Internal wiring of appliances; or where exposed to oil at a temperature not exceeding 60°C or 80°C, whichever is applicable.. Tags may indicate the following: 600V Peak - For Electronic Use Only.</p> </blockquote> <p>I'd like to be able to hook up RAMPs 1.4 to my <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI" rel="nofollow">switching power supply</a> with this wire. Will this work okay?</p>
<p>22awg wiring is good for a max of 7A in this usage case. Your power supply can provide 30A. So it is definitely not large enough wire gauge for good wiring practice -- in the event of a short, you want the PSU's over-current protection to kick in before the wiring overheats. That would mean 14ga between the PSU and board. 16ga would probably cover your actual load requirements just fine, but we need to know a lot more about your printer to say that for sure. </p> <p>12v systems need heavy duty wiring, at least on the main supply lines. You can use 22ga for individual power consumers, such as fans, extruder heaters, etc. (No heatbeds.)</p>
<p>That should be fine for powering RAMPS, steppers and extruders but it is on the thin side. To err on the side of caution you should use somewhat ticker wires. However, you should definitely use thicker wires for the heated bed connection.</p>
234
<p>For my acceptance testing I'm writing text into the auto complete extender and I need to click on the populated list.</p> <p>In order to populate the list I have to use AppendText instead of TypeText, otherwise the textbox looses focus before the list is populated.</p> <p>Now my problem is when I try to click on the populated list. I've tried searching the UL element and clicking on it; but it's not firing the click event on the list.</p> <p>Then I tried to search the list by tagname and value:</p> <pre><code>Element element = Browser.Element(Find.By("tagname", "li") &amp;&amp; Find.ByValue("lookupString")); </code></pre> <p>but it's not finding it, has anyone been able to do what I'm trying to do?</p>
<p>The best solution (if we're talking .NET) seem to be to use WCF and streaming http. The client makes the first http connection to the server at port 80, the connection is then kept open with a streaming response that never ends. (And if it does it reconnects).</p> <p>Here's a sample that demonstrates this: <a href="http://blogs.thinktecture.com/buddhike/archive/2007/05/23/414851.aspx" rel="nofollow noreferrer">Streaming XML</a>. </p> <p>The solution to pushing through firewalls: <a href="http://blogs.msdn.com/drnick/archive/2006/10/20/keeping-connections-open-in-iis.aspx" rel="nofollow noreferrer" title="Keeping connections open in IIS">Keeping connections open in IIS</a></p>
<p>I would go with XML. XML is widely supported on all platforms and has lots of libraries and tools available for it. And since it's text, there are no issues when you pass it between platforms.</p> <p>I know JSON is another alternative, but I'm not familiar enough with it to know whether or not to recommend it in this case.</p>
7,368
<p>The <a href="http://msdn.microsoft.com/en-us/library/y23b5415.aspx" rel="nofollow noreferrer">official guidelines</a> suggest that there can be very few practical uses for these. Does anyone have examples of where they've put them to good use?</p>
<p>Au Contrare... you'll find C/C++ people flocking to structs a.k.a. value types.<br> An example would be data packets. If you have a large number of data packets to transfer/transmit, you'd use value structs to model your data packets.<br> reason: Turning something into a class adds an overhead of (approx 8-16 Bytes I forget) of <strong>overhead in the object header</strong> in addition to the instance data. In scenarios where this is unacceptable, value types are your safest bet<br> Another use would be situations where you need <strong>value type semantics</strong> - once you create-initialize a object, it is readonly/immutable and can be passed around to n clients.</p>
<p>Enums are first class citizens of .NET world. As for structures I found that in most cases classes can be used, however for memory-intense scenarios consider using structures. As a practical example I used structures as data structures for OSCAR (ICQ) protocols primitives.</p>
5,877
<p>I've played around with GTK, TK, wxPython, Cocoa, curses and others. They are are fairly horrible to use.. GTK/TK/wx/curses all seem to basically be direct-ports of the appropriate C libraries, and Cocoa basically mandates using both PyObjC and Interface Builder, both of which I dislike..</p> <p>The Shoes GUI library for Ruby is great.. It's very sensibly designed, and very "rubyish", and borrows some nice-to-use things from web development (like using hex colours codes, or <code>:color =&gt; rgb(128,0,0)</code>)</p> <p>As the title says: are there any nice, "Pythonic" GUI toolkits?</p>
<p>Have you looked at <a href="http://qt.io" rel="nofollow noreferrer">Qt</a>/<a href="http://www.riverbankcomputing.co.uk/software/pyqt/intro" rel="nofollow noreferrer">PyQt</a>? Although PyQt <em>is</em> a direct port from the C++ library, I find it much more pythonic and nice to program with compared to the others you listed. It also has very good documentation.</p> <p><a href="http://dabodev.com/" rel="nofollow noreferrer">Dabo</a> has a nice ui library implemented on top of wxPython. It's a framework intended mostly for database-centric applications, but the ui library can be used separately. </p> <p>There are/were several other attempts to create a very pythonic gui as a layer on top of PyGtk or wxPython, such as <a href="http://wiki.wxpython.org/Wax" rel="nofollow noreferrer">wax</a> and <a href="http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/" rel="nofollow noreferrer">PyGui</a>, which seem to be "stuck" at various degrees of being complete.</p> <p>Also, an exhaustive list of Python GUI toolkits can be found <a href="http://wiki.python.org/moin/GuiProgramming" rel="nofollow noreferrer">here</a>.</p>
<p>I've used <a href="http://glade.gnome.org/" rel="nofollow noreferrer">Glade</a> with some success, though I didn't manage to wrap my head around creating anything really complex. It has a nice GUI builder and stores the forms as xml files that are loaded dynamically. Kind of like XAML afiak.</p>
5,652
<p>How do you stop the "Default SMTP Virtual Server" from sending bounce messages for email addresses that you don't have?</p> <p>i.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'address not known' (or something like that) is sent back to the sender. I want it to silently fail.</p>
<p>I found this <a href="http://isorecorder.alexfeinman.com/catchall.htm" rel="nofollow noreferrer">article</a> which has a script you can run to configure a catch-all account on your server. All emails which would generate a NDR will instead be directed to this account. Sorry, I haven't tested it. The article above has been removed here it is via the <a href="https://web.archive.org/web/20170609215028/http://isorecorder.alexfeinman.com/catchall.htm" rel="nofollow noreferrer">WayBack Machine</a></p> <p>Basically the short answer to your question is no.</p> <p>On another note, if you don't want to spend any money, or have no budget, and want a better email system, try something like <a href="http://www.smartertools.com/SmarterMail/Free-Windows-Mail-Server.aspx" rel="nofollow noreferrer">Smarter Mail</a> which you can use for free up to 10 users. I am sure there are others out there, but I have used Smarter Mail in the past successfully. </p>
<p>This isn't an IIS failure. The SMTP server receiving the message is looking for a valid email address, and when it doesn't find one, sends an email back to your email address saying that there isn't one there. The only way to have it silently fail is by putting the from address as a bogus email like no-reply@company.com, etc.</p>
8,384
<p>How much less libraries are there for Mono than for Java?</p> <p>I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of</p> <ul> <li>performance (for example, I'm told Java is good for threading, and I hear the runtime code optimization has become very good recently for .NET)</li> <li><i>real world</i> portability (it's both meant to be portable, what's Catch-22 for each?)</li> <li>tool availability (<a href="http://en.wikipedia.org/wiki/Continuous_integration" rel="noreferrer">CI</a>, build automation, debugging, IDE)</li> </ul> <p>I am especially looking for what you actually experienced in your own work rather than the things I could google. My application would be a back-end service processing large amounts of data from time series.</p> <p>My main target platform would be Linux.</p> <p><strong>Edit:</strong> <em>To phrase my question more adequately, I am interested in the whole package (3rd party libraries etc.), not just the language. For libraries, that probably boils down to the question "how much less libraries are there for Mono than for Java"?</em></p> <hr> <p>FYI, I have since chosen Java for this project, because it seemed just more battle-worn on the portability side and it's been around for a while on older systems, too. I'm a tiny little bit sad about it, because I'm very curious about C# and I'd love to have done some large project in it, but maybe next time. Thanks for all the advice.</p>
<p>Well....Java is actually more portable. Mono isn't implemented everywhere, and it lags behind the Microsoft implementation significantly. The Java SDK seems to stay in better sync across platforms (and it works on more platforms). </p> <p>I'd also say Java has more tool availability across all those platforms, although there are plenty of tools available for .NET on Windows platforms.</p> <p><strong>Update for 2014</strong></p> <p>I still hold this opinion in 2014. However, I'll qualify this by saying I'm just now starting to pay some attention to Mono after a long while of not really caring, so there may be improvements in the Mono runtime (or ecosystem) that I haven't been made aware of. AFAIK, there is still no support for WPF, WCF, WF, of WIF. Mono can run on iOS, but to my knowledge, the Java runtime still runs on far more platforms than Mono. Also, Mono is starting to see some much improved tooling (Xamarin), and Microsoft seems to have a much more cross-platform kind of attitude and willingness to work with partners to make them complimentary, rather than competitive (for example, Mono will be a pretty important part of the upcoming OWIN/Helios ASP.NET landscape). I suspect that in the coming years the differences in portability will lessen rapidly, especially after .NET being open-sourced.</p> <p><strong>Update for 2018</strong></p> <p>My view on this is starting to go the other way. I think .NET, broadly, particularly with .NET Core, has started to achieve "portability parity" with Java. There are efforts underway to bring WPF to .NET Core for some platforms, and .NET Core itself runs on a great many platforms now. Mono (owned by Xamarin, which is now owned by Microsoft) is a more mature and polished product than ever, and writing applications that work on multiple platforms is no longer the domain of deep gnosis of .NET hackery, but is a relatively straightforward endeavor. There are, of course, libraries and services and applications that are Windows-only or can only target specific platforms - but the same can be said of Java (broadly). </p> <p>If I were in the OP's shoes at this point, I can think of no reason inherent in the languages or tech stacks themselves that would prevent me from choosing .NET for any application going forward from this point.</p>
<p>There are other language choices too. I've become quite fond of Python, which works well on Windows, Linux, and Mac, and has a rich set of libraries.</p>
8,680
<p>I just bought new eSUN PETg filament. When I started to extrude it, I heard popping sound same as moisture boiling out of it. I don't expect new eSUN vaccum sealed filament having moisture content. Is there any problem with my e3d v6? Is it possible that due to old filament, moisture is residing inside my extruder assembly and new filament is carrying it while extruding? My settings : </p> <ul> <li>print temperature: 250&nbsp;&deg;C, </li> <li>bed temperature: 80&nbsp;&deg;C, </li> <li>retraction length: 6.5&nbsp;mm, </li> <li>retraction speed: 25&nbsp;mm/s, </li> <li>print speed: 10&nbsp;mm/s, </li> <li>layer height: 25 micron</li> </ul> <p>What do I do in this case? Should I clean the extruder assembly? </p>
<p>The extruder can't hold much water and transport it to the melt zone. Filament can. The printer behaves like the filament is wet, so try drying it. </p> <p>Try putting the filament in your electric oven at the lowest temperature (often 170&nbsp;&deg;F to 180&nbsp;&deg;F) for an hour and see if the behavior improves. </p> <p>Keep the filament at a distance from (or shield it from) the heating elements. </p>
<p>eSun has had quality problems recently (mid 2020), when they switched from the screw together clear reels to the molded black reels. I got an unprintable roll of PLA that was wet and brittle, others reported similar issues. This is theorized to have coincided with them moving production to Vietnam.</p> <p>Try to dry it, but if that doesn’t help, try a different brand. As far as your settings, I’ve printed a couple reels of the eSun PETG successfully at 235 °C, with 75 °C bed (though bed would have nothing to do with moisture). Agree 10 mm/s print speed is excruciatingly slow. 50 mm/s is typical for a Bowden setup.</p>
1,565
<p>I am developing a GPL-licensed application in Python and need to know if the GPL allows my program to use proprietary plug-ins. This is <a href="http://www.gnu.org/licenses/gpl-faq.html" rel="noreferrer">what the FSF has to say</a> on the issue:</p> <blockquote> <p><strong>If a program released under the GPL uses plug-ins, what are the requirements for the licenses of a plug-in?</strong></p> <p>It depends on how the program invokes its plug-ins. If the program uses fork and exec to invoke plug-ins, then the plug-ins are separate programs, so the license for the main program makes no requirements for them.</p> <p>If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. This means the plug-ins must be released under the GPL or a GPL-compatible free software license, and that the terms of the GPL must be followed when those plug-ins are distributed.</p> <p>If the program dynamically links plug-ins, but the communication between them is limited to invoking the ‘main’ function of the plug-in with some options and waiting for it to return, that is a borderline case.</p> </blockquote> <p>The distinction between fork/exec and dynamic linking, besides being kind of artificial, doesn't carry over to interpreted languages: what about a Python/Perl/Ruby plugin, which gets loaded via <code>import</code> or <code>execfile</code>?</p> <p>(edit: I understand why the distinction between fork/exec and dynamic linking, but it seems like someone who wanted to comply with the GPL but go against the &quot;spirit&quot; --I don't-- could just use fork/exec and interprocess communication to do pretty much anything).</p> <p>The best solution would be to add an exception to my license to explicitly allow the use of proprietary plugins, but I am unable to do so since I'm using <a href="http://trolltech.com/products/qt" rel="noreferrer">Qt</a>/<a href="http://www.riverbankcomputing.co.uk/software/pyqt/intro" rel="noreferrer">PyQt</a> which is GPL.</p>
<blockquote> <p>he distinction between fork/exec and dynamic linking, besides being kind of artificial,</p> </blockquote> <p>I don't think its artificial at all. Basically they are just making the division based upon the level of integration. If the program has "plugins" which are essentially fire and forget with no API level integration, then the resulting work is unlikely to be considered a derived work. Generally speaking a plugin which is merely forked/exec'ed would fit this criteria, though there may be cases where it does not. This case especially applies if the "plugin" code would work independently of your code as well.</p> <p>If, on the other hand, the code is deeply dependent upon the GPL'ed work, such as extensively calling APIs, or tight data structure integration, then things are more likely to be considered a derived work. Ie, the "plugin" cannot exist on its own without the GPL product, and a product with this plugin installed is essentially a derived work of the GPLed product.</p> <p>So to make it a little more clear, the same principles could apply to your interpreted code. If the interpreted code relies heavily upon your APIs (or vice-versa) then it would be considered a derived work. If it is just a script that executes on its own with extremely little integration, then it may not.</p> <p>Does that make more sense?</p>
<p>How much info are you sharing between the Plugins and the main program? If you are doing anything more than just executing them and waiting for the results (sharing no data between the program and the plugin in the process) then you could most likely get away with them being proprietary, otherwise they would probably need to be GPL'd.</p>
5,135
<blockquote> <p>CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.</p> </blockquote> <p>I've found these links:</p> <ul> <li><a href="http://blog.benhall.me.uk/2008/03/sql-server-and-vista-create-database.html" rel="nofollow noreferrer">http://blog.benhall.me.uk/2008/03/sql-server-and-vista-create-database.html</a></li> <li><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=702726&amp;SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=702726&amp;SiteID=1</a></li> </ul>
<p>Generally the user that you are using to run the SQL Server service will not have access to your personal user folders, that is why you're getting the error. You either need to change the credentials used for the service, or move the database to another folder, which did the trick in your case.</p>
<p>Yes, a previous attachment wasn't unattached properly, or it was attached manually. Go in to Management Studio connect to the database, and disconnect the long database name that looks like a file path. Then try again it should work.</p>
3,564
<p>I have a table in a MySql database that stores user accounts. One of the columns, expires, stores an expiration date but defaults to NULL. I need to be able to remove an expiration date and set it back to the default value.</p> <p>Currently, all of my CRUD routines are written using MySqlCommand with parameters. Can this be done directly with a MySqlParameter, or do I have to create an alternate command object to handle this eventuality?</p>
<p>The problem was DBNull, doing:</p> <pre><code>command.Parameters.AddWithValue("@parameter", null); </code></pre> <p>compiles OK.</p>
<p>It's not clear what conditions you're talking about. If you want to set column to default value, you can use <a href="http://msdn.microsoft.com/en-us/library/system.dbnull.value.aspx" rel="nofollow noreferrer">DbNull.Value</a>;</p> <pre><code>command.AddWithValue("@param", DbNull.Value); or command.Parameters.Add("@param", &lt;data type&gt;).Value = DBNull.Value; </code></pre>
7,424
<p>Are there any tools that will spider an asp.net website and create a static site?</p>
<p><a href="http://www.httrack.com/" rel="nofollow noreferrer">http://www.httrack.com/</a><br> Have used for this purpose a few times, may need to do a little tidying up of urls, and some css linked images might not make it, depends on how good a job you want to do.<br> If you have dreamweaver, you can use that to manage the links if you need to clean up the file names afterwards.<br> Optionally use the link checker extension for firefox to check it all afterwards.</p>
<p>Another solution is <a href="http://www.devarticles.com/c/a/Web-Services/Website-Mirroring-With-wget/1/" rel="nofollow noreferrer">wget</a>.</p>
6,629
<p>I have a method that where I want to redirect the user back to a login page located at the root of my web application.</p> <p>I'm using the following code:</p> <pre><code>Response.Redirect("~/Login.aspx?ReturnPath=" + Request.Url.ToString()); </code></pre> <p>This doesn't work though. My assumption was that ASP.NET would automatically resolve the URL into the correct path. Normally, I would just use</p> <pre><code>Response.Redirect("../Login.aspx?ReturnPath=" + Request.Url.ToString()); </code></pre> <p>but this code is on a master page, and can be executed from any folder level. How do I get around this issue?</p>
<blockquote> <p>I think you need to drop the "~/" and replace it with just "/", I believe / is the root</p> </blockquote> <p><strong>STOP RIGHT THERE!</strong> :-) unless you want to hardcode your web app so that it can only be installed at the root of a web site. </p> <p>"~/" <strong><em>is</em></strong> the correct thing to use, but the reason that your original code didn't work as expected is that <code>ResolveUrl</code> (which is used internally by <code>Redirect</code>) tries to first work out if the path you are passing it is an absolute URL (e.g. "**<a href="http://server/" rel="noreferrer">http://server/</a>**foo/bar.htm" as opposed to "foo/bar.htm") - but unfortunately it does this by simply looking for a colon character ':' in the URL you give it. But in this case it finds a colon in the URL you give in the <code>ReturnPath</code> query string value, which fools it - therefore your '~/' doesn't get resolved.</p> <p>The fix is that you should be URL-encoding the <code>ReturnPath</code> value which escapes the problematic ':' along with any other special characters.</p> <pre><code>Response.Redirect("~/Login.aspx?ReturnPath=" + Server.UrlEncode(Request.Url.ToString())); </code></pre> <p>Additionally, I recommend that you (or anyone) never use <code>Uri.ToString</code> - because it gives a human-readable, more "friendly" version of the URL - not a necessarily correct one (it unescapes things). Instead use Uri.AbsoluteUri - like so:</p> <pre><code>Response.Redirect("~/Login.aspx?ReturnPath=" + Server.UrlEncode(Request.Url.AbsoluteUri)); </code></pre>
<p>What about using</p> <pre><code>Response.Redirect(String.Format("http://{0}/Login.aspx?ReturnPath={1}", Request.ServerVariables["SERVER_NAME"], Request.Url.ToString())); </code></pre>
5,112
<p>Are there any official naming conventions for tag names on Stack Exchange? And if not, how should tags be named?</p> <p>From what I understand, one typically adds a <em>dash</em> (-) where you normally would leave a <em>space</em>, but how about tags that derive from words that are <em><a href="https://3dprinting.meta.stackexchange.com/questions/150/tag-for-mattercontrol-app">CamelCased</a></em>, or somehow <em><a href="https://3dprinting.stackexchange.com/questions/tagged/postproduction">Prefixed</a></em>?</p> <p>Examples (which also shows some inconsistencies):</p> <pre><code>Topic | Existing tag | Alternative tag? ---------------------------------------------------------- MatterControl | matter-control | mattercontrol MakerBot | makerbot | maker-bot Post-production | postproduction | post-production Post-processing | post-processing | postprocessing Multi-material | multi-material | multimaterial </code></pre> <p>Which of the above tag alternatives should we go for?</p>
<p>Looking at other SE sites, the most common approach seems to make everything lowercase (including names and trademarks) and using hyphens whenever there would be a space or hyphen in normal usage.</p> <p>As such:</p> <ul> <li><p>MatterControl becomes mattercontrol</p></li> <li><p>Makerbot becomes makerbot</p></li> <li><p>Post-production becomes post-production</p></li> <li><p>Post-processing becomes post-processing</p></li> <li><p>Multi-material becomes multi-material</p></li> </ul>
<p>I would say we could use synonyms to stay with clear tag namespace.In this case we apply following pattern (especially for proper name (product name)):</p> <pre><code>Topic | Existing tag | Synonym? ---------------+-----------------+-------------- MatterControl | mattercontrol | matter-control </code></pre> <p>I think dash could be used to separate kinda branch for example:</p> <pre><code>app-cura, app-mattercontrol, app-meshmixer &lt;&lt; these could be also synonyms 3d-printer, 3d-models, 3d-design </code></pre> <p>of course we already have tags like</p> <pre><code>feature-request, switching-power-supply </code></pre> <p>but they are descriptive and would be unreadable written as one word, one may say these describe actions</p>
29
<p>As moving the endstop upwards reduces the range of the z-axis, I was wondering whether it reduces the maximum height of the printable object, by the distance the endstop was moved. Or is this somehow (to a certain extent) beeing counterbalanced?</p> <p>(Follow-up question of <a href="https://3dprinting.stackexchange.com/questions/7332/tevo-michelangelo-nozzle-below-build-plate">this</a> question)</p>
<p>If you move up the end stop such that it raises the nozzle with respect to the build platform you lose height, so basically the answer is yes. But, as seen in your referenced question, your nozzle location is determined by the mechanical layout of the printer and the end stop had to be raised in order to print at all. This means that although you have less height to move the Z gantry, it can now actually print the full range the printer is designed for (the max Z to print is fixed in the configuration of the firmware of the printer and is always smaller than the maximum Z of the mechanical layout). Theoretically, if you ever make a lower profile hotend head, you would be able to lower the end stop and gain a little in height and adjust the firmware maximum Z height.</p> <p>E.g. in Marlin firmware, for an Anet A8 3D printer,</p> <pre><code>#define Z_MAX_POS 240 </code></pre> <p>in the <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/example_configurations/Anet/A8/Configuration.h" rel="noreferrer">Configuration.h</a> file defines the maximum print height of 240 mm. If you would deliberately increase the Z end stop height and platform by let's say 50 mm, the printer thinks it still can print 240 mm, but in reality the gantry will crash against the top mounts and thus limit your printing height.</p>
<p>After adjusting the endstop check that the documented maximum height (150mm) is still achievable. Just move Z axis in the menu.</p>
1,078
<p>I know in certain circumstances, such as long running processes, it is important to lock ASP.NET cache in order to avoid subsequent requests by another user for that resource from executing the long process again instead of hitting the cache.</p> <p>What is the best way in c# to implement cache locking in ASP.NET? </p>
<p>Here's the basic pattern:</p> <ul> <li>Check the cache for the value, return if its available</li> <li>If the value is not in the cache, then implement a lock</li> <li>Inside the lock, check the cache again, you might have been blocked</li> <li>Perform the value look up and cache it</li> <li>Release the lock</li> </ul> <p>In code, it looks like this:</p> <pre><code>private static object ThisLock = new object(); public string GetFoo() { // try to pull from cache here lock (ThisLock) { // cache was empty before we got the lock, check again inside the lock // cache is still empty, so retreive the value here // store the value in the cache here } // return the cached value here } </code></pre>
<p>This article from CodeGuru explains various cache locking scenarios as well as some best practices for ASP.NET cache locking:</p> <p><a href="http://www.codeguru.com/csharp/.net/net_asp/article.php/c5363/" rel="nofollow noreferrer">Synchronizing Cache Access in ASP.NET</a></p>
6,018
<p>So basically I've been having a problem with my Micro+. It will not level / calibrate itself and I can't fix it. The reason I'm here is that I've been using Cura, and somehow it destroyed my bed. (See image)</p> <p><a href="https://i.stack.imgur.com/Qe8cA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qe8cA.jpg" alt="print bed for Micro +" /></a></p> <p>I would like to know how to get it off, as I tried freezing, scraping and sandpaper</p> <hr /> <p>To clarify some things:</p> <ul> <li>The material is PLA,</li> <li>bed is made of plastic.</li> </ul> <p>My build plate surface got destroyed after trying to use Cura, which sliced wrong and engraved the print into my bed.</p>
<p>In general I would use <a href="https://github.com/rcarlyle/StepperSim" rel="nofollow noreferrer">https://github.com/rcarlyle/StepperSim</a> which takes into account more parameters.</p> <p>You can play with voltage and current to see which combination gives you the best results for your motor.</p> <p>Or you can change to a TMC driver with higher voltage (35-50 V) to keep torque at much higher speeds and push the current motor more.</p> <p>Since the torque you require is likely not so high, you can increase the speed of your stepper motor with 3D printed herringbone gears, for example 4:1. They don't need to be super accurate, backlash is totally fine considering the ridiculous 40:1 reduction.</p>
<p>I was considering buying a Fl3xdrive but had this exact fear, that the speed (rotation) required for retractions was too much.</p> <p>I stumbled upon this post while looking for a project for a step-up gearbox. I found a <a href="https://www.thingiverse.com/thing:3714978" rel="nofollow noreferrer">Nema 17 Gearbox &quot;Pulleybox&quot; Mod for Extruder</a> on Thingiverse, should be enough to do what you did with your design, I guess.</p>
1,895
<p>I recently switched to a RAMPS 1.4 on an Arduino Mega 2560. Ever since I have extruder temperature swings a couple of minutes into the print, but it looks like a problem reading the temp rather than actual fluctuations in the temperature (as can be seen in the attached pic). Also, I've noticed that the MOSFET is getting really hot when I heat the heated bed.</p> <p>What is the problem and how can I fix it?</p> <p><a href="https://i.stack.imgur.com/QETof.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QETof.png" alt="enter image description here"></a></p>
<p>For the overheating, you may need to turn the juice down a little on your Power Supply. Typically, there is a potentiometer inside that trims the voltage level coming from there. Some things can heat up if it's over-volting and needing to drop more voltage for the board.</p> <p>For the temperature reading stuff, make sure the thermistor is plugged in all way and not possibly dangling near the hot-end block. I have had that happen before and it will report improper temperatures as it goes along, and often results in the hot-end getting too hot and messing with the filament. If it's properly secured it might be just crappy or broken in some other way and you would need to replace it. It's reasonable practice to have a few extra thermistors lying around as having them go out at lousy times will bum you out.</p>
<p>For the really hot mosfet I would say it might be a good idea to get one of those external mosfet module boards. It just seems like a good idea to me, to not have the huge current of the bed-heater flowing through the ramps board. And for the thermistor wires, do you have them twisted together? If not, try tightly twisting the pair (of + &amp; -) together to ensure there is no interference from other signals. Careful not to put stress on where the wires are attached to the actual thermistor-head. Honestly, all of your wiring should be in twisted-pair configuration. <a href="https://en.m.wikipedia.org/wiki/Twisted_pair" rel="nofollow noreferrer">https://en.m.wikipedia.org/wiki/Twisted_pair</a></p>
706
<p>It seems like there should be something shorter than this:</p> <pre><code>private string LoadFromFile(string path) { try { string fileContents; using(StreamReader rdr = File.OpenText(path)) { fileContents = rdr.ReadToEnd(); } return fileContents; } catch { throw; } } </code></pre>
<p>First of all, the title asks for "how to write the contents of strnig to a text file" but your code example is for "how to read the contents of a text file to a string.</p> <p>Answer to both questions:</p> <pre><code>using System.IO; ... string filename = "C:/example.txt"; string content = File.ReadAllText(filename); File.WriteAllText(filename, content); </code></pre> <p>See also ReadAllLines/WriteAllLines and ReadAllBytes/WriteAllBytes if instead of a string you want a string array or byte array.</p>
<p>File.ReadAllText() maybe?</p> <p>ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_mscorlib/html/4803f846-3d8a-de8a-18eb-32cfcd038f76.htm if you have VS2008's help installed.</p>
6,373
<p>At the moment my code (PHP) has too many SQL queries in it. eg...</p> <pre><code>// not a real example, but you get the idea... $results = $db-&gt;GetResults("SELECT * FROM sometable WHERE iUser=$userid"); if ($results) { // Do something } </code></pre> <p>I am looking into using stored procedures to reduce this and make things a little more robust, but I have some concerns..</p> <p>I have hundreds of different queries in use around the web site, and many of them are quite similar. How should I manage all these queries when they are removed from their context (the code that uses the results) and placed in a stored procedure on the database?</p>
<p>The best course of action for you will depend on how you are approaching your data access. There are three approaches you can take:</p> <ul> <li>Use stored procedures</li> <li>Keep the queries in the code (but put all your queries into functions and fix everything to use PDO for parameters, as mentioned earlier)</li> <li>Use an ORM tool</li> </ul> <p>If you want to pass your own raw SQL to the database engine then stored procedures would be the way to go if all you want to do is get the raw SQL out of your PHP code but keep it relatively unchanged. The stored procedures vs raw SQL debate is a bit of a holy war, but K. Scott Allen makes an excellent point - albeit a throwaway one - in an article about <a href="http://odetocode.com/blogs/scott/archive/2008/02/02/11737.aspx" rel="nofollow noreferrer">versioning databases</a>: </p> <blockquote> <p>Secondly, stored procedures have fallen out of favor in my eyes. I came from the WinDNA school of indoctrination that said stored procedures should be used all the time. Today, I see stored procedures as an API layer for the database. This is good if you need an API layer at the database level, but I see lots of applications incurring the overhead of creating and maintaining an extra API layer they don't need. In those applications stored procedures are more of a burden than a benefit.</p> </blockquote> <p>I tend to lean towards not using stored procedures. I've worked on projects where the DB has an API exposed through stored procedures, but stored procedures can impose some limitations of their own, and those projects have <em>all</em>, to varying degrees, used dynamically generated raw SQL in code to access the DB. </p> <p>Having an API layer on the DB gives better delineation of responsibilities between the DB team and the Dev team at the expense of some of the flexibility you'd have if the query was kept in the code, however PHP projects are less likely to have sizable enough teams to benefit from this delineation.</p> <p>Conceptually, you should probably have your database versioned. Practically speaking, however, you're far more likely to have just your code versioned than you are to have your database versioned. You are likely to be changing your queries when you are making changes to your code, but if you are changing the queries in stored procedures stored against the database then you probably won't be checking those in when you check the code in and you lose many of the benefits of versioning for a significant area of your application.</p> <p>Regardless of whether or not you elect not to use stored procedures though, you should at the very least ensure that each database operation is stored in an independent function rather than being embedded into each of your page's scripts - essentially an API layer for your DB which is maintained and versioned with your code. If you're using stored procedures, this will effectively mean you have two API layers for your DB, one with the code and one with the DB, which you may feel unnecessarily complicates things if your project does not have separate teams. I certainly do.</p> <p>If the issue is one of code neatness, there are ways to make code with SQL jammed in it more presentable, and the UserManager class shown below is a good way to start - the class only contains queries which relate to the 'user' table, each query has its own method in the class and the queries are indented into the prepare statements and formatted as you would format them in a stored procedure.</p> <pre><code>// UserManager.php: class UserManager { function getUsers() { $pdo = new PDO(...); $stmt = $pdo-&gt;prepare(' SELECT u.userId as id, u.userName, g.groupId, g.groupName FROM user u INNER JOIN group g ON u.groupId = g.groupId ORDER BY u.userName, g.groupName '); // iterate over result and prepare return value } function getUser($id) { // db code here } } // index.php: require_once("UserManager.php"); $um = new UserManager; $users = $um-&gt;getUsers(); foreach ($users as $user) echo $user['name']; </code></pre> <p>However, if your queries are quite similar but you have huge numbers of permutations in your query conditions like complicated paging, sorting, filtering, etc, an Object/Relational mapper tool is probably the way to go, although the process of overhauling your existing code to make use of the tool could be quite complicated.</p> <p>If you decide to investigate ORM tools, you should look at <a href="http://propel.phpdb.org/" rel="nofollow noreferrer">Propel</a>, the ActiveRecord component of <a href="http://yiiframework.com" rel="nofollow noreferrer">Yii</a>, or the king-daddy PHP ORM, <a href="http://www.doctrine-project.org/" rel="nofollow noreferrer">Doctrine</a>. Each of these gives you the ability to programmatically build queries to your database with all manner of complicated logic. Doctrine is the most fully featured, allowing you to template your database with things like the <a href="http://www.developersdex.com/gurus/articles/112.asp" rel="nofollow noreferrer">Nested Set tree pattern</a> out of the box.</p> <p>In terms of performance, stored procedures are the fastest, but generally not by much over raw sql. ORM tools can have a significant performance impact in a number of ways - inefficient or redundant querying, huge file IO while loading the ORM libraries on each request, dynamic SQL generation on each query... all of these things can have an impact, but the use of an ORM tool can drastically increase the power available to you with a much smaller amount of code than creating your own DB layer with manual queries.</p> <p><a href="https://stackoverflow.com/questions/37791/how-do-you-manage-sql-queries#38053">Gary Richardson</a> is absolutely right though, if you're going to continue to use SQL in your code you should always be using PDO's prepared statements to handle the parameters regardless of whether you're using a query or a stored procedure. The sanitisation of input is performed for you by PDO.</p> <pre><code>// optional $attrs = array(PDO::ATTR_PERSISTENT =&gt; true); // create the PDO object $pdo = new PDO("mysql:host=localhost;dbname=test", "user", "pass", $attrs); // also optional, but it makes PDO raise exceptions instead of // PHP errors which are far more useful for debugging $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo-&gt;prepare('INSERT INTO venue(venueName, regionId) VALUES(:venueName, :regionId)'); $stmt-&gt;bindValue(":venueName", "test"); $stmt-&gt;bindValue(":regionId", 1); $stmt-&gt;execute(); $lastInsertId = $pdo-&gt;lastInsertId(); var_dump($lastInsertId); </code></pre> <p>Caveat: assuming that the ID is 1, the above script will output <code>string(1) "1"</code>. <code>PDO-&gt;lastInsertId()</code> returns the ID as a string regardless of whether the actual column is an integer or not. This will probably never be a problem for you as PHP performs casting of strings to integers automatically.</p> <p>The following will output <code>bool(true)</code>:</p> <pre><code>// regular equality test var_dump($lastInsertId == 1); </code></pre> <p>but if you have code that is expecting the value to be an integer, like <a href="http://php.net/manual/en/function.is-int.php" rel="nofollow noreferrer">is_int</a> or PHP's <a href="http://au.php.net/manual/en/language.operators.comparison.php" rel="nofollow noreferrer">"is really, truly, 100% equal to"</a> operator:</p> <pre><code>var_dump(is_int($lastInsertId)); var_dump($lastInsertId === 1); </code></pre> <p>you could run into some issues.</p> <p><strong>Edit:</strong> Some good discussion on stored procedures <a href="https://stackoverflow.com/questions/83419/stored-procedures-a-no-go-in-the-phpmysql-world#84294">here</a></p>
<p><a href="https://stackoverflow.com/questions/22278/whats-a-good-way-to-encapsulate-data-access-with-phpmysql">This other question</a> also has some useful links in it...</p>
5,858
<p>I sadly have a big problem since a couple of weeks and I cant fix it myself. For over 20 prints, I had the same problems: At the <strong>start, everything goes well</strong> but at some point of time, my Creality CR-10 starts <strong>under extruding and</strong> after like 1 minute, <strong>NO filament is extruded anymore</strong> and the 3D printer moves over the printing bed without extruding anything. After that, I have to pull out the filament and the feeder always grinds into it.</p> <p>Some problem with the hotend (so the feeder works well but it cant push the filament through somehow - I cleaned the nozzle and couldn't find anything wrong there. When I push the filament through by hand it gets extruded but after a failed print, it is <strong>VERY hard to pull it back</strong> (because of the filament being slightly bigger at the nozzle - hard to remove! - </p> <p><strong>That could be the problem:</strong></p> <p><strong>I just tried to remove the filament from the printer (another failed print) I had to use two tongs because the filament was so hard to pull back. I noticed that the diameter of the PLA close to the hotend was a lot bigger (way over 1.75&nbsp;mm) <em>For about 5&nbsp;cm</em> that's a very long distance - that's the reason why it's hard to pull back (and also push through?) But I don't know why that happens... If I get an answer for that, I think that I have solved my problem</strong></p> <p>I already tried printing at 50&nbsp;% which didn't work.</p> <ul> <li>Creality CR-10 with 0.4&nbsp;mm nozzle, </li> <li>1.75&nbsp;mm PLA filament used (white)</li> <li>0.27&nbsp;mm layer height</li> <li>45&nbsp;mm/s printing speed at 220° (I can easily push the filament through at 200° by hand)</li> <li>60° bed temp</li> </ul> <p>And here some pictures of the failed prints:</p> <p><a href="https://i.stack.imgur.com/ZPB2n.jpg" rel="nofollow noreferrer" title="Failed print"><img src="https://i.stack.imgur.com/ZPB2n.jpg" alt="Failed print" title="Failed print"></a></p> <p><a href="https://i.stack.imgur.com/Mrw3I.jpg" rel="nofollow noreferrer" title="Filament grinding"><img src="https://i.stack.imgur.com/Mrw3I.jpg" alt="Filament grinding" title="Filament grinding"></a></p> <p><a href="https://i.stack.imgur.com/xKJTQ.jpg" rel="nofollow noreferrer" title="Sorry for the bad resolution"><img src="https://i.stack.imgur.com/xKJTQ.jpg" alt="Sorry for the bad resolution" title="Sorry for the bad resolution"></a></p> <p><a href="https://i.stack.imgur.com/54vPw.jpg" rel="nofollow noreferrer" title="Failed print #2"><img src="https://i.stack.imgur.com/54vPw.jpg" alt="Failed print #2" title="Failed print #2"></a></p> <p><strong>I think I can exclude these:</strong></p> <p>It could be: (the things I can imagine but don't have a solution for)</p> <ul> <li>The feeder being too strong/my new PLA filament being too soft</li> <li>Maybe a software problem? I'm using the newest Cura version and I don't know what could be wrong there.</li> </ul> <p>The filament seems to run out of the hotend. Something is really broken here. I tried to lower the print temperature and don't have an issue (at least not that big) with pulling out the filament but instead, the feeder started grinding into the filament again.</p> <p><a href="https://i.stack.imgur.com/tHT78.jpg" rel="nofollow noreferrer" title="Filament exiting nozzle"><img src="https://i.stack.imgur.com/tHT78.jpg" alt="Filament exiting nozzle" title="Filament exiting nozzle"></a></p> <p>I'm very happy for any answer and possible solutions. </p>
<p>Grinding is due to attempts to advance filament faster than it can be melted and dispensed. Try one or more of the following:</p> <ul> <li>Raise the head temperature (to meet current throughput demand)</li> <li>Lower the print speed (to reduce throughput demand)</li> <li>Slice for thinner layers (to reduce throughput demand)</li> </ul>
<p>A 0.27 mm layer height is not correct for any printer, any nozzle/hotend, any file, and should never be used as a layer height variable for any FDM printer.</p> <p>Layer height should be a factor of the diameter of your nozzle size. i.e. Your nozzle is 0.4 mm, so depending on your printer, your range of resolutions/layer heights could start as low as 0.04 mm, but is monumentally more likely to begin at 0.08 or 0.12 mm, with a maximum value being 0.28 mm, and maybe 0.32 mm if you're doing some risky/experimental spiralized vase printing.</p>
1,015
<p>I have an object in a multi-threaded environment that maintains a collection of information, e.g.:</p> <pre><code>public IList&lt;string&gt; Data { get { return data; } } </code></pre> <p>I currently have <code>return data;</code> wrapped by a <code>ReaderWriterLockSlim</code> to protect the collection from sharing violations. However, to be doubly sure, I'd like to return the collection as read-only, so that the calling code is unable to make changes to the collection, only view what's already there. Is this at all possible? </p>
<p>If your underlying data is stored as list you can use <a href="http://msdn.microsoft.com/en-us/library/e78dcd75.aspx" rel="noreferrer">List(T).AsReadOnly</a> method.<br> If your data can be enumerated, you can use <a href="http://msdn.microsoft.com/en-us/library/bb342261.aspx" rel="noreferrer">Enumerable.ToList</a> method to cast your collection to List and call AsReadOnly on it.</p>
<p>One should note that <a href="https://stackoverflow.com/questions/55502/return-collection-as-read-only#55507">aku</a>'s answer will only protect the list as being read only. Elements in the list are still very writable. I don't know if there is any way of protecting non-atomic elements without cloning them before placing them in the read only list. </p>
7,928
<p>Considering this code, can I be <em>absolutely sure</em> that the <code>finally</code> block always executes, no matter what <code>something()</code> is?</p> <pre><code>try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println("I don't know if this will get printed out"); } </code></pre>
<p>Yes, <code>finally</code> will be called after the execution of the <code>try</code> or <code>catch</code> code blocks.</p> <p>The only times <code>finally</code> won't be called are:</p> <ol> <li>If you invoke <code>System.exit()</code></li> <li>If you invoke <code>Runtime.getRuntime().halt(exitStatus)</code></li> <li>If the JVM crashes first</li> <li>If the JVM reaches an infinite loop (or some other non-interruptable, non-terminating statement) in the <code>try</code> or <code>catch</code> block</li> <li>If the OS forcibly terminates the JVM process; e.g., <code>kill -9 &lt;pid&gt;</code> on UNIX</li> <li>If the host system dies; e.g., power failure, hardware error, OS panic, et cetera</li> <li>If the <code>finally</code> block is going to be executed by a daemon thread and all other non-daemon threads exit before <code>finally</code> is called</li> </ol>
<p>I am terribly late to answer here, but I am surprised that no one mentioned the Java debugger option to drop a stack frame. I am a heavy user of this feature in IntelliJ. (I am <em>sure</em> Eclipse and NetBeans has support for the same feature.)</p> <p>If I drop stack frame from a the try or catch block that is followed by a finally block, the IDE will prompt me: &quot;Shall I execute the finally block?&quot; Obviously, this is an artificial runtime environment -- a debugger!</p> <p>To answer your question, I would say you can only guarantee it runs if ignore when a debugger is attached, and (like others said) method <code>something()</code> does not (a) call Java method <code>System.exit(int)</code> or (b) C function <code>exit(int)</code> / <code>abort()</code> via JNI or (c) do something crazy like call <code>kill -9 $PID</code> on itself(!).</p>
9,074
<p>Let's say I have the following simple table variable:</p> <pre><code>declare @databases table ( DatabaseID int, Name varchar(15), Server varchar(15) ) -- insert a bunch rows into @databases </code></pre> <p>Is declaring and using a cursor my only option if I wanted to iterate through the rows? Is there another way?</p>
<p>First of all you should be absolutely sure you need to iterate through each row — set based operations will perform faster in every case I can think of and will normally use simpler code.</p> <p>Depending on your data it may be possible to loop using just <code>SELECT</code> statements as shown below:</p> <pre><code>Declare @Id int While (Select Count(*) From ATable Where Processed = 0) &gt; 0 Begin Select Top 1 @Id = Id From ATable Where Processed = 0 --Do some processing here Update ATable Set Processed = 1 Where Id = @Id End </code></pre> <p>Another alternative is to use a temporary table: </p> <pre><code>Select * Into #Temp From ATable Declare @Id int While (Select Count(*) From #Temp) &gt; 0 Begin Select Top 1 @Id = Id From #Temp --Do some processing here Delete #Temp Where Id = @Id End </code></pre> <p>The option you should choose really depends on the structure and volume of your data.</p> <p><strong>Note:</strong> If you are using SQL Server you would be better served using:</p> <pre><code>WHILE EXISTS(SELECT * FROM #Temp) </code></pre> <p>Using <code>COUNT</code> will have to touch every single row in the table, the <code>EXISTS</code> only needs to touch the first one (see <a href="https://stackoverflow.com/a/65294/963542">Josef's answer</a> below).</p>
<p>This is the code that I am using 2008 R2. This code that I am using is to build indexes on key fields (SSNO &amp; EMPR_NO) n all tales</p> <pre><code>if object_ID('tempdb..#a')is not NULL drop table #a select 'IF EXISTS (SELECT name FROM sysindexes WHERE name ='+CHAR(39)+''+'IDX_'+COLUMN_NAME+'_'+SUBSTRING(table_name,5,len(table_name)-3)+char(39)+')' +' begin DROP INDEX [IDX_'+COLUMN_NAME+'_'+SUBSTRING(table_name,5,len(table_name)-3)+'] ON '+table_schema+'.'+table_name+' END Create index IDX_'+COLUMN_NAME+'_'+SUBSTRING(table_name,5,len(table_name)-3)+ ' on '+ table_schema+'.'+table_name+' ('+COLUMN_NAME+') ' 'Field' ,ROW_NUMBER() over (order by table_NAMe) as 'ROWNMBR' into #a from INFORMATION_SCHEMA.COLUMNS where (COLUMN_NAME like '%_SSNO_%' or COLUMN_NAME like'%_EMPR_NO_') and TABLE_SCHEMA='dbo' declare @loopcntr int declare @ROW int declare @String nvarchar(1000) set @loopcntr=(select count(*) from #a) set @ROW=1 while (@ROW &lt;= @loopcntr) begin select top 1 @String=a.Field from #A a where a.ROWNMBR = @ROW execute sp_executesql @String set @ROW = @ROW + 1 end </code></pre>
8,731
<p>Is there an easy way to avoid dealing with text encoding problems?</p>
<p>You can't really avoid dealing with the text encoding issues, but there are existing solutions in Apache Commons:</p> <ul> <li><code>Reader</code> to <code>InputStream</code>: <a href="https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/input/ReaderInputStream.html" rel="noreferrer"><code>ReaderInputStream</code></a></li> <li><code>Writer</code> to <code>OutputStream</code>: <a href="https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/output/WriterOutputStream.html" rel="noreferrer"><code>WriterOutputStream</code></a></li> </ul> <p>You just need to pick the encoding of your choice.</p>
<p>For Reading a string in a stream using just what java supplies.</p> <pre><code>InputStream s = new BufferedInputStream( new ReaderInputStream( new StringReader("a string"))); </code></pre>
8,761
<p>OK here's some background of the problem:</p> <p>Symptoms:</p> <ul> <li><p>All retracts on the extruder produce a screeching noise. The extruder extrudes normally all other times.</p> </li> <li><p>Any fast move on the Z-axis also produces a screeching noise and the Z-axis will move normally at all other times.</p> </li> <li><p>This appears to happen regardless of any printing state whether the heaters are on or not it will still occur it even happens during the ABL process.</p> </li> </ul> <p>Specifications of the printer:</p> <ul> <li>Mainboard: MKS Gen L V2</li> <li>Drivers: TMC2209 UART</li> <li>Stepper motors: Stepperonline 17HS15-1504S 1.8 deg 1.5A</li> <li>Pulleys: GT2 16T</li> <li>Leadscrew: 2 mm pitch T8</li> <li>Hotend: E3D V6</li> </ul> <p>OK so basically I performed an upgrade of my stepper drivers as well as the leadscrew and pulleys on my 3D printer which was originally a Tevo tornado and at the start of every print I would experience a loud screeching noise coming from the Z-axis and I originally identified it to be a single line in my G-code that would only trigger the screech if it was preceded by another line and by commenting out the first line I was able to start printing</p> <p>Lines in question:</p> <pre><code>G1 X3 Y1 Z15 F9000 ; Move safe Z height to shear strings G0 X1 Y1 Z0.2 F9000 ; Move in 1mm from edge and up [z] 0.2mm </code></pre> <p>However, while I was able to start printing, I soon found out that the extruder was doing the same thing with every retract it would create a loud screech and the filament wouldn't be retracted this caused heavy stringing as well as poor layer adhesion resulting in prints failing. I figured the problem was with the version of Marlin I was using so I attempted to use the latest bug fix. However, I was still experiencing the same problems. I attempted to see if the stepper current was the problem and after identifying that the stepper current was not the cause of the problem, I figured I needed to replace the stepper motors and after replacing the stepper motors the problem still remained. I figured the problem must be with Marlin so I attempted to use Klipper. However, I am still experiencing the same and now I can't even complete a mesh bed leveling as the movements that Klipper uses are triggering the loud screeching and causing the steppers to freeze up.</p> <p>I am unsure as to what could be causing this as I think I've checked everything that could be causing it so I'm not quite sure how to proceed I've also made a video that should show the problem in action. So I guess I'm wondering what's my next troubleshooting step?</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/v_vXF8f9GdQ?start=0"></iframe> </div></div></p> <p>EDIT: Updates</p> <p>I have tried changing the drivers back to TMC2208s there have been no changes on both Kilpper and Marlin.</p> <p>I tried switching to an MKS Gen L V2.1 in case it was a mainboard problem. sill experiencing problems</p> <p>Marlin Config</p> <p>Configuration.H <a href="https://paste-bin.xyz/41662" rel="nofollow noreferrer">https://paste-bin.xyz/41662</a></p> <p>Configuration_ADV.H <a href="https://paste-bin.xyz/41663" rel="nofollow noreferrer">https://paste-bin.xyz/41663</a></p> <p>Klipper Config <a href="https://paste-bin.xyz/41677" rel="nofollow noreferrer">https://paste-bin.xyz/41677</a></p> <p>Edit:</p> <p>The only other thing I think I can try is running the TMC2209s in standalone mode</p>
<p>If you have an empty spool of the same brand, you could weigh the empty spool and the one you're trying to &quot;measure&quot; to get an approximate weight of the remaining filament. Divide by the (presumably available from manufacturer) weight per meter to get a rough length in meters, if that's more useful to you than weight.</p>
<p>Besides using the window on a spool that estimates the amount of filament left, I've used large calipers to measure the diameter of an empty spool and the diameter of the filament left on the spool.</p>
2,110
<p>I've currently got a set of reports with a number of common functions sitting in code blocks within the .rdl files. This obviously presents a maintainability issue and I as wondering if anyone knew a way for these different reports to share a library of common code?</p> <p>Ideally I'd like to have a .Net Assembly attached to my Reporting Services project, which all of my reports can access and call functions from. This would save the headache of trying to update and redeploy about 100 reports every time a change needs to be made to a common function.</p> <p>Any suggestions?</p>
<p>From within Visual Studio in the properties of the report, on the 'References' tab add the details for the assembly that contains the managed code. This code can be called from expressions within reports using the instance name that is specified.</p> <p>This assembly can either be stored in the GAC or the PrivateAssemblies directory of Visual Studio, and be deployed to the Report Service 'bin' directory on the Reporting Services server. For more information refer to <a href="http://support.microsoft.com/kb/920769" rel="noreferrer">How to use custom assemblies or embedded code in Reporting Services</a></p>
<p>You must deploy to the GAC. <a href="http://www.developerdotstar.com/community/node/333" rel="nofollow noreferrer">http://www.developerdotstar.com/community/node/333</a></p>
9,700
<p>I created a C++ console app and just want to capture the cout/cerr statements in the Output Window within the Visual Studio 2005 IDE. I'm sure this is just a setting that I'm missing. Can anyone point me in the right direction?</p>
<p>I've finally implemented this, so I want to share it with you:</p> <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt; #include &lt;windows.h&gt; #include &lt;boost/iostreams/stream.hpp&gt; #include &lt;boost/iostreams/tee.hpp&gt; using namespace std; namespace io = boost::iostreams; struct DebugSink { typedef char char_type; typedef io::sink_tag category; std::vector&lt;char&gt; _vec; std::streamsize write(const char *s, std::streamsize n) { _vec.assign(s, s+n); _vec.push_back(0); // we must null-terminate for WINAPI OutputDebugStringA(&amp;_vec[0]); return n; } }; int main() { typedef io::tee_device&lt;DebugSink, std::streambuf&gt; TeeDevice; TeeDevice device(DebugSink(), *cout.rdbuf()); io::stream_buffer&lt;TeeDevice&gt; buf(device); cout.rdbuf(&amp;buf); cout &lt;&lt; "hello world!\n"; cout.flush(); // you may need to flush in some circumstances } </code></pre> <p><strong>BONUS TIP:</strong> If you write:</p> <pre><code>X:\full\file\name.txt(10) : message </code></pre> <p>to the output window and then double-click on it, then Visual Studio will jump to the given file, line 10, and display the 'message' in status bar. It's <em>very</em> useful.</p>
<p>Also, depending on your intentions, and what libraries you are using, you may want to use the <a href="http://msdn.microsoft.com/en-us/library/4wyz8787(VS.80).aspx" rel="nofollow noreferrer">TRACE macro</a> (<a href="http://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library" rel="nofollow noreferrer">MFC</a>) or <a href="http://msdn.microsoft.com/en-us/library/6xkxyz08(VS.80).aspx" rel="nofollow noreferrer">ATLTRACE</a> (<a href="http://en.wikipedia.org/wiki/Active_Template_Library" rel="nofollow noreferrer">ATL</a>).</p>
9,895
<p>I really enjoyed <a href="http://www.codinghorror.com/blog/archives/001148.html" rel="noreferrer">Jeff's post</a> on <a href="http://ssdl-wiki.cs.technion.ac.il/wiki/index.php/Spartan_programming" rel="noreferrer">Spartan Programming</a>. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with.</p> <p>For years I have read about and adhered to the "one-expression-per-line" practice. I have fought the good fight and held my ground when many programming books countered this advice with example code like:</p> <pre><code>while (bytes = read(...)) { ... } while (GetMessage(...)) { ... } </code></pre> <p>Recently, I've advocated one expression per line for more practical reasons - debugging and production support. Getting a log file from production that claims a NullPointer exception at "line 65" which reads:</p> <pre><code>ObjectA a = getTheUser(session.getState().getAccount().getAccountNumber()); </code></pre> <p>is frustrating and entirely avoidable. Short of grabbing an expert with the code that can choose the "most likely" object that was null ... this is a real practical pain.</p> <p>One expression per line also helps out quite a bit while stepping through code. I practice this with the assumption that most modern compilers can optimize away all the superfluous temp objects I've just created ...</p> <p>I try to be neat - but cluttering my code with explicit objects sure feels laborious at times. It does not generally make the code easier to browse - but it really has come in handy when tracing things down in production or stepping through my or someone else's code.</p> <p>What style do <em>you</em> advocate and can you rationalize it in a practical sense?</p>
<p>In <strong>The Pragmatic Programmer</strong> Hunt and Thomas talk about a study they term the Law of Demeter and it focuses on the coupling of functions to modules other than there own. By allowing a function to never reach a 3rd level in it's coupling you significantly reduce the number of errors and increase the maintainability of the code. </p> <p>So:</p> <blockquote> <p>ObjectA a = getTheUser(session.getState().getAccount().getAccountNumber());</p> </blockquote> <p>Is close to a felony because we are 4 objects down the rat hole. That means to change something in one of those objects I have to know that you called this whole stack right here in this very method. What a pain.</p> <p>Better:</p> <blockquote> <p>Account.getUser();</p> </blockquote> <p>Note this runs counter to the expressive forms of programming that are now really popular with mocking software. The trade off there is that you have a tightly coupled interface anyway, and the expressive syntax just makes it easier to use.</p>
<p>Maintainability, and with it, readability, is king. Luckily, shorter very often means more readable.</p> <p>Here are a few tips I enjoy using to slice and dice code:</p> <ul> <li><strong>Variable names</strong>: how would you describe this variable to someone else on your team? You would <em>not</em> say "the numberOfLinesSoFar integer". You would say "numLines" or something similar - comprehensible and short. Don't pretend like the maintainer doesn't know the code at all, but make sure you yourself could figure out what the variable is, even if you forgot your own act of writing it. Yes, this is kind of obvious, but it's worth more effort than I see many coders put into it, so I list it first.</li> <li><strong>Control flow</strong>: Avoid lots of closing clauses at once (a series of }'s in C++). Usually when you see this, there's a way to avoid it. A common case is something like</li> </ul> <p>:</p> <pre><code>if (things_are_ok) { // Do a lot of stuff. return true; } else { ExpressDismay(error_str); return false; } </code></pre> <p>can be replaced by</p> <pre><code>if (!things_are_ok) return ExpressDismay(error_str); // Do a lot of stuff. return true; </code></pre> <p>if we can get ExpressDismay (or a wrapper thereof) to return false.</p> <p>Another case is:</p> <ul> <li><strong>Loop iterations</strong>: the more standard, the better. For shorter loops, it's good to use one-character iterators when the variable is never used except as an index into a single object.</li> </ul> <p>The particular case I would argue here is against the "right" way to use an STL container:</p> <pre><code>for (vector&lt;string&gt;::iterator a_str = my_vec.begin(); a_str != my_vec.end(); ++a_str) </code></pre> <p>is a lot wordier, and requires overloaded pointer operators *a_str or a_str->size() in the loop. For containers that have fast random access, the following is a lot easier to read:</p> <pre><code>for (int i = 0; i &lt; my_vec.size(); ++i) </code></pre> <p>with references to my_vec[i] in the loop body, which won't confuse anyone.</p> <p>Finally, I often see coders take pride in their line number counts. But it's not the line numbers that count! I'm not sure of the best way to implement this, but if you have any influence over your coding culture, I'd try to shift the reward toward those with compact classes :)</p>
7,399
<p>Cura has a layer view feature that lets you watch a simulation of the extruder head as it lays down material at each layer. Is it possible to get Cura to show a time stamp as it does this? That would let me set reminders to check a print just at certain critical times.</p>
<p>These estimates tend to be very approximate, even if Cura has the accurate acceleration values for your firmware. An error of 100% is not unusual.</p> <p>What you probably want is an alarm at a specific layer (a few before the critical ones). You might be able to add this to Octoprint fairly easily - it does support plugins which can provide (for example) pushbullet notifications.</p> <p>I'm not sure that 'critical' points are much more likely to fail than other less predictable things (like bed adheesion failure, extruder jams, filament breaks) - unless you're testing features (and then hopefully you can print only a slice of the part).</p>
<p>If I may interpret your question a bit, and add alternatives to Sean H's suggestions. I agree that any attempt to estimate elapsed time per layer is doomed. </p> <p>Perhaps you should just look at the LayerView to determine the critical layers of interest. Then edit the gcode file in a text editor. Locate the start of the layer in question, and insert a PAUSE command (as well as whatever other actions your firmware supports, in case you can actually send an audible alarm or something). </p> <p>If you really just want to print a subsection of the item, you're better off removing the unwanted parts in MeshMixer/MeshLab/whateverCAD , and slicing just the part you want to produce. </p>
1,001
<p>I am looking to print an enclosure, which will have a PCB inside with some LED indicators. I was wondering if it is possible to 3D print the enclosure such that the following look can be achieved? What material and technique?</p> <p>When LEDs are off, it looks something like this:</p> <p><a href="https://i.stack.imgur.com/eUN2v.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/eUN2v.jpg" alt="enter image description here"></a></p> <p>WHen the LED turns on, it looks like this (illuminated symbols):</p> <p><a href="https://i.stack.imgur.com/X9GuC.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/X9GuC.jpg" alt="enter image description here"></a></p>
<p>Achieving this with 3D printing would be quite difficult, and you might be better served by creating this effect some other way (I would personally recommend getting some inkjet transparencies and stacking a few layers together: an entirely black layer, and a few layers with the symbols in negative space).</p> <p>One way that you <em>might</em> be able to achieve this using just a common FDM printer is to print the part face down, and printing just a single layer or two that covers the entire face, and then printing more layers that cover everything but the symbols. However, those symbols look small and detailed and you might not be able to reproduce such detail.</p>
<p>You can print the "lid" in translucent (gray) and stick a piece of laser printed transparency film under it with the symbols (print it "negative" so the symbols are transparent and the rest is black). Depending on the quality of the printed black you might want to stack two printouts to minimize light sipping through the black areas. A divider separating the leds underneath ensures that only one symbol lights up.</p> <p>This will work better the better surface quality the "lid" has.</p>
358
<p>I run a game and the running is done by hand, I have a few scripts that help me but essentially it's me doing the work. I am at the moment working on web app that will allow the users to input directly some of their game actions and thus save me a lot of work.</p> <p>The problem is that I'm one man working on a moderately sized (upwards of 20 tables) project, the workload isn't the issue, it's that bugs will have slipped in even though I test as I write. So my question is thus two-fold.</p> <ol> <li>Beta testing, I love open beta's but would a closed beta be somehow more effective and give better results?</li> <li>How should I bring in the app? Should I one turn drop it in and declare it's being used or should I use it alongside the normal construct of the game?</li> </ol>
<p>This is my general approach to testing/launching. How you test/launch depends mostly on:</p> <ol> <li>What your application <strong>is</strong>.</li> <li>Who your users <strong>are</strong>.</li> </ol> <p>If you application is a technical application and is geared to the technically-minded, the word "beta" won't really scare them - but provide an opportunity to test the product before it goes 'live', and help to improve the system. This is the ideal circumstance in which to use either an open or closed beta. It's usually beneficial to start off 'closed' with a group of people you select and trust to bug-find quickly and reliably - after you're more confident that all the critical bugs are gone, open it up with an invite system (for example).</p> <p>If, however, your application is 'trivial' from a technical standpoint (i.e. it's something like Twitter, or Facebook, or Flickr - nothing that is inherently geared towards technical usage), then you're going to have to be more careful in how you plan your testing. Closed testing is most definitely your first port of call, and this should last for longer than a closed beta on a more 'technical' product. The reason? Your 'average Joe' doesn't necessarily know what the word "beta" means, and others may well be scared by it, or judge your service prematurely (not understanding the concept of this 'public testing' phase). Many won't want to be used as guinea pigs.</p>
<p>I don't understand what you mean by "bring in the app" and "one turn drop it". By "bring in the app" do you mean deploy? As for "One turn drop", I totally don't understand it.</p> <p>As for open betas, that depends on your audience, really. Counterstrike, for example, apparently run a few closed betas before doing open betas, so here's my suggestion:</p> <ol> <li>Set up a forum in some free forumboard, or set up a topic in a popular gaming forum.</li> <li>Look for people (whether or not they are in those forums) that you trust, and let them in in a closed beta. This will allow you to iron out serious kinks at first.</li> <li>If your closed group isn't reporting as much bugs any more, release it to open beta, pointing out ways on how they could give feedback to you.</li> </ol> <p>This is similar to the approach StackOverflow took, but this being a game setting it up on a gaming forum will give the dual benefit of advertising your game <em>and</em> getting some interested beta testers.</p>
4,971
<p>I got my first printer, a <a href="https://www.amazon.de/dp/B075FQRNY3/ref=pe_3044161_189395811_TE_SCE_3p_dp_1" rel="nofollow noreferrer">Geeetech Prusa i3</a>, and for the price I paid (160$) I am so blown away. As I saved so much money, I treated myself to a legit copy of Simplify3D, which I am happy with.</p> <p>I'm using white PLA filament (supposedly 1.75&nbsp;mm) with a 0.3&nbsp;mm nozzle. The hotend temperature range is 215-240&nbsp;°C and the bed is usually at 90&nbsp;°C (with hairspray it gives a nice shiny solid bottom surface). My goal is to print with 0.3, or with 0.2 if 0.3 is to big for the nozzle (ideally a 0.3 nozzle can print 0.3 layer height).</p> <p><strong>The problem:</strong></p> <p>It seems that, especially on the first layer with bigger prints, or any layer that continuously pulls filament through the nozzle (outside lining of a layer), the amount of filament that gets "printed out" isn't enough compared to the amount of filament that is pushed in by the extruder gear. This, in my theory right now, causes the new filament to stay in place until the melted plastic in the nozzle is used, which then makes room again for more filament to be pushed through. Until this happens, the gear slips/clicks and can't pull anymore filament.</p> <p>The mechanics seem to work well, and I don't think the nozzle is clogged. I would guess that some settings need to be manually adjusted to keep the amount of filament pushed through the nozzle equal or less than the amount the nozzle can actually push through, but what is weird to me is that this happens semi-randomly. I have searched online and the issue intermittently appears with other people, but I haven't found a solution yet.</p> <p><em>What settings would I need to test?</em> </p> <p>Here is a link to <a href="https://1drv.ms/f/s!AnDfnxILoXLp9TWV9u0Ue1OEW1cL" rel="nofollow noreferrer">some current successful prints and a layer mess up example(batman bust)</a>.</p> <p>My biggest print so far (Batman Bust) is amazing, but even here you can see certain layers where the gear couldn't push filament through and the gear skipped a few clicks, causing it to print less when it was suppose to print on the following instructions. This happens a lot more, but when it happens during an infill you obviously can't see it from the outside. The individual layer-height seems maybe a bit too small (0.1 for batman), and the times where the extruder usually skips and clicks appear when I print bigger sizes (0.2 and 0.3). I want to start printing more complex and bigger things, so using 0.1 seems like an overkill in detail and takes way too long.</p> <p>Edit:</p> <p>My filament is the generic Geeetech white PLA that I ordered together with the printer.</p>
<p>A nozzle with a nozzle <strong>width</strong> of 0.3 mm cannot print a 0.3 mm layer <strong>height</strong>. You <em>could</em> do that but you <em>should</em> not as you ultimately pay the price in the form of a less aesthetic finish. The general rule of thumb is to maximize the layer height at 75 % of the nozzle width, so a 0.3 mm nozzle would allow for a maximum of 0.225 mm. The rationale is that the filament leaves the nozzle as a tube and needs to be flattened to make it flat and adhere to the previous layer, too high layer heights increase the pressure in the nozzle (more filament is needed) causing a less than ideal extrusion and cause the extruder to skip; this is identified by observing a distinct <a href="https://3dprinting.stackexchange.com/search?tab=newest&amp;q=extruder%20click">clicking</a> noise.</p> <p>Please lower your layer height (try 0.2 mm) and decrease the printing speed to see if this works better.</p> <p>Furthermore, for PLA, temperatures for the hotend (unless you have some sort of a special PLA filament) and the bed temperature are too high. Please aim to print PLA at about 200 &deg;C with a bed temperature of 50 - 60 &deg;C.</p>
<p>I fixed it!</p> <p>The problem wasn't the temperature, it was the spring that puts the pressure on the little wheel against the gear. That was too strong, so the entry of the extruder was to tight. The gear worked fine and the settings worked well, I just had to adjust the spring a bit to carefully lower the pressure. I just printed another Golden Key and it looks perfect!</p> <p>Thanks for all your tips on the other settings, I will experiment with tose to see if I can increase quality even more, but it seems to work perfectly now for a 160$ printer :) </p>
1,063
<p>Is it possible to generate PDF Documents in an Adobe AIR application without resorting to a round trip web service for generating the PDF? I've looked at the initial Flex Reports on GoogleCode but it requires a round trip for generating the actual PDF.</p> <p>Given that AIR is supposed to be the Desktop end for RIAs is there a way to accomplish this? I suspect I am overlooking something but my searches through the documentation don't reveal too much and given the target for AIR I can't believe that it's just something they didn't include.</p>
<p>There's <a href="http://code.google.com/p/alivepdf/" rel="nofollow noreferrer">AlivePDF</a>, which is a PDF generation library for ActionScript that should work, it was made just for the situation you describe.</p>
<p>One of the other teams where I work is working on a Flex-based drawing application and they were totally surprised that AIR / Flex does not have PDF authoring built-in. They ended up rolling their own simple PDF creator based on the PDF specification.</p>
7,677
<p>3D Printers (those who print, not the machine, dummy)!</p> <p>I haven't been printing in a while, so when I returned to my Monoprice Select Mini VII, of course it had been sprung out of whack. Some of my first prints would not even come out of the extruder until I realized I had some pretty bad (and worse, unnoticed!) heat creep going on. After fixing that issue, it became apparent that many more persisted.</p> <p>My question for you all is this: In general, what problems should be addressed first when looking at a complete disaster of a print?</p> <p>I'm not going to specify any singular problem, but I am interested in seeing the "order of operations" for general problem solving when multiple issues exist. For example, "Fix bed height before anything else; this is a common problem that produces multiple others." Hopefully, this can help others with multiple printing issues, too.</p>
<p>for sure the answer could be dissertation or even a book because there is no simple way to address "all" issues - it's just to wide area</p> <p>but as the simple troubleshooting i would list it this way</p> <ol> <li>is your printer alive so is it <ul> <li>working at all (check power, cables)</li> <li>communicate with the world (check app, drivers, cables)</li> <li>moving HE and heating HB (check jams, end-points, belts, screws)</li> <li>is it extruding (check heating, temperature, HE jams, filament path)</li> </ul></li> </ol> <p>if all above is "yes" then</p> <ol start="2"> <li>is your printer making printouts and are those printouts <ul> <li>starts and continues (check heating HB, HB adhesion, leveling, cooling)</li> <li>finished at all (check all above again, stepsticks temerature)</li> <li>keeping the shape (check screws and nuts, couplings, stiffness, stability, temperatures)</li> </ul></li> </ol> <p>if all above is "yes" then in general you are half way ;)</p> <ol start="3"> <li>common issues - printout is <ul> <li>bent or skewed (check geometry, stiffnes, leveling, belts, vibrations, stepsticks temerature)</li> <li>wrapped or overextruded (check temperature, extruding, printout angles)</li> <li>underextruded (check filament flow, filament path, stepsticks temerature)</li> <li>stringy (check temperatures, app settings)</li> </ul></li> </ol> <p>that is the main path i think. all above is more or less applicable to all DIY printers and all prusa clones and all clones of clones ;)</p> <p>it can go wrong and fork in all possible moments as there is so many aspects to screw...</p>
<h1>The obvious ones first</h1> <p>This is, well, obvious. It is, what a visual and smell inspection shows. Stuff like missing or ruptured cables, bent rails, ripped or very loose belts, burnt smell or hung up software that is easy to see that it is going on needs to be addressed first.</p> <h1>The not so obvious next</h1> <p>Next on the list are problems that have no obvious cause and effect. My order of operations to find these is like this:</p> <ul> <li>Homing</li> <li>movement of XYZ</li> <li>Bed leveling</li> <li>Heating test to 200 °C</li> <li>Extrusion of some millimeters</li> <li>Retract some millimeters</li> </ul> <p>That solves the basic mechanical side, it shows that the machine technically could print. It is a visual as well as audial inspection. It also prepares the printer for printing.</p> <h1>A test print next</h1> <p>What's next, after having a machine that theoretically should be able to print is to print.</p> <p>Start with a simple thing. A cube for example. It shows problems with bed adhesion, surface finish, extrusion, temperature, layer shifting and layer adhesion.</p> <p>Half of these problems are usually the result of temperature control. The rest but for layer shifting usually as a result of slicer settings.</p> <ul> <li>Layer shifting, the odd one out, most often would either be caused by a mechanical problem are using speeds which the printer can't cope with.</li> <li>Surface imperfections like blobbing shows too much extrusion and heat.</li> <li>Ghosting so that the printer is resonating with its movement.</li> </ul>
1,315
<p>I love the ease that the ASP.NET Ajax control Toolkit provides to ASP.NET developers. However, I've not found it to be a scalable solution at all. I have a page with 2 date input fields. By putting a TextBox and an CalendarExtendar control attached to it for each date field, I get several (11, in fact) external Javascript calls to /ScriptResource.axd?d=xxxx</p> <p>Is there any way to control this? Why does it suck so much? What's a better Ajax toolkit for .NET that can provide equal (or better) set of functionality that is more scalable, straight forward and completely customizable? NOT looking to reinvent the wheel here.</p>
<p>I always preferred to write my Ajax calls in javascript using JQuery or Prototype. ASP.NET Ajax Toolkit does make things easier, but it never seems to do so elegantly.</p> <p>I personally would make a new Calendar Controller. This way you can control the AJAX (using JQuery/Prototype) calls that are being made.</p>
<p>ASP.NET AJAX allows you to register web services with the ScriptManager which will create JavaScript proxies for you to call. See <a href="http://msdn.microsoft.com/en-us/library/bb515101.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb515101.aspx</a>.</p>
3,660
<p>There are several plugin options for building a search engine into your Ruby on Rails application. Which of these is the best?</p> <ul> <li><a href="http://ts.freelancing-gods.com/" rel="noreferrer">Thinking Sphinx</a></li> <li><a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html" rel="noreferrer">UltraSphinx</a></li> <li><a href="http://seattlerb.rubyforge.org/Sphincter/" rel="noreferrer">Sphincter</a></li> <li><a href="http://www.datanoise.com/articles/2007/3/23/acts_as_sphinx-plugin" rel="noreferrer">acts_as_sphinx</a></li> <li><a href="http://projects.jkraemer.net/acts_as_ferret/" rel="noreferrer">acts_as_ferret</a></li> <li><a href="http://ferret.davebalmain.com/trac/" rel="noreferrer">Ferret</a></li> <li><a href="http://locomotivation.com/2008/07/23/simple-ruby-on-rails-full-text-search-using-xapian" rel="noreferrer">acts_as_xapian</a></li> <li><a href="http://github.com/railsfreaks/acts_as_solr/tree/master" rel="noreferrer">acts_as_solr</a></li> <li><a href="http://hyperestraier.sourceforge.net/" rel="noreferrer">Hyper Estraier</a></li> </ul>
<p>Thinking Sphinx has more concise syntax to define which fields and which models are indexed.</p> <p>Both UltraSphinx and Thinking Sphinx (recently) have ultra-cool feature which takes into account geographical proximity of objects. </p> <p>UltraSphinx has annoying problems with how it loads models (it does not load entire Rails stack, so you could get strange and hard to diagnose errors, which are handled by adding explicit <code>require</code> statements).</p> <p>We use Thinking Sphinx on new projects, and UltraSphinx on projects which use geo content.</p>
<p>I've used Thinking Sphinx and it seems pretty good, but I haven't had the time to evaluate all of the options.</p>
9,926
<p>A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases.</p> <p>The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub selects, ~15-25 where conditions and GroupBy's). The base table is always the same one, but the structure of joins, conditions and groupings depend on a set of parameters that are passed into my class/method.</p> <p>Constructing the sql query like this does work but it obviously isn't a very elegant solution (and rather hard to read/understand and maintain as well)... I could just write a simple "querybuilder" myself but I am pretty sure that I am not the first one with this kind of problem, hence my questions:</p> <ul> <li>How do <em>you</em> construct your database queries?</li> <li>Does C# offer an easy way to dynamically build queries?</li> </ul>
<p>I used C# and Linq to do something similar to get log entries filtered on user input (see <a href="https://stackoverflow.com/questions/11194/conditional-linq-queries">Conditional Linq Queries</a>):</p> <pre><code>IQueryable&lt;Log&gt; matches = m_Locator.Logs; // Users filter if (usersFilter) matches = matches.Where(l =&gt; l.UserName == comboBoxUsers.Text); // Severity filter if (severityFilter) matches = matches.Where(l =&gt; l.Severity == comboBoxSeverity.Text); Logs = (from log in matches orderby log.EventTime descending select log).ToList(); </code></pre> <p>Edit: The query isn't performed until .ToList() in the last statement.</p>
<p>You may want to consider LINQ or an O/R Mapper like this one: <a href="http://www.llblgen.com/" rel="nofollow noreferrer">http://www.llblgen.com/</a> </p>
8,851
<p>I am trying to print something that might take 15 hours. I don't want to risk my printer so if I print for 15 hours, what is the worst that can happen? So far, I haven't printed anything for more than 5 hours.</p>
<p>Playing around with the nozzle height will help: back it off until just before you have first layer adhesion issues. Don't jam the filament into the bed as you might for ABS. This helps with small prints. However, my experience has been that if you have a large enough continuous contact area (i.e. more than a few square inches) with the print bed, there will be problems getting the print off. So I still use painters tape (in case I have to rip the print off with force) and glue sticks (so that I don't often need to) on my aluminum print bed as I've found that makes it much easier to deal with without damaging either the bed or the print.</p> <p>You can also try dialing back the heated bed temperature a bit (I think I've got mine set to 70-75c for PETG) but that also doesn't eliminate the issue with larger prints. Also, if I lowered it too much I had problems with first layer adhesion on any size print.</p> <p>I also have a glass plate that I use for ABS, which I don't use with PETG. I've read too many accounts of it sticking too well to glass as well (to the point of the plate being destroyed) and didn't want to try using the amount of force on it that I sometimes have to when removing a PETG print. I also considered trying BuildTak but read accounts of similar issues with it and PETG. So I stayed with what's been working for me: tape and glue sticks.</p>
<p>Correctly level your bed. Seriously, that's the answer. PETG does stick well, but it only gets difficult to remove if you're smashing the first layer against the bed with a nozzle that's way too close. With the bed leveled properly - using feeler gauges or test prints and a sub-0.1-mm-precision caliper - I have no trouble taking PETG prints off a buildtak-clone bed. Glass should be easier.</p> <p>If you already have PETG stuck to a build surface you care about and don't want to risk destroying it, try heat, or alternating heat and cold.</p>
1,777
<p>I have one table "orders" with a foreing key "ProductID".</p> <p>I want to show the orders in a grid with the <strong>product name</strong>, without <strong>LazyLoad</strong> for better performance, but I if use <strong>DataLoadOptions</strong> it retrieves <strong>all</strong> Product fields, which seams like a <strong>overkill</strong>.</p> <p>Is there a way to retrieve <strong>only</strong> the Product name in the first query? Can I set some attribute in the DBML?</p> <p>In this <a href="http://visualstudiomagazine.com/listings/list.aspx?id=566" rel="nofollow noreferrer">table</a> says that "Foreign-key values" are "Visible" in Linq To SQL, but don't know what this means.</p> <p><strong>Edit</strong>: Changed the title, because I'm not really sure the there is no solution.<br> Can't believe no one has the same problem, it is a very common scenario.</p>
<p>What you are asking for is a level of optimisation the linq-to-sql does not provide. I think your best bet is to create a query that returns exactly the data you want, possibly as an anonymous type:</p> <pre><code>from order in DB.GetTable&lt;Orders&gt;() join product in DB.GetTable&lt;Products&gt;() on order.ProductID = product.ID select new { ID = order.ID, Name = order.Name, ProductName = product.Name }; </code></pre>
<p>If you select only the columns you want in the linq query, and then call .ToList() on the query, it will be immedietly executed, and will only bring back the columns you are interested in. For example if you do this:</p> <pre><code>var q = from p in dataContext.products select p.ProductName; var results = q.ToList(); </code></pre> <p>You will get back a list of product names stored in results, and when the query executes on the server it will only bring back the ProductName column.</p>
4,870
<p>I was working on my printer when something metallic came into contact with the pcb. I smelled smoke and quickly unplugged the printer. Anyway, this is the result and, of course, the heat bed won't heat. </p> <p>Can this be salvaged or should I toss it and buy a new one? </p> <p><a href="https://i.stack.imgur.com/WhRPu.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/WhRPu.jpg" alt="shorted"></a></p> <p><strong>update</strong> the heat bed was not hot at the time. I had the heat bed unscrewed from the chassis but had forgotten to unplug the printer. I am not exactly sure how it shorted but I think it shorted between the power lead connection and the thermistor. </p>
<p>What happend was short circuit of course. There is no doubt you overheated HB so copper detached from HB base plate. Because you wrote it doesn't work it means copper tracks are broken.</p> <p>There is very low chance to fix it. I mean it - near to zero.</p> <p>What you could do is:</p> <ol> <li>Detach HB from arduino</li> <li>Find a place where track is broken (which needs to uncover it from protective layer)</li> <li>Connect it with a wire</li> </ol> <p>Unfortunately even if you do it and your HB will work (electrically) your fixed HB which won't be flat anymore.</p> <p>So definitely it's to be thrown away.</p> <p><strong>[edit]</strong></p> <p>I just realised you have double power HB, which means your HB has 2 heaters... which gives a bit hope.</p> <p>take a look here</p> <p><a href="https://i.stack.imgur.com/GZMZc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GZMZc.jpg" alt="enter image description here"></a></p> <p><a href="http://reprap.org/mediawiki/images/thumb/6/62/Heated-bed-schematic.png/800px-Heated-bed-schematic.png" rel="nofollow noreferrer">here is schematics</a> which could give you an idea</p> <p>You could check if your second heater works ok</p> <p>If yes then you are salvaged! :)</p> <p><strong>[edit2]</strong> I really suppose the schematics of HB is more or less like this</p> <p><a href="https://i.stack.imgur.com/AS2I1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AS2I1.png" alt="enter image description here"></a></p> <p>So if H1 is broken there is a chance to use H2 connecting pins respectively</p>
<p>Yes, it should be possible to fix, although you might choose to replace anyway on the basis that the repaired bed might give you concerns about how long it will be before your repair fails.</p> <p>You will need to carefully remove the protective layer to expose the heating element (assuming you can identify where it is likely to have broken). Then carefully solder across the break (maybe with a short fragment of wire).</p> <p>After making the repair, you should cover the exposed track. This provides both electrical and thermal insulation. In the absence of any suitable high-temperature paintable covering, you could try using kapton tape.</p>
264
<p>I'm trying to call a function after I load some XML into Actionscript, and I'm just wondering how I call that function. Example:</p> <pre><code>//Function Declarations function parentFunction() { function callMe() { textField.text = "lawl"; } } </code></pre> <p>Now, <strong>how do I call the "callMe()" function</strong> in a different part of the code, like an onRelease function?</p> <pre><code>on(release) { callMe(); //doesn't work parentFunction().callMe(); //doesn't work parentFunction.callMe(); //doesn't work } </code></pre> <p>ActionScript 2.0 is just so wonky! Any ideas?</p>
<p>Are you forced to declare callMe inside of parentFunction? I assume so because otherwise you would just do</p> <p>function parent() { } function callMe() { }</p> <p>To be clear, a function can't own another function unless you provide some scope for that function to live in.</p> <p>So in JavaScript, you would do this by using the prototype object to declare the callMe function as a method of the object that parentFunction returned.</p> <p><a href="http://www.howtocreate.co.uk/tutorials/javascript/objects" rel="nofollow noreferrer">http://www.howtocreate.co.uk/tutorials/javascript/objects</a></p> <p>For ActionScript, read this article on Adobe's website: <a href="http://www.adobe.com/devnet/flex/articles/as_collections_03.html" rel="nofollow noreferrer">http://www.adobe.com/devnet/flex/articles/as_collections_03.html</a></p> <p>EDIT: After some more reading it appears the way you did things, you are actually declaring callMe as a <strong>private</strong> function. See this article which should make the whole <a href="http://www.crockford.com/javascript/private.html" rel="nofollow noreferrer">private/public javascript issue</a> a lot more understandable.</p>
<p>I'm an idiot. I forgot the whole "a function can't own another function" thing, so I figured out another way to do it. Thanks!</p>
6,175
<p>We are looking for a WYSIWYG editor control for our windows application (vb.net or c#) so that users can design HTML emails (to send using the SMTP objects in the dot net framework) before sending.</p> <p>Currently all the available editors we can find have one of the following issues:</p> <ol> <li><p>They rely on mshtml.dll or the web browser control which as proven for us to be unreliable as the HTML code and the editor get out of sync under windows 2000 (IE6)</p></li> <li><p>They are web-based, not a windows form control </p></li> <li><p>They place styles in the head of the document (see note below)</p></li> </ol> <p>Unfortunately, as this <a href="http://www.xavierfrenette.com/articles/css-support-in-webmail/" rel="nofollow noreferrer">HTML email article</a> descries the only sure way of making HTML emails to work with styles is to use them inline which now seems to be unsupported in many editors.</p> <p>Does anyone have any experience in this or could suggest a solution?</p>
<p>I also needed a WYSIWYG editor for a Windows Forms project that I was working on. I wrote about the items that I found <a href="http://ellisweb.net/2007/03/wysiwyg-editing-of-html-in-a-windows-forms-control/" rel="nofollow noreferrer">here</a>. Eventually, I ended up using something that I found on CodeProject: <a href="http://www.codeproject.com/KB/edit/editor_in_windows_forms.aspx" rel="nofollow noreferrer">A Windows Forms based text editor with HTML output</a>. This does violate (a) above in that it uses the WebBrowser control. However, I couldn't find anything good that didn't do this (if you don't use the WebBrowser in some way, then you basically have to write your own HTML parser and renderer in order to handle the "What-You-See" part of WYSIWYG). The good thing about this control is that the source is easily customizable, so you can take away and add formatting options as you need (and if you want the styles to all be in-line, you can do this as well). </p>
<p>Instead of searching for an HTML editor, consider the option of a RichText editor (which can be much easier to create) and then convert the final text into a HTML document.</p> <p>Provided you are required to use a minimal set of features (bold / italics etc) both the creation of the RT editor and the conversion of the final document into HTML format shouldn't be hard.</p> <p>If, on the other hand, you need to use more features (such as tables), you need to study the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=DD422B8D-FF06-4207-B476-6B5396A18A2B&amp;displaylang=en" rel="nofollow noreferrer">Rich Text Format</a> and implement the features you need.</p> <p>Additional resources:</p> <ul> <li>Converting RTF to HTML: <a href="http://www.codeproject.com/KB/vb/RTFToHTML.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/vb/RTFToHTML.aspx</a></li> <li>RichTextBox tips and tricks: <a href="http://www.vbforums.com/showthread.php?t=355994" rel="nofollow noreferrer">http://www.vbforums.com/showthread.php?t=355994</a></li> </ul>
3,004
<p>I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out there that I can use or should I just give happs another try?</p>
<p>The best tools as of 2011 are:</p> <ul> <li><a href="http://snapframework.com/" rel="nofollow noreferrer">Snap</a></li> <li><a href="http://www.yesodweb.com/" rel="nofollow noreferrer">Yesod</a>; or</li> <li><a href="http://happstack.com/" rel="nofollow noreferrer">Happstack</a></li> </ul> <p>The web development community around Haskell has been thriving on the competition between these communities.</p> <p>The authors even compare their frameworks here: <a href="https://stackoverflow.com/questions/5645168/comparing-haskells-snap-and-yesod-web-frameworks">Comparing Haskell&#39;s Snap and Yesod web frameworks</a></p>
<p>There is also <a href="http://hope.bringert.net/about" rel="nofollow noreferrer">Hope</a> (link is depreciated), although it doesn't seem to have gained as much traction as <a href="http://happs.org/" rel="nofollow noreferrer">HApps</a> and <a href="http://www2.informatik.uni-freiburg.de/~thiemann/WASH/" rel="nofollow noreferrer">WASH</a>. However, the site has also been quiet for about a year.</p>
7,388
<p>I'm building my own DLP printer with UV LEDs. I use a 20A relay to power them on, since they require high power and can't be directly driven by arduino or Raspberry.</p> <p>I'm planning to use them with NanoDLP on Raspberry + GRBL on Arduino.</p> <p>Is it possible to make NanoDLP tell GRBL to power on (send digital 1/+5V) the relay when the print starts and power it off (send digital 0/GND) when the print ends?</p> <p>The other way would be to just install an on/off switch and do it manually, but I feel this step should be automated somehow.</p> <p>Is there a way to do it?</p>
<p>I have no experience with either GRBL or DLP printers, but the</p> <pre><code>M7 M8 M9 </code></pre> <p>coolant control codes should be able to be sent by NanoDLP to GRBL. Those seem to allow for direct digital output. Apparently you can set the pin you want them to use in the <code>cpu_map.h</code> file, with the standard being Analog Pins 3 and 4 for the M8 and M7 commands respectively.</p> <pre><code>// Define flood and mist coolant enable output pins. #define COOLANT_FLOOD_DDR DDRC #define COOLANT_FLOOD_PORT PORTC #define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3 #define COOLANT_MIST_DDR DDRC #define COOLANT_MIST_PORT PORTC #define COOLANT_MIST_BIT 4 // Uno Analog Pin 4 </code></pre> <p>Hope this helps! Source: <a href="https://github.com/gnea/grbl" rel="nofollow noreferrer">https://github.com/gnea/grbl</a></p>
<p>I think you don't have to use the Arduino. There´s an option in NanoDLP to control the z-axis through the Raspberry GPIO.</p>
689
<p>I have a website that works correctly under IIS 6.0: It authenticates users with windows credentials, and then when talking to the service that hits the DB, it passes the credentials.</p> <p>In IIS 7.0, the same config settings do not pass the credentials, and the DB gets hit with NT AUTHORITY\ANONYMOUS.</p> <p>Is there something I'm missing? I've turned ANONYMOUS access off in my IIS 7.0 website, but I can't get the thing to work.</p> <p>These are the settings that I'm using on both IIS 6.0 and 7.0:</p> <pre><code>&lt;authentication mode="Windows"&gt; &lt;identity impersonate="true"&gt; </code></pre> <p>What changed from 6.0 to 7.0?</p>
<p>There has been changes between IIS7 and IIS6.0. I found for you one blog post that might actually help you (<a href="http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx" rel="noreferrer">click here to see it</a>).</p> <p>Are you running your application in Integrated Mode or in Classic Mode? From what I saw, putting the Impersonate attribute at true should display you a 500 error with the following error message:</p> <blockquote> <p>Internal Server Error. This is HTTP Error 500.19: The requested page cannot be accessed because the related configuration data for the page is invalid.</p> </blockquote> <p>Here is the workaround that is proposed:</p> <blockquote> <p>Workaround:</p> <p>1) If your application does not rely on impersonating the requesting user in the BeginRequest and AuthenticateRequest stages (the only stages where impersonation is not possible in Integrated mode), ignore this error by adding the following to your application’s web.config: </p> <pre><code>&lt;validation validateIntegratedModeConfiguration="false" </code></pre> <p>/></p> <p></p> <p>2) If your application does rely on impersonation in BeginRequest and AuthenticateRequest, or you are not sure, move to classic mode.</p> </blockquote> <p>I hoped that was useful to understand how IIS 7.0 now works.</p>
<p>Interesting... I have the opposite problem - <strong>Not being able</strong> to get the authentication to be passed from the client browser, through the webserver and onto the database within a large corporate network over firewalls.</p> <p>I also feel that "end to end user" authentication to the database is a bad idea and a potential security risk. There is nothing to stop the end user from loading up SQL Query and connecting directly to your database, so you'd better have your schema locked down!</p> <p>@Esteban - Clarified my <em>not very useful in helping you</em> answer.</p>
3,161
<p>When I use Cura with the Pronterface UI it sometime just stops printing.</p> <p>When it stops the printer just stops, the UI looks like it's still printing but nothing is moving in the printer, also, trying to control the printer from the UI does nothing.</p> <p>It always stops early in the printing process, usually during the auto-leveling process or while printing the skirt, the latest it happened was during the first solid layer of a raft.</p> <p>Usually closing the printing window and re-opening it solves the problem but not always, this never happened to me with the basic UI, I couldn't find any settings that makes the problem better or worse, it just happens randomly.</p> <p>Anyone knows how to stop that from happening?</p> <p>My printer is a Robo 3D R1+</p> <p><strong>Update</strong></p> <p>After installing a screen on my printer I discovered Pronterface is sending a "Wait for user" G Code to the printer.</p> <p>Because this changes the question too much and invalidates the existing answer I've asked a new question at <a href="https://3dprinting.stackexchange.com/questions/518/what-makes-pronterface-wait-for-user">What makes Pronterface wait for user?</a></p>
<p>The Monoprice Architect is is a bare-bones FlashForge Creator that has been re-badged for Monoprice. The Creator line is a very popular set of printers, so there is lots of good advice out there. The FlashForge Google Group is a good community to join: <a href="https://groups.google.com/forum/#!forum/flashforge" rel="nofollow">https://groups.google.com/forum/#!forum/flashforge</a></p> <p>The entire FF Creator line, in turn, is cloned from the original Makerbot Replicator 1. So you can use Makerbot slicing profiles for the Replicator 1. Just keep in mind that Makerbot does not generally test new software revs with their older printers, and DEFINITELY does not test new software revs with competitor knock-offs. Sometimes they appear to break functionality for non-Makerbot machines on purpose. So recent versions of Makerbot Desktop may not "play nice" with your FlashForge. <strong>The most recent "known good" free slicer you should use with this printer is Makerware 2.4.x. You can find links by searching the FF Google Group.</strong></p> <p>On that note, you may have received instructions to use ReplicatorG with your printer. But RepG is abandonware: development stopped years ago. It should only be used for firmware updates, not as a slicer. You should also only use the most recent version posted on the Sailfish page on Thingiverse: </p> <p><a href="http://www.thingiverse.com/thing:32084" rel="nofollow">http://www.thingiverse.com/thing:32084</a></p> <p>Using older versions of RepG with newer firmware revs will corrupt your EEPROM! Only use the version downloaded from the link above. </p> <p>The firmware that comes with the printer is FlashForge's slightly-customized build of either Sailfish or Makerbot's Replicator 1/2/2x firmware. But here's the trick: Makerbot's Rep1/2/2x firmware is just an old, out-of-date, slightly customized version of Sailfish. Makerbot stopped keeping up with bug-fixes and feature additions a long time ago. <strong>Everything is Sailfish:</strong> just different versions. You should use the most recent official release version listed at:</p> <p><a href="http://www.sailfishfirmware.com/" rel="nofollow">http://www.sailfishfirmware.com/</a></p> <p>Follow the instructions in the Sailfish manual from the link above, and RepG will automatically pull the right builds from the official mirror and populate a list of printer options to choose. The trick here is which build to download. As of 1-21-16, there is not an official Monoprice Architect build yet. Which would mean editing a machine xml profile to avoid the firmware throwing warnings. I STRONGLY recommend getting used to the printer using factory firmware before trying to fight with custom machine profiles... But here is the basic process to pick a Sailfish firmware build when you're ready:</p> <p>First: which Atmega processor version do you have? The large chip in the middle of the control board will either say 1280 or 2560. You need to know which version you have. Bad things happen if you load the wrong version.</p> <p>Second: What is the tooth count on the X and Y drivetrain pulleys? To my knowledge, FF always uses 17-tooth pulleys, which matches the Replicator 1 and FF Creator profiles. The Rep2 and 2x use 18t pulleys, so only use those builds if you have those pulleys. People often mess this up and their prints end up with dimensions ~5% off in X and Y. </p> <p>Third: The Architect has one extruder and no heatbed, so firmware builds that expect those to be connected (Rep 1 Dual, Creator, etc) will throw errors if loaded. You can fix this from the LCD screen or RepG, but that's a whole separate question. Do some printing and learn about the printer before attempting any firmware update so you'll know what to do if you pick a build with the wrong parts. </p> <p>Fourth: This one is just for the sake of completeness. Some FF models were shipped with off-spec heatbeds that require special firmware builds to prevent drawing too much current and overheating / overloading the power supply. The Architect doesn't have that, but firmware builds for those printer models (eg I believe the FF Creator 2560) will under-power regular heatbeds. This is just something you need to know with the Architect if you decide to install a heatbed later. But it's a really critical safety warning for people with those off-spec heatbeds. </p> <p>If this all seems complicated, that's because FlashForge (and in turn Monoprice) relies heavily on the open source Sailfish project to maintain the software ecosystem behind this line of printers. FlashForge has some internal builds that they use for flashing new bots, but these are not kept particularly up-to-date. Nor does FlashForge release the source files, so it's quite opaque where exactly the stock firmware differs from mainstream Sailfish. In the long run, you should install mainline Sailfish. But it's ok to stick with the factory firmware until you get used to the printer. </p> <p>To summarize: Because there is not an existing Sailfish build, you're going to need to do some investigating and some experimenting to figure out which build will work. Don't try that until you're familiar with the printer. Post on the FlashForge Google Group when you're ready for help.</p>
<p>Since the printer has no heater, I'd advise some sleuthing</p> <ol> <li>Look at the motherboard. Find the big black square chip and see if it is a ATmega 1280 or 2560. Likely it's a 1280, but you never know. This will impact which firmware build you use.</li> <li>If you will eventually add a heater PCB, then figure out the size (wattage) of the power supply. It may be big enough now for a heated platform, or maybe not. I guess you can cross that bridge if/when you add a HBP (heated build platform). However, it can make a difference as to which firmware build you load as some builds of Sailfish will intentionally serialize heating so as to not put too high of a load on the power supply (PSU).</li> </ol> <p>Armed with the above info, you can then decide if you want a 1280 or 2560 build of Sailfish. And if you want a build which will serialize eventual use of an HBP or not.</p> <p>Serialized: MakerBot Replicator 1 Single &amp; Dual (implied ATmega 1280), MakerBot Replicator 1 with ATmega 2560</p> <p>Non-serialized: FlashForge Creator I, II &amp; X (implied ATmega 1280)</p> <p>For a non-serialized, 2560 build know that the FlashForge one is for a poorly behaved heater PCB and you likely won't want it. That sort of leaves you without a good, non-serialized choice. In a pinch you can use the ZYYX 3D build for a 2560. Or you can contact the Sailfish team directly: speaking with very certain knowledge, I can assure you that they'd be happy to do a targetted build for your machine. However, at present they lack info to do so (e.g., build volume, distances from endstops to center of build platform, etc.).</p>
157
<p>I'm trying to figure out how to automatically extract the part after it was printed.</p> <p>One of the ideas is to wait until the bed get cooled enough (let's say to 40-50 °C, usually the part can be just slide of at this bed temperature) and turn on the powerful fan blowing off the part to a tray or something.</p> <p>Is this setup feasible?</p> <p>I'm printing with ABS on an opal glass.</p>
<p>You can do this provided the part releases consistently after cooling. Your filament choice may cause problems, though. ABS is prone to warping and a fan constantly blowing on the part would make it worse. The second thing to consider would be the release agent. I assume you are using gluestick or something similar on the bed. This may be pulled off the bed after a couple prints.</p>
<p>In theory you could knock the item off the build plate and into a bin by positioning the print head behind the part and then pushing.</p> <p>However your build plate would need to have a smooth front edge, so no clips in the way.</p> <p>You'd also want to have some delay to let the bed cool down before attempting this, and have spare belts on hand for the day the installed belt breaks.</p> <p>A fan may work IF you can control it to come on after the part has finished printing, AND your printer will release a finished part given time. Also, your finished part must be strong enough to survive the impact and fall without damage, else what's the point?</p> <p>Also, your effective print volume would shrink - there has to be enough space at the back to drop the print head behind the part using gcode, and then slide the bed backward until the part falls off. You couldn't use the back ~75mm of the bed.</p> <p>Personally I always have to use a scraper and occasionally a light hammer tap, so a fan wouldn't do anything.</p> <hr /> <p>If I were doing this, I'd either pony up and buy one of those Creality belt-fed printers that have a rolling platform, and drop parts off the front. The CR-30 <a href="https://www.creality3dofficial.com/products/cr-30-infinite-z-belt-3d-printer" rel="nofollow noreferrer">https://www.creality3dofficial.com/products/cr-30-infinite-z-belt-3d-printer</a> or other manufacturers would have the same.</p> <p>The other more homebrew option would be to consider where the bed ends up after job is done, and then have some kind of &quot;wiper&quot; mechanism that comes from the side and pushes the part over and off the bed. It would have to be low enough to get any brim and priming lines out of the way too. Since the printer probably can't control this, you'd be looking at an external controller like a computer running a print server, orchestrating the wiper and then starting the next job.</p> <p>You'll also want a really big roll of filament, or a filament-out sensor so you're not printing air.</p>
2,026
<p>I have a CR-10S 500 and want to change a capacitor on it to improve and solve temperature issues. This capacitor that needs to be changed should be labeled as "C4" as mentioned on <a href="https://www.jozerworx.com/creality-cr-10s-c4-capacitor-diy-fix-tutorial/" rel="nofollow noreferrer">this</a> post but it's not present on my motherboard. The goal is to replace 100uF capacitor with 220uF 16V capacitor.</p> <p>This is what the motherboard <strong>should</strong> look like:</p> <p><a href="https://i.stack.imgur.com/AgZyh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AgZyh.jpg" alt="enter image description here"></a></p> <p>but mine looks different. Below is what it looks like:</p> <p><a href="https://i.stack.imgur.com/Aw0Ww.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Aw0Ww.jpg" alt="enter image description here"></a></p> <p>There is no version number on my motherboard and there is no "C4" capacitor. Also, the component that's labeled "330" on the original board is labeled "470" on my motherboard. It's hard to decide which capacitor to change. On my motherboard, there two capacitors instead of one, closer to the location of the capacitor that needs to be replaced. They are labeled "C42" and "C35" instead of "C4". I do not want to replace the wrong one since it's risky enough to replace just one capacitor on these boards.</p> <p>Anyone know my motherboard type or version? Also, which capacitor to change?</p> <p>EDIT:</p> <p>Here is a better or zoomed in section of the place:</p> <p><a href="https://i.stack.imgur.com/896Ft.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/896Ft.jpg" alt="enter image description here"></a></p> <p>As <a href="https://3dprinting.stackexchange.com/questions/7462/which-capacitor-to-change-on-cr-10s-s500-motherboard#comment11920_7462">Trish</a> requested in the comment, below is also the back side of the motherboard.</p> <p><a href="https://i.stack.imgur.com/oj12r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oj12r.jpg" alt="enter image description here"></a></p> <p>theSealion might be right in his answer and I did a test and it all points to "C31" as he suggested but the problem is that the capacitor is different from the one it is supposed to be replaced with like on other CR-10 boards. I am not entirely sure if this is the capacitor since the type of capacitor are different from the one I was suggested to use. Below is the new capacitor:</p> <p><a href="https://i.stack.imgur.com/O4iFm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O4iFm.jpg" alt="enter image description here"></a></p> <p>My current idea is to remove the tiny "C31", solver wire to pin 4 of LM2596 and to the new capacitor but I do not want to remove the "C31" because I don't want anything to go bad. </p> <p>Can I add the new capacitor parallel to the existing "C31" without removing the "C31"?</p>
<p>You are looking for a capacitor that must be connected to Pin 4 of the LM2596.</p> <p>Maybe you could provide a better picture of that area so we could see the different tracks on the board.</p> <p>The LM2596 is in the center of the right side of the board (it is also labeled with LM2596D). The pins should be counted from top to bottom (in your picture)</p> <p>My guess is, the Elko you are looking for is connected to C31, and you must look for the positive pin.</p> <p><a href="https://i.stack.imgur.com/1h1U6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1h1U6.png" alt="LM2596 Wiring"></a></p> <p>In this wiring diagram Cout is the capacitor you are looking for. The SMD Parts R1, R2 and CFF should be R31, R32 and C31 in your picture.</p> <p>With the corresponging measurements I would say you do not need to replace the capacitors. </p> <p>In comparison to the old board your board already has the "fix" implemented. </p>
<h1>You are looking at the wrong board</h1> <p>Your board might on the surface look like a Creality v 2.0 board, and is indeed from the same family of boards. After trying to discern the parts and finally resorting to google image search, I almost had to maniacally laugh:</p> <p>The currently latest version is the <a href="https://www.creality3d.shop/products/mainboard-upgraded-replacement-controller-board-latest-v2-1-version-motherboard-for-creality-cr-10s-s4-s5-3d-printer" rel="nofollow noreferrer">Creality 2.1</a>, but your board clearly is a pre 2.0 board, as the 2.0 and 2.1 are quite similar, almost identical in the areas in question. According to the standard nomenclature, a 2.X board should be a full new engineering or vastly re-engineered board. So I looked up a Creality 1.X board - And indeed, it looks somewhat closer to a CR-10 motherboard in the area around the black capacitor, but that is marked 150/151. So it is <a href="https://www.creality3d.shop/collections/accessories/products/creality-cr-10-motherboard" rel="nofollow noreferrer">not a Creality 1.1.2 / 1.1.3</a>, also known as &quot;CR-10&quot; board.</p> <p>My best guess (Confirmed by OP and <a href="https://www.th3dstudio.com/knowledge-base/creality-cr-10-and-cr-10s-models-what-printer-do-you-have/" rel="nofollow noreferrer">this</a>) is, that your board is an intermediate step between the Creality 1.1.x Board for the CR-10 and the <em>new</em> CR-10S 2.0/2.1, so by nomenclature a <em>proto-2.0</em>. Among Makers, it is called &quot;original CR-10S&quot; at times. Your numbers should thus be read from this board:</p> <p><a href="https://i.stack.imgur.com/Zgh0z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zgh0z.jpg" alt="Original CR10S Board" /></a></p> <p>There is a 100/35V/UT Capacity in the indicated spot in both the green and black renditions.</p>
1,098
<p>Let's say I have a parent DIV. Inside, there are three child DIVs: header, content and footer. Header is attached to the top of the parent and fills it horizontally. Footer is attached to the bottom of the parent and fills it horizontally too. Content is supposed to fill all the space between header and footer.</p> <p>The parent has to have a fixed width and height. The content DIV has to fill all available space between header and footer. When the content size of the content DIV exceeds the space between header and footer, <strong><em>the content DIV should display scrollbars and allow appropriate scrolling</em></strong> so that the footer contents should never be obscured nor the footer obscure content.</p> <p>Now comes the hard part: <strong><em>you don't know the height of the header nor footer beforehand</em></strong> (eg. header and footer are filled dynamically). How can content be positioned <strong><em>without using JavaScript</em></strong>?</p> <p>Example:</p> <pre><code>&lt;div style="position : relative; width : 200px; height : 200px; background-color : #e0e0ff; overflow : hidden;"&gt; &lt;div style="background-color: #80ff80; position : absolute; left : 0; right : 0; top : 0;"&gt; header &lt;/div&gt; &lt;div style="background-color: #8080ff; overflow : auto; position : absolute;"&gt; content (how to position it?) &lt;/div&gt; &lt;div style="background-color: #ff8080; position : absolute; bottom : 0px; left :0; right : 0;"&gt; footer &lt;/div&gt; &lt;/div&gt; </code></pre> <hr> <p><strong>To clarify this event further</strong> - the target layout that I'm trying to achieve will be used in a business web application. <strong><em>The parent DIV will have a fixed, but unknown size</em></strong> (for instance, it will be exactly the size of the browser viewport, sizing itself along with sizing the browser window by the user). Let's call the parent DIV a "screen".</p> <p>The header will contain a set of filtering controls (like textboxes, drop down lists and a "filter" button) that should wrap to the next line if there is insufficient horizontal space (so its height can change any time to accomodate line breaking). <strong><em>The header should always be visible and attached to the top</em></strong> of the "screen".</p> <p>The footer will contain a set of buttons, like on a dialog window. These too can wrap to next line if there is not enough space horizontally. <strong><em>The footer must be attached to the bottom</em></strong> of the "screen" to be accessible and visible at all times.</p> <p>The content will contain "screen" contents, like dialog fields etc. If there are too few fields, the rest of the content will be "blank" (in this case the footer should not begin right after the content, but still be attached to the bottom of the "screen" which is fixed size). If there are too many fields, <strong><em>the content DIV will provide scrollbar(s)</em></strong> to access the hidden controls (in this case the content DIV must not extend itself below the footer, as the scrollbar would be partially hidden). </p> <p>I hope this clarifies the question a little bit further, as I have too low rep to enter comments to your repsonses.</p>
<p>I'm going to get downmodded for this, but this sounds like a job for a table.</p> <p>What you're trying to do is to set the total height of three contiguous divs as a unit, and a 1x3 table with height 100% is actually a cleaner solution.</p>
<p>Absolute positioning is messing you up. Try something like this:</p> <p>HTML:</p> <pre><code>&lt;div id="wrapper"&gt; &lt;div id="header"&gt; header &lt;/div&gt; &lt;div id="content"&gt; content &lt;/div&gt; &lt;div id="footer"&gt; footer &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre class="lang-css prettyprint-override"><code>#wrapper { width: 200px; height: 200px; overflow: visible; background: #e0e0ff; } #header { background: #80ff80; } #content { background: #8080ff; } #footer { background: #ff8080; } </code></pre> <p>edit: perhaps I misunderstood, do you want everything to fit into the 200x200px box or do you want the box to increase its height to fit the content?</p>
8,128
<p>I'm building a 3d printer of size 500 x 500 x 500 build area. For the Z axis, I'm planning to use this <a href="https://www.3dprintronics.com/Linear-Actuator-Ball-Screw-1204-p108536003" rel="nofollow noreferrer">Linear actuator</a>. </p> <p>The maximum weight Z axis might encounter is 15 Kg due to it being a clay printer. A single linear actuator can, according to the specs, lift 10 Kg. So I'm planning to use two of this.</p> <p>My question is a ball screw of pitch 4mm or 5mm, will it be able to Maintain it's position when the motor is de-energized under a load of 15 kg shared by two systems.</p> <p>What effect the diameter of rod has on it??</p> <p>Is there any way to find that??</p>
<blockquote> <p>My question is a ball screw of pitch 4mm or 5mm, will it be able to Maintain it's position when motor is deenergized under a load of 15 kg shared by two systems.</p> </blockquote> <p>The detent torque of a <a href="https://motion.schneider-electric.com/downloads/quickreference/NEMA23.pdf" rel="noreferrer">typical NEMA 23 stepper</a> varies between around 3 and 7 N·cm. This is the torque produced when the windings are not energized.</p> <p>Using this <a href="https://www.daycounter.com/Calculators/Lead-Screw-Force-Torque-Calculator.phtml" rel="noreferrer">leadscrew torque calculator</a>, you can find that the torque required for a 12 mm diameter, 4 mm pitch leadscrew to hold up a 75 N load, is around 5 N·cm - assuming there is no friction. If there is friction, then the required torque will be lower.</p> <p>So, the torque required is almost equal to or possibly even higher than the detent torque. Therefore, you should not count on a de-energized motor holding up the build platform. In practice, you might see that friction is enough to hold up the build platform, but that any disturbance (such as somebody bumping into the printer) is enough to get the leadscrews to start spinning and have the platform drop like a rock.</p> <blockquote> <p>What effect the diameter of rod has on it?</p> </blockquote> <p>Increasing the pitch also increases the torque required (so, go with a lower pitch leadscrew). The diameter does not affect the torque directly, but having a larger diameter increases the friction and so is beneficial.</p>
<p>Adding to the other more scientific answers here. The backdriving force will move the lead screws depending on the stiction between the lead screw and the nut. If it was friction less then it will always slide. Basically you need to keep the lead screw from turning while the machine is off. You can make a basic electromagnetic clutch which will add some resistance to turning by using double pole double throw relays to short the motor leads to ground when the power is off. You can test this yourself by just connecting all the lead wires together and then try turning the motor spindle by hand.</p> <p><a href="https://i.stack.imgur.com/Rycew.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rycew.gif" alt="Concept of an electromagnetic brake"></a></p> <p><a href="https://en.wikipedia.org/wiki/Electromagnetic_brake" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Electromagnetic_brake</a></p>
1,043
<p>Story: The user uploads an image that will be added to a photo gallery. As part of the upload process, we need to A) store the image on the web server's hard drive and B) store a thumbnail of the image on the web server's hard drive.</p> <p>"Best" here is defined as </p> <ul> <li>Relatively easy to implement, understand, and maintain</li> <li>Results in a thumbnail of reasonable quality</li> </ul> <p>Performance and high-quality thumbnails are secondary.</p>
<p>I suppose your best solution would be using the <a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx" rel="noreferrer">GetThumbnailImage </a> from the .NET <a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx" rel="noreferrer">Image</a> class.</p> <pre><code>// Example in C#, should be quite alike in ASP.NET // Assuming filename as the uploaded file using ( Image bigImage = new Bitmap( filename ) ) { // Algorithm simplified for purpose of example. int height = bigImage.Height / 10; int width = bigImage.Width / 10; // Now create a thumbnail using ( Image smallImage = image.GetThumbnailImage( width, height, new Image.GetThumbnailImageAbort(Abort), IntPtr.Zero) ) { smallImage.Save("thumbnail.jpg", ImageFormat.Jpeg); } } </code></pre>
<p>You can use the Image.GetThumbnailImage function to do it for you.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx</a> (.NET 3.5)</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage(VS.80).aspx</a> (.NET 2.0)</p> <pre><code>public bool ThumbnailCallback() { return false; } public void Example_GetThumb(PaintEventArgs e) { Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); Bitmap myBitmap = new Bitmap("Climber.jpg"); Image myThumbnail = myBitmap.GetThumbnailImage(40, 40, myCallback, IntPtr.Zero); e.Graphics.DrawImage(myThumbnail, 150, 75); } </code></pre>
4,759
<p>Our team develops distributed winform apps. We use ClickOnce for deployment and are very pleased with it.</p> <p>However, we've found the pain point with ClickOnce is in <em>creating</em> the deployments. We have the standard dev/test/production environments and need to be able to create deployments for each of these that install and update separate from one another. Also, we want control over what assemblies get deployed. Just because an assembly was compiled doesn't mean we want it deployed.</p> <p>The obvious first choice for creating deployments is Visual Studio. However, VS really doesn't address the issues stated. The next in line is the SDK tool, Mage. Mage works OK but creating deployments is rather tedious and we don't want every developer having our code signing certificate and password.</p> <p>What we ended up doing was rolling our own deployment app that uses the command line version of Mage to create the ClickOnce manifest files.</p> <p>I'm satisfied with our current solution but is seems like there would be an industry-wide, accepted approach to this problem. Is there?</p>
<p>I would look at using <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="noreferrer">msbuild</a>. It has built in <a href="http://msdn.microsoft.com/en-us/library/6wc2ccdc.aspx" rel="noreferrer">tasks</a> for handling clickonce deployments. I included some references which will help you get started, if you want to go down this path. It is what I use and I have found it to fit my needs. With a good build process using msbuild, you should be able to accomplish squashing the pains you have felt.</p> <p>Here is <a href="http://windowsclient.net/Articles/ClickOnce_MsBuild.aspx" rel="noreferrer">detailed post</a> on how ClickOnce manifest generation works with MsBuild.</p>
<p>I've used nAnt to run the overall build strategy, but pass parameters into MSBuild to compile and create the deployment package.</p> <p>Basically, nAnt calls into MSBuild for each environment you need to deploy to, and generates a separate deployment output for each. You end up with a folder and all ClickOnce files you need for every environment, which you can just copy out to the server.</p> <p>This is how we handled multiple production environments as well -- we had separate instances of our application for the US, Canada, and Europe, so each build would end up creating nine deployments, three each for dev, qa, and prod.</p>
4,105
<p>Has anybody come up with a better technique for managing tags and branches in subversion than what is generally recommended (the parallel directories called 'tags' and 'branches')?</p>
<p>Using the repository namespace to convey information like branches / tags / etc is fundamentally the SVN model; if what you want is a different model, you probably really want something other than SVN.</p> <p>The lack of metadata like CVS-style labels in SVN is an intentional design decision. No matter what arrangement of branches/tags/projects you choose in your tree, it's all going to reduce to sets of parallel directories for each purpose. What's left is just choosing the right naming strategy for your branches and tags to make things more clear to you.</p> <p>One convention that I'm fond of is a separation between full heavyweight branches and lightweight "twigs". The convention in the group where I work is that long-lived development goes in a branch, and the release engineers must know of and be partially responsible for each branch, but that any engineer can create a short-lived twig to use as scratch space for a problem that's too large to fit into one checkin but not massive enough to require release engineering support. Twigs here live in a separate parallel 'twigs' directory similar to branches, and the naming convention often has the creator's user ID and the bug ID number for the issue the twig is intended to address in it.</p>
<p>The only other thing you can do besides having parallel directories when you have Branches is to do an SVN Switch between two branches whenever you want to work on one or the other. Perhaps you should clarify what you want to be "better" about this system and people could make suggestions.</p>
9,212
<p>I've had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone searches "new" or "london" I want the list of prefix matches ordered by population, and I have that working with a prefix search and an sort by field reversed, where there is a population field, IE New Mexico, New York; or London, Londonderry.</p> <p>However I also always want the exact matching name to be at the top. So in the case of "London" the list should show "London, London, Londonderry" where the first London is in the UK and the second London is in Connecticut, even if Londonderry has a higher population than London CT.</p> <p>Does anyone have a single query solution?</p>
<p>dlamblin,let me see if I get this correctly: You want to make a prefix-based query, and then sort the results by population, and maybe combine the sort order with preference for exact matches. I suggest you separate the search from the sort and use a CustomSorter for the sorting: Here's <a href="http://blog.tremend.ro/2007/05/17/a-z-0-9-custom-sorting-in-lucene/" rel="nofollow noreferrer">a blog entry describing a custom sorter</a>. <a href="https://rads.stackoverflow.com/amzn/click/com/1932394281" rel="nofollow noreferrer" rel="nofollow noreferrer">The classic Lucene book</a> describes this well.</p>
<p>My current solution is to create an exact searcher and a prefix searcher, both sorted by reverse population, and then copy out all my hits starting from the exact hits, moving to the prefix hits. It makes paging my results slightly more annoying than I think it should be.</p> <p>Also I used a hash to eliminate duplicates but later changed the prefix searcher into a boolean query of a prefix search (MUST) with an exact search (MUST NOT), to have Lucene remove the duplicates. Though this seemed even more wasteful.</p> <p><em>Edit</em>: Moved to a comment (since the feature now exists): <a href="https://stackoverflow.com/users/1702/yuval-f">Yuval F</a> Thank you for your blog post ... How would the sort comparator know that the name field "london" exactly matches the search term "london" if it cannot access the search term?</p>
2,996
<p>Is there a simple method of parsing XML files in C#? If so, what?</p>
<p>I'd use <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml" rel="noreferrer">LINQ to XML</a> if you're in .NET 3.5 or higher.</p>
<p>You can use <a href="https://github.com/wojtpl2/ExtendedXmlSerializer" rel="nofollow noreferrer">ExtendedXmlSerializer</a> to serialize and deserialize.</p> <p><strong>Instalation</strong> You can install ExtendedXmlSerializer from <a href="https://www.nuget.org/packages/ExtendedXmlSerializer/" rel="nofollow noreferrer">nuget</a> or run the following command:</p> <pre><code>Install-Package ExtendedXmlSerializer </code></pre> <p><strong>Serialization:</strong></p> <pre><code>ExtendedXmlSerializer serializer = new ExtendedXmlSerializer(); var obj = new Message(); var xml = serializer.Serialize(obj); </code></pre> <p><strong>Deserialization</strong></p> <pre><code>var obj2 = serializer.Deserialize&lt;Message&gt;(xml); </code></pre> <p><strong>Standard XML Serializer in .NET is very limited.</strong></p> <ul> <li>Does not support serialization of class with circular reference or class with interface property,</li> <li>Does not support Dictionaries,</li> <li>There is no mechanism for reading the old version of XML,</li> <li>If you want create custom serializer, your class must inherit from IXmlSerializable. This means that your class will not be a POCO class,</li> <li>Does not support IoC.</li> </ul> <p><strong>ExtendedXmlSerializer can do this and much more.</strong></p> <p>ExtendedXmlSerializer support <strong>.NET 4.5</strong> or higher and <strong>.NET Core</strong>. You can integrate it with WebApi and AspCore. </p>
7,964
<p>I have seen many people saying on this site and many other 3D printing websites that 24 V systems are safer, compared to 12 V systems. By safer, I am talking in terms of fires or other electrical and component failures. </p> <p>Why would a 24 V system cause less danger? I would think that 12 V would be safer because it is very common (automotive) and many parts have been around for a while that use it. Although there are an increasingly amount of boards that support 24 V, many don't or need fuses or other parts that do support 24 V. </p> <p>Also, many parts that I have used are rated for 12 - 24 V. A 12 V power supply can go a bit over fairly comfortably. A 24 V power supply can't without partially going over the rating.</p> <p>If I had to build a printer designed with safety as a main priority, what voltage would be best?</p>
<p>The most important "safety" advantage when using 24V (compared to 12V) is that to get the same power, you only need half the current. A 192W heated bed would need 16A at 12V, but only 8A at 24V.</p> <p>Since one of the most common safety issues is underrated screw terminals being used for the heated bed (just search for "3d printer fire"; you'll find quite a few pictures of charred plastic around screw terminals). For example, the screw terminals on RAMPs board are only rated for up to 12A. That would be okay at 24V, but well over the limit at 12V.</p> <p>Since the wire gauge is dependent on current, you can also use somewhat thinner wires with a 24V system (or equivalently: wires that would melt in a 12V setup won't in a 24V setup). The power dissipated in a wire scales quadratically with current, so the same wire being used in a 24V setup would only waste a quarter of the heat of that wire in a 12V setup. There is also less strain on switching devices (such as MOSFETs or relays). The same applies here: power loss is quadratic with current.</p>
<p>From a pure safety standpoint there is nothing about a 24v system that is distrinctly more safe than a 12v system. I see you added comments about something involving wire sizes. This is not really a factor.. I would say not knowing what wire size to use is a whole other issue. There is nothing stopping you from putting on larger wires. </p> <p>The following websites verify the fact that a 24v needs smaller wires. Though again the system it self is not safer because the wires required are smaller.</p> <ul> <li><a href="https://www.jamestowndistributors.com/userportal/document.do?docId=1098" rel="nofollow noreferrer">JamesTown</a></li> <li><a href="http://sdcsecurity.com/docs/PDFs/wiregaugecharts_ohmslaw.pdf" rel="nofollow noreferrer">SDC minimum wire gauge to distance chart</a></li> </ul> <p>I will also note the size difference is negligible anyways. It is not a major difference. </p> <p>Now one exception to this. If you had a 24v and a 12v compatible board. I would pick a 24v. The reason is not that the wire sizes needed are different. But for the reduced danger of the CONNECTOR that the wires attach to. I see quite often in the flashforge owner group boards that have caught fire due to a cheap connector that can not handle the load for the printer.</p>
503
<p>I am working on a winforms application using LINQ to SQL - and am building the app using a SQL Express instance on my workstation. The final installation of the project will be on a proper SQL Server 2005. </p> <p>The database has the same name, and all tables are identical but the hostname is different. </p> <p>The only way I have found to make my app work from one machine to the next is to re-open the code in Visual Studio, delete all of the objects referring to the SQL express instance from my .mdbl, save the project, connect to the other server, drag all of the references back on, and rebuild the application for release once more.</p> <p>an answer here suggested that one can simply modify the app.config/web.config file - whih would work for asp.net, but this is a winforms application. What's the correct way of making LINQ to SQL apps use a new database without having to re-open the app in visual studio?</p>
<p>If I understand your problem correctly, you simply change the database's connection string in your app.config / web.config.</p> <p><strong>Edit</strong>, post clarification: You have the connection strings stored somewhere. They might be in the app.config of your server. Still, you get them from somewhere and that somewhere may be in an app.config. Use that then :)</p>
<p>I believe you can store the connection information in an app.config file and retrieve it from there. <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3716857&amp;SiteID=1" rel="nofollow noreferrer">Here</a> is a post about doing that with LINQ to SQL. Once you deploy it to a production server, you can just edit the XML to change the data source.</p>
7,175
<p>I have an application that reads a table from a database. </p> <p>I issue an SQL query to get a result set, based on a unique string value I glean from the results, I use a case/switch statement to generate certain objects (they inherit TreeNode BTW). These created objects get shunted into a Dictionary object to be used later.</p> <p>Whilst generating these objects I use some of the values from the result set to populate values in the object via the setters.</p> <p>I query the Dictionary to return a particular object type and use it to populate a treeview. However it is not possible to populate 2 objects of the same type in a treeview from the Dictionary object (you get a runtime error - which escapes me at the moment, something to with referencing the same object). So what I have to do is use a memberwiseClone and implement IClonable to get around this. </p> <p>Am I doing this right? Is there a better way - because I think this is causing my program to be real slow at this point. At the very least I think its a bit clunky - any advice from people who know more than me - greatly appreciated.</p>
<p>Is there a reason you are using the external dictionary? I would populate the tree directly as the data is queried.</p> <p>If you do require the dictionary, you could set the .Tag property of the tree node to point to the data in your dictionary.</p>
<p>have you considered using a Virtual Tree view which only loads the nodes the user actually wants to look at - i've had good success with the component from www.infralution.com </p>
8,010
<p>Is there any visible progress? Is it now just an academic exercise? Do you believe Perl will continue to evolve with or without Perl 6 or will soon be forgotten?</p>
<p>At the risk of sounding like a Perl fanboy, I'm still excited about Perl 6 and feel like the end result will be relevant when it's released. The last nine months have yielded some nice accomplishments on the Parrot front () and have even resulted in some <a href="http://news.perlfoundation.org/2008/05/tpf_receives_large_donation_in.html" rel="nofollow noreferrer">sizable donations</a> to help fund increased development.</p> <p>From <a href="http://www.rakudo.org/2008/09/final-report-for-mozilla-found.html" rel="nofollow noreferrer">a recent blog post</a>:</p> <blockquote> <p>Rakudo currently supports arrays, hashes, classes, objects, inheritance, roles, numeration types, subset types, role composition, multimethod dispatch, type checking, basic I/O, named regular expressions, grammars, optional parameters, named parameters, slurpy parameters, closures, smart match, junctions, and many other features expected from Perl 6.</p> </blockquote> <p>Keep your eye on <a href="http://rakudo.org/" rel="nofollow noreferrer">Rakudo.org</a> (Rakudo is the name of the Perl 6 implementation built on top of Parrot) for news on the ongoing development process of Perl 6.</p>
<p>It'll be out by Christmas. ;-) I've heard on podcasts that there there will be some kind of alpha before this Christmas. They were explicit about that but it has been a while since I heard that.</p>
9,181
<p>Octoprint warns me that the objects do not fit into the print volume. I noticed that this happens after a power-off cycle. Since I was overly anxious until today, I always uploaded the GCode file again and it didn't complain any more.</p> <p>Of course, always uploading the files again is also error prone. So today I gave it a try and simply started to print the object. As far as I can tell, it prints nicely.</p> <blockquote> <p>Image: Octoprint saying something like "Object does not fit into print volume" in German</p> </blockquote> <p><a href="https://i.stack.imgur.com/5NiFh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5NiFh.png" alt="Object does not fit into print volume"></a></p> <p><strong>Is this a known bug in OctoPrint? Are my files really damaged after a power off cycle?</strong></p> <p>The values (0.00, -3.00, 0.00) seem to be constant in this error message, no matter what object I want to print.</p> <p>I'm using OctoPrint in the PrusaPrint flavor and I'm running version 1.3.10 (hopefully a recent version, since I usually update). I generate the G-Code with Slic3r.</p>
<p>That's the purging that Slic3r PE adds, the broad line of filament at the edge of the sheet. That is outside the official print volume, which triggers this error.</p> <p>The G-Code generated by Slic3r PE at the start of the file contains the following lines:</p> <pre><code>G1 Y-3.0 F1000.0 ; go outside print area G92 E0.0 G1 X60.0 E9.0 F1000.0 ; intro line M73 Q0 S174 M73 P0 R173 G1 X100.0 E12.5 F1000.0 ; intro line G92 E0.0 </code></pre> <p>You can see that it explicitly goes to -3 on the Y axis, and then extrudes two times on a line along the X axis.</p> <p>The model size detection is labeled as beta in the settings dialog. It's not very reliable at detecting stuff like this purging line outside the boundaries.</p>
<p><a href="/a/8267">This answer</a> is correct, it's normal for Prusa printers to purge at -3&nbsp;mm on the Y axis.</p> <p>This answer is an addition that describes how to get rid of the error.</p> <ol> <li>Open Octoprint web UI</li> <li>Go to <code>Settings</code> -> <code>Printer Profiles</code></li> <li>Find active profile, click on the pen icon next to it (<code>Edit Profile</code>)</li> <li>Go to <code>Print bed and build volume</code></li> <li>Tick <code>Custom bounding box</code></li> <li>Enter -3 to <code>Y Coordinates</code> <code>Min</code> input box</li> <li>Hit <code>Confirm</code></li> </ol>
1,222
<p>I homebuilt a delta 3D printer (like Kossel mini) with a Z probe near the hotend with manual deploy and RAMPS 1.4 board:</p> <ul> <li>I configured the Repetier firmware with the online tool;</li> <li>All my endstops (included the Z probe endstop) work in reverse mode, so I reversed the endstops triggering option;</li> <li>I enabled <em>Z-probing</em> and set the <code>BED_LEVELING_METHOD</code> to 1 (n*n grid);</li> <li>I set <code>Z_PROBE_REPETITIONS</code> to 3, and;</li> <li>Finally I downloaded it and uploaded to my Mega 2560.</li> </ul> <p>Then I tested it inside Repetier-Host and all seems to work well (homing, moving, extruding) except for the Autobed leveling method.</p> <p>Specifically, it always starts measurement of <strong>3 Points</strong> (with 3 probe repetition each) even if I change the type of measurement. It never does a <strong>grid measurement</strong> or a <strong>2 points mirror</strong> measurement.</p> <p>I also tried to re-upload the firmware with <code>EEPROM_MODE</code> to 0 but didn't work.</p> <p>Does anyone have the same issue, or can explain to me why this happens?</p>
<p>As a guess, you are using the wrong command. If set for n x n grid, you get 3 point measurement with G29, but that is not auto leveling, it is just setting Z height - based on average height at 3 points.</p> <p>What you need is <code>G32 S2</code> with <code>S2</code> to store result in EEPROM (and therefore you should have EEPROM enabled with auto leveling. It is also used to store endstop offsets).</p>
<p>Delta bed leveling has been dodgy in Repetier for a long time. There are a number of fixes occurring in the dev branch right now (June 2016) if you look at Github. So it's getting better, but I wouldn't call it mature yet. (Delta auto-calibration is one of the only big shortcomings of Repetier, in my opinion.)</p> <p>The problem with approaches like bed plane compensation and grid/mesh leveling for Deltas is that they don't fix print geometry errors caused by imprecise printer construction. They just help get the first layer down. What I would recommend is to use one of the non-Repetier delta auto-calibration techniques available in order to get your firmware settings correct, and then you won't need to use "slap a bandaid on a calibration problem" solutions like grid leveling. Two popular options:</p> <ul> <li><strong>Load Rich Cattell's Marlin branch</strong>, perform auto-calibration, record the adjusted values, and then load those parameters into Repetier. This will usually work well enough that you don't need to attempt any kind of auto-leveling in Repetier. (I don't recommend actually printing with Marlin on a Delta due to lack of performance optimization. Repetier can print much, much faster while managing more features like LCDs. Marlin gets bogged down doing all the Delta kinematics math unless you print very slow.)</li> <li><strong>Use David Crocker's awesome <a href="http://escher3d.com/pages/wizards/wizarddelta.php" rel="nofollow">online delta calibration tool</a>.</strong> I'd recommend using six-factor calibration with 10 probe points. This is the manual version of the auto-calibration technique built into dc42 RepRapFirmware, and it's practically magical compared to the routines built into Repetier. </li> </ul> <p>Sidenote: Grid leveling can be a very useful technique for large printers where bed flatness is difficult to achieve. It's just very limited as a way to deal with delta calibration problems. </p>
335
<p>I have a nullable property, and I want to return a null value. How do I do that in VB.NET ?</p> <p>Currently I use this solution, but I think there might be a better way.</p> <pre><code> Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer) Get If Current.Request.QueryString("rid") &lt;&gt; "" Then Return CInt(Current.Request.QueryString("rid")) Else Return (New Nullable(Of Integer)).Value End If End Get End Property </code></pre>
<p>Are you looking for the keyword "Nothing"?</p>
<p>Or this is the way i use, to be honest ReSharper has taught me :)</p> <pre><code>finder.Advisor = ucEstateFinder.Advisor == "-1" ? (long?)null : long.Parse(ucEstateFinder.Advisor); </code></pre> <p>On the assigning above if i directly assign null to finder.Advisor*(long?)* there would be no problem. But if i try to use if clause i need to cast it like that <code>(long?)null</code>.</p>
9,804
<p>A little backstory to help you understand the situation. I put the 3D printer together and turned it on and everything seemed fine until I started printing. It didn't even get the first layer down when the screen reset and so did the print. I didn't think anything of it, I just went back and tried again, but this time right when I pressed start, the fuse blew. </p> <p>I have done some research on the issue and haven't had any luck besides recommendations for putting in a secondary fuse before the power supply (which I will be doing in the near future). As for now though, my plan is to just replace the power supply fuse if possible. I went to the hardware store and picked up a Bussmann T5AL/250V fuse (photo attached below) and before I put it in, I just want to make sure this is the correct fuse and I'm not going to kill the entire printer this time. </p> <p><em>Picture showing the internals of the power supply unit:</em></p> <p><a href="https://i.stack.imgur.com/fYGTI.jpg" rel="nofollow noreferrer" title="PSU, cover removed showing fuse"><img src="https://i.stack.imgur.com/fYGTI.jpg" alt="PSU, cover removed showing fuse" title="PSU, cover removed showing fuse"></a></p> <p><em>Picture of the fuse I bought:</em></p> <p><a href="https://i.stack.imgur.com/QU6dU.jpg" rel="nofollow noreferrer" title="Picture of the fuse I bought"><img src="https://i.stack.imgur.com/QU6dU.jpg" alt="Picture of the fuse I bought" title="Picture of the fuse I bought"></a></p> <p>Any and all help is very much appreciated because as you might expect, I'm not too happy with the printer so far.</p>
<p>The fuse rating is same as described on the board - so that shall be no issue with it.</p> <p><strong>My main concern is why the fuse is down?</strong></p> <p>Was there a short-circuit? As this is mains fuse - that suggest a big-bang, so, please check carefully hot-end and bed heater connections before restarting the device, to avoid replacing another fuse.</p>
<p>To add to the answer of <em>@profesor79</em> (which you <strong>absolutely need to address first</strong> (find the cause why it blew); else the fuse might blow again), you might be interested in installing fuse clamps. As <em>@fred_dot_u</em> mentions:</p> <blockquote> <p>use caution when soldering leads to the fuse that you do not de-solder the internal fuse from the caps</p> </blockquote> <p>is that if you incorrectly solder the fuse, you might de-solder the caps, soldering the clamps is easier.</p> <p><em>Example of fuse clamp:</em><br> <a href="https://i.stack.imgur.com/HwRFQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HwRFQ.jpg" alt="5 mm fuse clamp"></a></p>
947
<p>I've seen binary trees and binary searching mentioned in several books I've read lately, but as I'm still at the beginning of my studies in Computer Science, I've yet to take a class that's really dealt with algorithms and data structures in a serious way.</p> <p>I've checked around the typical sources (Wikipedia, Google) and most descriptions of the usefulness and implementation of (in particular) Red-Black trees have come off as dense and difficult to understand. I'm sure for someone with the necessary background, it makes perfect sense, but at the moment it reads like a foreign language almost.</p> <p>So what makes binary trees useful in some of the common tasks you find yourself doing while programming? Beyond that, which trees do you prefer to use (please include a sample implementation) and why?</p>
<p>Red Black trees are good for creating well-balanced trees. The major problem with binary search trees is that you can make them unbalanced very easily. Imagine your first number is a 15. Then all the numbers after that are increasingly smaller than 15. You'll have a tree that is very heavy on the left side and has nothing on the right side.</p> <p>Red Black trees solve that by forcing your tree to be balanced whenever you insert or delete. It accomplishes this through a series of rotations between ancestor nodes and child nodes. The algorithm is actually pretty straightforward, although it is a bit long. I'd suggest picking up the CLRS (Cormen, Lieserson, Rivest and Stein) textbook, "Introduction to Algorithms" and reading up on RB Trees. </p> <p>The implementation is also not really so short so it's probably not really best to include it here. Nevertheless, trees are used <em>extensively</em> for high performance apps that need access to lots of data. They provide a very efficient way of finding nodes, with a relatively small overhead of insertion/deletion. Again, I'd suggest looking at CLRS to read up on how they're used.</p> <p>While BSTs may not be used explicitly - one example of the use of trees in general are in almost every single modern RDBMS. Similarly, your file system is almost certainly represented as some sort of tree structure, and files are likewise indexed that way. Trees power Google. Trees power just about every website on the internet.</p>
<p>If you would like to see how a Red-Black tree is supposed to look graphically, I have coded an implementation of a Red-Black tree that you can <a href="http://brockwoolf.com/redblacktree" rel="nofollow noreferrer">download here</a></p>
4,107
<p>I'm looking at developing a device which will need to support Ethernet over USB (hosted in Linux, XP, and Vista). As I understand it, Vista and Linux support the industry standard USB CDC. However, in classic Windows style, XP only supports it's own Remote NDIS. So, now I'm thinking of just bowing down and doing it over RNDIS, as opposed to rolling my own CDC driver for XP.</p> <p>I've been reading some older documentation that says even XP is pretty buggy with NDIS (suprise!). Does anyone have experience with XP's RNDIS drivers? Are they safe for product development? Any insight would be much appreciated.</p>
<p>The filesystem backend is only worth looking at if you're not going to use a database for any other part of your system. If you are using a database then the filesystem backend has nothing to recommend it.</p> <p>The memcache backend is much quicker than the database backend, but you run the risk of a session being purged and some of your session data being lost.</p> <p>If you're a really, really high traffic website and code carefully so you can cope with losing a session then use memcache. If you're not using a database use the file system cache, but the default database backend is the best, safest and simplest option in almost all cases.</p>
<p>If the database have a DBA that isn't you, you may not be allowed to use a database-backed session (it being a front-end matter only). Until django supports easily merging data from several databases, so that you can have frontend-specific stuff like sessions and user-messages (the messages in django.contrib.auth are also stored in the db) in a separate db, you need to keep this in mind.</p>
7,338
<p>I'd like to to associate a file extension to the current executable in C#. This way when the user clicks on the file afterwards in explorer, it'll run my executable with the given file as the first argument. Ideally it'd also set the icon for the given file extensions to the icon for my executable. Thanks all.</p>
<p>There doesn't appear to be a .Net API for directly managing file associations but you can use the Registry classes for reading and writing the keys you need to.</p> <p>You'll need to create a key under HKEY_CLASSES_ROOT with the name set to your file extension (eg: ".txt"). Set the default value of this key to a unique name for your file type, such as "Acme.TextFile". Then create another key under HKEY_CLASSES_ROOT with the name set to "Acme.TextFile". Add a subkey called "DefaultIcon" and set the default value of the key to the file containing the icon you wish to use for this file type. Add another sibling called "shell". Under the "shell" key, add a key for each action you wish to have available via the Explorer context menu, setting the default value for each key to the path to your executable followed by a space and "%1" to represent the path to the file selected.</p> <p>For instance, here's a sample registry file to create an association between .txt files and EmEditor:</p> <pre> Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.txt] @="emeditor.txt" [HKEY_CLASSES_ROOT\emeditor.txt] @="Text Document" [HKEY_CLASSES_ROOT\emeditor.txt\DefaultIcon] @="%SystemRoot%\\SysWow64\\imageres.dll,-102" [HKEY_CLASSES_ROOT\emeditor.txt\shell] [HKEY_CLASSES_ROOT\emeditor.txt\shell\open] [HKEY_CLASSES_ROOT\emeditor.txt\shell\open\command] @="\"C:\\Program Files\\EmEditor\\EMEDITOR.EXE\" \"%1\"" [HKEY_CLASSES_ROOT\emeditor.txt\shell\print] [HKEY_CLASSES_ROOT\emeditor.txt\shell\print\command] @="\"C:\\Program Files\\EmEditor\\EMEDITOR.EXE\" /p \"%1\"" </pre>
<p>There are two cmd tools that have been around since Windows 7 which make it very easy to create simple file associations. They are <a href="https://technet.microsoft.com/en-us/library/cc770920(v=ws.11).aspx" rel="nofollow noreferrer">assoc</a> and <a href="https://technet.microsoft.com/en-us/library/cc771394(v=ws.11).aspx" rel="nofollow noreferrer">ftype</a>. Here's a basic explanation of each command.</p> <ul> <li><a href="https://technet.microsoft.com/en-us/library/cc770920(v=ws.11).aspx" rel="nofollow noreferrer">Assoc</a> - associates a file extension (like '.txt') with a "file type."</li> <li><a href="https://technet.microsoft.com/en-us/library/cc771394(v=ws.11).aspx" rel="nofollow noreferrer">FType</a> - defines an executable to run when the user opens a given "file type."</li> </ul> <p>Note that these are cmd tools and not executable files (exe). This means that they can only be run in a cmd window, or by using ShellExecute with "cmd /c assoc." You can learn more about them at the links or by typing "assoc /?" and "ftype /?" at a cmd prompt. </p> <p>So to associate an application with a .bob extension, you could open a cmd window (WindowKey+R, type cmd, press enter) and run the following:</p> <pre><code>assoc .bob=BobFile ftype BobFile=c:\temp\BobView.exe "%1" </code></pre> <p>This is much simpler than messing with the registry and it is more likely to work in future windows version. </p> <p>Wrapping it up, here is a C# function to create a file association:</p> <pre><code>public static int setFileAssociation(string[] extensions, string fileType, string openCommandString) { int v = execute("cmd", "/c ftype " + fileType + "=" + openCommandString); foreach (string ext in extensions) { v = execute("cmd", "/c assoc " + ext + "=" + fileType); if (v != 0) return v; } return v; } public static int execute(string exeFilename, string arguments) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = false; startInfo.UseShellExecute = true; startInfo.FileName = exeFilename; startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.Arguments = arguments; try { using (Process exeProcess = Process.Start(startInfo)) { exeProcess.WaitForExit(); return exeProcess.ExitCode; } } catch { return 1; } } </code></pre>
9,515
<p>I would like to flash a success message on my page.</p> <p>I am using the jQuery <code>fadeOut</code> method to fade and then remove the element. I can increase the duration to make it last longer, however this looks strange.</p> <p>What I would like to happen is have the element be displayed for five seconds, then fade quickly, and finally be removed.</p> <p>How can you animate this using jQuery? </p>
<p>The new <code>delay()</code> function in jQuery 1.4 should do the trick.</p> <pre><code>$('#foo').fadeIn(200).delay(5000).fadeOut(200).remove(); </code></pre>
<p>Update for 1.6.2</p> <p>Nathan Long's answer will cause the element to pop off without obeying delay or <code>fadeOut</code>.</p> <p>This works:</p> <pre><code>$('#foo').delay(2000).fadeOut(2000); </code></pre>
6,370
<p>When I process a cube in Visual Studio 2005 I get following message:</p> <blockquote> <p>Process succeeded. Trace information is still being transferred. If you do not want to wait for all of the information to arrive press Stop.</p> </blockquote> <p>and no trace info is displayed. Cube is processed OK by it is a little bit annoying. Any ideas? I access cubes via web server.</p>
<p>I get the same message when I process a cube, but if I wait for a few seconds the trace information arrives. Are you dealing with a very large quantity of data or a very complex cube? Maybe this is a silly question, but have you tried waiting a few minutes?</p>
<p>how are you processing the cube? through XMLA or through the GUI? If you do it in XMLA then you should see the results as they come in the output window</p>
3,361
<p>My custom 3D printer prints everything inverted. I guess this is a homing problem as the motor moves in correct direction.</p> <p>In Pronterface,</p> <ul> <li>if I press -Y — bed moves forward (towards the Y endstop)</li> <li>if I press +Y — bed moves backward (away from Y endstop)</li> <li>if I press -X — hotend moves left (towards the X endstop)</li> <li>if I press +X — hotend moves right (away from the X endstop)</li> </ul> <p>on RAMPS 1.4:</p> <ul> <li>X endstop is connected on the 1st pin</li> <li>Y endstop is connected on the 3rd pin</li> <li>Z endstop is connected on the 5th pin</li> </ul> <p>(Pin 2, 4 &amp; 6 are not used (are these for MAX_ENDSTOP ?))</p> <p>Below is my Marlin config</p> <pre><code>#define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe. #define X_HOME_DIR -1 #define Y_HOME_DIR -1 #define Z_HOME_DIR -1 #define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false </code></pre> <p>I have attached 3 photographs.</p> <ol> <li>Shows the Home position of hotend. Y Motor on back and Y endstop at front.</li> </ol> <p><a href="https://i.stack.imgur.com/M4Gcr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M4Gcr.jpg" alt="Home position of hotend" /></a></p> <ol start="2"> <li>Shows inverted print.</li> </ol> <p><a href="https://i.stack.imgur.com/9SRBZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9SRBZ.jpg" alt="inverted print" /></a></p> <ol start="3"> <li>Pronterface screenshot (shows actual G-code file)</li> </ol> <p><a href="https://i.stack.imgur.com/4ru5r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4ru5r.jpg" alt="Pronterface screenshot" /></a></p> <p>I tried flipping the motor cables, but that inverts the motor direction I also tried INVERT_Y_DIR true, but no luck.</p> <p>Please help me. What am I doing wrong?</p>
<h1>Heater polarity doesn't matter</h1> <p>The heater cartridges are just large resistors and so polarity is irrelevant. Either can be positive or negative.</p> <p>You can extend the leads by cutting and splicing in ~20 gauge wires* to a two pin JST connector line you suggest.</p> <hr /> <p>*<sup>At 24 volts and 30 watts, you need <a href="https://www.platt.com/CutSheets/Multiple/AWG%20Conductors.pdf" rel="nofollow noreferrer">wire that is rated to carry at least 1.25 amps</a>. The US National Electric Code dictates that this should be 20 gauge wire, but their standard is very conservative. Since you don't need to adhere to NEC codes, you could get away with something thinner (ie higher gauge number).</sup></p>
<p>1 meter puts you far enough away from the heater than you don't need high temperature wiring to extend it. The larger the guage(e.g. 20 guage) the less resistance you will add to the heater circuit. This doesn't matter as long as you can still achieve your maximum temperature (if you can still achieve the same current without maxing out your voltage on the heater).</p> <p>Your sensor is where added series resistance is critical. Series resistance to the thermistor will give a negative error in the temperature.</p>
1,919
<p>I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable files (including installers, documentation, etc.), send e-mails to the developers upon errors and all sorts of other nifty things. What tool, or tool-set, should I use for this?</p> <p>I used to use FinalBuilder a few years ago and I liked that a lot but I'm not sure if they support such features as nightly-builds and email messages.</p>
<p>At my work we use CCNET, but with builds on check-in more than nightly - although it's easily configured for either or both.</p> <p>You can very easily set up unit testing to run on every checkin as well, FXCop testing, and a slew of other products.</p> <p>I would also advise checking out <a href="http://www.jetbrains.com/teamcity/" rel="nofollow noreferrer">Team City</a> as an option, because it has a free version, and the reporting and setup is reportedly much simpler (it does look nice to me). It does have a limit of somewhere around 20 team members/projects, before it hits a pay-for window.</p> <p>That said, we started with CCNET, and have grown several products too large to look at Team City on the free version and are very happy with what we have.</p> <p>Features that help with CCNET include:</p> <ul> <li>XML based configuration - you can usually copy and paste most of what you need. </li> <li>More or less you'll be able to plug your treesurgeon script in as your build script, and point CCNET at that as an executable task to run the compilation. </li> <li>Lots of documentation and very easy to set up nunit, ncover, fxcop, etc. </li> <li>Taskbar app that will let you know the status of your projects at any time, and it can also fire off an email or keep an RSS feed with the same information. </li> </ul> <p>But I'd definitely go with running a CI build on every check-in - for the most part will run the unit tests before checking in, but let the CCNET server handle run any applications/assemblies that would have dependencies on the assembly we're checking in, and they get re-built, and re-tested on every checkin.</p> <p>Given that CCNET is free free and takes very little time to set up - I'd highly recommend just going for it and seeing if it suits you, then expanding from there.</p> <p>(There's another thread here where I posted pretty much the same/with a few alterations - but some of the other comments may help too! <a href="https://stackoverflow.com/questions/36568/automated-builds#37204">Automated Builds</a>)</p> <p>Edit to add: You can easily set up your own deployment scheme for CCNET, and there are a tonne of blog posts out there to assist, and email notifications can really be set up fairly granularly, either on all successes, all failures, when it changes from success to fail, etc. There's also built in RSS, and you could even set up your own notifiers for other systems.</p>
<p><a href="http://www.conifersystems.com/cascade/" rel="nofollow noreferrer">Cascade</a> supports doing a build on every single change committed to the repository.</p> <p>I would not recommend doing only nightly builds -- that's a pretty long window where a build break can slip in before it's reported.</p>
5,846
<p>I've been using WWF for a while as part of an internal call center application (ASP.NET), and while learning it was a good practice in understanding how a state machine based workflow system <em>should</em> work, I am definitely not in love with WWF itself. In my opinion it is:</p> <ol> <li>Overly complex, especially for use within web apps (all that threaded runtime stuff)</li> <li>Immature (ever worked with that horrible designer?)</li> <li>Anemic in its current feature set</li> </ol> <p>Does anyone have a suggestion for a better .NET based workflow framework? Specifically, I am looking for the following features:</p> <ol> <li>State machine based (mapping states to available actions)</li> <li>A focus on user permissions (controlling who has access to what actions)</li> <li>The ability to run workflows as timed background tasks (for example, to send out reminders for items that have been sitting in a certain state for x days)</li> </ol> <p>That's really all I need. I don't need to be able to "drag and drop" any activities or visually design the flow. I am perfectly comfortable writing actual code once a particular action is triggered.</p>
<p>You could try <a href="http://www.thefreakparade.com/2008/05/simplestatemachine-codeplex-project/" rel="noreferrer">Simple State Machine</a>. You would have to implement access control and background timers yourself, but that shouldn't be a big deal. SSM was also built out of frustration with WF. <a href="http://www.codeplex.com/Project/ProjectDirectory.aspx?ProjectSearchText=%22state%20machine%22" rel="noreferrer">There are some other state machine implementations on Codeplex</a> as well. If one of them doesn't fit he bill out of the box, they are open source and should get you close enough. </p> <p>I wholeheartedly agree with you about state machines in WF - they aren't testable, are too complicated, the threading model is peculiar and hard to follow, and I'm not sure a visual designer could have been more poorly conceived for designing state machines graphically. I think this may be because the state machine concept feels tacked onto the WF runtime, which was designed for sequential state machines, something WF does a much better job with, in my opinion. The problem is that state machines are really not the same animal as a sequential work flow, and should have been given a first class implementation of their own, because the warping of WF to make it seem to support them turned out to be more or less unsupportable, if not actually unusable.</p>
<p>Do you have the option to consider BizTalk Server?</p>
3,974
<p>I'm using LINQ to SQL classes in a project where the database design is still in a bit of flux.</p> <p>Is there an easy way of synchronising the classes with the schema, or do I need to manually update the classes if a table design changes?</p>
<p>You can use SQLMetal.exe to generate your dbml and or cs/vb file. Use a pre-build script to start it and target the directory where your datacontext project belongs. </p> <pre><code>C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sqlmetal.exe /server:&lt;SERVER&gt; /database:&lt;database&gt; /code:"path\Solution\DataContextProject\dbContext.cs" /language:csharp /namespace:&lt;your namespace&gt; </code></pre>
<p>How about modifying the Properties of the entity/table within the DataContext design surface within Visual Studio?</p> <p>For instance if I added a column to an SQL Server table:</p> <ol> <li>Open the *.dbml file.</li> <li>Right click the entity and select Add > Property.</li> <li>Fill out the values in the Properties window for the new column.</li> <li>Build your solution.</li> </ol> <p>The auto generated model classes should reflect the new column that was added.</p> <p><a href="https://i.stack.imgur.com/S2Ixq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S2Ixq.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/PMtq9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PMtq9.png" alt="enter image description here"></a></p>
6,120
<p>This has me stumped. I had been printing normally until this happened. Below is an expurgated version of my headache over two days. Some help would be appreciated.</p> <p>Printer is Hypercube Evolution (CoreXY) using Bowden tube and eSun PLA+ filament. Bowden tube goes from inside the feed cone in the extruder straight through the heatsink and into the feed throat of the heatbreak. Genuine Titan Extruder. Extruder stepper has no label.</p> <p>Started a new print. Printer was at ambient temperature of about 18 degrees. Printer brought up to temperature, 60° bed and 200° hotend. Bed homed and levelled in gcode. Print speed 60mm/s. Hotend moved to centre of bed and print started. No filament extruded and extruder stepper was making a grinding noise. Normally expect this to be hotend not hot enough. Altered pressure adjustment on the extruder. Made no difference. Cancelled print.</p> <p>Lowered bed out of the way. Hotend to 225°. Attempted to extrude filament. Nothing other than extruder stepper grinding. Tried to retract filament, no motion and extruder stepper still grinding.</p> <p>Disassembled hotend. No problem removing nozzle. The heatbreak and the heatsink Bowden connections would not give. There was filament between the Bowden connector and the heatbreak. When this snapped, I could get the parts free. The heatbreak had stretched filament stuck in the feed throat. There was thickened filament in the Bowden tube preventing retraction. It is still in there and stuck. Extruder stepper replaced and VREF adjusted. New all metal 1.75mm heatbreak. Bowden tube replaced. Hotend reassembled. Hotend to 200° and extruded 200mm of filament. There was some smoke from the hot end at first and the initial filament was burnt. Everything seemed to be working, hotend turned off and Z-offset calculated and stored.</p> <p>Lowered the bed, hotend back to 200°. The problem was back, could not extrude nor retract, extruder stepper grinding. I was able to withdraw the filament manually. The end was slightly thickened with a whispy &quot;tail&quot;. Cut the filament, hotend to 225° and re-fed filament. Acrid smoke initially from the hotend and filament extruded. Hotend allowed to cool to room temperature. Hotend to 225°. Filament would not extrude nor retract. Hotend turned off and left.</p> <p>Disassembled hotend. Again, heatbreak and Bowden connections to heatsink would not give. Managed to manually feed filament whilst unscrewing heatbreak. The filament found is shown in the attached picture. The small thick bulge would seem to have occurred in the tiny area where the Bowden tube enters the feed throat of the heatbreak. The thin filament is stretching whilst trying to retract. After that can be seen where the filament has thickened again. Mangled filament trimmed and hotend reassembled making sure that the Bowden tube was seated in the heatbreak feed throat. Hotend to 200° and extruded 200mm filament. Tried a test print, not very good, but worked. Tried a second print, the problem was back again.</p> <p>Has anybody any ideas how to solve this? I have also checked that the thermistor is reading correctly, changed the roll of filament (just in case I had a bad roll) and have replaced the extruder stepper driver.</p> <p><a href="https://i.stack.imgur.com/iOIoz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iOIoz.jpg" alt="Filament from the Hotend" /></a></p>
<p>The lump at the top of the heatbreak is because there is a gap between your bowden tube and the heatbreak. Liquid filament is leaking out of the heatbreak and solidifying there. When you reassemble, you need to close this gap.</p> <p>There should not be smoke coming out of your nozzle. Maybe when it is new, there might be a bit of oil that would smoke, but it should only do that once. If you are getting burned filament, your nozzle temperature is too high. Either the control system is overshooting and the temperature spikes, or your temperature sensor has a problem.</p> <p>The thickened filament is worrisome. With the filament jammed at the heatbreak, if the filament is soft, it might be getting compressed. But PLA should not do this unless there is enough heat leaking into the bowden tube to soften it.</p>
<p>Worked out the reason for the thickening filament. A number of sites refer to heat creep and suggest that you check that the heatsink is clear and the heatsink fan is working properly. In my case, they were. However, the fan outlet (where it blows on the heat sink) was full of garbage. Cleaned that out things improved. Also replacing a dodgy thermistor cleared up the residual problem.</p>
2,061
<p>I'm a complete Xcode/Objective-C/Cocoa newbie but I'm learning fast and really starting to enjoy getting to grips with a new language, platform and paradigm.</p> <p>One thing is though, having been using Visual Studio with R# for so long I've kind of been spoiled with the coding tools such as refactorings and completion etc and as far as I can tell Xcode has some fairly limited built in support for this stuff.</p> <p>On that note, does anyone know if any add-ins or whatever are available for the Xcode environment which add coding helpers such as automatically generating implementation skeletons from a class interface definition etc? </p> <p>I suspect there aren't but I suppose it can't help to ask.</p>
<p>You sound as if you're looking for three major things: code templates, refactoring tools, and auto-completion.</p> <p>The good news is that Xcode 3 and later come with superb auto-completion and template support. By default, you have to explicitly request completion by hitting the escape key. (This actually works in all <code>NSTextView</code>s; try it!) If you want to have the completions appear automatically, you can go to <strong>Preferences</strong> -> <strong>Code Sense</strong> and set the pop-up to appear automatically after a few seconds. You should find good completions for C and Objective-C code, and pretty good completions for C++.</p> <p>Xcode also has a solid template/skeleton system that you can use. You can see what templates are available by default by going to Edit -> Insert Text Macro. Of course, you don't want to insert text macros with the mouse; that defeats the point. Instead, you have two options:</p> <ol> <li>Back in <strong>Preferences</strong>,go to <strong>Key Bindings</strong>, and then, under <strong>Menu Key Bindings</strong>, assign a specific shortcut to macros you use often. I personally don't bother doing this, but I know plenty of great Mac devs who do</li> <li><p>Use the <code>CompletionPrefix</code>. By default, nearly all of the templates have a special prefix that, if you type and then hit the escape key, will result in the template being inserted. You can use Control-/ to move between the completion fields.</p> <p>You can see <a href="http://crookedspin.com/2005/06/10/xcode-macros/" rel="noreferrer">a full list of Xcode's default macros and their associated <code>CompletionPrefix</code>es</a> at <a href="http://crookedspin.com" rel="noreferrer">Crooked Spin</a>.</p> <p>You can also add your own macros, or modify the defaults. To do so, edit the file <code>/Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro</code>. The syntax should be self-explanatory, if not terribly friendly.</p></li> </ol> <p>Unfortunately, if you're addicted to R#, you will be disappointed by your refactoring options. Basic refactoring is provided within Xcode through the context menu or by hitting Shift-Apple-J. From there, you can extract and rename methods, promote and demote them through the class hierarchy, and a few other common operations. Unfortunately, neither Xcode nor any third-party utilities offer anything approaching Resharper, so on that front, you're currently out of luck. Thankfully, Apple has already demonstrated versions of Xcode in the works that have vastly improved refactoring capabilities, so hopefully you won't have to wait too long before the situation starts to improve.</p>
<p>I found some xtmacro files in Xcode.app package: <strong>/Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources</strong></p> <p>Installed Xcode ver. 3.2.5.</p>
4,079
<p>I've had my Ender 3 Pro for a few months, and it's been working great. Then, after a failed print (the STL had extra seams, causing the print to get mangled), I've started having issues that I have attributed to under-extrusion.</p> <p>As evidenced by the below image, some lines in each layer are missing. The gaps align throughout the print, but not between prints (the two squares are identical G-code). This happens in every layer, with a different pattern in each. It also causes some perimeters to not adhere to the previous layer at all.</p> <p>The extra strands in the right print are present because I ripped off the infill layer that printed on top before I aborted the print.</p> <p>I first assumed I needed to calibrate my extruder. It turns out I did (93 had to be changed to 150 steps/mm). However, that did not fix the issue.</p> <p><strong>Some things I've tried</strong>:</p> <ul> <li>Calibrate the extruder</li> <li>Check nozzle size and filament size in Slic3r</li> <li>Level the bed (I had to place a post-it note under the centre of the flexible magnetic build surface to make up for a warped bed)</li> <li>Clean my nozzle and hotend (I fully dismantled the hotend)</li> <li>Replace my nozzle</li> <li>Increase printing temperature</li> </ul> <p>Is there anything else I might try to get this fixed?</p> <p><img src="https://i.stack.imgur.com/i2KNm.jpg" alt="Evidence Image" /></p> <p><strong>Specs for Reference</strong>:</p> <ul> <li>Ender 3 Pro</li> <li>0.4 mm Brass Nozzle</li> <li>205 °C Hotend</li> <li>60 °C Bed</li> <li>Slic3r</li> <li>150 Steps/mm for Extruder</li> </ul> <hr /> <p>If you need any more information, just comment and I'll do my best to supply it.</p> <p><em>Please note that I am <strong>not</strong> open to suggestions to replace my printer. I'd rather fix the one I have.</em></p>
<p>It turns out the extruder <em>was</em> slipping, but not due to a nozzle or Bowden tube pressure issue. The extruder arm (?) that holds the passive wheel (as opposed to the drive gear) was cracked, so the pressure between the wheel and the gear was weak. A bit of glue fixed it.</p> <p>These printers should ship with metal extruders, I think.</p> <p><strong>EDIT</strong></p> <p>The arm broke <em>again</em>, and this time I have a picture to illustrate the issue. I didn't make the printer do anything strenuous; I just printed a few small parts, causing it to break. <img src="https://i.stack.imgur.com/ibmeD.jpg" alt="enter image description here" /></p>
<p>This is a big red flag and severely wrong:</p> <blockquote> <p>93 had to be changed to 150 steps/mm</p> </blockquote> <p>It can be reasonable to tune steps per mm by a few percent, but needing an increase of more than 50% versus the standard value for the same physical gearing indicates either you did something wrong in computing the needed value, or some other serious root problem with the printer.</p> <p>You should start by fixing that (putting it back at 93) then try to figure out why it seemed to need change.</p> <p>Likely your extruder isn't gripping the filament. Trying to overextrude that severely likely grinds it so bad the hob fills up with shavings then doesn't grip at all.</p>
2,003
<p>I want to parse a config file sorta thing, like so:</p> <pre><code>[KEY:Value] [SUBKEY:SubValue] </code></pre> <p>Now I started with a <code>StreamReader</code>, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me.</p> <p>One restriction is that it has to work in a Linux/Mono environment (1.2.6 to be exact). I don't have the latest 2.0 release (of Mono), so try to restrict language features to C# 2.0 or C# 1.0.</p>
<blockquote> <p>I considered it, but I'm not going to use XML. I am going to be writing this stuff by hand, and hand editing XML makes my brain hurt. :')</p> </blockquote> <p>Have you looked at <a href="http://www.yaml.org/" rel="noreferrer">YAML</a>?</p> <p>You get the benefits of XML without all the pain and suffering. It's used extensively in the ruby community for things like config files, pre-prepared database data, etc</p> <p>here's an example</p> <pre><code>customer: name: Orion age: 26 addresses: - type: Work number: 12 street: Bob Street - type: Home number: 15 street: Secret Road </code></pre> <p>There appears to be a <a href="http://yaml-net-parser.sourceforge.net/default.html" rel="noreferrer">C# library here</a>, which I haven't used personally, but yaml is pretty simple, so "how hard can it be?" :-)</p> <p>I'd say it's preferable to inventing your own ad-hoc format (and dealing with parser bugs)</p>
<p>Regardless of the persisted format, using a Regex would be the fastest way of parsing. In ruby it'd probably be a few lines of code.</p> <pre><code>\[KEY:(.*)\] \[SUBKEY:(.*)\] </code></pre> <p>These two would get you the Value and SubValue in the first group. Check out MSDN on how to match a regex against a string.</p> <p>This is something everyone should have in their kitty. Pre-Regex days would seem like the Ice Age.</p>
3,486
<p>I am aware of <a href="http://www.capify.org/" rel="nofollow noreferrer">Capistrano</a>, but it is a bit too heavyweight for me. Personally, I set up two <a href="http://www.selenic.com/mercurial/wiki/" rel="nofollow noreferrer">Mercurial</a> repositories, one on the production server and another on my local dev machine. Regularly, when a new feature is ready, I push changes from repository on my local machine to repository on the server, then update on the server. This is a pretty simple and quick way to keep files in sync on several computers, but does not help to update databases.</p> <p>What is your solution to the problem?</p>
<p>I used to use git push to publish to my web server but lately I've just been using rsync. I try to make my site as agnostic about where it's running as possible (using relative paths, etc) and so far it's worked pretty well. The only challenge is keeping databases in sync, and for that I usually use the production database as the master and make regular backups and imports into my testing database.</p>
<p>@Andrew</p> <p>To use git push to deploy your site you will need to do first set up a remote server in your .git/config file to push to. Then you need to configure a hook that will basically perform a git reset --hard to copy the code you just copied to the repository to the working directory.</p> <p>I know this is a little vague, but I actually deleted the server-side .git folder once I switched to rsync, so I don't have the exact scripts that I used to make the magic happen. That might be a good candidate for a full question though, so you might get more responses that way.</p> <p><strong>edit:</strong> I know it's been a while, but I eventually found what I was using again:</p> <p><a href="https://stackoverflow.com/questions/279169/deploy-php-using-git#327315">Deploy a project using Git push</a></p>
5,873
<p>I am getting some errors thrown in my code when I open a Windows Forms form in Visual Studio's designer. I would like to branch in my code and perform a different initialization if the form is being opened by designer than if it is being run for real. </p> <p>How can I determine at run-time if the code is being executed as part of designer opening the form?</p>
<p>To find out if you're in "design mode":</p> <ul> <li>Windows Forms components (and controls) have a <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx" rel="noreferrer">DesignMode</a> property.</li> <li>Windows Presentation Foundation controls should use the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.designerproperties.isindesignmode.aspx" rel="noreferrer">IsInDesignMode</a> attached property.</li> </ul>
<pre><code> /// &lt;summary&gt; /// Whether or not we are being run from the Visual Studio IDE /// &lt;/summary&gt; public bool InIDE { get { return Process.GetCurrentProcess().ProcessName.ToLower().Trim().EndsWith("vshost"); } } </code></pre>
9,921
<p>Has anyone used <a href="http://web.archive.org/web/20090803092709/http://www.aptana.com:80/Jaxer" rel="nofollow noreferrer">Jaxer</a> in a production environment, I am curious as to how it holds up compared to something like php, ruby, etc. and if anyone knows of any pitfalls to using it that are well known.</p>
<p>@Stu: Not necessarily, maybe there's a bunch of people using it and having no issues. I love the concept having to only write validations once, using one language for everything both client and server side sounds like a interesting approach.</p>
<p>I'll add this <a href="http://www.ibm.com/developerworks/web/library/wa-aj-jaxer/index.html?ca=dgr-jw64wa-aj-jaxer&amp;S_TACT=105AGY46&amp;S_CMP=GRsitejw64" rel="nofollow noreferrer">Url</a> to my post I found it today, it has some information regarding the subject but no real "performance" information.</p>
3,149
<p>Is it possible to merge to a branch that is not a direct parent or child in TFS? I suspect that the answer is no as this is what I've experienced while using it. However, it seems that at certain times it would be really useful when there are different features being worked on that may have different approval cycles (ie. feature one <strong>might</strong> be approved before feature two). This becomes exceedingly difficult when we have production branches where we have to merge some feature into a previous branch so we can release before the next full version.</p> <p>Our current branching strategy is to develop in the trunk (or mainline as we call it), and create a branch to stabilize and release to production. This branch can then be used to create hotfixes and other things while mainline can diverge for upcoming features.</p> <p>What techniques can be used otherwise to mitigate a scenario such as the one(s) described above?</p>
<p>I agree with Harpreet that you may want to revisit how you you have setup you branching structure. However you if you really want to perform this type of merge you can through something called a baseless merge. It runs from the tfs command prompt, </p> <pre><code>Tf merge /baseless &lt;&lt;source path&gt;&gt; &lt;&lt;target path&gt;&gt; /recursive </code></pre> <p>Additional info about baseless merges can be found <a href="http://www.codeplex.com/VSTSGuidance/Wiki/View.aspx?title=How%20To%3A%20Perform%20a%20Baseless%20Merge%20in%20Team%20Foundation%20Server&amp;referringTitle=View%20More" rel="noreferrer">here</a></p> <p>Also I found this document to be invaluable when constructing our tfs branching structure <a href="http://vsarbranchingguide.codeplex.com/" rel="noreferrer">Microsoft Team Foundation Server Branching Guidance </a></p>
<p>I am far from a TFS expert, but I think you can merge siblings, and I think it is not a baseless merge. </p> <p>We branched off our main branch (branch name "main") for a feature (branch name "feature"), then I needed some of the work in a branch that was also branched off the main branch (branch name "dev"). I would consider feature and dev branches to be siblings as they both came from the same parent. I merged feature to dev and all files (14000) were marked as merge, some were marked as merge,edit. I could not cancel (visual studio would just hang), so I accepted the merge. Then I merged dev to main, then I pulled main to feature, and again 14000 files were marked for merge. I was really upset, and afraid this would continue.</p> <p>At this point we did a test project. We set up main, then branched dev and feature from main. We repeated the above steps with the same results. Once we completed the merge from main to feature, all future merges only showed the edited files.</p> <p>After our little test I completed the merge from main to feature. And just like the test our merges now only show the edited files. We can go dev to feature, feature to main, main to dev, etc. </p> <p>I did notice when branching all file dates were modified. Maybe this is an issue?</p>
7,616
<p>Whenever a 3D printer that uses linear rails is announced (case in point: the <a href="https://www.cetus3d.com/cetus-3d-printer.html" rel="noreferrer">cetus</a>), the Internet (well... at least that corner of it dealing with 3D printing) gets abuzz with excitement.</p> <p>I researched a bit the topic myself, and while I understand that linear rails can be produced to a fantastic degree of precision for super-heavy machinery, it escapes my comprehension why they are considered superior "by default", relative to the classic linear bearings on a shaft.</p> <p>3D printing is a lightweight application, and the motion of at least 2 axis does not happen against a solid surface (where you could bolt a linear rail every few cm) but suspended between the 2 ends of the axis. Furthermore, the internals of the bearings used on linear rails are substantially identical to those used on a shaft.</p> <p>The cetus site says under the heading "Quality Linear Rails":</p> <blockquote> <p>Self-lubricated | Maintenance Free | High Precision | Long Lifespan | Quiet</p> </blockquote> <p>but this - in my experience - can be said of "Quality Linear Bearings on a Shaft" as well, and in some cases even bushing deliver to a high standard on 3D printers.</p> <p>So, what am I missing?</p>
<p>The following is a compilation of the input from a number of sources.</p> <p>Linear rails in general are mechanical components that - when designing equipment - offer great flexibility.</p> <p><strong>The profile of the rail can be designed in nearly infinite ways.</strong> This in turn allows for:</p> <ul> <li><em>Different levels of stiffness in different directions</em> (for example you may have stresses only on a given plane, or you may actually want the rail to slightly flex in one plane but not in another one).</li> <li><em>Placing the surfaces for the rollers strategically</em>, for example in a location that is unlikely to get contaminated, or where the maximum force will be applied.</li> <li><em>Curved paths</em>, so that the carriage can move along a line that is not straight.</li> </ul> <p>Because the contact surface between the rollers and the bearings is flat, <strong>cylinders can be used instead of spheres</strong>. This in turns diminishes the mechanical stresses, and the amount of play, increases longevity and allows for more bearing capacity, among others.</p> <p>Linear rails <strong>can be anchored along their full length</strong>, rather that at their extremes, thus increasing the accuracy of their positioning, their stiffness and their bearing capacity.</p> <p>Linear rails <strong>can be machined while pre-loaded</strong>, thus achieving maximum accuracy when in use, rather than when coming out of the factory.</p> <p><strong>The bearings on a linear rail only allow for one degree of movement</strong>. There need to be two rods with linear bearings/bushes to achieve the same result.</p> <p>All that said, <strong>when it comes to the specific application of consumer-grade FDM 3D printers, it seems that none of the above is very relevant, nor confers any real advantage to the printer in terms of quality of the final print</strong>:</p> <ul> <li>the mechanical stresses involved in 3D printing are very small,</li> <li>the movements all happen along straight lines,</li> <li>most of the axis cannot be anchored to a large, rigid body,</li> <li>...</li> </ul> <p>On the other hand, the design with rods + linear bearings is cheap, effective, simpler and lightweight, all characteristics that are highly desirable in a 3D printer.</p> <p>All in all, <strong>it seems that there is no good reason to prefer linear rails over rods <em>in general</em></strong>.</p> <p>Still, there may be <em>specific</em> designs that may benefit from their adoption. I postulate that the Cetus printer linked in the question may be such a design: the cantilever arrangement of its axis - for example - is well served by the fact that a single rail locks movement in all but one direction, and the orientation of the X rail offers maximum rigidity against the action of gravity.</p>
<p>Linear rails will always produce a high degree of accuracy and stability and more so than round rod with PTFE bushings and/or bearings. </p> <p>One may argue the fact however even as a product developer and one who is involved with the mechanicals and development of machinery on a day to day basis comparing the two we see “significant” improvements using rails over rods and if properly utilized on a Z axis print bed you will have a bed free of leveling issues that can smoothly and accurately operate with one driver versus two. </p> <p>I will further add that getting rods aligned perfectly is a difficult task for the average person and even a slight twist or angular position can affect final print quality. I’ve seen many linear rods that appear visually straight and when chucked into a lathe spindle with 0.0000 accuracy there will be 0.005 or more in runout. In fact I’ve yet to see one perfecting concentric motion that is longer than 6 inches. This tells me that they cannot plausibly be as accurate and that while they may function they will never function with a high degree of accuracy.</p> <p>Do we need higher accuracy in 3D printer axis? Sure we can have quality control boards that compensate to some degree however the mechanics of the machine are utmost important before you choose the quality of board and software. Why install a \$300 motion control on a cheap linear rod printer if you’re not going to see the full benefits? </p> <p>With technology further advancing into 64 bit and eventually 128 bit and higher degrees of precisional accuracy 3D printing is turning a page and will if not already be capable of micro resolutional accuracy and can only do so if all the components function properly together. </p> <p>So sure, your rod guided printer works. However, it will never work as well as my linear rail guided printer with ballscrews and servos. You can have your layered fuzzy prints. I will keep my smooth finished injection molded looking parts that are made from materials a typical desktop cannot even print. So to argue it’s not needed is arguing that high quality isn’t accepted in a lower price point market. </p> <p>One other addition here. Ask yourself how level and square is your printer? I’m not talking about using a carpenter's level for checking your machine they can be inaccurate up to a 1/4” per 10 feet. When you can dial your printers bed down to 0.00005 or less every direction and your structure is just as accurate than you know what a quality printer and print looks like.</p> <p>I guarantee no printer priced \$300-\$1000 comes even close to that degree of accuracy. The average consumer is so drawn into the technology of a final print itself they overlook the precisional aspects involved and learn to settle for less. Then you wouldn’t expect your \$500 printer to compete with my \$10,000 printer either. </p> <p>Bottom line you get what you pay for.</p>
783
<p>While working between a Windows MySQL server and a Debian MySQL server, I noticed that warnings were fatal on Windows, but silently ignored on Debian. I'd like to make the warnings fatal on both servers while I'm doing development, but I wasn't able to find a setting that effected this behavior. Anyone have any ideas?</p>
<p>I think what you're looking for is the sql_mode parameter in my.conf. STRICT_ALL_TABLES is the value. I guess it depends what you mean by "fatal".</p> <p><a href="http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html</a></p>
<p>Look at enabling strict mode in the /etc/my.ini file.</p>
8,975
<p>I am using a class library which represents some of its configuration in .xml. The configuration is read in using the <code>XmlSerializer</code>. Fortunately, the classes which represent the .xml use the <code>XmlAnyElement</code> attribute at which allows me to extend the configuration data for my own purposes without modifying the original class library.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Config&gt; &lt;data&gt;This is some data&lt;/data&gt; &lt;MyConfig&gt; &lt;data&gt;This is my data&lt;/data&gt; &lt;/MyConfig&gt; &lt;/Config&gt; </code></pre> <p>This works well for deserialization. I am able to allow the class library to deserialize the .xml as normal and the I can use my own <code>XmlSerializer</code> instances with a <code>XmlNodeReader</code> against the internal <code>XmlNode</code>.</p> <pre><code>public class Config { [XmlElement] public string data; [XmlAnyElement] public XmlNode element; } public class MyConfig { [XmlElement] public string data; } class Program { static void Main(string[] args) { using (Stream fs = new FileStream(@"c:\temp\xmltest.xml", FileMode.Open)) { XmlSerializer xser1 = new XmlSerializer(typeof(Config)); Config config = (Config)xser1.Deserialize(fs); if (config.element != null) { XmlSerializer xser2 = new XmlSerializer(typeof(MyConfig)); MyConfig myConfig = (MyConfig)xser2.Deserialize(new XmlNodeReader(config.element)); } } } </code></pre> <p>I need to create a utility which will allow the user to generate a new configuration file that includes both the class library configuration as well my own configuration, so new objects will be created which were not read from the .xml file. The question is how can I serialize the data back into .xml? </p> <p>I realize that I have to initially call <code>XmlSerializer.Serialize</code> on my data before calling the same method on the class library configuration. However, this requires that my data is represented by an <code>XmlNode</code> after calling <code>Serialize</code>. What is the best way to serialize an object into an <code>XmlNode</code> using the <code>XmlSerializer</code>?</p> <p>Thanks,</p> <p>-kevin</p> <p>btw-- It looks like an <code>XmlNodeWriter</code> class written by Chris Lovett was available at one time from Microsoft, but the links are now broken. Does anyone know of an alternative location to get this class?</p>
<p>So you need to have your class contain custom configuration information, then serialize that class to XML, then make that serialized XML into an XML node: is that right?</p> <p>Could you just take the string created by the XMLSerializer and wrap that in it's own XML tags?</p> <pre><code>XmlSerializer xs = new XmlSerializer(typeof(MyConfig)); StringWriter xout = new StringWriter(); xs.Serialize(xout, myConfig); XmlDocument x = new XmlDocument(); x.LoadXml("&lt;myConfig&gt;" + xout.ToString() + "&lt;/myConfig&gt;"); </code></pre> <p>Now x is an XmlDocument containing one element, "&lt;myconfig&gt;", which has your serialized custom configuration in it.</p> <p>Is that at all what you're looking for? </p>
<p>One solution is to serialize the inner object to a string and then load the string into a XmlDocument where you can find the XmlNode representing your data and attach it to the outer object. </p> <pre><code>XmlSerializer xser1 = new XmlSerializer(typeof(Config)); XmlSerializer xser2 = new XmlSerializer(typeof(MyConfig)); MyConfig myConfig = new MyConfig(); myConfig.data = "My special data"; StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); XmlWriter xw = new XmlTextWriter(sw); xser2.Serialize(xw, myConfig); XmlDocument doc = new XmlDocument(); doc.LoadXml(sb.ToString()); Config config = new Config(); config.data = "some new info"; config.element = doc.LastChild; xser1.Serialize(fs, config); </code></pre> <p>However, this solution is cumbersome and I would hope there is a better way, but it resolves my problem for now.</p> <p>Now if I could just find the mythical XmlNodeWriter referred to on several blogs!</p>
6,835
<p>What did I do wrong?</p> <p>Here is an excerpt from my code:</p> <pre><code>public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); mParent = new Composite(scrollBox, SWT.NONE); scrollBox.setContent(mParent); FormLayout layout = new FormLayout(); mParent.setLayout(layout); // Adds a bunch of controls here mParent.layout(); mParent.setSize(mParent.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); } </code></pre> <p>...but it clips the last button: <img src="https://i.stack.imgur.com/1ubzc.png" alt="alt text" title="Screenshot"></p> <p>bigbrother82: That didn't work.</p> <p>SCdF: I tried your suggestion, and now the scrollbars are gone. I need to work some more on that.</p>
<p>This is a common hurdle when using <code>ScrolledComposite</code>. When it gets so small that the scroll bar must be shown, the client control has to shrink horizontally to make room for the scroll bar. This has the side effect of making some labels wrap lines, which moved the following controls farther down, which increased the minimum height needed by the content composite.</p> <p>You need to listen for width changes on the content composite (<code>mParent</code>), compute the minimum height again given the new content width, and call <code>setMinHeight()</code> on the scrolled composite with new height.</p> <pre><code>public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); scrollBox.setExpandVertical(true); // Using 0 here ensures the horizontal scroll bar will never appear. If // you want the horizontal bar to appear at some threshold (say 100 // pixels) then send that value instead. scrollBox.setMinWidth(0); mParent = new Composite(scrollBox, SWT.NONE); FormLayout layout = new FormLayout(); mParent.setLayout(layout); // Adds a bunch of controls here mParent.addListener(SWT.Resize, new Listener() { int width = -1; public void handleEvent(Event e) { int newWidth = mParent.getSize().x; if (newWidth != width) { scrollBox.setMinHeight(mParent.computeSize(newWidth, SWT.DEFAULT).y); width = newWidth; } } } // Wait until here to set content pane. This way the resize listener will // fire when the scrolled composite first resizes mParent, which in turn // computes the minimum height and calls setMinHeight() scrollBox.setContent(mParent); } </code></pre> <p>In listening for size changes, note that we ignore any resize events where the width stays the same. This is because changes in the height of the content do not affect the <i>minimum</i> height of the content, as long as the width is the same.</p>
<p>Don't you need to recompute the size of the scrollBox after the layout?</p>
5,557
<p>What is the proper way for an MFC application to cleanly close itself?</p>
<p>Programatically Terminate an MFC Application</p> <pre><code> void ExitMFCApp() { // same as double-clicking on main window close box ASSERT(AfxGetMainWnd() != NULL); AfxGetMainWnd()-&gt;SendMessage(WM_CLOSE); } </code></pre> <p><a href="http://support.microsoft.com/kb/117320">http://support.microsoft.com/kb/117320</a></p>
<p>If it is a dialog based application you can do it by calling EndDialog() function.</p> <p>If it is an SDI/MDI based application you can call DestroyWindow. But before which you will need to do the cleanup yourself (closing documents, deallocating memory and resources, destroying any additional windows created etc).</p>
3,530
<p>What could the best strategy for writing validation layer for mid-enterprise level business application built on Spring 2.5</p> <p>I know that Spring provides facility where we can implement Validator interface and write validation logic in validate method. But this will be restricted to only web requests coming through spring controller.</p> <p>I would like to develop the validation framework which can be utilized during web-services calls.</p> <p>In other words, the framework can remain and be called independently without the need of implementing Validator interface and then too it can be automatically integrated into Spring MVC flow.</p> <p>Hope you get my point.</p>
<p>The Spring Validation framework can be used outside of Spring MVC. What WebServices Stack are you using? If you are using Spring-WS (Spring's Web Services stack) they have special instructions on how to set up the validator here:</p> <p><a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/server.html#d0e2313" rel="nofollow noreferrer">http://static.springframework.org/spring-ws/sites/1.5/reference/html/server.html#d0e2313</a></p> <p>If you are using some other stack, it is probably easier to implement something for that stack (or find one) that will use Spring's validation framework.</p>
<p>Recall that the Validator interface defines two methods:</p> <pre><code>boolean supports(Class clazz) void validate(Object target, Errors errors) </code></pre> <p>The <code>Object target</code> is your form object, which is the whole object representing the page to be shown to the user. The Errors instance will contain the errors that will be displayed to the user.</p> <p>So, what you need to do is define an intermediary that can be called with the specifics in your form that you want to validate which are also the same as in your web service. The intermediary can take one of two forms:</p> <ol> <li><p>(probably the best):</p> <pre><code>public interface ErrorReturning { public void getErrors(Errors errors); } </code></pre></li> <li><p>(this can get ugly really fast if more than two states are added):</p> <pre><code>public interface ValidationObject { public Errors getErrors(Errors errors); public Object getResultOfWebServiceValidation(); } </code></pre></li> </ol> <p>I would suggest that the first approach be implemented. With your common validation, pass an object that can be used for web service validation directly, but allow it to implement the <code>getErrors()</code> method. This way, in your validator for Spring, inside your validation method you can simply call:</p> <pre><code>getCommonValidator().validate(partialObject).getErrors(errors); </code></pre> <p>Your web service would be based around calls to <code>getCommonValidator().validate(partialObject)</code> for a direct object to be used in the web service.</p> <p>The second approach is like this, though the interface only allows for an object to be returned from the given object for a web service validation object, instead of the object being a usable web service validation object in and of itself.</p>
8,151
<p>I'm a novice in 3D printing. I have a <a href="https://en.wikipedia.org/wiki/Aleph_Objects#LulzBot" rel="noreferrer">Lulzbot Kittaz 3D printer</a> with a hexagonal hot end of 0.35&nbsp;mm. I have printed a test subject, and while I was printing I encountered this extrusion problem. I'm using ABS with 230&nbsp;°C hot end temperature and 85&nbsp;°C bed temperature. What kind of problem is this and how should I rectify it?</p> <p>I took this photo when the printer printed the first layer:</p> <p><a href="https://i.stack.imgur.com/HtTv4.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/HtTv4.jpg" alt="First layer of print"></a></p>
<p>It looks like you are not extruding at the correct rate. I would check your slicer settings for nozzle and filament size. Also check and calibrate for your filament diameter.</p> <p>It looks like you could be getting better adhesion too. Lulzbot recommends a 110C bed temperature. That might help. (lulzbot.com/store/filament/abs under specifications)</p> <p>These are some good resources to troubleshoot prints, </p> <p><a href="http://reprap.org/wiki/Print_Troubleshooting_Pictorial_Guide#Insufficient_Material" rel="nofollow noreferrer">RepRap</a></p> <p><a href="https://all3dp.com/common-3d-printing-problems-3d-printer-troubleshooting-guide/" rel="nofollow noreferrer">All3DP</a></p> <p><a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#extruding-too-much-plastic" rel="nofollow noreferrer">Simplify3D</a></p>
<p>Two things come to mind. First it is the first few layers. You could have the head Smashing into the print bed. Causing a massive build up of plastic the first few layers. And or you have over extrusion.</p> <ol> <li><p>Take a piece of paper. you want the distance from the head and the bed to be that width. Just enough friction to feel a light drag. </p></li> <li><p>After that verify that your first layer extrusion multiplier is under 1.5. </p></li> <li><p>Make sure you are extruding the correct amount. Take a ruler. Mark out 100mm. Have it extrude 100mm. Correct feed rates accordingly. </p></li> <li><p>Next check plastic diameter by taking the average over 10 samples over a meter of plastic. Enter accordingly.</p></li> <li><p>Then last you might have temp a bit high. Drop it a few degrees. Not a huge factor. </p></li> </ol>
417
<p>Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create plug-ins for a host application using a simple interface.</p> <p>Let's be practical, and leave the C++ standard, which is not very helpful in this respect, aside for a minute. If I want to write an app for Windows and Mac (and optionally Linux) that supports C++ plug-ins, and if I want to give plug-in authors a reasonably large choice of compilers (say less than 2 year old versions of Visual C++, GCC or Intel's C++ compiler), what features of C++ could I count on?</p> <p>Of course, I assume that plug-ins would be written for a specific platform.</p> <p>Off the top of my head, here are some C++ features I can think of, with what I think is the answer:</p> <ul> <li>vtable layout, to use objects through abstract classes? (yes)</li> <li>built-in types, pointers? (yes)</li> <li>structs, unions? (yes)</li> <li>exceptions? (no)</li> <li>extern "C" functions? (yes)</li> <li>stdcall non-extern "C" functions with built-in parameter types? (yes)</li> <li>non-stdcall non-extern "C" functions with user-defined parameter types? (no)</li> </ul> <p>I would appreciate any experience you have in that area that you could share. If you know of any moderately successful app that has a C++ plug-in system, that's cool too.</p> <p>Carl</p>
<p>Dr Dobb's Journal has an article <a href="http://www.ddj.com/cpp/204202899?cid=RSSfeed_DDJ_Cpp" rel="nofollow noreferrer">Building Your Own Plugin Framework: Part 1</a> which is pretty good reading on the subject. It is the start of a series of articles which covers the architecture, development, and deployment of a C/C++ cross-platform plugin framework.</p>
<p>I have my own game engine that has a C++ plug-in system.</p> <p>I have some code in header files so it gets put into the plugin's compilation unit.</p> <p>Larger functions that live in the main engine are called via an exported C function (plugin calls MyObject_somefunction(MyObject *obj) which in the engine just calls obj->somefunction()). If calling a C function is ugly for your taste, then with some header trickery, when the header is included in the plugin, have the member function #defined to call the C function:</p> <pre><code>#if defined(IN_THE_PLUGIN) void MyObject::somefunction() { MyObject_somefunction(this); } #endif </code></pre> <p>Virtual functions either have to be pure or the code lives in the header file. If I'm not inheriting from a class and merely just instancing one, virtual function code can live in the engine, but then the class must export some C functions for creating and destroying the object that is called from the plugin.</p> <p>Basically, the tricks that I have used, with the goal being to maintain total platform independence, just amount to C exports and header file tricks.</p>
6,494
<p>As I said in the title there is some issue with my z axis steppers. They will make a humming sound and vibrate a little but won't actually spin. I'm fairly sure this is an issue with the firmware (but I might be totally wrong) since they turn when the wires are switched with the ones for the Y axis and swapping the driver board for a spare had no impact on them. Any help would be appreciated. I am using RAMPs 1.4 and marlin firmware.</p>
<p>Try connecting Y-motor to your Z ports. If Y-motor will behave like Z-motors, then there's problem with your Z ports, be it hardware or software. I'm not a RAMPS user, but have heard that there is voltage regulator for every motor port. Sounds like your motors may be underpowered.</p>
<p>Hello it's seems to be the voltage regutaltor on the steppers drivers for the nema motors. Check to adjust the voltage with a multimeter connecting the red pin from the multimeter on the voltage regulator on the driver and the black pin on the GND pin on the ramps 12v connector.</p> <p>Also make sure that you have connected the jumpers to setup the microstep resolution: </p> <p>Full step,Half step,Quarter step,Eighth step,Sixteenth step</p> <p>Best regards.</p> <p>Rodrigo</p>
748
<p>What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?</p>
<p><kbd>Ctrl</kbd> + <kbd>T</kbd> (ReSharper, Goto, type) will open a class file for you.</p> <p>Looks like <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd> opens files.</p>
<p>It depends on the key mapping that you have set. With default keymapping: Do <kbd>Ctrl</kbd> + <kbd>T</kbd> to open a type and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd> to open a file. With IntelliJ like mapping : Do <kbd>Ctrl</kbd> + <kbd>N</kbd> to open a type and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>N</kbd> to open a file.</p> <p>Visit the following links for all your key mapping.</p> <p>ReSharper 4 Default Keymap: Visual Studio scheme <a href="http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap.pdf" rel="nofollow noreferrer">http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap.pdf</a></p> <p>ReSharper 4 Default Keymap: ReSharper 2.x / IDEA scheme <a href="http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap2.pdf" rel="nofollow noreferrer">http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap2.pdf</a></p>
7,536
<p>I'm using MinGW with GCC 3.4.5 (mingw-special vista r3).</p> <p>My C application uses a lot of stack so I was wondering is there any way I can tell programatically how much stack is remaining so I can cleanly handle the situation if I find that I'm about to run out.</p> <p>If not what other ways would you work around the problem of potentially running out of stack space?</p> <p>I've no idea what size of stack I'll start with so would need to identify that programatically also.</p>
<p>The getrusage function gets you the current usage . (see <a href="http://www.kernel.org/doc/man-pages/online/pages/man2/getrusage.2.html" rel="noreferrer"><code>man getrusage</code></a>).</p> <p>The <code>getrlimit</code> in Linux would help fetching the stack size with the <code>RLIMIT_STACK</code> parameter.</p> <pre><code>#include &lt;sys/resource.h&gt; int main (void) { struct rlimit limit; getrlimit (RLIMIT_STACK, &amp;limit); printf ("\nStack Limit = %ld and %ld max\n", limit.rlim_cur, limit.rlim_max); } </code></pre> <p>Please give a look at <a href="http://man7.org/linux/man-pages/man2/setrlimit.2.html" rel="noreferrer"><code>man getrlimit</code></a>. The same information could be fetched by <code>ulimit -s</code> or <code>ulimit -a</code> stack size row. Also have a look at <code>setrlimit</code> function which would allow to set the limits. But as the mentioned in the other answers if you need to adjust stack then probably you should re consider your design. If you want a big array why not take the memory from the heap ?</p>
<p>maybe this will help for Windows platform only:</p> <p>in the PE header (IMAGE_NT_HEADERS) of your exe there are some records such as:</p> <pre> typedef struct _IMAGE_NT_HEADERS { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER32 OptionalHeader; } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32; typedef struct _IMAGE_OPTIONAL_HEADER { ... DWORD SizeOfStackReserve; DWORD SizeOfStackCommit; ... } </pre> <p>There is a simple way to obtain these values: using GetModuleHandle(NULL) will give you the imagebase (handle) of your module, address where you'll find a IMAGE_DOS_HEADER structure which will help you to find the IMAGE_NT_HEADERS structure (imagebase+IMAGE_DOS_HEADER.e_lfanew) -> IMAGE_NT_HEADERS, and there you'll find those fields: <b>SizeOfStackReserve</b> and <b>SizeOfStackCommit</b>.</p> <p>The maximum amount of space that the OS will allocate for your stack is SizeOfStackReserve.</p> <p>If you consider trying this, let me know and I will assist you. There is a way to obtain the size of stack used in a certain point.</p>
7,742
<p>Hy, does anyone worked with N2 Content Management System(<a href="http://www.codeplex.com/n2" rel="nofollow noreferrer">http://www.codeplex.com/n2</a>). If yes, how does it perform, performance wise(under heavy load)? It seems pretty simple and easy to use.</p> <p>Adrian</p>
<p>Maybe try this question at <a href="http://www.codeplex.com/n2/Thread/List.aspx" rel="nofollow noreferrer">http://www.codeplex.com/n2/Thread/List.aspx</a></p> <p>They might be able to tell you about performance limitations or bottlenecks.</p>
<p>I tried it and it looked promising at first but quickly had issues actually deploying it to a Medium Trust host.</p>
3,332