instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I am currently working on parts for a custom prosthesis.</p> <p>My main concern at the moment is to find biocompatible materials that can be 3D printed from a UP or a Reprap. The piece would need to be in contact with the skin for extended periods of time, probably around 17 hours a day on average.</p> <p>The main concerns I have are:</p> <ul> <li>Skin reactions caused by prolonged contact</li> <li>Skin reactions and bruising caused by friction</li> <li>Degradation of the materials due to prolonged exposure to skin secretions and sweat</li> <li>Risks of toxicity in the compounds generated by the aforementioned material degradation</li> </ul> <p><strong>Which materials can you recommend?</strong> </p> <p><strong>Any extensive data (from testing) would be greatly appreciated.</strong></p>
<p>There are printers designed for medical use, and the manufacturers supply them with varying levels of <a href="http://www.medicalplasticsnews.com/opinion/passing-the-test_1/" rel="nofollow">certification and testing</a>, however I've not seen a filament manufacturer certify their material as bio-compatible separate from the printer. The printing process changes the material slightly in the best case (and significantly with poor temperature control or badly set parameters), so even if bio-compatible filament were found, the resulting product might not achieve the same level of bio-compatibility.</p> <p>If your intent is to use hobbyist level machine for medical purposes, you might simply want to use an interface, such as a sock or a molded/cast polymer that you know to be bio-compatible between the printed part and the skin.</p>
<p>If you want to know something about what you are questioning, it is interesting to you to read <a href="http://e-nable.org/resources/prosthetics-students-consultation/" rel="nofollow noreferrer">http://e-nable.org/resources/prosthetics-students-consultation/</a></p> <p>That's a link with complementary information how to print 3D as a volunteer.</p> <p>I know that is not enough information about products, but I believe Nylon is the best recommend because it is what generally printers are using, though.</p> <p>This website supports information with Dr. Chang by the e-mail eagle01@rocketmail.com</p> <p>but there insnt information about the components used in the prosthetics, but I know that Nylon is the best suited to it nowadays. </p> <p>If you prefer there is a site with makers loging information about PETG: <a href="https://www.matterhackers.com/news/how-to-succeed-when-printing-with-petg-filament" rel="nofollow noreferrer">https://www.matterhackers.com/news/how-to-succeed-when-printing-with-petg-filament</a></p>
117
<p>Are there plans or ideas floating around for a logo contest, or is that a Public-Beta stage thing?</p>
<p>Getting a logo is part of getting a design, which is something that happens when a site <em>graduates</em> out of public beta.</p> <p>In short, not for a long time yet.</p> <p>While the site is in beta it will keep this theme that it currently has.</p>
<p>Getting a logo is part of getting a design, which is something that happens when a site <em>graduates</em> out of public beta.</p> <p>In short, not for a long time yet.</p> <p>While the site is in beta it will keep this theme that it currently has.</p>
5
<p>This confusion arises as most people are trained to evaluate arithmetic expressions as per <a href="http://en.wikipedia.org/wiki/PEMDAS#Mnemonics" rel="nofollow noreferrer">PEDMAS or BODMAS rule</a> whereas arithmetic expressions in programming languages like C# do not work in the same way.</p> <p>What are your takes on it?</p>
<p><em>Precedence</em> rules specify priority of operators (which operators will be evaluated first, e.g. multiplication has higher precedence than addition, PEMDAS). </p> <p>The <em>associativity</em> rules tell how the operators of same precedence are grouped. Arithmetic operators are left-associative, but the assignment is right associative (e.g. a = b = c will be evaluated as b = c, a = b). </p> <p>The <em>order</em> is a result of applying the <em>precedence</em> and <em>associativity</em> rules and tells how the expression will be evaluated - which operators will be evaluated firs, which later, which at the end. The actual order can be changed by using <em>braces</em> (braces are also operator with the highest precedence). </p> <p>The <em>precedence</em> and <em>associativity</em> of operators in a programming language can be found in its language manual or specification. </p>
<p>I am not sure there really is a difference. The traditional BODMAS (brackets, orders, division, multiplication, addition, subtraction) or PEDMAS (parentheses, exponents, division, multiplication, addition, subtraction) are just subsets of all the possible operations and denote the order that such operations should be applied in. I don't know of any language in which the BODMAS/PEDMAS rules are violated, but each language typically adds various other operators - such as ++, --, = etc.</p> <p>I always keep a list of operator precedence close to hand in case of confusion. However when in doubt it is usually worth using some parentheses to make the meaning clear. Just be aware that parentheses do not have the highest precedence - see <a href="http://msdn.microsoft.com/en-us/library/126fe14k.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/126fe14k.aspx</a> for an example in C++.</p>
9,621
<p>We use an IBM database known as Universe that holds all of our user id's, passwords, and profile information in a table called USERINFO. </p> <p>Can I use the Membership Provider to connect to this database and authenticate the user? </p> <p>The database access is actually through a web service since we don't have a direct connect to the database.</p> <p>We have a web service method called GetUserInfo which accepts a parameter of username. The method will return the password and profile information.</p>
<p>As mentioned above, you'll need to create a custom membership provider which a fairly straightforward. You'll create a .NET class that inherits from System.Web.Security.MembershipProvider. There are several methods that need to be overriden in your class, but most are not even used by the MVC account controller. The main method you'll want to override is ValidateUser(username, password) which will get a user logged in. After you've implemented your class you'll need to register it in web.config which is easy as well.</p> <p>You can find a sample for a custom provider here: <a href="http://msdn.microsoft.com/en-us/library/6tc47t75(VS.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/6tc47t75(VS.80).aspx</a></p> <p>And a tutorial for the entire process here: <a href="http://www.15seconds.com/issue/050216.htm" rel="noreferrer">http://www.15seconds.com/issue/050216.htm</a></p> <p>Keep in mind that the process for making a custom provider for MVC is the same for a standard ASP.NET web site, however MVC does not fully utilize all methods of the MembershipProvider class so it's much easier to implement.</p>
<p>You'll have to create a custom provider for that. It isn't very hard, as long as you can access the web service without an issue.</p>
9,718
<p>I am just starting to play with Django/Python and am trying to shift into the MTV mode of programming that Django asks for (insists on). Deciding on what functions should be methods of a model vs simple being a function in a view has so far been confusing. Does anyone know of a book, website, blog, slideshow, whatever that discusses Web Framework programming in more general, abstract terms? I imagine just a book on object oriented programming would do it, but I feel like that would be overkill - I was looking for something web framework specific.</p>
<p>My basic rule in Django is: if you could conceivably need the functionality from somewhere other than the view itself, it doesn't belong in the view function. </p> <p>I'd also recommend downloading some of the plethora of apps on <a href="http://djangoplugables.com/" rel="nofollow noreferrer">Django Pluggables</a> and seeing how they do it.</p>
<p>If you aren't absolutely set on diving into Django and don't mind trying something else as a start, you might want to give <a href="http://www.python.org/dev/peps/pep-0333/" rel="nofollow noreferrer">WSGI</a> a shot, which allows you to template your application your own way using a <a href="http://pypi.python.org/pypi/Tenjin/0.6.2" rel="nofollow noreferrer">third party engine</a>, rather than having to go exactly by Django's rules. This also allows you to peek at a lower level of handling requests, so you get a bit better understanding of what Django is doing under the hood.</p>
4,220
<p>I'm trying to set up an enclosed (custom enclosure) Prusa i3 style printer for ABS, but having a fair amount of difficulty preventing the part corners from curling.</p> <p><a href="https://i.stack.imgur.com/k9YT6.png" rel="nofollow noreferrer" title="Example of curling at part corners"><img src="https://i.stack.imgur.com/k9YT6.png" alt="Example of curling at part corners" title="Example of curling at part corners"></a></p> <p>Detailed specs:</p> <ul> <li>Geetech A10 (generic Prusa clone) w/ PEI heatbed</li> <li>Custom enclosure</li> <li>Slic3r software</li> <li>ABS filament (obviously!)</li> <li>247&nbsp;°C hotend temp</li> <li>115&nbsp;°C heated bed first layer, 110&nbsp;°C for others</li> <li>Fan on for layer 3 and above</li> </ul> <p>Verified heatbed temperature with calibrated IR imager.</p> <p>Thus far I have been unable to prevent parts from separating from the heatbed during print, primarily at the corners where stress is concentrated. I've tried various heatbed temperatures from 90&nbsp;°C to 115&nbsp;°C, lower hotend temperatures (which just made the problem worse and caused complete print failure), cleaning the PEI surface with alcohol, etc. to no avail. I'm even seeing this to some extent with Benchy, it shows up as a lift to the stern and bow (slight bend parallel to the keel) -- the print is otherwise basically perfect.</p> <p>I've attached an image of the more extreme curling -- yes, I should probably be using mouse ears on a part like this, but I see the same thing on parts that shouldn't require mouse ears.</p> <p>What is the best way to fix this particular problem? Temperature adjustments, brims, rafts, something else?</p>
<p>Adding 20mm mouse ears was sufficient to resolve the problem using the original extrusion / heatbed settings. I did not expect mouse ears to be required on the Benchy model, but given the lack of better advice it seems this may be a poorly documented "feature" of ABS.</p> <p>Results on the original worst-case test model:</p> <p><a href="https://i.stack.imgur.com/aBOso.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aBOso.jpg" alt="Properly bonded mouse ear"></a></p> <p>Note that the brims will not help if the bed is insufficiently leveled -- the brim has to actually merge with / melt into the base part layer, so the extruder height has to be perfect at the brim to part interface.</p> <p>Example of extruder too far away from bed:</p> <p><a href="https://i.stack.imgur.com/CAoV3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CAoV3.png" alt="Failed mouse ear"></a></p>
<p>A tall skirt (like 1 cm tall or more, even as tall as the part) few millimetres from the part would shield the corners and the outer parts from colder air and keep the part temperature high, reducing curling. </p> <p>It is in principle better than mouse ears, because these just pull the corners, which will still have a lot of internal stress when cooled, but if you keep the part warm as I suggest, the corner will stay flat(ter) by themselves, resulting in a stronger and better print with less internal stresses.</p>
1,280
<p>The below HTML/CSS/Javascript (jQuery) code displays the <code>#makes</code> select box. Selecting an option displays the <code>#models</code> select box with relevant options. The <code>#makes</code> select box sits off-center and the <code>#models</code> select box fills the empty space when it is displayed. </p> <p>How do you style the form so that the <code>#makes</code> select box is centered when it is the only form element displayed, but when both select boxes are displayed, they are both centered within the container?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var cars = [ { "makes" : "Honda", "models" : ['Accord','CRV','Pilot'] }, { "makes" :"Toyota", "models" : ['Prius','Camry','Corolla'] } ]; $(function() { vehicles = [] ; for(var i = 0; i &lt; cars.length; i++) { vehicles[cars[i].makes] = cars[i].models ; } var options = ''; for (var i = 0; i &lt; cars.length; i++) { options += '&lt;option value="' + cars[i].makes + '"&gt;' + cars[i].makes + '&lt;/option&gt;'; } $("#make").html(options); // populate select box with array $("#make").bind("click", function() { $("#model").children().remove() ; // clear select box var options = ''; for (var i = 0; i &lt; vehicles[this.value].length; i++) { options += '&lt;option value="' + vehicles[this.value][i] + '"&gt;' + vehicles[this.value][i] + '&lt;/option&gt;'; } $("#model").html(options); // populate select box with array $("#models").addClass("show"); }); // bind end });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.hide { display: none; } .show { display: inline; } fieldset { border: #206ba4 1px solid; } fieldset legend { margin-top: -.4em; font-size: 20px; font-weight: bold; color: #206ba4; } fieldset fieldset { position: relative; margin-top: 25px; padding-top: .75em; background-color: #ebf4fa; } body { margin: 0; padding: 0; font-family: Verdana; font-size: 12px; text-align: center; } #wrapper { margin: 40px auto 0; } #myFieldset { width: 213px; } #area { margin: 20px; } #area select { width: 75px; float: left; } #area label { display: block; font-size: 1.1em; font-weight: bold; color: #000; } #area #selection { display: block; } #makes { margin: 5px; } #models { margin: 5px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"&gt;&lt;/script&gt; &lt;div id="wrapper"&gt; &lt;fieldset id="myFieldset"&gt; &lt;legend&gt;Cars&lt;/legend&gt; &lt;fieldset id="area"&gt; &lt;label&gt;Select Make:&lt;/label&gt; &lt;div id="selection"&gt; &lt;div id="makes"&gt; &lt;select id="make"size="2"&gt;&lt;/select&gt; &lt;/div&gt; &lt;div class="hide" id="models"&gt; &lt;select id="model" size="3"&gt;&lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/fieldset&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
<p>It's not entirely clear from your question what layout you're trying to achieve, but judging by that fact that you have applied "float:left" to the select elements, it looks like you want the select elements to appear side by side. If this is the case, you can achieve this by doing the following:</p> <ul> <li>To centrally align elements you need to add "text-align:center" to the containing block level element, in this case #selection.</li> <li>The position of elements that are floating is not affected by "text-align" declarations, so remove the "float:left" declaration from the select elements.</li> <li>In order for the #make and #model divs to sit side by side with out the use of floats they must be displayed as inline elements, so add "display:inline" to both #make and #model (note that this will lose the vertical margin on those elements, so you might need to make some other changes to get the exact layout you want).</li> </ul> <p>As select elements are displayed inline by default, an alternative to the last step is to remove the #make and #model divs and and apply the "show" and "hide" classes to the model select element directly.</p>
<p>Floating the select boxes changes their display properties to "block". If you have no reason to float them, simply remove the "float: left" declaration, and add "text-align: center" to #makes and #models.</p>
8,605
<p>Often, when I have a breakpoint on some line in Visual Studio, The program will run and stop there. great. I will then click the red circle (or press F9) to remove it. Obviously I don't want my program to keep stopping there. The problem is that the next time I refresh the page the breakpoint is back! The only way to permanently remove it is to open the breakpoints window and remove it there. Why does this happen and how can I change this behavior?</p> <p>I have noticed that these breakpoints which keep coming back have a little plus next to them in the breakpoints window which when you click on - open up many sub lines of breakpoints. What is the deal with that?</p> <p>Thanks, Adin</p>
<p>Helpful Key combo: to permanently delete all breakpoints, press CTRL + SHIFT + F9.</p>
<p>Wipe the breakpoint out using the Breakpoints Window (Ctrl + Alt + B).</p> <p>While debugging, when you hit the breakpoint, look at the BreakPoint window for the one that is bold. </p> <p>Then, right-click it and choose Delete.</p>
8,338
<p>Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible?</p> <p>If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)?</p>
<pre><code>tf diff /shelveset:shelveset /format:unified </code></pre> <p><strong>Edit:</strong> This writes to standard output. You can pipe the output to a file.</p> <p>For more options, see <a href="http://msdn.microsoft.com/en-us/library/6fd7dc73%28v=vs.100%29.aspx" rel="noreferrer">Difference Command</a>.</p>
<p>I wrote a blog post about a similar issue where I used the TF.exe command and 7Zip to <a href="http://codeblog.theg2.net/2014/09/create-tfs-patch-file-with-pending.html" rel="nofollow">create a TFS patch file</a> that could then be applied on another TFS server or workspace. I posted the the Powershell scripts at <a href="https://github.com/gbrayut/CodeBlog/tree/master/20140914_TFS" rel="nofollow">Github</a>, which can be used to Zip up any pending changes on one workspace and then apply them to a different server. It would have to be modified to use a changeset instead of pending changes, but that shouldn't be too difficult to accomplish.</p>
7,547
<p>How does the new Microsoft asp.net mvc implementation handle partitioning your application - for example:</p> <pre><code>--index.aspx --about.aspx --contact.aspx --/feature1 --/feature1/subfeature/action --/feature2/subfeature/action </code></pre> <p>I guess what I am trying to say is that it seems everything has to go into the root of the views/controllers folders which could get unwieldy when working on a project that if built with web forms might have lots and lots of folders and sub-folders to partition the application.</p> <p>I think I get the MVC model and I like the look of it compared to web forms but still getting my head round how you would build a large project in practice.</p>
<p>There isn't any issues with organizing your controllers. You just need to setup the routes to take the organization into consideration. The problem you will run into is finding the view for the controller, since you changed the convention. There isn't any built in functionality for it yet, but it is easy to create a work around yourself with a ActionFilterAttribute and a custom view locator that inherits off ViewLocator. Then when creating your controller, you just specify what ViewLocator to use, so the controller knows how to find the view. I can post some code if needed.</p> <p>This method kind of goes along with some advice I gave another person for separating their views out for a portal using ASP.NET MVC. Here is the <a href="https://stackoverflow.com/questions/19746/views-in-seperate-assemblies-in-aspnet-mvc">link to the question</a> as a reference.</p>
<p>In terms of how you arrange your views, you can put your views in subfolders if you'd like and create your own view structure. All views can always be referenced by their full path using the ~syntax. So if you put Index.aspx in \Views\Feature1\Home then you could reference that view using ~/Views/Feature1/Home/Index.aspx.</p>
4,626
<p>I'm currently implementing a raytracer. Since raytracing is extremely computation heavy and since I am going to be looking into CUDA programming anyway, I was wondering if anyone has any experience with combining the two. I can't really tell if the computational models match and I would like to know what to expect. I get the impression that it's not exactly a match made in heaven, but a decent speed increasy would be better than nothing.</p>
<p>One thing to be very wary of in CUDA is that divergent control flow in your kernel code absolutely KILLS performance, due to the structure of the underlying GPU hardware. GPUs typically have massively data-parallel workloads with highly-coherent control flow (i.e. you have a couple million pixels, each of which (or at least large swaths of which) will be operated on by the <b>exact</b> same shader program, even taking the same direction through all the branches. This enables them to make some hardware optimizations, like only having a single instruction cache, fetch unit, and decode logic for each group of 32 threads. In the ideal case, which is common in graphics, they can broadcast the same instruction to all 32 sets of execution units in the same cycle (this is known as SIMD, or Single-Instruction Multiple-Data). They can <b>emulate</b> MIMD (Multiple-Instruction) and SPMD (Single-Program), but when threads within a Streaming Multiprocessor (SM) diverge (take different code paths out of a branch), the issue logic actually switches between each code path on a cycle-by-cycle basis. You can imagine that, in the worst case, where all threads are on separate paths, your hardware utilization just went down by a factor of 32, effectively killing any benefit you would've had by running on a GPU over a CPU, particularly considering the overhead associated with marshalling the dataset from the CPU, over PCIe, to the GPU.</p> <p>That said, ray-tracing, while data-parallel in some sense, has widely-diverging control flow for even modestly-complex scenes. Even if you manage to map a bunch of tightly-spaced rays that you cast out right next to each other onto the same SM, the data and instruction locality you have for the initial bounce won't hold for very long. For instance, imagine all 32 highly-coherent rays bouncing off a sphere. They will all go in fairly different directions after this bounce, and will probably hit objects made out of different materials, with different lighting conditions, and so forth. Every material and set of lighting, occlusion, etc. conditions has its own instruction stream associated with it (to compute refraction, reflection, absorption, etc.), and so it becomes quite difficult to run the same instruction stream on even a significant fraction of the threads in an SM. This problem, with the current state of the art in ray-tracing code, reduces your GPU utilization by a factor of 16-32, which may make performance unacceptable for your application, especially if it's real-time (e.g. a game). It still might be superior to a CPU for e.g. a render farm.</p> <p>There is an emerging class of MIMD or SPMD accelerators being looked at now in the research community. I would look at these as logical platforms for software, real-time raytracing.</p> <p>If you're interested in the algorithms involved and mapping them to code, check out POVRay. Also look into photon mapping, it's an interesting technique that even goes one step closer to representing physical reality than raytracing.</p>
<p>It can certainly be done, has been done, and is a hot topic currently among the raytracing and Cuda gurus. I'd start by perusing <a href="http://www.nvidia.com/object/cuda_home.html" rel="nofollow noreferrer">http://www.nvidia.com/object/cuda_home.html</a></p> <p>But it's basically a research problem. People who are doing it well are getting peer-reviewed research papers out of it. But <em>well</em> at this point still means that the best GPU/Cuda results are approximately competitive with best-of-class solutions on CPU/multi-core/SSE. So I think that it's a little early to assume that using Cuda is going to accelerate a ray tracer. The problem is that although ray tracing is "embarrassingly parallel" (as they say), it is not the kind of "fixed input and output size" problem that maps straightforwardly to GPUs -- you want trees, stacks, dynamic data structures, etc. It can be done with Cuda/GPU, but it's tricky.</p> <p>Your question wasn't clear about your experience level or the goals of your project. If this is your first ray tracer and you're just trying to learn, I'd avoid Cuda -- it'll take you 10x longer to develop and you probably won't get good speed. If you're a moderately experienced Cuda programmer and are looking for a challenging project and ray tracing is just a fun thing to learn, by all means, try to do it in Cuda. If you're making a commercial app and you're looking to get a competitive speed edge -- well, it's probably a crap shoot at this point... you might get a performance edge, but at the expense of more difficult development and dependence on particular hardware. </p> <p>Check back in a year, the answer may be different after another generation or two of GPU speed, Cuda compiler development, and research community experience.</p>
6,053
<p>Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first "constructed" did not seem to share a relationship. </p> <p>However, whenever I see architects design an application, the first thing they do is start programming to an interface. How come? How do you know all the relationships between objects that will occur within that interface? If you already know those relationships, then why not just extend an abstract class?</p>
<p>Programming to an interface means respecting the "contract" created by using that interface. And so if your <code>IPoweredByMotor</code> interface has a <code>start()</code> method, future classes that implement the interface, be they <code>MotorizedWheelChair</code>, <code>Automobile</code>, or <code>SmoothieMaker</code>, in implementing the methods of that interface, add flexibility to your system, because one piece of code can start the motor of many different types of things, because all that one piece of code needs to know is that they respond to <code>start()</code>. It doesn't matter <em>how</em> they start, just that they <em>must start</em>.</p>
<p>In one sense, I think your question boils down to simply, "why use interfaces and not abstract classes?" Technically, you can achieve loose coupling with both -- the underlying implementation is still not exposed to the calling code, and you can use Abstract Factory pattern to return an underlying implementation (interface implementation vs. abstract class extension) to increase the flexibility of your design. In fact, you could argue that abstract classes give you slightly more, since they allow you to both require implementations to satisfy your code ("you MUST implement start()") and provide default implementations ("I have a standard paint() you can override if you want to") -- with interfaces, implementations must be provided, which over time can lead to brittle inheritance problems through interface changes.</p> <p>Fundamentally, though, I use interfaces mainly due to Java's single inheritance restriction. If my implementation MUST inherit from an abstract class to be used by calling code, that means I lose the flexibility to inherit from something else even though that may make more sense (e.g. for code reuse or object hierarchy).</p>
7,108
<p>When using Google Chrome, I want to debug some JavaScript code. How can I do that?</p>
<p>Try adding this to your source:</p> <pre><code>debugger; </code></pre> <p>It works in most, if not all browsers. Just place it somewhere in your code, and it will act like a breakpoint.</p>
<p>From the console in Chrome, you can do <code>console.log(data_to_be_displayed)</code>.</p>
9,192
<p>I implemented a Lucene search solution awhile back, and it got me interested in compressed file indexes that are searchable. At the time I could not find any good information on how exactly you would go about creating a custom search index, so I wonder if anyone can point me in the right direction? </p> <p>My primary interest is in file formatting, compression, and something similar to the concept of Lucene's documents and fields. It should not necessarily be language specific, but if you can point me to online resources that have language specific implementations with full descriptions of the process then that is okay, too.</p>
<p>It all depends on what you're doing: animation, video, calculation, etc? There are <a href="http://www.tobinharris.com/2008/8/30/performance-of-silverlight-vs-flash-vs-javascript-vs-tracemonkey" rel="nofollow noreferrer">some tests that show Silverlight being faster for raw computation</a>, while Flash's graphics engine is farther along (GPU utilization, 3D, etc.).</p> <p>If you're talking about load time, there are definitely things you can do in Silverlight to make your XAP file smaller than most images - the Hard Rock Memorabilia team got their XAP down under 70K, and that site browsed GB of photo data. I'm sure you can do the same in Flash.</p> <p>While your question is focused on performance, as others have mentioned you do have to take into account the 4.5MB install for Silverlight, since it's not widely installed yet.</p>
<p>Actually, you have to assume that Flash is probably already installed on the user's browser, and SilverLight probably not. So the cost of installing silverlight (though a small download) has to be taken in to consideration as well.</p> <p>Silverlight, however, does have some pretty neat out of the box multimedia support.</p>
9,141
<p>For example: <code>man(1)</code>, <code>find(3)</code>, <code>updatedb(2)</code>? </p> <p>What do the numbers in parentheses (Brit. "brackets") mean?</p>
<p>It's the section that the man page for the command is assigned to.</p> <p>These are split as</p> <ol> <li>General commands</li> <li>System calls</li> <li>C library functions</li> <li>Special files (usually devices, those found in /dev) and drivers</li> <li>File formats and conventions</li> <li>Games and screensavers</li> <li>Miscellanea</li> <li>System administration commands and daemons</li> </ol> <p>Original descriptions of each section can be seen in the <a href="https://web.archive.org/web/20170601064537/http://plan9.bell-labs.com/7thEdMan/v7vol1.pdf" rel="noreferrer">Unix Programmer's Manual</a> (page ii).</p> <p>In order to access a man page given as &quot;foo(5)&quot;, run:</p> <pre class="lang-sh prettyprint-override"><code>man 5 foo </code></pre>
<p><a href="http://en.wikipedia.org/wiki/Man_page#Manual_sections" rel="nofollow noreferrer">Wikipedia</a> details about Manual Sections:</p> <ol> <li>General commands</li> <li>System calls</li> <li>Library functions, covering in particular the C standard library</li> <li>Special files (usually devices, those found in /dev) and drivers</li> <li>File formats and conventions</li> <li>Games and screensavers</li> <li>Miscellanea</li> <li>System administration commands and daemons</li> </ol>
8,846
<p>With text-recognition improving and CAPTCHA-breakers using Mechanical Turks to break otherwise unbreakable keys, what's the next technology to keep scripts from spam-botting a site that relies on user input?</p>
<p>I like the concept of an 'Invisible Captcha'. Phil Haack details one implementation <a href="http://haacked.com/archive/2006/09/26/Lightweight_Invisible_CAPTCHA_Validator_Control.aspx" rel="nofollow noreferrer">here</a>.</p> <p>This banks on the fact that bots, spiders, and crawlers don't implement javascript engines. This too could change in the near future.</p>
<p>The most fundamental tool to keep people from spambotting a user input site is the "nofollow" tag on links. Most comment-spammers are interested in Google juice rather than actually having their stuff seen, so nofollow removes the incentive. </p>
8,443
<p>I want to print multiple objects in a single G-code file on my Maker Select Plus 3D Printer.</p> <p>On the Cura "Machine>Machine Settings..." menu, what are the correct settings for "Printer head size" in the upper right quadrant?</p> <p>My best guess is below:</p> <p><a href="https://i.stack.imgur.com/hJkip.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hJkip.png" alt="Machine Settings Dialog"></a></p> <p>Note 1: I'm particularly concerned that I got the min and max directions correct. For instance, I just swapped my Y min and Y max values because when I tried them the other way, the print head impacted the first object when printing the second.</p> <p>Note 1.5: I added 10 mm to my settings because I was concerned that Cura wasn't accounting for the width of the raft that I usually use when I print.</p> <p>Note 2: From what I've read online before posting this question, this printer may be physically the same as the WanHao Duplicator i3.</p>
<h3>TL;DR</h3> <p>The settings that you seem to need can be found here: <a href="https://www.thingiverse.com/groups/i3/topic:6818" rel="noreferrer">Print One At a time settings? CURA</a>:</p> <blockquote> <p>You actually can!</p> <p>Providing that none of your object is too tall (taller than the Gantry clearance). Also the objects cannot be too close from each other (when you activate the option and move objects on the bed, you see a gray box around them showing this limit).</p> <p>The reason you cannot use it at the moment is probably because you didn't filled the printer head size parameters (Menu "Machine -> Machine Settings..."). You will have to measure them, but on mine (Australian clone of the i3) I use those values and it works fine:</p> <ul> <li>Head size toward X min: 30 </li> <li>Head size toward Y min: 70 </li> <li>Head size toward X max: 60 </li> <li>Head size toward Y max: 50 </li> <li>Printer gantry height: 35 </li> </ul> <p>Those are "conservative" values (a little bigger than the actual values). It means I'm losing a little bed space, but I prefer that to the risk of having the print head knocking out previous prints if one of the measurements is too low :o).</p> <p>PS: The option will automatically disable itself if some object dimension are too big to avoid collisions</p> </blockquote> <p>To be fair, the rest of the thread is people debating whether you can successfully achieve <em>sequential printing</em>, or not, with the Wanhao Duplicator I3. </p> <p>However, the setting above seem to be the settings that you are looking for. Apart from <em>Head size toward X max</em>, they also correlate, pretty much, to the settings that you have already determined. As the poster notes, their settings are, somewhat, on the conservative side, which would explain the difference.</p> <hr> <h3>Extra detail</h3> <p>If this is so that you can achieve <em>sequential printing</em><sup>1</sup>, then this may not be suitable for your printer, unfortunately. Sequential printing works best for printers with a long nozzle with nothing (fans, X-axis gantry, etc.) around it, for example a delta printer with a low hanging nozzle would be ideal. Your printer type has a wide head with attachments, as well as an X-axis gantry, and so the clearance is less than that of an (ideal) delta.</p> <p>See <a href="https://groups.google.com/forum/#!topic/wanhao-printer-3d/giqKBkZAjBM" rel="noreferrer">WanHao Duplicator i3 Printer Head Size Settings for Cura</a> for more details.</p> <p>If you wish to go ahead and still try it, then from the <a href="https://groups.google.com/forum/#!topic/wanhao-printer-3d/giqKBkZAjBM" rel="noreferrer">same link</a>:</p> <blockquote> <p>The way to measure is lower the nozzle to the bed.</p> <p>Then measure the space taken up around the nozzle by the heater block, fans, mounting, the motor, and finally, the distance between the X axis rods and the bed "WHEN the nozzle is touching the bed".</p> <p>That gives you some idea of the clearance you have where an ALREADY printed object can exist on the bed and NOT get slammed into the gantry or moving head when printing a second sequential part.</p> <p>Just a visual with a moving bed printer and it's not promising. Not impossible, but in a 200mm square build area, you might really only get 4 objects at a time in the 4 quadrants.</p> <p>Even that is height limited because the gantry will slam into it at a certain height.</p> <p>Maybe some weird staggering pattern.</p> </blockquote> <p>Also, of use, for obtaining your own measurements, from <a href="https://ultimaker.com/en/community/7451-cura-1407-printer-head-size" rel="noreferrer">Ultimaker - Cura 14.07 Printer Head Size</a>:</p> <blockquote> <p>If I'm not mistaken all measurements are taken from the nozzle tip. So, for the first one, measure the size of your head from the nozzle tip towards the direction in X to where your machine homes.</p> </blockquote> <p>and</p> <blockquote> <p>There's a tooltip when you mouse over these settings which describes what they mean.</p> <p>Gantry height is the vertical clearance between the build plate and your x-y gantry (on the Ultimaker, these are the 6mm shafts which hold the head).</p> <p>If you print two objects - one after another - then the first object must be shorter in height than the gantry height. Otherwise, the gantry would crash into the first part while printing the second part.</p> </blockquote> <p>In more detail, paying attention to the placing of the objects can aid with any issues that you have with a low gantry:</p> <blockquote> <p>If you place multiple parts in a diagonal line across the build-plate so the gantry and head never intersects earlier parts after printing them, you can set the gantry height to an artificially high value, to ignore it, without problems.</p> <p>I place pieces along a diagonal from right-front to left-rear, to avoid conflict when the head homes after finishing the print. I can fit 3 to 4 small but tall pieces on the build plate that way for sequential printing.</p> </blockquote> <p>The purpose of these <em>Printer head size</em> settings is to enable Cura to determine the order in which the objects are printed:</p> <blockquote> <p>... none of those settings are important as long as you only print one STL file at a time. It's when you want to print multiple objects "one at a time" that these numbers have a purpose - it allows Cura to figure out which order to print them in and if it can do them one at a time or if it has to print them all at once.</p> </blockquote> <hr> <h3>Footnote</h3> <p><sup>1</sup> <em>Sequential Printing</em> is where one object is <em>completely</em> printed, before moving on to the next object, instead of the usual method of printing all objects <em>simultaneously</em> one layer at a time. This method can give superior quality prints, but not always. The main advantage appears to be reduced "stringing" of filament between objects, and a cleaner surface finish, due to reduced print head movement between objects. The process is detailed in <a href="https://www.simplify3d.com/support/articles/multi-part-printing/" rel="noreferrer">Multi-part printing</a>.</p>
<p>Like the OP, I'm confused by this as well. I figured I'd need measurements from the center of the nozzle to the left, right, front, and back of the print head, as well as a height from the print surface to the gantry while the head was homed. I've carefully measured, but things aren't going quite as I expected. In trying to understand this, I see examples like the one here:</p> <ul> <li>Head size toward X min: 30</li> <li>Head size toward Y min: 70</li> <li>Head size toward X max: 60</li> <li>Head size toward Y max: 50</li> </ul> <p>How is 70 a minimum and 50 a maximum? What do these numbers really mean?</p> <p>Also, I see the shading in the slicer (presumably one is a shadow, the middle one is a minimum, and the darker one is a maximum?) and changing my values don't affect these shadows in the way I'd expect.</p>
607
<p>OK, so I don't want to start a holy-war here, but we're in the process of trying to consolidate the way we handle our application configuration files and we're struggling to make a decision on the best approach to take. At the moment, every application we distribute is using it's own ad-hoc configuration files, whether it's property files (ini style), XML or JSON (internal use only at the moment!).</p> <p>Most of our code is Java at the moment, so we've been looking at <a href="http://commons.apache.org/configuration/" rel="noreferrer">Apache Commons Config</a>, but we've found it to be quite verbose. We've also looked at <a href="http://xmlbeans.apache.org/" rel="noreferrer">XMLBeans</a>, but it seems like a lot of faffing around. I also feel as though I'm being pushed towards XML as a format, but my clients and colleagues are apprehensive about trying something else. I can understand it from the client's perspective, everybody's heard of XML, but at the end of the day, shouldn't be using the right tool for the job?</p> <p>What formats and libraries are people using in production systems these days, is anyone else trying to avoid the <a href="http://www.codinghorror.com/blog/archives/001114.html" rel="noreferrer">angle bracket tax</a>?</p> <p><strong><em>Edit:</strong> really needs to be a cross platform solution: Linux, Windows, Solaris etc. and the choice of library used to interface with configuration files is just as important as the choice of format.</em></p>
<p>XML XML XML XML. We're talking <em>config files here</em>. There is no "angle bracket tax" if you're not serializing objects in a performance-intense situation. </p> <p>Config files must be human readable and human understandable, in addition to machine readable. XML is a good compromise between the two.</p> <p>If your shop has people that are afraid of that new-fangled XML technology, I feel bad for you. </p>
<p>What platform are you working on? I'd recommend trying to use the preferred/common method for it.</p> <ol> <li>MacOSX - plists</li> <li>Win32 - Registry (or are there a new one here, long since I developed on it)</li> <li>Linux/Unix - ~/.apprc (name-value perhaps)</li> </ol>
3,325
<p>I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user.</p> <p>The hard part is handling re-occurring events, the row in the events table has an event_type field that tells you what kind of event it is, since an event can be for a single date only, OR a re-occuring event every x days.</p> <p><strong>The main design challenge is handling re-occurring events.</strong></p> <p>When a user views the calendar, using the month's view, how can I display all the events for the given month? The query is going to be tricky, so I thought it would be easier to create another table and create a row for each and every event, including the re-occuring events.</p> <p>What do you guys think?</p>
<p>As previously stated, <strong><em>don't reinvent the wheel</em></strong>, just enhance it.</p> <p>Checkout <a href="http://www.ultraapps.com/app_overview.php?app_id=19" rel="nofollow noreferrer">VCalendar</a>, it is open source, and comes in PHP, ASP, and ASP.Net (C#)!</p> <p>Also you could check out <a href="http://www.daypilot.org/" rel="nofollow noreferrer">Day Pilot</a> which offers a calendar written in Asp.Net 2.0. They offer a lite version that you could check out, and if it works for you, you could purchase a license.</p> <p><strong>Update (9/30/09):</strong></p> <p>Unless of course the wheel is broken! Also, you can put a shiny new coat of paint if you like (ie: make a better UI). But at least try to find some foundation to build off of, since the calendar system can be tricky (with Repeating events), and it's been done thousands of times.</p>
<p>I think I understand your second paragraph to mean you are considering a second events table that has a row for each occurrence of an event. I would avoid that.</p> <p>Re-occurring events should have a start date and a stop date (which could be Null for events that continue every X days "forever") You'll have to decide what kinds of frequency you want to allow -- every X days, the Nth day of each month, every given weekday, etc.</p> <p>I'd probably tend toward two tables - one for one time events and a second for recurring events. You'll have to query and display the two separately.</p> <p>If I were going to tackle this (and I'd try as hard as I can to avoid reinventing this wheel) I'd look for open-source libraries or, at the very least, open source projects with Calendars that you can look at. Any recommendations guys?</p>
3,367
<p>For certain programs nothing beats the command line. Unfortunately, I have never seen good documentation or examples on how to write console applications that go beyond "Hello World". I'm interested in making console apps like <a href="http://en.wikipedia.org/wiki/Vim_(text_editor)" rel="nofollow noreferrer">Vim</a> or <a href="http://en.wikipedia.org/wiki/Emacs" rel="nofollow noreferrer">Emacs</a>. Well not exactly like Vim or Emacs but one that takes over the entire command prompt while it is in use and then after you exit it leaves no trace behind. I know that on Unix there is the <a href="http://en.wikipedia.org/wiki/Curses_(programming_library)" rel="nofollow noreferrer">curses library</a> but for Windows? ...</p>
<p><a href="http://pdcurses.sourceforge.net/" rel="nofollow noreferrer">PDCurses</a> works on Win32.</p>
<p>This is the best tool for it I've ever seen!!<br> 1) Create any application using <strong><em>VB6 IDE</em></strong><br> 2) Convert it to <strong><em>Console Application</em></strong>, using <a href="http://nirsoft.net/vb/console_application_visual_basic.html" rel="nofollow"><strong>THIS!</strong></a></p>
6,487
<p>The amount of posts being voted to closed is getting ridiculous. The last two posts have been printing related, one looking for information and the other a design question for 3D printing yet both have been voted to be closed. </p> <p>Yes, I have read the other Meta post about how closing is not permanent (<a href="https://3dprinting.meta.stackexchange.com/questions/111/closing-locking-too-many-questions">Closing/locking too many questions?</a>) but this site does not have much to offer right now and I can tell you if I was new here I wouldn't stick around and edit the post time after time to get an answer when I'm sure most people here can answer the question. The site is now running at 1.2 questions per day and I don't see that going up at all if the criteria isn't changed for how people are voting. If that's how everyone wants the site run then that's fine but I'm sure you'll be alone here.</p>
<p>I absolutely agree. I believe we all want this site to maintain high quality, but right now almost no questions fall within our desired scope and form.</p> <p>I think we either need to:</p> <ul> <li>Change the acceptable scope of questions to be asked</li> <li>Change how we welcome new users</li> </ul> <p>Right now most new users do not ask questions "the SE way", which quickly leads to down-votes and closing votes. For new users this is a direct slap in the face.</p> <p>What we rather should do is to <em>encourage</em> new users to improve their question, and if they do, give them the highly desired up-votes to make them come back for more. </p> <p>I think the reputation system on SE sites is a great motivator for writing good questions and answers. And if we want this site to grow, we need to let our fellow users grow with it.</p>
<p>I've been active on SO since it was in beta, and have participated in numerous SE sites when they were in beta.</p> <p>It's my impression that there is much more enthusiasm for close votes here than in other sites which launched out of beta. I know that seems to discourage me from participating more, and may discourage others likewise.</p> <p>Whereas for programming and electronics my first goto is always stack, I'm finding that other sites are having better answers and a "nicer" approach to my n00bism in 3d printing.</p> <p>Just IMHO and FWIW!</p>
25
<p>I'd like to add the <code>HttpOnly</code> flag to <code>JSF/richfaces</code> cookies, especially the session cookie, to up the level of security on my web app. Any ideas? </p>
<p>There may be something that allows you to do this in your servlet engine. This is part of the Servlet 3.0 spec which is yet to be released.</p>
<p>Something like:</p> <pre><code>response.setHeader("Set-Cookie", "yourcookiename=yourcookievalue; HTTPOnly"); </code></pre> <p>might work in a Java environment. I am not aware of a JSF-specific way to achieve this... sorry</p> <p>This seems to be not an easy task in Java.</p>
9,795
<p>As I browse through the site, I find a lot of terms that many developers just starting out (and even some advanced developers) may be unfamiliar with.</p> <p>It would be great if people could post here with a term and definition that might be unknown to beginners or those from different programming backgrounds. </p> <p>Some not-so-common terms I've seen are 'auto boxing', 'tuples', 'orthogonal code', 'domain driven design', 'test driven development', etc.</p> <p>Code snippets would also be helpful where applicable..</p>
<p>You need to decorate the ListView property with the DesignerSerializationVisibility attribute, like so:</p> <pre><code>[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ListView MyListView { get { return this.listView1; } } </code></pre> <p>This tells the designer's code generator to output code for it.</p>
<p>Just so I'm clear, you've done something like this, right?</p> <pre><code>public ListView MyListView { get { return this.listView1; } } </code></pre> <p>So then you are accessing (at design time) the MyListView property on your UserControl?</p> <p>I think if you want proper design-time support you're better off changing the "Modifier" property on the ListView itself (back on the original UserControl) to Public - that way you can modify the ListView directly on instances of the UserControl. I've had success doing that anyway.</p>
3,654
<p>I know nothing about 3D printing and I was wondering if it is a good candidate for what I want to make.</p> <p>I want to make a custom game cartridge which looks like this: <a href="https://i.stack.imgur.com/k0RpQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k0RpQ.jpg" alt="enter image description here"></a> </p> <p>Basically it's like a SD card in a custom shell. Now I can produce the inside as a thin PCB (0.6mm-1mm). But I was wondering what the best (and cheapest) way to prototype (and maybe make a small run production) the outer shell would be. The entire cart is about 2mm thick, so each half of the shell would be at most ~0.6mm thick.</p> <p>Is this something I can do with a typical 3D printer? How would I "attach" the two halves together?</p>
<p>Typically, for FDM, the resolution is different for height compared with the x-y plane.</p> <p>In x-y, you will be constrained by the nozzle diameter (0.4mm is common), which effectively quantises your wall thickness (0.4, 0.8, 1.2 etc). These walls can be placed with maybe 0.05mm precision.</p> <p>In Z, the constraint is to be less than the nozzle, so 0.12 or 0.2 mm is common.</p> <p>So you can easily make a half which is around 1mm thick, with a 0.3mm high wall. You would want the majority of the wall width to be 0.8 or 1.2 mm at least, but you could probably arrange an overlap between the two parts to allow some tolerance and increase the glueing area.</p> <p>A flat print of only a single layer is possible, but it won't be as accurately dimensioned (due to bed-leveling accuracy). A single layer with a wall would work, but might be too flexible.</p>
<p>With the experience I have with my 3d printer you can make (almost) everything you can draw with it.</p> <p>0.6mm parts can be 3d printed but will not be very strong though.</p> <p>For joining the 2 halves when they are so thin, I think the best solution is to glue them together. With the things I make for myself I mostly use small screws or small nuts and bolts but with 0.6mm parts I guess this wil not be possible.</p>
639
<p>In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels.</p> <p>I'd like to suppress those methods in source, so I copied the suppression code generated by FxCop into AssemblyInfo.cs, but it doesn't work.</p> <p>This is the attribute that FxCop copied to the clipboard.</p> <pre><code>[module: SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", Scope = "member", Target = "WindowsClient.MainForm.InitializeComponent():System.Void", MessageId = "System.Windows.Forms.Control.set_Text(System.String)")] </code></pre> <p>Anyone knows the correct attribute to suppress this messages?</p> <p>PS: I'm using Visual Studio 2005, C#, FxCop 1.36 beta.</p>
<p>You've probably got the right code, but you also need to add CODE_ANALYSIS as a precompiler defined symbol in the project properties. I think those SuppressMessage attributes are only left in the compiled binaries if CODE_ANALYSIS is defined.</p>
<p>Module level suppression messages need to be pasted into the same file as the code that is raising the FxCop error before the namespace declaration or in assemblyinfo.cs. Additionally, you will need to have CODE_ANALYSIS defined as a conditional compiler symbols (Project > Properties > Build). Once that is in place, do a complete rebuild of project and the next time you run FxCop the error should be moved to the "Excluded in Source" tab.</p> <p>Also, one small tip, but if you are dealing with a lot of FxCop exclusions it might be useful to wrap a region around them so you can get them out of the way.</p>
5,609
<p>My printer stopped printing during a few prints, and i found that the extruder had stopped heating, and the motors had stopped running. I checked the code, and nothing was wrong. My 5A fuse though, was extremely hot. I wanted to verify whether it was my fuse that had turned bad or there was some kind of short in my circuitry. With the power switched on, none of my appliances drew any current. However, the RAMPS board drew about 0.16 amps. Is that normal? If that is normal, does it mean that my fuse needs replacement? Because none of my loads seemed to draw unnecessary current. Thanks in advance.</p>
<p>As @Mikhail Z commented, it does sound like the fuse may be bad.</p> <p>The first thing to do is put an ohmmeter across the fuse (with power off!) -- if you get high resistance the fuse is definitely bad. However, if you get low resistance that does not prove the fuse is good -- see @Tom's comments below re. polyfuses in particular, and how to disconnect from the rest of the circuit.</p> <p>If you don't get lucky testing a fuse in-line, remove it and put the ohmmeter on it in isolation. Whether good or bad, it's good to put in a fuse-holder or socket, so you never have to de-solder the fuse again. </p> <p>Some boards use auto-resetting fuses or circuit breakers, which might have more complicated ways of failing (you can always replace the part to be sure). I personally avoid auto-resetting for anything that supplies heaters; if there's a problem I want to intervene rather than letting it try again endlessly.</p> <p>Since the heaters and the motors are both down, it's a good bet it's the fuse or something very early (that is, "near" the power supply). If it were a single motor or single heater, then the output control (typically a solid-state relay, or perhaps the logic controlling it) would be a better bet. Though unlikely, it's possible for two or more such controls to fail at once, so don't rule that out <em>completely</em>.</p> <p>Let us know what you discover.</p>
<p>Its very likely the polyfuse is bad. In an ideal printer, given the heater cores and great deal of power, polyfuses are some of the worst things you can use. Polyfuses have a tendency to fail in "interesting" ways, especially around their trigger amperage. Fire is one of those failure modes.</p> <p>Not only that, but if this is a noname chinese RAMPS 1.4, then you're also looking at 1/2 oz pour (it should be 1 oz or more for power traces) for the circuit board and cheaping on everything possible. I've a few boards like this that are a firetrap, along with a badly poured PCB heated bed. In that case, I would consider getting a better controller. If that's outside of your budget there is another way to do this.</p> <p>Unsolder the polyfuses and put wire between them. Normally, this is <strong>unprotecting</strong> yourself. But we're going to fix that. Head to the local automotive shop and get yourself inline fuses (think of 2 wires with a fuse in a pill shaped device). You want a 5A and a 11A fuse. Or if you did the math and know better, get the fuses you calculated for. Now, make sure they're inline with the + side of the power.</p> <p>You now have external fuses that you know are rated for the appropriate amperage, unlike polyfuses.</p>
676
<p>I was using a CASE called <a href="http://www.magicsoftware.com/" rel="nofollow noreferrer">MAGIC</a> for a system I'm developing, I've never used this kind of tool before and at first sight I liked, a month later I had a lot of the application generated, I felt very productive and ... I would say ... satisfied.</p> <p>In some way a felt uncomfortable, cause, there is no code and everything I was used to, but in the other hand I could speed up my developing. The fact is that eventually I returned to use C# because I find it more flexible to develop, I can make unit testing, use CVS, I have access to more resources and basically I had "all the control". I felt that this tool didn't give me confidence and I thought that later in the project I could not manage it due to its forced established rules of development. And also a lot of things like sending emails, using my own controls, and other things had their complication, it seemed that at some point it was not going to be as easy as initially I thought and as initially the product claims. This reminds me a very nice article called "<a href="http://www.virtualschool.edu/mon/SoftwareEngineering/BrooksNoSilverBullet.html" rel="nofollow noreferrer">No Silver Bullet</a>".</p> <p>This CASE had its advantages but on the other hand it doesn't have resources you can consult and actually the license and certification are very expensive. For me another dissapointing thing is that because of its simplistic approach for development I felt scared on first hand cause of my unexperience on these kind of tools and second cause I thought that if I continued using it maybe it would have turned to be a complex monster that I could not manage later in the project.</p> <p>I think it's good to use these kind of solutions to speed up things but I wonder, why aren't these programs as popular as VS.Net, J2EE, Ruby, Python, etc. if they claim to enhance productivity better than the tools I've pointed?</p>
<p>We use a CASE tool at my current company for code generation and we are trying to move away from it.</p> <p>The benefits that it brings - a graphical representation of the code making components 'easier' to pick up for new developers - are outweighed by the disadvantges in my opinion.</p> <p>Those main disadvantages are:</p> <ol> <li><p>We cannot do automatic merges, making it close to impossible for parallel development on one component.</p></li> <li><p>Developers get dependant on the tool and 'forget' how to handcode.</p></li> </ol>
<p>Just a couple questions for you:</p> <p>How much productivity do you gain compared to the control that you use? How testable and reliant is the code you create? How well can you implement a new pattern into your design?</p> <p>I can't imagine that there is a CASE out there that I could write a test first and then use a CASE to generate the code I need. I'd rather stick to resharper which can easily do my mundane tasks and retain full control of my code.</p>
3,448
<p>How do you create a static class in C++? I should be able to do something like:</p> <pre><code>cout &lt;&lt; "bit 5 is " &lt;&lt; BitParser::getBitAt(buffer, 5) &lt;&lt; endl; </code></pre> <p>Assuming I created the <code>BitParser</code> class. What would the <code>BitParser</code> class definition look like?</p>
<p>If you're looking for a way of applying the &quot;static&quot; keyword to a class, like you can in C# for example, then you won't be able to without using Managed C++.</p> <p>But the looks of your sample, you just need to create a public static method on your BitParser object. Like so:</p> <p><strong>BitParser.h</strong></p> <pre><code>class BitParser { public: static bool getBitAt(int buffer, int bitIndex); // ...lots of great stuff private: // Disallow creating an instance of this object BitParser() {} }; </code></pre> <p><strong>BitParser.cpp</strong></p> <pre><code>bool BitParser::getBitAt(int buffer, int bitIndex) { bool isBitSet = false; // .. determine if bit is set return isBitSet; } </code></pre> <p>You can use this code to call the method in the same way as your example code.</p>
<p>One case where namespaces may not be so useful for achieving "static classes" is when using these classes to achieve composition over inheritance. Namespaces cannot be friends of classes and so cannot access private members of a class.</p> <pre><code>class Class { public: void foo() { Static::bar(*this); } private: int member{0}; friend class Static; }; class Static { public: template &lt;typename T&gt; static void bar(T&amp; t) { t.member = 1; } }; </code></pre>
3,075
<p>Can anyone explain this behavior or how to get around it?</p> <p>If you execute this query:</p> <pre><code>select * from TblA left join freetexttable ( TblB, *, 'query' ) on TblA.ID = [Key] inner join DifferentDbCatalog.dbo.TblC on TblA.ID = TblC.TblAID </code></pre> <p>It will be very very very slow.</p> <p>If you change that query to use two inner joins instead of a left join, it will be very fast. If you change it to use two left joins instead of an inner join, it will be very fast.</p> <p>You can observe this same behavior if you use a sql table variable instead of the freetexttable as well. </p> <p>The performance problem arises any time you have a table variable (or freetexttable) and a table in a different database catalog where one is in an inner join and the other is in a left join.</p> <p>Does anyone know why this is slow, or how to speed it up?</p>
<p>A general rule of thumb is that OUTER JOINs cause the number of rows in a result set to <em>increase,</em> while INNER JOINs cause the number of rows in a result set to <em>decrease.</em> Of course, there are plenty of scenarios where the opposite is true as well, but it's more likely to work this way than not. What you want to do for performance is keep the size of the result set (working set) as small as possible for as long as possible. </p> <p>Since both joins match on the first table, changing up the order won't effect the accuracy of the results. Therefore, you probably want to do the INNER JOIN before the LEFT JOIN:</p> <pre><code>SELECT * FROM TblA INNER JOIN DifferentDbCatalog.dbo.TblC on TblA.ID = TblC.TblAID LEFT JOIN freetexttable ( TblB, *, 'query' ) on TblA.ID = [Key] </code></pre> <p>As a practical matter, the query optimizer <em>should</em> be smart enough to compile to use the faster option, regardless of which order you specified for the joins. However, it's good practice to pretend that you have a dumb query optimizer, and that query operations happen in order. This helps future maintainers spot potential errors or assumptions about the nature of the tables.</p> <p>Because the optimizer should re-write things, this probably isn't good enough to fully explain the behavior you're seeing, so you'll still want to <em>examine the execution plan</em> used for each query, and probably add an index as suggested earlier. This is still a good principle to learn, though.</p>
<p>Index the field you use to perform the join.</p> <p>A good rule of thumb is to assign an index to any commonly referenced <a href="http://en.wikipedia.org/wiki/Foreign_key" rel="nofollow noreferrer">foreign</a> or <a href="http://en.wikipedia.org/wiki/Candidate_key" rel="nofollow noreferrer">candidate keys</a>.</p>
6,929
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c">How to properly clean up Excel interop objects in C#</a> </p> </blockquote> <p>Suppose a ASP.NET web application generates automated Excel Reports on the server. How do we kill a server-side Excel.EXE once the processing is over. I am raising this purposely, because I believe that the Garbage Collecter does not clean the Excel executable even after the Excel file is closed.</p> <p>Any pointers would be helpful?</p>
<p>Sorry to say this, and I'm not trying to be smart, but... <strong>don't put office on the server!!!</strong></p> <p>That's if I've understood correctly! :)</p> <p><strong>EDIT:</strong> Even though I've been marked down for this, I will never <em>ever</em> advocate running Office on the server - it has proven <strong>way too</strong> much of a pain in the ass for me in the past.</p> <p>Having said that, the same now goes for me and Crystal Reports ;-)</p>
<p>You need safely dispose all COM interop objects after you end your work. By "all" I mean absolutely <strong>all</strong>: collections property values and so on. I've created stack object and pushed objects during their setup:</p> <pre><code>Stack&lt;object&gt; comObjectsToRelease = new Stack&lt;object&gt;(); ... Log("Creating VBProject object."); VBProject vbProject = workbook.VBProject; comObjectsToRelease.Push(vbProject); ... finally { if(excel != null) { Log("Quiting Excel."); excel.Quit(); excel = null; } while (comObjectsToRelease.Count &gt; 0) { Log("Releasing {0} COM object.", comObjectsToRelease.GetType().Name); Marshal.FinalReleaseComObject(comObjectsToRelease.Pop()); } Log("Invoking garbage collection."); GC.Collect(); } </code></pre> <p>If Excel is still there you have to kill it manually.</p>
7,451
<p>Does anyone know where I can get a free 3D design (STEP or STL) of an M4 Screw and nut? I have found only an M3 on Thingiverse: <a href="http://www.thingiverse.com/thing:729842" rel="nofollow noreferrer">M3 Bolt</a> by <a href="http://www.thingiverse.com/Kaleta" rel="nofollow noreferrer">Kaleta</a>.</p>
<p>You can get a model for nearly everything McMaster-Carr sells from their website.</p> <p>M4 Hex Head Screw - <a href="https://www.mcmaster.com/#91280a140/=15dmpx8" rel="nofollow noreferrer">https://www.mcmaster.com/#91280a140/=15dmpx8</a></p> <p>M4 Nut - <a href="https://www.mcmaster.com/#90592a090/=15dmqjy" rel="nofollow noreferrer">https://www.mcmaster.com/#90592a090/=15dmqjy</a></p> <p>The options to download models are to the right of the drawings.</p> <hr> <p><a href="https://www.mcmaster.com/help/drawingsandmodels.asp?sesnextrep=301313211397959#disclaimer" rel="nofollow noreferrer">NOTE: the site does prohibit use of these models for direct printing.</a></p> <blockquote> <p>You shall not use a CAD model to engage in 3D printing or other fabrication of the object depicted in the CAD model for any other purpose. You shall not otherwise redistribute or make available the CAD models (or any design drawings or prototypes that incorporate them) to any third parties, including third parties in the business of selling products similar to the products sold by us.</p> </blockquote>
<p>The thing you linked to describes itself as being generated from a parametric model: <a href="http://www.thingiverse.com/apps/customizer/run?thing_id=193647" rel="nofollow noreferrer">http://www.thingiverse.com/apps/customizer/run?thing_id=193647</a></p> <p>To generate any different bolt or nut, you will need to identify the correct dimensions for not only the thread (where hints exist in the customiser), but also for the hex head. These are obviously less critical to define than the thread.</p> <p>Once you have generated a custom model, you can share it and answer your own question.</p>
444
<p>I'm printing with anycubic i3 mega on an ultrabase bed. When I first got the printer the prints were easy to remove from the bed after it cools down, I didn't need to put any extra effort. However after I used 70% isopropyl to clean it it seems I removed some kind of extra coating as all next prints were sticking to the bed firmly even after the bed cools down. So I tried to heat the bed up to 100 degrees and then cool it down and wait until it gets to something like 35, at that point print comes off quite easily (really helped me with some big parts with huge initial layer) so I wonder if I should just add that extra heating cycle to the end of each print job.</p> <p>Is there any possible problems with that?</p> <p>PS my understanding is that PLA should be okay with short temperature spike since it is being melted with twice as high heat. However long exposure to that temperature might cause some deformation (eg if I throw the printed part into dishwasher). Another possible concern is that extra heating cycle could potentially shorten life of the ultrabase, but not sure if it is the case.</p> <p>UPDATE</p> <p>so after some experiments I printed at least a dozen calibration cubes adjusting several parameters along the way as it seems each of them contributed to the issue</p> <ul> <li>I decided to reset initial layer thickness which I noticed was set to <code>0.25</code> when normal layer was <code>0.2</code>. Since it was thicker for better adhesion I thought I don't need it since I don't have problem with sticking to the bed :)</li> <li>second thing was the flow adjustment and enabling some layer filling settings in cura (filtering small holes etc). Ended up at <code>91%</code> flow rate which gave me much cleaner top layers as well as the bottom ones.</li> <li>and finally I played with <code>Z offset</code>, I did bed leveling recently so it was flat (did single layer tests to check that) but it might have been a little bit too high, so adding an offset seems like a good way to compensate for it. The thing I was looking after as a feedback here is the squeezing bottom layers issue, so I stopped once I got initial layers a bit smaller than the ones on top, went back a few values and ended up with <code>0.125 mm</code> which sounds quite big to me but it allowed to get initial layer very clean and consistent with next layer so I think I got it right.</li> </ul> <p>I can say it is easier to remove the cube from the bed now (used to be very difficult and I was using a mallet almost every time in the beginning) but it still doesn't come off on its own. I also noticed that now all three dimensions are almost identical (Z was about <code>0.5</code> less). And all X/Y/Z are ~19mm after cube cools down (the model is 20mm) so I wonder if I need to fix that one now</p>
<p>Heating PLA even to 60°C will make it pliable and may affect dimensional accuracy; 100°C is likely to make that severe. Being stuck to the bed and thus constrained by it might help some, but I think it's a bad idea.</p> <p>If your PLA is hard to remove, you probably have bed leveling issues. PLA should remove easily after cooling from reasonable print-time bed temperatures of 40-60°C to room temperature as long as it has not been extruded against the bed with excessive force (from being too close and having nowhere else to go).</p>
<p>You did exactly the right thing:</p> <ol> <li>look,</li> <li>see,</li> <li>think,</li> <li>evaluate and adapt</li> <li>test</li> <li>Back to 1. or continue to 7.</li> <li>Solution found and applied!</li> </ol> <p>Congrats! Johan</p> <p>Ps: I use the tape in paper, used to mask before paint jobs, I was not that keen as you! It always comes off, and I restart every time with a clean glass, no hairspray, glue or others. They cost nothing, and if you are handy, you can use 100mm wide stripes. (or just the amount needed for your part.</p>
1,698
<p>Is there a way in .net 2.0 to discover the network alias for the machine that my code is running on? Specifically, if my workgroup sees my machine as //jekkedev01, how do I retrieve that name programmatically?</p>
<p>Since you can have multiple network interfaces, each of which can have multiple IPs, and any single IP can have multiple names that can resolve to it, there may be more than one.</p> <p>If you want to know all the names by which your DNS server knows your machine, you can loop through them all like this:</p> <pre><code>public ArrayList GetAllDnsNames() { ArrayList names = new ArrayList(); IPHostEntry host; //check each Network Interface foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { //check each IP address claimed by this Network Interface foreach (UnicastIPAddressInformation i in nic.GetIPProperties().UnicastAddresses) { //get the DNS host entry for this IP address host = System.Net.Dns.GetHostEntry(i.Address.ToString()); if (!names.Contains(host.HostName)) { names.Add(host.HostName); } //check each alias, adding each to the list foreach (string s in host.Aliases) { if (!names.Contains(s)) { names.Add(s); } } } } //add "simple" host name - above loop returns fully qualified domain names (FQDNs) //but this method returns just the machine name without domain information names.Add(System.Net.Dns.GetHostName()); return names; } </code></pre>
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.environment.aspx" rel="nofollow noreferrer">System.Environment</a> class. It has a property for retrieving the machine name, which is retrieved from the NetBios. Unless I am misunderstanding your question.</p>
8,440
<p>I am looking to do this in C/C++. I came across <a href="http://www.swig.org/Doc1.3/Varargs.html" rel="nofollow noreferrer"><strong>Variable Length Arguments</strong></a>, but this suggests a solution with Python and C using <a href="http://sourceware.org/libffi/" rel="nofollow noreferrer">libffi</a>.</p> <p>Now, if I want to wrap the <code>printf</code> function with <code>myprintf</code>.</p> <p>I do it like below:</p> <pre><code>void myprintf(char* fmt, ...) { va_list args; va_start(args, fmt); printf(fmt, args); va_end(args); } int _tmain(int argc, _TCHAR* argv[]) { int a = 9; int b = 10; char v = 'C'; myprintf(&quot;This is a number: %d and \nthis is a character: %c and \n another number: %d\n&quot;, a, v, b); return 0; } </code></pre> <p>But the results are not as expected!</p> <pre class="lang-none prettyprint-override"><code>This is a number: 1244780 and this is a character: h and another number: 29953463 </code></pre> <p>What did I miss?</p>
<p>The problem is that you cannot use 'printf' with <em>va_args</em>. You must use <strong>vprintf</strong> if you are using variable argument lists. <em>vprint</em>, <em>vsprintf</em>, <em>vfprintf</em>, etc. (there are also 'safe' versions in Microsoft's C runtime that will prevent buffer overruns, etc.)</p> <p>You sample works as follows:</p> <pre><code>void myprintf(char* fmt, ...) { va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); } int _tmain(int argc, _TCHAR* argv[]) { int a = 9; int b = 10; char v = 'C'; myprintf(&quot;This is a number: %d and \nthis is a character: %c and \n another number: %d\n&quot;, a, v, b); return 0; } </code></pre>
<p>How do you mean a pure C/C++ solution?</p> <p>The rest parameter (...) is supported cross platform in the C runtime.</p> <p><em><a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/va-arg-va-copy-va-end-va-start" rel="nofollow noreferrer">va_arg, va_copy, va_end, va_start</a></em></p>
6,267
<p>Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access.</p> <p>Before I go talk to the IT department I would like to find out if this is even possible?</p> <p>Edit: From rails on linux? (Yes, I know I'm crazy)</p>
<p>Agree with Adam. Querying the Sharepoint Database is a big no-no, as Microsoft does not guarantee that the Schema is in any way stable. Only access the database if there is really no other way.</p> <p>As for Sharepoint, usually the Lists.asmx Web Service is what you want to look at first.</p> <p><a href="https://www.c-sharpcorner.com/article/access-sharepoint-portal-server-using-web-services-in-net/" rel="nofollow noreferrer">http://www.c-sharpcorner.com/UploadFile/mahesh/WSSInNet01302007093018AM/WSSInNet.aspx</a></p> <p><a href="https://web.archive.org/web/20200221152136/http://geekswithblogs.net:80/mcassell/archive/2007/08/22/Accessing-Sharepoint-Data-through-Web-Services.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/mcassell/archive/2007/08/22/Accessing-Sharepoint-Data-through-Web-Services.aspx</a></p>
<p>Just a small comment. Never ever go to the database direct. If there is no way to do it via published and supported API's, then there is no way to do it. End of story. This applies even to when you are "just reading data", as this can still cause significant issues.</p>
5,316
<p>How can I call a custom action dll written in managed code (.net) from an installer without using an unmanaged intermediary?</p>
<p>The answer to your question depends on how your are authoring your installer.</p> <p>For Visual Studio setup projects, create an installer class in one of your deployed assemblies. This is covered in the MSDN documentation, eg <a href="http://msdn.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx</a></p> <p>For Wix projects, you can use DTF to build managed custom actions which have complete access to the contents of the MSI. Wix is available at <a href="http://wix.sourceforge.net/" rel="nofollow noreferrer">http://wix.sourceforge.net/</a>.</p>
<p>There is support for exactly this in .NET/Windows Installer</p> <p>Create an assembly using VS.NET. Add an installer class to the project - select 'Add - New Item'. Select intaller class. This class derives from System.Configuration.Install.Installer. It has a number of virtual methods such as Install(). This will be called when by the windows installer engine at install time.</p> <p>This assembly can then be added to your Windows Installer project as a custom action. The method used to declare the custom action as a .NET installer class depends on the tool you are using to create the installation.</p> <p>Sorry this is a little brief.</p>
5,549
<p>At my job we make &amp; sell websites. Usually we install our .NET C# based site on a customer's server and maintain and support it remotely. However, every once in a while, for bigger development works and just to make things simpler (and faster!), we will copy the site to a local server.</p> <p>This is great, but has one pain - moving the site back to the customer. Now, If nothing was change on the customer's copy - no problem. However, it is the sad truth that sometime (read more often than I would like) some fixes were needed to be applied on the production server. Either because the customer needed it NOW or simply because it was major bug.</p> <p>I know that you can easily apply those bug fixes to the local copy as well, but this is an error prone process. So I'm setting my hopes on a distributed version control to help synchronize the two copies.</p> <p>Here is what I need:</p> <ul> <li>Easy to install - nothing else needed except the installer and admin rights.</li> <li>Can integrated in an existing website as a virtual directory and works on port 80 - no hassle with new DNS required.</li> <li>Excellent software</li> </ul> <p>That's it. Any ideas?</p> <hr> <h2>Some comments on the answers</h2> <p>First, thanks! much appreciated.</p> <p>I've looked at Mercurial and Bazaar and both look very good. The only caveat is the installation as a virtual directory on IIS. Mercurial, as far as I understand, use a special protocol (wire) and Bazaar needs and addition of python extensions. Is there another system which is easier to integrate with IIS? I'm willing to take a performance hit for that.</p>
<p>I'd look at either <a href="http://www.selenic.com/mercurial/wiki/" rel="nofollow noreferrer">Mercurial</a> or <a href="http://bazaar-vcs.org/" rel="nofollow noreferrer">Bazaar</a>. I'm told Git also works on windows, but I suspect the windows port is still a second class port at best.</p> <p>You'll probably need to be able to run python scripts on your webserver to host either of them.</p>
<p>Maybe not exactly what you request but checkout <a href="http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp" rel="nofollow noreferrer">DeltaCopy</a> which is a windows version of <a href="http://en.wikipedia.org/wiki/Rsync" rel="nofollow noreferrer">rsync</a>. You can also read about another rsync solution <a href="http://hype-free.blogspot.com/2007/02/using-rsync-on-windows.html" rel="nofollow noreferrer">here</a></p>
4,972
<p>I am new to 3D printing but have been in CNC Machining for a few years. I have a part I am trying to print that is a cylinder 1.000 in. in diameter and has a .200 in overhang starting at 1.300 in. In other words I am printing a 1.300 in. cylinder that is 1.500 in. tall that at 1.300 in. its diameter increases by .200 in. </p> <p>When I first printed the part the overhang had sunk or fallen out. Not by much and is still usable but made a crappy finish. What would I need to do in order to have the overhang not drop as the base layer extended outward .200 in. at 1.300 in.?</p> <p>I tried slowing the feed rate but that was worse. I also lowered the temp to 195&nbsp;°C.</p> <p>I am using a Monoprice Select Mini running at 200&nbsp;°C and a 1.0 Speed (Not really sure what that feed rate is in terms of mm/s). Based on what I've seen so far I would increase the speed and keep the temp at 200&nbsp;°C.</p> <p><a href="https://i.stack.imgur.com/hif1O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hif1O.jpg" alt="enter image description here"></a></p> <p>Any suggestions, I hope I have explained my problem well enough.</p>
<p>The world of 3D Printers usually uses the metric system, especially in nozzle sizes. 0.2 inches are therefore better referred to as 5 mm, which is a considerable amount: that's 11 to 13 perimeters from a 0.4 mm nozzle, depending on extrusion width (0.46 and 0.4 mm respectively). Furthermore, the bore of the item isn't supported either, it is bridging.</p> <p>To print overhangs and bridging without sagging, one should activate the generation of support material in the slicer.</p> <p>Generally speaking, PLA (judging from the print temperature) doesn't need to be printed with a raft and would be better served with a <code>brim</code> for bed adhesion, unless you have a perforated bed. If you have to print in the shown orientation, then you should activate support generation in your slicer.</p> <p>For this part, however, there is a better solution: it is of very simple geometry and it doesn't have to be printed as shown but equally could be printed "upside-down" by being rotated around the X-Axis by 180° in the slicer. This has two benefits: it removes all unsupported overhangs an avoids support structure, making the wasted material pretty much nonexistent.</p> <p>I strongly recommend taking a look at my <a href="https://3dprinting.stackexchange.com/questions/6726/what-special-considerations-must-be-taken-when-designing-parts-for-3d-printing/6830#6830">3D Design Primer</a> and the excellent question on <a href="https://3dprinting.stackexchange.com/questions/10636/how-to-decide-print-orientation">How to decide print orientation?</a> and then delve into further reading: </p> <ul> <li><a href="https://3dprinting.stackexchange.com/questions/250/how-to-print-an-overhanging-arc">How to print an overhanging arc</a></li> <li><a href="https://3dprinting.stackexchange.com/questions/686/how-can-i-improve-the-overhang-angles-my-printer-can-successfully-print">How can I improve the overhang angles my printer can successfully print?</a></li> <li><a href="https://3dprinting.stackexchange.com/questions/5529/is-there-any-setting-that-could-allow-me-to-print-this-overhang-without-support">Is there any setting that could allow me to print this overhang without support?</a></li> </ul>
<p>It appears that your part could be printable upside down. If possible, I'd highly recommend this, as it mostly avoids supports all together.</p>
1,483
<p>As a classic <code>ASP developer</code> about once a year since <code>ASP.NET</code> came out I decide I really gotta buckle down and learn this fancy new <code>ASP.NET</code>. A few days in and messing with code-behinds and webforms and all this other stuff.</p> <p>I decide the new fancy stuff is whack and go find something else to learn (<code>PHP and Ruby and Python were all fun to play with but I couldn't use it much with my existing ASP stuff</code>).</p> <p>Anyway, one project came up and I was able to use <code>PHP</code> and <code>CakePHP</code> and after getting my head around MVC I finally found something I liked and felt it was worth using over ASP (<code>PHP is cool too but it feels a lot like </code>ASP<code> so maybe that's why I like it so much</code>). But now with Jeff and the SO team raving about <code>ASP.NET MVC</code>, I think it's about time I start messing with <code>ASP.NET</code> again but</p> <p><strong>I keep thinking that PHP is free and blah blah blah . . . is <code>ASP.NET MVC</code> that much better than PHP with tools like CakePHP?</strong></p> <p>I know about compiled vs. not compiled and speed issues but most of that seems like a non-issue when you factor in all the caching and the fact that you can compile your PHP if you want.</p>
<p>For a classic ASP developer moving to ASP.NET MVC you are looking at learning a new language (C# or VB.NET), a new database layer (ADO.NET), and a new framework (ASP.NET MVC).</p> <p>That's a lot of new technologies to wrap your head around all at once.</p> <p>Also, I don't think it is so much that ASP.NET MVC is so much better than CakePHP (or Code Igniter, Ruby on Rails, etc.) The great thing about ASP.NET MVC (and other ASP.NET-based technologies such as MonoRail <a href="http://www.castleproject.org/monorail/index.html" rel="noreferrer">http://www.castleproject.org/monorail/index.html</a>) is that developers who are using ASP.NET now have the option of following the MVC pattern using tools and languages they are familiar with. That is an option that wasn't available before.</p>
<p>ASP.NET MVC is sparsely documented at present -- and of course it depends on your background. If you don't know ASP.NET yet, I wouldn't recommend jumping into it with ASP.NET MVC, too many layers of learning at once.</p>
7,038
<p>What are the advantages/disadvantages of keeping SQL in your C# source code or in Stored Procs? I've been discussing this with a friend on an open source project that we're working on (C# ASP.NET Forum). At the moment, most of the database access is done by building the SQL inline in C# and calling to the SQL Server DB. So I'm trying to establish which, for this particular project, would be best.</p> <p>So far I have:</p> <p>Advantages for in Code:</p> <ul> <li>Easier to maintain - don't need to run a SQL script to update queries</li> <li>Easier to port to another DB - no procs to port</li> </ul> <p>Advantages for Stored Procs:</p> <ul> <li>Performance</li> <li>Security</li> </ul>
<p>I am not a fan of stored procedures</p> <blockquote> <p>Stored Procedures are MORE maintainable because: * You don't have to recompile your C# app whenever you want to change some SQL</p> </blockquote> <p>You'll end up recompiling it anyway when datatypes change, or you want to return an extra column, or whatever. The number of times you can 'transparently' change the SQL out from underneath your app is pretty small on the whole</p> <blockquote> <ul> <li>You end up reusing SQL code.</li> </ul> </blockquote> <p>Programming languages, C# included, have this amazing thing, called a function. It means you can invoke the same block of code from multiple places! Amazing! You can then put the re-usable SQL code inside one of these, or if you want to get really high tech, you can use a library which does it for you. I believe they're called Object Relational Mappers, and are pretty common these days.</p> <blockquote> <p>Code repetition is the worst thing you can do when you're trying to build a maintainable application!</p> </blockquote> <p>Agreed, which is why storedprocs are a bad thing. It's much easier to refactor and decompose (break into smaller parts) code into functions than SQL into... blocks of SQL?</p> <blockquote> <p>You have 4 webservers and a bunch of windows apps which use the same SQL code Now you realized there is a small problem with the SQl code so do you rather...... change the proc in 1 place or push the code to all the webservers, reinstall all the desktop apps(clickonce might help) on all the windows boxes</p> </blockquote> <p>Why are your windows apps connecting directly to a central database? That seems like a HUGE security hole right there, and bottleneck as it rules out server-side caching. Shouldn't they be connecting via a web service or similar to your web servers?</p> <p>So, push 1 new sproc, or 4 new webservers?</p> <p>In this case it <em>is</em> easier to push one new sproc, but in my experience, 95% of 'pushed changes' affect the code and not the database. If you're pushing 20 things to the webservers that month, and 1 to the database, you hardly lose much if you instead push 21 things to the webservers, and zero to the database.</p> <blockquote> <p>More easily code reviewed.</p> </blockquote> <p>Can you explain how? I don't get this. Particularly seeing as the sprocs probably aren't in source control, and therefore can't be accessed via web-based SCM browsers and so on.</p> <h2>More cons:</h2> <p>Storedprocs live in the database, which appears to the outside world as a black box. Simple things like wanting to put them in source control becomes a nightmare.</p> <p>There's also the issue of sheer effort. It might make sense to break everything down into a <a href="http://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/" rel="noreferrer">million tiers</a> if you're trying to justify to your CEO why it just cost them 7 million dollars to build some forums, but otherwise creating a storedproc for every little thing is just extra donkeywork for no benefit.</p>
<p>For Microsoft SQL Server you should use stored procedures wherever possible to assist with execution plan caching and reuse. Why do you want to optimise plan re-use? Because the generation of execution plans is fairly expensive to do.</p> <p>Although the caching and reuse of execution plans for ad-hoc queries has improved significantly in later editions of SQL server (especially 2005 and 2008) there are still far fewer issues with plan reuse when dealing with stored procedures than there are for ad-hoc queries. For example, SQL server will only re-use an execution plan if the plan text matches <strong>exactly</strong> - right down to comments and white space, for example, if each of the following lines of SQL were to be executed independently, none of them would use the same execution plan:</p> <pre><code>SELECT MyColumn FROM MyTable WHERE id = @id select MyColumn from MyTable WHERE id = @id SELECT MyColumn FROM MyTable WHERE id = @id SELECT MyColumn FROM MyTable WHERE id = @id -- "some comment" SELECT MyColumn FROM MyTable WHERE id = @id -- "some other comment" </code></pre> <p>On top of this, if you don't explicitly specify the types of your parameters then there is a good chance that SQL Server might get it wrong, for example if you executed the above query with the input 4, then SQL Server will parametrise the query with @id as a SMALLINT (or possibly a TINYINT), and so if you then execute the same query with an @id of say 4000, SQL Server will parametrise it as an INT, and wont reuse the same cache.</p> <p>I think there are also some other issues, and in honesty most of them can probably be worked around - especially with later editions of SQL Server, but stored procedures generally offer you more control.</p>
3,593
<p>Within c#, I need to be able to</p> <ul> <li>Connect to a remote system, specifying username/password as appropriate</li> <li>List the members of a localgroup on that system</li> <li>Fetch the results back to the executing computer</li> </ul> <p>So for example I would connect to \SOMESYSTEM with appropriate creds, and fetch back a list of local administrators including SOMESYSTEM\Administrator, SOMESYSTEM\Bob, DOMAIN\AlanH, "DOMAIN\Domain Administrators".</p> <p>I've tried this with system.directoryservices.accountmanagement but am running into problems with authentication. Sometimes I get:</p> <p><em>Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again. (Exception from HRESULT: 0x800704C3)</em></p> <p>The above is trying because there will be situations where I simply cannot unmap existing drives or UNC connections.</p> <p>Other times my program gets UNKNOWN ERROR and the security log on the remote system reports an error 675, code 0x19 which is KDC_ERR_PREAUTH_REQUIRED.</p> <p>I need a simpler and less error prone way to do this!</p>
<p>This should be easy to do using WMI. Here you have a pointer to some docs:</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa394507.aspx" rel="nofollow noreferrer">WMI Documentation for Win32_UserAccount</a></p> <p>Even if you have no previous experience with WMI, it should be quite easy to turn that VB Script code at the bottom of the page into some .NET code.</p> <p>Hope this helped!</p>
<p>You should be able to do this with System.DirectoryServices.DirectoryEntry. If you are having trouble running it remotely, maybe you could install something on the remote machines to give you your data via some sort of RPC, like remoting or a web service. But I think what you're trying should be possible remotely without getting too fancy.</p>
4,167
<p>Try loading <a href="http://www.zodiacwheels.com/images/wheels/blackout_thumb.jpg" rel="noreferrer">this normal .jpg file</a> in Internet Explorer 6.0. I get an error saying the picture won't load. Try it in any other browser and it works fine. What's wrong? The .jpg file is just a normal picture sitting on the web server. I can even create a simple web page:</p> <pre><code>&lt;a href="http://www.zodiacwheels.com/images/wheels/blackout_thumb.jpg"&gt;blah&lt;/a&gt; </code></pre> <p>and use right click + save target as with IE6 to save it to my desktop, and it's a valid JPG file. However, <em>it won't load in the browser!</em></p> <p>Why?!</p> <p>I even tried checking the header response and MIME type and it looks fine:</p> <pre><code>andy@debian:~$ telnet www.zodiacwheels.com 80 Trying 72.167.174.247... Connected to zodiacwheels.com. Escape character is '^]'. HEAD /images/wheels/blackout_thumb.jpg HTTP/1.1 Host: www.zodiacwheels.com HTTP/1.1 200 OK Date: Wed, 20 Aug 2008 06:19:04 GMT Server: Apache Last-Modified: Wed, 20 Aug 2008 00:29:36 GMT ETag: "1387402-914ac-48ab6570" Accept-Ranges: bytes Content-Length: 595116 Content-Type: image/jpeg </code></pre> <p>The site needs to be able to work with IE6, how come it won't load a simple .jpg file?</p>
<p>The JPG you uploaded is in <a href="http://en.wikipedia.org/wiki/Cmyk" rel="noreferrer">CMYK</a>, IE and Firefox versions before 3 can't read these. Open it using Photoshop (or anything similar, I'm sure GIMP would work too) and resave it in <a href="http://en.wikipedia.org/wiki/Rgb" rel="noreferrer">RGB</a>.</p> <p>edit: Further Googling makes me suspect that CMYK isn't really a part of the jpeg standard, but <strong>can</strong> be shoehorned in there. That's why some software does not consider the file valid. It does however open just fine in Photoshop CS3, and shows a cmyk colorspace.</p>
<p>It is possible for other applications to register themselves as a handler for files with a particular extension. Quicktime has (or at least had) a tendency to do this with .png files, so a .png file would display fine inline in an HTML page, but with an URL referring directly to the .png file, IE would immediately delegate all responsibility for handling the file to Quicktime.</p> <p>Might this be what is happening to your .jpg files? Is it only this .jpg file that you're having a problem with?</p>
3,811
<p>I'm looking at working on a project which uses C#.NET (sitting on a windows box) as the primary language and PostgreSQL as the backend database (backend is sitting on a linux box). I've heard that ODBC.NET allows for easy integration of these two components. </p> <p>Has anyone had experience actually setting C# and PostgreSQL up to work together? If so, do you have any suggestions about how to go about it, issues you've found, etc.?</p>
<p>I'm working with C# and Postgres using <b>Npgsql2</b> component, and they work fast, I recommend you.</p> <p>You can download from <a href="https://github.com/npgsql/Npgsql/releases" rel="noreferrer">https://github.com/npgsql/Npgsql/releases</a></p> <p><b>Note:</b> If you want an application that works with any database you can use the <b>DbProviderFactory</b> class and make your queries using <b>IDbConnection</b>, <b>IDbCommand</b>, <b>IDataReader</b> and/or <b>IDbTransaction</b> interfaces.</p>
<p>Npgsql is excellent driver, but only issue Ive found so far is that Numeric value does not fit in a System.Decimal, so only option is correct each query or DB schema </p> <p><a href="https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/438#issuecomment-486586272" rel="nofollow noreferrer">https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/438#issuecomment-486586272</a></p>
6,918
<p>I wrote a SQL function to convert a datetime value in SQL to a friendlier "n Hours Ago" or "n Days Ago" etc type of message. And I was wondering if there was a better way to do it. </p> <p>(Yes I know "don't do it in SQL" but for design reasons I have to do it this way).</p> <p>Here is the function I've written:</p> <pre><code>CREATE FUNCTION dbo.GetFriendlyDateTimeValue ( @CompareDate DateTime ) RETURNS nvarchar(48) AS BEGIN DECLARE @Now DateTime DECLARE @Hours int DECLARE @Suff nvarchar(256) DECLARE @Found bit SET @Found = 0 SET @Now = getDate() SET @Hours = DATEDIFF(MI, @CompareDate, @Now)/60 IF @Hours &lt;= 1 BEGIN SET @Suff = 'Just Now' SET @Found = 1 RETURN @Suff END IF @Hours &lt; 24 BEGIN SET @Suff = ' Hours Ago' SET @Found = 1 END IF @Hours &gt;= 8760 AND @Found = 0 BEGIN SET @Hours = @Hours / 8760 SET @Suff = ' Years Ago' SET @Found = 1 END IF @Hours &gt;= 720 AND @Found = 0 BEGIN SET @Hours = @Hours / 720 SET @Suff = ' Months Ago' SET @Found = 1 END IF @Hours &gt;= 168 AND @Found = 0 BEGIN SET @Hours = @Hours / 168 SET @Suff = ' Weeks Ago' SET @Found = 1 END IF @Hours &gt;= 24 AND @Found = 0 BEGIN SET @Hours = @Hours / 24 SET @Suff = ' Days Ago' SET @Found = 1 END RETURN Convert(nvarchar, @Hours) + @Suff END </code></pre>
<p>As you say, I probably wouldn't do it in SQL, but as a thought exercise have a MySQL implementation:</p> <pre><code>CASE WHEN compare_date between date_sub(now(), INTERVAL 60 minute) and now() THEN concat(minute(TIMEDIFF(now(), compare_date)), ' minutes ago') WHEN datediff(now(), compare_date) = 1 THEN 'Yesterday' WHEN compare_date between date_sub(now(), INTERVAL 24 hour) and now() THEN concat(hour(TIMEDIFF(NOW(), compare_date)), ' hours ago') ELSE concat(datediff(now(), compare_date),' days ago') END </code></pre> <p>Based on a similar sample seen on the <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#c9500" rel="noreferrer">MySQL Date and Time</a> manual pages</p>
<p>The posts above gave me some good ideas so here is another function for anyone using SQL Server 2012.</p> <pre><code> CREATE FUNCTION [dbo].[FN_TIME_ELAPSED] ( @TIMESTAMP DATETIME ) RETURNS VARCHAR(50) AS BEGIN RETURN ( SELECT TIME_ELAPSED = CASE WHEN @TIMESTAMP IS NULL THEN NULL WHEN MINUTES_AGO &lt; 60 THEN CONCAT(MINUTES_AGO, ' minutes ago') WHEN HOURS_AGO &lt; 24 THEN CONCAT(HOURS_AGO, ' hours ago') WHEN DAYS_AGO &lt; 365 THEN CONCAT(DAYS_AGO, ' days ago') ELSE CONCAT(YEARS_AGO, ' years ago') END FROM ( SELECT MINUTES_AGO = DATEDIFF(MINUTE, @TIMESTAMP, GETDATE()) ) TIMESPAN_MIN CROSS APPLY ( SELECT HOURS_AGO = DATEDIFF(HOUR, @TIMESTAMP, GETDATE()) ) TIMESPAN_HOUR CROSS APPLY ( SELECT DAYS_AGO = DATEDIFF(DAY, @TIMESTAMP, GETDATE()) ) TIMESPAN_DAY CROSS APPLY ( SELECT YEARS_AGO = DATEDIFF(YEAR, @TIMESTAMP, GETDATE()) ) TIMESPAN_YEAR ) END GO </code></pre> <p>And the implementation:</p> <pre><code> SELECT TIME_ELAPSED = DBO.FN_TIME_ELAPSED(AUDIT_TIMESTAMP) FROM SOME_AUDIT_TABLE </code></pre>
7,283
<p>By &quot;better&quot; I mean &quot;more precise&quot;...</p> <p>With respect to a RepRap P3Steel or Wilson II, I am getting some 330 mm T8 leadscrews for the Z-axis movement.</p> <p>There seems to be a choice between a <em>lead</em> of 1, 2 or 8 mm - the <em>pitch</em> is 1 mm in the first case and 2 mm in the last two cases<sup>1</sup>. However, there is precious little information about the advantages and disadvantages of each lead size in <a href="http://reprap.org/wiki/Threaded_rod#Leadscrew" rel="noreferrer">RepRapWiki - Threaded Rod - Leadscrew</a>.</p> <p>It seems to me that using a leadscrew with a 1 or 2 mm lead could result in a more precise Z-axis movement, as one rotation of the stepper results in a smaller increment in height. Therefore the layer thicknesses could be smaller.</p> <p>However, is the minimum layer thickness not, also, dictated by the thickness of the filament, horizontal speed of the print head, nozzle size, etc.? Thus, at some point there would be no need for a super fine vertical resolution from the leadscrew, as it may be constrained by other limiting factors.</p> <p>Of course, conversely, the use of a 2 mm lead would mean that the stepper would need to &quot;work&quot; four times as hard, than when using 8 mm, in order to raise the print head the same distance, as well as making the movement, during a &quot;home&quot;, take four times as long (or, if you will, four times slower). In the case of a 1 mm lead that would become eight times...</p> <hr /> <h3>TL;DR</h3> <p>Is it worth getting a leadscrew with a 2 mm lead, or is 8 mm sufficient?</p> <p>By extension, would a 1 mm lead be even better, or just overkill?</p> <hr /> <h3>Footnote</h3> <p><sup>1</sup> Nomenclature:</p> <ul> <li><strong>Pitch</strong> is the distance between the adjacent threads;</li> <li><strong>Lead</strong> is the distance that a nut will turn with one rotation, and;</li> <li><strong>Start</strong> is how many starting (or thread entry) points at either end.</li> </ul> <p>So, for a leadscrew, with a <em>pitch</em> of 2 mm, if there is only one <em>start</em> to the screw then the lead is the same as the pitch. However, if there are four <em>starts</em> to the screw, then the lead will be 8 mm. If there are two <em>starts</em> to the screw, then the lead will be 4 mm. And so on.</p> <p>For more information, see <a href="https://en.wikipedia.org/wiki/Screw_thread#Lead.2C_pitch.2C_and_starts" rel="noreferrer">Wikipedia - Lead, pitch and starts</a>.</p>
<p>Based on what I've learned over 8 months of printing:</p> <p>What matters the most is getting a very accurate zero relative to the bed surface. An offset of 30 or 40 microns can strongly affect first-layer adhesion. Now, unless you put in some of the advanced auto-levelling sensors, the repeatability of the Z-axis limit switch may outweigh the precision of the lead screw itself. But if you've got a good limit sensor, then the more precision in the lead screw, the better you can set (and repeat) the position of the first layer. </p> <p>I don't see a significant difference in strain on the drive motors if they have to run longer per mm of z-drive - just make sure the lead screws are clean :-)</p>
<p><strong>Longer lead</strong></p> <p>Pros:</p> <ol> <li>Faster movement (mostly benefits homing)</li> <li>More standard</li> <li>Weak motor friendly</li> <li>Might be slightly more stable (sideways) than shorter leads because of more starts creating more contact with nut (?)</li> </ol> <p>Cons</p> <ol> <li>Backlash</li> <li>Less resolution (unless using 0.9 degree motor but see note<sup>1</sup>) although this is ignorable since it's still very high. It's already around 5x higher than xy axes using the longest leads<sup>2</sup>.</li> </ol> <p><strong>Shorter leads</strong></p> <p>Pros</p> <ol> <li>More accuracy if you turn off microstepping. it can give you more resolution, but it's useless resolution unless you print with &lt; 0.01&nbsp;mm layer heights<sup>3</sup>. Turning off microstepping trades away this useless resolution for increased accuracy. But this comes at the cost of (much) louder drivers.</li> <li>Less backlash</li> </ol> <p>Cons</p> <ol> <li>Stronger motors maybe needed</li> <li>Slower homing</li> </ol> <p>The reason why companies prefer longer leads is because shorter leads simply add useless resolution and slows down movement.</p> <p><strong>Footnotes</strong></p> <p><sup>1</sup> It makes more sense to use higher degree motors to drive shorter leads than vice versa because of higher torque.</p> <p><sup>2</sup> 0.0025&nbsp;mm vs 0.0125&nbsp;mm</p> <p><sup>3</sup> or using a probe to autolevel, which causes the z axis to go up and down in very small increments </p>
594
<p><strong>Situation:</strong></p> <p>I have a simple <em>XML</em> document that contains image information. I need to transform it into <em>HTML</em>. However, I can't see where the open tag is and when I use the <em>XSL</em> code below, it shows the following error message: </p> <blockquote> <p>"Cannot write an attribute node when no element start tag is open."</p> </blockquote> <p><strong>XML content:</strong></p> <pre><code>&lt;root&gt; &lt;HeaderText&gt; &lt;HeaderText&gt;Dan Testing&lt;/HeaderText&gt; &lt;/HeaderText&gt; &lt;Image&gt; &lt;img width="100" height="100" alt="FPO lady" src="/uploadedImages/temp_photo_small.jpg"/&gt; &lt;/Image&gt; &lt;BodyText&gt; &lt;p&gt;This is a test of the body text&lt;br /&gt;&lt;/p&gt; &lt;/BodyText&gt; &lt;ShowLinkArrow&gt;false&lt;/ShowLinkArrow&gt; &lt;/root&gt; </code></pre> <p><strong>XSL code:</strong></p> <pre><code>&lt;xsl:stylesheet version="1.0" extension-element-prefixes="msxsl" exclude-result-prefixes="msxsl js dl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:js="urn:custom-javascript" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:dl="urn:datalist"&gt; &lt;xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/&gt; &lt;xsl:template match="/" xml:space="preserve"&gt; &lt;img&gt; &lt;xsl:attribute name="width"&gt; 100 &lt;/xsl:attribute&gt; &lt;xsl:attribute name="height"&gt; 100 &lt;/xsl:attribute&gt; &lt;xsl:attribute name="class"&gt; CalloutRightPhoto &lt;/xsl:attribute&gt; &lt;xsl:attribute name="src"&gt; &lt;xsl:copy-of select="/root/Image/node()"/&gt; &lt;/xsl:attribute&gt; &lt;/img&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>
<p>Just to clarify the problem here - the error is in the following bit of code:</p> <pre><code>&lt;xsl:attribute name="src"&gt; &lt;xsl:copy-of select="/root/Image/node()"/&gt; &lt;/xsl:attribute&gt; </code></pre> <p>The instruction xsl:copy-of takes a node or node-set and makes a copy of it - outputting a node or node-set. However an attribute cannot contain a node, only a textual value, so xsl:value-of would be a possible solution (as this returns the textual value of a node or nodeset).</p> <p>A MUCH shorter solution (and perhaps more elegant) would be the following:</p> <pre><code>&lt;img width="100" height="100" src="{/root/Image/node()}" class="CalloutRightPhoto"/&gt; </code></pre> <p>The use of the {} in the attribute is called an Attribute Value Template, and can contain any XPATH expression.</p> <p>Note, the same XPath can be used here as you have used in the xsl_copy-of as it knows to take the textual value when used in a Attribute Value Template.</p>
<p>The other option to try is a straightforward </p> <pre><code>&lt;img width="100" height="100" src="/root/Image/image.jpeg" class="CalloutRightPhoto"/&gt; </code></pre> <p>i.e. without {} but instead giving the direct image path</p>
6,792
<p>The last time I took on a non-trivial .Net/C# application I used Castle Monorail and, on the whole, enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC. </p> <p>How did you find the switch?<br> What are the biggest differences, presently?</p>
<p>While I haven't made the switch yet, I have developed on both platforms and have been doing some pre-switch analysis. </p> <p>It looks like the biggest difference would be the View Engines. Our Monorail stuff uses the Brail view engine while asp.net mvc comes (stock) with a webforms like view engine. There are other view engines in MvcContrib which could help in this area, though.</p> <p>Also ViewComponents and view "helpers" seem to be handled quite differently the two frameworks.</p>
<p>The ASP.NET MVC team is still making changes before v1.0, so now's a good time to <a href="http://forums.asp.net/1146.aspx" rel="nofollow noreferrer">provide feedback</a>.</p> <p>Also, be aware that there are more frequent releases on <a href="http://www.codeplex.com/aspnet" rel="nofollow noreferrer">CodePlex</a>, while the home page on www.asp.net still links to Preview 3.</p>
4,389
<p>Our team is creating a new recruitment workflow system to replace an old one. I have been tasked with migrating the old data into the new schema. I have decided to do this by creating a small Windows Forms project as the schema are radically different and straight TSQL scripts are not an adequate solution.</p> <p>The main sealed class 'ImportController' that does the work declares the following delegate event:</p> <pre><code>public delegate void ImportProgressEventHandler(object sender, ImportProgressEventArgs e); public static event ImportProgressEventHandler importProgressEvent; </code></pre> <p>The main window starts a static method in that class using a new thread:</p> <pre><code>Thread dataProcessingThread = new Thread(new ParameterizedThreadStart(ImportController.ImportData)); dataProcessingThread.Name = "Data Importer: Data Processing Thread"; dataProcessingThread.Start(settings); </code></pre> <p>the ImportProgressEvent args carries a string message, a max int value for the progress bar and an current progress int value. The Windows form subcribes to the event:</p> <pre><code>ImportController.importProgressEvent += new ImportController.ImportProgressEventHandler(ImportController_importProgressEvent); </code></pre> <p>And responds to the event in this manner using it's own delegate:</p> <pre><code> private delegate void TaskCompletedUIDelegate(string completedTask, int currentProgress, int progressMax); private void ImportController_importProgressEvent(object sender, ImportProgressEventArgs e) { this.Invoke(new TaskCompletedUIDelegate(this.DisplayCompletedTask), e.CompletedTask, e.CurrentProgress, e.ProgressMax); } </code></pre> <p>Finally the progress bar and listbox are updated:</p> <pre><code>private void DisplayCompletedTask(string completedTask, int currentProgress, int progressMax) { string[] items = completedTask.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in items) { this.lstTasks.Items.Add(item); } if (currentProgress &gt;= 0 &amp;&amp; progressMax &gt; 0 &amp;&amp; currentProgress &lt;= progressMax) { this.ImportProgressBar.Maximum = progressMax; this.ImportProgressBar.Value = currentProgress; } } </code></pre> <p>The thing is the ListBox seems to update very quickly, but the progress bar never moves until the batch is almost complete anyway ??? what gives ?</p>
<p>Maybe you can try the BackgroundWorker component. It makes threading easier. Examples here:</p> <ul> <li><a href="http://www.codeproject.com/KB/cpp/BackgroundWorker_Threads.aspx" rel="nofollow noreferrer">BackgroundWorker Threads and Supporting Cancel</a></li> <li><a href="http://www.c-sharpcorner.com/UploadFile/LivMic/BGWorker07032007000515AM/BGWorker.aspx" rel="nofollow noreferrer">Using the BackgroundWorker Component in .NET 2 applications</a></li> <li><a href="http://www.danielmoth.com/Blog/2004/12/backgroundworker-sample.html" rel="nofollow noreferrer">BackgroundWorker Sample</a></li> </ul>
<p>Are you sure that the UI thread is running freely during all this process? i.e. it's not sitting blocked-up on a Join or some other wait? That's what it looks like to me.</p> <p>The suggestion of using BackgroundWorker is a good one - definitely superior to trying to sledge-hammer your way out of the problem with a load of Refresh/Update calls.</p> <p>And BackgroundWorker will use a pool thread, which is a friendlier way to behave than creating your own short-lived thread.</p>
3,318
<p>I know that we can get the MAC address of a user via IE (ActiveX objects).</p> <p>Is there a way to obtain a user's MAC address using JavaScript?</p>
<p>I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of:</p> <ul> <li>Using Java (with a signed applet)</li> <li>Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS (but it is fairly complicated to set up)</li> </ul>
<p>No you can't obtain a user's MAC address using JavaScript in another way, just by using active X op for Microsoft in IE browser</p>
2,551
<p>I am serializing a <code>JPEG</code> Image in <code>c#.net</code>. I am simply converting it into a byte steam and sending it through web service. </p> <p>I observed that serialized byte stream is 30 times more than that of the size of actual image. Can any one <strong>suggest me a better approach</strong> to serialize and stay relative to the size of the actual image? </p>
<p>JPEG is a compression technology, and it is expected that it will expand greatly once you read it in. This is the nature of the file format. Try to find a way to send the original JPEG file without reading it as an image first.</p>
<p>Why not convert it to a Base64String?</p> <pre><code>byte[] arr = File.ReadAllBytes(filename); string str = Convert.ToBase64String(arr); </code></pre> <p>On the other end you can change it back to a byte[] by going:</p> <pre><code>byte[] arr = Convert.FromBase64String(string); </code></pre>
9,498
<p>We are currently developing a server whereby a client requests interest in changes to specific data elements and when that data changes the server pushes the data back to the client. There has vigorous debate at work about whether or not it would be better for the client to poll for this data. </p> <p>What is considered to be the ideal method, in terms of performance, scalability and network load, of data transfer in a near real time environment? </p> <p><strong>Update:</strong> Here's a <a href="http://ayende.com/Blog/archive/2009/02/16/pull-vs.-push-models-for-ui-updates.aspx" rel="nofollow noreferrer">Link</a> that gives some food for thought with regards to UI updates.</p>
<p>There's probably no ideal method for every situation, but push is usually better and used more often. It allows to optimize server caching and data transfers, which helps performance and scalability, and cuts network traffic a bit by avoiding client requests and empty responses. It can be important advantage for a server to operate in it's own pace and supply clients with data when it is ready.</p> <p>Industry standarts - such as OPC, GID - support both. Server pushes updates to subscribed clients, but client can pull some rarely used data out without bothering with subscription.</p>
<p>What do you have on the client's side? Many firewalls allow outgoing requests but block incoming requests. In other words, pull may be your only option if you are crossing the Internet unless you are sending out e-mails.</p>
8,321
<p>According to Wikipedia, Tetrahydrofuran dissolves PLA. It also apparently dissolves PET.</p> <blockquote> <p>THF is considered a relatively nontoxic solvent, with the median lethal dose (LD<sub>50</sub>) comparable to that for acetone.</p> </blockquote> <p>Wikipedia further states that it's not particularly dangerous provided you keep it away from air circulation, so that it does not form peroxides.</p> <blockquote> <p>One danger posed by THF follows from its tendency to form highly explosive peroxides on storage in air.</p> </blockquote> <p>So well, this seems acceptable compared to other possible solvents which are all ridiculously dangerous. The question at hand is now of practical nature:</p> <ul> <li>Is Tetrahudrofuran actually viable replacement for acetone, which only works with ABS?</li> </ul> <p>I am asking because the fact that it does dissolve PLA does not really at all mean that it will work well. It could damage PLA structure, be more toxic than wikipedia says or not dry well.</p>
<p>According to Shuichi Sato, Daiki Gondo, Takayuki Wada, Shinji Kanehashi &amp; Kazukiyo Nagai: <em>Effects of various liquid organic solvents on solvent‐induced crystallization of amorphous poly(lactic acid) film</em> in <em>Journal of Applied Polymer Science</em>, Volume 129 Issue 3 (2013), p1607-1617<sup><a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/app.38833" rel="nofollow noreferrer">source</a></sup>, Tetrahydrofuran is classified as a solvent for PLA. The specific entry on page 1608:</p> <pre><code>Group Solvent Solvent type dd dp dh dt Result Ether Tetrahydrofuran Polar aprotic 16.8 5.7 8 19.4 soluble </code></pre> <p>The values dd dp dh and dt are explained on page 1607:</p> <blockquote> <p>The effects of 60 liquid organic solvents on PLA are systematically investigated using the Hansen solubility parameter (HSP). The HSP is one of the digitizing methods for analyzing the interaction between polymer materials and organic solvents. In HSP analysis, all solvents have three parameters: energy from dispersion bonds between molecules (dd), dipolar intermolecular force between molecules (dp), and the hydrogen bonds between molecules (dh). All solvents were characterized by a point in a three-dimensional structure at which dd, dp, and dh are plotted on three mutually perpendicular axes. Generally, if the HSP values of the various organic solvents are near that of the given polymer, the solvent is considered compatible with the polymer material.</p> </blockquote> <p>The factor dt is the total Hansen solubility parameter - the bigger this is, the better it is a solvent.</p> <p>19.4 is a rather good solvent but <strong>extremely explosive</strong>: in air 20000 ppm (2%) are explosive and thus the allowable concentration in an area is 2000 ppm<sup><a href="https://www.cdc.gov/niosh/idlh/109999.html" rel="nofollow noreferrer">source</a></sup></p> <h1>Alternatives</h1> <p>A similar potent solvent would be Benzene (dt = 18.6) which more easily available and less explosive, but more deadly (10000-20000 ppm fumes) and has an allowable concentration of 500 ppm<sup><a href="https://www.cdc.gov/niosh/idlh/71432.html" rel="nofollow noreferrer">source</a></sup></p> <p>Ethyl-acetate is also a solvent (dt = 18.2) and more available. It is explosive at an equal concentration as Tetrahydrofuran<sup><a href="https://www.cdc.gov/niosh/idlh/141786.html" rel="nofollow noreferrer">source</a></sup>, but it has just about half of its vapor pressure (73 mmHg<sup><a href="https://www.cdc.gov/niosh/npg/npgd0260.html" rel="nofollow noreferrer">source</a></sup> vs. 132 mmHg<sup><a href="https://www.cdc.gov/niosh/npg/npgd0602.html" rel="nofollow noreferrer">source</a></sup>), so can be stored more safely, and is less aggressive on the body. It is sometimes used to Smooth PLA via vapor chamber<sup><a href="https://en.wikipedia.org/wiki/Polylactic_acid#Organic_Solvents_for_PLA" rel="nofollow noreferrer">source</a></sup>, and only comes at a price tag of ca. 90 €/l for the pure stuff and also is used in some nail polish removers, put into a safe mix.</p> <p>Acetone is classified as a <em>better</em> solvent (dt = 20.1), and it is known to act as a glue and to soften PLA with some exposure time, but from experience, it can't smooth it. It is available most easy (nail polish remover and in the home depot), and is the least deadly option.</p> <p>Propylene-1,2-carbonate is classed as solvent and a far better at it with dt = 27.2. It has been used as an alternative to Ethyl-Acetate<sup><a href="https://en.wikipedia.org/wiki/Polylactic_acid#Organic_Solvents_for_PLA" rel="nofollow noreferrer">source</a></sup> and its MSDS is rather gentle<sup><a href="https://www.nwmissouri.edu/naturalsciences/sds/p/Propylene%20carbonate.pdf" rel="nofollow noreferrer">source</a></sup>. It comes at a price tag of 130 €/l for the chemical-grade liquid.</p> <h1>Conclusion</h1> <p>Tetrahydrofuran is not a viable replacement due to its explosive properties. It is not an improvement above Benzene, which at least can be stored safely.</p> <p>Using Acetone as a benchmark, Tetrahydrofuran should not smooth the surface in a vapor chamber, as it is a worse solvent than Acetone. It should also take <strong>longer</strong> to soften and dissolve objects than Acetone, but a heated bath or coating the surface with it could help to generate the needed exposure times.</p> <p>However, its comparable ethyl-acetate has been claimed to be used as a cleaning, vapor smoothing, and brush on surface smoothing agent successfully and can be used better by helping the solubility via heating, which can be done much safer with ethyl-acetate than THF. In a proper chemical mix, its storage problem can be solved too.</p> <p>A better alternative is propylene-1,2-carbonate, which is a better solvent, and much less dangerous.</p> <p><strong>tl;dr</strong>: No, Tetrahydrofuran is not able to dissolve PLA in a reasonable time<sup>1</sup> without heat activation and it has worse characteristics than Acetone. It could arguably be used to weld parts, but Dichloromethane would be more effective.</p> <hr /> <p><sup>1 - Sato, Gondo et al. in the aforementioned paper: <em>Solubility tests were performed for 24 h at 35+-1 °C.</em> which means we have a prolonged exposure of a thin film to a huge amount of solvent. how thin a film? <strong>Very</strong> thin: <em>The PLA films were prepared by casting 2 wt % dichloromethane solution onto a flat-bottomed glass Petri dish in a glass bell-type vessel and by drying under atmospheric pressure at room temperature. Each solvent was allowed to evaporate for 48 h. The dried PLA films were then thermally treated under a vacuum for 48 h at 70 °C to eliminate the residual solvent and to obtain amorphous PLA films. Afterwards, the thermally treated PLA films were cooled at room temperature under atmospheric pressure.</em></sup></p>
<p>From what I have read, THF is not super effective, it seems that Dichloromethane or DCM is actually a better solvent. Unfortunately I have no personal experience with either. </p> <p>It is rather nasty though, as the LD<sub>50</sub> is just 0.5 to 5 g/kg<sup><a href="https://www.researchgate.net/post/Solubility_of_PLA" rel="nofollow noreferrer">[1]</a><a href="https://groups.google.com/forum/#!topic/ultimaker/8s1bq_9LsRM" rel="nofollow noreferrer">[2]</a></sup>.</p>
519
<p>I'm downloading some images from a service that doesn't always include a content-type and doesn't provide an extension for the file I'm downloading (ugh, don't ask).</p> <p>What's the best way to determine the image format in .NET?</p> <p>The application that is reading these downloaded images needs to have a proper file extension or all hell breaks loose.</p>
<p>A probably easier approach would be to use Image.FromFile() and then use the RawFormat property, as it already knows about the magic bits in the headers for the most common formats, like this:</p> <pre><code>Image i = Image.FromFile("c:\\foo"); if (System.Drawing.Imaging.ImageFormat.Jpeg.Equals(i.RawFormat)) MessageBox.Show("JPEG"); else if (System.Drawing.Imaging.ImageFormat.Gif.Equals(i.RawFormat)) MessageBox.Show("GIF"); //Same for the rest of the formats </code></pre>
<p>Try loading the stream into a System.IO.BinaryReader. </p> <p>Then you will need to refer to the specifications for each image format you need, and load the header byte by byte to compare against the specifications. For example here are the <a href="http://www.libpng.org/pub/png/pngdocs.html" rel="nofollow noreferrer">PNG specifications</a></p> <p>Added: The actual <a href="http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html" rel="nofollow noreferrer">file structure</a> for PNG.</p>
7,972
<p>Given an Oracle table created using the following:</p> <pre><code>CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE); </code></pre> <p>Using the Python ODBC module from its <a href="http://www.python.org/download/windows/" rel="nofollow noreferrer">Win32 extensions</a> (from the win32all package), I tried the following:</p> <pre><code>import dbi, odbc connection = odbc.odbc("Driver=Oracle in OraHome92;Dbq=SERVER;Uid=USER;Pwd=PASSWD") cursor = connection.cursor() cursor.execute("SELECT WhenAdded FROM Log") results = cursor.fetchall() </code></pre> <p>When I run this, I get the following:</p> <pre><code>Traceback (most recent call last): ... results = cursor.fetchall() dbi.operation-error: [Oracle][ODBC][Ora]ORA-00932: inconsistent datatypes: expected %s got %s in FETCH </code></pre> <p>The other data types I've tried (VARCHAR2, BLOB) do not cause this problem. Is there a way of retrieving timestamps?</p>
<p>I believe this is a bug in the Oracle ODBC driver. Basically, the Oracle ODBC driver does not support the <code>TIMESTAMP WITH (LOCAL) TIME ZONE</code> data types, only the <code>TIMESTAMP</code> data type. As you have discovered, one workaround is in fact to use the <code>TO_CHAR</code> method.</p> <p>In your example you are not actually reading the time zone information. If you have control of the table you could convert it to a straight <code>TIMESTAMP</code> column. If you don't have control over the table, another solution may be to create a view that converts from <code>TIMESTAMP WITH TIME ZONE</code> to <code>TIMESTAMP</code> via a string - sorry, I don't know if there is a way to convert directly from <code>TIMESTAMP WITH TIME ZONE</code> to <code>TIMESTAMP</code>.</p>
<p>My solution to this, that I hope can be bettered, is to use Oracle to explicitly convert the TIMESTAMP into a string:</p> <pre><code>cursor.execute("SELECT TO_CHAR(WhenAdded, 'YYYY-MM-DD HH:MI:SSAM') FROM Log") </code></pre> <p>This works, but isn't portable. I'd like to use the same Python script against a SQL Server database, so an Oracle-specific solution (such as TO_CHAR) won't work.</p>
5,935
<p>I'm using RichFaces per a client requirement, but the markup it (and the stock JSF controls) generates is an awful mess of nested tables. Are there any control libraries out there that generate nicer markup? AJAX support is a huge plus!</p>
<p>There is ICEFaces which provides more semantic support than RichFaces .Also you can try Nitobi suite which also provides similar kinda solution.If you are not satisfied with any of these I suggest try to write your own part extending the Sun faces</p>
<p>Short answer: No I have not yet found one. Your options include using less complicated controls and know what html the standard controls emit. Thing like h:panelGrid render as a table. There is nothing stopping you writing your own rendering family which produces more standards compliment html, but this would be a big time investment. As for using RichFaces if you stick more to the a4j: namespace of tags you will still be getting the cross browser ajax with out all the mark up you don't like.</p>
8,896
<p>I am a C++/C# developer and never spent time working on web pages. I would like to put text (randomly and diagonally perhaps) in large letters across the background of some pages. I want to be able to read the foreground text and also be able to read the "watermark". I understand that is probably more of a function of color selection. </p> <p>I have been unsuccessful in my attempts to do what I want. I would imagine this to be very simple for someone with the web design tools or html knowledge. </p>
<pre><code>&lt;style type="text/css"&gt; #watermark { color: #d0d0d0; font-size: 200pt; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); position: absolute; width: 100%; height: 100%; margin: 0; z-index: -1; left:-100px; top:-200px; } &lt;/style&gt; </code></pre> <p>This lets you use just text as the watermark - good for dev/test versions of a web page.</p> <pre><code>&lt;div id="watermark"&gt; &lt;p&gt;This is the test version.&lt;/p&gt; &lt;/div&gt; </code></pre>
<p>You could make an image with the watermark and then set the image as the background via css.</p> <p>For example:</p> <pre><code>&lt;style type="text/css"&gt; .watermark{background:url(urltoimage.png);} &lt;/style&gt; &lt;div class="watermark"&gt; &lt;p&gt;this is some text with the watermark as the background.&lt;/p&gt; &lt;/div&gt; </code></pre> <p>That should work.</p>
9,407
<p>I am starting a new company using 3D printers and doing an advertisement, and I want to use the word FabLab to describe the kinds of field that my company is in.</p> <p>Can I be sued by using the word FabLab in an advertisement? Is it a trademark? I mean, I can find <a href="https://www.ebay.fr/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=fablab&amp;_sacat=0" rel="nofollow noreferrer">this</a> and <a href="https://www.ebay.com/sch/i.html?_from=R40&amp;_trksid=m570.l1313&amp;_nkw=fablab&amp;_sacat=0" rel="nofollow noreferrer">this</a>.</p> <p>From the links it looks like they all trademarked the same non-dictionary word:</p> <p><a href="https://trademarks.ipo.gov.uk/ipo-tmtext/page/Results" rel="nofollow noreferrer">https://trademarks.ipo.gov.uk/ipo-tmtext/page/Results</a></p>
<p>I did a simple search at <a href="http://www.huski.ai" rel="nofollow noreferrer">www.huski.ai</a>, and found 11 trademarks with the mark word &quot;FabLab&quot;.</p> <p><a href="https://i.stack.imgur.com/PXPXU.png" rel="nofollow noreferrer" title="Screenshot of search"><img src="https://i.stack.imgur.com/PXPXU.png" alt="Screenshot of search" title="Screenshot of search" /></a></p> <p>As you can see, most of them are abandoned, but there are 3 alive ones by a company called JO-ANN STORES, INC. Their categories are something like &quot;paper goods&quot;, &quot;fabrics&quot;, or &quot;furnitures&quot;, etc. So I think there's still room for you to register it under electronics.</p>
<p>Sorry, I needed to learn to use the site. This site shows Fablab as a word mark, the same way it shows Apple: <a href="https://www.trademarkengine.com/free-trademark-search/trademark-search" rel="nofollow noreferrer">https://www.trademarkengine.com/free-trademark-search/trademark-search</a></p>
1,867
<p>Developing an electronic product for which I'll need an enclosure. It's about 50x30x20mm and should survive higher temperatures (50-60 degrees). Because of the low volume (under 500 required per year), I'd like to go for an enclosure option that doesn't require a huge upfront cost. So ended up at 3d printing. As the product will retail for around 500$, the surface finish needs to be up to a higher quality than the standard pla prints that I've seen. From my own research (3d printing noob), the best material for this would be ABS. Maybe with some manual polishing at the end. Then I'd either buy a 3d printer and do it myself or find a company to do it.</p> <p>What am I missing? :)</p> <p>Anything I'm missing? Thanks a lot.</p>
<p>ABS should be able to handle the the temperatures you describe. ABS will have a similar finish to PLA when it first comes off the printer, but you can refine and smooth your results via an acetone vapor treatment. This only takes a few minutes per piece, and can cost as little as a $1 bottle of fingernail polish remover, a used coffee can, a bit of wire, and some paper towels.</p> <p>What you're missing is the hobby-level 3D printers ($1000 and below) can be <em>extremely</em> finicky. You're not gonna get the kind of quality you need the first print out of the gate. Or the second. Probably not the third or fourth, either. And then you'll find every now and then something isn't quite right any more, and you'll need to troubleshoot why.</p> <p>You certainly can make this work... just be prepared for what you're getting into.</p>
<p>ABS would be ok for these temperatures. But 3d-printing, cleaning up the print and smoothing the surface to get a marketable device takes time and effort. So I guess that for a few hundred enclosures you'd be far better/cheaper off having them manufactured (in China?) than trying to print them yourself. Unless the design changes often of course.</p>
1,389
<p>I am at my wits end with this problem. I start a print and the skirt goes down fine, then the outline of the parts go down fine (usually) and then when it goes to fill in the first layer, it will always get stuck to the hotend at some point and rip apart the layer. </p> <p>Any ideas on how to solve this?</p> <ul> <li>Printing PLA at 210°C;</li> <li>First layer temp is 225°C;</li> <li>Bed temp at 60°C;</li> <li>1.75&nbsp;mm filament, and;</li> <li>0.4&nbsp;mm nozzle. </li> </ul> <p>Maker Select V2.1, using Cura to slice.</p>
<p><strong>Step Zero:</strong> is always to check/adjust the bed level - if the height over the bed varies while putting down the first layer, it's hard to ever get first layer settings that work.</p> <p><strong>Step One:</strong> is to adjust your first layer settings - height, temperature, extrusion width until you find a set that work for your setup (knowing that they may change somewhat when you change filament.) Some folks find more success with thin first layers, others with a thicker first layer to pump more plastic, still others use the same layer height but increase the width to pump more plastic, and others combine these approaches. Increasing the temperature is common, though in my case I found that the "usual" +5°C was not enough for the present setup.</p> <p>You can change one setting at a time and have an idea of what works better or worse in each case, or you can change lots of settings and hope you get lucky. I prefer the tedious approach, it's less maddening.</p> <p>Are you using any surface treatment on the bed? A bit of gluestick or hairspray may help you stick.</p>
<p>Try lowering your first layer temp to 205°C, and apply a gluestick to the bed before you print anything. By lowering the temp, this allows th plastic to cool faster, and doesn't risk the plastic sticking to the nozzle as much. Applying the glue stick will help the print to stick to the buildplate better, lowering the risk of it getting stuck to the nozzle. You might also want to try using a raft, as this will provide more surface area for the print to stick to the bed with, and lower the chances of it attaching to the nozzle.</p>
626
<p>According to the <a href="http://uk3.php.net/features.safe-mode" rel="nofollow noreferrer">PHP Safe Mode Docs</a> on safe_mode_gid:</p> <blockquote> <p>By default, Safe Mode does a UID compare check when opening files. If you want to relax this to a GID compare, then turn on safe_mode_gid. Whether to use UID (FALSE) or GID (TRUE) checking upon file access.</p> </blockquote> <p>To a PHP script running on a web server, what is the difference between a UID (User Identifier) check and a GID (Group identifier) check?</p>
<p>This will just allow you a little more flexibility in your web server setup. Using safe_mode_gid, you should be able to run individual PHP/httpd processes for each user on your system, but give each process the ability to read some shared files as long as they are all run as the same group (GID) and the shared files are owned by this group.</p>
<p>Safe mode UID check is used to prevent users from accessing other peoples files. GID is used to prevent a GROUP of users from accessing other GROUPS files.</p>
2,940
<p>I'm getting notifications to back up my encryption key for EFS in Vista, however i haven't enabled bit locker or drive encryption.</p> <p>Anyone know how to find out what files may be encrypted or have an explanation for why it would notify me?</p>
<p>To find out which files on your system have been encrypted with EFS, you can simply run this command:</p> <pre><code>CIPHER.EXE /U /N </code></pre>
<p>Clippy noticed that you have sensitive information in your files and automatically encrypted them.</p> <p>Are you sure it's for EFS? I've had things prompt me to backup my keys before, but I didn't know exactly what they were to. I was assuming it was like a DRM protected file or something. It was a while ago so i don't remember exactly what the specific details were. I never backed it up and haven't been locked out of anything.</p>
3,279
<p>I have a variable of type <code>Dynamic</code> and I know for sure one of its fields, lets call it <code>a</code>, actually is an array. But when I'm writing </p> <pre><code>var d : Dynamic = getDynamic(); for (t in d.a) { } </code></pre> <p>I get a compilation error on line two:</p> <blockquote> <p>You can't iterate on a Dynamic value, please specify Iterator or Iterable</p> </blockquote> <p>How can I make this compilable?</p>
<p>Haxe can't iterate over <code>Dynamic</code> variables (as the compiler says).</p> <p>You can make it work in several ways, where this one is probably easiest (depending on your situation):</p> <pre><code>var d : {a:Array&lt;Dynamic&gt;} = getDynamic(); for (t in d.a) { ... } </code></pre> <p>You could also change <code>Dynamic</code> to the type of the contents of the array.</p>
<p>Another way to do the same is to use an extra temp variable and explicit typing:</p> <pre><code>var d = getDynamic(); var a: Array&lt;Dynamic&gt; = d.a; for (t in a) { ... } </code></pre>
7,497
<p>I'm capturing data from a tablet using Java (JPen library rocks) and would like to be able to paint a penstroke in a more natural way.</p> <p>Currently I'm drawing the pen stroke as straight line segments each with a different Stroke thickness. </p> <p>There has to be something in Java's Graphics Library that lets me to this more efficiently.</p> <p>Right?</p>
<p>I've never done this, but here are a couple things you could try. First, you could implement a custom <a href="http://java.sun.com/javase/6/docs/api/java/awt/Stroke.html" rel="nofollow noreferrer">Stroke</a> that creates skinny trapezoids. The width of the end caps would be a function of the pressure at the end points. If that works, you could try to make the line segments look more natural by using <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve" rel="nofollow noreferrer">Bezier curves</a> to form "curvy trapezoids". You might be able to use <a href="http://java.sun.com/javase/6/docs/api/java/awt/geom/QuadCurve2D.html" rel="nofollow noreferrer">QuadCurve2D</a> to help.</p>
<p>PostScript RIPs often convert circles to curves and curves to a series of straight line segments. The number of segments depends on the flatness setting which defaults to one suitable for the raster display resolution.</p> <p>A thick line or thick line segments can be converted to a skinny filled polygon.</p>
6,407
<p>The .NET <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" rel="noreferrer">IDisposable Pattern</a> <em>implies</em> that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situations where a finalizer is warranted.</p> <p>However, what happens if I just do this:</p> <pre><code>class Foo : IDisposable { public void Dispose(){ CloseSomeHandle(); } } </code></pre> <p>and don't implement a finalizer, or anything. Will the framework call the Dispose method for me?</p> <p>Yes I realise this sounds dumb, and all logic implies that it won't, but I've always had 2 things at the back of my head which have made me unsure.</p> <ol> <li><p>Someone a few years ago once told me that it would in fact do this, and that person had a very solid track record of "knowing their stuff."</p></li> <li><p>The compiler/framework does other 'magic' things depending on what interfaces you implement (eg: foreach, extension methods, serialization based on attributes, etc), so it makes sense that this might be 'magic' too. </p></li> </ol> <p>While I've read a lot of stuff about it, and there's been lots of things implied, I've never been able to find a <strong>definitive</strong> Yes or No answer to this question.</p>
<p>The .Net Garbage Collector calls the Object.Finalize method of an object on garbage collection. By <strong>default</strong> this does <strong>nothing</strong> and must be overidden if you want to free additional resources.</p> <p>Dispose is NOT automatically called and must be <strong>explicity</strong> called if resources are to be released, such as within a 'using' or 'try finally' block</p> <p>see <a href="http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx</a> for more information</p>
<p>The documentation on <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" rel="nofollow noreferrer">IDisposable</a> gives a pretty clear and detailed explaination of the behavior, as well as example code. The GC will NOT call the <code>Dispose()</code> method on the interface, but it will call the finalizer for your object.</p>
6,683
<p>I have just assembled the Creality3D Ender-4 kit a couple of days ago. I completed some rewiring and everything seems to be wired correctly, I'm able to auto-home successfully, but this is the problem I'm having:</p> <p>I tried printing a <a href="https://makerware.thingiverse.com/thing:1278865" rel="nofollow noreferrer">calibration cube</a>. The first problem I noticed is that the printing is starting on one corner instead of the center as specified on the Printer Settings in CURA (check settings below).</p> <p>Second problem is that I'm getting significant distortion. The movement of the printer seems to be fine, no jerks of weird sounds. I tried all I know but I honestly don't know how to proceed with this. I have a couple of hours of experience in 3D Printing so I'm completely lost.</p> <p>This is the result I got (Model printed with Raft for adhesion):</p> <p><a href="https://i.stack.imgur.com/qXkCz.png" rel="nofollow noreferrer" title="Model printed with Raft for adhesion"><img src="https://i.stack.imgur.com/qXkCz.png" alt="Model printed with Raft for adhesion" title="Model printed with Raft for adhesion"></a></p> <p>These are my CURA settings:</p> <p><strong>Printer</strong></p> <p><a href="https://i.stack.imgur.com/CaqvA.png" rel="nofollow noreferrer" title="CURA settings - Printer"><img src="https://i.stack.imgur.com/CaqvA.png" alt="CURA settings - Printer" title="CURA settings - Printer"></a></p> <p><strong>Extruder</strong></p> <p><a href="https://i.stack.imgur.com/SfRst.png" rel="nofollow noreferrer" title="CURA settings - Extruder"><img src="https://i.stack.imgur.com/SfRst.png" alt="CURA settings - Extruder" title="CURA settings - Extruder"></a></p>
<p>The <strong>first problem</strong> is solved by removing the tick mark at <code>Origin at center</code>. Most printers have their origin at a corner (not Delta's, their origin is in the top center).</p> <p>The <strong>second problem</strong> is a little more difficult to solve. Please note that a kit should be loaded with preset values that should be fair enough to print, your picture does not appear to print the calibration cube correctly, so you should try to <strong>eliminate each possibility one at a time</strong>. As said, your picture is not very clear, but it does not appear to be a cube, it looks more rectangular (also note that a raft is only interesting when printing difficult, read prone to warping, filaments like ABS). </p> <p>What you could do is print simple squares (no raft, but use a brim or skirt), e.g. 50 x 50 mm (only 1 or 2 walls in width and a few layers high), and measure the printed size. </p> <ul> <li><p>If these squares do not stick to the heated bed, calibrate the Z height to nozzle distance and re-level the bed or increase the heated bed temperature;</p></li> <li><p>If the X and Y sizes are different, you should calibrate the steps per mm for the direction that differs (<a href="https://reprap.org/wiki/G-code#M92:_Set_axis_steps_per_unit" rel="nofollow noreferrer">M92</a> is the G-code to set the steps per mm; <a href="https://reprap.org/wiki/G-code#M500:_Store_parameters_in_non-volatile_storage" rel="nofollow noreferrer">M500</a> to store the value to memory; these codes can be given over USB using specific programs that interface through a command line interface e.g. Pronterface, Repetier-Host or OctoPrintor alternatively in a <code>.gcode</code> file and loaded through the printer user interface);</p></li> <li><p>If extrusion does look weird, measure the filament width at various sections of the filament with a vernier caliper and calibrate the extruder stepper and set the correct amount of steps per mm;</p></li> <li><p>Finally, print the 20 x 20 x 20 mm cube and measure the height and adjust the steps per mm for the Z direction.</p></li> </ul>
<p>Fix was actually pretty simple.</p> <p>I just removed the printer that I had setup on CURA following the manual provided by Creality (found on the provided SD Card) and started from scratch.</p> <p>The one that worked was actually setting up the printer as a <a href="https://www.inky.mx/MPRESORA-CREALITY-CR-10-,728_1513022174?gclid=EAIaIQobChMI6p6pnq_v2wIVQh1pCh3FyQntEAQYBCABEgJ1hPD_BwE" rel="nofollow noreferrer">Creality CR-10</a> and then just changing the XYZ dimensions. This setup has the <em>Origin at Center</em> option unchecked as suggested in the comments. That's all it took...</p> <p><a href="https://i.stack.imgur.com/nt1io.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nt1io.png" alt="enter image description here"></a> </p> <p><strong>New results:</strong> <a href="https://i.stack.imgur.com/G8SIH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G8SIH.jpg" alt="enter image description here"></a></p>
938
<p>Joe Van Dyk <a href="http://www.zenspider.com/pipermail/ruby/2008-August/004223.html" rel="noreferrer">asked the Ruby mailing list</a>:</p> <blockquote> <p>Hi,</p> <p>In Ruby, I guess you can't marshal a lambda/proc object, right? Is that possible in lisp or other languages?</p> <p>What I was trying to do:</p> </blockquote> <pre><code>l = lamda { ... } Bj.submit "/path/to/ruby/program", :stdin =&gt; Marshal.dump(l) </code></pre> <blockquote> <p>So, I'm sending BackgroundJob a lambda object, which contains the context/code for what to do. But, guess that wasn't possible. I ended up marshaling a normal ruby object that contained instructions for what to do after the program ran.</p> <p>Joe</p> </blockquote>
<p>You cannot marshal a Lambda or Proc. This is because both of them are considered closures, which means they close around the memory on which they were defined and can reference it. (In order to marshal them you'd have to Marshal all of the memory they could access at the time they were created.)</p> <p>As Gaius pointed out though, you can use <a href="https://github.com/seattlerb/ruby2ruby" rel="nofollow noreferrer">ruby2ruby</a> to get a hold of the string of the program. That is, you can marshal the string that represents the ruby code and then reevaluate it later. </p>
<p>If proc is defined into a file, U can get the file location of proc then serialize it, then after deserialize use the location to get back to the proc again</p> <blockquote> <p>proc_location_array = proc.source_location</p> </blockquote> <p>after deserialize:</p> <blockquote> <p>file_name = proc_location_array[0]</p> <p>line_number = proc_location_array[1]</p> <p>proc_line_code = IO.readlines(file_name)[line_number - 1]</p> <p>proc_hash_string = proc_line_code[proc_line_code.index("{")..proc_line_code.length]</p> <p>proc = eval("lambda #{proc_hash_string}")</p> </blockquote>
4,377
<p>Back when I was at school, I remember tinkering with a Mac game where you programmed little robots in a sort of pseudo-assembler language which could then battle each other. They could move themselves around the arena, look for opponents in different directions, and fire some sort of weapon. Pretty basic stuff, but I remember it quite fondly, even if I can't remember the name.</p> <p>Are there any good modern day equivalents?</p>
<p>I used to have a lot of fun coding my own robot with <a href="http://robocode.sourceforge.net/" rel="noreferrer">Robocode</a> in college.</p> <p>It is Java based, the API is detailled and it's pretty easy to get a challenging robot up and running.</p> <p>Here is an example : </p> <pre><code> public class MyFirstRobot extends Robot { public void run() { while (true) { ahead(100); turnGunRight(360); back(100); turnGunRight(360); } } public void onScannedRobot(ScannedRobotEvent e) { fire(1); } } </code></pre>
<p>There is a Spanish Java Page who organice a football leage in wich the users program the skills of their team and the strategy. You only need to download the framework and implement a little interface, then you can simulate matchs which are seen in the screen. When you are happy with your team and strategy you submit the code to the page and enters in the tournament.</p> <p>Tutorials, videos and downloads:</p> <p><a href="http://javacup.javahispano.org" rel="nofollow noreferrer">Java Cup</a></p>
4,552
<p>I'm having a Prusa i3 derivative printer with a capacitive sensor for the z-axis. It switches a tiny bit before the nozzle hits the print bed and hence needs a z-offset to be configured.</p> <p>In Slic3r I have configured the z-offset to <code>-0.1</code> on the <em>General</em> page of the <em>Printer Settings</em>, but currently I'm evaluating Cura and can't find such a setting. Slic3r seems to apply this setting directly to the generated z-values in the g-code, so it does not use a short version at the beginning of the g-code. My current (except of the auto-bed-leveling part default) g-code:</p> <pre><code>G28 ;Home G29 ; auto-bed-leveling G1 Z15.0 F6000 ;Move the platform down 15mm G92 E0 G1 F200 E3 G92 E0 </code></pre> <p>Is there a way to configure Cura, e.g. using the <em>Start Gcode</em> options, to apply the z-offset?</p>
<p>You can trick the printer into applying an offset using the <code>G92</code> command:</p> <pre><code>G0 Z0 G92 Z0.1 </code></pre> <p>First, we move the nozzle to <code>Z=0</code>. Next, through the <code>G92</code> command, we tell the printer to, from now on, treat the current position as <code>Z=0.1</code>. This effectively applies an offset of <code>-0.1</code> to the Z-axis, since if we now executed <code>G0 Z0</code> again, the nozzle would move down <code>0.1mm</code>.</p> <p>Note that this needs to be done after homing and leveling to be effective.</p> <p>Of course, you don't necessarily need to move the nozzle to <code>Z=0</code> for this to work. You could also just insert <code>G92 Z15.1</code> after <code>G0 Z15</code> to get the same effect.</p>
<p>I built my printer five years ago with a similar issue and I strongly suggest that the physical 0 will be the actual 0 instead of tweeking it into the system. Especially if you are exploring and testing new methods, i.e. Cura vs Slic3r settings. In Marlin, you can insert a z adjustment for the endstops but it can create future complications if you decide to upgrade the machine.</p> <p>Keep it as simple as possible, if a sensor is misplaced don't try to reverse calculate it, the pressure of the motors will nudge it and after a while you'll have the same problem...</p>
701
<p>I needed to know if typical UV curing resins, such as the ones from Anycubic, can withstand solar radiation over extended periods of time with little to no degradation. It has been quite difficult to find information about the subject online, so I'm wondering whether anyone here has experience here to share.</p>
<p>What seems to be a difficulty is the stabilizers for plastic absorb UV. So if added to UV resin, they probably greatly increase the exposure time needed.</p> <p>The following show characteristics of some plastics, taken from <a href="https://www.coleparmer.com/tech-article/uv-properties-of-plastics" rel="nofollow noreferrer">https://www.coleparmer.com/tech-article/uv-properties-of-plastics</a></p> <blockquote> <p>Unmodified types of plastics that are regarded as having unacceptable resistance to UV are POM (Acetal), PC, ABS and PA6/6. Other plastics such as PET, PP, HDPE, PA12, PA11, PA6, PES, PPO, PBT and PPO are regarded as fair. Note that a PC/ABS alloy is also graded as fair. Good resistance to ultraviolet rays can be achieved from polymers extruded by Zeus such as PTFE, PVDF, FEP, and PEEKTM. The only plastics found with excellent resistance are the imides, Polyimide (PI) as used in the Hubble Space Telescope and Polyetherimide (PEI).</p> </blockquote> <blockquote> <p>PTFE has particularly good UV resistance because of its very strong carbon- fluorine (C-F) bond [almost 30% higher than the carbon-hydrogen (C-H) bond], which is the common side bond that surrounds the carbon (C-C) backbone in a helix and protects it. Most fluoropolymers also do not have the light absorbing chromophore impurities in their structure that can act as an initiator for photo-oxidation.</p> </blockquote>
<p>Sunlight contains the full spectrum of electromagnetic radiation, including the wavelength to photoinitiate your resin. Most UV-curable materials are kept in opaque containers for this reason. The extent to which your material is crosslinked will depend on your material and how much sunlight it receives.</p>
1,879
<p>I have a .NET 2.0 Windows Forms application. Where is the best place the store user settings (considering Windows guidelines)?</p> <p>Some people pointed to <code>Application.LocalUserAppDataPath</code>. However, that creates a folder structure like:</p> <blockquote> <p>C:\Documents and Settings\user_name\Local Settings\Application Data\company_name\product_name\product_version\</p> </blockquote> <p>If I release version 1 of my application and store an XML file there, then release version 2, that would change to a different folder, right? I'd prefer to have a single folder, per user, to store settings, regardless of the application version. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>I love using the built-in <a href="http://msdn.microsoft.com/en-us/library/a65txexh.aspx" rel="noreferrer">Application Settings</a>. Then you have built in support for using the settings designer if you want at design-time, or at runtime to use: </p> <pre><code>// read setting string setting1 = (string)Settings.Default["MySetting1"]; // save setting Settings.Default["MySetting2"] = "My Setting Value"; // you can force a save with Properties.Settings.Default.Save(); </code></pre> <p>It does store the settings in a similar folder structure as you describe (with the version in the path). However, with a simple call to: </p> <pre><code>Properties.Settings.Default.Upgrade(); </code></pre> <p>The app will pull all previous versions settings in to save in. </p>
<p>Settings are standard key-value pairs (string-string). I could wrap them in an XML file, if that helps.</p> <p>I'd rather use the file system instead of the registry. It seems to be easier to maintain. In support scenarios, if the user needs to manually open/change the settings, that would be easier if it's in the file system. </p>
4,594
<p>When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder will insert new string instances into the intern pool? </p> <p><a href="http://community.bartdesmet.net/blogs/bart/archive/2006/09/27/4472.aspx" rel="nofollow noreferrer">http://community.bartdesmet.net/blogs/bart/archive/2006/09/27/4472.aspx</a></p> <p>Can anyone explain how concatenation works with the intern pool?</p>
<p>If you create new strings, they will not automatically be put into the intern pool, unless you concatenate constants compile-time, in which case the compiler will create one string result and intern that as part of the JIT process.</p>
<p>You can see whether a string has been interned by calling <code>String.IsInterned</code>. The call will return a new string that is either a reference to an interned string equal to the string that was passed as an argument, or <code>null</code> if the string was not interned.</p>
5,889
<p>I love the way Mac OS <em>beautifully</em> renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows?</p> <p>Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?</p>
<p>Check out <strong>GDI++/FreeType</strong> (<a href="http://free.flop.jp/gdi++/" rel="noreferrer">link</a>, <a href="http://offset.skew.org/wiki/User:Mjb/GDI%2B%2B" rel="noreferrer">link</a>). It's a highly configurable font-rendering replacement for Windows. With some configuration of hinting, anti-aliasing, etc, you should be able to approximate OSX style font rendering fairly close.</p>
<p>You could wait until IE9, which apparently has much better text rendering, using DirectX: <a href="http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx</a></p>
8,275
<p>If I need to 3D print a hollow box that can not have any light permeating into the box, what would be the best course of action? Should I 3D print the hollow box as a whole or print out the 6 sides individually and put them together at the end? And if I do the second option, what would be the best way to put the pieces together (design/connect grooves or use glue)?</p> <p>I am very new to 3D printing so any feedback would be very much appreciated!</p>
<p>That depends very much on what your goal is with the box. If it needs to be hollow and you don't need any access to the inside (and also prefer it to be printed in one piece) than the answer provided by user77232 would probably be the best.</p> <p>Alternatively, if you need access to the inside of the box you would probably be best off printing the box in two pieces. A box and a lid. This way you can print the box without support and also save on material that would otherwise be used as infill.</p> <p>The amount of light coming into your box also depends on the translucency of your material and brightness of the light source. To find the required wall thickness would be a matter of testing with the desired material.</p>
<ol> <li>Print it as a whole object</li> <li>Use 20% infill.</li> <li>Profit!</li> </ol>
1,738
<p>If I use <code>assert()</code> and the assertion fails then <code>assert()</code> will call <code>abort()</code>, ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle them gracefully?</p>
<p>Yes, as a matter of fact there is. You will need to write a custom assert function yourself, as C++'s <code>assert()</code> is exactly C's <code>assert()</code>, with the <code>abort()</code> "feature" bundled in. Fortunately, this is surprisingly straightforward.</p> <p><em>Assert.hh</em></p> <pre><code>template &lt;typename X, typename A&gt; inline void Assert(A assertion) { if( !assertion ) throw X(); } </code></pre> <p>The above function will throw an exception if a predicate doesn't hold. You will then have the chance to catch the exception. If you don't catch the exception, <code>terminate()</code> will be called, which will end the program similarly to <code>abort()</code>.</p> <p>You may wonder what about optimizing away the assertion when we're building for production. In this case, you can define constants that will signify that you're building for production and then refer to the constant when you <code>Assert()</code>.</p> <p><em>debug.hh</em></p> <pre><code>#ifdef NDEBUG const bool CHECK_WRONG = false; #else const bool CHECK_WRONG = true; #endif </code></pre> <p><em>main.cc</em></p> <pre><code>#include&lt;iostream&gt; struct Wrong { }; int main() { try { Assert&lt;Wrong&gt;(!CHECK_WRONG || 2 + 2 == 5); std::cout &lt;&lt; "I can go to sleep now.\n"; } catch( Wrong e ) { std::cerr &lt;&lt; "Someone is wrong on the internet!\n"; } return 0; } </code></pre> <p>If <code>CHECK_WRONG</code> is a constant then the call to <code>Assert()</code> will be compiled away in production, even if the assertion is not a constant expression. There is a slight disadvantage in that by referring to <code>CHECK_WRONG</code> we type a little more. But in exchange we gain an advantage in that we can classify various groups of assertions and enable and disable each of them as we see fit. So, for example we could define a group of assertions that we want enabled even in production code, and then define a group of assertions that we only want to see in development builds.</p> <p>The <code>Assert()</code> function is equivalent to typing</p> <pre><code>if( !assertion ) throw X(); </code></pre> <p>but it clearly indicates the intent of the programmer: make an assertion. Assertions are also easier to grep for with this approach, just like plain <code>assert()</code>s.</p> <p>For more details on this technique see Bjarne Stroustrup's The C++ Programming Language 3e, section 24.3.7.2.</p>
<pre><code>_set_error_mode(_OUT_TO_MSGBOX); </code></pre> <p>believe me, this function can help you.</p>
5,816
<p>What are the 'headline' basic design rules for FDM? </p> <p>Which topics for design principles do you recommend to someone who has purchased an FDM machine and wants to understand what is practical? In other words, where is the place to start when you don't yet know what questions to ask?</p> <p><a href="https://3dprinting.stackexchange.com/questions/5215/3d-printing-references-for-beginner">This question</a> and its answer discuss design tools and the workflow but doesn't cover design rules.</p> <p>Design rules here meaning the principles of what is <strong>special</strong> about <strong>planning</strong> a design to be manufactured with an FDM process as opposed to traditional machining or a printing process like SLA, not the detailed/automated checks that would be applied to something like a PCB layout prior to sign-off.</p>
<p>Designing a part for 3D printing often doesn't seem to have many special considerations, but I have learned the hard way, that there are some things to do differently. This is just a list of things to that one should keep in mind <em><strong>in addition to basic principles of design</strong></em><sup>1</sup> when designing parts, keeping the subsequently slicing the parts in mind too:</p> <h1>Print orientation</h1> <p>There are many ways how you could orient your print, but usually, there is one orientation, that has the least need for support. Look at your part critically and keep this orientation in mind when designing. Especially look at overhangs and bridging, and if you can get away without.</p> <h1>Overhangs</h1> <p>There are 3 sorts of overhangs:</p> <ol> <li>Small overhangs ones that are neglectable.</li> <li>Long overhangs which can get support.</li> <li>Overhangs that can't be supported.</li> </ol> <p>When designing parts, you want to make sure you only have type 1 and 2 Overhangs, as type 3 overhangs will sag and fail. Think carefully if you can rotate the piece to get a print orientation that does not need an overhang that can't be supported by an automatically generated support structure. If that is impossible, try to implement a sacrificial piece that can turn the overhang into a bridge.</p> <p>Smaller overhangs can be made neglectable by adding a phase to the underside. This phase's angle is depending on the printer. In my experience, 70° is something many printers can manage, but I prefer 45° due to the ease of making them. A fuller <em>can</em> work to give a small overhang the needed support, but often has problems for larger overhangs!</p> <h1>Bridges</h1> <p>Overhangs turn into bridges if they are connected on both sides. These either have a limited length, depending on the printer you use or need a support in the center. Check if you really <em>need</em> a bridge or if you can rotate the piece to get away without.</p> <h2>Avoid vertical holes in bridges</h2> <p>It might be something that might surprise but a vertical hole or slot in a bridging part is something that often fails as the bridging strings just sag as they are terminated mid-air without a support structure and finally fall, ruining the bridge. Yet such a support structure sometimes could not be removed in all cases, so something needs to be done differently.</p> <p>One such a solution is to add a 1-layer sacrificial layer on the bottom of the hole: printing a solid layer by bridging is possible, and the subsequent hole/slot can still be free. It has to be cut free after printing in post-processing though.</p> <h2>round holes in Walls</h2> <p>Round holes in standing walls can become problematic to print once the diameter gets too large. A trick to keep the upper parts of the hole to sag into the cavity, making it undersized or needing to drill it to size later. To prevent this, the upper side of the hole can be adjusted: instead of a round upper rim, turn the hole into a teardrop. This reduces the overhanging area. Keeping a 60° top angle on the hole should be fine.</p> <p>If the hole is used to key an item to an axle, put the keyway to the top of the print orientation, so it takes the place of the teardrop-tip.</p> <p>Some more about holes one can learn from <a href="https://youtu.be/j6508J94VsA" rel="nofollow noreferrer">Makers Muse (Angus Daveson)</a></p> <h1>Reduce internal structure</h1> <p>I have seen prints fail for strange reasons. One of them was a piece taken from a straight up industrial design plan, then scaled down. This one resulted in <em>too much</em> tiny internal geometry, resulting in a lot of material and time wasted on printing these internal pieces that nobody could reach, that were fused together for the original gaps were already 0.2mm and less and besides that, there was the occasional print failure.</p> <p>Removing any non-essential internal geometry lessens not only the printer's load, but speeds up the print, lessens the material waste and can prevent failures due to clogs or other unexpected behavior. If you can't fix it in design, <a href="https://3dprinting.stackexchange.com/questions/6230/easy-way-to-refine-a-3d-model-for-3d-printing-by-removing-internal-geometry">there are workarounds</a>, but try to need to avoid them!</p> <h2>Avoid Intersecting Shells</h2> <p>As we are at it, often game and graphic designers are lazy and use intersecting shells. These can become quite messy in the slicing step. If possible, try to avoid intersecting shells, even as modern slicers have learned to fix this by themselves by now. The results of that are not always pretty if you forget to flag the &quot;Union intersecting shells&quot; option in your slicer.</p> <h1>Sizing</h1> <p>We might not always be aware of it, but prints do <em>shrink</em> in the XY axis and to a different degree in the Z axis as they cool, during and after the print is done. This is what causes warping in the first place and lead to many lost prints (especially on non-heated beds). This behavior has to be taken into consideration especially when designing bores. My suggestion for this is twofold:</p> <ul> <li>Intentionally design the hole to be too small and add extra wall material in slicing, then drill it up to the right diameter. Drill slowly to not melt the plastic.</li> <li>Learn your shrinking parameter for the material and design with that shrinkage in mind, possibly iterating the print a few times. Note that different spools/colors of the same material might have different shrinking!</li> </ul> <h2>Minimum Wall Thickness</h2> <p>Without Arachne, a 3D-printer can not reliably print walls that are thinner than the extrusion width of a printer. The choice of the correct nozzle for an extrusion width is <a href="https://3dprinting.stackexchange.com/questions/7425/help-to-reconcile-nozzle-diameter-deposited-line-width-and-wall-thickness-in-c">a question upon itself.</a>. Even with Arachne slicing and variable line width, printing a wall thinner than a nozzle diameter is nigh impossible.</p> <h2>Tapping/Screwing/Inserts</h2> <p>For tapping prints directly, you need wall thickness - according to the norms - you'll need usually about 0.2mm diameter that can be tapped into for smaller standard-size threads. Using 3 perimeters with a 0.45 mm extrusion width will give walls of 1.2 mm, which I consider a rather strong wall, and provides quite some tolerance to drill up to size and then tapping screws into. You will get away with 2 perimeters for smaller thread sizes (M3 and lower), but for large ones (M10+), you will want a fourth or even fifth perimeter.</p> <p>Remember though, that the <em>printed PLA is not good for very strong threading</em>: <strong>Tapping print</strong>s directly is pretty much only for <strong>low- and non-load-bearing connections</strong>. If you combine several pieces with screws, try to design the parts to make some sort of compression fit using a bolt and nut, or use several, small diameter screws with a fine thread. Avoid coarse thread if you can, stay on the small side.</p> <p>If you need a <strong>load bearing connection</strong> with screws, the best strength comes from using a <strong>metal insert</strong> or provide a <strong>space for a nut to fit into</strong>. Metal inserts are usually placed by heat-setting them: put the heat-set insert onto a soldering iron tip and push it into the slightly under-sized hole, melting and molding the print to fit the insert, providing strong threads that are held really good in the shell of remolded plastic.</p> <p>As a compromise, modern slicers allow to use modifier meshes, that could be used to increase the strength of modeled threads or holes that need to be tapped.</p> <p>Do you want to know more? <a href="https://www.youtube.com/watch?v=iR6OBlSzp7I" rel="nofollow noreferrer">CNC Kitchen (Stefan)</a> had made some tests on the strength of these connection type.</p> <h1>Print strength</h1> <p>Keep these general rules in mind when designing load-bearing parts:</p> <p>Generally speaking, FDM prints are strongest in carrying along their <strong>Z-axis</strong> when withstanding <strong>compressive forces</strong>, as then the print layers of the shell are forced against each other. It also excels at fighting <strong>bending</strong> forces this way. But this orientation is also giving us the <strong>lowest tensile strength</strong>, as each layer boundary is a possible breaking point.</p> <p>The <strong>XY-plane</strong> usually <strong>excels in tensile strength</strong> but sacrifices some of its ability to withstand compression (it is <em>not</em> proportional though).</p> <p>Printing a part at a <strong>45° angle</strong> will give often a <strong>great compromise of strengths</strong>, but might need an additional surface to get a good first layer - this surface can be sacrificial with the use of support.</p> <p>For deeper information on the strength of parts and materials in comparison and how to manipulate it, there are large playlists of tests made by <a href="https://www.youtube.com/playlist?list=PLEOQTmIWJ_rncRcWmjQIvMKFAeM071CXM" rel="nofollow noreferrer">CNC Kitchen (Stefan)</a> and <a href="https://www.youtube.com/playlist?list=PLDJMid0lOOYl8TZJV9xHznKFq5yA5ZTi2" rel="nofollow noreferrer">Thomas Sanladerer (Tom)</a></p> <h1>Post processing</h1> <p>Post processing can be your best friend when printing, just as it can be your worst nightmare. I won't detail all methods of postprocessing, but some that are quite applicable.</p> <h2>Assembly/Gluing</h2> <p>Remember to design your parts with gaps for the glue when designing parts for assembly, and you might want to include guidance notches/cones or other <strong>alignment features</strong> to make sure the assembly aligns. This is especially needed as the parts shrink a little and have a rough surface.</p> <p>If you need to assemble your part due to the available print volume, be especially sure to include ways to key the parts together. Pegs or outcroppings/indents (often called <em>keys</em>) that match up to one another make alignment on assembly much easier too, and are a different type of alignment feature. It can be a good idea to design yourself a &quot;cookie cutter&quot; file that is applied after designing the part that automatically includes the glue gaps and keys.</p> <p>There are a lot of glues and other methods to merge the parts. A more in-depth look at some of them is <a href="https://3dprinting.stackexchange.com/questions/6723/what-glues-for-pla/6725#6725">What glues for bonding printed PLA to injection-molded plastic?</a> but you will have to keep in mind how you want to combine your pieces in the design step - and account for it.</p> <h2>Print in Place/PIP</h2> <p>In this vein, learn the <strong>tolerances your printer</strong> can manage to allow print-in-place(PIP), allowing functional parts that require no assembly. PIP is something that isn't possible with subtractive manufacturing usually, but remember that in 3D printing you might need to <em>break</em> the parts free after printing from bridges or sagging. Usually, a single strong turn suffices. To be able to do this, you might want to include a position for an Allen-key to manually turn the parts.</p> <p>To learn how fine your tolerances are, there are many <strong>tolerance gauges/tests</strong> around. A <em>rule of thumb</em> for many printers is, that 1 nozzle width is often easily achievable with a good setup, 0.5 nozzles are achievable with some effort and 0.25 is somewhere close to the 'holy grail' - you might want to change the nozzle to a smaller one in case you want to have very thin gaps.</p> <h2>Composite construction</h2> <p>There are ways to turn your (mostly) hollow prints into much stiffer versions of themselves by turning them into composites, for example by using a resin or a different hardening fluid (like foam or plaster) as a filler or coating material.</p> <p>When planning to do so, remember to include inlets/outlets for it and the air. It can be a good idea to design the part in such a way that it just contains the walls and a pre-planned support structure. In doing so, remember to disable infill in the slicer to enforce the flow you want in your structure. Look at how the ribs inside of an airframe are designed for general rules on hollow parts: include holes. This allows the flow of your fluid into each and every corner instead of blocking the flow. This can also reduce the needed number of inlets and outlets from one per <em>chamber</em> to one per <em>part</em>.</p> <h2>Plastic Properties</h2> <p>Remember we work with thermoplastics. Learn what kind of postprocessing your thermoplastic allows and its mechanical properties. Some examples:</p> <ul> <li>APS can be vapor smoothed with acetone.</li> <li>Many plastics can be annealed by baking at or little above their glass transition temperature, increasing strength and layer-to-layer bonding.</li> <li>When using power tools on plastic, use ample cooling and time, as otherwise, one quickly melts the prints!</li> </ul> <h2>Surface Finish</h2> <p>The surface of FDM prints is somewhat rough. To smooth it out there are 2 general ways: fill it up or smooth it down. If you want to fill it up, design the part <em>undersized</em>, if you smooth it down, add <em>sacrificial thickness</em>. It is common to combine both, adding body filler first, then sanding down till the print material shows through again. If doing this, make sure to check your sizing.</p> <p>If there comes a lacquer layer atop, remember to account for that thickness: undersize surfaces, oversize holes!</p> <hr /> <p><sup>1 - this means, that thoughts about postprocessing that are not unique to 3D printing are not elaborated on here. Examples are painting, coating or smoothing the surface mechanically.</sup></p> <hr /> <h1>Further reading/viewing</h1> <p>Further information can be gotten from these playlists, though they aim at times for newbies:</p> <ul> <li>CNC Kitchen (Stefan): <a href="https://www.youtube.com/playlist?list=PLEOQTmIWJ_rmoqdFUCgKrNu_BsMVB7e1V" rel="nofollow noreferrer">3D Printing for Engineers Playlist</a></li> <li>CNC Kitchen (Stefan): <a href="https://www.youtube.com/playlist?list=PLEOQTmIWJ_rmPCnfJVOpkdIAhrOk6QppZ" rel="nofollow noreferrer">3D Printing Tips</a></li> <li>Maker's Muse (Angus): <a href="https://www.youtube.com/playlist?list=PLTCCNNvHC8PDR_jQy609toqq8EAfhiOOL" rel="nofollow noreferrer">3D Printint 101</a></li> <li>Maker's Muse (Angus): <a href="https://www.youtube.com/playlist?list=PLTCCNNvHC8PCFgwvZZBBI6qVW9W8KfJ_7" rel="nofollow noreferrer">Advanced 3D Printing Tips</a></li> <li>Maker's Muse (Angus): <a href="https://www.youtube.com/playlist?list=PLTCCNNvHC8PC40tcEqaJcgUMb97LNkLIn" rel="nofollow noreferrer">CAD for Newbies</a></li> <li>Maker's Muse (Angus): <a href="https://www.youtube.com/playlist?list=PLTCCNNvHC8PAcpgeMC1IIa0xEzrHO_9r0" rel="nofollow noreferrer">CAD for 3D Printing</a></li> </ul>
<p>In a <a href="https://drive.google.com/file/d/1p62P1ZvTwCKK0TGZL7FKhxg-lZQLMe3Q/view?usp=sharing" rel="nofollow noreferrer">presentation</a>(pdf) that I've used as an introduction to 3D printing, I listed out the following points:</p> <ul> <li>Structures have to be built-up from the build platform, with only about 45° overhang (or small <strong>flat</strong> bridges). <ul> <li>supports can be added (generally automatically), but results can be variable.</li> <li>changing the print orientation can solve overhand problems.</li> </ul></li> <li>Infill is used partly to provide additional strength, and partly to support any roof parts. Generally a print will not be solid.</li> <li>Small parts in particular may need a brim to help with bed adhesion.</li> <li>Designs must be 'manifold' to be printable. Arguably this is part of the workflow, but it can be the cause of non-obvious failures.</li> </ul> <p>The other detail worth calling out is the precision of what can be printed with FDM, although the best case resolution is ~0.1mm, the overall accuracy will be closer to the nozzle diameter due to the way that extruded filament is squashed during the print.</p>
1,012
<p>Here is the deal. </p> <p>$ gem --version</p> <blockquote> <p>1.1.0</p> </blockquote> <p>$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</p> <blockquote> <p>Bulk updating Gem source index for: <a href="http://gems.rubyforge.org/" rel="nofollow noreferrer">http://gems.rubyforge.org/</a> ERROR: could not find mysql locally or in a repository</p> </blockquote> <p>$ sudo gem update</p> <blockquote> <p>Updating installed gems Bulk updating Gem source index for: <a href="http://gems.rubyforge.org/" rel="nofollow noreferrer">http://gems.rubyforge.org/</a> </p> <p>Updating RedCloth ERROR: While executing gem ... (Gem::GemNotFoundException) could not find RedCloth locally or in a repository</p> </blockquote> <p>I've tried <a href="http://www.gregbenedict.com/2008/02/21/mysql-ruby-gem-install-issues-solved/" rel="nofollow noreferrer">this</a>, <a href="http://dev.mysql.com/downloads/ruby.html" rel="nofollow noreferrer">this</a>, <a href="http://installingcats.com/2007/12/13/mysql-ruby-gem-install-problem-on-mac-os-x-leopard/" rel="nofollow noreferrer">this</a>, <a href="http://www.docuverse.com/blog/donpark/2007/06/14/os-x-mysql-ruby-gem-install-problem" rel="nofollow noreferrer">this</a>, and a ton of others. </p> <p>None of them have worked for me. Is anyone else having this problem? If so what did you do to fix it that is not mentioned above? </p>
<p>First of all as Orion Edwards said make sure you have rubygems 1.2. Unfortunately, </p> <blockquote> <p>gem update --system</p> </blockquote> <p>did not work for me. </p> <p>Instead I had to:</p> <ol> <li>Manually download <a href="http://rubyforge.org/frs/download.php/38844/rubygems-update-1.2.0.gem" rel="nofollow noreferrer">rubygems-update-1.2.0</a> from rubyforge.</li> <li>$ sudo gem install /path/to/rubygems-update-1.2.0.gem</li> <li>$ update_rubygems</li> </ol> <p>Now that I had rubygems 1.2 I ran</p> <blockquote> <p>$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</p> </blockquote> <p>Everything is working. Thanks Orion Edwards for steering me in the right direction. </p>
<p>Do you have different ruby versions on your system? If you're running the Darwin-supplied ruby binary, but installed ruby gems under /usr/local, then you'll get errors like this. Even if you've aliased ruby to point to /usr/local, the gem command may fail if the proper ruby binary is not resolved correctly by your shell's $PATH. Also, if /usr/local/bin is located physically after /usr/bin in your path, gem will use /usr/bin/ruby to load the gems from /Library/Ruby/Gems/1.8/gems/. You may want to symlink /usr/lib/ruby/gems/1.8/gems to /Library/Ruby/Gems/1.8/gems/ to prevent this sort of thing. </p>
6,240
<p>I am searching for 3D printing filaments, that are suitable for outdoor purposes, but printable on unheated beds.</p> <p>I will mostly use it for sensor node enclosures (should withstand temperature up to 50°C/120°F) and car accessories (70°C/160°F).</p> <p>If it requires annealing, it should have low shrinkage, since I will be printing parts that will fit into each other.</p>
<p>This is not an easy one to solve, the firmware of the printer should be keeping the printer at a certain temperature depending on the temperature setting and the current value. If the firmware is not able to keep the temperature at the requested level, but goes beyond that level, that could be considered "strange". As it measures the temperature (and reports it on your display) it must know that it is over the limit and thus should not power the hotend.</p> <p>In this process there are a few possible candidates for you to look at:</p> <ul> <li>Check for a faulty <a href="https://en.wikipedia.org/wiki/MOSFET" rel="nofollow noreferrer">MOSFET</a> (sort of an electronic switch) on your controller board (is it leaking current to the hotend?). </li> <li>Check and or update the current settings for the <a href="https://en.wikipedia.org/wiki/PID_controller" rel="nofollow noreferrer">PID</a> values (settings for the control loop of the hotend). The PID values control the overshoot of the temperature. E.g. is this is very large overshoot? When incorrectly configured the temperature can get higher, but normally should never increase to infinity, are you sure it keeps rising? The determination of the new values is called <a href="https://reprap.org/wiki/PID_Tuning" rel="nofollow noreferrer">PID tuning</a>. Important commands (that need to be send over a USB connected printer with a 3D printer terminal application like Repetier Host, OctoPrint or Pronterface): <ul> <li>The <a href="https://reprap.org/wiki/G-code#M503:_Print_settings" rel="nofollow noreferrer">M503</a> <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> command shows the current settings (somewhere in the heap of all settings).</li> <li>The <a href="https://reprap.org/wiki/G-code#M303:_Run_PID_tuning" rel="nofollow noreferrer">M303</a> <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> command can determine the values.</li> </ul></li> <li>Reflash the firmware</li> <li>Replace the printer controller board</li> </ul> <p>You could replace the thermistor and the heater cartridge (just to be sure, most definitely not the problem, but they are really cheap to replace). The thermistor works as it reports the temperature, and the heater element doesn't get powered by itself. </p> <p>As suggested below <strong>the most likely candidate for your problem is the MOSFET</strong>. These are pretty easy to replace (depending on your board) or replaceable by an external MOSFET module (if you happen to have one lying around).</p>
<p>A similar condition occurred in my 3D printer. I solved the same. I checked all my connection and I came to know that I connected the thermistor of the extruder in the wrong port. So just check the connection of your thermistor.</p> <hr> <p>Actually my 3D printer circuit board frequently failed because of over current. I then added a multimeter in series with my power supply and the load, also a voltmeter across the voltage regulator. I then corrected every motor driver DRV8825 to a reference voltage of 0.6&nbsp;V so that the maximum current supplied to each of the motor will be less than 1&nbsp;A. All these made my circuit checked ok. Then I uploaded the G-code, but I couldn't print because my extruder gets heated about 280 °C and got reset and suddenly shut down the extruder supply. This continues to happen.</p> <p>Then I reinstalled the Marlin firmware and I also changed the port of my thermistor. Now my 3D printer is ok and prints nicely. I also faced another problem while I gave the print command - it showed that the extruder and bed had started heating but it actually was not heating. So I reinstalled the firmware again and this fixed it. Now my 3D printer works OK. You just try for these steps:</p> <ol> <li>Check the connection.</li> <li>Reinstall the firmware.</li> <li>Try manually preheat the extruder, and just see whether it heats to infinity.</li> </ol> <p>These are my working experience please try for these, I think it will help you. Just don't leave it you will get the solution. Keep on trying.</p>
969
<p>I've just bought my first 3D printer (Malyan M200 V2). For the most part, it's been really good and I've had no issues, apart from when printing the first few layers the printer doesn't seem to extrude enough material and doesn't form the correct shape. Whether it's a circle, rectangle, or anything else. So for example I've printed the below part.</p> <p>The raft prints perfectly:</p> <p><a href="https://i.stack.imgur.com/XXKQh.jpg" rel="nofollow noreferrer" title="Photo of a printed raft"><img src="https://i.stack.imgur.com/XXKQh.jpg" alt="Photo of a printed raft" title="Photo of a printed raft" /></a></p> <p>Then when it starts the first few layers of the actual print it extrudes a bit of material which then hangs from the nozzle and is dragged about the surface of the raft before stopping as more material is extruded. So when the print finishes the first layer looks messy like the one below:</p> <p><a href="https://i.stack.imgur.com/p2uoq.jpg" rel="nofollow noreferrer" title="Photo of the first layer of a printed model showing printing errors"><img src="https://i.stack.imgur.com/p2uoq.jpg" alt="Photo of the first layer of a printed model showing printing errors" title="Photo of the first layer of a printed model showing printing errors" /></a></p> <p>But everything after the first few layers is perfect for example the top of the same print:</p> <p><a href="https://i.stack.imgur.com/A71OY.jpg" rel="nofollow noreferrer" title="Photo of the layers after the first of a printed model that doesn't showing any errors"><img src="https://i.stack.imgur.com/A71OY.jpg" alt="Photo of the layers after the first of a printed model that doesn't showing any errors" title="Photo of the layers after the first of a printed model that doesn't showing any errors" /></a></p> <p>I've tried adjusting the temperature of the nozzle and the print bed neither has made a difference. The bed is level I've double-checked that. Trying to find the issue online keeps bringing me back to temperature or bed levelling.</p> <p>I'm using this <a href="https://www.amazon.co.uk/gp/product/B01N5SVFJS/ref=ppx_yo_dt_b_asin_title_o00_s01?ie=UTF8&amp;psc=1" rel="nofollow noreferrer">PrimaValue PLA Filament</a></p> <p>The leaflet in the box recommends printing at 210 °C, I've tried 210, 215, and 220 °C.</p> <p>The print bed I've been keeping at 60 °C which seems to have been working but I've tried printing down to 45 °C on the print bed and the same issue occurs. I'm not sure what an ideal temperature is for PLA, I've seen some posts saying that a heated bed isn't needed for PLA and others saying that it should be heated to between 50-70 °C (my printer only heats up to 60 °C).</p> <p>I've looked at some of the settings in Cura and there are various settings for things like initial speed and first/last layer speed which sound like they might help but I don't know anything about them. I have tried slowing down the print but again I just watched it happen more slowly, albeit that did help some as that's when I've realised it doesn't appear to be pushing out enough material on the first few layers. Any help or suggestions would be greatly appreciated.</p>
<p>PLA doesn't need a raft.</p> <p>Try printing without a raft. If you print with a raft because of adhesion problems, solve those first. A raft is only needed for filaments that shrink a lot and/or are printing at very high temperatures.</p> <p>If you want a raft, check the distance between raft and print object and know that a raft never gives a smooth bottom. This is because in order to prevent fusion of the print object to the raft a distance between the raft and the print object is accounted for. A property that controls the distance between the raft and the print object is called <code>Raft Air Gap</code> in Ultimaker Cura. Default for my setup this is 0.3 mm which I find rather large.</p> <p>For example (not raft, but support with a solid top layer, which is quite similar to a raft), I have used support structures with a roof to support large flat overhanging areas that where printed at 0.2 mm distance, this gave relatively good surface quality and barely no fusion to the print.</p>
<p>In Cura, you can indeed set the height of the first layer separate from the subsequent layers. So if the first layer is printing nicely, that's a good sign. That's usually the place prints fail. There are a few settings, but here are a few things to just double check:</p> <ul> <li>Is your nozzle set to the right size</li> <li>Is your raft layer height and regular layer height wildly different? Try setting them to the same, or if same, try making them different. There may be a 'raft top thickness' that's wrong for the nozzle size, (try 0.2 for a 0.4 mm nozzle)</li> <li>Layer height of your regular layers should be no greater than 80% of the nozzle width</li> <li>Print cooling (on), but initial fan speed (0)</li> <li>Supports: try printing with, or without. Look at Enable Support Interface (or disable it)</li> <li>Try just disabling your raft and see if it gets past the danger point. that will indicate if there's something misaligned with your Z.</li> <li>Check your axis rollers too! from this question, <a href="https://3dprinting.stackexchange.com/q/8022/4762">First 3 mm prints poorly, then fine after that</a></li> </ul>
2,176
<p>An obscure puzzle, but it's driving me absolutely nuts:</p> <p>I'm creating a custom Information Management Policy in MOSS. I've implemented IPolicyFeature, and my policy feature happily registers itself by configuring a new SPItemEventReceiver. All new items in my library fire the events as they should, and it all works fine.</p> <p>IPolicyFeature also has a method ProcessListItem, which is supposed to retroactively apply the policy to items that were already in the library (at least, it's supposed to do that for as long as it keeps returning <code>true</code>). Except it doesn't. It only applies the policy to the <strong><em>first</em></strong> item in the library, and I have absolutely no idea why.</p> <p>It doesn't seem to be throwing an exception, and it really does return true from processing that first item, and I can't think what else to look at. Anyone?</p> <p>Edit: Cory's answer, below, set me on the right track. Something else was indeed failing -- I didn't find out what, since my windbg-fu isn't what it should be, but I suspect it was something like "modifying a collection while it's being iterated over". My code was modifying the SPListItem that's passed into ProcessListItem, and then calling SystemUpdate on it; as soon as I changed the code so that it created its own variable (pointing at the exact same SPListItem) and used that, the problem went away...</p>
<p>There's only a couple of things I can think of to try. First, are you developing on the box where you might be able to use Visual Studio to debug? So just stepping through it.</p> <p>Assuming that's not the case - what I'd do is fire up WinDBG and attach it to the process just before I registered the policy. Turn on first chance exceptions so that it breaks whenever they occur. you can do that by issuing the command "sxe clr" once it is broken in. Here's a little more info about WinDBG:</p> <p><a href="http://blogs.msdn.com/tess/archive/2008/06/05/setting-net-breakpoints-in-windbg-for-applications-that-crash-on-startup.aspx" rel="nofollow noreferrer"><a href="http://blogs.msdn.com/tess/archive/2008/06/05/setting-net-breakpoints-in-windbg-for-applications-that-crash-on-startup.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/tess/archive/2008/06/05/setting-net-breakpoints-in-windbg-for-applications-that-crash-on-startup.aspx</a></a></p> <p>What I'd do is then watch for First Chance exceptions to be thrown, and do a !PrintException to see what is going on. My guess is that there is an exception being thrown somewhere that is causing the app to stop processing the other items. </p> <p>What does the logic look like for your ProcessListItem? Have you tried just doing a return true to make sure it works?</p>
<p>Some nice ideas there, thanks. The Visual Studio debugger wasn't showing an exception (and I've wrapped everything in try/catch blocks just in case), but I hadn't thought of trying Windbg...</p>
6,885
<p>I'm presenting information from a DataTable on my page and would like to add some sorting functionality which goes a bit beyond a straight forward column sort. As such I have been trying to place LinkButtons in the HeaderItems of my GridView which post-back to functions that change session information before reloading the page.</p> <p>Clicking my links <em>DOES</em> cause a post-back but they don't seem to generate any <em>OnClick</em> events as my <em>OnClick</em> functions don't get executed. I have <code>AutoEventWireup</code> set to true and if I move the links out of the GridView they work fine.</p> <p>I've got around the problem by creating regular anchors, appending queries to their <strong>hrefs</strong> and checking for them at page load but I'd prefer C# to be doing the grunt work. Any ideas?</p> <p><strong>Update:</strong> To clarify the IDs of the controls match their <em>OnClick</em> function names.</p>
<p>You're on the right track but try working with the Command Name/Argument of the LinkButton. Try something like this:</p> <p>In the HeaderTemplate of the the TemplateField, add a LinkButton and set the CommandName and CommandArgument</p> <pre><code>&lt;HeaderTemplate&gt; &lt;asp:LinkButton ID="LinkButton1" runat="server" CommandName="sort" CommandArgument="Products" Text="&lt;%# Bind('ProductName")' /&gt; &lt;/HeaderTemplate&gt; </code></pre> <p>Next, set the RowCommand event of the GridView</p> <pre><code>protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "sort") { //Now sort by e.CommandArgument } } </code></pre> <p>This way, you have a lot of control of your LinkButtons and you don't need to do much work to keep track of them.</p>
<p>Two things to keep in mind when using events on dynamically generated controls in ASP.Net:</p> <ul> <li>Firstly, the controls should ideally be created in the Page.Init event handler. This is to ensure that the controls have already been created before the event handling code is ran.</li> <li>Secondly, you must assign the same value to the controls ID property, so that the event handler code knows that that was the control that should handle the event.</li> </ul>
6,735
<p>What's the recommended source control system for a very small team (one developer)?<BR><BR> Price does not matter. Customer would pay :-)<BR> I'm working on Vista32 with VS 2008 in C++ and later in C# and with WPF. Setting up an extra (physical) server for this seems overkill to me. <BR><BR>Any opinions?</p>
<p>I would use Subversion (in fact I use it) [<strong>update</strong>: Jul 2014 -- I use Git -- see end of the answer]. SVN is:</p> <ul> <li>free, </li> <li>good enough (see disadvantages below), </li> <li>simple, </li> <li>works fine on Windows (and Linux too), </li> <li>a lot of people use it so it's easy to get help, </li> <li>can integrate with most of IDEs i.e. <strong>Visual Studio</strong> (i.e. <a href="http://ankhsvn.open.collab.net/" rel="nofollow noreferrer">ankhsvn</a> or <a href="http://www.visualsvn.com/" rel="nofollow noreferrer">VisualSVN</a> -- <a href="https://stackoverflow.com/questions/453481/subversion-plugin-to-visual-studio">more info</a>) or <strong>Eclipse</strong> (i.e. <a href="http://sourceforge.net/projects/subclipse/" rel="nofollow noreferrer">Subclipse</a> -- <a href="https://stackoverflow.com/questions/185486/which-eclipse-subversion-plugin-should-i-use">here</a> someone asked about that).</li> </ul> <p>I would <strong>strongly</strong> recommended separate machine to source control server. At best somewhere <em>on the cloud</em>. Advantages:</p> <ul> <li>You don't lost your source control repositories if your development box dies.</li> <li>You don't have to worry about maintenance of one more box.</li> </ul> <p>There are companies which <a href="http://www.svnhostingcomparison.com/" rel="nofollow noreferrer">host SVN repositories</a>.</p> <p><a href="http://subversion.apache.org/packages.html" rel="nofollow noreferrer">Here</a> are links to SVN (client and server) packages for various operating systems.</p> <h1>Disadvantages of SVN</h1> <p>I am using SVN on Windows machine for about 5 years and found that SVN has a few disadvantages :).</p> <h2>It is slow on large repositories</h2> <p>SVN (or its client -- TortoiseSVN) has one <strong>big</strong> disadvantage -- it terrible slow (while updating or committing) on large (thousands of files) repositories unless you have <a href="http://en.wikipedia.org/wiki/Solid-state_drive" rel="nofollow noreferrer">SSD</a> drive.</p> <h2>Merging can be difficult</h2> <p>Many people complain about how hard merging is with SVN.</p> <p>I do merging for about 4 years (including about 2 years in CVS -- that was terrible, but doable) and about 2 years with SVN.</p> <p>And personally I don't find it hard -- on the other hand -- any merge is easy after merging branches in CVS :).</p> <p>I do merge of large repository (two repositories in fact) once a week and rarely I have conflicts which are hard to solve (most of conflicts are solved automatically with <em>diff</em> software which I use).</p> <p>However in case of project of a few developers merging should not be problem at all if you keep a few simple rules:</p> <ul> <li>merge changes often,</li> <li>avoid active development in various branches simultaneously.</li> </ul> <h2>Added in July 2011</h2> <p>Many devs recommended <a href="http://en.wikipedia.org/wiki/Distributed_revision_control_system" rel="nofollow noreferrer">Distributed Version Control</a> like <a href="http://git-scm.com/" rel="nofollow noreferrer">Git</a> or <a href="https://www.mercurial-scm.org/" rel="nofollow noreferrer">Mercurial</a>.</p> <p>From <strong>single developer</strong> perspective there are only a few important advantages of DVCS over SVN:</p> <ul> <li>DVCS can be faster.</li> <li>You can commit to local repository without access to central one.</li> <li>DVCS is hot thing and fancy to use/learn (if someone pay for your learning).</li> </ul> <p>And I don't think merging is a problem in case of single developer.</p> <p>Joel Spolsky wrote <a href="http://hginit.com/" rel="nofollow noreferrer">tutorial about Mercurial</a> which is definitively worth to read.</p> <p>So, despite of many advantages of DVCS I would stay with SVN if merging or speed is not a problem.</p> <p>Or try Mercurial, which according to <a href="https://stackoverflow.com/questions/995636/popularity-of-git-mercurial-bazaar-vs-which-to-recommend">this</a> and <a href="https://stackoverflow.com/questions/2550091/best-support-now-on-windows-mercurial-or-git">this</a> SO questions, is better supported (in July 2011) on Windows.</p> <h2>Added in July 2014</h2> <p>For about a year I use Git (Git Bash mainly) for my pet-projects (i.e. solving Euler problems) and local branches for each Euler problem are really nice feature -- exactly as it is described as advantage of DVCS. </p> <p>Today Git tooling on Windows is much, much better then 2 or more years ago. You can use remote repo (like GitHub or ProjectLocker and many others) to keep copy of your project away from your workstation with no extra effort/money.</p> <p>However I use GUI client only to looks at diffs (and sometimes to choose files to commit), so it's better to not afraid of command line -- it's really nice.</p> <p>So as of today I would go with Git.</p>
<p>I dont see why the fact that your one developer changes anything on the source control issue. I would follow the same system (in fact I do on my solo projects). I use <a href="http://wush.net/" rel="nofollow noreferrer">wush.net</a> (svn and trac) in those cases. It's fast to set up and dont require that you yourself do or know any server issues. I recommend you use something like this. </p>
6,725
<p>This <a href="https://stackoverflow.com/questions/11782/file-uploads-via-web-services">question and answer</a> shows how to send a file as a byte array through an XML web service. How much overhead is generated by using this method for file transfer? I assume the data looks something like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;bytes&gt; &lt;byte&gt;16&lt;/byte&gt; &lt;byte&gt;28&lt;/byte&gt; &lt;byte&gt;127&lt;/byte&gt; ... &lt;/bytes&gt; </code></pre> <p>If this format is correct, the bytes must first be converted to UTF-8 characters. Each of these characters allocates 8 bytes. Are the bytes stored in base 10, hex, or binary characters? How much larger does the file appear as it is being sent due to the XML data and character encoding? Is compression built into web services?</p>
<p>Typically a byte array is sent as a <code>base64</code> encoded string, not as individual bytes in tags. </p> <p><a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Base64</a></p> <p>The <code>base64</code> encoded version is about <strong>137%</strong> of the size of the original content.</p>
<p>I use this method for some internal corporate webservices, and I haven't noticed any major slow-downs (but that doesn't mean it's not there). </p> <p>You could probably use any of the numerous network traffic analysis tools to measure the size of the data, and make a judgment call based off that.</p>
3,294
<p>What are the basic steps to compile an OpenGL application using <em>GLUT (OpenGL Utility Toolkit)</em> under Visual C++ Express Edition?</p>
<ol> <li>If you don't have Visual C++ Express Edition (VCEE), download and install <a href="http://msdn.microsoft.com/vstudio/express/visualc/default.aspx" rel="nofollow noreferrer">VCEE</a>.</li> <li>The default install of Visual C++ Express Edition builds for the .Net platform. We'll need to build for the Windows platform since OpenGL and GLUT are not yet fully supported under .Net. For this we need the Microsoft Platform SDK. (If you're using an older version of VCEE, download and install the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5" rel="nofollow noreferrer">Microsoft Platform SDK</a>. Visual C++ Express Edition will need to be configured to build for Windows platform. All these instructions are available <a href="http://msdn.microsoft.com/en-us/library/ms235626(VS.80).aspx" rel="nofollow noreferrer">here</a>.)</li> <li>If you don't have GLUT, download and unzip Nate Robin's <a href="http://www.xmission.com/~nate/glut.html" rel="nofollow noreferrer">Windows port of GLUT</a>.</li> <li>Add <strong>glut.h</strong> to your <em>Platform SDK/include/GL/</em> directory</li> <li>Link the project with <strong>glut.lib</strong>. (Go to VCEE <em>Project Properties -> Additional Linker Directories</em> and add the directory which has <strong>glut.lib</strong>.</li> <li>Add <strong>glut.dll</strong> to the <em>Windows/System32</em> directory, so that all programs using GLUT can find it at runtime.</li> </ol> <p>Your program which uses GLUT or OpenGL should compile under Visual C++ Express Edition now.</p>
<p>The GLUT port on Nate Robin's site is from 2001 and has some incompatibilities with versions of Visual Studio more recent than that (.NET 2003 and up). The incompatibility manifests itself as errors about redefinition of <code>exit()</code>. If you see this error, there are two possible solutions:</p> <ol> <li>Replace the <code>exit()</code> prototype in <code>glut.h</code> with the one in your <code>stdlib.h</code> so that they match. This is probably the best solution.</li> <li>An easier solution is to <code>#define GLUT_DISABLE_ATEXIT_HACK</code> before you <code>#include &lt;gl/glut.h&gt;</code> in your program.</li> </ol> <p>(Due credit: I originally saw this advice on the <a href="http://helpdesk.cs.tamu.edu/docs/glut_Visual_Studio2003" rel="noreferrer">TAMU help desk website</a>.)</p> <p>I've been using approach #1 myself since .NET 2003 came out, and have used the same modified <code>glut.h</code> with VC++ 2003, VC++ 2005 and VC++ 2008.</p> <p>Here's the diff for the glut.h I use which does #1 (but in appropriate <code>#ifdef blocks</code> so that it still works with older versions of Visual Studio):</p> <pre><code>--- c:\naterobbins\glut.h 2000-12-13 00:22:52.000000000 +0900 +++ c:\updated\glut.h 2006-05-23 11:06:10.000000000 +0900 @@ -143,7 +143,12 @@ #if defined(_WIN32) # ifndef GLUT_BUILDING_LIB -extern _CRTIMP void __cdecl exit(int); +/* extern _CRTIMP void __cdecl exit(int); /* Changed for .NET */ +# if _MSC_VER &gt;= 1200 +extern _CRTIMP __declspec(noreturn) void __cdecl exit(int); +# else +extern _CRTIMP void __cdecl exit(int); +# endif # endif #else /* non-Win32 case. */ </code></pre>
3,503
<p>I have a small problem where plastic comes out of the nozzle while the printer is at a standstill (normally towards the end of heating the nozzle for a print), and whilst it moves from the line for clearing the nozzle on the left of the bed (Cura) before the actual print starts. This causes a slight problem where the first few millimetres of the printed line curls upwards when the nozzle comes back around again it goes over it but it causes a slight bump that makes a very small (but noticeable) skip or bump in the print on the bottom layer. </p> <p>I am using the Ender 3 running Marling 1.1.9 with a Bltouch and a <a href="https://www.amazon.co.uk/Comgrow-Glass-Creality-Printer-Ender-3/dp/B07DSC9TJQ/ref=sr_1_3?ie=UTF8&amp;qid=1543100048&amp;sr=8-3&amp;keywords=ender%203%20glass" rel="nofollow noreferrer">glass bed</a>, I didn't seem to have this problem before I upgraded to the glass bed and Marlin for the Bltouch.</p> <p>Any help will be greatly appreciated.</p>
<h1>basics first</h1> <p>The viscosity of plastic is temperature dependent: the warmer it is, the lower it gets and thus the more "runny". The lower the viscosity is, the less force is needed to move it.</p> <p>In printing, a pressure is applied to the filament from the extruder. Pressure is the force by area, thus for our look pretty much the same: the extruder exerts a force on the filament, to overcome the viscosity keeping it in the nozzle.</p> <p>A secondary effect is, that heated material expands, depending on what kind of material is in the nozzle.</p> <h1>what happens</h1> <p>The whole problem starts with shutting off the printer after the print: as the filament cools it shrinks. As the motors are turned off, the solidifying and shrinking plastic pulls at the filament. The filament can change its location or be pulled a little through the extruder, keeping the space quite well filled without cavities. Bowden style can change the mere filament path a little to compensate some of the shrinkings by shifting its path from hugging the outer wall to doing the same on the inner wall.</p> <p>As you start to heat up the printer, there is no force applied on the filament from the extruder to push it out of the nozzle. But when you shut it down, there was some filament in the nozzle.</p> <p>The filament melts and its viscosity drops, but at the same time, it expands. The extruder does not yet apply force, but as the material expands, it pushes against the filament stuck above it. Newton's 3rd law is the iconic <em>Actioni contrariam semper et æqualem esse reactionem</em> or as we know it short: <em>Actio = Reactio</em>, the force you exert in one direction equals a force applied in the reverse direction. Thus, the expanding filament pressing back against the extruder <em>also</em> exerts a force against itself down against the nozzle. The same is true for the nozzle, but the nozzle has one difference: it has a hole, where the forces are bundled to force filament out.</p> <p>At some point, the force from the expanding filament is big enough to overcome the viscosity keeping the filament in the nozzle and it oozes out.</p> <h1>fixes</h1> <p>There are several ways to fix this in slicing, but I prefer the end-code method.</p> <ul> <li>Modify your <strong>end code</strong> to provide space in the nozzle while it is still hot. Simply add <code>G1 E-3 F1800</code> to retract quickly at the end of print. F1800 is rather fast.</li> <li>Modify your <strong>start code</strong> could help in preventing very runny filaments from oozing, but you usually need to zero the extruder first with <code>G92 E0</code> and you <em>might</em> also need to allow negative values with <code>G1 S1</code>. This isn't usable in all firmware versions, but one can use <code>G92 E3</code> to set it to 3, then extrude, then 0.</li> </ul> <h2>Example End Code</h2> <p>Watch line 2. This is what prevents my Ender 3 from oozing in the first place</p> <pre><code>G91 ;relative position set G1 F1800 E-3 ; Retract 3 mm to prevent oozing on startup G1 F3000 Z10 ; Move up 10 mm to clear the print G90 ;absolute position set G28 X0 Y0 ; home x and y axis to clear the print M106 S0 ; turn off part cooling fan M104 S0 ; turn off extruder M140 S0 ; turn off bed M84 ; disable motors </code></pre> <h2>Example Start Code addition</h2> <p>This is just a snippet that forces retraction at the start, once the filament is hot. it <em>WILL</em> though make the first three millimeters of push come empty, thus should be combined with a cleaning that uses more than this - check out <a href="https://3dprinting.stackexchange.com/questions/6355/writing-g-code-swiping-at-start-of-print?s=1|65.5276">Writing G-code : swiping at start of print</a> for better nozzle priming.</p> <pre><code>G92 E3 G1 E-3 F1000 G92 E0 </code></pre>
<p>This effect is called oozing. At the end of heating up the hot end, left filament becomes so liquid that it oozes out of the nozzle. This left filament could be a left over from the previous print where an insufficient retract prior to the last print finish causes this (you could retract the filament a little further in your "end G-code" script, first reset the E to zero <code>G92 E0</code> and then retract <code>G1 E-3 F1500</code>, be sure that the priming length in your "start G-code" takes care of this distance).</p>
1,102
<p>I want to put relief text on curved surface but can't find way to do that in OpenSCAD. I'm aware it's possible to bend text in Blender and then <code>import stl</code>, but I don't like this workflow. I found sort of working solution but it's not perfect.</p> <pre><code>$fn=50; module bend_text(caption, angle, text_height, text_width, text_depth, steps=10, k=1) { dh = text_height / steps; r = text_height / (angle * PI / 180); h0 = - text_height / 2; translate([0, 0, -r]) rotate([angle / 2, 0, 0]) for(i=[0:steps-1]) { rotate([-i * angle/steps, 0, 0]) translate([0, -(dh * i + h0), r / k]) intersection() { linear_extrude(text_depth) text(caption, valign=&quot;center&quot;, halign=&quot;center&quot;); translate([0, dh * i + h0, 0]) cube([text_width, dh, text_width], center=true); } } } bend_text(&quot;test&quot;, angle=90, text_height=9, text_width=30, text_depth=1, steps=10, k=1.1); </code></pre> <p><a href="https://i.stack.imgur.com/0zq1h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0zq1h.png" alt="test" /></a></p> <p>Is there better way?</p>
<p>Yes - you should be able to turn the extruder by hand when it is unplugged and therefore not powered.</p> <p>The V2 comes with a blue plastic knob for this purpose, it may be too small to turn the shaft by hand.</p> <p>When powered and &quot;steppers enabled&quot; the motors need a lot more force to overcome, but even that can be done by hand or a machine crash.</p> <p>If you can't turn the extruder at all, its probably toast. That you've tested other ports on the board is excellent problem solving.</p> <p>Whatever damaged the motor has likely damaged the board too, or vise versa.</p> <p>You likely need both parts replaced to get this printer working again. Could be expensive - you might want to compare cost of parts with cost of a new printer, remembering there may be other non-functional components still undiscovered.</p> <p>Plausibly, with a dead extruder, you could slap a laser on this unit and make it a dedicated burner. The creality laser module is around $50 USD.</p>
<p>Criggie's answer is basically correct, but I disagree with the conclusion that it:</p> <blockquote> <p>Could be expensive - you might want to compare cost of parts with cost of a new printer, remembering there may be other non-functional components still undiscovered.</p> </blockquote> <p>If you want to turn the Ender 3 into a decent printer, the controller board is one of the components you want to replace anyway, since it comes with either (old models) extremely loud and poorly performing A4988 stepper drivers or (newer models) TMC2208 stepper drivers hard-wired in a mode where they don't work well and malfunction if you enable Linear Advance (which is critical to getting decent prints on a bowden extruder system). Good boardsthat are exact fits for the housing and cable connectors, with TMC2209 steppers that lack the above problems, can be had for $35 or so.</p> <p>If the motor is dead, that's a pain but not expensive to replace. Equivalent motors are available for $15 or so all over the place, or you could make the upgrade to a light-weight geared direct drive extruder with pancake stepper instead of the large NEMA 17 (which negates pretty much all of the disadvantages of direct drive and gives you a much better printer than you started with).</p>
2,146
<p>I'm trying to generate custom e-mail addresses that get forwarded to a catch-all. I'm wondering how postfix would need to be configured to handle these types of e-mails</p> <p>dropbox@123456.foobar.highrisehq.com</p>
<p>I do believe that it is not totally a smtp server level thing. Like the mails where the ticket id is in the subject line and you have to keep that there, there would mostly be another application that would be checking TO address, doing a database lookup and then doing something useful.</p> <p>I haven't signed up for highrise,but I imagine that the dropbox address, given in the sample as "dropbox@12345678.highrisehq.com",the 12345678 part would be a randomly generated but unique number (means that they will not be sequentially generated, like 0000001,0000002, ... but like 28902734, 1029383, ...) and connected to your account. This way if you mistype that part, the chances of it landing up in the wrong account are lowered, and mostly the mail would bounce back. All the mails sent to the dropbox address are added that members account, in that sense, the dropbox email address is not to be made public. The dropbox address would not be easy to remember, but it is not meant to be. This lends more credence to the theory that there is a separate application which processes the mails and files them in the correct account.</p>
<p>They're most likely piping a wildcard e-mail address into a script.</p>
9,055
<p>So, you're writing a web application and you have several areas of the site where the user can upload files. My basic working method for this is to store the actual file on the server, and have a database table that connects the stored filename to the record it relates to.</p> <p>My question is this: Should there be a different table for each "type" of file? Also, should the files be stored in context-related locations on the server, or all together?</p> <p>Some examples: user profile photos, job application CVs, related documents on CMS pages, etc.</p>
<p>From your example, there is an argument for two tables, as you have files that can be associated with two different things.</p> <ul> <li>CVs, photos are associated with a user.</li> <li>attachments are associated with a CMS page.</li> </ul> <p>If you put these in one table, (and you want to allow users to have more than one photo or cv) then you need two link-tables to associate files->users and files->cms_pages. Arguably this implies a HABTM relationship, which is not correct and allows for inconsistent data. </p> <p>The two table approach is slightly cleaner and only allows files to be associated with the correct type of entity with a simple belongsTo relationship.</p> <p>But I don't think there is any "right" answer to this question, unless you need to store different types of metadata for different filetypes. </p> <p>Also be sure to store, or be able to calculate, the mimetype for each file so it can be served correctly back to the browser, with the correct HTTP headers.</p>
<p>From what you've said I would just store files with random (UUID or what-not) filenames in one place. I would then have a 'attachments' table or something that contains references to all your external files. This table would also contain the meta-data for that file, so what type of file it is (picture, CV etc) and so on.</p> <p>There may be hard limits to the number of files in one directory though, depending on what FS you are using.</p>
3,828
<p>Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron.</p> <p>I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit.</p> <p>So, my question is "is there a way to have some kind of process explorer, or task manager sort of thing for Firefox 3?"</p> <p>I would like to be able to see what tabs are using what percent of my processor via the JavaScript on that page (or anything in the page that is causing CPU/memory usage). </p> <p>Does anybody know of a plugin that does this, or something similar? Has anyone else done this kind of inspection another way?</p> <p>I know about FireBug, but I can't imagine how I would use it to finger which tab is using a lot of resources.</p> <p>Any suggestions or insights?</p>
<p>It's probably the <a href="http://shaver.off.net/diary/2008/05/25/fsyncers-and-curveballs/" rel="noreferrer">awesome firefox3 fsync "bug"</a>, which is a giant pile of fail.</p> <p>In summary</p> <ul> <li>Firefox3 saves its bookmarks and history in an SQLite database</li> <li>Every time you load a page it writes to this database several times</li> <li>SQLite cares deeply that you don't lose your bookmarks, so each time it writes, instructs the kernel to flush it's database file to disk and ensure that it's fully written</li> <li>Many variants of linux, when told to flush like that, flush EVERY FILE. This may take up to a minute or more if you have background tasks doing any kind of disk intensive stuff.</li> <li>The kernel makes firefox wait while this flush happens, which locks up the UI.</li> </ul>
<p>There's no &quot;process explorer&quot; kind of tool for Firefox; but there's <a href="https://developer.mozilla.org/en-US/docs/Archive/Mozilla/Venkman" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Archive/Mozilla/Venkman</a> with profiling mode, which you could use to see the time spent by chrome (meaning non-content, that is not web-page) scripts.</p> <p>From what I've read about it, DTrace might also be useful for this sort of thing, but it requires creating a custom build and possibly adding additional probes to the source. I haven't played with it myself yet.</p>
2,909
<p>I can set the PHP include path in the <code>php.ini</code>:</p> <pre><code>include_path = /path/to/site/includes/ </code></pre> <p>But then other websites are affected so that is no good.</p> <p>I can set the PHP include in the start of every file:</p> <pre><code>$path = '/path/to/site/includes/'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); </code></pre> <p>But that seems like bad practice and clutters things up. </p> <p>So I can make an include of that and then include it into every file:</p> <pre><code>include 'includes/config.php'; </code></pre> <p>or</p> <pre><code>include '../includes/config.php'; </code></pre> <p>This is what I'm doing right now, but the include path of <code>config.php</code> will change depending on what is including it. </p> <p>Is there a better way? Does it matter?</p>
<p>If you're using apache as a webserver you can override (if you allow it) settings using <em>.htaccess</em> files. See <a href="http://us2.php.net/configuration.changes" rel="nofollow noreferrer">the PHP manual</a> for details.</p> <p>Basically you put a file called <em>.htaccess</em> in your website root, which contains some PHP <code>ini</code> values. Provided you configured Apache to allow overrides, this site will use all values in your PHP config, + the values you specify in the <em>.htaccess</em> file.</p> <blockquote> <p>Can be used only with <code>PHP_INI_ALL</code> and <code>PHP_INI_PERDIR</code> type directives</p> </blockquote> <p>as stated in the page I linked. If you click through to the full listing, you see that the include path is a <code>PHP_INI_ALL</code> directive.</p>
<p>You can set <code>include_path</code> in your php.ini file too. I'm a perl guy, so I expect to be able to load includes and have <code>include</code> do the right thing. I have all my includes in a specific directory, which is added to <code>include_path</code>. I can do things like </p> <pre><code>require_once "ClassName.php"; </code></pre> <p>I don't need to worry about relative paths or locations of files.</p> <p>I've also written my own <code>CustomRequire</code> to do things like</p> <pre><code>function CustomRequire ($file) { if(defined('MYINCLUDEPATH')) { require_once MYINCLUDEPATH . "/$file"; } else { require_once $file; } } </code></pre> <p>That way I can change how I do includes at a later date. Of course, you still need to find a way to include your include code :)</p>
4,427
<p>I'm pretty new to my company (2 weeks) and we're starting a new platform for our system using .NET 3.5 Team Foundation from DotNetNuke. Our "architect" is suggesting we use one class project. Of course, I chime back with a "3-tier" architecture (Business, Data, Web class projects). </p> <p>Is there any disadvantages to using this architecture? Pro's would be separation of code from data, keeping class objects away from your code, etc.</p>
<p>I guess a fairly big downside is that the extra volume of code that you have to write, manage and maintain for a <strong>small</strong> project may just be overkill.</p> <p>It's all down to what's appropriate for the size of the project, the expected life of the final project and the budget! Sometimes, whilst doing things 'properly' is appealing, doing something a little more 'lightweight' can be the right commercial decision!</p>
<p>As with anything abstraction creates complexity, and so the complexity of doing N-tiered should be properly justified, e.g., does N-tiered actually benefit the system? There <em>will</em> be small systems that will work best with N-tiered, although a lot of them will not.</p> <p>Also, even if your system is small at the moment, you might want to add more features to it later -- not going N-tiered <em>might</em> consitute a sort of technical debt on your part, so you have to be careful.</p>
2,774
<p>Is there a preferred way to handle animation when using Flex -- For instance, if I want to render a ball and bounce it around the screen?</p>
<p>I prefer to use a tweening library for things like this. Check these out:</p> <p><a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fcode.google.com%2Fp%2Ftweener%2F&amp;ei=X4nOSIPJAaioesqPveAI&amp;usg=AFQjCNH06RZesH0SEvPCYbJ-J0OMFd7GGQ&amp;sig2=Ki_WXXUX1aHzahMMMSctIw" rel="nofollow noreferrer">Tweener</a></p> <p><a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fblog.greensock.com%2Ftweenmaxas3%2F&amp;ei=jInOSK2QC6jeeu3z-eEI&amp;usg=AFQjCNFfJ41rVV8JX7vg8VfC2vRwuwzAkQ&amp;sig2=sCb4Kj8LvIXZj9Wt9iLZ9g" rel="nofollow noreferrer">TweenLite / TweenMax</a></p> <p><a href="http://code.google.com/p/kitchensynclib/" rel="nofollow noreferrer">KitchenSync</a></p> <p>I've had good luck actually using the first two, and have read great things about the last one.</p>
<p>You can use mx.effects.AnimateProperty even though your target is not a UIComponent. </p> <p>If the tween you want to acheive is a simple one (Move, Resize, Fade etc) this saves you writing the boiler plate code that mx.effects.Tween requires.</p>
8,936
<p>I installed TortoiseHg (Mercurial) in my Vista 64-bit and the context menu is not showing up when I right click a file or folder. Is there any workaround for this problem?</p>
<p>Update: TortoiseHg 0.8 (released 2009-07-01) now includes both 32 and 64 bit shell extensions in the installer, and also works with Windows 7. The workaround described below is no longer necessary.</p> <hr> <p>A workaround to getting the context menus in Windows Explorer is buried in the TortoiseHg development mailing list archives. One of the posts provides this very handy tip on how to run 32-bit Explorer on 64-bit Windows:</p> <p>TortoiseHG context menus will show up if you run 32-bit windows explorer; create a shortcut with this (or use Start > Run):</p> <pre><code>%Systemroot%\SysWOW64\explorer.exe /separate </code></pre> <p>(Source: <a href="http://www.mail-archive.com/tortoisehg-develop@lists.sourceforge.net/msg01055.html" rel="nofollow noreferrer">http://www.mail-archive.com/tortoisehg-develop@lists.sourceforge.net/msg01055.html</a>)</p> <p>It works fairly well and is minimally invasive, <strike>but unfortunately this doesn't seem to make the icon overlays appear. I don't know of any workaround for that, but file status can still be viewed through TortoiseHg menu commands at least.</strike> All other TortoiseHg functionality seems intact.</p> <p>The icon overlays are now working with TortoiseHg 0.6 in 32-bit explorer! Not sure if this is a new fix or if I had some misconfiguration in 0.5; regardless this means TortoiseHg is <b>fully</b> functional in 64-bit Windows.</p>
<p>According to the <a href="http://bitbucket.org/tortoisehg/stable/wiki/FAQ" rel="nofollow noreferrer">TortoiseHg FAQ</a> the context menus will work in 64-bit Vista <a href="http://bitbucket.org/tortoisehg/stable/wiki/FAQ#does-tortoisehg-work-on-vista" rel="nofollow noreferrer">if you start a 32-bit instance of explorer by creating a shortcut</a> with the following settings (as suggested in the answer above):</p> <pre><code>Target: %windir%\syswow64\explorer.exe /separate Start In: %windir%\syswow64\ </code></pre>
6,089
<p>I'm setting up a server which is on a network behind a firewall and I want programs on this computer to be able to use sendmail to send emails to any email address. We have an SMTP server running on this network (let's call it mailrelay.example.com) which is how we're supposed to get outgoing emails through the firewall.</p> <p>So how do I configure sendmail to send all mail through mailrelay.example.com? Googling hasn't given me the answer yet, and has only revealed that sendmail configuration is extremely complex and annoying.</p>
<p>@eli: modifying sendmail.cf directly is not usually recommended, since it is generated by the macro compiler. </p> <p>Edit /etc/mail/sendmail.mc to include the line:</p> <pre><code> define(`SMART_HOST',`mailrelay.example.com')dnl </code></pre> <p>After changing the sendmail.mc macro configuration file, it must be recompiled to produce the sendmail configuration file.</p> <pre><code> # m4 /etc/mail/sendmail.mc &gt; /etc/sendmail.cf </code></pre> <p>And restart the sendmail service (Linux):</p> <pre><code> # /etc/init.d/sendmail restart </code></pre> <p>As well as setting the smarthost, you might want to also disable name resolution configuration and possibly shift your sendmail to non-standard port, or disable daemon mode.</p> <h1>Disable Name Resolution</h1> <p>Servers that are within fire-walled networks or using Network Address Translation (NAT) may not have DNS or NIS services available. This creates a problem for sendmail, since it will use DNS by default, and if it is not available you will see messages like this in mailq:</p> <pre><code> host map: lookup (mydomain.com): deferred) </code></pre> <p>Unless you are prepared to setup an appropriate DNS or NIS service that sendmail can use, in this situation you will typically configure name resolution to be done using the /etc/hosts file. This is done by enabling a 'service.switch' file and specifying resolution by file, as follows:</p> <p>1: Enable service.switch for sendmail Edit /etc/mail/sendmail.mc to include the lines:</p> <pre><code> define(`confSERVICE_SWITCH_FILE',`/etc/mail/service.switch')dnl </code></pre> <p>2: Configure service.switch for files Create or modify /etc/mail/service.switch to refer only to /etc/hosts for name resolution:</p> <pre><code> # cat /etc/mail/service.switch hosts files </code></pre> <p>3: Recompile sendmail.mc and restart sendmail for this setting to take effect.</p> <h1>Shift sendmail to non-standard port, or disable daemon mode</h1> <p>By default, sendmail will listen on port 25. You may want to change this port or disable the sendmail daemon mode altogether for various reasons: - if there is a security policy prohibiting the use of well-known ports - if another SMTP product/process is to be running on the same host on the standard port - if you don't want to accept mail via smtp at all, just send it using sendmail</p> <p>1: To shift sendmail to use non-standard port. Edit /etc/mail/sendmail.mc and modify the "Port" setting in the line:</p> <pre><code> DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') </code></pre> <p>For example, to get sendmail to use port 125:</p> <pre><code> DAEMON_OPTIONS(`Port=125,Addr=127.0.0.1, Name=MTA') </code></pre> <p>This will require sendmail.mc to be recompiled and sendmail to be restarted.</p> <p>2: Alternatively, to disable sendmail daemon mode altogether (Linux) Edit /etc/sysconfig/sendmail and modify the "DAEMON" setting to:</p> <pre><code> DAEMON=no </code></pre> <p>This change will require sendmail to be restarted.</p>
<p>@Espo: Thanks for the great advice on where to start. Your link would have been better if I had been configuring sendmail for its first use instead of taking an existing configuration and making this small change. However, once I knew to look for stuff on "SmartHost", I found an easier way.</p> <p>All I had to do was edit my /etc/mail/sendmail.cf file to change</p> <pre><code>DS </code></pre> <p>to</p> <pre><code>DSmailrelay.example.com </code></pre> <p>then restart sendmail and it worked.</p>
6,559
<p>Using CFML (ColdFusion Markup Langauge, aka ColdFusion), how can you compare if two single dimension arrays are the same?</p>
<p>There's a very simple way of comparing two arrays using CFML's underlying java. According to a recent blog by Rupesh Kumar of Adobe (<a href="http://coldfused.blogspot.com/" rel="nofollow noreferrer">http://coldfused.blogspot.com/</a>), ColdFusion arrays are an implementation of java lists (java.util.List). So all the Java list methods are available for CFML arrays.</p> <p>So to compare 2 arrays all you need to do is use the equals method. It returns a YES if the arrays are equal and NO if they are not.</p> <pre><code>&lt;cfset array1 = listToArray("tom,dick,harry,phred")/&gt; &lt;cfset array2 = listToArray("dick,harry,phred") /&gt; &lt;cfset array3 = listToArray("tom,dick,harry,phred")/&gt; &lt;cfoutput&gt; Array2 equals Array1 #array2.equals(array1)# (returns a NO) &lt;br/&gt; Array3 equals Array1 #array3.equals(array1)# (returns a YES) &lt;br/&gt; &lt;/cfoutput&gt; </code></pre>
<p>All of these solutions check that two arrays are equal. They don't check that they are the same object. The only way I know to do that in native CF is to change the object in some way and see if both references have the change in. </p> <p>I also think that you should be wary of relying on CF implementing certain java classes or exposing methods. These are liable to change. </p> <p>As for comparing two arrays to see if the contents is the same, why not just Check the length (if different return false) If the lengths are the same from 1 to array len and check the elements are the same break and return false if they are not.</p> <p>This will work for simple values.</p>
5,016
<p>I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. </p> <p>I'm making an example to clarify. Let's say that this is the Users table, with the points earned:</p> <pre><code>UserId - Points 1 - 100 2 - 75 3 - 50 4 - 50 5 - 50 6 - 25 </code></pre> <p>If I want the top 3 scores, the result will be:</p> <pre><code>UserId - Points 1 - 100 2 - 75 3 - 50 4 - 50 5 - 50 </code></pre> <p>This can be realized in a view or a stored procedure, as you want. My target db is Sql Server. Actually I solved this, but I think there are different way to obtain the result... faster or more efficent than mine.</p>
<p>Untested, but should work:</p> <pre><code>select * from users where points in (select distinct top 3 points from users order by points desc) </code></pre>
<p>@bosnic, I don't think that will work as requested, I'm not that familiar with MS SQL but I would expect it to return only 3 rows, and ignore the fact that 3 users are tied for 3rd place.</p> <p>Something like this should work:</p> <pre><code>select userid, points from scores where points in (select top 3 points from scores order by points desc) order by points desc </code></pre>
5,853
<p>I am having a strange intermittent printing error specific to one particular object I'm trying to print.</p> <p><a href="https://i.stack.imgur.com/L7Sxz.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/L7Sxz.jpg" alt="A picture of my print error"></a></p> <p>My printer is a BCN3D Sigma R17. I am printing a thin wall (0.6mm) cup object. I'm using:</p> <ul> <li>Simplify3D with Sigma Progen profiles</li> <li>0.6mm brass nozzle (w/thermal paste)</li> <li>0.1mm layer height</li> <li>Spiral (vase mode)</li> <li>Filaform PLA.</li> </ul> <p>As you can see in the images, the first few layers print ok, but then the nozzle seems to collide/penetrate the previous layer and grinds against it as it moves around in a circle. The result is a combination of rough textured surface and good quality surface. One half of the print also seems to be thicker, presumably from the increased extrusion width caused by squashing layers in the z-axis. I’ve tried</p> <ul> <li>changing model's wall thickness,</li> <li>disabling spiral mode</li> <li>increasing layer height</li> <li>changing filament</li> <li>upgrading printer (latest stepper drivers)</li> <li>changing extrusion width</li> <li>performing full calibration</li> </ul> <p>All without success. You can view the gcode and S3D fff profile here: <a href="https://drive.google.com/drive/folders/0B6SnaYyiYI7vcGU1U3Uxb0RrX3M?usp=sharing" rel="noreferrer">https://drive.google.com/drive/folders/0B6SnaYyiYI7vcGU1U3Uxb0RrX3M?usp=sharing</a></p> <p>The image shows some filament left hanging from a stopped print. It seemed to be squeezed out from excess pressure, as if it was being blocked during the print due to being pushed against the layers.</p>
<p>Well, for a 0.6 wall thickness using a 0.6 nozzle you should have one line for the whole wall. But I´m seeing in your prints walls of 0.1 and 0.4 as infill, Why? I´m using simplify3D and I can see the results about walls and infill prior to send to the printer. On this kind of parts avoid infill and give priority to walls.</p> <p>So the main problem with your gcode is that wall thickness, is too much difference between the filament extrusion 0.6 vs 0.1 this is 16.6% of the printing flow, so you need to set print flow to 16.6% or 20%, not 80%. You must need to use retraction to avoid blobs and set a lower temperature.</p> <p>I saw this video to control Coast issues, but is explained how to set settings on Simplify3D; I hope you can visualize your issues before printing. <a href="https://www.youtube.com/watch?v=WWpdGY0V-gM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=WWpdGY0V-gM</a></p>
<p>I'd suggest you change the Flow (%).</p> <p>It is usually at 100%, but can be adjusted. I'd suggest printing at 80%, and adjusting from there.</p> <p>Layer height, printing speed or other configurations always change the Extrusion Rate with it, because for example higher layers always require more material extruded at the same printing speed.</p> <p>How it is done with your specific software, I cannot tell.</p>
625
<p>I am considering building a application using PRISM (Composite WPF Guidance/Library). The application modules will be vertically partitioned (i.e. Customers, Suppliers, Sales Orders, etc). This is still all relatively easy... I also have a Shell with a main region were all the work will happen but now I need the following behavior: I need a menu on my main Shell and when each one of the options gets clicked (like customers, suppliers, etc) I need to find the module and load it into the region (Only 1 view at a time)? </p> <p>Does anybody know of any sample applications with this type of behavior? All the samples are more focused on having all the modules loaded on the main shell? And should my menu bar also be a module?</p> <p>[<strong>UPDATE</strong>] How do I inject a module into a region based on it being selected from a menu? All the examples show that the module injects the view into the region on initialize? I need to only inject the view if the module is selected on a menu?</p>
<p>Just finished watching <a href="http://www.dnrtv.com/default.aspx?showNum=124" rel="nofollow noreferrer">Brian Noyes on Prism</a> at dnrTV. This answered all my question... </p>
<p>to save you time, check <a href="http://johnpapa.net/building-a-presentation-framework-with-prism-for-silverlight" rel="nofollow noreferrer">John Papa's Presentation Framework article</a>. It will be more easy if you have 3rd object(<code>Screen Conductor</code>) to handle your screens in showing or hiding from regions.</p>
7,181
<p>I would like to rename files and folders recursively by applying a string replacement operation.</p> <p>E.g. The word "shark" in files and folders should be replaced by the word "orca".</p> <p><code>C:\Program Files\Shark Tools\Wire Shark\Sharky 10\Shark.exe</code> </p> <p>should be moved to:</p> <p><code>C:\Program Files\Orca Tools\Wire Orca\Orcay 10\Orca.exe</code></p> <p>The same operation should be of course applied to each child object in each folder level as well.</p> <p>I was experimenting with some of the members of the <code>System.IO.FileInfo</code> and <code>System.IO.DirectoryInfo</code> classes but didn't find an easy way to do it.</p> <pre><code>fi.MoveTo(fi.FullName.Replace("shark", "orca")); </code></pre> <p>Doesn't do the trick.</p> <p>I was hoping there is some kind of "genius" way to perform this kind of operation. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>So you would use recursion. Here is a powershell example that should be easy to convert to C#:</p> <pre><code>function Move-Stuff($folder) { foreach($sub in [System.IO.Directory]::GetDirectories($folder)) { Move-Stuff $sub } $new = $folder.Replace("Shark", "Orca") if(!(Test-Path($new))) { new-item -path $new -type directory } foreach($file in [System.IO.Directory]::GetFiles($folder)) { $new = $file.Replace("Shark", "Orca") move-item $file $new } } Move-Stuff "C:\Temp\Test" </code></pre>
<pre><code>string oldPath = "\\shark.exe" string newPath = oldPath.Replace("shark", "orca"); System.IO.File.Move(oldPath, newPath); </code></pre> <p>Fill in with your own full paths</p>
3,765
<p>Please check following image, Dog looks smooth from left side but its rough from right side , similar on back too.</p> <p>What could have caused this ?</p> <p></p> <p>Can it be due to moisture due to Air Conditioner in my room ? <a href="https://i.stack.imgur.com/u3VOP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u3VOP.jpg" alt="dog pic"></a></p>
<p>I was making following mistakes </p> <p>a) X-axis belt needed a tightening ( I calibrated all X,Y,Z and they were perfect)</p> <p>b) There was under extrusion . ( I had to increase number of steps per mm for extruder motor and store the setting) </p> <p>XYZ calibration cube was really helpful in debugging the problems .</p>
<p>It is most likely caused by inadequate part-cooling due to poor air-flow. Fit a [better] part cooling fan. There are plenty of designs on Thingiverse.</p> <p>You may also be able to resolve the issue by adjusting the printing temperature, but the easiest solution is to install a good part-cooling fan.</p>
1,323
<p>How can I drop all tables whose names begin with a given string? </p> <p>I think this can be done with some dynamic SQL and the <code>INFORMATION_SCHEMA</code> tables.</p>
<p>You may need to modify the query to include the owner if there's more than one in the database.</p> <pre class="lang-sql prettyprint-override"><code>DECLARE @cmd varchar(4000) DECLARE cmds CURSOR FOR SELECT 'drop table [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'prefix%' OPEN cmds WHILE 1 = 1 BEGIN FETCH cmds INTO @cmd IF @@fetch_status != 0 BREAK EXEC(@cmd) END CLOSE cmds; DEALLOCATE cmds </code></pre> <p>This is cleaner than using a two-step approach of generate script plus run. But one advantage of the script generation is that it gives you the chance to review the entirety of what's going to be run before it's actually run.</p> <p>I know that if I were going to do this against a production database, I'd be as careful as possible.</p> <p><strong>Edit</strong> Code sample fixed.</p>
<p>Try following code:</p> <pre><code>declare @TableLst table(TblNames nvarchar(500)) insert into @TableLst (TblNames) SELECT 'DROP TABLE [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'yourFilter%' WHILE ((select COUNT(*) as CntTables from @TableLst) &gt; 0) BEGIN declare @ForExecCms nvarchar(500) = (select top(1) TblNames from @TableLst) EXEC(@ForExecCms) delete from @TableLst where TblNames = @ForExecCms END </code></pre> <p>This SQL script is executed without using a <strong>cursor</strong>.</p>
2,640