instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>So I'm getting a new job working with databases (Microsoft SQL Server to be precise). I know nothing about SQL much less SQL Server. They said they'd train me, but I want to take some initiative to learn about it on my own to be ahead. Where's the best place to start (tutorials, books, etc)? I want to learn more about the SQL language moreso than any of the fancy point and click stuff.</p>
<p>If you're planning on coding against a sql database using .NET, skip ADO and go directly to Linq. You will NOT miss anything.</p> <p>Oh, also, Joe Celko. If you see his name on an article or a book about SQL, read it.</p>
<p>Yikes...first I'd say "Best of luck to ya!"</p> <p>Then secondly if you are really serious that you have no experiences with SQL I'd say find one of the SAMS "Teach Yourself SQL in 34 nanoseconds" books. Normally I'd never recommend a SAMS book, but if you are the stalwart type to accept a job you know nothing about then...what the heck.</p>
3,879
<p>I want to know how to fully uninstall <code>MSSQL 2005</code>. </p> <p>I've been using the Trial version of SQL Server Reporting Services for a while now. My company finally purchased the software from an online distributor, and for support of Oracle, we needed to upgrade to MSSQL 2005 SP2. Anyway, the "full" version of the software would not install, as it was already installed (It seems the installer doesn't recognize what was installed was the trial version). So I tried uninstalling MSSQL 2005, and everything related (including visual studio), I can not seem to get it reinstalled. The error is a vague error message, and when i click the link to get more information, the usual "no information about this error was found" error. </p> <blockquote> <h2>Microsoft SQL Server 2005 Setup</h2> <p>There was an unexpected failure during the setup wizard. You may review the setup logs and/or click the help button for more information. </p> <p>For help, click: <a href="http://go.microsoft.com/fwlink?LinkID=20476&amp;ProdName=Microsoft+SQL+Server&amp;ProdVer=9.00.1399.06&amp;EvtSrc=setup.rll&amp;EvtID=50000&amp;EvtType=packageengine%5cinstallpackageaction.cpp%40InstallToolsAction.11%40sqls%3a%3aInstallPackageAction%3a%3aperform%400x643" rel="nofollow noreferrer">http://go.microsoft.com/fwlink?LinkID=20476&amp;ProdName=Microsoft+SQL+Server&amp;ProdVer=9.00.1399.06&amp;EvtSrc=setup.rll&amp;EvtID=50000&amp;EvtType=packageengine%5cinstallpackageaction.cpp%40InstallToolsAction.11%40sqls%3a%3aInstallPackageAction%3a%3aperform%400x643</a></p> <h2>BUTTONS:</h2> <p>OK</p> </blockquote>
<p>@Mark Struzinski</p> <p>I actually discovered that it was a problem with the installer, when installing the "Full Version". I discovered, since the product was downloaded, instead of delivered on CD/DVD, that the installer was looking for information in a path that was not correct. There was a MS Knowledge Base article on the topic. Thanks for your reply, tho</p>
<p>I had the exact same problem, and this article helped me clean up all the related files from my system and do a fresh install of both Visual Studio and the SQL client components. Give it a try and let me know if it helps you out:</p> <p><a href="http://support.citrix.com/article/CTX115270" rel="nofollow noreferrer">http://support.citrix.com/article/CTX115270</a></p>
3,639
<p>I have a bunch of legacy documents that are HTML-like. As in, they look like HTML, but have additional made up tags that aren't a part of HTML</p> <pre><code>&lt;strong&gt;This is an example of a &lt;pseud-template&gt;fake tag&lt;/pseud-template&gt;&lt;/strong&gt; </code></pre> <p>I need to parse these files. PHP is the only only tool available. The documents don't come close to being well formed XML. </p> <p>My original thought was to use the loadHTML methods on PHPs DOMDocument. However, these methods choke on the make up HTML tags, and will refuse to parse the string/file.</p> <pre><code>$oDom = new DomDocument(); $oDom-&gt;loadHTML("&lt;strong&gt;This is an example of a &lt;pseud-template&gt;fake tag&lt;/pseud-template&gt;&lt;/strong&gt;"); //gives us DOMDocument::loadHTML() [function.loadHTML]: Tag pseud-template invalid in Entity, line: 1 occured in .... </code></pre> <p>The only solution I've been able to come up with is to pre-process the files with string replacement functions that will remove the invalid tags and replace them with a valid HTML tag (maybe a span with an id of the tag name).</p> <p>Is there a more elegant solution? A way to let DOMDocument know about additional tags to consider as valid? Is there a different, robust HTML parsing class/object out there for PHP?</p> <p>(if it's not obvious, I don't consider regular expressions a valid solution here)</p> <p><strong>Update</strong>: The information in the fake tags is part of the goal here, so something like Tidy isn't an option. Also, I'm after something that does the some level, if not all, of well-formedness cleanup for me, which is why I was looking the DomDocument's loadHTML method in the first place.</p>
<p>You can suppress warnings with <a href="http://www.php.net/manual/en/function.libxml-use-internal-errors.php" rel="noreferrer"><code>libxml_use_internal_errors</code></a>, while loading the document. Eg.:</p> <pre><code>libxml_use_internal_errors(true); $doc = new DomDocument(); $doc-&gt;loadHTML("&lt;strong&gt;This is an example of a &lt;pseud-template&gt;fake tag&lt;/pseud-template&gt;&lt;/strong&gt;"); libxml_use_internal_errors(false); </code></pre> <p>If, for some reason, you need access to the warnings, use <a href="http://www.php.net/manual/en/function.libxml-get-errors.php" rel="noreferrer"><code>libxml_get_errors</code></a></p>
<p>My quick and dirty solution to this problem was to run a loop that matches my list of custom tags with a regular expression. The regexp doesn't catch tags that have another inner custom tag inside them. </p> <p>When there is a match, a function to process that tag is called and returns the "processed HTML". If that custom tag was inside another custom tag than the parent becomes childless by the fact that actual HTML was inserted in place of the child, and it will be matched by the regexp and processed at the next iteration of the loop. </p> <p>The loop ends when there are no childless custom tags to be matched. Overall it's iterative (a while loop) and not recursive.</p>
9,223
<p>Anyone know a good book or post about how to start in EF? I have seen the DnrTV any other place?</p>
<p>Mike Taulty's Blog: <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx" rel="noreferrer">http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx</a></p> <p>A great EF intro deck: <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/03/13/10235.aspx" rel="noreferrer">http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/03/13/10235.aspx</a></p> <p>And these ADO.NET Data Services screencasts are nice too: <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/01/25/10152.aspx" rel="noreferrer">http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/01/25/10152.aspx</a></p> <p>ADO.NET Entity Framework MSDN: <a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/bb399572.aspx</a></p> <p>ADO.NET Entity Framework forums: <a href="http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=533&amp;SiteID=1" rel="noreferrer">http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=533&amp;SiteID=1</a></p> <p>ADO.NET team blog: <a href="http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx" rel="noreferrer">http://blogs.msdn.com/adonet/archive/tags/Entity+Framework/default.aspx</a></p> <p>Programming LINQ and the ADO.NET Entity Framework Webcast: <a href="http://blogs.msdn.com/adonet/archive/2008/01/28/programming-linq-and-the-ado-net-entity-framework-webcast.aspx" rel="noreferrer">http://blogs.msdn.com/adonet/archive/2008/01/28/programming-linq-and-the-ado-net-entity-framework-webcast.aspx</a></p>
<p><a href="http://blogs.msdn.com/alexj/" rel="nofollow noreferrer">Alex James, Program Manager on the ADO.Net team</a> at microsoft also has the odd good post on EF especially around Metadata.</p>
6,442
<p>I am a 3D printing beginner but wanted to get stuck in straight away and design my own 3D objects. I used Sketchup to design a badge of one of my logos. I make sure that all faces of my object are not inside out and show a white face in Sketchup. I also make my entire object a component before exporting into a .stl file. However, when I import into Ultimaker Cura, the base of the object is red. This to my understanding means there is an issue with that face.I have played around with Sketchup several times by not creating a component, reversing the face and I still have no luck. When I reverse the base face in Sketchup so that it is grey, it then shows up in Ultimaker Cura as okay (not red). But when I 3D print it, it still prints it very strangely. I would like to note I am 3D printing with a raft and when I do not use a raft, the object prints fine. Also I have tested printing a small 3D cube with the same settings and the results are exactly the same. Surely you can design objects in Sketchup and print with a raft?</p> <p><a href="https://i.stack.imgur.com/WdSYa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WdSYa.jpg" alt="Reverse of object"></a></p> <p><a href="https://i.stack.imgur.com/t8seY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t8seY.jpg" alt="Front of object"></a></p>
<p>A red surface coloring is normal for the bottom when viewed in Ultimaker Cura, nothing to worry about that (e.i. when that face is touching the build plate; if it is unsupported, you should add support structures but a raft is generally not necessary for PLA).</p> <p>Rafts are useful when you print high temperature materials that have a large shrinkage when cooled from print to bed temperature (this somewhat mitigates the problems of curling up corners or warping prints), for PLA it is not needed. As seen from the print that is printed on the raft, it's clear that the print to raft distance is to large, the first print object layer is not adhering to the top raft layer very well.</p> <p>The print that is printed without a raft doesn't look too bad. Some printer <a href="/q/6483">extruder calibration</a> could further improve the quality.</p>
<p>Note: This answer is curently wrong because I mentally reversed your "with raft" and "without raft" columns. I'll attempt to fix it soon.</p> <p>This doesn't look like a problem with your model, but rather a problem with your bed height or slicer settings (possibly both) that may be affecting your particular model worse than others. It's clear from the photo of the bottom of your print that the extrusions that were supposed to be circular failed to adhere to the bed, and instead got pulled to chords between points they happened to adhere at. This could be caused by a mix of:</p> <ul> <li>Excessive print speed for the first layer. Generally I would limit it to 30 mm/s or less to give the material the best chance to stick.</li> <li>Excess space between the nozzle and bed. Could be caused by improper adjustment of bed height ("leveling"), or by using a layer thickness that's too high (roughly, more than 75-80% of nozzle width).</li> <li>Underextrusion, possibly caused by insufficient print temperature, incorrect filament diameter setting, or poor quality filament with wrong diameter, among other things.</li> </ul> <p>Using a raft mitigates these things by moving the potential problem to the interface between the raft and the bed; once there's a raft sticking to the bed, printing of the model can ignore the problem. But you <em>should never need a raft</em>. It's a waste of plastic and a workaround for problems that have better fixes, not a necessary part of 3D printing.</p> <p>The "red" in Cura is not a problem; as I understand it, Cura shows all parts of the model that aren't supported <em>by other parts of the model</em> in red, and this includes the base. However, it is possible that your model has some stray part extruding below the bottom, causing the whole thing (except that stray part) to be printed starting one layer above the print bed with nothing to adhere to. You can check if this is the case in Cura by switching to layer view and looking at the first layer. You should see the whole surface that you want to adhere to the bed; if instead you see just one or a few small blobs, that's your problem.</p>
1,391
<p>What is the best way to make a delphi application (delphi 2007 for win32 here) go completely full screen, removing the application border and covering windows task bar ?</p> <p>I am looking for something similar to what IE does when you hit F11.</p> <p>I wish this to be a run time option for the user not a design time decision by my good self.</p> <p>As Mentioned in the accepted answer </p> <pre><code>BorderStyle := bsNone; </code></pre> <p>was part of the way to do it. Strangely I kept getting a <code>E2010 Incompatible types: 'TFormBorderStyle' and 'TBackGroundSymbol'</code> error when using that line (another type had <code>bsNone</code> defined).</p> <p>To overcome this I had to use : </p> <pre><code>BorderStyle := Forms.bsNone; </code></pre>
<p>Well, this has always worked for me. Seems a bit simpler...</p> <pre><code>procedure TForm52.Button1Click(Sender: TObject); begin BorderStyle := bsNone; WindowState := wsMaximized; end; </code></pre>
<p>You need to make sure Form position is poDefaultPosOnly.</p> <pre><code>Form1.Position := poDefaultPosOnly; Form1.FormStyle := fsStayOnTop; Form1.BorderStyle := bsNone; Form1.Left := 0; Form1.Top := 0; Form1.Width := Screen.Width; Form1.Height := Screen.Height; </code></pre> <p>Tested and works on Win7 x64.</p>
3,527
<p>How do I get Asterisk to forward incoming calls based on matching the incoming call number with a number to forward to? Both numbers are stored in a MySQL database.</p>
<p>Sorry for the long code sample, but more than half of it is debugging code to help you get it set up.</p> <p>I'm assuming your server already has a modern version of PHP (at <code>/usr/bin/php</code>) with the PDO library, and that you have a database table named <code>fwd_table</code> with columns <code>caller_id</code> and <code>destination</code>.</p> <p>In /var/lib/asterisk/agi-bin get a copy of the <a href="http://sourceforge.net/projects/phpagi/" rel="nofollow noreferrer">PHP AGI</a> library. Then create a file named something like <code>forward_by_callerid.agi</code> that contains:</p> <pre><code>#!/usr/bin/php &lt;?php ini_set('display_errors','false'); //Supress errors getting sent to the Asterisk process require('phpagi.php'); $agi = new AGI(); try { $pdo = new PDO('mysql:host='.$db_hostname.';dbname='.$db_database.';charset=UTF-8', $db_user, $db_pass); } catch (PDOException $e) { $agi-&gt;conlog("FAIL: Error connecting to the database! " . $e-&gt;getMessage()); die(); } $find_fwd_by_callerid = $pdo-&gt;prepare('SELECT destination FROM fwd_table WHERE caller_id=? '); $caller_id = $agi-&gt;request['agi_callerid']; if($callerid=="unknown" or $callerid=="private" or $callerid==""){ $agi-&gt;conlog("Call came in without caller id, I give up"); exit; }else{ $agi-&gt;conlog("Call came in with caller id number $caller_id."); } if($find_fwd_by_callerid-&gt;execute(array($caller_id)) === false){ $agi-&gt;conlog("Database problem searching for forward destination (find_fwd_by_callerid), croaking"); exit; } $found_fwds = $find_fwd_by_callerid-&gt;fetchAll(); if(count($found_fwds) &gt; 0){ $destination = $found_contacts[0]['destination']; $agi-&gt;set_variable('FWD_TO', $destination); $agi-&gt;conlog("Caller ID matched, setting FWD_TO variable to ''"); } ?&gt; </code></pre> <p>Then from the dial plan you can call it like this:</p> <pre><code>AGI(forward_by_callerid.agi) </code></pre> <p>And if your database has a match, it will set the variable <code>FWD_TO</code> with goodness. Please edit your question if you need more help getting this integrated into your dial plan.</p>
<p><a href="http://scottstuff.net/blog/articles/2004/08/09/database-driven-call-forwarding-with-asterisk" rel="nofollow noreferrer">This article</a> should do the trick. It's about 3 lines of code and some simple queries to add and remove forwarding rules.</p>
9,502
<p>I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?</p>
<p>As a programmer/hacker, <code>Get-Member</code> and <code>Get-Command</code> are the ones I use more than any others, but the ones I use to show off are <code>Select-Control</code> and <code>Send-Keys</code> from <a href="http://CodePlex.com/WASP" rel="nofollow noreferrer">WASP</a>, the <a href="http://PowerGadgets.com" rel="nofollow noreferrer">PowerGadgets</a>, and some of my own stuff written in WPF against CTP2 or <a href="http://CodePlex.com/PoshConsole" rel="nofollow noreferrer">PoshConsole</a> ;-)</p> <p><img src="https://i.stack.imgur.com/HCO2p.png" alt="Weather in PoshConsole"></p>
<p>While semi-related to your question, it does not entirely fit the Powershell NetCmdlets motif. But I wanted to post it anyhow as I use it daily and it may help others. Simply making shift-control-c key combo into displaying the visual studio command prompt.</p>
2,473
<p>I am printing ABS on an Ender 3 printer at a temperature of 240 °C on the nozzle and 110 °C on the bed. I am getting the following result:</p> <p><a href="https://i.stack.imgur.com/FnLuQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FnLuQ.jpg" alt="enter image description here" /></a></p> <p>Is there any way I can fix this?</p>
<p>I think that your bed is too hot because the bubbling is only on the bottom layer, if it was through out the entire print, I would say that it is your nozzle temp and you should do a temp tower, but because that isn't the case try lowering your bed temp</p>
<p>I had a similiar issue. First 2 to 4 layers looked god, than a trouble zone with 5 to 10 layers, and after that good again. In my case the z-layer screws were not tight. During moving up I lost some steps due to the lose screws ...</p>
1,940
<p>I know 'best' is subjective, so according to you, what is the best solution for the following problem:</p> <p>Given a string of length n (say "abc"), generate all proper subsets of the string. So, for our example, the output would be {}, {a}, {b}, {c}, {ab}, {bc}, {ac}. {abc}.</p> <p>What do you think?</p>
<p>You want the <a href="http://en.wikipedia.org/wiki/Power_set" rel="noreferrer">power set</a>. It can be calculated <a href="http://en.wikipedia.org/wiki/Power_set#Algorithms" rel="noreferrer">recursively and inductively</a>. ;-)</p>
<pre><code>def subsets(s): r = [] a = [False] * len(s) while True: r.append("".join([s[i] for i in range(len(s)) if a[i]])) j = 0 while a[j]: a[j] = False j += 1 if j &gt;= len(s): return r a[j] = True print subsets("abc") </code></pre>
6,505
<p>Today I ran into an issue with the filament not sticking to the build plate. However, the strange part is, that this only happens with one filament color (both PLA, khaki, black works just fine) and only in the main print. The test line on the side of the bed and the brim all stick without a problem. I already releveled everything and as I'm using ABL and the other filament works fine, this shouldn't be the issue.</p> <p>I also tried increasing the first layer thickness in Cura, however, this leads to extreme warp (2 mm height on 5 mm width).</p> <p>From my observations, it seems that the print head is raised after the brim is printed. Is there a setting in Cura to change that?</p> <p><strong>Printer Details:</strong> Modified Ender-3 with MKS Gen L V2 Board and TMC 2209 motor drivers and BLTouch<br /> <strong>Print temp:</strong> 220 °C / 70 °C initial after that 200 °C / 60 °C<br /> <strong>Firmware:</strong> Marlin, details <a href="https://github.com/MasterPuffin/MKS-GEN-L-V2-Marlin-Firmware-for-Ender-3/tree/BLTouch" rel="nofollow noreferrer">here</a></p>
<p>Yes you can edit many parameters in Cura that may help with your problem.</p> <p>However, I believe an easier fix to this problem may be to either apply some glue or masking tape to the bed before you try to change Cura settings since the problem only occurs with just one filament type..</p>
<p>Your temperatures look pretty good. You could try raising both bed temperatures by 5°C.</p> <p>You could try Elmer's glue stick or hair spray.</p> <p>Make sure your Z height is still OK as well as your bed being level after you loaded the different filament.</p>
1,936
<p>Is there some way to do multi-threading in JavaScript?</p>
<p>See <a href="http://caniuse.com/#search=worker" rel="nofollow noreferrer">http://caniuse.com/#search=worker</a> for the most up-to-date support info.</p> <p>The following was the state of support circa 2009.</p> <hr /> <p>The words you want to google for are <a href="http://www.google.com/search?q=JavaScript+worker+threads" rel="nofollow noreferrer">JavaScript Worker Threads</a></p> <p>Apart from from <a href="http://gears.google.com/" rel="nofollow noreferrer">Gears</a> there's nothing available right now, but there's plenty of talk about how to implement this so I guess watch this question as the answer will no doubt change in future.</p> <p>Here's the relevant documentation for Gears: <a href="http://code.google.com/apis/gears/api_workerpool.html" rel="nofollow noreferrer">WorkerPool API</a></p> <p>WHATWG has a Draft Recommendation for worker threads: <a href="http://www.whatwg.org/specs/web-workers/current-work/" rel="nofollow noreferrer">Web Workers</a></p> <p>And there's also Mozilla’s <a href="https://wiki.mozilla.org/DOMWorkerThreads" rel="nofollow noreferrer">DOM Worker Threads</a></p> <hr /> <p><strong>Update:</strong> June 2009, current state of browser support for JavaScript threads</p> <p><strong>Firefox 3.5</strong> has web workers. Some demos of web workers, if you want to see them in action:</p> <ul> <li><a href="http://blog.mozbox.org/post/2009/04/10/Web-Workers-in-action" rel="nofollow noreferrer">Simulated Annealing</a> (&quot;Try it&quot; link)</li> <li><a href="https://web.archive.org/web/20120406122342/https://developer.mozilla.org/web-tech/2008/12/04/web-workers-part-2" rel="nofollow noreferrer">Space Invaders</a> (link at end of post)</li> <li><a href="http://www.yafla.com/dforbes/Web_Workers_and_You__A_Faster_More_Powerful_JavaScript_World" rel="nofollow noreferrer">MoonBat JavaScript Benchmark</a> (first link)</li> </ul> <p>The Gears plugin can also be installed in Firefox.</p> <p><strong>Safari 4</strong>, and the <strong>WebKit nightlies</strong> have worker threads:</p> <ul> <li><a href="http://blog.owensperformance.com/2009/02/safari-4-worker-threads-javascript-domination/" rel="nofollow noreferrer">JavaScript Ray Tracer</a></li> </ul> <p><strong>Chrome</strong> has Gears baked in, so it can do threads, although it requires a confirmation prompt from the user (and it uses a different API to web workers, although it will work in any browser with the Gears plugin installed):</p> <ul> <li><a href="http://code.google.com/apis/gears/samples/hello_world_workerpool/hello_world_workerpool.html" rel="nofollow noreferrer">Google Gears WorkerPool Demo</a> (not a good example as it runs too fast to test in Chrome and Firefox, although IE runs it slow enough to see it blocking interaction)</li> </ul> <p><strong>IE8</strong> and <strong>IE9</strong> can only do threads with the Gears plugin installed</p>
<p>With HTML5 <a href="https://www.w3.org/TR/workers/" rel="nofollow noreferrer">specification</a> you do not need to write too much JS for the same or find some hacks.</p> <p>One of the feature introduced in HTML5 is <a href="http://www.w3schools.com/html/html5_webworkers.asp" rel="nofollow noreferrer">Web Workers</a> which is JavaScript running in the background,independently of other scripts, without affecting the performance of the page. </p> <p>It is supported in almost all browsers : </p> <p>Chrome - 4.0+ </p> <p>IE - 10.0+</p> <p>Mozilla - 3.5+</p> <p>Safari - 4.0+</p> <p>Opera - 11.5+</p>
4,988
<p>I would like to know how to write PHPUnit tests with Zend_Test and in general with PHP.</p>
<p>I'm using Zend_Test to completely test all controllers. It's quite simple to set up, as you only have to set up your bootstrap file (the bootstrap file itself should NOT dispatch the front controller!). My base test-case class looks like this:</p> <pre><code>abstract class Controller_TestCase extends Zend_Test_PHPUnit_ControllerTestCase { protected function setUp() { $this-&gt;bootstrap=array($this, 'appBootstrap'); Zend_Auth::getInstance()-&gt;setStorage(new Zend_Auth_Storage_NonPersistent()); parent::setUp(); } protected function tearDown() { Zend_Auth::getInstance()-&gt;clearIdentity(); } protected function appBootstrap() { Application::setup(); } } </code></pre> <p>where <code>Application::setup();</code> does all the setup up tasks which also set up the real application. A simple test then would look like this:</p> <pre><code>class Controller_IndexControllerTest extends Controller_TestCase { public function testShowist() { $this-&gt;dispatch('/'); $this-&gt;assertController('index'); $this-&gt;assertAction('list'); $this-&gt;assertQueryContentContains('ul li a', 'Test String'); } } </code></pre> <p>That's all...</p>
<p>I haven't used Zend_Test but I have written tests against apps using Zend_MVC and the like. The biggest part is getting enough of your bootstrap code in your test setup.</p>
9,138
<p>Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to step through it in the debugger.</p> <p>There's an article on how to debug a SharePoint workflow <a href="http://www.andrewconnell.com/blog/archive/2008/06/11/SharePoint-Debugging-and-Logging-Tips-and-Tricks.aspx" rel="nofollow noreferrer">here</a> that tells you how to set breakpoints etc. This involves copying the .pdb file into the GAC alongside the .dll file containing your workflow. You have to do this from a command prompt (or a batch file) because Windows Explorer doesn't let you view the relevant subdirectory of c:\windows\assembly.</p> <p>However, if you do this, the next time you try to deploy the workflow from within Visual Studio, it complains that it can't be deployed because "the file may not be signed" and if you attempt to copy the new version of the dll into the GAC, it tells you that the .dll file is locked.</p> <p>I've found that some of the time, you can get round this by doing an iisreset, but on other occasions you have to restart Visual Studio and there have been frequent times when I've even had to reboot the computer altogether because some mystery process has locked the file. When I don't use the debugger, on the other hand, everything works just fine.</p> <p>Does anyone know of a simpler way of debugging workflows than this?</p>
<p>The SharePoint team is currently working on MOSS extensions for VS 2008 which will allow this type of functionality. This was available in VS 2005 with MOSS extensions, but has to be run off Windows Server with a full MOSS installation and the correct permissions set.</p>
<p>Check out <a href="http://www.codeplex.com/stsdev" rel="nofollow noreferrer">STSDev</a> on CodePlex by SharePoint MVPs like Ted Pattison, Andrew Connell, Scot Hillier, and more.</p> <blockquote> <p>STSDEV is a proof-of-concept utility application which demonstrates how to generate Visual Studio project files and solution files to facilitate the development and deployment of templates and components for the SharePoint 2007 platform including Windows SharePoint Services 3.0 (WSS) and Microsoft Office SharePoint Server 2007 (MOSS). Note that the current version of the stsdev utility only supports creating projects with the C# programming language.</p> </blockquote> <p>Keith</p>
2,877
<p>Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.)</p> <p>Antiword seems like it might be a reasonable option, but it seems like it might be abandoned.</p> <p>A Python solution would be ideal, but doesn't appear to be available.</p>
<p>I use catdoc or antiword for this, whatever gives the result that is the easiest to parse. I have embedded this in python functions, so it is easy to use from the parsing system (which is written in python).</p> <pre><code>import os def doc_to_text_catdoc(filename): (fi, fo, fe) = os.popen3('catdoc -w "%s"' % filename) fi.close() retval = fo.read() erroroutput = fe.read() fo.close() fe.close() if not erroroutput: return retval else: raise OSError("Executing the command caused an error: %s" % erroroutput) # similar doc_to_text_antiword() </code></pre> <p>The -w switch to catdoc turns off line wrapping, BTW.</p>
<p>Honestly <strong>don't use &quot;pip install tika</strong>&quot;, this has been developed for mono-user (one developper working on his laptop) and not for multi-users (multi-developpers).</p> <p>The small class TikaWrapper.py bellow which uses Tika in command line is widely enough to meet our needs.</p> <p>You just have to instanciate this class with JAVA_HOME path and the Tika jar path, that's all ! And it works perfectly for lot of formats (e.g: PDF, DOCX, ODT, XLSX, PPT, etc.).</p> <pre><code>#!/bin/python # -*- coding: utf-8 -*- # Class to extract metadata and text from different file types (such as PPT, XLS, and PDF) # Developed by Philippe ROSSIGNOL ##################### # TikaWrapper class # ##################### class TikaWrapper: java_home = None tikalib_path = None # Constructor def __init__(self, java_home, tikalib_path): self.java_home = java_home self.tika_lib_path = tikalib_path def extractMetadata(self, filePath, encoding=&quot;UTF-8&quot;, returnTuple=False): ''' - Description: Extract metadata from a document - Params: filePath: The document file path encoding: The encoding (default = &quot;UTF-8&quot;) returnTuple: If True return a tuple which contains both the output and the error (default = False) - Examples: metadata = extractMetadata(filePath=&quot;MyDocument.docx&quot;) metadata, error = extractMetadata(filePath=&quot;MyDocument.docx&quot;, encoding=&quot;UTF-8&quot;, returnTuple=True) ''' cmd = self._getCmd(self._cmdExtractMetadata, filePath, encoding) out, err = self._execute(cmd, encoding) if (returnTuple): return out, err return out def extractText(self, filePath, encoding=&quot;UTF-8&quot;, returnTuple=False): ''' - Description: Extract text from a document - Params: filePath: The document file path encoding: The encoding (default = &quot;UTF-8&quot;) returnTuple: If True return a tuple which contains both the output and the error (default = False) - Examples: text = extractText(filePath=&quot;MyDocument.docx&quot;) text, error = extractText(filePath=&quot;MyDocument.docx&quot;, encoding=&quot;UTF-8&quot;, returnTuple=True) ''' cmd = self._getCmd(self._cmdExtractText, filePath, encoding) out, err = self._execute(cmd, encoding) return out, err # =========== # = PRIVATE = # =========== _cmdExtractMetadata = &quot;${JAVA_HOME}/bin/java -jar ${TIKALIB_PATH} --metadata ${FILE_PATH}&quot; _cmdExtractText = &quot;${JAVA_HOME}/bin/java -jar ${TIKALIB_PATH} --encoding=${ENCODING} --text ${FILE_PATH}&quot; def _getCmd(self, cmdModel, filePath, encoding): cmd = cmdModel.replace(&quot;${JAVA_HOME}&quot;, self.java_home) cmd = cmd.replace(&quot;${TIKALIB_PATH}&quot;, self.tika_lib_path) cmd = cmd.replace(&quot;${ENCODING}&quot;, encoding) cmd = cmd.replace(&quot;${FILE_PATH}&quot;, filePath) return cmd def _execute(self, cmd, encoding): import subprocess process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = process.communicate() out = out.decode(encoding=encoding) err = err.decode(encoding=encoding) return out, err </code></pre>
6,397
<p>I have an Ender 3, I got a new glass bed, the bed comes with glue on the back.</p> <p>Should I stick the glass bed to the aluminium base? or just use it with the clips? I saw other people just use the clips, but my glass seems to have a sticky back...</p> <p><a href="https://i.stack.imgur.com/iq7WD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iq7WD.jpg" alt="enter image description here"></a></p>
<p>This is opinion-based, but the volcano has drawbacks that affect print quality, mine is oozier and sloppier than a V6 with the shorter, more precise melt zone. It isn’t a slam dunk upgrade, more of a special applications part. I think there is no point to using a Volcano unless you’re running big nozzles fast, like .8 mm.</p> <p>Your 5 mm<sup>3</sup>/s throughput is low, the V6 is generally known as a ~13 mm<sup>3</sup>/s volumetric throughput, vs the Volcano at 25 mm<sup>3</sup>/s. This is due to the low temperature you favor, possibly something not ideal with your extruder. I could see...</p> <ul> <li><p>just living with the slow speed. I realize I vastly prefer print quality over print speed because one takes no human interaction and the other does.</p> </li> <li><p>do what everyone else does. go hotter, plastic viscosity goes way down even with a 5-10 degree increase</p> </li> <li><p>increase extruder torque. If you can increase stepper current safely (know the limit for your driver and motor!) with a trim pot on the stepper driver, you may be able to get more torque before the motor skips steps. This can increase motor temperature. If you get more torque, at some point the filament will slip and get carved up by the extruder’s hobbed gear. Double geared extruder designs like Bondtech can grip the filament from both sides and get more traction on the filament if you want to get diabolical shoving the filament.</p> </li> <li><p>use a larger nozzle for faster printing at your preferred temp. I’m loving the .6 mm nozzle for bigger prints. It has most of the detail of the .4 mm but double the plastic comes out. A larger nozzle hole means less pressure in the nozzle at a given temp and extruder feed rate</p> </li> </ul> <p>If you think the extruder might not be all it can be, try heating up the nozzle hotter than usual, and get the extruder going slow and steady, and pull a little on the filament by hand, see if it skips steps easily with a little resistance. It should pull pretty strong. I had a failing wire to my extruder that manifested in wimpy extrusion.</p>
<p>Yes, the Volcano or the Super Volcano allow for larger flow rate (typically when using larger nozzles), that is where they were designed for. Just the nozzle will not help you, you need this larger nozzle shaft to be inside a Volcano heater block, else you cannot transfer the heat.</p> <p>According to measurements from Metaform, the volumetric flow of a Volcano hotend is larger than the regular E3D V6 hotend.</p> <p><a href="https://i.stack.imgur.com/5p6Le.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5p6Le.png" alt="enter image description here" /></a></p>
1,652
<p>I have a bunch of files (TV episodes, although that is fairly arbitrary) that I want to check match a specific naming/organisation scheme..</p> <p>Currently: I have three arrays of regex, one for valid filenames, one for files missing an episode name, and one for valid paths.</p> <p>Then, I loop though each valid-filename regex, if it matches, append it to a "valid" dict, if not, do the same with the missing-ep-name regexs, if it matches this I append it to an "invalid" dict with an error code (2:'missing epsiode name'), if it matches neither, it gets added to invalid with the 'malformed name' error code.</p> <p>The current code can be found <a href="http://github.com/dbr/checktveps/tree/8a6dc68ad61e684c8d8f0ca1dc37a22d1c51aa82/2checkTvEps.py" rel="nofollow noreferrer">here</a></p> <p>I want to add a rule that checks for the presence of a folder.jpg file in each directory, but to add this would make the code substantially more messy in it's current state.. </p> <p>How could I write this system in a more expandable way?</p> <p>The rules it needs to check would be..</p> <ul> <li>File is in the format <code>Show Name - [01x23] - Episode Name.avi</code> or <code>Show Name - [01xSpecial02] - Special Name.avi</code> or <code>Show Name - [01xExtra01] - Extra Name.avi</code></li> <li>If filename is in the format <code>Show Name - [01x23].avi</code> display it a 'missing episode name' section of the output</li> <li>The path should be in the format <code>Show Name/season 2/the_file.avi</code> (where season 2 should be the correct season number in the filename)</li> <li>each <code>Show Name/season 1/</code> folder should contain "folder.jpg"</li> </ul> <p>.any ideas? While I'm trying to check TV episodes, this concept/code should be able to apply to many things..</p> <p>The only thought I had was a list of dicts in the format:</p> <pre><code>checker = [ { 'name':'valid files', 'type':'file', 'function':check_valid(), # runs check_valid() on all files 'status':0 # if it returns True, this is the status the file gets } </code></pre>
<blockquote> <p>I want to add a rule that checks for the presence of a folder.jpg file in each directory, but to add this would make the code substantially more messy in it's current state..</p> </blockquote> <p>This doesn't look bad. In fact your current code does it very nicely, and Sven mentioned a good way to do it as well:</p> <ol> <li>Get a list of all the files</li> <li>Check for "required" files</li> </ol> <p>You would just have have add to your dictionary a list of required files:</p> <pre><code>checker = { ... 'required': ['file', 'list', 'for_required'] } </code></pre> <p>As far as there being a better/extensible way to do this? I am not exactly sure. I could only really think of a way to possibly drop the "multiple" regular expressions and build off of Sven's idea for using a delimiter. So my strategy would be defining a dictionary as follows (and I'm sorry I don't know Python syntax and I'm a tad to lazy to look it up but it should make sense. The /regex/ is shorthand for a regex):</p> <pre><code>check_dict = { 'delim' : /\-/, 'parts' : [ 'Show Name', 'Episode Name', 'Episode Number' ], 'patterns' : [/valid name/, /valid episode name/, /valid number/ ], 'required' : ['list', 'of', 'files'], 'ignored' : ['.*', 'hidden.txt'], 'start_dir': '/path/to/dir/to/test/' } </code></pre> <ol> <li>Split the filename based on the delimiter.</li> <li>Check each of the parts.</li> </ol> <p>Because its an ordered list you can determine what parts are missing and if a section doesn't match any pattern it is malformed. Here the <code>parts</code> and <code>patterns</code> have a 1 to 1 ratio. Two arrays instead of a dictionary enforces the order.</p> <p>Ignored and required files can be listed. The <code>.</code> and <code>..</code> files should probably be ignored automatically. The user should be allowed to input "globs" which can be shell expanded. I'm thinking here of <code>svn:ignore</code> properties, but globbing is natural for listing files.</p> <p>Here <code>start_dir</code> would be default to the current directory but if you wanted a single file to run automated testing of a bunch of directories this would be useful.</p> <p>The real loose end here is the path template and along the same lines what path is required for "valid files". I really couldn't come up with a solid idea without writing one large regular expression and taking groups from it... to build a template. It felt a lot like writing a TextMate language grammar. But that starts to stray on the ease of use. The real problem was that the path template was not composed of <code>parts</code>, which makes sense but adds complexity.</p> <p>Is this strategy in tune with what you were thinking of?</p>
<p>maybe you should take the approach of defaulting to: "the filename is correct" and work from there to disprove that statement:</p> <p>with the fact that you only allow filenames with: 'show name', 'season number x episode number' and 'episode name', you know for certain that these items should be separated by a "-" (dash) so you have to have 2 of those for a filename to be correct.<br> if that checks out, you can use your code to check that the show name matches the show name as seen in the parent's parent folder (case insensitive i assume), the season number matches the parents folder numeric value (with or without an extra 0 prepended).</p> <p>if however you don't see the correct amount of dashes you instantly know that there is something wrong and stop before the rest of the tests etc.</p> <p>and separately you can check if the file <code>folder.jpg</code> exists and take the necessary actions. <strong>or</strong> do that first and filter that file from the rest of the files in that folder.</p>
3,953
<p>Convert a .doc or .pdf to an image and display a thumbnail in Ruby?<br> Does anyone know how to generate document thumbnails in Ruby (or C, python...)</p>
<p>A simple RMagick example to convert a PDF to a PNG would be:</p> <pre><code>require 'RMagick' pdf = Magick::ImageList.new("doc.pdf") thumb = pdf.scale(300, 300) thumb.write "doc.png" </code></pre> <p>To convert a MS Word document, it won't be as easy. Your best option may be to first convert it to a PDF before generating the thumbnail. Your options for generating the PDF depend heavily on the OS you're running on. One might be to use OpenOffice and the <a href="http://www.artofsolving.com/opensource/pyodconverter" rel="noreferrer">Python Open Document Converter</a>. There are also online conversion services you could try, including <a href="http://Zamzar.com" rel="noreferrer">http://Zamzar.com</a>.</p>
<p>Not sure about .doc support in any open source library but ImageMagick (and the RMagick gem) can be compiled with pdf support (I think it's on by default)</p>
9,101
<p>At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process we have been discussing with the team of the other application about the structure of the XML file. </p> <p>The sample I came up with is essentially something like:</p> <pre><code>&lt;INVENTORY&gt; &lt;ITEM serialNumber="something" location="something" barcode="something"&gt; &lt;TYPE modelNumber="something" vendor="something"/&gt; &lt;/ITEM&gt; &lt;/INVENTORY&gt; </code></pre> <p>The other team said that this was not industry standard and that attributes should only be used for meta data. They suggested:</p> <pre><code>&lt;INVENTORY&gt; &lt;ITEM&gt; &lt;SERIALNUMBER&gt;something&lt;/SERIALNUMBER&gt; &lt;LOCATION&gt;something&lt;/LOCATION&gt; &lt;BARCODE&gt;something&lt;/BARCODE&gt; &lt;TYPE&gt; &lt;MODELNUMBER&gt;something&lt;/MODELNUMBER&gt; &lt;VENDOR&gt;something&lt;/VENDOR&gt; &lt;/TYPE&gt; &lt;/ITEM&gt; &lt;/INVENTORY&gt; </code></pre> <p>The reason I suggested the first is that the size of the file created is much smaller. There will be roughly 80000 items that will be in the file during transfer. Their suggestion in reality turns out to be three times larger than the one I suggested. I searched for the mysterious "Industry Standard" that was mentioned, but the closest I could find was that XML attributes should only be used for meta data, but said the debate was about what was actually meta data.</p> <p>After the long winded explanation (sorry) how do you determine what is meta data, and when designing the structure of an XML document how should you decide when to use an attribute or an element?</p>
<p>I use this rule of thumb:</p> <ol> <li>An Attribute is something that is self-contained, i.e., a color, an ID, a name.</li> <li>An Element is something that does or could have attributes of its own or contain other elements.</li> </ol> <p>So yours is close. I would have done something like:</p> <p><strong>EDIT</strong>: Updated the original example based on feedback below.</p> <pre><code> &lt;ITEM serialNumber="something"&gt; &lt;BARCODE encoding="Code39"&gt;something&lt;/BARCODE&gt; &lt;LOCATION&gt;XYX&lt;/LOCATION&gt; &lt;TYPE modelNumber="something"&gt; &lt;VENDOR&gt;YYZ&lt;/VENDOR&gt; &lt;/TYPE&gt; &lt;/ITEM&gt; </code></pre>
<p>I agree with feenster. Stay away from attributes if you can. Elements are evolution friendly and more interoperable between web service toolkits. You'd never find these toolkits serializing your request/response messages using attributes. This also makes sense since our messages are data (not metadata) for a web service toolkit.</p>
5,383
<p>Can you provide a good example of rule definition language written in C#.<br> Java guys have <a href="http://herzberg.ca.sandia.gov/" rel="noreferrer">JESS</a>, is there anything good for C#?</p>
<p>This page shows some examples of open-source rules engines in C#: <a href="http://csharp-source.net/open-source/rule-engines" rel="noreferrer">http://csharp-source.net/open-source/rule-engines</a></p>
<p>There is the Microsoft Business Rules Engine: <a href="http://msdn.microsoft.com/en-us/library/aa561216.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa561216.aspx</a>. Not sure if it can only be used inside Biztalk - it does says it is a .Net Class Library.</p>
6,540
<p>Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output?<br> I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. </p> <p>Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was missing something important in the process or it is just way too involved.</p> <p>I know somebody out there has a really nice dead-simple solution.</p> <p>I'm reiterating here because I think my formatting made that paragraph non-inviting to read:</p> <blockquote> <p>I gave sandcastle a try but had a really hard time getting it set up. What I really have in mind is something much simpler.</p> </blockquote> <p>That is, unless I just don't understand the sandcastle process. It seemed like an awful lot of extra baggage to me just to produce something nice for the testers to work with.</p>
<p>You're looking for Sandcastle</p> <p>Project Page: <a href="http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx" rel="noreferrer">Sandcastle Releases</a></p> <p>Blog: <a href="http://blogs.msdn.com/sandcastle/default.aspx" rel="noreferrer">Sandcastle Blog</a></p> <p><a href="http://ndoc.sourceforge.net" rel="noreferrer">NDoc Code Documentation Generator for .NET</a> used to be the tool of choice, but support has all but stopped.</p>
<p>Follow <a href="http://saftsack.fs.uni-bayreuth.de/~dun3/archives/integrate-xml-code-comments-into-visual-studio-20052008-using-sandcastle-and-html-help-20/150.html" rel="nofollow noreferrer">this simple 5 step article</a> and you are pretty much done. As a bonus you can use <a href="http://www.helpware.net/mshelp2/h2viewer.htm" rel="nofollow noreferrer">H2Viewer</a> to view Html Help 2.x files.</p>
2,329
<p>I have the following tables in my database that have a many-to-many relationship, which is expressed by a connecting table that has foreign keys to the primary keys of each of the main tables:</p> <ul> <li>Widget: WidgetID (PK), Title, Price </li> <li>User: UserID (PK), FirstName, LastName</li> </ul> <p>Assume that each User-Widget combination is unique. I can see two options for how to structure the connecting table that defines the data relationship:</p> <ol> <li>UserWidgets1: UserWidgetID (PK), WidgetID (FK), UserID (FK) </li> <li>UserWidgets2: WidgetID (PK, FK), UserID (PK, FK)</li> </ol> <p>Option 1 has a single column for the Primary Key. However, this seems unnecessary since the only data being stored in the table is the relationship between the two primary tables, and this relationship itself can form a unique key. Thus leading to option 2, which has a two-column primary key, but loses the one-column unique identifier that option 1 has. I could also optionally add a two-column unique index (WidgetID, UserID) to the first table.</p> <p>Is there any real difference between the two performance-wise, or any reason to prefer one approach over the other for structuring the UserWidgets many-to-many table?</p>
<p>You only have one primary key in either case. The second one is what's called a compound key. There's no good reason for introducing a new column. In practise, you will have to keep a unique index on all candidate keys. Adding a new column buys you nothing but maintenance overhead.</p> <p>Go with option 2.</p>
<p>Since each User-Widget combination is unique, you should represent that in your table by making the combination unique. In other words, go with option 2. Otherwise you may have two entries with the same widget and user IDs but different user-widget IDs.</p>
5,986
<p>Does anyone have any recommendations of tools that can be of assistance with moving literal values into resource files for localization?</p> <p>I've used a resharper plugin called RGreatX but was wondering if there is anything else out there.</p> <p>It's one heck of a long manual process for moving the strings across and think there must be a better way! RGreatX is OK but could be a bit slicker I feel.</p>
<p>Here's one:</p> <p><a href="http://www.codeplex.com/ResourceRefactoring" rel="noreferrer">http://www.codeplex.com/ResourceRefactoring</a></p> <p>It'a actually a Microsoft "open source" Visual Studio(2005 and up) tool that integrates with the IDE. You can easily replace every occurence of a string with a ressource reference with a few clicks.</p>
<p>Try <a href="https://visuallocalizer.codeplex.com" rel="nofollow">Visual Localizer</a> - you can batch-process whole code, select which strings may be localized and the tool will add them to a resource file and create a reference instead. Many other features easing localization are included.</p>
3,591
<p>Once I have my renamed files I need to add them to my project's wiki page. This is a fairly repetitive manual task, so I guess I could script it but I don't know where to start.</p> <p>The process is:</p> <pre><code>Got to appropriate page on the wiki for each team member (DeveloperA, DeveloperB, DeveloperC) { for each of two files ('*_current.jpg', '*_lastweek.jpg') { Select 'Attach' link on page Select the 'manage' link next to the file to be updated Click 'Browse' button Browse to the relevant file (which has the same name as the previous version) Click 'Upload file' button } } </code></pre> <p>Not necessarily looking for the full solution as I'd like to give it a go myself.</p> <p>Where to begin? What language could I use to do this and how difficult would it be?</p>
<p>Check if the wiki you mean to talk to supports <a href="http://www.jspwiki.org/wiki/WikiRPCInterface2" rel="nofollow noreferrer">XMLRPC</a>, because if it does it should be a snap. I wrote a tool called <a href="http://trac.gargoyle.ath.cx/trac/wiki/WikiUp" rel="nofollow noreferrer">WikiUp</a> to solve a similar problem (updating a delineated section on a wiki page). </p>
<p>If you're writing in C#, the WebClient classes might be a good place to start. I bet people could give more specific advice if you mentioned which wiki platform you are using, and whether it requires authentication, though.</p> <p>I'd probably start by downloading fiddler and watching the http requests from doing it manually. Then you could use some simple scripts and regexes to build your http requests for automating the process.</p> <p>Of course, if your wildly lucky, your wiki would have a backend simple enough that you could just plug them into its db directly. :)</p>
3,347
<p>I've got a Monoprice Mini Select (15365) and it takes FOREVER for me to manually spin the dial to get the printhead to raise all the way up so that I can perform maintenance (clear blockages in the nozzle or apply new tape to the bed, etc).</p> <p>So, I was thinking about writing a snippet of gcode that I could just run which would contain the commands necessary to do that for me. I'm a n00b to 3D printing, but I'm an old programmer so I figured it would be too hard. However, before running this code on my printer, I wanted to get some experts to double check me to make sure I'm not going to hurt anything. :)</p> <p>Here is what I have, please let me know if I've done anything wrong or if you have any suggestions.</p> <pre><code>; Move print head to center and top to prepare for cleaning/maintenance M107 ; fan off G28 ; home all axes G21 ; set units to millimeters G90 ; use absolute coordinates ; full dimensions of the print area are 120mm x 120mm x 120mm G0 X60 Y60 Z119 ; move to center X,Y and just below the max height M84 ; disable motors </code></pre> <p>I grabbed a few lines from gcode generated by Slic3r and used the gcode wiki entry to understand each of the commands and fill in the extra ones I needed.</p>
<p>Yes, on machines which will execute "standard" gcode, this will do what you request. Some good resources are <a href="http://reprap.org/wiki/G-code">http://reprap.org/wiki/G-code</a> and <a href="https://en.wikipedia.org/wiki/G-code">https://en.wikipedia.org/wiki/G-code</a></p>
<p>It really depends on whether you currently have something half printed on the bed when you need to do maintenance. For example, you may have a blockage mid-print or need to reprime the nozzle. </p> <p>So with that in mind, personally I would separate the line that does the move into two different lines. </p> <p>Move vertically first, then in X Y. Otherwise, the print head may move diagonally and hit your object. This is because the head will move all three axes at once.</p> <p>Otherwise looks good.</p> <p>Edit: Another suggestion is that if you use repetier host to control the printer it will be easier to return to the print in-progress automatically.</p> <p>Also take a look at the S parameter, for moves it can control how fast the move is.</p>
494
<p>I'm experimenting with creating an add-in for Infopath 2007. The documentation is very skimpy. What I'm trying to determine is what kind of actions an add-in can take while designing a form. Most of the discussion and samples are for when the user is filling out the form. Can I, for example, add a new field to the form in the designer? Add a new item to the schema? Move a form field on the design surface? It doesn't appear so, but I can't find anything definitive.</p>
<p>What are you hoping to end up with at the end? The body, the subject, the sender, an attachment? You should spend some time with <a href="http://www.faqs.org/rfcs/rfc2822.html" rel="noreferrer">RFC2822</a> to understand the format of the mail, but here's the simplest rules for well formed email:</p> <pre><code>HEADERS\n \n BODY </code></pre> <p>That is, the first blank line (double newline) is the separator between the HEADERS and the BODY. A HEADER looks like this:</p> <pre><code>HSTRING:HTEXT </code></pre> <p>HSTRING always starts at the beginning of a line and doesn't contain any white space or colons. HTEXT can contain a wide variety of text, including newlines as long as the newline char is followed by whitespace.</p> <p>The "BODY" is really just any data that follows the first double newline. (There are different rules if you are transmitting mail via SMTP, but processing it over a pipe you don't have to worry about that).</p> <p>So, in really simple, circa-1982 <a href="http://www.faqs.org/rfcs/rfc822.html" rel="noreferrer">RFC822</a> terms, an email looks like this:</p> <pre><code>HEADER: HEADER TEXT HEADER: MORE HEADER TEXT INCLUDING A LINE CONTINUATION HEADER: LAST HEADER THIS IS ANY ARBITRARY DATA (FOR THE MOST PART) </code></pre> <p>Most modern email is more complex than that though. Headers can be encoded for charsets or <a href="http://www.faqs.org/rfcs/rfc2047.html" rel="noreferrer">RFC2047</a> mime words, or a ton of other stuff I'm not thinking of right now. The bodies are really hard to roll your own code for these days to if you want them to be meaningful. Almost all email that's generated by an MUA will be <a href="http://www.faqs.org/rfcs/rfc2045.html" rel="noreferrer">MIME</a> encoded. That might be uuencoded text, it might be html, it might be a uuencoded excel spreadsheet.</p> <p>I hope this helps provide a framework for understanding some of the very elemental buckets of email. If you provide more background on what you are trying to do with the data I (or someone else) might be able to provide better direction.</p>
<p>yeah, ive been able to write a basic parser, based off that rfc and some other basic tutorials. but its the multipart mime nested boundaries that keep messing me up.</p> <p>i found out that MMS (not SMS) messages sent from my phone are just standard emails, so i have a system that reads the incoming email, checks the from (to only allow from my phone), and uses the body part to run different commands on my server. its sort of like a remote control by email.</p> <p>because the system is designed to send pictures, its got a bunch of differently encoded parts. a mms.smil.txt part, a text/plain (which is useless, just says 'this is a html message'), a application/smil part (which the part that phones would pic up on), a text/html part with a advertisement for my carrier, then my message, but all wrapped in html, then finally a textfile attachment with my plain message (which is the part i use) (if i shove an image as an attachment in the message, its put at attachment 1, base64 encoded, then my text portion is attached as attachment 2)</p> <p>i had it working with the exact mail format from my carrier, but when i ran a message from someone elses phone through it, it failed in a whole bunch of miserable ways.</p> <p>i have other projects i'd like to extend this phone->mail->parse->command system to, but i need to have a stable/solid/generic parser to get the different parts out of the mail to use it.</p> <p>my end goal would be to have a function that i could feed the raw piped mail into, and get back a big array with associative sub-arrays of headers var:val pairs, and one for the body text as a whole string</p> <p>the more and more i search on this, the more i find the same thing: giant overdeveloped mail handling packages that do everything under the sun thats related to mails, or useless (to me, in this project) tutorials.</p> <p>i think i'm going to have to bite the bullet and just carefully write something my self.</p>
3,398
<p>I have a page results page (you get there after submitting your search query elsewhere) whit a whole bunch of gridviews for different type of data objects.</p> <p>Obviously, some of the queries take longer than the others. How can I make each gridview render as soon as it has the data it needs?</p> <p>This has been tricky for me because it must work on a postback as well as a pageload. Also, the object data sources just fire automatically on page load/postback; I'm not calling any methods programatically to get the data. Will I have to change this? </p>
<p>@Gareth Jenkins</p> <p>The page will execute all of the queries before returning even the first update panel, so he won't save any time there.</p> <p>The trick to do this is to move each of your complex gridviews into a user control, in the user control, get rid of the Object DataSource crap, and do your binding in the code behind.</p> <p>Write your bind code so that it only binds in this situation: </p> <pre><code>if (this.isPostBack &amp;&amp; ScriptManager.IsInAsyncPostback) </code></pre> <p>Then, in the page, programaticly refresh the update panel using javascript once the page has loaded, and you'll get each individual gridview rendering once its ready.</p>
<p>Could you put the DataGrids inside panels that have their visibility set to false, then call a client-side javascript function from the body's onload event that calls a server side function that sets the visibility of the panels to true?</p> <p>If you combined this with an asp:updateProgress control and wrapped the whole thing in an UpdatePanel, you should get something close to what you're looking for - especially if you rigged the js function called in onload to only show one panel and call a return function that showed the next etc.</p>
8,425
<p>I recently got an Ender 3 Pro for my birthday, and I am having some problems with elephant's foot (as the title suggests). I have tried several fixes; lowering the print speed, changing the print micron size (quality) in my slicer, and I have also tried the masking tape trick (it definitely does not work). I want to know if there are any other ways to prevent elephant's foot on my prints. I first noticed it on a game-cartridge holder. It was four and a half millimeters thick on the bottom. I think that it could be an issue with the design, but I'm not entirely sure. I can send the specs for the design if you want to look at them.</p>
<p>Elephant's foot can be caused by different causes.</p> <ul> <li>Incorrect leveling or incorrect nozzle to bed distance<br><a href="https://3dprinting.stackexchange.com/a/15993/">This answer</a> describes that it can be caused by a too low nozzle to bed distance.</li> <li>Bed temperature<br>A too high bed temperature and weight of the print can cause bulging out of the bottom layers. This also frequently occurs as the result of an uncooled/too less cooled first layer.</li> </ul> <p>Improved cooling, lowering bed temperature or adjusting nozzle to bed distance and proper leveling are the most obvious solutions to fight this problem. Other solution can be found in using chamfers on the bottom of the print (requires modifying the model) or printing on a raft, this latter solution does lead to losing the nice bottom layer finish.</p>
<p>Elephant foot on an FDM machine is typically caused by more material (filament) being present in that layer than it has space for.</p> <p>The most common cause of this is your z-zero is too low, so for the first layer the nozzle starts too close to the bed and the filament gets &quot;squeezed&quot; laterally. You can try adjusting your z-zero or z-stop to allow slightly more space, fractions of a millimeter, between the nozzle and bed for your first layer.</p> <p>If you don't want to try that, or you'd like to try a different solution first, consider printing the part on a raft so that it starts raised up off the bed and away from that elephant-footing.</p> <p>There are a handful of other potential causes and factors which can make this better or worse, things like having a large footprint on the bed, but I hope the above is a quick and easy place to start.</p>
1,908
<p>I have a Tevo Tarantula with a MKS Base 1.5 board and dual extruders. I am running Marlin RC8 Tevo Community build for the dual extruder, large bed and SN04 sensor. </p> <p>All temperature sensors work and give accurate reading but <code>E1</code> when activated runs at 100% until the overtemps kicks in and shuts down the system. Like I said, it reads proper temperatures through the thermistor it just won’t stop at the set temperature. I checked the MOSFET and there is no obvious scorching or bad solder joints on the MKS board. This leads me to believe it is a mix-up in firmware but, being a bit of a newbie on this, I am still getting familiar with G-code and Marlin.</p> <p>I have confirmed the correct board is being referenced in firmware from <code>boards.h</code> but looking at <code>configuration.h</code> I just get confused. What I am thinking is somehow/somewhere <code>E1</code> might be referenced as a fan that is just off or on. Anybody have ideas?</p>
<p>I am not sure what the hardware config is for the <strong>Tevo Tarantula</strong></p> <p>Make sure your <code>configuration.h</code> file is setup for your hardware. The extruder defines are describe in <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Conditionals_LCD.h" rel="nofollow noreferrer">Conditional_LCD.h</a></p> <p>It looks like the <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Configuration.h" rel="nofollow noreferrer">configuration.h file</a> on GitHub is configured for a single extruder.</p> <p>For example, if you have 2 hotends; but, "HOTENDS=2" is not set then the I/O will not be configured for the 2nd hotend. I just looked at the code and if <code>HOTENDS == 1</code> then the <code>MOSFET_D_PIN</code> will be used to control FAN1 (which sounds very similar to what you are describing that you are seeing).</p> <pre><code> #if HOTENDS == 1 #define FAN1_PIN MOSFET_D_PIN #else #define HEATER_1_PIN MOSFET_D_PIN #endif </code></pre>
<p>So, following on from <a href="https://3dprinting.stackexchange.com/questions/4177/dual-extruder-setup-in-marlin/4179#4179">Mark's answer</a>, in <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Conditionals_LCD.h#L298" rel="nofollow noreferrer">line 298</a> of <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Conditionals_LCD.h" rel="nofollow noreferrer">Conditional_LCD.h</a>, you would need to change:</p> <pre><code>#define HOTENDS 1 </code></pre> <p>to</p> <pre><code>#define HOTENDS 2 </code></pre>
616
<p><strong><em>Edit:</em></strong> This question had been tagged "Tolstoy" in appreciation of the quality and length of my writing:) Just reading the first and the last paragraph should be enough:) If you tend to select and move code with the mouse, the stuff in middle could be interesting to you.</p> <p>This question is about how you use text editors in general. I’m looking for the best way to <em>delete</em> a plurality of lines of code (no intent to patent it:) This extends to <em>transposing</em> lines, i.e. deleting and adding them somewhere else. Most importantly, I don’t want to be creating any blank lines that I have to delete separately. Sort of like Visual Studio's SHIFT+DELETE feature, but working for multiple lines at once.</p> <p>Say you want to delete line 3 from following code (tabs and newlines visualized as well). The naïve way would be to select the text between angle brackets:</p> <pre> if (true) {\n \t int i = 1;\n \t &lt;i *= 2;&gt;\n \t i += 3;\n }\n </pre> <p>Then hit backspace. This creates a blank line. Hit backspace twice more to delete \t and \n. </p> <p>You end up with:</p> <pre> if (true) {\n \t int i = 1;\n \t i += 3;\n }\n </pre> <p>When you try to select a whole line, Visual Studio doesn't let you select the trailing newline character. For example, placing the cursor on a line and hitting SHIFT+END will not select the newline at the end. Neither will you select the newline if you use your mouse, i.e. clicking in the middle of a line and dragging the cursor all the way to the right. You only select the trailing newline characters if you make a selection that spans at least two lines. Most editors I use do it this way; Microsoft WordPad and Word are counter-examples (and I frequently get newlines wrong when deleting text there; at least Word has a way to display end-of-line and end-of-paragraph characters explicitly).</p> <p>When using Visual Studio and other editors in general, here’s the solution that currently works best for me:</p> <p>Using the mouse, I select the characters that I put between angle brackets:</p> <pre> if (true) {\n \t int i = 1;&lt;\n \t i *= 2;&gt;\n \t i += 3;\n }\n </pre> <p>Hitting backspace now, you delete the line in one go without having to delete any other characters. This works for several contiguous lines at once. Additionally, it can be used for transposing lines. You could drag the selection between the angle brackets to the point marked with a caret:</p> <pre> if (true) {\n \t int i = 1;&lt;\n \t i *= 2;&gt;\n \t i += 3;^\n }\n </pre> <p>This leaves you with:</p> <pre> if (true) {\n \t int i = 1;\n \t i += 3;&lt;\n \t i *= 2;&gt;\n }\n </pre> <p>where lines 3 and 4 have switched place.</p> <p>There are variations on this theme. When you want to delete line 3, you could also select the following characters:</p> <pre> if (true) {\n \t int i = 1;\n &lt;\t i *= 2;\n &gt;\t i += 3;\n }\n </pre> <p>In fact, this is what Visual Studio does if you tell it to select a complete line. You do this by clicking in the margin between your code and the column where the red circles go which indicate breakpoints. The mouse pointer is mirrored in that area to distinguish it a little better, but I think it's too narrow and physically too far removed from the code I want to select.</p> <p>Maybe this method is useful to other people as well, even if it only serves to make them aware of how newlines are handled when selecting/deleting text:) It works nicely for most non-specialized text editors. However, given the vast amount of features and plugins for Visual Studio (which I use most), I'm sure there is better way to use it to delete and move lines of code. Getting the indentation right automatically when moving code between different blocks would be nice (i.e. without hitting "Format Document/Selection"). I'm looking forward to suggestions; no rants on micro-optimization, please:)</p> <hr> <p><strong><em>Summary of Answers</em></strong></p> <p>With respect to Visual Studio: Navigating well with the cursor keys.</p> <p>The solution that would best suit my style of going over and editing code is the <em>Eclipse</em> way:</p> <p>You can select several consecutive lines of code, where the first and the last selected line may be selected only partially. Pressing ALT+{up,down} moves the complete lines (not just the selection) up and down, fixing indentation as you go. Hitting CTRL+D deletes the lines completely (not just the selection) without leaving any unwanted blank lines. I would love to see this in Visual Studio!</p>
<p>In Emacs:</p> <ul> <li>kill-line C-k </li> <li>transpose-lines C-x C-t</li> </ul> <p>C-a C-k C-k -- kill whole line including newline (or <code>kill-whole-line</code> by C-S-backspace).</p> <p>C-u &lt;number> C-k -- kill &lt;number> of lines (including newlines).</p> <p>C-y -- yank back the most recently killed text (aka paste)</p>
<p>Using the <strong>Brief</strong> keyboard mapping this is done using the <strong><kbd>Alt</kbd>+<kbd>L</kbd></strong> to mark the line and the <strong><kbd>-</kbd></strong> key on the numeric keypad (or <strong><kbd>Alt</kbd>+<kbd>D</kbd></strong>) to cut the line to clipboard. The cut will remove the line entirely, including the newline character.</p> <p>Hitting the <strong><kbd>Ins</kbd></strong> key on the numeric keypad would put the line back into the document including the newline character. </p> <p>IMHO <strong>Brief</strong> is a really well designed keyboard mapping.</p> <p><strong>PS:</strong> I think MSVC has an option to emulate the Brief keyboard mapping.</p>
8,568
<p>I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. </p> <p>In C#, I would use an out parameter for the string, but there is no equivalent in Python. I'm still very new to Python and the only thing I can think of is to return a tuple with the boolean and modified string.</p> <p>Related question: <a href="https://stackoverflow.com/questions/61605/is-it-pythonic-for-a-function-to-return-multiple-values">Is it pythonic for a function to return multiple values?</a></p>
<pre><code>def f(in_str): out_str = in_str.upper() return True, out_str # Creates tuple automatically succeeded, b = f("a") # Automatic tuple unpacking </code></pre>
<p>You can use return statement with multiple expressions</p>
5,941
<p>I'm trying to fetch Wikipedia pages using <a href="http://search.cpan.org/dist/libwww-perl" rel="noreferrer">LWP::Simple</a>, but they're not coming back. This code:</p> <pre><code>#!/usr/bin/perl use strict; use LWP::Simple; print get("http://en.wikipedia.org/wiki/Stack_overflow"); </code></pre> <p>doesn't print anything. But if I use some other webpage, say <code><a href="http://www.google.com" rel="noreferrer">http://www.google.com</a></code>, it works fine. </p> <p>Is there some other name that I should be using to refer to Wikipedia pages? </p> <p>What could be going on here?</p>
<p>Apparently Wikipedia blocks LWP::Simple requests: <a href="http://www.perlmonks.org/?node_id=695886" rel="noreferrer">http://www.perlmonks.org/?node_id=695886</a></p> <p>The following works instead:</p> <pre><code>#!/usr/bin/perl use strict; use LWP::UserAgent; my $url = "http://en.wikipedia.org/wiki/Stack_overflow"; my $ua = LWP::UserAgent-&gt;new(); my $res = $ua-&gt;get($url); print $res-&gt;content; </code></pre>
<p>Because Wikipedia is blocking the HTTP user-agent string used by LWP::Simple.</p> <p>You will get a "403 Forbidden"-response if you try using it.</p> <p>Try the LWP::UserAgent module to work around this, setting the agent-attribute.</p>
4,417
<p>I am trying to slice a model that is half a mm less than max width, but not successful.</p> <p><a href="https://i.stack.imgur.com/puSzw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/puSzw.png" alt="enter image description here"></a></p> <p>What am I missing? Is there some minimum value less than maximum allowed, or something?</p> <p><strike><strong>Edit</strong>: after changing the width to 220 in machine settings, slicing works.</strike> This is a dangerous thing to do, as it <em>could</em> damage the printer.</p>
<p>Take a look at this post: <a href="https://community.ultimaker.com/topic/15588-cura-23-not-using-full-print-area/" rel="nofollow noreferrer">https://community.ultimaker.com/topic/15588-cura-23-not-using-full-print-area/</a>. As the raft/skirt/brim will fall outside of the build volume, Cura is not able to slice it. Look at the the answer by @ahouben. He suggests that if you want to use the maximum build volume : </p> <blockquote> <ul> <li><p>adhesion type = brim</p></li> <li><p>brim line count = 0</p></li> <li><p>travel avoid distance = 0</p></li> <li><p>horizontal expansion = 0</p></li> <li><p>support horizontal expansion = 0 (if support is enabled)</p></li> <li><p>draft shield disabled</p></li> <li><p>ooze shield disabled</p></li> <li><p>infill wipe distance = 0</p></li> </ul> <p>Note that in most cases brim with brim line count=0 will get you most of the way there</p> </blockquote> <p>Try this and see if it makes a difference.</p>
<p><a href="/a/10566">This answer</a> already addresses that Ultimaker Cura "eats up" platform space for e.g. skirt, brim, raft, dual extruder, deposition of priming blob, prime towers, etc. Disabling those features will reclaim platform space so you can print larger prints. <strong><em>However, that will only work when your printer is correctly configured!</em></strong> E.g. the center of the bed needs to be the center of the center in the slicer which needs to have the specific sizes of the bed dimensions. Note that increasing the bed size past the actual dimensions is not considered to be a nice solution, it is an easy work-around that gives you extra space in X<sup>+</sup> and Y<sup>+</sup>, i.e. it does not center this newly created space, furthermore, this can destroy your printer is there is tight space left on those axes! Let's illustrate that with an example, if you have a 200x200&nbsp;mm build plate and want to slice something of size 200x200&nbsp;mm, this should be centered around (100, 100), if you change the bed size to 220x220&nbsp;mm, Ultimaker Cura will center the print around (110, 110) which means that the print maximum coordinates are 210&nbsp;mm; this is outside the bed area and potentially can destroy your printer!</p> <p>What you should check is if the physical center of your bed actually is the center as defined by the firmware of the printer (surprisingly, many of the cheaper printer have this incorrectly configured). The answers on question <a href="/q/6375"><em>"How to center my prints on the build platform?"</em> (Re-calibrate homing offset)</a> describe how you could do that.</p>
1,406
<p>I am printing using an Ender3 Pro with eSUN PLA+ 215/45 and I am getting this issue on two corners, the other two corners look fine.</p> <p>Any idea on what can be causing this?</p> <p>The bad corners</p> <p><a href="https://i.stack.imgur.com/kr4VD.jpg" rel="noreferrer" title="Bad corners"><img src="https://i.stack.imgur.com/kr4VD.jpg" alt="Bad corners" title="Bad corners"></a></p> <p>The good corners</p> <p><a href="https://i.stack.imgur.com/Ras6V.jpg" rel="noreferrer" title="Good corners"><img src="https://i.stack.imgur.com/Ras6V.jpg" alt="Good corners" title="Good corners"></a></p>
<p>This has nothing to do with speed, temperature, adhesion, and whatever you do, <strong>DO NOT</strong> extrude more material per line (increase flow rate), as this will make the problem that much worse. </p> <p>This is a fairly simple problem with an even simpler fix: you're over extruding. Reduce your flow rate by 5%, and see if that fixes the issue. It will definitely improve it, but you might need to lower your flow rate a little bit more. </p> <p>What can often happen when your flow rate is set too high is the extra plastic will concentrate at areas of relatively high acceleration (corners and the start/stop spot for a perimeter of a given layer), but depending on the size of the thing being printed and the degree of overextrusion, it won't concentrate at every spot like this on a perimeter. </p> <p>Usually, I see this happen where the perimeter moves start and stop each time, which (again, depends on the slicer and settings) tend to be the same spot for certain models, often a corner. I couldn't say for certain the exact mechanism, except that it seems like the plastic, given the right conditions, prefers to lay down evenly while the excess over extruded plastic builds up (probably carried by the nozzle, since it is hot and the plastic will want to stick to it) until too much has built up for the nozzle adhesion to keep it from sticking to the print, or the nozzle begins to decelerate (late at a corner or the end of a print move), causing the extra plastic to 'scrunch' up, like something that shoved in a distance too short for it. Knowing this, if you examine the corners, it should be quite obvious that this is what is happening. The perimeter is being extruded with more plastic than it should be, and the extra has a tendency to collect all in one spot each time. </p> <p>Sometimes it is one corner, sometimes it is every corner, sometimes it is corners that are maximally distant from each other (since it takes some time for enough excess plastic to build up to over power whatever effects are preventing it from adhering immediately. So in this case, the two good corners were just where not enough excess plastic had built up yet at the nozzle to cause problems). Another possible explanation is that those two corners are simply where the perimeters were started and stopped, but some layers it was one corner, and other layers the other corner. But you can see over extrusion artifacts lower down on the feet (or whatever they are), and your first layer as well. </p> <p><strong>Do not increase flow rate.</strong></p> <p><strong>Do not increase infill.</strong></p> <p><strong>Do not lower your speed.</strong></p> <p><strong>Do not increase your temperature.</strong></p> <p>None of those will help, and increasing flow rate further could cause the nozzle to catch on the print, potentially damaging your hotend. </p> <p>Just reduce your flow rate by 5%. You should see an immediate improvement, or even elimination of the issue. If it is still there, then reduce your flow rate a percent or two until it does go away. And remember this number, because you'll probably want to use that flow rate in general for your printer. </p>
<p>Looks like it treated those corners a bit differently in the slice routine. Normally something like this different treatment would be too slight to matter, but (probably due to the slight overhang?) it appears to have caused some layers to not adhere to the bottom ones and get pulled along to a different shape (red line in image). (Be sure to check some general layer adhesion/overhang topics too.)</p> <p>I'd try increasing the infill there (and using honeycomb style infill) or even using a cad software to hollow the interior to essentially a desired infill before slicing if the current infill is important elsewhere.</p> <p>Moving slower, Increasing the temperature a bit, and/or extruding more material per line and layer if the layer adhesion is due to the slight overhang (although it looks pretty small).<img src="https://i.stack.imgur.com/WjGW7.jpg" alt="enter image description here"></p>
1,489
<p>I now own the Prusa3D MMU2. The benefits, costs, and experience others have had is well documented. I am interested in rebuilding my large, home-designed delta machine to be multi-material, and don't want to overlook strategies I haven't considered.</p> <p>My original implementation used an E3D Kraken as the hot-end, and handled the inevitable delta tilt by adding two additional degrees of freedom to the head to lower the selected nozzle to the bed. I've been through three generations of mechanisms, and I think the third will work.</p> <p>But, I feel that I am not seeing obvious and better alternatives.</p> <p>So, the question: Through what methods and mechanisms can a multi-material (different polymers, different temperatures) FDM printer operate, and are there available designs or examples of best practices for those methods?</p>
<p>Let's look at various methods:</p> <h2>Multiple Hotends</h2> <p>The oldest version and one of the best to print materials at vastly different print temperatures (like printing a cheaper PLA infill into a Polycarbonate shell - the print temperature difference is 60-100 °C) is to have 2 or more hotends. This way also avoids the need for purging towers. It does, however, limit the maximum size of the used printbed and few 2-printhead machines are cheap.</p> <h2>Y-Coupler</h2> <p>Using a bowden setup, a Y-coupler could be used to feed the filament from 2 extruders into one hotend. On the switching tool command, E0 would pull the filament back some couple millimeters beyond the coupler and then E1 would push forward back into the meltzone. One will need a purging tower/object.</p> <h2>Special, multi-entry hotend</h2> <p>Some Hotends had been concieved that have 2 or more ways into the meltzone and the multiple extruders push along them. They generally are quite complex and hard to clean, but they allow to seamlessly blend between two filaments of the same material and create pretty much a controlled fade by precisely directing how much of either side is used on any layer. For clean cuts, a purging tower is necessary.</p> <h2>Splicing filament</h2> <p>This is what the <a href="https://www.mosaicmfg.com/products/palette-2" rel="nofollow noreferrer">Palette 2</a> and the Prusa MMU do: they push pieces of filament into a feeder tube that then are consumed by the printer via its own extruder. If they melt the filaments together like in the PAlette, it's proper splicing, if they just line up the next filament piece without merging into a spliced filament it's more like instant color switching.</p> <p>This method is good for multi-color prints or using materials that have the same or similar<sup>1</sup> melting temperatures. It might or might not need a purge tower/object to get rid of the residue in the zones between the filaments.</p> <p>This could btw also be done manually but should be avoided.</p> <p><sup>1 - or rather not too dissimilar, if the slicer is set up to do it right. By setting up the slicer cleverly, one can have the extruder retract the filament, then adjust the heat over the purge tower and then resume extruding in the purge object at the changed temperature. PLA/PVA from a Prusa MMU is known and advertised to be doable, PLA/ABS might be possible this way. For extreme dissimilarities like PLA/PC (60-100 °C) I have my doubts though. </sup></p> <h2>Usability</h2> <p>All of these variants are basically viable, but some have benefits over others. Service is in this comparison meant as <em>repairing</em> a broken extruder, <em>maintaining</em> as the operations needed to keep it in printing order.</p> <ul> <li>multiple <em>fully independent</em> hotends is among the easiest to services. It could be direct drive (good for flexible filaments) or bowden. It is however heavy and usually not an option for delta printers. It has a downside that you have to perfectly level two hotend nozzles to be exactly on the same height, putting it in the hard to maintain category. <ul> <li><em>multiple hotends on the same carrier</em> is harder to service and maintain in comparison to multiple <em>independent</em> hotends as the components are very close together. Especially nozzle height adjustments can be more finicky.</li> </ul></li> <li>Y-Coupler needs to be a bowden and has problem with materials that are very stringy. That makes it especially bad for flexible materials. Maintaining is like a normal hotend and servicing is almost the same.</li> <li>Special hotends are hard to come by but could be available for direct drive, making them possible for flexible filaments. They are, as already noticed, very hard to service.</li> <li>Splicing filament can be done with either direct drive or bowden setups. It is probaby the most convenient to use after setup and has the maintenance and serviceability of a single hotend and a fully separate machine. Their biggest downside is price and setup time needed.</li> </ul>
<p>Another way to combine the simpler geometry of a single nozzle, and to get the reduced mass of a single extrusion tool would be to make it like a CNC machine with a tool changer. One material is printed, then the hot end, extruder, and feed tube are swapped out for another which is primed and ready with the next material.</p> <p>Lots of mechanical precision problems exist for arranging for the nozzles to be in the very same place, plus or minus a small tolerance. This is worsened by the presence of filament bits and strings which seem to eventually pollute the workspace.</p> <p>If that could be worked out, one could have a plethora of extrusion tools, nozzle sizes, materials, multi-material mixing chambers, and other complexities.</p> <p>E3D was talking about such a printer, but I haven't seen a product... only an invitation to send money as a show of interest in such a printer.</p>
1,334
<p>I'm getting an error whenever I load Management Studio or open a folder in the server explorer, etc. Additionally, If I try to create a new database it constantly is updating and does not finish. I have attached a screenshot of the error. Please let me know what I can do to fix this because it's really aggravating.</p> <p><a href="http://frickinsweet.com/databaseError.gif" rel="nofollow noreferrer">Error Screen http://frickinsweet.com/databaseError.gif</a> </p>
<p>From MSDN forum <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120476&amp;SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120476&amp;SiteID=1</a></p>
<p>My first guess would be Client Tool corruption.</p> <p>I've occasionally had to uninstall my client tools and reinstall them. Boot after uninstall.</p>
8,488
<p>I have findbugs plugin for eclipse which when run on my project will show results in Bugs explorer clubbed by the type of bug.</p> <p>I need to be able to do two things:</p> <ul> <li>Export all these to excel sheet</li> <li>Find out the bugs reported in a set of files (and be able to do it recursively w/o running for whole project and exporting and finding out the classes to be modified.</li> </ul> <p>Any suggestions?</p> <p>FYI, I am using MyEclipse v 6.0.1 and FindBugs 1.3.4</p>
<p>Findbugs dumps its results into an XML file in your workspace's .metadata folder. Look for the subfolder that's named something like findbugs.</p> <p>You can also download a standalone version of Findbugs that will save the results wherever you like.</p> <p>Once you have the results file, you might be able to import from XML to Excel and filter there. Alternatively, you can use XSLT to transform to several CSV files and open them in Excel.</p>
<p>I had the same problem with findbugs some versions ago.</p> <p>I updated the plugin today to version 1.3.8 and found out that you can now export and even import reports as XML directly. </p> <p>All you have to do is right-click on a project either in the package explorer or in the findbugs "Bug explorer" and select "Findbugs->Save XML" or "Findbugs->Load XML".</p> <p>Finely a proper export and import functionality for a fantastic tool.</p> <p>Btw, I use Eclipse 3.3.2.</p>
6,853
<p>It looks interesting and I've played around with it some --- but the development IDE in a web browser seems to be nightmare eventually.</p> <p>Does anyone have experience using it and what are your thoughts?</p>
<p>We evaluated GI a few months ago for a project but didn't end up selecting it.</p> <p>The IDE-in-a-browser (which is itself build with GI) actually works surprisingly well, though there are some features you normally expect from an editor that it lacks, most notably (and irritatingly) an Undo command. It's also impossible to do things like subdocument includes (practically a necessity for team development) from the IDE, though you can do them manually in the underlying XML and the IDE will respect them.</p> <p>In the end the main reason we didn't go with it was that it was difficult to make the resulting web application look as good as the designers really wanted. It was relatively easy to build functionality, but the components were very restrictive in look and feel. The way GI renders its own document model to HTML involves a lot of <code>style</code> attributes which makes skinning in CSS all but impossible. It seems to prefer making web applications that look like applications, instead of web applications that look like websites.</p> <p>So it would probably be great for building intranet type applications where look and feel isn't a huge issue, but I probably wouldn't use it to make a public facing site.</p> <p>By the way for those that don't know, TIBCO GI is a completely separate product from the rest of TIBCO's SOA business integration stuff - General Interface was a separate company that was acquired by TIBCO a couple of years ago.</p>
<p>Kieron does a good job of summarizing GI. It's really for enterprise web applications, not consumer-y widgets. The overhead of loading the entire GI framework and waiting a second or two for it to load doesn;t seem like much if you're firing up a call center or an employee provisioning application you're going to use for the next few hours. But, it seems like forever if you're waiting for a widget to load into an existing web page. And, even though, GI supports some nice functional and performance QA tools, they really are overkill unless you're working on something important and complex. So, if all you want is to toss a sexy looking datepicker on screen, use something else for sure.</p>
3,357
<p>How do you make your application multithreaded ? Do you use asynch functions ? or do you spawn a new thread ? I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources... So is there some kind of design when using thread or asynch functions ?</p>
<p>Spawning threads is only going to waste resources if you start spawning tons of them, one or two extra threads isn't going to effect the platforms proformance, infact System currently has over 70 threads for me, and msn is using 32 (I really have no idea how a messenger can use that many threads, exspecialy when its minimised and not really doing anything...)</p> <p>Useualy a good time to spawn a thread is when something will take a long time, but you need to keep doing something else.</p> <p>eg say a calculation will take 30 seconds. The best thing to do is spawn a new thread for the calculation, so that you can continue to update the screen, and handle any user input because users will hate it if your app freezes untill its finished doing the calculation.</p> <p>On the other hand, creating threads to do something that can be done almost instantly is nearly pointless, since the overhead of creating (or even just passing work to an existing thread using a thread pool) will be higher than just doing the job in the first place.</p> <p>Sometimes you can break your app into a couple of seprate parts which run in their own threads. For example in games the updates/physics etc may be one thread, while grahpics are another, sound/music is a third, and networking is another. The problem here is you really have to think about how these parts will interact or else you may have worse proformance, bugs that happen seemingly "randomly", or it may even deadlock.</p>
<p>The use of threads makes you think more about the way your application needs threading and can in the long run make it easier to improve / control your performance.<br> Async methods are faster to use but they are a bit magic - a lot of things happen to make them possible - so it's probable that at some point you will need something that they can't give you. Then you can try and roll some custom threading code.<br> It all depends on your needs.</p>
8,651
<p>I have been wondering about 3D metal printing (steel, aluminium), but after a short research on google I found only too expensive printers (markforged, desktop metal and a few other industrial ones). Is there any less expensive printer that is able to print metal parts on the market ?</p>
<p>Anzalone and friends published <a href="https://ieeexplore.ieee.org/document/6678531/" rel="noreferrer">A Low-Cost Open-Source Metal 3-D Printer</a> in <em>IEEE Access</em>:</p> <blockquote> <p>This paper reports on the development of a open-source metal 3-D printer. The metal 3-D printer is controlled with an open-source micro-controller and is a combination of a low-cost commercial gas-metal arc welder and a derivative of the Rostock, a deltabot RepRap. The bill of materials, electrical and mechanical design schematics, and basic construction and operating procedures are provided.</p> </blockquote>
<p>You can do lost-PLA investment casting, the actual gear to do it is kind of pricey unless you're willing to create your own DIY forge for melting aluminum.</p> <p>Check it out though, you don't need a special printer to do it.</p> <p>There's also a way to coat your prints with metal it would require an electric current and some nasty chemicals, but it's possible as an alternative.</p>
983
<p>What kinds of considerations are there for migrating an application from <strong>NHibernate</strong> 1.2 to 2.0? What are breaking changes vs. recommended changes? </p> <p>Are there mapping issues?</p>
<p><a href="http://forum.hibernate.org/viewtopic.php?t=985289" rel="noreferrer">Breaking changes in NHibernate 2.0</a></p> <p><strong>If you have good test coverage it's busywork.</strong></p> <p>Edit: We upgraded this morning. There is nothing major. You have to Flush() the session after you delete. The Expression namespace got renamed to Criterion. All these are covered in the link above. Mappings need no change. It's quite transparent. Oh, and transactions <em>everywhere</em>, but you were probably doing that already.</p> <p>By the way, here's an interesting look at the changes: <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/08/26/nhibernate-2-0-changes-overview.aspx" rel="noreferrer">http://codebetter.com/blogs/patricksmacchia/archive/2008/08/26/nhibernate-2-0-changes-overview.aspx</a></p>
<p>I found the answer here:</p> <p><a href="http://blog.domaindotnet.com/2008/08/24/nhibernate-20-gold-released-must-wait-for-linq-to-nhibernate/" rel="nofollow noreferrer">http://blog.domaindotnet.com/2008/08/24/nhibernate-20-gold-released-must-wait-for-linq-to-nhibernate/</a></p> <h1>gold release 2.0.0.GA</h1> <h2>BREAKING CHANGES from NH1.2.1GA to NH2.0.0</h2> <ul> <li> <h2>Infrastructure</h2> <ul> <li>.NET 1.1 is no longer supported</li> <li>Nullables.NHibernate is no longer supported (use nullable types of .NET 2.0)</li> <li>Contrib moved. New Location <ul> <li><a href="http://sourceforge.net/projects/nhcontrib" rel="nofollow noreferrer">http://sourceforge.net/projects/nhcontrib</a></li> </ul> </li> </ul> </li> <li> <h2>Compile time</h2> <ul> <li>NHibernate.Expression namespace was renamed to NHibernate.Criterion</li> <li>IInterceptor have additional methods. (IsUnsaved was renamed IsTransient)</li> <li>INamingStrategy</li> <li>IType</li> <li>IEntityPersister</li> <li>IVersionType</li> <li>IBatcher</li> <li>IUserCollectionType</li> <li>IEnhancedUserType</li> <li>IPropertyAccessor</li> <li>ValueTypeType renamed to PrimitiveType</li> </ul> </li> <li> <h2>Possible Breaking Changes for external frameworks</h2> </li> </ul> <ul> <li>Various classes were moved between namespaces</li> <li>Various classes have been renamed (to match Hibernate 3.2 names)</li> <li>ISession interface have additional methods</li> <li>ICacheProvider</li> <li>ICriterion</li> <li>CriteriaQueryTranslator</li> </ul> <p><li></p> <h2>Initialization time</h2> <p></li></p> <ul> <li>&lt;nhibernate&gt; section, in App.config, is no longer supported and will be ignored. Configuration schema for configuration file and App.config is now identical, and the App.config section name is: &lt;hibernate-configuration&gt;</li> <li>&lt;hibernate-configuration&gt; have a different schema and all properties names are cheked</li> <li>configuration properties are no longer prefixed by “hibernate.”, if before you would specify “hibernate.dialect”, now you specify just “dialect”</li> <li>All named queries will be validated at initialization time, an exception will be thrown if any is not valid (can be disabled if needed)</li> <li>Stricter checks for proxying classes (all public methods must be virtual)</li> </ul> <p><li></p> <h2>Run time</h2> <ul> <li>SaveOrUpdateCopy() returns a new instance of the entity without changing the original</li> <li>AutoFlush will not occur outside a transaction - Database transactions are never optional, all communication with the database must occur inside a transaction, whatever you read or write data.</li> <li>NHibernate will return long for count(*) queries on SQL Server</li> <li>&lt;formula&gt; must contain parenthesis when needed</li> <li>These HQL function names may cause conflict in your HQL reserved names are: <ul> <li>substring</li> <li>locate</li> <li>trim</li> <li>length</li> <li>bit_length</li> <li>coalesce</li> <li>nullif</li> <li>abs</li> <li>mod</li> <li>sqrt</li> <li>upper</li> <li>lower</li> <li>cast</li> <li>extract</li> <li>concat</li> <li>current_timestamp</li> <li>sysdate</li> <li>second</li> <li>minute</li> <li>hour</li> <li>day</li> <li>month</li> <li>year</li> <li>str</li> </ul> </li> <li>&lt;any&gt; when meta-type=”class” the persistent type is a string containing the Class.FullName <ul> <li>In order to set a parameter in a query you must use SetParameter(”paraName”, typeof(YourClass).FullName, NHibernateUtil.ClassMetaType)</li> </ul> </li> </ul> <p></li> <li></p> <h2>Mapping</h2> <p></li> <li>&lt;any&gt; : default meta-type is “string” (was “class”)</li></p>
4,688
<p>I have recently purchased an Anet A8 but have been wondering why the prints look squished and have tiny balls on them. </p> <p>I am using 1.75&nbsp;mm cheap PLA bought from eBay and have also had problems of filament oozing out of the print block. </p> <p><img src="https://i.stack.imgur.com/9bEPO.jpg" alt="Photos of squished prints" title="Photos of squished prints">]<a href="https://i.stack.imgur.com/9bEPO.jpg" rel="nofollow noreferrer" title="Photos of squished prints">1</a></p>
<p>It could be that cheap filament has inconsistent diameter, or your calibration is over extruding, or you have something loose that needs to be tight. It's hard for me to tell precisely from just these images. In your shoes, I would print 20mm x 20mm x 10mm, 100% infill boxes until I got it dialed in so that it is square, fully filled in, but nice and flat.</p> <p>If they're coming out square and staying stuck to the build plate properly, but are bumpy and overfilled, then you're over extruding and you'll want to either recalibrate e-steps or if they're correct, adjust your flow rate in the slicer (down).</p> <p>If they aren't square then you need to square up your frame and tighten it and the belts.</p> <p>Etc.</p> <p>But my first guess is that you're extruding too much plastic since I'll bet they were flatter when they were still on the build plate, yes?</p> <p>On the question of ooze: you'll always get some ooze. Molten plastic and gravity means some will ooze out pretty much no matter what. What you need to worry about is when this results in stringing or unwanted lines on the surface of the print. These things you address with retraction (which reduces the pressure on the nozzle during travel moves, but can't stop gravity) and for the surface problem various travel, z-hop and combing strategies depending on your slicer.</p>
<p>You may be having an over-extrusion issue, you should check the flow rate in whatever slicer you use. </p> <p>You should also check to make sure that the filament diameter you are using matches that of the diameter setting in your slicer.</p>
587
<p>Are there any free (non-GPL) libraries for .NET that provide IMAP4 server side functionality?</p> <p>E.g. handles the socket level and message handshaking so that an IMAP4 client (such as outlook) can retrieve, read, edit and/or delete messages. </p> <p>I am not trying to connect to an IMAP4 server, I'd like the assistance to implement one.</p>
<p>I know I'm answering my own question, but after yet more searching I think I may have found something matching my needs:</p> <p><a href="http://nmailserver.sourceforge.net/index.php/Main_Page" rel="nofollow noreferrer">NMail</a></p> <p>Features</p> <ul> <li>NMail is a 100% .net application.</li> <li>A Windows installer and setup wizard.</li> <li>ASP.net Webmail.</li> <li>An ASP.net administration site.</li> </ul> <p>IMAP Server Features</p> <ul> <li>Support for ACLs.</li> <li>NTLM authentication (Secure Password Authentication (SPA) under Outlook and Outlook Express).</li> <li>Support for SSL/TLS encryption.</li> <li>SASL plain authentication support (when using an encrypted session).</li> </ul> <p>SMTP Server Features</p> <ul> <li>Support for SSL/TLS encryption.</li> <li>Flexible API for filtering and altering messages. E.g. To remove spam or to rewrite addresses, etc.</li> </ul>
<p>I'm not sure if you have tried Indy (previously a set of Delphi components) - although I am not sure if they do IMAP4 as their web page is a bit blank, as is their CodePlex hub. Go to <a href="http://indy-project.org" rel="nofollow noreferrer">their website</a>. Other than that I'm not sure - even <a href="http://google.co.uk/search?q=c#+imap4+server" rel="nofollow noreferrer">Google</a> only shows clients.</p>
9,227
<p>I am using cura with M3D entry level printer.</p> <p>When I print things more than 6-7cm/2.5-3inches, at the end of the print, the hot end sink back into the print then gets stuck as it tries to return to idle position.</p> <p>Please see the attached photo. Has anyone had this problem? Thank you<a href="https://i.stack.imgur.com/2xpD4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2xpD4.jpg" alt="enter image description here"></a></p> <p>The last 20 lines of gcode is:</p> <pre><code>G0 X50.83 Y49.982 G1 F600 X50.541 Y49.975 E4399.62304 G1 X50.268 Y49.985 E4399.62637 G1 X49.999 Y49.999 E4399.63024 G1 X49.73 Y50.012 E4399.6341 G1 X49.457 Y50.023 E4399.63742 G1 X49.168 Y50.016 E4399.63941 G0 F7200 X49.28 Y49.87 ;TIME_ELAPSED:6301.614981 G1 F1500 E4393.13941 M107 M104 S0 M140 S0 ;Retract the filament G92 E1 G1 E-1 F300 G28 X0 Y0 M84 M82 ;absolute extrusion mode M104 S0 ;End of Gcode </code></pre>
<p>As Oscar commented, check the tail end of your gcode files. Most slicing software includes commands to move the head to x=0,y=0 at the very least. I am a bit surprised that your files don't appear to have this, since Cura does apply said code. </p> <p>Possiblly there's something lacking in your printer's firmware and it doesn't recognize some of the gcode commands.</p>
<p>As Oscar commented, check the tail end of your gcode files. Most slicing software includes commands to move the head to x=0,y=0 at the very least. I am a bit surprised that your files don't appear to have this, since Cura does apply said code. </p> <p>Possiblly there's something lacking in your printer's firmware and it doesn't recognize some of the gcode commands.</p>
1,033
<p>I'm sure there is a good (or at least decent) reason for this. What is it?</p>
<blockquote> <p>I think this is a brilliant question - and I think there is need of a better answer.</p> <p>Surely the only reason is that there is something in a framework somewhere that isn't very thread-safe. </p> </blockquote> <p>That "something" is almost every single instance member on every single control in System.Windows.Forms.</p> <p>The MSDN documentation for many controls in System.Windows.Forms, if not all of them, say <em>"Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe."</em></p> <p>This means that instance members such as <code>TextBox.Text {get; set;}</code> are not <strong><em>reentrant</em></strong>.</p> <p>Making each of those instance members thread safe could introduce a lot of overhead that most applications do not need. Instead the designers of the .Net framework decided, and I think correctly, that the burden of synchronizing access to forms controls from multiple threads should be put on the programmer.</p> <p>[Edit]</p> <p>Although this question only asks "why" here is a link to an article that explains "how":</p> <p><em>How to: Make Thread-Safe Calls to Windows Forms Controls</em> on MSDN</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms171728.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms171728.aspx</a></p>
<p>Hmm I'm not pretty sure but I think that when we have a progress controls like waiting bars, progress bars we can update their values from another thread and everything works great without any glitches. </p>
3,158
<p>Even though chrome runs tabs as different processes it appears to not support this... any ideas or documentation I might have missed?</p>
<p>Try two different incognito windows.</p>
<p>If you want to stay logged in for a period of time, the best thing to do is to create a new profile for each set of credentials. Click the face icon in the top right-hand corner and select "new user."</p> <p><img src="https://i.stack.imgur.com/SoVNQ.png" alt="creating a new profile"></p> <p>If you just want to log-in with different credentials once, it might be easier to use incognito mode, as rmmh said.</p>
6,226
<p>If I have: </p> <pre><code>signed char * p; </code></pre> <p>and I do a comparison:</p> <pre><code>if ( *p == 0xFF ) break; </code></pre> <p>it will never catch 0XFF, but if I replace it with -1 it will:</p> <pre><code>if ( *p == (signed char)0xFF ) break; </code></pre> <p>How can this happen? Is it something with the sign flag? I though that <code>0xFF == -1 == 255</code>.</p>
<p>The value <code>0xFF</code> is a signed int value. C will promote the <code>*p</code> to an <code>int</code> when doing the comparison, so the first if statement is equivalent to:</p> <pre><code>if( -1 == 255 ) break; </code></pre> <p>which is of course false. By using <code>(signed char)0xFF</code> the statement is equivalent to:</p> <pre><code>if( -1 == -1 ) break; </code></pre> <p>which works as you expect. The key point here is that the comparison is done with <code>int</code> types instead of <code>signed char</code> types.</p>
<p>0xff will be seen as an integer constant, with the value of 255. You should always pay attention to these kind of comparison between different types. If you want to be sure that the compiler will generate the right code, you should use the typecast:</p> <pre> if( *p == (signed char)0xFF ) break; </pre> <p>Anyway, <b>beware</b> that the next statement will <b>not</b> work the same way:</p> <pre> if( (int)*p == 0xFF ) break; </pre> <p>Also, maybe it would be a better idea to avoid signed chars, or, it you must use signed chars, to compare them with signed values such as -1 in this case:</p> <pre> if( *p == -1 ) break; </pre> <p>0xff==-1 only if those values would be assigned to some char (or unsigned char) variables:</p> <pre> char a=0xff; char b=-1; if(a==b) break; </pre>
8,637
<p>Is it possible to access the iSight camera on a macbook programmatically? By this I mean I would like to be able to just grab still frames from the iSight camera on command and then do something with them. If so, is it only accessible using objective c, or could other languages be used as well? </p>
<p>You should check out the <a href="http://developer.apple.com/documentation/QuickTime/Conceptual/QTKitCaptureProgrammingGuide/Introduction/chapter_1_section_1.html#//apple_ref/doc/uid/TP40004574-CH1-DontLinkElementID_41" rel="nofollow noreferrer">QTKit Capture documentation</a>.</p> <p>On Leopard, you can get at all of it over the RubyCocoa bridge:</p> <pre><code>require 'osx/cocoa' OSX.require_framework("/System/Library/Frameworks/QTKit.framework") OSX::QTCaptureDevice.inputDevices.each do |device| puts device.localizedDisplayName end </code></pre>
<p>Aside from ObjC, you can use the PyObjC or RubyCocoa bindings to access it also. If you're not picky about which language, I'd say use Ruby, as PyObjC is horribly badly documented (even the official Apple page on it refers to the old version, not the one that came with OS X Leopard)</p> <p>Quartz Composer is probably the easiest way to access it, and .quartz files can be embed in applications pretty easily (and the data piped out to ObjC or such)</p> <p>Also, I suppose there should be an example or two of this in the /Developer/Examples/</p>
3,045
<p>I have developed a COM component (dll) that implements an Edit() method displaying a WTL modal dialog.</p> <p>The complete interface to this COM component corresponds to a software standard used in the chemical process industry (CAPE-OPEN) and as a result this COM component is supposed to be usable by a range of 3rd party executables that are out of my control.</p> <p>My component works as expected in many of these EXEs, but for one in particular the Edit() method just hangs without the dialog appearing.</p> <p>However, if I make a call to <code>::MessageBox()</code> immediately before <code>DoModal()</code> the dialog displays and behaves correctly after first showing the MessageBox.</p> <p>I have a suspicion that the problem may be something to do with this particular EXE running as a 'hidden window application'.</p> <p>I have tried using both NULL and the return value from <code>::GetConsoleWindow()</code> as the dialog's parent, neither have worked.</p> <p>The dialog itself is an ATL/WTL CPropertySheetImpl.</p> <p>The parent application (EXE) in question is out of my control as it is developed by a (mildly hostile) 3rd party.</p> <p>I do know that I can successfully call <code>::MessageBox()</code> or display the standard Windows File Dialog from my COM component, and that after doing so I am then able to display my custom dialog. I'm just unable to display my custom dialog without first displaying a 'standard' dialog.</p> <p>Can anyone suggest how I might get it to display the dialog without first showing an unnecessary MessageBox? I know it is possible because I've seen this EXE display the dialogs from other COM components corresponding to the same interface.</p>
<p>Are you using a parent for the Dialog? e.g.</p> <pre><code>MyDialog dialog(pParent); dialog.DoModal(); </code></pre> <p>If you are, try removing the parent. Especially if the parent is the desktop window.</p>
<p>Whatever you do, <strong>do not</strong> use the desktop window as the parent for your modal dialog box.</p> <p>See here for explanation: <a href="http://blogs.msdn.com/b/oldnewthing/archive/2004/02/24/79212.aspx" rel="nofollow">http://blogs.msdn.com/b/oldnewthing/archive/2004/02/24/79212.aspx</a></p> <p>To quote the rationale:</p> <blockquote> <p>Put this together: If the owner of a modal dialog is the desktop, then the desktop becomes disabled, which disables all of its descendants. In other words, it disables every window in the system. Even the one you're trying to display!</p> </blockquote>
5,875
<p>I am new to 3D printing. I have just put together my own 3D printer with some help.</p> <p>I was advised I shouldn't print directly onto the aluminium plate - I assume it's aluminium.</p> <ol> <li><p>The manufacturer did give me a piece of matrix board (i.e. no cooper at all) to print on. Will this work well?</p></li> <li><p>If glass is better, does it have to cover the entire bed? My bed is 275 mm deep by 220 mm wide. I'm struggling to find glass for it that will come within the next few days. The only custom cut was on eBay and it's going to take over a week to arrive.</p></li> </ol>
<p>Obviously being in a rush can limit your options, but here are a few thoughts:</p> <p><strong>Quick solutions:</strong></p> <ul> <li><strong>Blue painters tape</strong> (as Carl mentioned) will work directly on your heated bed...assuming it's a flat piece of aluminum with the heating element under it. Your surface does need to be flat.</li> <li><strong>Acrylic plate</strong> will work but is best with no heat, or low heat. PLA sticks to it. It's easy to cut and easy to find at local hardware stores.</li> <li><strong>Scrap glass</strong> is fairly easy to find for free and it's <a href="https://youtu.be/cfdrgrOH50Y" rel="noreferrer">not that hard</a> to cut...or buy some at your local hardware store and have them cut it. Just be careful, it's sharp. You can sand the sharp edges (wet sandpaper) to make it safer. <strong>No, it doesn't have to cover the whole plate, but obviously covering the whole plate would normally be preferred.</strong></li> </ul> <p><strong>Better (but not as fast) solutions:</strong></p> <ul> <li><strong>Buy some custom tempered glass.</strong> I like <a href="https://www.onedayglass.com/" rel="noreferrer">One Day Glass</a> because they're fast and very capable. Like Tom says, many many people print on glass because it's nice and flat and stiff. It's also easy to clean and holds up well. You can print on the bare glass with many materials or use various preparations like PVA (glue stick or white glue diluted with water are popular), hairspray, or others.</li> <li><strong>Touch Screen Glass:</strong> Some people like replacement glass for tablets or touch screens because it has a hardened scratch-resistant surface. I've not tried it, but if you can find one that is the right size, it might be worth a shot.</li> <li><strong>Specialty products:</strong> There are many many print bed products out there that promise an easier/better printing experience. I've used a few that are okay...definitely better than blue painters tape, but I much prefer my current favorite...</li> <li><strong>My current favorite is PEI.</strong> Use a 3M 468MP adhesive sheet (it handles the heat well) to stick a thin sheet PEI (also sold under brand name Ultem) on top of your glass plate. I got this idea from Lulzbot and it's what they use on all of their printers. It works beautifully. Common filaments stick to it while it's hot and release easily while it's cool. For other filaments I just use PVA like I would over glass. For material printing tips and settings that work well on PEI beds, check out Lulzbot's site. When it starts wearing out or getting scuffed up, I just sand it with fine sandpaper and I'm good to go for another hundred prints or so.</li> </ul>
<p>I have been printing for over 2 years directly onto the 3 mm Aluminum heated bed platform using a touch of PVA based print adhesion spray 3DLAC or Dimafix (see e.g. <a href="https://3dprinting.stackexchange.com/a/6861/">this answer</a> on question "<a href="https://3dprinting.stackexchange.com/questions/3710/should-you-use-hairspray-on-a-metal-bed-3d-printer">Should you use hairspray on a metal bed 3D printer? </a>"). I've obtained best results with 3DLAC. Works like a charm! Always good adhesion and a very shiny and flat surface finish. I have not found any downsides of printing directly onto the Aluminum, I find it very easy as I do not have to fight that dreadful tape (application, bubbling, tearing, etc.). </p>
400
<p>Let's say that I want to have a table that logs the date and the number of columns in some other table (or really any sort of math / string concat etc).</p> <pre><code>CREATE TABLE `log` ( `id` INTEGER NOT NULL AUTO_INCREMENT , `date` DATETIME NOT NULL , `count` INTEGER NOT NULL , PRIMARY KEY (`id`) ); </code></pre> <p>Is it possible to have the count column calculated for me whenever I do an insert?</p> <p>e.g. do something like:</p> <pre><code>INSERT INTO log (date='foo'); </code></pre> <p>and have count calculated by mysql.</p> <p>Obviously I could do it myself by doing a query to get the count and inserting it, but this would be better.</p>
<p>Triggers are the best tool for annotating data when a table is changed by insert, update or delete.</p> <p>To automatically set the date column of a new row in the log with the current date, you'd create a trigger that looked something like this:</p> <pre><code>create trigger log_date before insert on log for each row begin set new.date = current_date() end; </code></pre>
<p>Why don't you use information_schema.TABLES?</p>
6,722
<p>There are many ASP.MVC blog post bits and pieces scattered over different web sites, as well as couple of resource questions here - <a href="https://stackoverflow.com/questions/14599/aspnet-model-view-controller-mvc-where-do-i-start-from">ASP.NET Model-view-controller (MVC) - where do I start from?</a> and <a href="https://stackoverflow.com/questions/10425/mvc-learning-resources">MVC Learning Resources</a></p> <p>I wonder if there was a one-stop tutorial posted yet on getting started with ASP.NET MVC?</p> <p>Thank you!</p> <p><strong>Edit:</strong> I probably need to clarify - a one-stop tutorial that'd help to get started within and hour or two and learn more as I go... Reading books is a non starter for me personally - takes more time I can afford and starts with basics...</p>
<p>Have you looked at <a href="http://www.codeplex.com/mvcsamples" rel="noreferrer">MVC Samples</a> on CodePlex? Rob Conery has some screencasts that go along with the creation of the site at <a href="http://blog.wekeroad.com/mvc-storefront/" rel="noreferrer"><a href="http://blog.wekeroad.com/mvc-storefront/" rel="noreferrer">http://blog.wekeroad.com/mvc-storefront/</a></a>.</p>
<p>In addition to the above mentioned:</p> <ul> <li><a href="http://weblogs.asp.net/stephenwalther" rel="nofollow noreferrer">http://weblogs.asp.net/stephenwalther</a></li> <li><a href="http://www.manning.com/palermo/" rel="nofollow noreferrer">Asp.net MVC in Action</a> looks to be a good book.</li> </ul>
7,591
<p>My only functional computer at the moment is a raspberry pi, and I was wondering if there was any software that supported it. My printer is a Newmatter mod-t, but I might be able to modify other software to support it</p>
<h2>Safety first</h2> <p>I suggest the following handling of resins, some basic stuff first:</p> <ul> <li><strong>ALWAYS</strong> wear disposable, one-use gloves when handling resin.</li> <li>Respirators are highly advised to be worn.</li> <li>Work in a well-ventilated area.</li> <li>Tools dedicated to resin handling are for resin only to prevent contamination of other tools.</li> <li>Try to minimize the amount added to the vat, so you have as little rests as possible.</li> </ul> <h2>Re-cycling</h2> <p>Now, what to do to get the used resin back to the cycle? Any resin that has been exosed to air and light, such as having been in the vat is best considered to be B-Quality. You can use it to cast greeblies or bits (aka disposal by curing), as one would do with leftover casting (2-component) resin, but that is a waste.</p> <h3>Step 1: Re-botteling</h3> <p>So, let's look at some better ways: first of all re-botteling the resin. We need to take in mind, that the quality of our resin will further degrade the longer it stays exposed to light (and to a lesser degree: air), so we need to handle the resin in a way that allows us to eliminate exposition to either. For this, it would be best to keep an empty resin bottle at hand and label it as the leftover bottle. To fill this bottle, you should use a <a href="https://www.thingiverse.com/search?q=resin%20vat&amp;type=things&amp;sort=relevant" rel="nofollow noreferrer">Jig</a> to keep the vat in a position that it pours into the bottle. You might want to use a funnel in some cases!</p> <h2>Step 2: Re-conditioning</h2> <p>Now, we know how to get the stuff back into the (B-quality) bottle. But how to make sure it has the best quality we can? As you notice, many of the jigs involve a funnel. This funnel is used in conjunction with a filter to remove larger particles. The finer the filter, the better. <a href="https://en.wikipedia.org/wiki/Coffee_filter#Paper_filter" rel="nofollow noreferrer">Coffee filters</a> manage to snatch particles down to about 10 to 15 micrometers. It is equivalent to about Grade 4 laboratory filter paper. However, laboratory filter paper of <a href="https://en.wikipedia.org/wiki/Filter_paper#Qualitative_filter_paper" rel="nofollow noreferrer">grades 1,2,3 or 602h</a> would allow to catch particles of even lower size, as the mesh gets even smaller, but might clog faster. Tea filters on the other hand have worse filtration ability and should be avoided.</p> <p>To get the best out of it, use a filtration stack, that starts with a metal mesh filter before going through a rough and a fine filter to get out any chunks and large particles that would clog the fine filter.</p> <p>It would be best to have this process run in the dark, so mounting the dripping and filtration stack in a box might first sound like overkill, but if you go through a large amount of resin (for example by running several printers) it might be an investment that can save a considerable amount of resin in the long run. However, if you run so many printers, you also might run them continually with the same resin colors and just refill them as needed and only filter if there had been a print failure.</p> <h2>Step 3: Storage</h2> <p>Store your bottles in a closed cupboard. It would be best if this cupboard is ventilated through a filtration unit and then outside. It should also keep a steady temperature above about 10 °C to prevent clumping. Just follow the storage manual for the normal resin actually.</p> <h2>Step 4: Re-use</h2> <p>Now comes the tricky part: re-using the resin. While technically the filtered and re-bottled resin should be almost as good as new, it would be best to make sure that we mix it with some virgin resin to make sure we have enough photoinitiator in the resin. For this, I would suggest mixing the recycled resin with between a sixth and half of the fresh stuff. Mix the two well to make sure you get the best possible. Make sure it's the same type and color of the used resin, best even from the same original batch.</p> <p>Use up the re-cycled resin first, as you should consider it's best before date much shorter than on the virgin bottle.</p>
<p>Considerations for storing resin include using a light-tight bottle, preventing stray ultraviolet radiation from prematurely curing the resin.</p> <p>You'll also note that users will filter the resin through a fine mesh filter. I've seen some videos in which the user pours through coffee filters to remove as many particulates as possible.</p> <p>Left-over resin that has been carefully filtered is effectively the same as fresh-from-the-bottle material, from a purely technical view, but you can pick up contaminants that bypass the filter.</p>
1,753
<p>I have done Java and JSP programming in the past, but I am new to Java Server Faces and want to know if there's a set of best practices for JSF development. </p>
<p>Some tips: Understand the JSF request <a href="http://www.java-samples.com/showtutorial.php?tutorialid=470" rel="nofollow noreferrer">lifecycle</a> and where your various pieces of code fit in it. Especially find out why your model values will not be updated if there are validation errors.</p> <p>Choose a tag library and then stick with it. Take your time to determine your needs and prototype different libraries. Mixing different taglibs may cause severe harm to your mental health.</p>
<p>Select a good component library .Do not use richfaces , i suggest you dont use jsf , use spring mvc,jquery fro view and json in a rest architecture. but if you have to ,use primefaces it easy to use and has enough components.</p>
5,188
<p>Is there any way to prevent Visual Studio from creating a VSMacros80 folder in my default project directory?</p>
<p>I just found it out myself: If you add a trailing backslash to the <em>Project Folder</em> setting e.g. changing it from <code>C:\dev</code> to <code>C:\dev\</code>, the <code>VSMacros80</code> directory will no longer be created. </p> <p>I tested it with Visual Studio 2005 SP1, with all windows updates installed.</p>
<p>I could not find the previous thread, because I was searching for "vsmacros" instead of "vsmacros80".</p> <p>There are currently 5 different entries in <code>Tools-&gt;Options-&gt;Addin/Macro Security</code></p> <pre><code>%ALLUSERSPROFILE%\Application Data\Microsoft\MsEnvShared\Addins %APPDATA%\Microsoft\MsEnvShared\Addins %VSAPPDATA%\Addins %VSCOMMONAPPDATA%\Addins %VSMYDOCUMENTS%\Addins </code></pre> <p>Can you tell me which one I have to delete?</p>
9,574
<p>Does anyone have time to take a look at it? </p> <p>I've read a bit and it promises a lot, if it's half what they say, it'll change web Development a lot</p>
<p>I have compared Mozilla Firefox 3.0.1 and Google Chrome 0.2.149.27 on <a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html" rel="noreferrer">SunSpider JavaScript Benchmark</a> with the following results:</p> <ul> <li>Firefox - total: 2900.0ms +/- 1.8%</li> <li>Chrome - total: <strong>1549.2ms +/- 1.7%</strong></li> </ul> <p>and on <a href="http://code.google.com/apis/v8/benchmarks.html" rel="noreferrer">V8 Benchmark Suite</a> with the following results (higher score is better):</p> <ul> <li>Firefox - score: 212</li> <li>Chrome - score: <strong>1842</strong></li> </ul> <p>and on <a href="http://celtickane.com/webdesign/jsspeedarchive.php" rel="noreferrer">Web Browser Javascript Benchmark</a> with the following results:</p> <ul> <li>Firefox - total duration: 362 ms</li> <li>Chrome - total duration: <strong>349 ms</strong></li> </ul> <p><em>Machine:</em> Windows XP SP2, Intel Core2 DUO T7500 @ 2.2 Ghz, 2 GB RAM</p> <p>All blog posts and articles that I've read so far also claim that V8 is clearly the fastest JavaScript engine out there. See for example - <a href="http://waynepan.com/2008/09/02/v8-tracemonkey-squirrelfish-ie8-benchmarks/" rel="noreferrer">V8, TraceMonkey, SquirrelFish, IE8 BenchMarks</a></p> <blockquote> <p>"... Needless to say, Chrome’s V8 blows away all the current builds of the next-generation of JavaScript VMs. Just to be clear, WebKit and FireFox engines haven’t even hit beta, but it looks like the performance bar has just been set to an astronomical height by the V8 Team."</p> </blockquote>
<p>It's really speedy. Visibly so. I was pretty impressed with its performance compared with Firefox 3. Already made it my default browser.</p>
6,227
<p>I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. </p> <p>Using TCPTrace I was able to get the soap packet passed to the web service but only on a remote machine so I can't debug it there. Is there a way of calling my local webservice with the soap packet generated rather than my current test harness where I manually create objects and call the web service through a web reference?</p> <p>[edit] The machine that I got the soap packet was on a vm so I can't link it to my machine. I suppose I'm looking for a tool that I can paste the soap packet into and it will in turn call my web service</p>
<p>A somewhat manual process would be to use the <a href="http://code.google.com/p/poster-extension/" rel="nofollow noreferrer">Poster</a> add-in for Firefox. There is also a java utility called <a href="http://sourceforge.net/project/showfiles.php?group_id=136013&amp;package_id=163662&amp;release_id=500134" rel="nofollow noreferrer">SoapUI</a> that has some discovery based automated templates that you can then modify and run against your service.</p>
<p>Same as palehorse, use soapUI or directly the specific component for that feature: <a href="http://ws.apache.org/commons/tcpmon/" rel="nofollow noreferrer">TCPMon</a>.</p>
4,827
<p>What culprits are the most likely to cause a <code>404 resource not found</code> error when a page in a given .WAR, autocreated by Sun's J2EE <code>deploytool</code>, is trying to load a Servlet in the same .WAR file? <br/> Eg:</p> <blockquote> <p> <h1>HTTP Status 404 - /MyServlet/MyServlet</h1><p><b>type</b> Status report</p><p><b>message</b> /MyServlet/MyServlet</p><p><b>description</b> The requested resource (/MyServlet/MyServlet) is not available.</p></p> </blockquote> <p><hr> Related: Of these, how many would you expect to be server specific? eg: <i>Sun Java Application Server </i> vs <i>Tomcat &amp; Catalina </i>?</p>
<p>Is there a valid &lt;servlet-mapping&gt; for 'MyServlet' in your web.xml? That's been my number one culprit in the past</p>
<p>I just spent about an hour pulling my hair out on this very problem. Tomcat 5.5.27 on OSX was working just fine until I'd added another servlet and servlet-mapping at which point <em>everything</em> was returning a 404. I hadn't realized it, but when I'd added a new servlet/servlet-mapping pair I'd put the servlet-mapping before the servlet entry. It's an easy mistake to make and, although knee-capping the entire application without giving anything resembling a sensible error message seems a little extreme, it makes perfect sense in retrospect.</p>
9,230
<p>The reason I ask is that Stack Overflow has been <a href="http://slashdot.org/firehose.pl?op=view&amp;id=1170403" rel="nofollow noreferrer">Slashdotted</a>, and <a href="http://www.reddit.com/r/programming/comments/71i4v/stack_overflow_launched_into_public/" rel="nofollow noreferrer">Redditted</a>.</p> <p>First, what kinds of effect does this have on the servers that power a website? Second, what can be done by system administrators to ensure that their sites remain up and running as best as possible?</p>
<p>Unfortunately, if you haven't planned for this before it happens, it's probably too late and your users will have a poor experience. </p> <p>Scalability is your first immediate concern. You may start getting more hits per second than you were getting per month. Your first line of defense is good programming and design. Make sure you're not doing anything stupid like reloading data from a database multiple times per request instead of caching it. Before the spike happens, you need to do some fairly realistic load tests to see where the bottlenecks are.</p> <p>For absurdly high traffic, consider the ability to switch some dynamic pages over to static pages. </p> <p>Having a server architecture that can scale also helps. Shared hosts generally don't scale. A single dedicated machine generally doesn't scale. Using something like Amazon's EC2 to host can help, especially if you plan for a cluster of servers from the beginning (even if your cluster is a single computer).</p> <p>You're next major concern is security. You're suddenly a much bigger target for the bad guys. Make sure you have a good security plan in place. This is something you should always have, but it become more important with high usage.</p>
<p>The app designer needs to think about scaling up (larger machines with more cores and higher performance) and/or scaling out (distributing workload across multiple systems). The IT guy needs to work out how to best support that. The network is what you look at first, because obviously everything rides on top of it. Starting at the border, that usually means network load balancers and redundant routers being served by multiple providers. You can also look at geographic caching services and apps such as cachefly.</p> <p>You want to reduce your bottlenecks as much as possible. You also want to design the environment such that it can be scaled out as needed without much work. Do the design work up front and it'll mean less headaches when you do get dugg.</p>
8,780
<p>I did my homework reading similar questions, like <a href="https://3dprinting.stackexchange.com/questions/8296/petg-sticking-to-nozzle">this</a>, <a href="https://3dprinting.stackexchange.com/questions/7122/petg-filament-doesnt-stick-reliably-to-fake-buildtak-surface">this</a> and <a href="https://3dprinting.stackexchange.com/questions/722/petg-collecting-on-the-extruder">this</a>. Here a video that shows the issue:</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/YVTeJ6Tka_o?start=0"></iframe> </div></div></p> <p>The filament is PETG from <a href="https://www.amazon.it/gp/product/B08BRDT3X8/" rel="nofollow noreferrer">JAYO</a> and the printer is a Dremel 3D45. As you can see, the filament does not stick on the buildplate. The manufacturer suggests to use 220-250 °C for the nozzle and 70-80 °C for the bed. Here what I tried so far:</p> <ul> <li>add purple glue from Dremel</li> <li>bed temperature from 70 to 80 °C</li> <li>nozzle temperature from 235 to 250 °C (below 230 °C it does not come out from the nozzle at all)</li> <li>print speed from 50 to 70 mm/s</li> <li>nozzle gap from 0.0 to 0.4 mm (in step of 0.1 mm). The video was taken with the maximum gap. When the gap is lower, almost all the filament sticks to the nozzle</li> <li>fan speed from 0 % to 50 %</li> <li>the filament is inside a filament dryer</li> <li>clean up the nozzle</li> <li>before each print I level and calibrate the buildplate</li> </ul> <p>Honestly I don't know what to do further. From your experience what should I do to avoid what you see in the video?</p>
<p>Your nozzle is very much too high to properly print just about any filament. If the filament sticks to the nozzle after it is positioned closer to the bed, you have two problems. The first is the initial layer position, sometimes called z-offset. The second is bed adhesion.</p> <p>While the bed is cool, clean it carefully using the appropriate substance for your bed. I'm not familiar with that specific printer, but a glass bed can be cleaned by just about anything, while PEI beds should not have acetone as the cleaning substance. IPA or Denatured Alcohol is pretty safe.</p> <p>Once you can get a clean bed and good adhesion, bring the nozzle back to an appropriate height. 0.4 mm is the most common nozzle diameter (perhaps until lately) and will provide near zero adhesion. 0.15 is the value I use for my printer, but each printer will be different.</p> <p>You don't want ropy stringy build lines, nor do you want a nozzle that flattens the filament into something you can't remove when cool. I've had too-low nozzle height in which the filament was nearly transparent and was nearly impossible to remove.</p>
<p>With one brand of PETG I used 110 degrees on the build plate and 240 for the nozzle. Couldn't get a decent first layer before that.</p>
2,190
<p>In MS Access 2003 (I know, I know), I'm using the OLE Object data type to persist the sate of some objects that are marked as serializable (just using a IO.BinaryFormatter to serialize to a MemoryStream, and then saving that to the db as a Byte array). Does this work pretty much like a varbinary, or a blob? Are there any gotchas looming in the shadows that anyone knows about? Any performance advise or war stories? I'd profit from any advice.</p>
<p>In access I never figured out how to properly use the OLE object data type without real performance problems (and structural too -- lots of compact and repair jobs). The solution path I've always taken (mind you I haven't used Access in anger now for <strong><em>years</em></strong>) is to just store the blogs onto disk somewhere and store the file location in the data table.</p>
<p>I can't answer your specific question, but you might want to look at the GetChunk and AppendChunk methods in Access help, since those are the methods used for writing and manipulating data in binary fields.</p>
5,170
<p>How do you convert between hexadecimal numbers and decimal numbers in C#?</p>
<p>To convert from decimal to hex do...</p> <pre><code>string hexValue = decValue.ToString("X"); </code></pre> <p>To convert from hex to decimal do either...</p> <pre><code>int decValue = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber); </code></pre> <p>or </p> <pre><code>int decValue = Convert.ToInt32(hexValue, 16); </code></pre>
<p>An extension method for converting a byte array into a hex representation. This pads each byte with leading zeros.</p> <pre><code> /// &lt;summary&gt; /// Turns the byte array into its Hex representation. /// &lt;/summary&gt; public static string ToHex(this byte[] y) { StringBuilder sb = new StringBuilder(); foreach (byte b in y) { sb.Append(b.ToString("X").PadLeft(2, "0"[0])); } return sb.ToString(); } </code></pre>
9,984
<p>I currently use a BLtouch 3.1, which is known to stop operating at about 35-40 °C. In fact, when I preheat the bed at 100 °C close to the probe, I sometimes get issues with the pin not retracting correctly.</p> <p>I would like in the future to enclose and heat the printer chamber, therefore I need a probe capable of operating at higher temperature. My target is 100 °C.</p> <p>As of now, I'm aware of this solution:</p> <p><a href="https://hightemp3d.com/products/remoteht-bed-level-probe-3d-printer" rel="nofollow noreferrer">https://hightemp3d.com/products/remoteht-bed-level-probe-3d-printer</a></p> <blockquote> <p>This high temperature probe uses a mechanical switch in combination with a servo motor to probe the bed. The servo motor is outside the enclosure and retracts the probe pin by pulling on a steel string inside a spring guide tube.</p> </blockquote> <p>Microswitches are known to work at high temperatures (that's what the link above uses), but usually need a servo or other mechanism to extend/retract them when needed. Servos typically don't operate at such high temperature, not to mention that they are usually not very accurate.</p> <p>I saw a <a href="https://www.thingiverse.com/thing:4138933" rel="nofollow noreferrer">Hall filament sensor</a> which uses Hall effect sensors &quot;<a href="https://sensing.honeywell.com/honeywell-sensing-ss39et-ss49e-ss59et-product-sheet-005850-3-en.pdf" rel="nofollow noreferrer">ss49e</a>&quot; and which could be easily <a href="https://www.youtube.com/watch?list=PLC-4S0aWJmLgpsTpdV56nfbFBFBC1jijn&amp;v=-UwGZgZvYmw&amp;feature=emb_title" rel="nofollow noreferrer">modified to be used as bed probe</a>. Those Hall effect sensors are rated up to 100 °C but at that temperature they have up to 8% shift of the null value and +3/-9% change in sensitivity. The linked project uses two of them in differential mode so the temperature compensation should be much better, but it is not clear how much better. A <a href="https://3dua.info/topic/21-datchik-diametra-filamenta/?page=2" rel="nofollow noreferrer">discussion</a> about it on a Russian forum does not talk about this.</p> <p>Are there other options operating at 100 °C?</p>
<p>Have you considered using or adapting Prusa’s P.I.N.D.A. V2 or SuperPINDA? Seems that within some bounds they’ve solved the temperature compensation issue.</p> <p>The older P.I.N.D.A. V1 sensor seems to be temperature-sensitive. See more information in <a href="https://help.prusa3d.com/en/article/p-i-n-d-a-superpinda-sensor-testing_2091" rel="nofollow noreferrer">P.I.N.D.A./SuperPINDA Sensor testing</a> article of Pruse Knowledge Base.</p>
<p>There are various designs which can be made to work at 100 °C.</p> <p>For example this <a href="https://www.thingiverse.com/thing:4390007" rel="nofollow noreferrer">solenoid probe</a> uses a solenoid to lift a plunger during print, letting it drop during probing. The design uses a rare earth magnet which usually loses strength at 60-80 °C, but there are high temperature versions or a ferrite magnet will do. It also uses an Attiny13, rated 80 °C, but there are higher temperature versions of the chip. It is likely that it would work out of specs at 100 °C too, but it uses an optical endstop, which is the limiting factor with 85 °C typical.</p> <p><a href="https://www.thingiverse.com/thing:4689074" rel="nofollow noreferrer">This other design</a> uses a solenoid to push up and down a tactile switch. I see no reason why the solenoid would not work at 100 °C, maybe only the external wires may require replacement to withstand the temperature. There is no electronics limiting the operating temperature.</p> <p>Other <a href="https://www.thingiverse.com/thing:3593971" rel="nofollow noreferrer">designs</a> with a servo are limited by the temperature range of the servo, which is typically 50-60 °C max. I think they would work fine up to 80 °C since they are not operated continuously and they are loaded with little force, but there is no guarantee.</p> <p>Another <a href="https://www.thingiverse.com/thing:2752968" rel="nofollow noreferrer">design</a> working perfectly and with an even lower total weight is based on a microswitch and... the user placing the probe in position manually. It can probably be automated by mounting it on a hinge and by using something on the side of the bed to move it in an upright position and in a tilted position, where it could be held by (ferrite) magnets.</p>
1,860
<p>I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinng a warning.</p>
<p>I'd avoid SimpleXML if you can. Though it looks very tempting by getting to avoid a lot of "ugly" code, it's just what the name suggests: simple. For example, it can't handle this:</p> <pre><code>&lt;p&gt; Here is &lt;strong&gt;a very simple&lt;/strong&gt; XML document. &lt;/p&gt; </code></pre> <p>Bite the bullet and go to the DOM Functions. The power of it far outweighs the little bit extra complexity. If you're familiar at all with DOM manipulation in Javascript, you'll feel right at home with this library.</p>
<p>I mostly stick to SimpleXML, at least whenever PHP5 is available for me.</p> <p><a href="http://www.php.net/simplexml" rel="nofollow noreferrer">http://www.php.net/simplexml</a></p>
9,406
<p>We are using the Board SKR 1.3 with the following pins:</p> <pre><code>/** * Trinamic Stallguard pins */ #define X_DIAG_PIN P1_29 // X- #define Y_DIAG_PIN P1_27 // Y- #define Z_DIAG_PIN P1_25 // Z- #define E0_DIAG_PIN P1_28 // X+ #define E1_DIAG_PIN P1_26 // Y+ </code></pre> <p>We need a double Z motor, so We have defined the number of stepper drivers to 2 and it works like a charm:</p> <pre><code>#define NUM_Z_STEPPER_DRIVERS 2 </code></pre> <p>Here is the problem, We need to have a single extruder with <strong>two heating zones</strong>, not a real second extruder. We have defined the number of extruders to 2:</p> <pre><code>#define EXTRUDERS 2 </code></pre> <p>We want to reinforce that the second extruder does not exist, we only need the <strong>second heating zone</strong>. It's a big hotend with two different heating cartridges, that is, two different temperatures. So we do not need the stepper driver, only the temperature. Then we get the following error messages:</p> <p><a href="https://i.stack.imgur.com/5jNEg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5jNEg.png" alt="enter image description here"></a></p> <p>We have thought of enabling the chamber and use it's pin, but we got stuck with all the structure for it:</p> <pre><code>#define TEMP_SENSOR_CHAMBER 5 </code></pre> <pre><code>#define CHAMBER_MAXTEMP 250 // Extruder first temperature zone </code></pre> <pre><code>#define HEATER_CHAMBER_PIN 24 </code></pre>
<p>I second the previous answer if running second Z motor in parallel, just split wires or buy adapter consisting of two females to one male, Z motor on most printers don't draw huge current (or at least in smaller less frequent intervals to give things time to cool). </p> <p>Erm I extruder with two temperature zones, hmmm buy a larger heating element, like a E3D Volcano or I believe they have an extreme version now, mine is rated for 40&nbsp;W+.</p> <p>Or you could use external MOSFET with separate Arduino PID.</p>
<p>Unfortunately, I faced the same problem. The heated chamber will not be accurate enough due to lack of PID tuning. As a result, the temp will differ up to 10 degrees celsius when the heater is on. Is a big difference that will either not dry your filament enough or in the worst scenario will melt it. You will need to enable other features in order to bypass the issue. Find below how I enabled the 2nd heater element with the exact same setup as yours. You need to define the following:</p> <pre><code>#define EXTRUDERS 2 </code></pre> <hr /> <p>On the following part you must change the <code>SERVO_NR</code> to <code>-1</code> otherwise you will face issues in case you are using a BLTouch, for example:</p> <pre><code>// A dual extruder that uses a single stepper motor #define SWITCHING_EXTRUDER #if ENABLED(SWITCHING_EXTRUDER) #define SWITCHING_EXTRUDER_SERVO_NR -1 #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] #if EXTRUDERS &gt; 3 #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 #endif #endif // A dual-nozzle that uses a servomotor to raise/lower one (or both) of the nozzles #define SWITCHING_NOZZLE #if ENABLED(SWITCHING_NOZZLE) #define SWITCHING_NOZZLE_SERVO_NR -1 //#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo) #endif ----------------------------- #define TEMP_SENSOR_1 1 ----------------------------- </code></pre> <p>And finally, you must <code>#define PID_PARAMS_PER_HOTEND</code> in order to be able to PID tuning the 2nd heater which will be used for your inline filament dryer.</p>
1,608
<p>I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other)</p> <p>What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#?</p> <p>Also, what's the smallest ammount of time I can get between t and t+1? One tick?</p> <p>EDIT: Clarifying: What is the smallest unit of time in C#? <code>[TimeSpan].Tick</code>?</p>
<p>In .Net a <code>decimal</code> will be the most precise datatype that you could use for position. I would just write a class for the position:</p> <pre><code>public class Position { decimal x; decimal y; decimal z; } </code></pre> <p>As for time, your processor can't give you anything smaller than one tick.</p> <p>Sounds like an fun project! Good luck!</p>
<p>I'm not sure I understand your last question, could you please clarify?</p> <p>Edit:</p> <p>I might still not understand, but you can use any type you want (for example, doubles) to represent time (if what you actually want is to represent the discretization of time for your physics problem, in which case the tick is irrelevant). For most physics problems, doubles would be sufficient.</p> <p>The tick is the best precision you can achieve when measuring time with your machine.</p>
4,855
<p>I have had problems with items sticking on the build plate, especially when they were big (as they didn't stick well, they corners warped -> all kind of problems).</p> <p>I also wanted to upgrade my printer (Scratch XYCore-Bowden) to have the ability to use flexible filament so first I modified my extruder motor/cog-wheel so it pushes the filament straight into the Bowden tube (classic modification).</p> <p>This worked okay for small parts (as was the case with PLA).</p> <p>The heat-bed seems to flex when heating in an uniform manner so it's not perfectly flat which means the Marlin 3-point test doesn't work out.</p> <p>To alleviate this I added a borosilicate glass on top of the heat bed for perfect 'flatness', but the inductive sensor didn't reach through those extra 3&nbsp;mm of the glass, so I bought another inductive sensor (old was 4&nbsp;mm LJ12A3-4-Z/BY PNP with a voltage divider, new is 8&nbsp;mm NPN) and this started to function somehow:</p> <p>As the sensor doesn't sense the surface (or the glass at all), but senses the heatbed under, which isn't either flat nor stable according to temperature, I added aluminium tape under the glass pane. This actually works perfectly well!</p> <p>Now I am able to tune in the first layer distance really well, but still the flex filament floats around on the glass so I added blue painters tape which makes it work, very very well!</p> <p>All well for flex printing!</p> <p>Switched to PLA (which always worked okay whatever some small errors in print height, and not too wide items) and I have all pieces sticking to the bed in a manner <strong>I just cant get them off...</strong></p> <p>They get big scratches from the pincers, get broken, etc.,...</p> <p>I have tried:</p> <ul> <li><p>Pincers (works for some items, doesn't work for some. About always makes marks);</p></li> <li><p>Ripping off the blue painter tape (the tape was removed everywhere except where the item was stuck. Plus now I have to add new tape);</p></li> <li><p>Chuck the build plate in the freezer for an hour. It helps a lot but:</p> <ol> <li>Still not easy to remove without making marks;</li> <li>It's a serious hassle;</li> <li>It's also a time waster.</li> </ol></li> </ul> <p><strong>My question is:</strong> How can you both reliably print and remove your item without breaking it?</p> <p>Little image of the last part that I broke (the square impact in the middle is after ripping of the "hook" from this hanger when I tried to detach it from the heat bed), as it didn't work at all I had to put it in the freezer for an hour or so to be able to remove the rest:</p> <p><a href="https://i.stack.imgur.com/BbbjJ.jpg" rel="nofollow noreferrer" title="Print damaged during removal"><img src="https://i.stack.imgur.com/BbbjJ.jpg" alt="Print damaged during removal" title="Print damaged during removal"></a></p>
<p>If your print is sticking too well, try printing directly onto the glass.<br> If then, your print isn't sticking well enough, try using something like a glue stick instead. Most people use a paint scraper (<a href="https://mobileimages.lowes.com/product/converted/820909/820909561316.jpg" rel="noreferrer">a small one, like this</a>) to remove prints from build surfaces.</p>
<p>Technology has come to the rescue here. New printing surfaces are available that release PLA very easily. I am using the WhamBam system. A magnet is stuck to the AL bed. A flex steel sheet is placed on the magnet. The flexsteel has a PEX sheet stuck to it.</p> <p>After levelling the bed, a print is done normally. When done, the flex steel sheet is lifted off the magnet. After cooling a minute or two, give the steel a little flex across the two sides, and the piece pops right off.</p> <p>I've posted a video at this Stack Exchange topic</p> <p><a href="https://3dprinting.stackexchange.com/questions/10176/printing-pla-on-pex-surface-is-heated-bed-needed">Printing PLA on PEX surface - is heated bed needed?</a></p>
914
<p>Printer: Monoprice Select V2.</p> <p>I've done several prints already and swapped out filaments many times but in my most recent swap, I can't feed my PLA through any more.</p> <p>I first preheat my extruder for PLA temps (185&nbsp;&deg;C). Then I press the plastic thingy to allow me to push as much of the filament into the hole as possible. Then I adjust my extruder position to try to suck it in. Usually after a few mm, I start to see the filament come out of the extruder and I also feel a pull on the filament from the top. But nothing is happening now.</p> <p>However, if I adjust the extruder position in the opposite direction, it eventually pushes the filament back up and out, so I guess the "stepper motor" (is that what it's called?) is working (at least in one direction).</p> <p>I'm getting ready to open the extruder module up to see what's going on, but wanted to see if anyone had any simple ideas for me to try before I unscrew anything.</p>
<p>I figured out the issue. I think I was shoving it in the wrong hole.</p> <p>I took apart my extruder component. There's a good video on it <a href="https://youtu.be/37df_c2hqYE?t=194" rel="nofollow noreferrer">here</a>. But basically, you just have to loosen the two bottom screws on the side fan like this: <a href="https://i.stack.imgur.com/KAO15.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KAO15.jpg" alt="enter image description here"></a></p> <p>I checked everything out first. I cleaned the extruder head with the included pin. I also shoved the filament through the heated area and filament came out ok. <a href="https://i.stack.imgur.com/uLz5D.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLz5D.jpg" alt="enter image description here"></a></p> <p>But then I discovered the filament could go in the wrong way sometimes through the extruder.</p> <p>This is the correct way for the filament to go through. It should come out of that plastic hole. <a href="https://i.stack.imgur.com/m0aaR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m0aaR.jpg" alt="enter image description here"></a></p> <p>But once in awhile, I accidentally pushed the filament through this way. <a href="https://i.stack.imgur.com/1BxoK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1BxoK.jpg" alt="enter image description here"></a></p> <p>If the filament was bent and I pushed the lever too hard, it would often find its way down the wrong path. So I played around with how much force I should be holding down the lever and how hard I should be pushing the filament through.</p> <p>I don't know if other 3D printer extruder feeders are designed this way, but seems error prone. Or maybe it's just me.</p>
<p>Maybe some PLA is stuck in the throat above the heat break. Can you feed a very small wire all the way through it, or see light through the filament path?</p> <p>185 is a little on the cold side. I would suggest trying to feed at 195 before taking more drastic measures.</p>
1,183
<p>I bought an Anet A8 over christmas. When I bought my printer from Gearbest, I also bought the inductive sensor that they <a href="http://www.gearbest.com/3d-printer-parts/pp_591321.html" rel="nofollow noreferrer">sell</a>.</p> <p>It doesn't seem to work, and I think it might be broken. However, I have no idea how I can test if it is broken. This is what the wiring <a href="http://rotjes.bangblog.eu/reddit/DSC_0112.JPG" rel="nofollow noreferrer">looks</a> like and how it's connected to the <a href="http://rotjes.bangblog.eu/reddit/DSC_0113.JPG" rel="nofollow noreferrer">board</a></p> <p>I'm not sure if I need to modify the wiring in order to hook it up to the A8's motherboard. I have no idea what the pinout is on the A8's mobo, and it's not indicated either. Most guides deal with using RAMPS when it comes to installing such a sensor. I'd like to know how to connect this to my board, if possible.</p> <p>The printer works fine otherwise, so I don't think the board is broken or anything. For now I've resumed using the normal endstop, but I would like to enable bed levelling by installing this sensor. (or a different one if necessary)</p> <p>How do I get this working?</p>
<p>I am not entirely familiar with the ANET A8 electronics, but it's very unlikely it's any different from how any other mainboard works, so any instructions that work for RAMPS should work for your board as well.</p> <p>The sensor you linked to has an operating voltage range of &quot;6V to 36V&quot;. However, the endstop connectors (on any mainboard I've come across) only provide 5V - not enough for the sensor to work. You could verify that this is also the case for your ANET board with a multimeter.</p> <p>(Assuming the colour coding is standard) you'll need to connect the black wire to GND, the red wire to 12V, and the yellow wire <strong>through a diode</strong> to the signal pin of the endstop connector. The anode of the diode should connect to the signal pin and the cathode to the wire coming from the sensor.</p> <p>The diode is required, because otherwise the 12V signal from the sensor will damage your electronics, which can only accept 5V. Any ordinary diode will do (for instance 1N4148). You should enable endstop pullups in your firmware when using this method (though if your board already has physical pullups this is not necessary but won't hurt either).</p> <p>Note that if the sensor is inductive, it will also need an appropriate (metal) surface to trigger off. Unfortunately, it is not clear from the product description what type of sensor you have bought, and (amusingly) gearbest doesn't know either:</p> <blockquote> <p>Question:</p> <p>Hello, is this Sensor capazitiv or induktiv? Thank you verry much.</p> <p>Reply:</p> <p>It is an auto leveling sensor for 3D printers</p> </blockquote>
<p>You will have to:</p> <ol> <li><p>Find and print something on Thingiverse to mount sensor;</p></li> <li><p>Change firmware to Skynet and change the offset values accordingly, in order for the new sensor to recognize the bed.</p></li> </ol> <p>There is official Facebook page of Anet A8 printers as well as Skynet firmware. You can ask there if you need further help. Though the above steps are easy. </p>
480
<p>I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary).</p> <p>I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persistence strategy, and given my company's previous experience with it, Hibernate 3.x is the obvious choice.</p> <p>Migrating to Hibernate is going to take a while, as over 100 tables in the application use entity beans. So I'm looking at a phased approach where the two persistence strategies run in parallel, ideally on the same tables at the same time, if possible.</p> <p>My question is, what are the pitfalls (if any) of combining these two persistence strategies? Will they get in each other's way?</p>
<p>The table cell needs the text-align: center.</p>
<p>The <code>text-align: center</code> should be sufficient, since you're centering the text inside a block element (h2) - adjusting the margins will change the position of the block, not the text.</p> <p>I wonder if it's just that IE is having a dummy-spit at that <code>font</code> declaration you've got there?</p>
9,414
<p>It is generally accepted that the use of cursors in stored procedures should be avoided where possible (replaced with set based logic etc). If you take the cases where you need to iterate over some data, and can do in a read only manner, are fast forward (read only forward) cursor more or less inefficient than say while loops? From my investigations it looks as though the cursor option is generally faster and uses less reads and cpu time. I haven't done any extensive testing, but is this what others find? Do cursors of this type (fast forward) carry additional overhead or resource that could be expensive that I don't know about.</p> <p>Is all the talk about not using cursors really about avoiding the use of cursors when set-based approaches are available, and the use of updatable cursors etc.</p>
<p>While a fast forward cursor does have some optimizations in Sql Server 2005, it is <em>not</em> true that they are anywhere close to a set based query in terms of performance. There are very few situations where cursor logic cannot be replaced by a set-based query. Cursors will always be inherently slower, due in part to the fact that you have to keep interrupting the execution in order to fill your local variables.</p> <p>Here are few references, which would only be the tip of the iceberg if you research this issue: </p> <p><a href="http://www.code-magazine.com/Article.aspx?quickid=060113" rel="nofollow noreferrer">http://www.code-magazine.com/Article.aspx?quickid=060113</a></p> <p><a href="http://dataeducation.com/re-inventing-the-recursive-cte/" rel="nofollow noreferrer">http://dataeducation.com/re-inventing-the-recursive-cte/</a></p>
<p>The 'Best Practice' of avoiding cursors in SQL Server dates back to SQL Server 2000 and earlier versions. The rewrite of the engine in SQL 2005 addressed most of the issues related to the problems of cursors, particularly with the introduction of the fast forward option. Cursors are not neccessarily worse than set-based and are used extensively and successfully in Oracle PL/SQL (LOOP).</p> <p>The 'generally accepted' that you refer to <strong>was</strong> valid, but is now outdated and incorrect - go on the assumption that fast forward cursors behave as advertised and perform. Do some tests and research, basing your findings on SQL2005 and later</p>
5,765
<p>I have a database that contains a date and we are using the MaskedEditExtender (MEE) and MaskedEditValidator to make sure the dates are appropriate. However, we want the Admins to be able to go in and change the data (specifically the date) if necessary. </p> <p>How can I have the MEE field pre-populate with the database value when the data is shown on the page? I've tried to use 'bind' in the 'InitialValue' property but it doesn't populate the textbox.</p> <p>Thanks.</p>
<p>We found out this morning why our code was mishandling the extender. Since the db was handling the date as a date/time it was returning the date in this format 99/99/9999 99:99:99 but we had the extender mask looking for this format 99/99/9999 99:99 </p> <pre><code>Mask="99/99/9999 99:99:99"</code></pre> <p>the above code fixed the problem. thanks to everyone for their help.</p>
<p>Are you referring to the asp.Net Ajax toolkit extensions at:</p> <p><a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/MaskedEdit/MaskedEdit.aspx" rel="nofollow noreferrer">http://www.asp.net/AJAX/AjaxControlToolkit/Samples/MaskedEdit/MaskedEdit.aspx</a></p> <p>If so have you checked that your data is coming back in the correct format? It will have to match your date format in order to be displayed.</p>
3,328
<p>I'm seeing strange errors when my C++ code has min() or max() calls. I'm using Visual C++ compilers.</p>
<p>Check if your code is including the <strong>windows.h</strong> header file and either your code or other third-party headers have their own <strong>min()</strong>/<strong>max()</strong> definitions. If yes, then prepend your <strong>windows.h</strong> inclusion with a definition of <strong>NOMINMAX</strong> like this:</p> <pre><code>#define NOMINMAX #include &lt;windows.h&gt; </code></pre>
<p>Honestly, when it comes to min/max, I find it best to just define my own:</p> <pre><code>#define min(a,b) ((a) &lt; (b) ? (a) : (b)) #define max(a,b) ((a) &gt;= (b) ? (a) : (b)) </code></pre>
3,499
<p>I'm creating an app that holds loads of loads of user data in memory, and it's mostly keeping it all in List&lt;T&gt; structures (and some Dictionary&lt;T,T&gt; when I need lookup).</p> <p>And I'm wondering...</p> <p>How efficient are Lists? How much memory overhead do I get for each of them? (that is, memory space in addition to what the objects they contain would take) How much of a penalty do I pay every time I instance a new one?</p> <p>Is there a more efficient way?</p> <p>Dictionaries are just HashTables, right? Or are them a less efficient data structure?</p> <p>I'd like to use Arrays, but I have the typical problem of adding and removing things all the time from them, so having to grow / shrink them would be a pain.</p> <p>Any ideas/suggestions?</p> <hr> <p>Edit: I know my basic data structures 101, and why a Linked List is better for adding/removing, and a HashTable is better for Random Access.</p> <p>I'm mostly concerned about .Net's idionsyncracies. How much memory each of these structure wastes, for example. And time wasted on initializing / killing them.</p> <p>Things like, for example, if it takes a lot of time to instance/GC a List, but not much to clear it, maybe I should keep a little pool of Lists waiting for me, and clear them and send them back to the pool when done, instead of simply dereferencing them.</p> <p>Or, if Hashtables are faster for access but waste a lot of memory, I might prefer to use Lists and traverse them, for small item counts.</p> <p>And I'd also really like to focus on memory usage, since my app is hediously memory intensive (think memcached like)... Does anyone know where I can find such info?</p>
<p>Lists are arrays underneath, so the performance hit of adding an item, unless it is at the end, will be very costly.</p> <p>Otherwise they will be basically as fast as an array.</p>
<p>The .Net List doesn't use a linked list. It is an array, it starts with 4 positions by default and I think it doubles in size as you add things. So performance can vary a bit depending on how you use it.</p> <hr> <p>If your using VS 2008 run the profiler before you get too far down this rat hole. When we started actually looking at where we were losing time it didn't take long for use to figure out that debating the finer points of linked lists just really didn't matter. </p>
5,344
<p>I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user.</p> <p>Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each user, I'd have to send the email to John at 7 PM Server time and Fred at 4 PM Server time.</p> <p>What's a good approach to this in .NET / Sql Server? I have found an xml file with all of the time zone information, so I am considering writing a script to import it into the database, then querying off of it.</p> <p><strong>Edit:</strong> I used “t4znet.dll” and did all comparisons on the .NET side.</p>
<p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p> <p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.microsoft.com/kb/303650</a></p>
<p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p> <p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.microsoft.com/kb/303650</a></p>
4,230
<p>My question concerns c# and how to access Static members ... Well I don't really know how to explain it (which kind of is bad for a question isn't it?) I will just give you some sample code:</p> <pre><code>Class test&lt;T&gt;{ int method1(Obj Parameter1){ //in here I want to do something which I would explain as T.TryParse(Parameter1); //my problem is that it does not work ... I get an error. //just to explain: if I declare test&lt;int&gt; (with type Integer) //I want my sample code to call int.TryParse(). If it were String //it should have been String.TryParse() } } </code></pre> <p>So thank you guys for your answers (By the way the question is: how would I solve this problem without getting an error). This probably quite an easy question for you!</p> <hr /> <p>Edit: Thank you all for your answers!</p> <p>Though I think the try - catch phrase is the most elegant, I know from my experience with vb that it can really be a bummer. I used it once and it took about 30 minutes to run a program, which later on only took 2 minutes to compute just because I avoided try - catch.</p> <p>This is why I chose the switch statement as the best answer. It makes the code more complicated but on the other hand I imagine it to be relatively fast and relatively easy to read. (Though I still think there should be a more elegant way ... maybe in the next language I learn)</p> <hr /> <p>Though if you have some other suggestion I am still waiting (and willing to participate)</p>
<p>The problem is that TryParse isn't defined on an interface or base class anywhere, so you can't make an assumption that the type passed into your class will have that function. Unless you can contrain T in some way, you'll run into this a lot.</p> <p><a href="http://msdn.microsoft.com/en-us/library/d5x73970.aspx" rel="noreferrer" title="C# Programming Guide (MSDN)">Constraints on Type Parameters</a></p>
<p>That is not how statics work. You have to think of statics as sort of in a Global class even if they are are spread across a whole bunch of types. My recommendation is to make it a property inside the T instance that can access the necessary static method.</p> <p>Also T is an actual instance of something, and just like any other instance you are not able to access the statics for that type, through the instantiated value. Here is an example of what to do:</p> <pre><code>class a { static StaticMethod1 () virtual Method1 () } class b : a { override Method1 () return StaticMethod1() } class c : a { override Method1 () return "XYZ" } class generic&lt;T&gt; where T : a { void DoSomething () T.Method1() } </code></pre>
4,023
<p>I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go.</p> <p>The question: Is there a good regex library for VB6?</p> <p>Thank you!</p> <p>Edit: Holy crap, 3 responses in under an hour. Thanks a ton, folks! I've heard such good things about Regex Buddy from Jeff's postings / podcasting, that I will have to take a look.</p>
<p>Use the Regex COM component built into Windows. You can find a step by step on referencing and using it in your project at: <a href="http://www.regular-expressions.info/vb.html" rel="nofollow noreferrer">http://www.regular-expressions.info/vb.html</a></p>
<p>Use the Regex COM component built into Windows. You can find a step by step on referencing and using it in your project at: <a href="http://www.regular-expressions.info/vb.html" rel="nofollow noreferrer">http://www.regular-expressions.info/vb.html</a></p>
6,643
<p>What are the fundamentals to accomplish data encryption with exactly two keys (which could be password-based), but needing only one (either one) of the two keys to decrypt the data?</p> <p>For example, data is encrypted with a user's password and his company's password, and then he or his company can decrypt the data. Neither of them know the other password. Only one copy of the encrypted data is stored.</p> <p>I don't mean public/private key. Probably via symmetric key cryptography and maybe it involves something like XORing the keys together to use them for encrypting. </p> <p>Update: I would also like to find a solution that does not involve storing the keys at all.</p>
<p>The way this is customarily done is to generate a single symmetric key to encrypt the data. Then you encrypt the symmetric key with each recipient's key or password to that they can decrypt it on their own. S/MIME (actually the Cryptographic Message Syntax on which S/MIME is based) uses this technique.</p> <p>This way, you only have to store one copy of the encrypted message, but multiple copies of its key.</p>
<p>I think I thought of a solution that would work:</p> <pre><code>D = data to encrypt h1 = hash(userpassword) h2 = hash(companyPassword) k = h1 concat h2 E = function to encrypt //C is the encrypted data C = E_h1(h2) concat E_h2(h1) concat E_k(D) </code></pre> <p>Then either person can decrypt the hash of the other person, and then combine them to decrypt the rest of the data.</p> <p>Perhaps there is a better solution than this though?</p>
5,983
<p>In my code behind I wire up my events like so:</p> <pre><code>protected override void OnInit(EventArgs e) { base.OnInit(e); btnUpdateUser.Click += btnUpateUserClick; } </code></pre> <p>I've done it this way because that's what I've seen in examples. </p> <ul> <li>Does the base.OnInit() method need to be called? </li> <li>Will it be implicitly be called? </li> <li>Is it better to call it at the beginning of the method or at the end? </li> <li>What would be an example where confusion over the base method can get you in trouble? </li> </ul>
<p>I should clarify:</p> <p>The guidelines recommend that firing an event should involve calling a virtual "On<em>EventName</em>" method, but they also say that if a derived class overrides that method and forgets to call the base method, the event should still fire.</p> <p>See the "Important Note" about halfway down <a href="http://msdn.microsoft.com/en-us/library/ms229011.aspx" rel="nofollow noreferrer">this page</a>:</p> <blockquote> <p>Derived classes that override the protected virtual method are not required to call the base class implementation. The base class must continue to work correctly even if its implementation is not called.</p> </blockquote>
<p>In this case, if you don't call the base OnInit, then the Init even will not fire.</p> <p>In general, it is best practice to ALWAYS call the base method, unless you specifically know that you do not want the base behaviour to occur.</p> <p>Whether its called at the start or the end depends on how you want things to work. In a case like this, where you are using an override instead of hooking up an event handler, calling it at the start of the method makes more sense. That way, your code will run after any handlers, which makes it more emulate a "normal" event handler.</p>
3,972
<p>When running <a href="https://github.com/MarlinFirmware/Marlin" rel="nofollow noreferrer">Marlin Firmware</a>, is it possible to run <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> scripts/series of commands automatically when you insert the SD card?</p> <hr> <p>I'm running Marlin on a 3D printer board using an ATmega 2560 based board with a reprap discount LCD controller with an SD card slot. I would like to do this without the need to add another computer/board, so native from the board running the Marlin Firmware.</p>
<p>I am not <em>entirely sure</em> if this is what you are after, or if it will work, but from <a href="https://github.com/MarlinFirmware/Marlin/issues/2891#issuecomment-180980733" rel="nofollow noreferrer">this post</a> on <a href="https://github.com/MarlinFirmware/Marlin/issues/2891" rel="nofollow noreferrer">Printing From SD Card when printer is turned On</a></p> <blockquote> <p>While an LCD controller is not needed for auto#.g to work, if you have an LCD controller you can use the <code>MENU_ADDAUTOSTART</code> option to add a menu command that will run the auto0.g, auto1.g, auto2.g whenever you want.</p> </blockquote> <p>This (final) post ended up closing the thread so it appears to answer the OP's question - however, whether it will answer your question is another matter.</p> <hr /> <p><a href="https://reprap.org/forum/read.php?415,833394" rel="nofollow noreferrer">This post</a>, on the Marlin forum, replicates your question and asks about purely insertion of an SD card on a printer which is <em>already</em> powered on.</p> <p><a href="https://reprap.org/forum/read.php?415,833394,833489#msg-833489" rel="nofollow noreferrer">A reply</a> was received and apparently it should be possible by making a code change in <code>ultralcd.ccp</code>:</p> <blockquote> <p>It does not seem like an auto print, when inserting a SD-card, is to be found in the current program code of Marlin.</p> <p>You might consider making a feature request here: [<a href="https://github.com/MarlinFirmware/Marlin/issues" rel="nofollow noreferrer">github.com</a>]</p> <p>I do not think that it would require much work to implement a &quot;card.autoprintfile()&quot; function in Marlin. It seems to me that a call to such a function could happen at line 5172 right after:</p> <pre><code>else LCD_MESSAGEPGM(MSG_SD_INSERTED); </code></pre> <p>in the file <code>ultralcd.ccp</code></p> </blockquote> <p>A subsequent feature request has been made on Marlin's GitHub, see <a href="https://github.com/MarlinFirmware/Marlin/issues/11815" rel="nofollow noreferrer">[FR] Can G-code scripts be run automatically on inserting an SD card when using Marlin Firmware?</a></p> <p>However, from <a href="https://github.com/MarlinFirmware/Marlin/issues/11815#issuecomment-420791259" rel="nofollow noreferrer">this reply</a>, it appears that a feature request is already pending:</p> <blockquote> <p>I'm not in favor of this as a general feature. We already have a feature request to be able to run custom G-code in response to various events, with SD card insertion being one of those events. Would that feature serve your needs?</p> </blockquote> <p>However, as yet, I do not have a link to this other feature request. Will update as and when.</p> <hr /> <p>As an aside, in might be worth mentioning that the SDFat related code could be the place to code this in, see <a href="https://forum.arduino.cc/index.php?topic=360754.0" rel="nofollow noreferrer">if SD card removed, how to flag and restart?</a>, although after looking at the Marlin codebase, in particular <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/SdFatUtil.cpp" rel="nofollow noreferrer"><code>SdFatUtils.cpp</code></a>, this would appear to be a <a href="https://en.wikipedia.org/wiki/Red_herring" rel="nofollow noreferrer">red herring</a>.</p>
<p>I don't know what you would like to achieve.</p> <p>As @typo mentioned there is similar functionality which triggers at printer startup: <a href="https://github.com/MarlinFirmware/Marlin/wiki/Autostart" rel="nofollow noreferrer">https://github.com/MarlinFirmware/Marlin/wiki/Autostart</a></p> <p>I found in Marlin's source code that you can enable that autostart feature to be triggered from menu. Just enable <code>MENU_ADDAUTOSTART</code> in <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration_adv.h" rel="nofollow noreferrer">Configuration_adv.h</a>. </p> <p>If you really need a g-code that start after sd-card insert then you have to adjust the marlin source code on your own. I suggest to alter file <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/cardreader.cpp" rel="nofollow noreferrer">cardreader.cpp</a>. There you have to trigger the autostart procedure after a sd-card is inserted.</p>
1,021
<p>I often run into the following problem.</p> <p>I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always remember what I've changed and I don't always remember to write it down.</p> <p>So, I make a push to the live system and get a big, obvious error that there is no <code>NewColumnX</code>, ugh.</p> <p>Regardless of the fact that this may not be the best practice for this situation, is there a version control system for databases? I don't care about the specific database technology. I just want to know if one exists. If it happens to work with MS SQL Server, then great.</p>
<p>In Ruby on Rails, there's a concept of a <a href="http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations" rel="noreferrer">migration</a> -- a quick script to change the database.</p> <p>You generate a migration file, which has rules to increase the db version (such as adding a column) and rules to downgrade the version (such as removing a column). Each migration is numbered, and a table keeps track of your current db version.</p> <p>To <em>migrate up</em>, you run a command called "db:migrate" which looks at your version and applies the needed scripts. You can migrate down in a similar way.</p> <p>The migration scripts themselves are kept in a version control system -- whenever you change the database you check in a new script, and any developer can apply it to bring their local db to the latest version.</p>
<p>In the absence of a VCS for table changes I've been logging them in a wiki. At least then I can see when and why it was changed. It's far from perfect as not everyone is doing it and we have multiple product versions in use, but better than nothing.</p>
2,280
<p>I'm in the process of building my own head unit / stereo prototype for a car, which will have a 3D-printed enclosure.</p> <p>My concern is that cars can get quite hot in the sun, and even more so if you live in hot climates. Some estimations put the interior of cars getting up to 50-60&nbsp;°C, sometimes even in only 20&nbsp;°C weather due to the 'greenhouse' effect created in the car. I live in a fairly temperate climate, but the summers can still get up to 20-29&nbsp;°C (80-85&nbsp;°F), and my car might get up to 60&nbsp;°C/150&nbsp;°F on a hot day.</p> <p>The part won't be exposed <em>directly</em> to the sun, but will obviously be exposed to heat both from the interior of the car when in the sun, and potentially from the engine radiating heat through the firewall, though the latter factor will differ from car to car.</p> <p>Should I be concerned using PLA for my part? If not, what material, if any, would be better suited for these possible temperatures (other than metal)?</p>
<p>No, PLA cannot be used in cars standing in the sun. Temperatures can locally get over 50 °C (122 °F).</p> <p>I have printed sun visor hinge pins from PLA for a car (not exposed to direct sunlight either), but after one day in the sun (it usually doesn't get over 29 °C or about 85 ˚F here too) the pin deformed (only printed it for form fitting). The actual pin was eventually printed in PETG, and even with PETG the part deformed a little when it got really hot in the car.</p> <p>Your part might not get that hot as it is lower in the car, but you could best print parts in Nylon (Polyamide, PA), ABS or any other high temperature resistant Co-Polymer (e.g. made from Amphora HT5300), there are lots to choose from nowadays.</p> <p>If it is a non load bearing component that is not stressed (e.g. a cover or a bushing) it could be printed in PLA, but I would not take a change and would print it directly in a more temperature resistant material.</p> <hr /> <p>Downloading some of the technical data sheets from various filaments will give you for <a href="https://ultimaker.com/en/resources/49911-pla#technical" rel="nofollow noreferrer">PLA</a>:</p> <blockquote> <p><strong>Not suitable for</strong> long term outdoor usage or applications where the printed part is exposed to temperatures higher than 50 °C (122 °F).</p> </blockquote> <p>similar for <a href="https://ultimaker.com/en/resources/49913-nylon#technical" rel="nofollow noreferrer">Nylon</a>:</p> <blockquote> <p><strong>Not suitable for</strong> applications where the printed part is exposed to temperatures higher than 80 °C (176 °F).</p> </blockquote> <p>To complete the overview, generally, materials should not be exposed prolonged periods of time above (give or take):</p> <ul> <li>70 °C (158 °F) for basic Co-Polymers</li> <li>85 °C (185 °F) for ABS</li> <li>100 °C (212 °F) for enhanced Co-Polymers and ASA</li> <li>105 °C (221 °F) for Polypropylene (PP)</li> <li>110 °C (230 °F) for Polycarbonate (PC)</li> </ul>
<p>If you put PLA parts in a sealed plastic bag (or two to keep it dry) and simmer in water (212&nbsp;&deg;F or 100&nbsp;&deg;C), the part "anneals". The time taken varies with the part shape, but for small parts should be about 15-30&nbsp;minutes. You can simmer longer if unsure, but it provides no additional benefit once the part is annealed. When you remove and cool the annealed part, it will feel harder and more compact. You may also notice a slight hazing or color change.</p> <p>Annealed parts become a bit more resistant to heat warp. The annealing process shrinks and hardens your part (I've annealed gears) so you need to account for the shrinkage by making the unannealed part slightly larger. I do this for stepper mounts or gears as needed. Putting your part in the passenger compartment of a car can work depending on your climate. My daughter-in-law has a camera mount on her dashboard showing significant warp, but she still uses it.</p> <p>Here's <a href="https://rigid.ink/blogs/news/how-to-anneal-your-3d-prints-for-strength" rel="nofollow noreferrer">more information</a> and I'm sure you can find more...</p>
925
<p>I have a C# singleton class that multiple classes use. Is access through <code>Instance</code> to the <code>Toggle()</code> method thread-safe? If yes, by what assumptions, rules, etc. If no, why <em>and</em> how can I fix it?</p> <pre><code>public class MyClass { private static readonly MyClass instance = new MyClass(); public static MyClass Instance { get { return instance; } } private int value = 0; public int Toggle() { if(value == 0) { value = 1; } else if(value == 1) { value = 0; } return value; } } </code></pre>
<blockquote> <p>Is access through 'Instance' to the 'Toggle()' class threadsafe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it?</p> </blockquote> <p>No, it's not threadsafe.</p> <p>Basically, both threads can run the <code>Toggle</code> function at the same time, so this could happen</p> <pre><code> // thread 1 is running this code if(value == 0) { value = 1; // RIGHT NOW, thread 2 steps in. // It sees value as 1, so runs the other branch, and changes it to 0 // This causes your method to return 0 even though you actually want 1 } else if(value == 1) { value = 0; } return value; </code></pre> <p>You need to operate with the following assumption.</p> <p>If 2 threads are running, they can and will interleave and interact with eachother randomly at any point. You can be half way through writing or reading a 64 bit integer or float (on a 32 bit CPU) and another thread can jump in and change it out from underneath you.</p> <p>If the 2 threads never access anything in common, it doesn't matter, but as soon as they do, you need to prevent them from stepping on each others toes. The way to do this in .NET is with locks.</p> <p>You can decide what and where to lock by thinking about things like this:</p> <p>For a given block of code, if the value of <code>something</code> got changed out from underneath me, would it matter? If it would, you need to lock that <code>something</code> for the duration of the code where it would matter.</p> <p>Looking at your example again</p> <pre><code> // we read value here if(value == 0) { value = 1; } else if(value == 1) { value = 0; } // and we return it here return value; </code></pre> <p>In order for this to return what we expect it to, we assume that <code>value</code> won't get changed between the read and the <code>return</code>. In order for this assumption to actually be correct, you need to lock <code>value</code> for the duration of that code block.</p> <p>So you'd do this:</p> <pre><code>lock( value ) { if(value == 0) ... // all your code here return value; } </code></pre> <p><strong>HOWEVER</strong></p> <p>In .NET you can only lock Reference Types. Int32 is a Value Type, so we can't lock it.<br> We solve this by introducing a 'dummy' object, and locking <em>that</em> wherever we'd want to lock 'value'.</p> <p>This is what <a href="https://stackoverflow.com/questions/42505/thread-safe-use-of-a-singletons-members/42517#42517">Ben Scheirman</a> is referring to.</p>
<p>Well, I actually don't know C# that well... but I am ok at Java, so I will give the answer for that, and hopefully the two are similar enough that it will be useful. If not, I apologize.</p> <p>The answer is, no, it's not safe. One thread could call Toggle() at the same time as the other, and it is possible, although unlikely with this code, that Thread1 could set <code>value</code> in between the times that Thread2 checks it and when it sets it.</p> <p>To fix, simply make Toggle() <code>synchronized</code>. It doesn't block on anything or call anything that might spawn another thread which could call Toggle(), so that's all you have to do save it.</p>
6,402
<p>I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity .vm files), configs (struts.xml, persistence.xml) from main WAR file.</p> <p>I have all in default structure like: </p> <pre> application |-- <i><b>META-INF</b></i> -- Some configs are here |-- <i><b>WEB-INF</b></i> -- others here | |-- classes | | |-- META-INF | | `-- mypackage | | `-- class-files | `-- lib |-- css `-- <i><b>tpl</b></i> -- Template dir to be relocated </pre> <p>And I apparently can't find documentation about how to setup (probably in struts.xml) where my templates go, and where config files will be.</p> <p>I think I will have to use configurations on the application server too (I am using Jetty 5.1.14).</p> <p>So, any lights on how to configure it ? </p> <p>Thanks</p> <hr> <p>Well, the whole thing about changing templates place is to put the templates in a designer accessible area, so any modification needed, the designer can load them to his/her computer, edit, and upload it again. I think this is a common scenario. So, probably I am missing something in my research. Maybe I am focusing in configuring it on the wrong place ... Any thoughts ?</p>
<p>If I understood your question about Struts config files right, they are specified in web.xml. Find the Struts servlet config param. The param-value can be a list of comma separated list of XML files to load. Eg:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;config&lt;/param-name&gt; &lt;param-value&gt; WEB-INF/config/struts-config.xml, WEB-INF/config/struts-config-stuff.xml, WEB-INF/config/struts-config-good.xml, WEB-INF/config/struts-config-bad.xml, WEB-INF/config/struts-config-ugly.xml &lt;/param-value&gt; &lt;/init-param&gt; ... &lt;/servlet&gt; </code></pre> <p>See this <a href="http://struts.apache.org/1.x/userGuide/configuration.html" rel="nofollow noreferrer">Struts guide</a> under 5.3.2. And yes, this applies to 2.x also.</p>
<p>For <em>persistence.xml</em>, specifically, you can put a persistence unit in a separate JAR, which you can deploy separately from your web application WAR, or both together in an EAR archive, depending on what your application server supports. For example, the JBoss manual describes this as <a href="http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/beta422/html/ch01s04s02.html" rel="nofollow noreferrer">Deploy EAR with EJB3 JAR</a>. </p> <p>For <em>struts-config.xml</em> I expect that you are going to have to override the Struts code that loads it, if you want to use a non-standard location.</p> <p>I don't know about the Velocity templates.</p> <p>In general, web applications only load resources from within the WAR, for security reasons. There are other techniques you can use, but you may find it easier to try <a href="https://weblets.dev.java.net/" rel="nofollow noreferrer">weblets</a>, which seems to be a framework designed to let you load resources from a separate JAR.</p>
5,602
<p>I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3:</p> <pre><code> proc2 -&gt; stdout / proc1 \ proc3 -&gt; stdout </code></pre> <p>I tried</p> <pre><code> proc1 | (proc2 &amp; proc3) </code></pre> <p>but it doesn't seem to work, i.e.</p> <pre><code> echo 123 | (tr 1 a &amp; tr 1 b) </code></pre> <p>writes</p> <pre><code> b23 </code></pre> <p>to stdout instead of </p> <pre><code> a23 b23 </code></pre>
<p><sup><em>Editor's note</em>:<br> - <code>&gt;(…)</code> is a <a href="http://mywiki.wooledge.org/ProcessSubstitution" rel="noreferrer"><em>process substitution</em></a> that is a <em>nonstandard shell feature</em> of <em>some</em> POSIX-compatible shells: <code>bash</code>, <code>ksh</code>, <code>zsh</code>.<br> - This answer accidentally sends the output process substitution's output through the pipeline <em>too</em>: <code>echo 123 | tee &gt;(tr 1 a) | tr 1 b</code>.<br> - Output from the process substitutions will be unpredictably interleaved, and, except in <code>zsh</code>, the pipeline may terminate before the commands inside <code>&gt;(…)</code> do.</sup></p> <p>In unix (or on a mac), use the <a href="http://en.wikipedia.org/wiki/Tee_(command)" rel="noreferrer"><code>tee</code> command</a>:</p> <pre><code>$ echo 123 | tee &gt;(tr 1 a) &gt;(tr 1 b) &gt;/dev/null b23 a23 </code></pre> <p>Usually you would use <code>tee</code> to redirect output to multiple files, but using >(...) you can redirect to another process. So, in general,</p> <pre><code>$ proc1 | tee &gt;(proc2) ... &gt;(procN-1) &gt;(procN) &gt;/dev/null </code></pre> <p>will do what you want.</p> <p>Under windows, I don't think the built-in shell has an equivalent. Microsoft's <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" rel="noreferrer">Windows PowerShell</a> has a <code>tee</code> command though. </p>
<p>another way to do would be,</p> <pre><code> eval `echo '&amp;&amp; echo 123 |'{'tr 1 a','tr 1 b'} | sed -n 's/^&amp;&amp;//gp'` </code></pre> <p>output:</p> <pre><code>a23 b23 </code></pre> <p>no need to create a subshell here</p>
8,604
<p>I would like to debug my separately running JSP/Struts/Tomcat/Hibernate application stack using the Eclipse IDE debugger. How do I setup the java JVM and eclipse so that I can set breakpoints, monitor variable values, and see the code that is currently executing?</p>
<p>I just Googled it. :)</p> <p><a href="http://bugs.sakaiproject.org/confluence/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging" rel="noreferrer">http://bugs.sakaiproject.org/confluence/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging</a></p> <p>Many more on google.</p> <p>Effectively, set your JPDA settings: set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket bin/catalina.bat jpda start</p> <p>Then, in Eclipse, Run->Debug Configurations...->Remote Applications.</p>
<p>Follow these steps:</p> <ol> <li><p>Add the following arguments to the <code>java</code> command that is used to launch Tomcat (on Windows, I think this is in TOMCAT\bin\catalina.bat)</p> <p>-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n</p></li> <li><p>In Eclipse, create a 'Remote Java Application' debug configuration and set the port to 8787 and the host to the name (or IP address) of the machine where Tomcat is running. If Tomcat is running on the same machine as Eclipse, use 'localhost'.</p></li> <li><p>In the 'source' tab of the debug configuration, add any projects that you want to debug into</p></li> <li><p>Start Tomcat</p></li> <li><p>Launch the debug configuration you created in step 2</p></li> <li><p>Eclipse should now stop at any breakpoints that you've set in the projects you added in step 3.</p></li> </ol> <h2>Notes:</h2> <ul> <li>You can change the port to any other available port if for some reason you can't use 8787</li> <li>If you want Tomcat to wait for the remote debugger to start, use 'suspend=n' in the command above to 'suspend=y'</li> </ul>
9,337
<p>I have a long running SQL statement that I want to run, and no matter what I put in the "timeout=" clause of my connection string, it always seems to end after 30 seconds. </p> <p>I'm just using <code>SqlHelper.ExecuteNonQuery()</code> to execute it, and letting it take care of opening connections, etc.</p> <p>Is there something else that could be overriding my timeout, or causing sql server to ignore it? I have run profiler over the query, and the trace doesn't look any different when I run it in management studio, versus in my code.</p> <p>Management studio completes the query in roughly a minute, but even with a timeout set to 300, or 30000, my code still times out after 30 seconds.</p>
<p>What are you using to set the timeout in your connection string? From memory that's "ConnectionTimeout" and only affects the time it takes to actually <em>connect</em> to the server.</p> <p>Each individual command has a separate "CommandTimeout" which would be what you're looking for. Not sure how SqlHelper implements that though.</p>
<p><s>In addition to timeout in connection string,</s> try using the timeout property of the SQL command. Below is a C# sample, using the SqlCommand class. Its equivalent should be applicable to what you are using.</p> <pre><code>SqlCommand command = new SqlCommand(sqlQuery, _Database.Connection); command.CommandTimeout = 0; int rows = command.ExecuteNonQuery(); </code></pre>
4,706
<p>In E (specman) I want to declare variables that are lists, and I want to fix their lengths.</p> <p>It's easy to do for a member of a struct:</p> <pre><code>thread[2] : list of thread_t; </code></pre> <p>while for a "regular" variable in a function the above doesn't work, and I have to do something like:</p> <pre><code>var warned : list of bool; gen warned keeping { it.size() == 5; }; </code></pre> <p>Is there a better way to declare a list of fixed size?</p>
<p>A hard keep like you have is only going to fix the size at initialization but elements could still be added or dropped later, are you trying to guard against this condition? The only way I can think of to guarantee that elements aren't added or dropped later is emitting an event synced on the size != the predetermined amount:</p> <pre><code>event list_size_changed is true (wanted.size() != 5) @clk; </code></pre> <p>The only other thing that I can offer is a bit of syntactic sugar for the hard keep:</p> <pre><code>var warned : list of bool; keep warned.size() == 5; </code></pre>
<p>I know nothing of specman, but a fixed sized list is an array, so that might point you somewhere.</p>
4,102
<p>We're looking for a package to help identify and automatically rotate faxed TIFF images based on a watermark or logo. </p> <p>We use libtiff for rotation currently, but don't know of any other libraries or packages I can use for detecting this logo and determining how to rotate the images.</p> <p>I have done some basic work with OpenCV but I'm not sure that it is the right tool for this job. I would prefer to use C/C++ but Java, Perl or PHP would be acceptable too. </p>
<p>You are in the right place using OpenCV, it is an excellent utility. For example, <a href="http://www.nashruddin.com/template-matching-in-opencv-with-example.html" rel="nofollow noreferrer">this guy</a> used it for template matching, which is fairly similar to what you need to do. Also, the link Roddy specified looks similar to what you want to do.</p> <p>I feel that OpenCV is the best library out there for this kind of development.</p> <p>@Brian, OpenCV and the IntelIPP are closely linked and very similar (both Intel libs). As far as I know, if OpenCV finds the intel IPP on your computer it will automatically use it under the hood for improved speed.</p>
<p>The Intel Performance Primitives (IPP) library has a lot of very efficient algorithms that help with this kind of a task. The library is callable from C/C++ and we have found it to be very fast. I should also note that it's not limited to just Intel hardware.</p>
5,263
<p>Is there a web service of some sort (or any other way) to pull a current time zone settings for a (US) city. For the parts of the country that don't follow the Daylight Saving Time and basically jump timezones when everyone else is switching summer/winter time... I don't fancy creating own database of the places that don't follow DST. Is there a way to pull this data on demand? </p> <p>I need this for the database server (not for client workstations) - there entities stored in the database that have City, State as properties. I need know current timezone for these entities at any moment of time.</p>
<p>earthtools.org provides a free web service to get the time zone from a city here:</p> <p><a href="http://www.earthtools.org/webservices.htm#timezone" rel="noreferrer">http://www.earthtools.org/webservices.htm#timezone</a></p> <p>You just pass in the long/lat values like this: (This is for New York)</p> <p><a href="http://www.earthtools.org/timezone-1.1/40.71417/-74.00639" rel="noreferrer">http://www.earthtools.org/timezone-1.1/40.71417/-74.00639</a></p> <hr> <p><strong>EDIT:</strong></p> <p>It seems like earthtools has been shut down. A good alternative (That did not exist in 2008 when this question was answered) is the Google Time Zone API. To use it you must first <a href="https://console.developers.google.com/flows/enableapi?apiid=timezone_backend&amp;keyType=SERVER_SIDE" rel="noreferrer">activate the Time Zone API</a> on your account. It is free if you stay below these limits:</p> <ul> <li>2500 requests per 24 hour period.</li> <li>5 requests per second.</li> </ul> <p><a href="https://developers.google.com/maps/documentation/timezone/intro" rel="noreferrer">The documentation</a> is available on Google Developers.</p>
<p>I know this is answered, but I am posting this answer as people might still find it useful - The selected answer does not work successfuly right now.</p> <p>Google have their own service, which is very reliable and easy to use, and outputs info in JSON format. It even allows for specifying a custom time, e.g get the timezone in 02/02/2013 in Malta.</p> <p><a href="https://developers.google.com/maps/documentation/timezone/" rel="nofollow">https://developers.google.com/maps/documentation/timezone/</a></p>
7,975
<p>Is it possible at runtime to programmatically check the name of the Thread that is holding the lock of a given object?</p>
<p>You can only tell whether the current thread holds a normal lock (<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#holdsLock%28java.lang.Object%29" rel="noreferrer"><code>Thread.holdsLock(Object)</code></a>). You can't get a reference to the thread that has the lock without native code.</p> <p>However, if you're doing anything complicated with threading, you probably want to familiarize yourself with the java.util.concurrent packages. The <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantLock.html" rel="noreferrer"><code>ReentrantLock</code></a> does allow you to get its owner (but its a protected method, so you'd have to extend this). Depending on your application, it may well be that by using the concurrency packages, you'll find that you don't need to get the lock's owner after all.</p> <p>There are non-programmatic methods to find the lock owners, such as signaling the JVM to issue a thread dump to stderr, that are useful to determine the cause of deadlocks.</p>
<p>You can use a variable to hold the current thread when you take the lock, then print it if someone else is trying to use it.</p> <pre><code>Thread holderOfLock = null; Object theLock = new Object(); public void doStuff() { if(holderOfLock != null) { //get and print name of holderOfLock-thread or get stacktrace etc. } synchronized (theLock) { holderOfLock = Thread.currentThread(); //do stuff... holderOfLock = null; } } </code></pre>
7,335
<p>EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters</p> <p>Our business uses the WebMethods integration server to handle most of our outbound communications, and its FTP functionality leaves something to be desired. We are having a problem that may be specific to WebMethods, but if anyone can point me in a direction of what kinds of things might cause this I'd appreciate it.</p> <p>When polling two of our partners' FTP servers, we connect without issue but, when doing a NLST on a directory that is empty (no files and no subdirectories) it's timing out. The actual error is:</p> <blockquote> <p>com.wm.net.ftpCException: [ISC.0064.9010] java.net.SocketTimeoutException: Accept timed out</p> </blockquote> <p>It's being thrown during the invocation of the pub.client.ftp:ls service. I've logged in with a number of FTP clients without a problem to the same sites. I've used whatever the default FTP client is in windows, FileZilla and lftp. All without issue. The servers themselves aren't the same FTP server software from what I can tell. One is Microsoft FTP, the other I'm uncertain on but is definitely not Microsoft.</p> <p>Any idea what could cause an FTP client to timeout when waiting for a NLST response on an empty directory? The visible responses from the FTP server appear to be the same, but is there a difference in how NLST responds for an empty directory that I'm unaware of?</p> <p>This problem is consistent on these two servers. Everything functions fine on directories with files or subdirectories within it, but not when empty.</p> <p>Any thoughts or directions would be appreciated.</p> <p>Thanks!</p> <p>Eric Sipple</p>
<p>I tried this in WebMethods IS Version 6.5 Updates WmPRT_6-5-1_SP1, IS_6-5_SP3.</p> <p>It worked perfectly first time.</p> <p>I turned on debugging on the FTP server (Debian's default ftpd). WebMethods' NLST honours the active/passive parameter passed to it.</p> <p>There's nothing special about the NLST command, nor its correct behaviour with an empty directory -- if LIST works, then so should RETR, STOR and NLST. If NLST works with a non-empty directory, it should work with an empty one.</p> <p>So my guess is that either:</p> <ul> <li>Your version of WM has a bug mine doesn't</li> <li>Your FTP server has a bug mine doesn't</li> <li>There's a wacky protocol-aware firewall in your system that doesn't like FTP data sockets with no data in them.</li> </ul> <p>Firewall vendors are a bit wayward when it comes to FTP... When testing with other clients, make sure it's from the same machine on which WebMethods Integration Server is running.</p> <p>Just for the record, here's what should happen for an active NLST</p> <ul> <li>client opens a listening socket, and sends a PORT command with that socket's details</li> <li>client sends NLST command</li> <li>server connects to client's listening socket (this is the data socket)</li> <li>server transmits listing over data socket (in this case, zero bytes)</li> <li>server closes data socket</li> </ul> <p>... and in passive mode</p> <ul> <li>client sends PASV command</li> <li>server opens a listening socket, and replies with PASV response containing its details</li> <li>client connects to listening socket (this is the data socket)</li> <li>client sends NLST command</li> <li>server transmits listing over data socket (zero bytes again)</li> <li>server closes data socket</li> </ul>
<p>I'm going to run some new tests with the settings to passive tomorrow when maintenance is done here, but I'm not sure that's the issue. We are able to get a directory listing if there are files or subdirectories in that directory. It only fails when the directory we're NLST-ing on is empty.</p> <p>Would the active/passive difference only manifest for an empty directory, or is there another possibility?</p>
8,140
<p>What is the best algorithm to take array like below:</p> <p><code>A {0,1,2,3}</code></p> <p>I expected to order it like array below:</p> <p><code>B {3,1,0,2}</code> </p> <p>Any ideas?</p>
<p>So if you have two arrays and they hold the same data just in different order then just do this:</p> <p>A = B</p> <p>I suspect that is not your situation so I think we need more info.</p>
<p>In the example you gave (an array of numbers), there would be no point in re-ordering A, since you could just use B.</p> <p>So, presumably these are arrays of objects which you want ordered by one of their properties.</p> <p>Then, you will need a way to look up items in A based on the property in question (like a hashtable). Then you can iterate B (which is in the desired sequence), and operate on the corresponding element in A.</p>
6,599
<p>How can I retrieve the page title of a webpage (title html tag) using Python?</p>
<p>I'll always use <a href="http://lxml.de/" rel="nofollow noreferrer">lxml</a> for such tasks. You could use <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow noreferrer">beautifulsoup</a> as well.</p> <pre><code>import lxml.html t = lxml.html.parse(url) print(t.find(&quot;.//title&quot;).text) </code></pre> <p>EDIT based on comment:</p> <pre><code>from urllib2 import urlopen from lxml.html import parse url = &quot;https://www.google.com&quot; page = urlopen(url) p = parse(page) print(p.find(&quot;.//title&quot;).text) </code></pre>
<p>Using lxml...</p> <p>Getting it from page meta tagged according to the Facebook opengraph protocol:</p> <pre><code>import lxml.html.parse html_doc = lxml.html.parse(some_url) t = html_doc.xpath('//meta[@property="og:title"]/@content')[0] </code></pre> <p>or using .xpath with lxml:</p> <pre><code>t = html_doc.xpath(".//title")[0].text </code></pre>
7,423
<p>The heater cartridge on my CR10 V2 broke so I ordered a new one(12V). After replacing it the new one heats of very quickly past the target temperature and the slowly decreases to the target. Once it hits the target temp it goes up and down by 10&nbsp;&deg;C or so during prints. During the prints there is under extrusion. I read that if the filament gets hot too high up the hotted it could cause clogs. I replaced the nozzle as well and cleaned out everything.</p> <p>Some things that I think may have an effect:</p> <ol> <li>Could the new heater cartridge not be compatible?</li> <li>does a poor solder job with heater cartridge wires have an effect</li> <li>It's possible I messed up the thermistor when replacing heater cartridge, could that explain whats happening?</li> <li>Is there anything else in the hot end assembly such as fans that would cause this?</li> </ol>
<p>This sounds as if you have bought an incorrect heater element, e.g. one for 12&nbsp;V instead of 24&nbsp;V. The CR-10 uses 24&nbsp;V. The 12&nbsp;V cartridge has a lower resistance, so when powered by 24&nbsp;V, the current is much higher and therefore also the heating power (<span class="math-container">$ {(\frac{24}{12})}^2 = 4 $</span> times higher). For details on the calculation, the <a href="/a/13313">this answer</a> on question: <a href="/q/13310">"PID autotune fails 'Temp too high' with 12 V heater cartridge but works with 24 V?"</a>. This makes the hotend heat up very fast resulting in a large overshoot. You need to replace the cartridge for one for 24&nbsp;V.</p> <hr> <p><em>Note that I recently experienced exactly the same problem by mixing up the cartridges see <a href="/a/13314">this answer</a>.</em></p>
<p>funny I have the opposite worry, I have a CR10s5 and relaxed the whole hot end with the CR10v2 one and now I get a thermal error at 170 degrees and it shuts off, should I just replace the cartridge, or do I need to replace the fans tooo</p>
1,636
<p>The only thing I've found has been;</p> <pre class="lang-css prettyprint-override"><code>.hang { text-indent: -3em; margin-left: 3em; } </code></pre> <p>The only way for this to work is putting text in a paragraph, which causes those horribly unsightly extra lines. I'd much rather just have them in a <code>&lt;span class="hang"&gt;&lt;/span&gt;</code> type of thing.</p> <p>I'm also looking for a way to further indent than just a single-level of hanging. Using paragraphs to stack the indentions doesn't work.</p>
<p><code>&lt;span&gt;</code> is an inline element. The term <em>hanging indent</em> is meaningless unless you're talking about a paragraph (which generally means a block element). You can, of course, change the margins on <code>&lt;p&gt;</code> or <code>&lt;div&gt;</code> or any other block element to get rid of extra vertical space between paragraphs.</p> <p>You may want something like <code>display: run-in</code>, where the tag will become either block or inline depending on context... sadly, this is <a href="http://quirksmode.org/css/css2/display.html" rel="noreferrer">not yet universally supported by browsers</a>.</p>
<p>ysth's answer is best with one debatable exception; the unit of measure should correspond to the size of the font.</p> <pre class="lang-css prettyprint-override"><code>p { text-indent: -2en; padding-left: 2en; } </code></pre> <p>"3" would also work adequately well; "em" is not recommended as it is wider than the average character in an alphabetic set. "px" should only be used if you intended to align hangs of text blocks with differing font sizes.</p>
3,293
<p>I'm really interested to hear what you think about Model-driven Software Development for Java and/or .NET.</p> <p>Does it save time? Does it improve quality?</p>
<p>I am using MDSD in a project with IBM Rational Rhapsody for C++. The model is pretty close to UML, so there we do not really have a Domain-Specific-Language. But still I would claim to use MDSD. From my experience, there are many benefits with MDSD:</p> <p>a) Using MDSD helps to bring a SW architecture to a sophisticated level. You always work on a very abstract level, thinking about the big picture. Cowboy coding software usually lacks a good architecture, because a developer is stuck in details. With MDSD, I see a tendency in my work, to solve problems with adequate sized classes, nice patterns, or simply better code.</p> <p>b) Big picture documentation of the SW tends to be better with MDSD. Of course, there are tools that automatically generate a class diagram out of your code. But these diagrams consists of 1000 classes and you do not see the aspect of interest. With MDSD, you specifically draw one aspect of the system, and the very same diagram is also used to generate a part of your code.</p> <p>c) Modelling helps to deal with an inherent system complexity. I would say, some systems are just too complex to be built without support from computer-aided design. Nobody would design a CPU without the help of huge SW tools. Use SW to help you write even more complex SW.</p> <p>d) Using MDSD helps to adhere to coding style guidelines. There is no better way to get coherent code style than letting the code be generated by a rule set.</p> <p>There are of course also some downsides of MDSD: d) If you have a model, you want every line of code to come from that model. And it may be difficult to include external libraries to a project. So either you live with the fact, that your system is based on external components or you reinvent the wheel to get it into your model.</p> <p>e) Modelling tools might suffer from problems using versioning tools. Source code is usually simpler to merge than a model diagram. This forces a team to move from the copy-edit-merge to a lock-edit-merge workflow.</p>
<p>MDA usually make difficult to integrate the business rules inside the server side layer, as the model view mapping is handled by generated code and functional hooks are provided as event responders. </p> <p>Still I've not seen a MDA tool as powerful as Forté (or UDS, now dead) + Express were. I imagine that a MDA with the Forté capabilities plus better pattern to achieve an independent service layer (as ActiveRecord, or EntityTransactionManager patterns) would be a killer app for whatever platform.</p> <p>The problem with actual application aiming at the three tiered MDA approach is that those are terribly difficult to set up and adapt to specific requirements. Just think of ABAP and SAP rates</p>
9,626
<p>Usually the hardness of the material is considered primary for nozzles used with abrasive filaments. Has friction between between nozzle material and abrasive filaments been considered? It seems that friction as well as hardness would play a roll in how long the nozzle lasts. Perhaps, this is considered with ruby tipped nozzles.</p>
<p>I think I found the problem. I think there was some crosstalk between the BLTouch wires and the other wires it was tied together leading to the hotend. When I moved the BLTouch wires away from the others the problem went away.</p> <p>I will be added a sheild to the cable in the future like in this <a href="https://www.youtube.com/watch?v=jkcrRCxPlZM&amp;ab_channel=509Drone" rel="nofollow noreferrer">youtube video</a></p>
<p>The OP already found the problem and <a href="/a/16632/">answered</a> the question hinting to shielding of the cable. If this is the actual problem, of fiddling with the cables might have caused this, an alternative solution is presented as I've experienced similar behavior.</p> <p>If one side of the bed is higher than the rest, even when rotating the glass bed, you might experience that the nozzle carriage is tilting on that side. E.g. when using a Bowden extruder assembly, a too short Bowden tube (or cables in a non-Bowden setup) the tube (or cables) pull at the carriage causing it to lift at the furthest points from the extruder; this tilting can cause the nozzle to go up a few tenths of a millimeter.</p>
1,970
<p>For personal usage, indoor, I'm doing some experiments with following lamp (v0.1):</p> <p><a href="https://i.stack.imgur.com/SrEhy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SrEhy.jpg" alt="enter image description here"></a></p> <p>Lamp is a led bulb enclosed in a methacrylate tube and with a 3D printed finish at the top using PLA (my first 3d print ;-).</p> <p>In some www pages (by example, <a href="https://www.lifx.com/blogs/the-latest/19032975-how-hot-are-led-light-bulbs" rel="nofollow noreferrer">here</a>) I've read that the led buld radiator can reach 90º C. Experimentally, the methacrylate and the PLA feels only slightly hot, I suppose around 40ºC.</p> <p>According to www info, PLA has a melting point of 150ºC, far from this usage, but a continuous operative temperature of only 40ºC ( !? this made 3d printing unable in a country as my own one, where ambient in summer is around 40ºC).</p> <p>So, my question, is PLA a valid material for this application? If not, some other one better?</p> <p>Thanks a lot. </p>
<p><a href="https://3dprinting.stackexchange.com/a/4488/5740">EvilTeach's</a> answer is correct, ABS is a more reliable plastic for any kind of work which may get above what feels "hot to the touch." </p> <p>Just to elaborate on the why: the property you're looking for in the thermoplastic (which will determine the continuous operating temperature) is <strong>glass transition temperature</strong>. This is the point at which the plastic begins to flow, and becomes deformable as EvilTeach described. PLA reaches this state at around <strong>60&nbsp;°C</strong>, whereas ABS is around <strong>105&nbsp;°C</strong>, just suiting your specifications. To go a bit further, polycarbonate offers a glass transition temperature of around 150&nbsp;°C, and Ultem at 217&nbsp;°C. So there's a thermoplastic for everyone, you just need to know what you're looking for!</p>
<p>I had a PLA print that would weaken and deform when sitting in the car on a hot day. I think you should try it with ABS.</p>
666
<p>Suppose I have a table called Companies that has a DepartmentID column. There's also a Departaments table that has as EmployeeID column. Of course I have an Employee table as well. The problem is that I want to delete a company, so first i have to delete all the employees for every departament and then all the departaments in the company. Cascade Delete is not an option, therefore i wish to use nested transactions. I'm new to SQL so I would appreciate your help.</p>
<p>I'm not sure why you need nested transactions here. You only need one actual transaction:</p> <pre><code>BEGIN TRAN DELETE FROM Employee FROM Employee INNER JOIN Department ON Employee.DepartmentID = Department.DepartmentID INNER JOIN Company ON Department.CompanyID = Company.CompanyID WHERE Company.CompanyID = @CompanyID DELETE FROM Department FROM Department INNER JOIN Company ON Department.CompanyID = Company.CompanyID WHERE Company.CompanyID = @CompanyID DELETE FROM Company WHERE Company.CompanyID = @CompanyID COMMIT TRAN </code></pre> <p>Note the double FROM, that is not a typo, it's the correct SQL syntax for performing a JOIN in a DELETE.</p> <p>Each statement is atomic, either the entire DELETE will succeed or fail, which isn't that important in this case because the entire batch will either succeed or fail.</p> <p>BTW- I think you had your relationships backwards. The Department would not have an EmployeeID, the Employee would have a DepartmentID.</p>
<p>I'm not answering your question, but foreign Keys <em>is</em> the way to go, why is it not an option?</p> <p>As for nested transactions they are:</p> <pre><code>BEGIN delete from Employee where departmentId = 1; BEGIN delete from Department where companyId = 2; BEGIN delete from Company where companyId = 2; END END END </code></pre> <p>Programmatically it looks different of course, but that'd depend on the platform you are using</p>
8,336