instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution is hardly ideal.</p> <p>What is the simplest way to implement continuations for Scheme in C?</p>
<p>I remember reading an article that may be of help to you: <em><a href="http://home.pipeline.com/~hbaker1/CheneyMTA.html" rel="noreferrer">Cheney on the M.T.A.</a></em> :-)</p> <p>Some implementations of Scheme I know of, such as <a href="http://sisc.sourceforge.net/" rel="noreferrer">SISC</a>, allocate their call frames on the heap.</p> <p>@ollie: You don't need to do the hoisting if all your call frames are on the heap. There's a tradeoff in performance, of course: the time to hoist, versus the overhead required to allocate all frames on the heap. Maybe it should be a tunable runtime parameter in the interpreter. :-P</p>
<p>Use an explicit stack instead.</p>
2,824
<p>We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines.</p> <p>A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an option unfortunately, so I don't want this to descend into a VSS bash)</p> <p>We are looking at merging projects. We are also looking at having multiple solutions to achieve greater separation of concerns and quicker compile times for each element of the application. This I can see will become a DLL hell as we try to keep things in synch.</p> <p>I am interested to know how other teams have dealt with this scaling issue, what do you do when your code base reaches a critical mass that you are wasting half the day watching the status bar deliver compile messages.</p> <p><strong>UPDATE</strong> I neglected to mention this is a C# solution. Thanks for all the C++ suggestions, but it's been a few years since I've had to worry about headers.</p> <p><strong>EDIT:</strong></p> <p>Nice suggestions that have helped so far (not saying there aren't other nice suggestions below, just what has helped)</p> <ul> <li>New 3GHz laptop - the power of lost utilization works wonders when whinging to management <li>Disable Anti Virus during compile <li>'Disconnecting' from VSS (actually the network) during compile - I may get us to remove VS-VSS integration altogether and stick to using the VSS UI </ul> <p>Still not rip-snorting through a compile, but every bit helps.</p> <p>Orion did mention in a comment that generics may have a play also. From my tests there does appear to be a minimal performance hit, but not high enough to sure - compile times can be inconsistent due to disc activity. Due to time limitations, my tests didn't include as many Generics, or as much code, as would appear in live system, so that may accumulate. I wouldn't avoid using generics where they are supposed to be used, just for compile time performance</p> <p><strong>WORKAROUND</strong></p> <p>We are testing the practice of building new areas of the application in new solutions, importing in the latest dlls as required, them integrating them into the larger solution when we are happy with them.</p> <p>We may also do them same to existing code by creating temporary solutions that just encapsulate the areas we need to work on, and throwing them away after reintegrating the code. We need to weigh up the time it will take to reintegrate this code against the time we gain by not having Rip Van Winkle like experiences with rapid recompiling during development.</p>
<p>The Chromium.org team listed several options for <a href="http://dev.chromium.org/developers/how-tos/build-instructions-windows" rel="noreferrer">accelerating the build</a> (at this point about half-way down the page):</p> <blockquote> <p>In decreasing order of speedup:</p> <ul> <li>Install Microsoft hotfix <a href="http://support.microsoft.com/kb/935225" rel="noreferrer">935225</a>.</li> <li>Install Microsoft hotfix <a href="http://support.microsoft.com/kb/947315" rel="noreferrer">947315</a>. </li> <li>Use a true multicore processor (ie. an Intel Core Duo 2; not a Pentium 4 HT).</li> <li>Use 3 parallel builds. In Visual Studio 2005, you will find the option in <strong>Tools > Options... > Projects and Solutions > Build and Run > maximum number of parallel project builds</strong>.</li> <li>Disable your anti-virus software for .ilk, .pdb, .cc, .h files and only check for viruses on <strong>modify</strong>. Disable scanning the directory where your sources reside. Don't do anything stupid.</li> <li>Store and build the Chromium code on a second hard drive. It won't really speed up the build but at least your computer will stay responsive when you do gclient sync or a build.</li> <li>Defragment your hard drive regularly.</li> <li>Disable virtual memory.</li> </ul> </blockquote>
<p>Slow Visual Studio Performance … Solved! September 24th, 2014 by Uzma Abidi</p> <p>I had an odd performance-related issue today. My Microsoft Visual Studio seemed to be taking far too long to perform even the simplest of operations. I Googled around and tried a few ideas that people had such as disabling add-ins or clearing Visual Studio’s recent projects list but those suggestions didn’t seem to solve the problem. I remembered that the Windows SysInternals website had a tool called Process Monitor that would sniff registry and file accesses by any running program. It seemed to me that Visual Studio was up to something and Process Monitor should help me figure out what it was. I downloaded the most recent version, and after fiddling around a bit with its display filters, ran it and to my horror, I saw that Visual Studio was so slow because it was accessing the more than 10,000 folders in C:\Users\krintoul\AppData\Local\Microsoft\WebSiteCache on most IDE operations. I’m not sure why there were that many folders and moreover, wasn’t sure what Visual Studio was doing with them, but after I zipped those folders up and moved them somewhere else, Visual Studio’s performance improved tremendously.</p> <p>The Windows SysInternals website has a number of other useful utilities for network management, security, system information and more. Check it out. I’m sure you’ll find something of value.</p>
7,932
<p>My ender3 came with a BuildTak-clone surface, and as I was a little too vigorous in getting the print off the bed (I had failed to level right and printed a bit too tight to the bed, resulting in SUPER strong adhesion), I needed to replace it.</p> <p>Peeling off the black was easy. The plastic sheet that held the glue was easy too... but how to clean up the bed to get the residue glue off and prepare for the new 3M sticker?</p>
<p>In my experience, we deal with 3M™ Adhesive Transfer Tape 468MP; high-temperature glue residue. To remove the leftover glue from my Aluminium build plate I found that it works best if I apply <a href="https://en.wikipedia.org/wiki/Paint_thinner" rel="nofollow noreferrer">paint thinner</a>. </p> <p>I ran out of acetone for one refurbishment so I tried thinner and white (cleaning) spirit; the latter option did not work well. However, thinner worked very well. I got a bottle of "thinner" at the hardware store's house brand and found it to be more aggressive stuff than turpentine or acetone. I had tried those latter 2 but found that "thinner" works best.</p> <p>Putting the thinner fluid on paper cloth directly to clean the glue did not work well. I applied the thinner directly onto the glue (splash it on), waited for a while to let it soak in to weaken the bonds after which you can remove it with a spatula and kitchen paper towel.</p> <p>The exact contents of paint thinners are not always available but they contain various hydrocarbons.</p>
<p>Cleaning up the aluminium build platform was rather easy in a three step process as I figured out:</p> <h3>Preparation</h3> <p>Get the old bed-surface off and any film layers that stick to the original glue. Don't bother to try to scrape off the glue, it is wasted time.</p> <h3>Solvent</h3> <p>To remove the sticker's residue, I first tried heat and 70% isopropyl alcohol (aka isopropanol, 2-propanol), which was not very effective. </p> <p>What did prove effective was nail-polish remover on the base of <strong>acetone</strong>. It worked like a charm to turn the sticky film into easily removable, goopy clumps. With small doses and a lot of rubbing/massaging it into the residue and careful use of the scraper, all the glue was gone after about half to three-quarters of an hour of work.</p> <p>In subsequent replacement, I used <strong>paint thinner</strong>, which is more effective in goopifying the glue and allowing to scrape it off much faster. 10 minutes max.</p> <h3>Cleanup</h3> <p>After applying the generous amounts of nail polish remover, I thought that it might be best to get any of the additives that were meant to protect the skin off the bed - as well as the slight blue coloring - before applying the new tape. So I gave the aluminium a good wipe down with isopropanol.</p> <p>In subsequent replacements I used ethanol 98 % to clean the bed before applying, just to make sure no fingerprints or glue residue creates bumps.</p> <p>Applying the new bed surface was easy afterwards, and after a quick bed leveling, the printer runs like a charm again.</p>
1,178
<p><strong>My Goal</strong></p> <p>I would like to have a main processing thread (non GUI), and be able to spin off GUIs in their own background threads as needed, and having my main non GUI thread keep working. Put another way, I want my main non GUI-thread to be the owner of the GUI-thread and not vice versa. I'm not sure this is even possible with Windows Forms(?)</p> <p><strong>Background</strong></p> <p>I have a component based system in which a controller dynamically load assemblies and instantiates and run classes implementing a common <code>IComponent</code> interface with a single method <code>DoStuff()</code>.</p> <p>Which components that gets loaded is configured via a xml configuration file and by adding new assemblies containing different implementations of <code>IComponent</code>. The components provides utility functions to the main application. While the main program is doing it's thing, e.g. controlling a nuclear plant, the components might be performing utility tasks (in their own threads), e.g. cleaning the database, sending emails, printing funny jokes on the printer, what have you. What I would like, is to have one of these components be able to display a GUI, e.g. with status information for the said email sending component.</p> <p>The lifetime of the complete system looks like this</p> <ol> <li>Application starts.</li> <li>Check configuration file for components to load. Load them.</li> <li><strong>For each component, run <code>DoStuff()</code> to initialize it and make it live its own life in their own threads.</strong></li> <li>Continue to do main application-thingy king of work, forever.</li> </ol> <p>I have not yet been able to successfully perform point 3 if the component fires up a GUI in <code>DoStuff()</code>. It simply just halts until the GUI is closed. And not until the GUI is closed does the program progress to point 4.</p> <p>It would be great if these components were allowed to start up their own Windows Forms GUIs.</p> <p><strong>Problem</strong></p> <p>When a component tries to fire up a GUI in <code>DoStuff()</code> (the exact line of code is when the component runs <code>Application.Run(theForm)</code>), the component and hence our system "hangs" at the <code>Application.Run()</code> line until the GUI is closed. Well, the just fired up GUI works fine, as expected.</p> <p>Example of components. One hasn't nothing to do with GUI, whilst the second fires up a cute windows with pink fluffy bunnies in them.</p> <pre><code>public class MyComponent1: IComponent { public string DoStuff(...) { // write something to the database } } public class MyComponent2: IComponent { public void DoStuff() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form()); // I want the thread to immediately return after the GUI // is fired up, so that my main thread can continue to work. } } </code></pre> <p>I have tried this with no luck. Even when I try to fire up the GUI in it's own thread, the execution halts until the GUI as closed.</p> <pre><code>public void DoStuff() { new Thread(ThreadedInitialize).Start() } private void ThreadedInitialize() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form()); } </code></pre> <p>Is it possible to spin off a GUI and return after <code>Application.Run()</code>?</p>
<p><strong>Application.Run</strong> method displays one (or more) forms and initiates the standard message loop which runs until all the forms are closed. You cannot force a return from that method except by closing all your forms or forcing an application shutdown.</p> <p>You can, however, pass an <strong>ApplicationContext</strong> (instad of a new Form()) to Application.Run method and ApplicationContext can be used to launch several forms at once. Your application will only end when all of those are closed. See here: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.run.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.application.run.aspx</a></p> <p>Also, any forms that you Show non-modally will continue to run alongside your main form, which will enable you to have more than one windows that do not block each other. I believe this is actually what you are trying to accomplish.</p>
<p>I'm sure this is possible if you hack at it hard enough, but I'd suggest it is not a good idea.</p> <p>'Windows' (that you see on the screen) are highly coupled to processes. That is, each process which displays any GUI is expected to have a Message Loop, which processes all of the messages which are involved with creating and managing windows (things like 'clicked the button', 'closed the app', 'redraw the screen' and so on.</p> <p>Because of this, it is more or less assumed that if you have any message loop, it must be available for the lifetime of your process. For example windows might send you a 'quit' message, and you need to have a message loop available to handle that, even if you've got nothing on the screen.</p> <p>Your best bet is do it like this:</p> <p>Make a fake form which is never shown which is your 'main app' Start up Call Application.Run and pass in this fake form. Do your work in another thread, and fire events at the main thread when you need to do Gui stuff.</p>
2,501
<p>I remember watching a webcast from Mark Russinovich showing the sequence of keyboard keys for a user initiated kernel dump. Can somebody refresh my memory on the exact order of the keys.</p> <p>Please note this is for XP.</p>
<p><a href="http://psacake.com/web/jr.asp" rel="nofollow noreferrer">http://psacake.com/web/jr.asp</a> contains full instructions, and here's an excerpt:</p> <pre> While it may seem odd to think about purposefully causing a Blue Screen Of Death (BSOD), Microsoft includes such a provision in Windows XP. This might come in handy for testing and troubleshooting your Startup And Recovery settings, Event logging, and for demonstration purposes. Here's how to create a BSOD: Launch the Registry Editor (Regedit.exe). Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters. Go to Edit, select New | DWORD Value and name the new value CrashOnCtrlScroll. Double-click the CrashOnCtrlScroll DWORD Value, type 1 in the Value Data textbox, and click OK. Close the Registry Editor and restart Windows XP. When you want to cause a BSOD, press and hold down the [Ctrl] key on the right side of your keyboard, and then tap the [ScrollLock] key twice. Now you should see the BSOD. If your system reboots instead of displaying the BSOD, you'll have to disable the Automatically Restart setting in the System Properties dialog box. To do so, follow these steps: Press [Windows]-Break. Select the Advanced tab. Click the Settings button in the Startup And Recovery panel. Clear the Automatically Restart check box in the System Failure panel. Click OK twice. Here's how you remove the BSOD configuration: Launch the Registry Editor (Regedit.exe). Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters. Select the CrashOnCtrlScroll value, pull down the Edit menu, and select the Delete command. Close the Registry Editor and restart Windows XP. Note: Editing the registry is risky, so make sure you have a verified backup before making any changes. </pre> <p>And I may be wrong in assuming you want BSOD, so this is a Microsoft Page showing how to capture kernel dumps: <a href="https://web.archive.org/web/20151014034039/https://support.microsoft.com/fr-ma/kb/316450" rel="nofollow noreferrer">https://web.archive.org/web/20151014034039/https://support.microsoft.com/fr-ma/kb/316450</a></p>
<p>I don't know of any keyboard short cuts, but are you looking for like in task manager, when you right click on a process and select "Create Dump"?</p>
8,388
<p>Let me use the following example to explain my question:</p> <pre class="lang-csharp prettyprint-override"><code>public string ExampleFunction(string Variable) { return something; } string WhatIsMyName = &quot;Hello World&quot;; string Hello = ExampleFunction(WhatIsMyName); </code></pre> <p>When I pass the variable <code>WhatIsMyName</code> to the <code>ExampleFunction</code>, I want to be able to get a string of the <em>original</em> variable's name. Perhaps something like:</p> <pre class="lang-csharp prettyprint-override"><code>Variable.OriginalName.ToString() // == &quot;WhatIsMyName&quot; </code></pre> <p>Is there any way to do this?</p>
<p>What you want isn't possible directly but you can use Expressions in C# 3.0:</p> <pre><code>public void ExampleFunction(Expression&lt;Func&lt;string, string&gt;&gt; f) { Console.WriteLine((f.Body as MemberExpression).Member.Name); } ExampleFunction(x =&gt; WhatIsMyName); </code></pre> <p>Note that this relies on unspecified behaviour and while it does work in Microsoft’s current C# and VB compilers, <strong>and</strong> in Mono’s C# compiler, there’s no guarantee that this won’t stop working in future versions.</p>
<p><strong>No.</strong> I don't think so.</p> <p>The variable name that you use is for your convenience and readability. The compiler doesn't need it &amp; just chucks it out if I'm not mistaken.</p> <p>If it helps, you could define a new class called <code>NamedParameter</code> with attributes <code>Name</code> and <code>Param</code>. You then pass this object around as parameters.</p>
9,770
<blockquote> <p>What's the best way to make an element of 100% minimum height across a wide range of browsers ?</p> </blockquote> <p>In particular if you have a layout with a <code>header</code> and <code>footer</code> of fixed <code>height</code>,</p> <p>how do you make the middle content part fill <code>100%</code> of the space in between with the <code>footer</code> fixed to the bottom ?</p>
<p>I am using the following one: <a href="http://www.xs4all.nl/~peterned/examples/csslayout1.html" rel="noreferrer">CSS Layout - 100 % height</a></p> <blockquote> <p><strong>Min-height</strong></p> <p>The #container element of this page has a min-height of 100%. That way, if the content requires more height than the viewport provides, the height of #content forces #container to become longer as well. Possible columns in #content can then be visualised with a background image on #container; divs are not table cells, and you don't need (or want) the physical elements to create such a visual effect. If you're not yet convinced; think wobbly lines and gradients instead of straight lines and simple color schemes. </p> <p><strong>Relative positioning</strong></p> <p>Because #container has a relative position, #footer will always remain at its bottom; since the min-height mentioned above does not prevent #container from scaling, this will work even if (or rather especially when) #content forces #container to become longer. </p> <p><strong>Padding-bottom</strong></p> <p>Since it is no longer in the normal flow, padding-bottom of #content now provides the space for the absolute #footer. This padding is included in the scrolled height by default, so that the footer will never overlap the above content.</p> <p>Scale the text size a bit or resize your browser window to test this layout. </p> </blockquote> <pre class="lang-css prettyprint-override"><code>html,body { margin:0; padding:0; height:100%; /* needed for container min-height */ background:gray; font-family:arial,sans-serif; font-size:small; color:#666; } h1 { font:1.5em georgia,serif; margin:0.5em 0; } h2 { font:1.25em georgia,serif; margin:0 0 0.5em; } h1, h2, a { color:orange; } p { line-height:1.5; margin:0 0 1em; } div#container { position:relative; /* needed for footer positioning*/ margin:0 auto; /* center, not in IE5 */ width:750px; background:#f0f0f0; height:auto !important; /* real browsers */ height:100%; /* IE6: treaded as min-height*/ min-height:100%; /* real browsers */ } div#header { padding:1em; background:#ddd url("../csslayout.gif") 98% 10px no-repeat; border-bottom:6px double gray; } div#header p { font-style:italic; font-size:1.1em; margin:0; } div#content { padding:1em 1em 5em; /* bottom padding for footer */ } div#content p { text-align:justify; padding:0 1em; } div#footer { position:absolute; width:100%; bottom:0; /* stick to bottom */ background:#ddd; border-top:6px double gray; } div#footer p { padding:1em; margin:0; } </code></pre> <p>Works fine for me.</p>
<p>just share what i've been used, and works nicely</p> <pre><code>#content{ height: auto; min-height:350px; } </code></pre>
4,486
<p>I am currently working on (or at least planning) a couple of projects that work with large amounts of repetitive data. The kind of data that works well in a spreadsheet or database, but is nasty in XML. :)</p> <p>NetCDF seems like a great option for a file format. However, my work is in C# and there is no "official" NetCDF implementation available. There is an "official" Python version that I could potentially use with IronPython. Another option is the "NetCDF Library for .Net" on CodePlex but it seems pretty quiet (<a href="http://www.codeplex.com/netcdf" rel="noreferrer">http://www.codeplex.com/netcdf</a>).</p> <p>Has anyone worked with either of these libraries? Can you provide any recommendations?</p>
<p>First, are you sure that NetCDF is the right choice? If you want to interact with other programs that need to read in large amounts of data and they already support NetCDF, then it's probably a great choice. There aren't that many standard and well-supported file formats that support large multidimensional arrays. But if you're only going to be reading and writing files from C#, it may not be such a good choice.</p> <p>I'm a big fan of the "classic" NetCDF file format. It's compact and extremely simple, but flexible enough to support lots of common kinds of multidimensional well-structured data. It only took me one day to write a complete parser for classic NetCDF, and it only took an hour to write a program to output a well-formed special case of a classic NetCDF file. You could implement a pure C# NetCDF library yourself and it wouldn't be much trouble. You could easily start by implementing only the features you need. <a href="http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/NetCDF-Classic-Format.html" rel="noreferrer">Here's the specification.</a></p> <p>Unfortunately, NetCDF-4 chose to use HDF-5 as its data format. It adds a lot of complexity and makes it much more difficult to write a complete NetCDF parser in another language. HDF-5 is very general-purpose and in my opinion, it was overengineered - it tries to be too many things to too many people. I would not recommend trying to work with it directly unless you plan to spend a month writing unit tests. If you must use netCDF-4 / HDF-5 from C#, your only realistic option would be to wrap the C library using SWIG or something like that.</p> <p>Note that NetCDF for Python is just a wrapper around the C code, so it's not really all that helpful; if you're going to use a wrapped C library you may as well just write a C# wrapper rather than use Python as a middle layer.</p>
<p>In a project we are using the ucar netcdf implementation in c# using ikvm. IKVM can be used to 'convert' java projects into .Net libraries without a use for java VM. I have not done any performance check but it is a simple way to get netcdf in c# :).</p> <p><a href="http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp" rel="nofollow noreferrer">http://www.ikvm.net/stories.html</a></p> <p><a href="http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp" rel="nofollow noreferrer">http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp</a></p>
8,484
<p>Is there a maximum number of inodes in a single directory? </p> <p>I have a directory of over 2 million files and can't get the <code>ls</code> command to work against that directory. So now I'm wondering if I've exceeded a limit on inodes in Linux. Is there a limit before a 2^64 numerical limit?</p>
<p><code>df -i</code> should tell you the number of inodes used and free on the file system.</p>
<p>Another option is <a href="http://www.gnu.org/software/findutils/" rel="nofollow noreferrer"><code>find</code></a>:</p> <p><code>find . -name * -exec somcommands {} \;</code></p> <p><code>{}</code> is the absolute filepath.</p> <p>The advantage/disadvantage is that the files are processed one after each other.</p> <p><code>find . -name * &gt; ls.txt</code></p> <p>would print all filenames in <code>ls.txt</code> </p> <p><code>find . -name * -exec ls -l {} \; &gt; ls.txt</code></p> <p>would print all information form ls for each file in <code>ls.txt</code></p>
6,160
<p>I'm using <code>ByteBuffers</code> and <code>FileChannels</code> to write binary data to a file. When doing that for big files or successively for multiple files, I get an <code>OutOfMemoryError</code> exception. I've read elsewhere that using <code>Bytebuffers</code> with NIO is broken and should be avoided. Does any of you already faced this kind of problem and found a solution to efficiently save large amounts of binary data in a file in java?</p> <p>Is the jvm option <code>-XX:MaxDirectMemorySize</code> the way to go?</p>
<p>I would say don't create a huge ByteBuffer that contains ALL of the data at once. Create a much smaller ByteBuffer, fill it with data, then write this data to the FileChannel. Then reset the ByteBuffer and continue until all the data is written.</p>
<p>The previous two responses seem pretty reasonable. As for whether the command line switch will work, it depends how quickly your memory usage hits the limit. If you don't have enough ram and virtual memory available to at least triple the memory available, then you will need to use one of the alternate suggestions given.</p>
4,830
<p>I had a friend request that I print out the Bathymetry of Lake Michigan as a gift for her PhD adviser. I went to NOAA and the site had a few files for the Bathymetry of Lake Michigan.</p> <p>Files and types are located here: <a href="http://www.ngdc.noaa.gov/mgg/greatlakes/michigan.html" rel="noreferrer">http://www.ngdc.noaa.gov/mgg/greatlakes/michigan.html</a> </p> <p>I am trying to convert this into an STL file to print in my 3D printer however I am having no luck in converting this into a mesh I can use. I have tried multiple approaches with the different files that are listed but cannot seem to get it to properly convert to a mesh. I have tried the following so far:</p> <p>-Import an .xyz file into MeshLab to convert it to an STL. After I import it looks like nothing imported and I can't navigate around in the file</p> <p>-Import an ASC file into MeshLab to convert it to an STL. After I import it, I get no errors but the output is a long, thin mesh that looks nothing like lake Michigan</p> <p>-Just for a test, I imported the .xyz file into Autodesk ReCap just to see what would happen. I noticed that the points were in a long thin area similar to the ASC import but as I browsed around I noticed that the each layer of dots was the actual Bathymetry contours.</p> <p>I have tried multiple approaches and software beyond these but can't seem to get the files to convert into a printable mesh that I can manipulate to send to my 3D printer.</p>
<p>In order to properly get an STL file out of a point cloud, you'll need some tool to help triangulate the points to create proper shell surfaces. The shell that is created in an STL is what the slicing engine will &quot;slice&quot;.</p> <p>I'm not as familiar with the full potential of MeshLab, but I would think this tool is best suited for files that at least have most of shell already in place. Essentially best for fixing STL's.</p> <p>In the past, I've used (the very expensive) Unigraphics NX8. This CAD/CAM software is very powerful and has tools for creating meshes out of point clouds. I believe it was the <a href="https://www.google.com/?gws_rd=ssl#q=unigraphics%20nx8%20sew" rel="nofollow noreferrer">sew tool</a> that allowed me to do this in the past (I no longer have access to the software). Other CAD programs such as SolidWorks, Rhino, AutoCAD, etc. might have similar features.</p> <p>Alternatively, I think it looks like you might be able to convert a 3D point cloud in SketchUp. If the cloud is layered by height and each layer had points on the same -Z- plane, then you might be able to automate creating lines between the nearest points on the same plane. Then it might just take a little bit of manual labor to &quot;fix&quot; the model to become 3D printing ready. Also check out <a href="http://sketchucation.com/forums/viewtopic.php?f=79&amp;t=56135" rel="nofollow noreferrer">this forum post</a>, it looks like someone had luck in converting terrain point clouds.</p> <p>Completely alternatively, have you considered converting an image to STL? I've done this many times before and it turns out quite nicely. If you can find topographical map of the lake, you could alter the image into grayscale (play with it a bit). Then use <a href="http://www.thingiverse.com/thing:66115" rel="nofollow noreferrer">software</a> to convert the grayscale image to STL.</p>
<p>You can do this using MATLAB, or possibly Octave (the open-source version of MATLAB). I'm doing this right now to print a globe with exaggerated topography and bathymetry. MATLAB has tons of tools for importing data. I'm sure you can import the Lake Michigan bathymetry data, though you may have to hunt for an importing script on the MATLAB exchange. </p> <p>As long as you can get your data imported as a 2D matrix of X, Y and Z values, you can use the <code>surf2stl()</code> function by Bill McDonald, available here: </p> <p><a href="https://www.mathworks.com/matlabcentral/fileexchange/4512-surf2stl" rel="nofollow noreferrer">https://www.mathworks.com/matlabcentral/fileexchange/4512-surf2stl</a></p> <p>This creates an STL you can use. Note that it's just a surface, so you'll need to give it depth some other way so your printed object isn't paper-thin. </p>
215
<p>I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them.</p> <p>I think this <a href="http://www.ddj.com/cpp/184406207" rel="nofollow noreferrer">hybrid of linked list and hash map</a> should do the job, but before I tried to use <code>std::tr1::unordered_map</code> thinking that it was working in that way I described, but it wasn't. So could someone explain me the meaning and behavior of <code>unordered_map</code>?</p> <hr> <p>@wesc: I'm sure std::map is implemented by STL, while I'm sure std::hash_map is NOT in the STL (I think older version of Visual Studio put it in a namespace called stdext).</p> <p>@cristopher: so, if I get it right, the difference is in the implementation (and thus performances), not in the way it behaves externally.</p>
<p>You've asked for the canonical reason why Boost::MultiIndex was made: list insertion order with fast lookup by key. <a href="http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/tutorial/basics.html#list_fast_lookup" rel="nofollow noreferrer">Boost MultiIndex tutorial: list fast lookup</a></p>
<p>@wesc: STL has std::map... so what's the difference with unordered_map? I don't think STL would implement twice the same thing and call it differently.</p>
5,655
<p>I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net?</p> <p><strong>EDIT:</strong> I found this and thought it was interesting: <a href="http://weblogs.asp.net/jgalloway/archive/2006/10/29/Showing-a-Connection-String-prompt-in-a-WinForm-application.aspx" rel="nofollow noreferrer">Showing a Connection String prompt in a WinForm application</a>. This only works for SQL Server connections though.</p>
<p>You might want to try using <a href="http://msdn.microsoft.com/en-us/magazine/cc163409.aspx" rel="nofollow noreferrer">SQL Server Management Objects</a>. This MSDN article has a good sample for prompting and connecting to a SQL server.</p>
<p>The only "built in" connection string functionality that I could think of is the one that comes up when you run a CMD script (essentially a batch file) that runs SQL scripts. However I'm not sure if it's something built into Visual Studio.</p> <p>It's really simple to make one anyway. If you don't want the user to be able to input a straight-out connection string, you can put together one made up of four textboxes and a checkbox:</p> <ul> <li>Server</li> <li>Catalog Name</li> <li>checkbox for integrated security or SQL Authentication</li> <li>Username</li> <li>Password</li> </ul> <p>Fairly trivial, IMHO.</p>
7,663
<p>I have a table in a SQL Server 2005 database with a trigger that is supposed to add a record to a different table whenever a new record is inserted. It seems to work fine, but if I execute an Insert Into on the master table that uses a subquery as the source of the values, the trigger only inserts one record in the other table, even though multiple records were added to the master. I want the trigger to fire for each new record added to the master table. Is that possible in 2005?</p> <p>The insert I'm doing is:</p> <pre><code>INSERT INTO [tblMenuItems] ([ID], [MenuID], [SortOrder], [ItemReference], [MenuReference], [ConcurrencyID]) SELECT [ID], [MenuID], [SortOrder], [ItemReference], [MenuReference], [ConcurrencyID] FROM [IVEEtblMenuItems] </code></pre> <p>Here is what the trigger looks like:</p> <pre><code>CREATE TRIGGER [dbo].[tblMenuItemInsertSecurity] ON [dbo].[tblMenuItems] FOR INSERT AS Declare @iRoleID int Declare @iMenuItemID int Select @iMenuItemID = [ID] from Inserted DECLARE tblUserRoles CURSOR FASTFORWARD FOR SELECT [ID] from tblUserRoles OPEN tblUserRoles FETCH NEXT FROM tblUserRoles INTO @iRoleID WHILE (@@FetchStatus = 0) BEGIN INSERT INTO tblRestrictedMenuItems( [RoleID], [MenuItemID], [RestrictLevel]) VALUES( @iRoleID, @iMenuItemID, 1) FETCH NEXT FROM tblUserRoles INTO @iRoleID END CLOSE tblUserRoles Deallocate tblUserRoles </code></pre>
<p>Your trigger is only using the first row from 'Inserted'. This is a common misunderstanding when dealing with SQL triggers for the first time. The trigger fires per update not per row.</p> <p>For example if you do the following:-</p> <p>update products set title = 'geoff de geoff'</p> <p>this would update all the products, but a trigger on the product table would only fire once.</p> <p>The Inserted 'table' you get in trigger would contain all the rows. You must either loop through Inserted with a cursor, or better join Inserted to the table you are updating.</p>
<p>I just want to second @Gordon Bell on his answer...</p> <p>"Catch" the values the very moment they are being inserted. You do not really need the cursor in this situation (or maybe you have a reason?).</p> <p>A simple TRIGGER might be all you need:</p> <p><a href="http://dbalink.wordpress.com/2008/06/20/how-to-sql-server-trigger-101/" rel="nofollow noreferrer">http://dbalink.wordpress.com/2008/06/20/how-to-sql-server-trigger-101/</a> </p>
3,882
<p>What follows is a regular expression I have written to match multi-line pre-processor macros in C / C++ code. I'm by no means a regular expressions guru, so I'd welcome any advice on how I can make this better.</p> <p>Here's the regex:</p> <pre><code>\s*#define(.*\\\n)+[\S]+(?!\\) </code></pre> <p>It should match all of this:</p> <pre><code>#define foo(x) if(x) \ doSomething(x) </code></pre> <p>But only some of this (shouldn't match the next line of code:</p> <pre><code>#define foo(x) if(x) \ doSomething(x) normalCode(); </code></pre> <p>And also shouldn't match single-line preprocessor macros.</p> <p>I'm pretty sure that the regex above works - but as I said, there probably a better way of doing it, and I imagine that there are ways of breaking it. Can anyone suggest any?</p>
<p>This is a simple test program I knocked up:</p> <pre><code>#!/usr/bin/env python TEST1=""" #include "Foo.h" #define bar foo\\ x #include "Bar.h" """ TEST2=""" #define bar foo #define x 1 \\ 12 \\ 2 \\\\ 3 Foobar """ TEST3=""" #define foo(x) if(x) \\ doSomething(x) """ TEST4=""" #define foo(x) if(x) \\ doSomething(x) normalCode(); """ import re matcher = re.compile(r"^[ \t]*#define(.*\\\n)+.*$",re.MULTILINE) def extractDefines(s): mo = matcher.search(s) if not mo: print mo return print mo.group(0) extractDefines(TEST1) extractDefines(TEST2) extractDefines(TEST3) extractDefines(TEST4) </code></pre> <p>The re I used:</p> <pre><code>r"^[ \t]*#define(.*\\\n)+.*$" </code></pre> <p>Is very similar to the one use used, the changes:</p> <ol> <li>[ \t] To avoid newlines at the start of the define.</li> <li>I rely on + being greedy, so I can use a simple .*$ at the end to get the first line of the define that doesn't end with \</li> </ol>
<pre><code>start = r"^\s*#define\s+" continuation = r"(?:.*\\\n)+" lastline = r".*$" re_multiline_macros = re.compile(start + continuation + lastline, re.MULTILINE) </code></pre>
8,569
<p>I'm evaluating Server 2008. My C++ executable is getting this error. I've seen this error on MSDN that seems to have required a hot-fix for several previous OSes. Anyone else seen this? I get the same results for the 32 &amp; 64 bit OS.</p> <p>Code snippet:</p> <pre><code>HRESULT GroupStart([in] short iClientId, [in] VARIANT GroupDataArray, [out] short* pGroupInstance, [out] long* pCommandId); </code></pre> <p>Where the GroupDataArray VARIANT argument wraps a single-dimension SAFEARRAY of VARIANTs wrapping a DCAPICOM_GroupData struct entries:</p> <pre><code>// DCAPICOM_GroupData [ uuid(F1FE2605-2744-4A2A-AB85-1E1845C280EB), helpstring("removed") ] typedef struct DCAPICOM_GroupData { [helpstring("removed")] long m_lImageID; [helpstring("removed")] unsigned char m_ucHeadID; [helpstring("removed")] unsigned char m_ucPlateID; } DCAPICOM_GroupData; </code></pre>
<p>We ran into the same error recently with a client/server app communicating via DCOM. It turned out that the size of a marshalled interface pointer going across the wire (i.e., not local) had changed (gotten bigger). You might like to check whether your code is doing any special marshalling via CoMarshalInterface or the like.</p>
<p>We ran into the same error recently with a client/server app communicating via DCOM. It turned out that the size of a marshalled interface pointer going across the wire (i.e., not local) had changed (gotten bigger). You might like to check whether your code is doing any special marshalling via CoMarshalInterface or the like.</p>
9,086
<p>When 3D Printing moves into public beta, you're going to want to get the word out. And fast! One of the best ways to advertise ourselves across the entire Stack Exchange network is through community ads. </p> <h3>So what are these "Community Ads?"</h3> <p>Graduated sites allow the community to advertise relevant products or services within the site, using a system where the community chooses what to advertise. You can find these posts on per-site metas. Hint: these posts have the <a href="/questions/tagged/community-ads" class="post-tag moderator-tag" title="show questions tagged &#39;community-ads&#39;" rel="tag">community-ads</a> tag!</p> <h3>Cool! What should the ad be like?</h3> <p>There's a few requirements for these ads. Most notably,</p> <ul> <li>They must be 300px wide by 250px tall, or double for "retina" displays</li> <li>There's a limit on file size of 150 kB.</li> <li>The image must be hosted on i.stack.imgur (the Stack Exchange image hosting service).</li> <li>Ads must be GIF or PNG (no animated GIFs).</li> </ul> <h3>What else should I know?</h3> <p>To facilitate easy posting to other sites, make sure that the embedded image is of the following format:</p> <pre>[![Tagline to show on mouseover][1]][2] [1]: http://image-url [2]: http://clickthrough-url </pre> <p>You can also include a message as a part of your answer with your own thoughts: why you chose some of the elements, and what sites the ads could potentially be posted to. Don't forget to critique each other as well!</p> <p><strong>Happy Designing!</strong></p>
<p>I'll try my hand at it and try to get the ball rolling.</p> <p><a href="https://3dprinting.stackexchange.com/"><img src="https://i.stack.imgur.com/CBJNE.png" alt="Been here?"></a></p>
<p>As mentioned, here's one related to the <a href="http://www.thingiverse.com/thing:30808" rel="nofollow noreferrer"><strong>Occupy Thingiverse</strong></a> movement. It's simple, but it has a bit of history within the 3D printing community.</p> <p><a href="https://i.stack.imgur.com/9vUg7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vUg7.png" alt="enter image description here"></a></p>
16
<p>Let's say I want to run a .NET application on a machine where the .NET framework is not available; Is there any way to compile the application to native code?</p>
<p>Microsoft has an article describing how you can <a href="http://msdn.microsoft.com/en-us/library/ht8ecch6(VS.71).aspx" rel="noreferrer">Compile MSIL to Native Code</a></p> <p>You can use <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf.aspx" rel="noreferrer">Ngen</a>.</p> <blockquote> <p>The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.</p> </blockquote> <p>Unfortunately, you still need the libraries from the framework in order to run your program. There's no feature that I know of with the MS .Net framework SDK that allows you to compile all the required files into a single executable</p>
<p>I think it's not possible. You will need to distribute .NET FW as well. If you want to compile .NET app to native code, use NGen <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf.aspx" rel="nofollow noreferrer">tool</a></p>
6,769
<p>I have a need to create a "transactional" process using an external API that does not support COM+ or .NET transactions (Sharepoint to be exact)</p> <p>What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will have to manually undo all of the previous steps. In my case there are only 2 types of step, both af which are fairly easy to undo/roll back.</p> <p>Does anyony have any suggestions for design patterns or structures that could be usefull for this ?</p>
<p>If your changes are done to the SharePoint object model, you can use the fact that changes are not committed until you call the <code>Update()</code> method of the modified object, such as <code>SPList.Update()</code> or <code>SPWeb.Update()</code>.</p> <p>Otherwise, I would use the <em>Command</em> Design Pattern. Chapter 6 in <a href="https://rads.stackoverflow.com/amzn/click/com/0596007124" rel="nofollow noreferrer" rel="nofollow noreferrer">Head First Design Patterns</a> even has an example that implements the undo functionality.</p>
<p>You might want to have a look at the Compensating Resource Manager:</p> <p><a href="http://msdn.microsoft.com/en-us/library/8xkdw05k(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/8xkdw05k(VS.80).aspx</a></p>
4,217
<p>I have a wrapper around a C++ function call which I call from C# code. How do I attach a debugger in Visual Studio to step into the native C++ code?</p> <p>This is the wrapper that I have which calls GetData() defined in a C++ file:</p> <pre><code> [DllImport("Unmanaged.dll", CallingConvention=CallingConvention.Cdecl, EntryPoint = "GetData", BestFitMapping = false)] public static extern String GetData(String url); </code></pre> <p>The code is crashing and I want to investigate the root cause.</p> <p>Thanks, Nikhil</p>
<p>Check the Debug tab on your project's properties page. There should be an "Enable unmanaged code debugging" checkbox. This worked for me when we developed a new .NET UI for our old c++ DLLs.</p> <p>If your unmanaged DLL is being built from another project (for a while ours were being built using VS6) just make sure you have the DLL's pdb file handy for the debugging.</p> <p>The other approach is to use the C# exe as the target exe to run from the DLL project, you can then debug your DLL normally.</p>
<p>To anyone using WinDbg:</p> <p>1>Setup symbols</p> <p>Look at these commands. (Help: in console .hh &lt; command> )</p> <pre><code>.sympath .sympath+ .symfix </code></pre> <p>2>Set up source path</p> <pre><code>.srcpath </code></pre> <p>3>Load SOS extention to debug managed / mixed mode programs.</p> <p>(Make sure you have extention path setup correctly)</p> <p>Add Microsoft.NET\Framework\v2.0.50727 for x86 using-</p> <pre><code>.extpath </code></pre> <p>Set a breakpoint for the clr to load.</p> <pre><code>sxe ld:mscorwks </code></pre> <p>(F5 / g) (Wait for ModLoad BP on mscorwks.dll)</p> <p>Make sure you dont have a duplicate sos extention already loaded. See:</p> <pre><code>.chain </code></pre> <p>Now we're ready to load the sos extention. :)</p> <pre><code>.loadby sos mscorwks </code></pre> <p>4> Reload all the symbols..</p> <pre><code>.reload </code></pre> <p>Now you're all set :)</p> <p>(YMMV)</p>
8,224
<p>I have a noobish question for any graphics programmer.</p> <p>I am confused how some games (like Crysis) can support both DirectX 9 (in XP) and 10 (in Vista)?</p> <p>What I understand so far is that if you write a DX10 app, then it can only runs in Vista.</p> <p>Maybe they have 2 code bases -- one written in DX9 and another in DX10? But isn't that an overkill?</p>
<p>They have two rendering pipelines, one using DX9 calls and one using DX10 calls. The APIs are not compatible, though a majority of any game engine can be reused for either. If you want some Open Source examples of how different rendering pipelines are done, look at something like Ogre3d, which supports OpenGL, DX9, and (soon)DX10 rendering.</p>
<p>It is likely that they have an abstraction layer and they develop against that. At run-time they instantiate the DX9 or DX10 wrapping concrete engines.</p> <p>I imagine their abstraction is positioned very close to the DirectX layer and simply provides DX9 with sensible manual implementations of DX10 functions or enhances DX9 logic when running on DX10.</p>
9,165
<p>I've seen a lot of commonality in regex capabilities of different regex-enabled tools/languages (e.g. perl, sed, java, vim, etc), but I've also many differences.</p> <p>Is there a <em>standard</em> subset of regex capabilities that all regex-enabled tools/languages will support? How do regex capabilities vary between tools/languages?</p>
<p>Compare Regular Expression Flavors</p> <p><a href="http://www.regular-expressions.info/refflavors.html" rel="noreferrer">http://www.regular-expressions.info/refflavors.html</a></p>
<p>There's no standard engine. However, the POSIX Extended Regular Expression format is a valid subset of most engines and is probably as close as you'll get to a standardised subset.</p>
4,987
<p>Is there a distributed version control system (git, bazaar, mercurial, darcs etc.) that can handle files larger than available RAM?</p> <p>I need to be able to commit large binary files (i.e. datasets, source video/images, archives), but I don't need to be able to diff them, just be able to commit and then update when the file changes.</p> <p>I last looked at this about a year ago, and none of the obvious candidates allowed this, since they're all designed to diff in memory for speed. That left me with a VCS for managing code and something else ("asset management" software or just rsync and scripts) for large files, which is pretty ugly when the directory structures of the two overlap.</p>
<p>It's been 3 years since I asked this question, but, as of version 2.0 Mercurial includes the <a href="https://www.mercurial-scm.org/wiki/LargefilesExtension" rel="nofollow noreferrer">largefiles extension</a>, which accomplishes what I was originally looking for:</p> <blockquote> <p>The largefiles extension allows for tracking large, incompressible binary files in Mercurial without requiring excessive bandwidth for clones and pulls. Files added as largefiles are not tracked directly by Mercurial; rather, their revisions are identified by a checksum, and Mercurial tracks these checksums. This way, when you clone a repository or pull in changesets, the large files in older revisions of the repository are not needed, and only the ones needed to update to the current version are downloaded. This saves both disk space and bandwidth.</p> </blockquote>
<p>I came to the conclusion that the best solution in this case would be to use the ZFS.</p> <p>Yes ZFS is not a DVCS but:</p> <ul> <li>You can allocate space for repository via creating new FS</li> <li>You can track changes by creating snapshots</li> <li>You can send snapshots (commits) to another ZFS dataset</li> </ul>
9,577
<p>Example: I have two shared objects (same should apply to .dlls). The first shared object is from a third-party library, we'll call it libA.so. I have wrapped some of this with JNI and created my own library, libB.so. Now libB depends on libA.</p> <p>When webstarting, both libraries are places in some webstart working area. My java code attempts to load libB. At this point the system loader will attempt to load libA which is not in the system library path (java.library.path won't help this). The end result is that libB has an unsatisfied link and cannot be used. </p> <p>I have tried loading libA before libB, but that still does not work. Seems the OS wants to do that loading for me. Is there any way I can make this work other than statically compiling?</p>
<p>Static compilation proved to be the only way to webstart multiple dependent native libraries.</p>
<p>Are both native libraries packaged into a <em>signed</em> jar which is listed as</p> <pre><code>&lt;nativelib ...&gt; </code></pre> <p>In the JNLP file?</p>
2,664
<p>I need to reformat my machine but I have so many user/passwords stored in FF2 that I just keep putting it off. Yes I know about backing up the entire profile and restoring it. But for some reason my profile has many issues and I want to start fresh with that as well.</p> <p>Are the username and passwords stored in a text file or is there some way to export them and import after I reformat?</p>
<p>There is a Firefox add-on called <a href="https://addons.mozilla.org/en-US/firefox/addon/2848" rel="nofollow noreferrer">Password Exporter</a>. It can export to XML or CSV files that can be imported in another browser or computer.</p>
<p>Alas, this won't solve the re-importing problem, but check out <a href="http://wejn.org/stuff/moz-export.html" rel="nofollow noreferrer">http://wejn.org/stuff/moz-export.html</a></p> <p>They have a single html page with a small javascript section that exports your passwords. Save the html to your desktop, read through to make sure it's not evil, open the page in FF, save the results.</p> <p>Maybe I'm paranoid, but I'm not sure I'd trust a password-exporting extension...</p>
6,161
<p>I have a web application written in C# that consumes several internal web services. We have a development tier, a testing tier, and a production tier. Also, we use the <code>WSDL.exe</code> command to generate a <code>Proxies.cs</code> file for a given tier's web services.</p> <p>When we are ready to deploy our code up the stack from development to test or test to production, we need to run the <code>WSDL.exe</code> command to point to the appropriate version of the web services.</p> <p>Is there a generally accepted way to automate this?</p>
<p>There are a number of way to do it. A NAnt build script will do it, but I think the most commonly accepted method now is to use MSBuild. See <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="nofollow noreferrer">MSDN</a> for details.</p>
<p>Our company uses a combination of NANT + Cruise Control + Custom Utility apps to build our products. More specifically, the <a href="http://nant.sourceforge.net/release/latest/help/tasks/exec.html" rel="nofollow noreferrer"> task</a> in NANT will allow you to fire off those command-line applications such as WSDL.exe</p>
3,856
<p>We are in a stage of creating a prototype of some IoT device with some electric boards and sensors. The device will be connected to the power and the boards inside might be warm a bit.</p> <p>What material whould you recommended to print it? Will you recommend it to production as well? Thanks</p>
<p>Well I got a perfect print as follows:</p> <ol> <li>Loaded the .stl file.</li> <li>Set Cura to use the 'Good' profile downloaded from CHEPCLUB (recommended by a friend).</li> <li>Used <strike>Pritt-stick</strike> Scotch (glue stick) on the bed.</li> </ol> <p>I was quite loath to use glue stick, as I thought heated beds etc didn't need it, but if that's what it takes then...</p> <p>I even bought an enclosure a few days ago as the room the printer was in if fairly cool.</p> <p>I'll try the exact same print without the glue and see if that works but at least I know know that I can get a perfect print and that a good calibration print isn't the be-all and end-all.</p>
<p>For a good adhesion the print bed should be free of any oil or fat. Wipe the print bed with pure alcohol just befor the start of printing.</p>
2,041
<p>I would like to extend some existing applications' drag and drop behavior, and I'm wondering if there is any way to hack on drag and drop support or changes to drag and drop behavior by monitoring the app's message loop and injecting my own messages.</p> <p>It would also work to monitor for when a paste operation is executed, basically to create a custom behavior when a control only supports pasting text and an image is pasted.</p> <p>I'm thinking <a href="http://research.microsoft.com/sn/detours/" rel="nofollow noreferrer">Detours</a> might be my best bet, but one problem is that I would have to write custom code for each app I wanted to extend. If only Windows was designed with extensibility in mind!</p> <p>On another note, is there any OS that supports extensibility of this nature?</p>
<p>My best suggestion would be to create a webservice on each site that the other could call with the information that needs to get passed. If security is necessary, it's easy to add an SSL-like authentication scheme (or actual SSL even, if you like) to this system to ensure that only the two servers are able to talk to their respective web services.</p> <p>This would let you avoid the hackiness that's inherent in any scheme that involves one site opening windows on the other.</p>
<p>@jmein - you've described how to create a modal popup (which is exactly what jqModal does) however you've missed that the content of the modal window is served from another domain. The two domains involved belong to two separate companies so can't be combined in the way you describe.</p>
5,311
<p>What tools/websites do you use to read JavaDocs? </p> <p>I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable.</p> <p>What I would expect from such a tool/website:</p> <ul> <li>Aggregate JavaDocs from different locations</li> <li>Direct access to types like Ctrl+T in Eclipse or similar</li> <li>Fulltext search</li> <li>Cross referencing between all the Java libraries I've chosen</li> <li>For a tool: offline support</li> <li>Speed</li> </ul> <p>not mandatory: </p> <ul> <li>possibility to annotate things</li> <li>support for different versions of a library (+ diffing ?)</li> <li>IDE integration</li> </ul> <p>Edit:</p> <p>Thanks for your answers. I knew most of the sites but gave them another try. Here is my judgement:</p> <ul> <li>built-in Eclipse/IDE features <ul> <li>tightly integrated</li> <li>offline/online support</li> </ul></li> <li><a href="http://www.javadoconline.com" rel="noreferrer"><strike>javadoconline.com</strike></a> (no longer maintained) <ul> <li>works</li> <li>clean looks</li> <li>finds matches in more than one version of the api and allows easy switching</li> <li>simple but working</li> <li>fast</li> </ul></li> <li><a href="http://www.jdocs.com/" rel="noreferrer"><strike>jdocs</strike></a> (offline) <ul> <li>seems very sophisticated</li> <li>sometimes slow</li> <li>some recent versions of libraries seem to be missing (Seam 2.0.0, Hibernate Validators) but it looks like you can add them yourself</li> <li>IDE integration (not tested)</li> <li>wiki style comments to each item</li> </ul></li> <li><a href="http://www.docjar.com/" rel="noreferrer">docjar.com</a> <ul> <li>works</li> <li>fast</li> <li>cluttered UI</li> </ul></li> <li><a href="http://www.teria.com/~koseki/tools/gm/javadoc_isearch/" rel="noreferrer">javadoc_isearch</a> <ul> <li>greasemonkey script for firefox which makes navigating javadocs easier</li> <li>works smooth and perfectly</li> </ul></li> </ul>
<p>If you use Eclipse, it offers support for Javadocs. For example, hovering your mouse over a method call will display a tooltip showing you the Javadoc for that method. Documentation for the core Java classes are supported out of the box. However, if your project uses any additional libraries (JAR files), some configuration is required in order to plug their Javadocs into Eclipse.</p> <ol> <li>Go to the "Java Build Path" section of your project properties.</li> <li>Go to the "Libraries" tab and click the "plus" icon next to the JAR file.</li> <li>Click "Javadoc location", then the "Edit..." button.</li> </ol> <p>This will let you specify where the Javadocs for that JAR are located. It will even let you specify a website URL, so you don't have to download the Javadocs yourself!</p>
<p>Doxygen (<a href="http://www.doxygen.nl/" rel="nofollow noreferrer">http://www.doxygen.nl/</a>) might fit the bill. </p> <p>EDIT: I may have misread your question, doxygen is a tool to generate documentation and models based off your code and javadoc. </p>
9,904
<p>I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sense or another?</p> <p>Update 2/5/09: I've since went along another route in my project. However I did attempt to obtain text using MODI (Microsoft Office Document Imaging). It allows you to OCR an image and pull text from it with some ease.</p>
<p>This is an active area of research. There are literally oodles of academic papers on the subject. It's going to be difficult to give you assistance especially w/o more deatails. Are you looking for specific types of text? Fonts? English-only? Are you familiar with the academic literature? </p> <p>"Text detection" is a standard problem in any OCR (optical character recognition) system and consequently there are lots of bits of code on the interwebs that deal with it. </p> <p>I could start listing piles of links from google but I suggest you just do a search for "text detection" and start reading :). There is ample example code available as well.</p>
<p>If you're ok with using an online API for this, the API at <a href="http://www.wisetrend.com/wisetrend_ocr_cloud.shtml" rel="nofollow noreferrer">http://www.wisetrend.com/wisetrend_ocr_cloud.shtml</a> can do text detection in addition to just OCR.</p>
2,411
<p>I'm interested in finding online APIs where you could perform a call to some third party service with some print preparation request with my model (i.e. "heal a model" or "set up support") and get in return GCODE file I can send to a 3D printer. My input will be :</p> <ul> <li>The 3d model (obj, stl)</li> <li>My printer (makerbot, ultimaker, whatever) or a printer profile</li> <li>A printing profile</li> </ul> <p>This is opposed to all the classical 3D printing processes we have right now. Currently when printing in a 3D printer you would need to go through these phases:</p> <ol> <li>Create/Download a model</li> <li>Prepare the model for printing with some 3rd party desktop software</li> <li>Export the model as gcode</li> <li>Save the file to some flash drive</li> <li>Plug the flash drive into the printer</li> <li>Print the model with the printer interface</li> </ol> <p>I would like to know if this process can be simplified to a point where you can just print your model directly from your web browser without going through all these steps. I know I'm over simplifying things here, but I would still want to see if solutions like I suggested exist?</p> <p>Thanks</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>
118
<p>Since our switch from Visual Studio 6 to Visual Studio 2008, we've been using the MFC90.dll and msvc[pr]90.dlls along with the manifest files in a private side-by-side configuration so as to not worry about versions or installing them to the system.</p> <p>Pre-SP1, this was working fine (and still works fine on our developer machines). Now that we've done some testing post-SP1 I've been pulling my hair out since yesterday morning.</p> <p>First off, our NSIS installer script pulls the dlls and manifest files from the redist folder. These were no longer correct, as the app still links to the RTM version.</p> <p>So I added the define for <code>_BIND_TO_CURRENT_VCLIBS_VERSION=1</code> to all of our projects so that they will use the SP1 DLLs in the redist folder (or subsequent ones as new service packs come out). It took me hours to find this.</p> <p>I've double checked the generated manifest files in the intermediate files folder from the compilation, and they correctly list the 9.0.30729.1 SP1 versions. I've double and triple checked depends on a clean machine: it all links to the local dlls with no errors. </p> <p>Running the app still gets the following error:</p> <blockquote> <blockquote> <p>The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.</p> </blockquote> </blockquote> <p>None of the searches I've done on google or microsoft have come up with anything that relates to my specific issues (but there are hits back to 2005 with this error message).</p> <p>Any one had any similar problem with SP1?</p> <p>Options:<ul> <li>Find the problem and fix it so it works as it should (preferred) <li>Install the redist <li>dig out the old RTM dlls and manifest files and remove the #define to use the current ones. (I've got them in an earlier installer build, since Microsoft blasts them out of your redist folder!)</ul></p> <p><b>Edit:</b> I've tried re-building with the define turned off (link to RTM dlls), and that works as long as the RTM dlls are installed in the folder. If the SP1 dlls are dropped in, it gets the following error:</p> <blockquote> <p>c:\Program Files\...\...\X.exe</p> <p>This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.</p> </blockquote> <p>Has no-one else had to deal with this issue?</p> <p><b>Edit:</b> Just for grins, I downloaded and ran the vcredist_x86.exe for VS2008SP1 on my test machine. <b><i>It</i></b> works. With the SP1 DLLs. And my RTM linked app. But <b>NOT</b> in a private side-by-side distribution that worked pre-SP1.</p>
<p>I have battled this problem myself last week and consider myself somewhat of an expert now ;)</p> <p>I'm 99% sure that not all dlls and static libraries were recompiled with the SP1 version. You need to put</p> <pre><code>#define _BIND_TO_CURRENT_MFC_VERSION 1 #define _BIND_TO_CURRENT_CRT_VERSION 1 </code></pre> <p>into <em>every</em> project you're using. For every project of a real-world size, it's very easy to forget some small lib that wasn't recompiled.</p> <p>There are more flags that define what versions to bind to; it's documented on <a href="http://msdn.microsoft.com/en-us/library/cc664727%28v=vs.90%29.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc664727%28v=vs.90%29.aspx</a> . As an alternative to the lines above, you can also put</p> <pre><code>#define _BIND_TO_CURRENT_VCLIBS_VERSION 1 </code></pre> <p>which will bind to the latest version of all VC libs (CRT, MFC, ATL, OpenMP).</p> <p>Then, check what the embedded manifest says. Download XM Resource Editor: <a href="http://www.wilsonc.demon.co.uk/d10resourceeditor.htm" rel="nofollow noreferrer">http://www.wilsonc.demon.co.uk/d10resourceeditor.htm</a>. Open every dll and exe in your solution. Look under 'XP Theme Manifest'. Check that the 'version' attribute on the right-hand side is '9.0.30729.1'. If it's '9.0.21022', some static library is pulling in the manifest for the old version.</p> <p>What I found is that in many cases, <em>both</em> versions were included in the manifest. This means that some libraries use the sp1 version and others don't.</p> <p>A great way to debug which libraries don't have the preprocessor directives set: temporarily modify your platform headers so that compilation stops when it tries to embed the old manifest. Open C:\Program Files\Microsoft Visual Studio 9.0\VC\crt\include\crtassem.h. Search for the '21022' string. In that define, put something invalid (change 'define' to 'blehbleh' or so). This way, when you're compiling a project where the <code>_BIND_TO_CURRENT_CRT_VERSION</code> preprocessor flag is not set, your compilation will stop and you'll know that you need to add them or made sure that it's applied everywhere.</p> <p>Also make sure to use Dependency Walker so that you know what dlls are being pulled in. It's easiest to install a fresh Windows XP copy with no updates (only SP2) on a virtual machine. This way you know for sure that there is nothing in the SxS folder that is being used instead of the side-by-side dlls that you supplied.</p>
<p>I just remembered another trick that I used to find out which static libraries were ill-behaving: 'grep' through the static libraries for the string '21022'. HOWEVER, don't use the 'normal' grep tools like wingrep because they won't show you these strings (they think it's a binary file and look for the raw, non-unicode string). Use the 'strings' utility from the resource kit (now in the Russinovich site I think). That one will grep through binaries ok. So you let this 'strings' go through your whole source tree and you'll see the binary files (dlls and static libraries) that contain references to the wrong manifest (or to the manifest with the wrong version in it).</p>
8,426
<p>Right now I'm developing mostly in C/C++, but I wrote some small utilities in Python to automatize some tasks and I really love it as language (especially the productivity). </p> <p>Except for the performances (a problem that could be sometimes solved thanks to the ease of interfacing Python with C modules), do you think it is proper for production use in the development of stand-alone complex applications (think for example to a word processor or a graphic tool)?</p> <p>What IDE would you suggest? The IDLE provided with Python is not enough even for small projects in my opinion.</p>
<p>We've used IronPython to build our flagship spreadsheet application (40kloc production code - and it's Python, which IMO means loc per feature is low) at <a href="http://www.resolversystems.com/" rel="noreferrer">Resolver Systems</a>, so I'd definitely say it's ready for production use of complex apps.</p> <p>There are two ways in which this might not be a useful answer to you :-)</p> <ol> <li>We're using IronPython, not the more usual CPython. This gives us the huge advantage of being able to use .NET class libraries. I may be setting myself up for flaming here, but I would say that I've never really seen a CPython application that looked "professional" - so having access to the WinForms widget set was a huge win for us. IronPython also gives us the advantage of being able to easily drop into C# if we need a performance boost. (Though to be honest we have <em>never</em> needed to do that. All of our performance problems to date have been because we chose dumb algorithms rather than because the language was slow.) Using C# from IP is much easier than writing a C Extension for CPython. </li> <li>We're an Extreme Programming shop, so we write tests before we write code. I would not write production code in a dynamic language without writing the tests first; the lack of a compile step needs to be covered by something, and as other people have pointed out, refactoring without it can be tough. (Greg Hewgill's answer suggests he's had the same problem. On the other hand, I don't think I would write - or especially refactor - production code in <em>any</em> language these days without writing the tests first - but YMMV.)</li> </ol> <p>Re: the IDE - we've been pretty much fine with each person using their favourite text editor; if you prefer something a bit more heavyweight then <a href="http://www.wingware.com/products" rel="noreferrer">WingIDE</a> is pretty well-regarded.</p>
<p>I know I'm probably stating the obvious, but don't forget that the quality of the development team and their familiarity with the technology will have a major impact on your ability to deliver. </p> <p>If you have a strong team, then it's probably not an issue if they're familiar. But if you have people who are more 9 to 5'rs who aren't familiar with the technology, they will need more support and you'd need to make a call if the productivity gains are worth whatever the cost of that support is.</p>
5,632
<p>I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So:</p> <ul> <li><strong>Does anyone know of any good resources on constructing Parsers, Interpreters, and Compilers?</strong></li> </ul> <p>EDIT: I'm not looking for compiler-compilers/parser-compilers such as Lex, Yacc and Bison...</p>
<p>The best paper I ever read on compilers is dated <strong>1964</strong> "META II a syntax-oriented compiler writing language" by Val Schorre. (<a href="http://doi.acm.org/10.1145/800257.808896" rel="noreferrer">http://doi.acm.org/10.1145/800257.808896</a>)</p> <p>In 10 pages, he shows you how to build an astoundingly simple but very effective compiler-compiler, provides you with with the compiler-compiler grammar and provides you with enough details for you to hand implement it in an afternoon (with one <em>astonishing</em> conceptual moment when you realize how it recurses), and just for grins implements an ALGOL-like language. The paper is a complete gas and really should be required reading for anybody working with compiler technology.</p> <p>Here's a link to play with an great tutorial on metacompiling, based on the paper. <a href="http://www.bayfronttechnologies.com/mc_tutorial.html" rel="noreferrer">http://www.bayfronttechnologies.com/mc_tutorial.html</a></p>
<p>It's an old book, and rather dated, but I've found <em>Brinch Hansen on Pascal Compilers</em> to be a very practical introduction to creating a language and building the elements of a compiler. Despite the name, it's not specific to Pascal. It's very worthwhile if you can find a copy.</p>
6,317
<p>I have a simple CAML query like</p> <pre><code>&lt;Where&gt;&lt;Eq&gt;&lt;Field="FieldName"&gt;&lt;Value Type="Text"&gt;Value text&lt;/Value&gt;&lt;/Field&gt;&lt;/Eq&gt;&lt;/Where&gt; </code></pre> <p>And I have a variable to substitute for <code>Value text</code>. What's the best way to validate/escape the text that is substituted here in the .NET framework? I've done a quick web search on this problem but all what I found was <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.aspx" rel="nofollow noreferrer"><code>System.Xml.Convert</code></a> class but this seems to be not quite what I need here.</p> <p>I know I could have gone with an <code>XmlWriter</code> here, but it seems like a lot of code for such a simple task where I just need to make sure that the <code>Value text</code> part is formatted well.</p>
<p>When working with XML, always use the XML API that works with your programming environment. Don't try to roll your own XML document building and escaping code. As Longhorn213 mentioned, in .Net all the appropriate stuff is in the System.XML namespace. Trying to to write your own code for writing XML documents will just result in many bugs and troubles down the line.</p>
<p>use <code>System.Xml.Linq.XElement</code> and <code>SetValue</code> method. This will format the text <em>(assuming a string)</em>, but also allows you to set xml as the value.</p>
3,778
<p>How should I run another program from within my <code>C</code> program? I need to be able to write data into <code>STDIN</code> of the launched program (and maybe read from it's <code>STDOUT</code>)</p> <p>I am not sure if this is a standard C function. I need the solution that should work under Linux.</p>
<p>You want to use <code>popen</code>. It gives you a unidirectional pipe with which you can access stdin and stdout of the program.</p> <p>popen is standard on modern unix and unix-like OS, of which Linux is one :-)</p> <p>Type</p> <pre><code>man popen </code></pre> <p>in a terminal to read more about it.</p> <p><strong>EDIT</strong></p> <p>Whether <code>popen</code> produces unidirectional or bidirectional pipes depends on the implementation. In <a href="https://manpages.debian.org/jessie/manpages-dev/popen.3.en.html" rel="nofollow noreferrer">Linux</a> and <a href="http://man.openbsd.org/OpenBSD-current/man3/popen.3" rel="nofollow noreferrer">OpenBSD</a>, <code>popen</code> produces unidirectional pipes, which are read-only or write-only. On <a href="https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/popen.3.html" rel="nofollow noreferrer">OS X</a>, <a href="https://www.freebsd.org/cgi/man.cgi?query=popen&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+11.0-RELEASE+and+Ports&amp;arch=default&amp;format=html" rel="nofollow noreferrer">FreeBSD</a> and <a href="http://netbsd.gw.com/cgi-bin/man-cgi?popen++NetBSD-current" rel="nofollow noreferrer">NetBSD</a> <code>popen</code> produces bidirectional pipes.</p>
<p>I think you can use </p> <blockquote> <p><code>freopen</code></p> </blockquote> <p>for this .</p>
9,632
<p>Alright it can be a lame question, but everybody uses these things differently. What's some of the best time savers out there for this IDE. <BR><BR>Tom</p>
<p>Don't forget <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd>, which displays a list of all the keyboard shortcut combinations (just in case you forget any of those listed here).</p>
<p>CTRL + b: to build the project under c++</p> <p>CTRL + SHIFT + f: to format your code (c++)</p>
7,855
<p>Let me try to explain what I need. I have a server that is visible from the internet. What I need is to create a ASP.NET application that get the request of a web Site and send to a internal server, then it gets the response and publish the the info. For the client this should be totally transparent.</p> <p>For different reasons I cannot redirect the port to the internal server. What I can do but no know how - maybe the answer is there - is to create a new Web Site that its host in the other server.</p>
<p>Why won't any old proxy software work for this? Why does it need to be an ASP.NET application? There are TONS of tools out there (both Windows and *nix) that will get the job done quite easily. Check <a href="http://www.squid-cache.org/" rel="nofollow noreferrer">Squid</a> or <a href="https://web.archive.org/web/20090601113940/http://www.grok.co.uk:80/netproxy/" rel="nofollow noreferrer">NetProxy</a> for starters.</p> <p>If you need to integrate with IIS, <a href="http://www.iisproxy.net/" rel="nofollow noreferrer">IISProxy</a> looks like it would do the trick too.</p>
<p>I use apache mod_proxy and mod_proxy_balancer. Works awesome running 5 domains a cluster of 4 web boxes.</p>
3,257
<p>What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself?</p>
<p>You have a couple options:</p> <p>You could use another application .exe to do the auto update. This is probably the best method.</p> <p>You can also rename a program's exe while it is running. Hence allowing you to get the file from some update server and replace it. On the program's next startup it will be using the new .exe. You can then delete the renamed file on startup. </p>
<p>I don't know of a way to do it without a second program that the primary program launches prior to shutting down. Program 2 downloads and installs the changes and then relaunches the primary program.</p>
6,805
<p>I have multiple selects:</p> <pre><code>&lt;select id="one"&gt; &lt;option value="1"&gt;one&lt;/option&gt; &lt;option value="2"&gt;two&lt;/option&gt; &lt;option value="3"&gt;three&lt;/option&gt; &lt;/select&gt; &lt;select id="two"&gt; &lt;option value="1"&gt;one&lt;/option&gt; &lt;option value="2"&gt;two&lt;/option&gt; &lt;option value="3"&gt;three&lt;/option&gt; &lt;/select&gt; </code></pre> <p>What I want is to select "one" from the first select, then have that option be removed from the second one. Then if you select "two" from the second one, I want that one removed from the first one.</p> <p>Here's the JS I have currently:</p> <pre><code>$(function () { var $one = $("#one"); var $two = $("#two"); var selectOptions = []; $("select").each(function (index) { selectOptions[index] = []; for (var i = 0; i &lt; this.options.length; i++) { selectOptions[index][i] = this.options[i]; } }); $one.change(function () { var selectedValue = $("option:selected", this).val(); for (var i = 0; i &lt; selectOptions[1].length; i++) { var exists = false; for (var x = 0; x &lt; $two[0].options.length; x++) { if ($two[0].options[x].value == selectOptions[1][i].value) exists = true; } if (!exists) $two.append(selectOptions[1][i]); } $("option[value='" + selectedValue + "']", $two).remove(); }); $two.change(function () { var selectedValue = $("option:selected", this).val(); for (var i = 0; i &lt; selectOptions[0].length; i++) { var exists = false; for (var x = 0; x &lt; $one[0].options.length; x++) { if ($one[0].options[x].value == selectOptions[0][i].value) exists = true; } if (!exists) $one.append(selectOptions[0][i]); } $("option[value='" + selectedValue + "']", $one).remove(); }); }); </code></pre> <p>But when the elements get repopulated, it fires the change event in the select whose options are changing. I tried just setting the <code>disabled</code> attribute on the option I want to remove, but that doesn't work with IE6.</p>
<p>I am not (currently) a user of jQuery, but I can tell you that you need to temporarily disconnect your event handler while you repopulate the items or, at the least, set a flag that you then test for and based on its value, handle the change.</p>
<p>Or you can just hide the option you don't want to show...</p> <pre><code>function hideSelected($one, $two) { $one.bind('change', function() { var val = $one.val(); $two.find('option:not(:visible)').show().end() .find('option[value='+val+']').hide().end(); }) } hideSelected($one, $two); hideSelected($two, $one); </code></pre> <p>EDIT: Oh sorry, this code does not work with IE6...</p>
6,665
<p>What options / methods / software are available to convert a JAR file to a managed .NET assembly?<br> Please provide all commercial and non-commercial methods in the answer.<br> These don't include solutions which require Java to be installed on the host machine.</p>
<p>I could be wrong, but I'm pretty sure that's impossible. The java byte code is different to the code produced to run on the CLR.</p> <p><strong>Snarky answer</strong>: Get the source code, and port it.</p> <p>EDIT: A little poking comes up with <a href="http://sourceforge.net/projects/ikvm/" rel="noreferrer">http://sourceforge.net/projects/ikvm/</a>, a Java Virtual Machine implementation for .NET. Not quite what you asked for, but it's probably going to be the best you can do.</p>
<p>Confronted with this situation last year, I wrote a small wrapper (in java) that read the inputs from a temp file, invoked the jar and placed the output in anther temp file. The .NET project would create the input file, call the JVM and start the wrapper, wait for it to finish and read the output file. Quick and Dirty. at least in my case</p>
9,457
<p>I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN.</p> <p>EDIT: You guys are fast.</p>
<p><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-ignore.html" rel="noreferrer">Here's a link to show the ignoring process in TortoiseSVN</a></p>
<p>SVN only controls what you put into it when creating your repository. Don't just import your entire project folder but import a "clean" folder BEFORE doing a build. After the build you get all the object files or your _Resharper folder etc. but they are not version controlled.</p> <p>I forgot: the <pre>svn:ignore</pre> command is another possibility to tell SVN to exclude certain files. You can add this as a property to the version controlled folders, e.g. with TortoiseSVN. </p>
9,484
<p>I recently "needed" a zip function in Perl 5 (while I was thinking about <a href="https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time">How do I calculate relative time?</a>), i.e. a function that takes two lists and "zips" them together to one list, interleaving the elements.</p> <p>(Pseudo)example: </p> <pre><code>@a=(1, 2, 3); @b=('apple', 'orange', 'grape'); zip @a, @b; # (1, 'apple', 2, 'orange', 3, 'grape'); </code></pre> <p><a href="http://www.haskell.org/onlinereport/standard-prelude.html" rel="nofollow noreferrer">Haskell has zip in the Prelude</a> and <a href="http://ferreira.nfshost.com/perl6/zip.html" rel="nofollow noreferrer">Perl 6 has a zip operator</a> built in, but how do you do it in an elegant way in Perl 5?</p>
<p>Assuming you have exactly two lists and they are exactly the same length, here is a solution originally by merlyn (Randal Schwartz), who called it perversely perlish:</p> <pre><code>sub zip2 { my $p = @_ / 2; return @_[ map { $_, $_ + $p } 0 .. $p - 1 ]; } </code></pre> <p>What happens here is that for a 10-element list, first, we find the pivot point in the middle, in this case 5, and save it in <code>$p</code>. Then we make a list of indices up to that point, in this case 0 1 2 3 4. Next we use <code>map</code> to pair each index with another index that’s at the same distance from the pivot point as the first index is from the start, giving us (in this case) 0 5 1 6 2 7 3 8 4 9. Then we take a slice from <code>@_</code> using that as the list of indices. This means that if <code>'a', 'b', 'c', 1, 2, 3</code> is passed to <code>zip2</code>, it will return that list rearranged into <code>'a', 1, 'b', 2, 'c', 3</code>.</p> <p>This can be written in a single expression along ysth’s lines like so:</p> <pre><code>sub zip2 { @_[map { $_, $_ + @_/2 } 0..(@_/2 - 1)] } </code></pre> <p>Whether you’d want to use either variation depends on whether you can see yourself remembering how they work, but for me, it was a mind expander.</p>
<p>This is totally not an elegant solution, nor is it the best solution by any stretch of the imagination. But it's fun!</p> <pre><code>package zip; sub TIEARRAY { my ($class, @self) = @_; bless \@self, $class; } sub FETCH { my ($self, $index) = @_; $self-&gt;[$index % @$self][$index / @$self]; } sub STORE { my ($self, $index, $value) = @_; $self-&gt;[$index % @$self][$index / @$self] = $value; } sub FETCHSIZE { my ($self) = @_; my $size = 0; @$_ &gt; $size and $size = @$_ for @$self; $size * @$self; } sub CLEAR { my ($self) = @_; @$_ = () for @$self; } package main; my @a = qw(a b c d e f g); my @b = 1 .. 7; tie my @c, zip =&gt; \@a, \@b; print "@c\n"; # ==&gt; a 1 b 2 c 3 d 4 e 5 f 6 g 7 </code></pre> <p>How to handle <code>STORESIZE</code>/<code>PUSH</code>/<code>POP</code>/<code>SHIFT</code>/<code>UNSHIFT</code>/<code>SPLICE</code> is an exercise left to the reader.</p>
5,925
<p>I run an ASP.NET website solution with a few other projects in it. I've known that MSBuild projects are capable of this, but is it the best way? Are they easy to create? Is nAnt, CruiseControl.NET or any other solution better?</p> <p>When I build the site (using <a href="http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx" rel="nofollow noreferrer">Web Deployment Projects</a>), can I automate part of the build so that it does not copy certain folders from the project into the Release folder? For instance, I have folders with local search indexes, images and other content part of the folder, but I never need or upload those when deploying the project. </p> <p>I'm also looking toward this type of solution to automatically increment build and version numbers.</p>
<p>Here's an example of a Web Deployment Project scripting this sort of task in the .wdproj file:</p> <pre><code> &lt;Target Name="AfterBuild"&gt; &lt;!-- ============================ Script Compression============================ --&gt; &lt;MakeDir Directories="$(OutputPath)\compressed" /&gt; &lt;Exec Command="java -jar c:\yuicompressor-2.2.5\build\yuicompressor-2.2.5.jar --charset UTF-8 styles.css -o compressed/styles.css" WorkingDirectory="$(OutputPath)" /&gt; &lt;Exec Command="move /Y .\compressed\* .\" WorkingDirectory="$(OutputPath)" /&gt; &lt;RemoveDir Directories="$(OutputPath)\sql" /&gt; &lt;Exec Command="c:\7zip-4.4.2\7za.exe a $(ZipName).zip $(OutputPath)\*" /&gt; &lt;/Target&gt; </code></pre> <p>This would allow you to delete a folder.</p> <p>(I suspect that if you wanted to not have the folder copy over <em>at all</em>, the solution file would be the place to specify that, though I haven't had to use that.)</p>
<p>CruiseControl.NET solves a different problem (continuous integration) ... however, I've had great success with NAnt for specifically what you're asking. There's a learning curve, but once you get proficient you'll wonder how you ever got along w/o it.</p>
3,659
<p>Is there a classification of method of control most (FDM) 3D printers fall under?</p> <p>From a 1986robotics textbook<sup>ref</sup> I was reading they defined three classes of control:</p> <p>1) Pick and place</p> <p>2) Point to point</p> <p>3) Continuous path</p> <p>However, both point to point and continuous path control are stated as requiring servo motors.</p> <p>I know that the majority of 3D printers are actuated with stepper motors as opposed to servo. Does the continuous path classification still apply? Or is there another classification?</p> <p>ref - <em><a href="https://www.springer.com/gp/book/9789401167703" rel="nofollow noreferrer">Todd, D.J.(Ed.):Fundamentals of Robot Technology: An Introduction to Industrial Robots, Teleoperators and Robot Vehicles - Kogan Page 1986</a></em></p>
<p>The question is if robots classification terminology the textbook sketches applies to 3D printing?</p> <p>Servos (closed loop) are used in robots to guarantee position (you don't want to accumulate an error after repetitive movement), most 3D printers use open loop steppers that are instructed on a point to point basis through G-code instructions, implying that the use of servos is not a "requirement" for point to point control.</p> <p>It <strong>is</strong> a requirement if you want to be absolutely sure that the position is reached. In 3D printing where the loads are generally low, this requirement is frequently dropped. But, there are printers that use servo control. </p> <p>Note that many CNC machines (operating at much higher loads than a 3D printer) even don't use servo's but (open loop) steppers, these are generally larger and more powerful (more torque).</p>
<p>3D Printers fall under additive manufacturing and then can be classified by the material first. Usually, the material dictates entirely what the design looks like and it would be foolish to not differentiate what you look at by this first. For some materials, there are a couple of subtypes that tell us about which method for fusing the material is used, but usually, there is just one.</p> <ul> <li>light curing resin <ul> <li>projected light</li> <li>Laser</li> </ul></li> <li>Paste, gel or air curing resin <ul> <li>direct deposit from syringe</li> </ul></li> <li>Foil <ul> <li>Laser1</li> </ul></li> <li>Powder <ul> <li>Laser</li> </ul></li> <li>Filament (FFF/FDM) <ul> <li>direct deposit</li> </ul></li> </ul> <p>Of all these printers, only the FDM/FFF Group has a large diversity in how they are designed on the outer side, with the main 4 designs (and one example) being</p> <ul> <li>Cantilever (TronXY X1)</li> <li>Core-XY (Hypercube)</li> <li>Portal (Prusa)</li> <li>Delta (Kossel)</li> </ul> <p>Now comes the kicker: Most FDM/FFF Printers do use only stepper motors and use G-Code that is derived from CNC - just like the whole idea of FDM was invented as <em>reverse CNC</em>. Only very few use an encoder at all. Marlin, the main firmware used in 3D printers, executes usually <em>point-to-point</em> instructions (<a href="http://marlinfw.org/docs/gcode/G000-G001.html" rel="nofollow noreferrer"><code>G0 X10 Y10 Z0 E5</code></a>), but some implementations are able to perform arcs (<a href="http://marlinfw.org/docs/gcode/G002-G003.html" rel="nofollow noreferrer"><code>G2 E7.85 R5 X-5 Y5</code></a>). Usually, printers run in <em>relative coordinates</em> (to the last position of the nozzle/tool), but for some operations <em>absolute coordinates</em> (mainly start or end codes) are used. </p> <p>Among the printers that use servos instead of steppers are, to my knowledge, mostly laser-based systems.</p>
1,510
<p>We are currently evaluating different applications that interface with Visual Studio 2008 (C#) and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the latest versions be pushed to each workstation. What has been your experience with these tools and what are some recommendations?</p> <hr> <p><strong>Suggested software</strong></p> <ul> <li><a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" rel="nofollow noreferrer">Cruise Control .NET</a></li> <li><a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a></li> <li><a href="http://www.jetbrains.com/teamcity/" rel="nofollow noreferrer">TeamCity</a></li> </ul> <p><strong>Suggested articles</strong></p> <ul> <li><a href="http://dotnet.org.za/cjlotz/archive/2008/01/15/continuous-integration-from-theory-to-practice-2nd-edition.aspx" rel="nofollow noreferrer">Continuous Integration: From Theory to Practice 2nd Edition (CC.net)</a></li> <li><a href="http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=87a1c0f7-a75e-4f1a-8d3a-6c52c6ad9f46" rel="nofollow noreferrer">Automating Your ASP.NET Build and Deploy Process with Hudson</a></li> </ul>
<p>Cruise Control.net (ccnet) does everything you are looking for. Its pretty easy to use, just make sure if you are going to run it as a service, you give it an account and don't make it run as network service, that way you can give it rights on intranet boxes and have it do xcopy deploys.</p> <p>It has all kinds of email modes, on failure, on all, on fix after failure, and many many more.</p>
<p>A couple of tidbits about working with cc.net and msbuild. If you are building C/C+= projects, msbuild is, um, unreliable at least with VS 2005 (and perhaps earlier). I have not tested with VS 2008. We found that sometimes msbuild would work properly, sometimes not. In trying to solve the problem, we found vcbuild.exe which seems to work well in place of msbuild when building C/C++ solutions.</p>
7,513
<p>Has anybody got this to actually work? Documentation is non existent on how to enable this feature and I get missing attribute exceptions despite having a 3.5 SP1 project. </p>
<p>I found that it doesn't work with internal/private types, but making my type public it worked fine. This means no anonymous types either :(</p> <p>Using reflector I found the method ClassDataContract.IsNonAttributedTypeValidForSerialization(Type) that seems to make the decision. It's the last line that seems to be the killer, the type must be visible, so no internal/private types allowed :(</p> <pre><code>internal static bool IsNonAttributedTypeValidForSerialization(Type type) { if (type.IsArray) { return false; } if (type.IsEnum) { return false; } if (type.IsGenericParameter) { return false; } if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) { return false; } if (type.IsPointer) { return false; } if (type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false)) { return false; } foreach (Type type2 in type.GetInterfaces()) { if (CollectionDataContract.IsCollectionInterface(type2)) { return false; } } if (type.IsSerializable) { return false; } if (Globals.TypeOfISerializable.IsAssignableFrom(type)) { return false; } if (type.IsDefined(Globals.TypeOfDataContractAttribute, false)) { return false; } if (type == Globals.TypeOfExtensionDataObject) { return false; } if (type.IsValueType) { return type.IsVisible; } return (type.IsVisible &amp;&amp; (type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, Globals.EmptyTypeArray, null) != null)); </code></pre> <p>}</p>
<p>There are several serialization options in WCF: Data contract, XML Serialization and and raw data payload. Which of these are you trying to use? From the question, it seems you are trying to use something other than objects decorated with datacontact attributes. Is that what you are asking?</p>
8,859
<p>We are developing a middleware SDK, both in C++ and Java to be used as a library/DLL by, for example, game developers, animation software developers, Avatar developers to enhance their products.</p> <p>Having created a typical API using specific calls for specific functions I am considering simplifying the API by using a REST type API (GET, PUT, POST, DELETE) or CRUD type (CREATE, READ, UPDATE, DELETE) interface.</p> <p>This would work in a similar way to a client-server type REST API where there are only 4 possible API calls but these can take flexible parameters.</p> <p>This seems to have the benefit of making the API stable in that new calls are not being added and old calls are not being removed. So a consumer of this API need not worry about having to recompile and change their code to suit any updates to our middleware.</p> <p>The overhead is that there is an extra layer of redirection in the middleware controller to route API calls and the developer needs to know what parameters are available for each REST call (supplied of course).</p> <p>I have not so far seen this system used outside of web type client server applications so my question is this: Is this a feasible idea?</p> <p>I am thinking in terms of its efficiency as well as if for example a game developer would find it easy to use.</p>
<p>Yes, this is a feasible idea. But I'm not sure the benefits would justify the costs. REST is best applied to a networked application scenario, oriented around requests and responses. While there are definite learning curve advantages to a uniform interface, those advantages can be present in almost any well-designed API which provides reasonably abstract procedures.</p> <p>You also expressed concern for whether a game developer would find a RESTful API easy to use. I'd be dubious. I've implemented many RESTful web services, and helped many developers get up to speed both building them and using them, and the conceptual leap required to grasp REST can be substantial for someone who has been steeped in procedural APIs for years. I'd think that game developers in particular would be very strongly connected to procedural APIs, to the point that attempting to adopt a different paradigm, whatever its benefits, might prove extremely difficult.</p>
<p>Remember that REST is not specific to HTTP, and does not rely on just the 4 HTTP verbs. The verbs you have and can use depend on what protocol you're using.</p>
8,799
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/83547/algorithm-to-find-which-numbers-from-a-list-of-size-n-sum-to-another-number">Algorithm to find which numbers from a list of size n sum to another number</a> </p> </blockquote> <p>What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers? In my case, I am determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but the algorithm needs to work for the generic case where the bill set can differ over time (due to running out of a bill) or due to bill denominations differing by currency. The problem would apply to a foreign exchange teller at an airport.</p> <p>So $50 can be met with a set of ($20 and $30), but cannot be met with a set of ($20 and $40).</p> <p>In addition. If the amount cannot be met with the bill denominations available, how do you determine the closest amounts above and below which can be met?</p>
<p>You are looking for the coin change problem:</p> <ul> <li><p><a href="http://en.wikipedia.org/wiki/Coin_problem" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Coin_problem</a></p></li> <li><p><a href="http://www.egr.unlv.edu/~jjtse/CS477/DP%20Coin%20Change.html" rel="nofollow noreferrer">http://www.egr.unlv.edu/~jjtse/CS477/DP%20Coin%20Change.html</a></p></li> <li><p><a href="http://www.algorithmist.com/index.php/Coin_Change" rel="nofollow noreferrer">http://www.algorithmist.com/index.php/Coin_Change</a></p></li> </ul>
<p>Start with the largest bills and work down. With each denomination, start with the largest number of those bills and work down. You might need fewer of a large denomination because you need multiple smaller ones to hit a value on the head.</p>
9,257
<p>What is the JavaScript to scroll to the top when a button/link/etc. is clicked?</p>
<pre><code>&lt;a href="javascript:scroll(0, 0)"&gt;Top&lt;/a&gt; </code></pre>
<p>actually, this works by itself, no need to define it.</p> <pre><code>&lt;a href="#top"&gt;top&lt;/a&gt; </code></pre> <p>This is a "magic" hashname value that does not need to be defined in browsers.</p> <p>Just like this will "reload" the page.</p> <pre><code>&lt;a href="/"&gt;reload&lt;/a&gt; </code></pre>
7,134
<p>How does unix handle full path name with space and arguments ?<br> In windows we quote the path and add the command-line arguments after, how is it in unix?</p> <pre><code> "c:\foo folder with space\foo.exe" -help </code></pre> <p><strong>update:</strong></p> <p>I meant how do I recognize a path from the command line arguments.</p>
<p>You can either quote it like your Windows example above, or escape the spaces with backslashes:</p> <pre><code> "/foo folder with space/foo" --help /foo\ folder\ with\ space/foo --help </code></pre>
<p>If the normal ways don't work, trying substituting spaces with <code>%20</code>.</p> <p>This worked for me when dealing with SSH and other domain-style commands like <code>auto_smb</code>.</p>
7,358
<p>While going through university and from following the development of SO, I've heard a lot about the Model-View-Controller architectural design pattern. I inadvertently used the MVC pattern even before I knew what it was, and still use it in my everyday job. From what I've seen, it's probably the most popular pattern used today. What I haven't heard much about though, are the alternative patterns you can use instead of MVC. What options are there, and for what reasons would you decide to use them over MVC? I'm also interested in knowing the types of systems they are typical of being used for. Finally, what are the pros and cons that come along with using them?</p>
<ol> <li>Passive View - <a href="http://martinfowler.com/eaaDev/PassiveScreen.html" rel="noreferrer">http://martinfowler.com/eaaDev/PassiveScreen.html</a></li> <li>Supervising Controller - <a href="http://martinfowler.com/eaaDev/SupervisingPresenter.html" rel="noreferrer">http://martinfowler.com/eaaDev/SupervisingPresenter.html</a></li> <li>Model-View-Presenter - <a href="http://martinfowler.com/eaaDev/ModelViewPresenter.html" rel="noreferrer">http://martinfowler.com/eaaDev/ModelViewPresenter.html</a> </li> </ol> <blockquote> <p>My personal favorite is the <em>Passive View</em>. More testable than others I've seen including MVC.</p> </blockquote>
<p>You can roll your own MVC with the current ASP.NET framework and still keep the postback model.</p> <p><a href="http://www.codeproject.com/KB/aspnet/RollingYourOwnMVCwithASP.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/RollingYourOwnMVCwithASP.aspx</a></p>
4,411
<p>I have a form element that contains multiple lines of inputs. Think of each line as attributes of a new object that I want to create in my web application. And, I want to be able to create multiple new objects in one HTTP POST. I'm using Javascript's built-in cloneNode(true) method to clone each line. The problem is that each input-line also has a removal link attached to its onclick-event:</p> <pre><code>// prototype based &lt;div class="input-line"&gt; &lt;input .../&gt; &lt;a href="#" onclick="$(this).up().remove();"&gt; Remove &lt;/a&gt; &lt;/div&gt; </code></pre> <p>When the cloned input-line's removal link is clicked, it also removes any input-lines that were cloned from the same dom object. Is it possible to rebind the "this" object to the proper anchor tag after using cloneNode(true) on the above DOM element?</p>
<p>Don't put handler on each link (this really should be a button, BTW). Use <a href="http://www.quirksmode.org/js/events_order.html" rel="noreferrer">event bubbling</a> to handle <em>all</em> buttons with one handler:</p> <pre><code>formObject.onclick = function(e) { e=e||event; // IE sucks var target = e.target||e.srcElement; // and sucks again // target is the element that has been clicked if (target &amp;&amp; target.className=='remove') { target.parentNode.parentNode.removeChild(target.parentNode); return false; // stop event from bubbling elsewhere } } </code></pre> <p>+</p> <pre><code>&lt;div&gt; &lt;input…&gt; &lt;button type=button class=remove&gt;Remove without JS handler!&lt;/button&gt; &lt;/div&gt; </code></pre>
<p>Looks like you're using jQuery? It has a method to clone an element with events: <a href="http://docs.jquery.com/Manipulation/clone#true" rel="nofollow noreferrer">http://docs.jquery.com/Manipulation/clone#true</a></p> <p>EDIT: Oops I see you're using Prototype.</p>
4,927
<p>Like many others on this site I am considering a move to ASP.NET MVC for future projects. Currently my sites are running the traditional ASP.NET 2.0 Web Forms, and it works OK for us, so my other option is just to stick with what I know and make the move to ASP.NET 3.5 with the integrated AJAX stuff.</p> <p>I'm wondering about how user controls work in ASP.NET MVC. We have tons of <code>.ASCX</code> controls, and a few composite controls. When I work with web designers it is very easy to get them to use ASCX controls effectively, even without any programming knowledge, so that's a definite plus. But then of course the downsides are the page life cycle, which can be maddening, and the fact that ASCX controls are hard to share between different projects. Composite controls are share-able, but basically a black box to a designer.</p> <p>What's the model in ASP.NET MVC? Is there a way to create controls that solves the problems we've dealt with using ASCX and composite controls? Allowing easy access for web designers without having to worry about code being broken is an important consideration.</p>
<p>To implement a user control you do the following call:</p> <pre><code>&lt;% Html.RenderPartial("~/Views/Shared/MyControl.ascx", {data model object}) %&gt; </code></pre> <p>You may also see the older syntax which as of PR5 is not valid anymore</p> <pre><code>&lt;%= Html.RenderUserControl("~/Views/Shared/MyControl.ascx", {data model object}) %&gt; </code></pre> <p>You will always have to worry about code breaking when moving from Web Forms to MVC, however the ASP.NET MVC team has done a great job to minimize the problems.</p>
<p>As Nick suggested, you will indeed be able to render your user controls, but obviously the page-cycle, pagestate and postback from traditional ASP Webforms won't work anymore, thus making your controls most likely useless.</p> <p>I think you'll have to rewrite most of your complex controls to port your website to MVC, while simple controls which, for instance, provide only formatting and have no postback status, should simply work. The code provided by Nick will simply work in this case.</p> <p>And about sharing between more projects: I think controls will be more like "reusable HTML-rendering components" that can be shared across a website, rather than "reusable code components" with logic (like WebForms controls). Your web logic will/should be in the pages controllers and not in the HTML controls. Therefore sharing controls across more projects won't be so useful as in the WebForms case.</p>
6,311
<p>Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1? I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and are mangling the code snippets instead of prettifying them.</p>
<p>I use <a href="http://wordpress.org/extend/plugins/wp-syntax/" rel="noreferrer">WP-Syntax</a> and it's worked very well for me. It's supported every language I've thrown at it so far, and the colors can be customized for a particular theme (though the defaults look just fine too)</p>
<p>You should also checkout <a href="http://code.google.com/p/syntaxhighlighter/" rel="nofollow noreferrer">syntaxhighlighter</a> from Google Code.</p>
5,627
<p>I'm printing with a Prusa MK3, with the following settings:</p> <ul> <li>3 perimeters</li> <li>50&nbsp;% infill</li> <li>infill overlap: 50&nbsp;%</li> </ul> <p>The filament is Polyalchemy emerald green (PLA). Nozzle temperature: 210&nbsp;°C.</p> <p>On a simple part (it's a keychain), the shell detaches if I apply a bit of force on a zone of the part that is "fragile". See picture. You might not be able to see it, but only the 2 external perimeters detach from the rest of the part. I used to print this part on another printer, and I never observed this problem.</p> <p>Any idea on how to solve this problem? It seems the 3 external perimeters didn't fuse properly.</p> <p><a href="https://i.stack.imgur.com/cUI0O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cUI0O.jpg" alt="enter image description here"></a></p>
<p>I ultimately concluded that the material isn't great. I printed this part with multiple other PLAs and never observed any problem. The Polyalchemy PLA looks great, but for any part that has some sort of mechanical constraint, it behaves poorly.</p>
<p>I am looking at your picture, and I realize that it is not only that the perimeter is detaching from the infill, but also that the perimeter is breaking.</p> <p>Once the perimeter breaks, the weaker connection with the infill will surely break, too.</p> <p>You could try:</p> <ol> <li>Using more than two perimeter layers. Go big. Try five.</li> <li>Add a fillet where the ring attaches so that the force is not focused on a point.</li> <li>Choose an infill percentage and pattern that maximizes the contact between the perimeter and the body.</li> <li>Change the angle on the bed at which the keychain is printed so that the infill maximally connects with the breaking point. That might make the ring be 45 degrees off the X and Y axes.</li> </ol>
1,531
<p>While this may seem like terribly noobish question, I'm sure one day someone will have same problem.</p> <p>I own a ZONESTAR P802QSU (Bowden extruder) and all of sudden my extruder motor stopped working. What I did:</p> <ol> <li>I check whether or not motor is moving freely - I can rotate it without any problems manually.</li> <li>I checked out cable and plugs - everything seems OK.</li> <li>I checked whether motor is working after plugging it into another slot in motherboard - motor works fine.</li> <li>I checked if another motor works after plugging it into same slot on mainboard - and it does not.</li> </ol> <p>It would seem that there is something wrong with E0-mot driver module, or with socket. I'm however totally at loss about what can I do with any of those. I do not have any electronic equipment except multimeter, and voltage on motor seems fine(11.3V between red and black, I guess V+ and ground). It sometimes seemed to get lower, but I'm almost sure it is my trembling hands.</p> <p>After some googling, I started checking A4988 stepper driver with my multimeter. VDD was ~5V and VMOT around 12V, so it seems to work at least in this way.</p> <p>What can I do, to see what is broken? Visually nothing looks like it burned out, but I'm fully aware it may not be visible. </p>
<p>Changing the PSU with one with a higher amperage will <em><strong>not</strong></em> make the bed heat up any faster unless the PSU is underrated for the amperage required and the voltage is dropping as a result of the load. This can be checked by measuring the output voltage with a multimeter (when the PSU is loaded e.g. by a heating heat bed). In this case, the PSU has a marginal higher Amperage than the printer consumes (even has some room for the over-voltage; <em><strong>under the assumption that it is a good working PSU</strong></em>). Increasing the voltage will decrease the heat up time. There is a screw next to the 12 V connectors that can change the output voltage of the PSU. Usually, it is safe to increase the voltage up to 14 V, but that depends on your whole setup (and 14 V is applied to the whole setup, increasing the current for <strong>all</strong> parts, including your printer controller board, this board must be rated for the 14 V). <strong>Please do check the stability of the voltage during load.</strong></p> <p>Although it can be done, it is not something I used. What is an extra minute on a print of several hours?</p> <p>You can do the math: say the heat bed has a resistance of 1.2 Ω. We only need two formulas:</p> <ul> <li><span class="math-container">$U=R\times I$</span> - potential Difference <em><strong>U</strong></em> is Resistance <em><strong>R</strong></em> times Current <em><strong>I</strong></em></li> <li><span class="math-container">$P=U\times I=I^2\times R=\frac {U^2} R$</span>. The power <em><strong>P</strong></em> of an item the potential difference times the current through the item.</li> </ul> <ul> <li>at <strong>12 V</strong> that will draw 10 Amps (12 V / 1.2 Ω) resulting in a 120 Watt bed: <span class="math-container">$P= 12^2 \text V \times 10^2 \text A= {10^2 \text A}\times {1.2\ \Omega}=\frac{12^2 \text V} {1.2\ \Omega} $</span>),</li> <li>at <strong>14 V</strong> that same bed will draw 11.7 Amps (14 V / 1.2 Ω) resulting in a 163.3 Watt bed.</li> </ul> <p><em>Use at your own risk!</em></p> <p>What you could do to decrease time to heat the bed without changing the PSU or the voltage is to insulate the bottom of the heat bed with heat bed cotton sheets or cork (placemats from IKEA ;) ), put a sheet of cork onto the heat bed before printing and start heating the bed through the LCD panel of the printer or any attached printer controller programs over USB prior to printing.</p>
<p>May I recommend an alternative approach, which does not require any change of hardware? The time required to heat the bed is not huge, so either via USB from your computer or from the front panel, instruct your printer to heat the bed first, while you're setting everything else up (loading gcode files, changing filaments, or whatever). This way tasks are completed in parallel.</p>
892
<p>Can anyone recommend a decent C image library?</p> <p>I'm after loaders for bmp, gif, jpg, png and tga.</p> <p>I want to use this for programming my <strong>Sony Playstation Portable</strong>, so opensource would be very handy.</p> <p>After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.</p>
<p>If you control the images you're loading, the lightest loader I know is Sean Barrett's awesome <a href="http://nothings.org/stb_image.c" rel="noreferrer">stb_image.c</a> (direct link to single file source code!).</p> <p>There are also other very worthwhile libraries on Sean's site such as a tiny TrueType rasterizer and Vorbis decompressor, btw.</p> <p>If you need OpenGL image loading that uses stb_image, I'll humbly point you to <a href="http://bitbucket.org/akx/soilex" rel="noreferrer">SOILex</a>...</p>
<p><a href="http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp" rel="nofollow noreferrer">Here</a> is some code I wrote for handling images. It is in c++ ( not c ) but you should be able to easily extract the BMP and GIF load code. It's licensed LGPL. </p> <p>I use the libpng and jpeglib for decompressing those formats. </p>
7,269
<p>I have an AppleScript program which creates XML tags and elements within an Adobe InDesign document. The data is in tables, and tagging each cell takes .5 seconds. The entire script takes several hours to complete.</p> <p>I can post the inner loop code, but I'm not sure if SO is supposed to be generic or specific. I'll let the mob decide.</p> <p>[edit] The code builds a list (prior to this loop) which contains one item per row in the table. There is also a list containing one string for each column in the table. For each cell, the program creates an XML element and an XML tag by concatenating the items in the [row]/[column] positions of the two lists. It also associates the text in that cell to the newly-created element.</p> <p>I'm completely new to AppleScript so some of this code is crudely modified from Adobe's samples. If the code is atrocious I won't be offended.</p> <p>Here's the code:</p> <pre><code>repeat with columnNumber from COL_START to COL_END select text of cell ((columnNumber as string) &amp; ":" &amp; (rowNumber as string)) of ThisTable tell activeDocument set thisXmlTag to make XML tag with properties {name:item rowNumber of symbolList &amp; "_" &amp; item columnNumber of my histLabelList} tell rootXmlElement set thisXmlElement to make XML element with properties {markup tag:thisXmlTag} end tell set contents of thisXmlElement to (selection as string) end tell end repeat </code></pre> <p>EDIT: I've rephrased the question to better reflect the correct answer.</p>
<p>I figured this one out.</p> <p>The document contains a bunch of data tables. In all, there are about 7,000 data points that need to be exported. I was creating one root element with 7,000 children.</p> <p>Don't do that. Adding each child to the root element got slower and slower until at about 5,000 children AppleScript timed out and the program aborted.</p> <p>The solution was to make my code more brittle by creating ~480 children off the root, with each child having about 16 grandchildren. Same number of nodes, but the code now runs fast enough. (It still takes about 40 minutes to process the document, but that's infinitely less time than infinity.)</p> <p>Incidentally, the original 7,000 children plan wasn't as stupid or as lazy as it appears. The new solution is forcing me to link the two tables together using data in the tables that I don't control. The program will now break if there's so much as a space where there shouldn't be one. (But it works.)</p>
<blockquote> <p>I can post the inner loop code, but I'm not sure if SO is supposed to be generic or specific. I'll let the mob decide.</p> </blockquote> <p>The code you post as an example can be as specific as you (or your boss) is comfortable with - more often than not, it's easier to help you with more specific details.</p>
3,266
<p>Good morning everyone,</p> <p>I am developing a consulting job in a clinic of dental CT scans.</p> <p>This work involves the development of administrative software, and preparing a routine for conversion of tomographic files in DICOM format to STL format. The files in STL format will be used for both visualization and analysis of 3D models, such as printing in 3D printers.</p> <p>Our problem is just the conversion DICOM to STL.</p> <p>Has anyone come across this kind of situation? We did not find any documentation or tool for this purpose in our searches and we are really with a gande urgency in the solution.</p> <p>Advance grateful for any assistance.</p>
<p>The marching cubes algorithm can convert voxel data into a surface mesh. A global threshold to determine the surface in the greyvalues is used. This <a href="https://pyscience.wordpress.com/2014/09/11/surface-extraction-creating-a-mesh-from-pixel-data-using-python-and-vtk/" rel="nofollow">article</a> might be helpful. </p>
<p>There is this software that should work: <a href="https://www.slicer.org/" rel="nofollow">https://www.slicer.org/</a></p> <p>If that doesn't cut it, I use this site to convert images to STL: <a href="http://www.online-convert.com/" rel="nofollow">http://www.online-convert.com/</a></p> <p>They do have DICOM listed as a supported format, but whether it would convert correctly or not I can't say for sure. I've had varied results. </p>
377
<p>Inspired by another question and due to the fact that some of my filament will face the same problem when I will use them again, I wanted to know if there are proven recipies to get rid of water that has ben incorporated to PLA filament from humidity? One knows the filament had too much exposure to humidity when hearing tiny puffs during extrusion and/or more brittle prints.</p> <p>I know about suggestions to heat the water out of the filament at a temperature well below the glass transition temperature, but can someone provide first hand knowledge or even evidence?</p>
<p><strong>The easiest way to freshen up filament is hot air, although there are other options.</strong></p> <p>There is an optimal melt processing <em>moisture level</em> for every plastic, typically in the range of 0.1-0.2% water content by weight. But the equilibrium moisture content of most plastics in humid air can be more like 1%. As a consequence, <strong>hot air dehydration is standard practice</strong> to prepare plastic pellets for extrusion in industry. Pretty much every injection-molded and extruded plastic product in the world -- including 3d printer filament -- is made with pre-dried pellets. Hot air is blown through the pellets until they are below the moisture limit.</p> <p>Different plastics tolerate extrusion with different amounts of moisture, and absorb different amounts of moisture. They can also tolerate different drying temperatures. So the ideal storage and drying conditions vary by material. </p> <ul> <li><strong>PLA</strong> absorbs relatively little moisture, but in humid environments can accumulate enough water content to cause steam bubbles during extrusion. In some cases, steam bubbles can contribute to hot end jamming. Extreme wetness has been known to cause swelling that can increase filament feed drag. It's arguable whether wetness actually causes brittleness, or if that is a separate aging issue. People who keep their homes below ~50% relative humidity usually don't have any problems. Leaving PLA in a dry environment for a week or two should adequately re-dry it, or it can be gently heated to about 120F / 50C for a couple hours. (Some people dry it hotter. but that risks deforming the filament.)</li> <li><strong>ABS</strong> also doesn't absorb very much water, but perhaps a little more than PLA. It also experiences steam bubbles, but that's typically the only issue. Homes below ~45% RH usually don't have problems. Storing ABS with fresh silica gel for a couple weeks will dry it. Or it can be oven-dried up to about 180F / 80C for an couple hours. <strong>HIPS</strong> can be treated the same. </li> <li>The kind of PET used in plastic bottles is rapidly degraded into tar by hydrolysis when melted with any significant water content. So <strong>PETG</strong> filaments are specially blended to absorb less water and to be less damaged by water than PET. But there is still the possibility of bubbles and cloudy strands due to steam expansion at higher temperatures, and there is some evidence that wet PETG produces weaker, more brittle prints than dry PETG. Different manufacturers' blends require different conditions: some people report Taulman t-glase needs oven-drying and careful storage while Esun PETG is fairly tolerant of normal home humidity levels. Oven-drying at 150F / 65C should work well. </li> <li><strong>Nylon</strong> absorbs a huge amount of water, which causes it to swell considerably, produce massive steam bubbles, look cloudy, warp more, and adhere less than properly-dried nylon. It's nearly unprintable when wet. It should be oven-dried at around 150F / 65C for 4+ hours -- desiccant will not strip enough moisture from it. In fact, nylon will pull water out of used silica gel! Once dry, it should be stored with an aggressive desiccant (either bone-dry silica or preferably calcium chloride). It only takes a few hours of exposure to air for it to become excessively moist. Building a sealed drybox feed system is highly recommended to avoid exposed time during and between prints. </li> <li><strong>Polycarbonate</strong> is similar to nylon in that is is an aggressive water-absorber. It will look cloudy, produce steam bubbles, warp more, and provide very poor layer bonding when wet. It should be oven-dried at 180F / 80C if on a plastic spool (up to 250F / 120C if dried alone) for 4+ hours and then stored in a drybox with aggressive desiccant just like nylon. Note that some modern PC blends like Esun ePC are less prone to water absorption, at the cost of some decrease in mechanical properties. </li> <li><strong>PVA</strong> is basically destroyed by airborne humidity, since it literally dissolves in water. Store in a drybox with an aggressive desiccant at all times. </li> </ul> <p>Composite filaments should be treated like the base material. </p> <p>Some drying and prevention options:</p> <ul> <li><strong>Oven</strong>: The "warm" setting will usually work pretty well. Let the oven preheat and settle out for a while, and measure temperature with a good oven thermometer or thermocouple. Shield the filament from direct radiant heating and hot spots with aluminum foil, cookie sheets, etc. Electric ovens will dry faster than gas ovens, because burning natural gas produces some additional moisture. Do not leave the oven unattended if using temperatures above the glass point of the filament, or bad things may happen!</li> <li><strong>"Light bucket"</strong>: A 5-gallon plastic bucket with an incandescent lightbulb inside is a pretty effective way to gently warm low-temp filament like PLA for drying or medium-term storage. Leave the lid slightly open if drying. </li> <li><strong>Food dehydrator</strong>: Works great. Set temperatures as per the oven temps above. The main challenge is getting a large enough space inside for a filament spool. </li> <li><strong>Desiccant</strong>: In order for desiccant to actively dry filament, it must be significantly more attractive to water than the filament is. And affinity for water is a function of how wet the material already is. That means dry desiccant can easily pull some water out of very wet filament, but wet desiccant can actually give water TO the filament! Rechargeable indicator desiccant (such as an <em>Eva-Dry E-333</em> unit) is ideal. It's also important to have ENOUGH desiccant: silica gel can only absorb 10% of its weight in water at 20% RH. That means to pull 1% moisture content out of a wet 1kg spool, you would need to start with at least 100g of bone-dry, fresh-baked silica! "Used" silica is basically useless, it already contains too much water to pull any more from the filament. But you can re-dry the silica in an oven. 250F / 120C for 6 hours should be safe for all types of silica gel, but more aggressive drying (including microwave drying) is possible for some silica gels. Follow the gel manufacturer instructions. </li> <li><strong>Rice</strong>: Does not work. It's basically a myth that rice has drying power. A bag of rice you buy at the store is already pretty close to moisture equilibrium with the air, so it has minimal capacity to pull water from filament (or a soaked iPhone, for that matter). If you dry the rice in an oven to drive out its water first, it will work to some degree, but silica gel is considerably more effective. </li> <li><strong>Kitty litter</strong>: Silica gel style kitty litter is nearly identical to desiccant silica gel. Like rice, it is fairly close to saturated when you open the container, but can be dried in the oven to be a good cheap bulk desiccant. Clay type kitty litter is not as effective. Be careful of getting kitty litter dust all over your filament. </li> <li><strong>Dry storage</strong> A thick plastic box with an airtight seal is preferable. Look for recycling code 2 (HDPE) or 5 (PP) on the box. 5 gallon buckets with sealing lids also work fine. Ziplocks and other thin plastic bags are better than nothing, but are permeable to water (yes, really) and can only be relied on as long as there is fresh desiccant in the bag. Acrylic/plexiglas dryboxes have been sold by various people, but acrylic is very permeable to water, so I don't recommend that option. </li> <li><strong>Air conditioning</strong>: Simply keeping the air in your printing environment reasonably dry will protect PLA and ABS and other low-absorption filaments. It may help to buy a humidity monitor to get an understanding of your ambient humidity. </li> </ul> <p>Now, considering the original question here, it's important to note that moisture content is not the only way filament can age or be damaged. PLA in particular is prone to becoming brittle over time. There are different theories for why this occurs. One is gradual chemical aging because poly(lactic acid) simply is not a very stable polymer. Moisture could contribute to that aging process, but true chemical aging would be irreversible even if the filament is later dried. How much this occurs should depend on the specific polymer blend and storage conditions. </p> <p>Another theory for PLA aging is that the residual filament extrusion stresses (from being drawn down to the correct diameter and rapidly quenched in a water bath) are slowly creeping over time. Anyone who has placed a PLA part under heavy load for more than a few weeks will see PLA creep. It's a rather odd polymer in that it will "creep to failure" and crack at very low creep elongations rather than progressively deform in a ductile manner like most creep-prone materials. So if the PLA has significant stresses locked-in from the initial extrusion process (which is very common) it may be creeping into a more brittle arrangement of polymer molecules over time. That would explain the aging effect, and it would explain why "drying" sometimes rejuvenates the PLA: heating the filament near its glass point will allow the polymer molecules to gently relax and basically anneal to a less brittle state. </p>
<p>Keep in mind gas ovens produce water when the gas is burned, so it isn't as effective as an electric oven for drying.</p> <p>Silica desiccant is excellent for drying filament, but you will want at least some of the desiccant beads to be "indicating" type. That is they show a color change when saturated with moisture. Silica desiccant can be recharged in a 220 &deg;F (104 &deg;C) oven, and can withstand a higher temperature than the filament, and it expels water when warm even though a lot is present in a gas oven. Indicating silica is typically blue or orange dry, pink or green when wet. If you have white silica beads with just a small percentage of indicating beads in it, they will equalize in moisture so the indicating beads can be trusted to indicate for the whole batch. Non-indicating silica is cheaper and can be spiked with a small dose of indicating beads.</p> <p>I use an x-large (~5 gallon) double zipper ziploc "big bag" with my entire supply of filament inside, along with a cloth bag holding 2.5 pounds of indicating silica beads. Even if the ziploc seal isn't perfect, the silica will maintain a low humidity until spent. It is rated to reduce humidity to 40 % and hold 40 % by weight in water (not the 10 % mentioned above, past 40 % water and the humidity will rise past 40 %), but in my 46 % rh (relative humidity) house, my filament bag dropped to 15 % rh within 20 minutes (measured with a HVAC humidity meter). The 2.5 pounds (1.1 kg) of silica can absorb 1 pound of water (0.45 kg). You can weigh your silica to get an indication of how much water is in it. I stored my filament in a vacuum chamber for a week while I waited for my order of desiccant to arrive, so the filament was quite dry before I filled the bag. The vacuum chamber is not practical for storage as you have to evacuate it every time you open it, and it doesn't hold much.</p>
327
<p>I printed a big base for a model, but the corners of the bottom bent up, making the whole base rock when set on a table. Is there a quick fix for a makerbot2 without a heated plate?</p>
<ul> <li><p>Consider using a different material. Since you're on a replicator 2 you're probably not printing with ABS (which would be a terrible choice for a large, flat model) but probably with PLA. Perhaps you could try printing with PET(G) instead, which tends to warp even less.</p></li> <li><p>You could try modifying your model a little. If you include several grooves in the bottom surface of your model that may provide some "strain relief" so-to-speak, preventing warping.</p></li> <li><p>Increase adhesion: print your initial layer slower, closer to the build surface, at a higher temperature, with a brim, and with some kind of print surface to increase adhesion (tape/glue/hairspray).</p></li> <li><p>Increase ambient temperature. The Replicator 2 does not have a heated bed, but you could still make the cooling more gradual by enclosing the printer, shielding it from drafts, etc...</p></li> </ul>
<p>here are the options:</p> <ul> <li>Use brim settings which increase contact surface.</li> <li>Use some sort of glue. People are using many things including hairspray. I do prefer paper glue stick.</li> </ul>
290
<p>Correct me if I'm wrong, but a "build" is a "compile", and not every language compiles. Continuous Integration involves building components to see if they continue to work beyond unit tests, which I might be oversimplifying. But if your project involves a language that does not compile, how do you perform nightly builds or use continuous integration techniques?</p>
<p>Hmm... I'd define "building" as something like "preparing, packaging and deploying all artifacts of a software system". The compilation to machine code is only one of many steps in the build. Others might be checking out the latest version of the code from scm-system, getting external dependencies, setting configuration values depending on the target the software gets deployed to and running some kind of test suite to ensure you've got a "working/running build" before you actually deploy.</p> <p>"Building" software can/must be done for any software, independent of your programming langugage. Intepreted languages have the "disadvantage" that syntactic or structural (meaning e.g. calling a method with wrong parameters etc.) errors normally will only be detected at runtime (if you don't have a separate step in your build which checks for such errors e.g. with <a href="http://www.icosaedro.it/phplint/" rel="nofollow noreferrer">PHPLint</a>). </p> <p>Thus (automated) Testcases (like Unit-Tests - see <a href="http://www.phpunit.de/" rel="nofollow noreferrer">PHPUnit</a> or <a href="http://simpletest.org/" rel="nofollow noreferrer">SimpleTest</a> - and Frontend-Tests - see <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a>) are all the more important for big PHP projects to ensure the good health of the code.</p> <p>There's a great Build-Tool (like Ant for Java or Rake for Ruby) for PHP too: <a href="http://phing.info/trac/" rel="nofollow noreferrer">Phing</a></p> <p>CI-Systems like <a href="http://code.google.com/p/xinc/" rel="nofollow noreferrer">Xinc</a> or <a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a> are simply used to automagically (like anytime a change is checked into scm) package your code, check it for obvious errors, run your tests (in short: run your build) and report the results back to your development team.</p>
<p>Create a daily tag of your current source control trunk?</p>
7,737
<p>I'm writing a wizard for an Eclipse RCP application. After doing some processing on a file and taking some user input, I don't want to let the user go back to make changes. At this point they must either accept or reject the changes they are about to make to the system.</p> <p>What I can't seem to find is a method call that lets me override the buttons that display or the user's ability to hit the back button. I'd prefer that it not be there or at least be disabled.</p> <p>Has anyone found a way to do this using the <a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/wizard/package-summary.html" rel="noreferrer">JFace Wizard</a> and <a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/wizard/package-summary.html" rel="noreferrer">WizardPage</a>?</p> <p>Usability-wise, am I breaking wizard conventions? Should I consider a different approach to the problem?</p>
<p>You can return null from the getPreviousPage() method in your wizard page implementation.</p>
<p>There is no way to do this using standard JFace wizard APIs. My team accomplished this by writing a custom WizardDialog. We did this on an Eclipse RCP application and not on an eclipse plugin. Disabling the back button is breaking convention, but our business analysts really wanted the functionality.</p>
6,787
<p>I'm trying to build an assembly with one larger part (about 50&nbsp;mm&nbsp;x&nbsp;50&nbsp;mm), two small parts (about 10&nbsp;mm&nbsp;x&nbsp;5&nbsp;mm) each, and one part that starts with two 2&nbsp;mm&nbsp;x&nbsp;2&nbsp;mm squares that eventually bridge into a sort of flap. The larger part has decent adhesion for a couple of layers, but the small parts are slipping off the table right away and the nozzle drags them onto the large part since it's the last part being printed in the group, resulting in some stringing.</p> <p>My bed is adequately leveled and can print larger models well so my suspicion is that the small parts are too small for good bed adhesion and need a brim or a raft to increase the surface area. Is this correct? If so, is there a way in Cura to add a brim or raft to the small parts and not the large part? Ideally I would print all pieces at once instead of the large part separate since I will be doing batches of these assemblies in the future.</p> <p>I'm using Ultimaker Cura 3.6, printing with PLA filament set to 200&nbsp;&deg;C at nozzle and 60&nbsp;&deg;C on the bed.</p>
<p><em>This is a &quot;No&quot; and &quot;Yes&quot; answer, it depends on the version of Cura you are using!</em></p> <hr /> <p><strong>No</strong>, there are no options available to set the brim to some of the parts in Ultimaker Cura (at the time of writing this answer, pre Cura 4.5.0). You could however change the smaller model to include the brim in your design, or add so-called &quot;Mouse Ears&quot;.</p> <p>At the time of writing this answer, the image below shows the Ultimaker Cura interface for &quot;per model&quot; settings, basically different settings with respect to the other models. As can be seen, you cannot expand the <code>Build Plate Adhesion</code> (it already shows the arrow downwards, so expanded):</p> <p><a href="https://i.stack.imgur.com/5YXXp.png" rel="nofollow noreferrer" title="Pre Cura 4.5.0 per model settings example"><img src="https://i.stack.imgur.com/5YXXp.png" alt="Ultimaker Cura with per model settings" title="Pre Cura 4.5.0 per model settings example" /></a></p> <p>But, <strong>yes</strong> as of Cura 4.5.0 (see <a href="/a/13293/">this answer</a>) the &quot;per model&quot; settings have changed and the <code>Build Plate Adhesion</code> is added with the option to add a <code>Brim Distance</code> to trick Cura into de-attaching the brim (it will print a brim, but it is not attached to the part):</p> <p><a href="https://i.stack.imgur.com/wzGPZ.png" rel="nofollow noreferrer" title="Cura 4.8.0 per model settings example"><img src="https://i.stack.imgur.com/wzGPZ.png" alt="Cura 4.8.0 per model settings example" title="Cura 4.8.0 per model settings example" /></a></p> <p>When applied to several models this could result in models with a brim attached and others without the brim attached:</p> <p><a href="https://i.stack.imgur.com/euEhG.jpg" rel="nofollow noreferrer" title="Example showing brim attached and detached"><img src="https://i.stack.imgur.com/euEhG.jpg" alt="Example showing brim attached and detached" title="Example showing brim attached and detached" /></a></p>
<p>This post is quite old, but I describe how I solved this for anyone has the same problem I had: areas moved by the nozzle as the base of some appendices are too thin and tall.</p> <p>In Cura 4.8 (I don't know since which version this feature is available) it is possible to add some custom shapes (cubes or cylinders) to your model. You can find this tool after move, resize, etc,, in the prepare page (left side icons).</p> <p>So you can add some custom supports to protect from falling/moving some areas of a single model that need to be kept in place. These added parts can be moved and resized as you would do with the any other imported model.</p> <p>I found this very useful to avoid that the nozzle moves parts with a small base area that are connected to the rest of the model on a higher level and the lower part is not stable enough. Especially when printing TPU or other flexible filaments.</p>
1,169
<p>The bottom of my prints warp/curve upwards, most often at the corners. This is a very slight curve, only about 1-2 mm.</p> <ul> <li>I print with a raft all the time.</li> <li>I don't have a heated bed.</li> <li>I print with PLA at 199 °C (390 °F) with a print speed of approximately 40 mm/s</li> <li>I have a Sindoh 3DWOX DP201.</li> </ul> <p>What slicer settings might be the cause of this phenomena? Or could it be 3D printer settings?</p>
<p><strong>The first thing to understand is what causes warping</strong>. Warping is caused by the thermal contraction of the plastic when it cools down.</p> <p>Simplifying things a fair bit, you can visualise the process like this:</p> <ol> <li>hot, expanded plastic gets deposited on cooler, shrunk layers,</li> <li>when the hot plastic cools down, it shrinks and pulls the upper part of the layer below inwards</li> <li>at this point, the layer below has a differential in the compression between its upper and lower parts, and curls up</li> <li>the problem is exacerbated at the very first layer (the one touching the bed) as this is "locked" to a rigid body (the bed) and cannot shrink, while subsequent layers are only attached to the somewhat flexible plastic beneath, and thus can contract.</li> </ol> <p><a href="https://i.stack.imgur.com/knXcU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/knXcU.png" alt="diagram of curling plastic"></a></p> <p>Also notice that the larger the part being printed, the stronger is the force trying to curl-up your print.</p> <p>Once one understands all of this, then it is possible to appreciate the many ways the problem can be mitigated.</p> <p>Here are the common ones:</p> <p><strong>USING A MATERIAL WITH LOW SHRINKAGE COEFFICIENT</strong></p> <p>This translates in smaller tensions and thus less force "pulling up" the corners of your print. Historically, 3D printing started with ABS because this material was one of the very few, relatively safe ones to source. Nowadays there are materials like PETG which have similar mechanical properties to ABS but are much easier and forgiving to print with, so - unless you need ABS for some very specific reason (e.g.: acetone smoothing) consider never printing with it.</p> <p><strong>DECREASING THE THERMAL DIFFERENCE BETWEEN MOLTEN AND SOLID STATE</strong></p> <p>Concretely, this means lowering the "gap" between the ~200°C of the nozzle and the ~20°C of room temperature by using a heated bed and - possibly - an enclosure.</p> <p>The heated bed not only drastically diminish the shrinkage of the first layer, but because heat radiates, and hot air goes upwards, the entire bottom of the print has shrinkage mitigated.</p> <p>An enclosure just increase the benefit of the heating bed, by reflecting IR radiation back towards the print and preventing hot air to escape. A heated enclosure just improve things even further.</p> <p>Some slicers offer a "shroud" option, that encloses the entire print in an enclosed, sacrificial structure, that tries to emulate the benefits of a proper printer enclosure.</p> <p><strong>INCREASING ADHESION WITH THE PRINTING BED</strong></p> <p>That is the "brutal force" approach: if you face a strong "curl up" force, oppose it with a strong "anchor down" one.</p> <p>The increase in adhesion can be achieved in a number of ways:</p> <ul> <li>Lower print speed (more time for the molten plastic to "bond")</li> <li>Overextrusion (more pressure, more material)</li> <li>Disabling cooling fan (more progressive cooling, more time to "bond")</li> <li>Using a brim (more contact surface between print and bed)</li> <li>Using "ad hoc" material on the bed (PVA glue for PLA, ABS sludge for ABS, kapton tape, hair spray, blue tape, etc...)</li> </ul> <p><strong>REDUCING THE CURL-UP FORCE</strong></p> <p>This is typically achieved during design. Designing is a vast field and it would be impossible to cover all the possible mitigating strategies one could use, but here are some of the most common ones:</p> <ul> <li><p>Prefer assembling smaller parts over printing huge ones. This is self explanatory really, as the curling force increases with the amount of material "pulling", the least material one has, the less force one gets.</p></li> <li><p>Make relief holes above the first layers in long structures. This will essentially "break" the build-up of tension in the layer, creating many points with a little "curling up force" rather than two with a huge one. Something along the lines of this, for example:</p></li> </ul> <p><a href="https://i.stack.imgur.com/nKSuL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/nKSuL.jpg" alt="I beam with relief holes"></a></p> <ul> <li>Avoid extensive overhangs close to the bottom of the print (this is because otherwise you will have considerably more material "pulling up" than you will have "anchoring down". Here is an example of what <em>not</em> to do (to be fair: this was specifically taken from a <a href="https://www.thingiverse.com/thing:1504207" rel="noreferrer">bed adhesion/warping test</a>).</li> </ul> <p><a href="https://i.stack.imgur.com/t7IDh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/t7IDh.png" alt="warping test"></a></p> <p>Of course all of the above strategies can/should be combined, when possible. Even if not warped, a part with a lot of internal tension will perform less predictably and possibly worse than a part where such tensions are lower.</p>
<p>If you have a heat bed, heat it up accordingly (for example for PLA 50 °C first layers, 40 °C then can be a good starting point).</p> <p>If the first layer isn't close enough, then warping can happen (Happened to me when moving from 0.3 mm layers to 0.1 mm).</p> <p>If you are under extruding / have dirt in the system (the heat chamber) so that extrusion is uneven it can make warps.</p> <p>And as always, you can try to print slower, it helps not always but often.</p> <p>Please also do tell what temperatures (heat bed &amp; nozzle) you are using and what material.</p>
781
<p>How do I make an MD5 hash of a string with Delphi?</p>
<p>If you want an MD5 digest and have the <a href="http://www.indyproject.org" rel="nofollow noreferrer">Indy</a> components installed, you can do this:</p> <pre><code>uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest; with TIdHashMessageDigest5.Create do try Result := TIdHash128.AsHex(HashValue('Hello, world')); finally Free; end; </code></pre> <p>Most popular algorithms are supported in the <a href="http://www.cityinthesky.co.uk/opensource/dcpcrypt/" rel="nofollow noreferrer">Delphi Cryptography Package</a>:</p> <ul> <li>Haval</li> <li>MD4, MD5</li> <li>RipeMD-128, RipeMD-160</li> <li>SHA-1, SHA-256, SHA-384, SHA-512,</li> <li>Tiger</li> </ul> <p><strong>Update</strong> <code>DCPCrypt</code> is now maintained by <a href="https://stackoverflow.com/users/84704/warren-p">Warren Postma</a> and source can be found <a href="https://bitbucket.org/wpostma/dcpcrypt2010" rel="nofollow noreferrer">here</a>.</p>
<p>Using ICS, you simply call StrMD5 function which is located in OverbytecsMD5 unit.</p> <p>Beside that specific function, there are a lot more MD5 function for other datatypes and scenarios. There are also other hash methods such as SHA.</p>
8,302
<p>How would one create an iterative function (or iterator object) in python?</p>
<p>Iterator objects in python conform to the iterator protocol, which basically means they provide two methods: <code>__iter__()</code> and <code>__next__()</code>. </p> <ul> <li><p>The <code>__iter__</code> returns the iterator object and is implicitly called at the start of loops.</p></li> <li><p>The <code>__next__()</code> method returns the next value and is implicitly called at each loop increment. This method raises a StopIteration exception when there are no more value to return, which is implicitly captured by looping constructs to stop iterating.</p></li> </ul> <p>Here's a simple example of a counter:</p> <pre><code>class Counter: def __init__(self, low, high): self.current = low - 1 self.high = high def __iter__(self): return self def __next__(self): # Python 2: def next(self) self.current += 1 if self.current &lt; self.high: return self.current raise StopIteration for c in Counter(3, 9): print(c) </code></pre> <p>This will print:</p> <pre><code>3 4 5 6 7 8 </code></pre> <p>This is easier to write using a generator, as covered in a previous answer:</p> <pre><code>def counter(low, high): current = low while current &lt; high: yield current current += 1 for c in counter(3, 9): print(c) </code></pre> <p>The printed output will be the same. Under the hood, the generator object supports the iterator protocol and does something roughly similar to the class Counter.</p> <p>David Mertz's article, <a href="https://www.ibm.com/developerworks/library/l-pycon/" rel="noreferrer">Iterators and Simple Generators</a>, is a pretty good introduction. </p>
<blockquote> <pre class="lang-py prettyprint-override"><code>class uc_iter(): def __init__(self): self.value = 0 def __iter__(self): return self def __next__(self): next_value = self.value self.value += 2 return next_value </code></pre> </blockquote> <p>Improving previous <a href="https://stackoverflow.com/a/7542261/11671779">answer</a>, one of the advantage of using <code>class</code> is that you can add <code>__call__</code> to return <code>self.value</code> or even <code>next_value</code>.</p> <pre class="lang-py prettyprint-override"><code>class uc_iter(): def __init__(self): self.value = 0 def __iter__(self): return self def __next__(self): next_value = self.value self.value += 2 return next_value def __call__(self): next_value = self.value self.value += 2 return next_value </code></pre> <pre class="lang-py prettyprint-override"><code>c = uc_iter() print([c() for _ in range(10)]) print([next(c) for _ in range(5)]) # [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] # [20, 22, 24, 26, 28] </code></pre> <hr /> <p>Other example of a class based on Python Random that can be both called and iterated could be seen on my implementation <a href="https://github.com/yasirroni/fakertype/blob/main/fakertype/generator.py" rel="nofollow noreferrer">here</a></p>
3,964
<p>Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (<em>i.e.</em> without using javascript trickery to submit a form)?</p>
<p>Asp.net Postbacks are initiated from the client (typically form submission). I am not sure what you are trying to achieve. Some of the server side <a href="http://www.15seconds.com/issue/020102.htm" rel="noreferrer">page lifecyle</a> events are already executed and what you are trying to do is raise the previous event handlers again.</p>
<p>For those using newer versions of .NET, you have to use <code>Page.ClientScript.GetPostBackEventReference</code> since <code>'this.GetPostBackEventReference(...)'</code> is obsolete. Also probably <code>Page.ClientScript.RegisterStartupScript(...</code></p>
8,559
<p>A while ago, I created some simple command buttons in Octoprint to help with bed levelling, by hopping to particular points on the bed. I realised that what I actually want to do is move Z up 10mm, move, and then home Z though, to avoid ploughing the nozzle along the bed if the level is badly off.</p> <p>So I did this:</p> <pre><code> - commands: - G91 - G1 Z-10 - G90 - G1 X30 Y160 F9000 - G28 Z name: Back Left type: command </code></pre> <p>Which should be, switch to relative move, Move -10mm Z, switch back to absolute, go to the specified point and then home Z.</p> <p>Except there's no Z move. I get the feeling that something might be optimising the moves together into one, or something similar... how can I get my printer to move up, <em>then</em> across, <em>then</em> down?</p> <p>(printer is an quite modified Anet A8 i3 clone - I think the board is Melzi-based?)</p>
<p>NO if you want to smooth your print, gently heat the plastic and with a utensil smooth out the plastic. A hair dryer is a good way of doing this but be careful to only lightly melt the outside of the model.</p>
<p>Nail polish contains acetone. It melts PLA, so yes you <em>could</em> damage it. Google acetone vapor batch to read up on a safer way to do the job.</p>
700
<p>I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file.</p> <p>Here's what the command line looks like:</p> <pre><code>test.cmd admin P@55w0rd &gt; test-log.txt </code></pre>
<p>Another useful tip is to use <code>%*</code> to mean &quot;all&quot;. For example:</p> <pre><code>echo off set arg1=%1 set arg2=%2 shift shift fake-command /u %arg1% /p %arg2% %* </code></pre> <p>When you run:</p> <pre><code>test-command admin password foo bar </code></pre> <p>The above batch file will run:</p> <pre><code>fake-command /u admin /p password admin password foo bar </code></pre> <p>I may have the syntax slightly wrong, but this is the general idea.</p>
<p>If you're worried about security/password theft (that led you to design this solution that takes login credentials at execution instead of static hard coding without the need for a database), then you could store the api or half the code of password decryption or decryption key in the program file, so at run time, user would type username/password in console to be hashed/decrypted before passed to program code for execution via <code>set /p</code>, if you're looking at user entering credentials at run time.</p> <p>If you're running a script to run your program with various user/password, then command line args will suit you.</p> <p>If you're making a test file to see the output/effects of different logins, then you could store all the logins in an encrypted file, to be passed as arg to test.cmd, unless you wanna sit at command line &amp; type all the logins until finished.</p> <p>The number of args that can be supplied is <a href="https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation" rel="nofollow noreferrer">limited to total characters on command line</a>. To overcome this limitation, the previous paragraph trick is a workaround without risking exposure of user passwords.</p>
4,610
<p>What's the best way to get user input in a C program where the choices are of a limited number?</p> <p>Say for example the choices are:</p> <p>A) Print the list. B) Add 99 to the end of the list. C) Delete all duplicates. 5) Reset 5 times.</p> <p>Entering &quot;A&quot; and then Enter is OK. Or, just a single keystroke would work as well.</p>
<p><code>getchar()</code>, or <code>cgetc()</code>, depending on the platform</p>
<p>I have used something simple like the following:</p> <pre><code>int intput() { char input = 0; int ret_val = 0; read(0, &amp;input, 1); switch(input) { case 'c': // Do c break; case 'p': // Do p break; case 'd': // Do d break; case 'q': quit = 1; break; case '?': PRINT(ENABLE, &quot;c - connect\n&quot;); PRINT(ENABLE, &quot;p - ping\n&quot;); PRINT(ENABLE, &quot;d - disconnect\n&quot;); PRINT(ENABLE, &quot;q - quit\n&quot;); PRINT(ENABLE, &quot;? - this message\n&quot;); break; } return 0; } </code></pre>
6,424
<p>Is there a tag in HTML that will only display its content if JavaScript is enabled? I know <code>&lt;noscript&gt;</code> works the opposite way around, displaying its HTML content when JavaScript is turned off. But I would like to only display a form on a site if JavaScript is available, telling them why they can't use the form if they don't have it.</p> <p>The only way I know how to do this is with the <code>document.write();</code> method in a script tag, and it seems a bit messy for large amounts of HTML.</p>
<p>Easiest way I can think of:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;noscript&gt;&lt;style&gt; .jsonly { display: none } &lt;/style&gt;&lt;/noscript&gt; &lt;/head&gt; &lt;body&gt; &lt;p class="jsonly"&gt;You are a JavaScript User!&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>No document.write, no scripts, pure CSS.</p>
<p><a href="http://weblogs.asp.net/alex_papadimoulis/archive/2008/02/21/scriptonly-the-opposite-of-a-noscript.aspx" rel="nofollow noreferrer">Alex's article</a> springs to mind here, however it's only applicable if you're using ASP.NET - it could be emulated in JavaScript however but again you'd have to use document.write();</p>
5,023
<p>In an application that I am currently working on, a requirement is to bring a window of an external application to the foreground. Making Win32 API calls such as BringWindowToTop and SetForeground window do not work all the time. This is due to some restrictions within Windows XP. What I would like to do instead is send simulate a mouse click the window's button on the taskbar which I am hoping will bring the window to the front. Does anyone know how this is possible?</p>
<p>Check out the section "How to steal focus on 2K/XP" at <a href="http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx" rel="noreferrer">http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx</a>, as this is exactly what you need. I wouldn't go the taskbar route as the taskbar could be hidden or simply not there.</p>
<p>I used this in a program where I needed to simulate clicks and mouse movements; </p> <p><a href="http://www.codeproject.com/KB/system/globalmousekeyboardlib.aspx" rel="nofollow noreferrer">Global Mouse and Keyboard Library</a></p>
3,907
<p>I'm currently experimenting with build script, and since I have an ASP.net Web Part under source control, my build script should do that at the end:</p> <ol> <li>Grab the "naked" Windows 2003 IIS VMWare or Virtual PC Image from the Network</li> <li>Boot it up</li> <li>Copy the Files from the Build Folder to the Server</li> <li>Install it</li> <li>Do whatever else is needed</li> </ol> <p>I have never tried automating a Virtual Machine, but I saw that both VMWare and Virtual Server offer automation facilities. While I cannot use Virtual Server (Windows XP Home :-(), Virtual PC works.</p> <p>Does anyone here have experience with either VMWare Server or Virtual PC 2007 SP1 in terms of automation?</p> <p>Which one is better suited (I run windows, so the Platform-independence of VMWare does not count) and easier to automate?</p>
<p>With VMWare, there is the <a href="http://www.vmware.com/support/developer/vix-api/" rel="noreferrer">Virtual Machine Automation APIs (VIX API)</a>. You can find the reference guide <a href="http://pubs.vmware.com/vix-api/ReferenceGuide/" rel="noreferrer">here</a>. It works with VMWare Server and WorkStation, but AFAIK it's not available for ESX Server.</p> <p>From the main page for VIX:</p> <blockquote> <p>The VIX API allows you to write scripts and programs that automate virtual machine operations. The API is high-level, easy to use, and practical for both script writers and application programmers. It runs on VMware Server and Workstation products, both Windows and Linux. Bindings are provided for C, Perl, and COM (Visual Basic, VBscript, C#).</p> </blockquote>
<p>VirtualBox also has API's for automating their VM's.</p>
2,671
<p>I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it?</p> <p>(My current strategy has been to copy the file into the new folder and check it in and then delete the file from the current folder.)</p>
<p>Subversion has native support for moving files.</p> <pre><code>svn move SOURCE DESTINATION </code></pre> <p>See the online help (svn help move) for more information.</p>
<p>If you are moving folders via Repository Browser, then there is no Move option on right-click; the only way is to drag and drop. </p>
6,811
<p>I'm using XPath in .NET to parse an XML document, along the lines of:</p> <pre class="lang-cs prettyprint-override"><code>XmlNodeList lotsOStuff = doc.SelectNodes("//stuff"); foreach (XmlNode stuff in lotsOStuff) { XmlNode stuffChild = stuff.SelectSingleNode("//stuffChild"); // ... etc } </code></pre> <p>The issue is that the XPath Query for <code>stuffChild</code> is always returning the child of the first <code>stuff</code> element, never the rest. Can XPath not be used to query against an individual <code>XMLElement</code>?</p>
<p><code>//</code> at the beginning of an XPath expression starts from the document root. Try ".//stuffChild". . is shorthand for self::node(), which will set the context for the search, and // is shorthand for the descendant axis.</p> <p>So you have:</p> <pre><code>XmlNode stuffChild = stuff.SelectSingleNode(".//stuffChild"); </code></pre> <p>which translates to:</p> <p><strike>xmlNode stuffChild = stuff.SelectSingleNode("self::node()/descendant::stuffChild");</strike></p> <pre><code>xmlNode stuffChild = stuff.SelectSingleNode("self::node()/descendant-or-self::stuffChild"); </code></pre> <p>In the case where the child node could have the same name as the parent, you would want to use the slightly more verbose syntax that follows, to ensure that you don't re-select the parent:</p> <pre><code>xmlNode stuffChild = stuff.SelectSingleNode("self::node()/descendant::stuffChild"); </code></pre> <p>Also note that if "stuffChild" is a direct descendant of "stuff", you can completely omit the prefixes, and just select "stuffChild".</p> <pre><code>XmlNode stuffChild = stuff.SelectSingleNode("stuffChild"); </code></pre> <p>The <a href="http://www.w3schools.com/xsl/xpath_syntax.asp" rel="nofollow noreferrer">W3Schools</a> tutorial has helpful info in an easy to digest format.</p>
<p>Selecting single node means you need only the first element. So, the best solution is:</p> <pre><code>XmlNode stuffChild = stuff.SelectSingleNode("descendant::stuffChild[1]"); </code></pre>
4,639
<p>We should do some tag maintenance, especially regarding printers to make them easier to read. Use an answer to propose a change, merge or split. Discussions for each change should go into the comments of each change.</p> <p>Some things are easier than others: </p> <ul> <li><strong>Renaming</strong> a tag can be done with mod tools.</li> <li><strong>Alias/Synonyms</strong> are reasonably quick, often follow along renaming</li> <li>Some tags need <strong>manual (separation)</strong>. Sifting through what is and what isn't this tag has to be done to separate the stuff. It can be noisy to the front site but has to be done.</li> </ul>
<h1>Laundry list:</h1> <h2>Open</h2> <ul> <li><a href="https://3dprinting.meta.stackexchange.com/a/438">e3d</a></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/436">Creality</a></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/434">Filled PLA</a></li> </ul> <h2>Done</h2> <ul> <li><a href="https://3dprinting.meta.stackexchange.com/a/431">Anet</a></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/435">Flashforge</a></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/432">Ultimaker</a> <ul> <li><a href="https://3dprinting.meta.stackexchange.com/a/437">Ultimaker 1</a></li> </ul></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/433">Cura</a></li> <li><a href="https://3dprinting.meta.stackexchange.com/a/445">Monoprice</a></li> </ul>
<h1>Manufacturer: Monoprice</h1> <p>Status: <strong>Done</strong></p> <p>This tag (<a href="https://3dprinting.stackexchange.com/questions/tagged/monprice" class="post-tag" title="show questions tagged &#39;monprice&#39;" rel="tag">monprice</a>) is used for tagging questions regarding various printer types while the tag itself is the manufacturer. In analogy to the other printer tags and types these should be re-tagged with the proper printer types.</p> <p>The tag appears to be used 52 times, of which 27 times used this year. Printers that are tagged under the <a href="https://3dprinting.stackexchange.com/questions/tagged/monoprice" class="post-tag" title="show questions tagged &#39;monoprice&#39;" rel="tag">monoprice</a> manufacturer tag are:</p> <ul> <li>Monoprice Architect</li> <li>Monoprice Select Mini (v1/v2)</li> <li>Monoprice Maker Select</li> <li>Monoprice Maker Select Plus</li> <li>Monoprice Maker Ultimate</li> <li>Monoprice Mini Delta</li> <li>Monoprice Dual Extrusion</li> </ul>
70
<p>I had recently purchased an ender 3 and after setting it up and plugging it in, I received an electrical shock from the power supply. I live in the UK and so I was provided an EU to UK adapter which I used and I set the voltage to 230&nbsp;V.</p> <p>Does anyone know why I was shocked and if there is any solution? Was it because EU to UK isn’t grounded (or am I wrong)?</p> <p>Would an older 10 amp monitor power cable work better as it’s grounded? </p>
<p>You need to take particular care when using plug adaptors - they are not always made to a high standard, and it is possible that the earth connection is not present. If you suspect that the earth connection won't allow a 13 A fuse to blow, it would be good to destroy the adaptor.</p> <p>A simple cable (without adaptor) will be better, but is unlikely to solve the problem.</p> <p>You should also check if your mains supply uses an earth-leakage protection circuit (any modern installation must, but your house may predate this legislation).</p>
<p>Sorry for leaving this so late, I completely forgot about my account until I went through some old emails. In terms of the PSU shock issue, it was fixed through a replacement 13 A cable from an old monitor (so @Green Online and @Sean Houlihane's response worked best I think).</p>
1,023
<p>I've just printed my very first part and it did not want to come loose from the build plate, it fact, it just broke instead.</p> <p>I can heat the bed up again and work it off, but I wondered if a release agent would be better?</p> <p>I have a silicon release spray (like those use with molds). Could I spray the base with that before starting printing?</p>
<p>Advice from another source suggested thoroughly cleaning the feed gear on the bowden extruder. When I looked closely there were plastic flakes all over the mechanism. I used compressed air and a brush to clean it. I also discovered expert mode in the FlashPrint software, which enabled me to slow down the speed at which fill is laid down. Now I have good printing results with any filament.</p> <p>EDIT AND UPDATE:: I have continued to have problems with PLA. For most of the last year I printed using ABS with no similar problems. I guess that PLA is simply rougher, scratchier than ABS and catches in the tube. I found a comment that putting olive oil on the filament fixes it. I used Vaseline. Things were fine for a while, but a retailer said this would lead to other problems.</p> <p>So far, no permanent answer to this question.</p>
<p>I had a lot of thumps lately after I moved my printer location.</p> <p>Turns out my printer wasn't level and the extruder was pushing harder (further down) on different places, causing thumps. This really shows because the calibration is only in 1 spot.</p> <p>I used some printer paper and a bubble level then recalibrated. Not a single thump since.</p>
1,134
<p>I got into a mini-argument with my boss recently regarding "project failure." After three years, our project to migrate a codebase to a new platform (a project I was on for 1.5 years, but my team lead was on for only a few months) went live. He, along with senior management of both my company and the client (I'm one of those god-awful consultants you hear so much about. My engagement is an "Application Outsourcing") declared the project to be a success. I disagreed, stating that old presentations I had found showed that compared to the original schedule, the delay in deployment was best measured in months and could potentially be measured in years. I explained what I know of project failure, and the studies and statistics behind failure rates. He responded that that was all academia, and that no project he led had failed, thanks to the wonders of change/risk management - what seems to come down to explaining delays and re-evaluating the schedule based on new data.</p> <p>Maybe consulting like this differs from other projects, but it seems like this is just failure wrapped up in a prettier name to avoid the stigma of having failed to deliver on time, on budget, or with full functionality. The fact that he explained that my company gave away hours of work for free in order to finish the project within the maxed out budget says a lot. </p> <p>So I ask you this: </p> <ul> <li>What is change management, and how does it apply to a project? </li> <li>Where does "change management" end, and "project failure" begin? </li> </ul> <p><hr> @shog9:<br> I wasn't asking about a blame game with the consultants, especially since in this case I <em>represent</em> the consultants. I was looking for views on when a project should be considered "failed" regardless of if the needed functionality <em>was</em> finally implemented.<br> I'm looking for the difference between "this is actually a little more complex than we thought, and it's going to be another week" which I'd expect is somewhat typical, and "project failure" - however you want to define failure. Is there even a difference? Does this minor level of schedule slippage constitute statistical "project failure?"</p>
<p>I think, most of the time, we developers forget this we all do is, after all, about bussiness.</p> <p>From that point of view a project is not a failure while the client is willing to pay for it. It all depends on the client, some clients have more patience and understand better the risks of software development, other just won't pay if there's a substantial delay.</p> <p>Anyway, about your question. Whenever you evolve a project there are risks involved, maybe you schedule the end of the project in a certain date but it will take like six month longer than you expected. In that case you have to balance what you have already spent and what you have to gain against the risks you're taking. There's actually an entire science called "decision making" that studies it at software level, so your boss is not wrong at all.</p> <p>Let's look at some questions, Is the client willing to wait for the project? Is he willing to assume certain overcosts? Even if he doesn't, Is worth completing the project assuming the extra costs instead of throwing away all the already done work? Can the company assume what's already lost?</p> <p>The real answer to your problem lies behind that questions. You can't establish a point and say, here, if the project isn't done by this time then it's a failure. As for your specific situation, who knows? Your boss has probably more information that you have so your work is to tell him how is the project going, how much it will take and how much it will cost (in terms hours/man if you wish)</p>
<p>I suppose how successful the project is depends on who the client is. If the client were the company directors and they are happy, then the project was successful regardless of the failures along the way.</p>
5,791
<p>Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. </p>
<p>Ok, I found some free time finally.<br> Here we go: </p> <pre><code>class TreeNode { public string Value { get; set;} public List&lt;TreeNode&gt; Nodes { get; set;} public TreeNode() { Nodes = new List&lt;TreeNode&gt;(); } } Action&lt;TreeNode&gt; traverse = null; traverse = (n) =&gt; { Console.WriteLine(n.Value); n.Nodes.ForEach(traverse);}; var root = new TreeNode { Value = "Root" }; root.Nodes.Add(new TreeNode { Value = "ChildA"} ); root.Nodes[0].Nodes.Add(new TreeNode { Value = "ChildA1" }); root.Nodes[0].Nodes.Add(new TreeNode { Value = "ChildA2" }); root.Nodes.Add(new TreeNode { Value = "ChildB"} ); root.Nodes[1].Nodes.Add(new TreeNode { Value = "ChildB1" }); root.Nodes[1].Nodes.Add(new TreeNode { Value = "ChildB2" }); traverse(root); </code></pre>
<p>Assuming a mythical object TreeItem, that conatins a Children collection to represent your hierarchy.</p> <pre><code> public void HandleTreeItems(Action&lt;TreeItem&gt; item, TreeItem parent) { if (parent.Children.Count &gt; 0) { foreach (TreeItem ti in parent.Children) { HandleTreeItems(item, ti); } } item(parent); } </code></pre> <p>Now to call it, passing in the lambda that handles one item, by printing its name to the console.</p> <pre><code>HandleTreeItems(item =&gt; { Console.WriteLine(item.Name); }, TreeItemRoot); </code></pre>
8,625
<p>I was looking for some advice on which 3D printers are good for someone who is just getting into 3D printing?</p> <p>I have been looking at the Anet A8 on ebay but not sure if they are any good or not.</p> <p>Regards</p>
<p>A budget would make answering your question alot easier. Do you have any experience with cad/cam software? What are you wanting to do with it? There are many inexpensive 3d printers but your skill level in mechanics/machinery, electronics, programming etc will also help others choose a good option for you. For example, plug and play units are usually more expensive than build your own models. But if you don't have the skill to assemble it the savings wasn't worth it</p>
<p>Short answer:</p> <p>Anet A8 in Ebay will be probably a kit "do it yourself". Something not easy for starters.</p> <p>I suggest you buy a cheap and ready to use one. A rebrand of Malyan M200 (Monoprice select mini in U.S., Prima Creator in Europe) or something similar.</p> <p><strong>Long answer:</strong></p> <p>To select a printer take into account:</p> <ul> <li>your experience in 3d printing</li> <li>your experience in electronics and software.</li> <li>your objective: learning, home user, professional?</li> <li>if it will be used by children.</li> <li>your budget</li> <li>the kind of materials you plan to use: PLA only, mainly PLA and ABS, others. PLA only printers are usually a few cheaper because they do not have heat bed.</li> <li>availability of support: official support, community size, market penetration.</li> <li>build volume </li> </ul> <p>Taken into account previous criteria: </p> <ul> <li>Anet A8 is usually a Prusa diy kit. As all these kits, it is more suitable when there are experience in 3d and hardware/software.</li> <li>If the answer to previous questions is "no experience, home user, adults and childrens, medium badget, PLA&amp;ABS, good support, small volume", a printer as Malyan M200 can be a good choice. </li> <li>A printer as Flashforge finder differs respect to the previous that it has no heated bed. That means it is more suitable for PLA only.</li> <li>(addition of more cases is welcome)</li> </ul> <p>NOTE: This answer is a community wiki to promote multiple editions.</p>
669
<p>What's the DOS FINDSTR equivalent for <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" rel="noreferrer">PowerShell</a>? I need to search a bunch of log files for "ERROR".</p>
<p>Here's the quick answer </p> <pre><code>Get-ChildItem -Recurse -Include *.log | select-string ERROR </code></pre> <p>I found it <a href="http://www.interact-sw.co.uk/iangblog/2006/06/03/pshfindstr" rel="noreferrer">here</a> which has a great indepth answer!</p>
<pre><code>if ($entry.EntryType -eq "Error") </code></pre> <p>Being Object Oriented, you want to test the property in question with one of the standard comparison operators you can find <a href="http://www.computerperformance.co.uk/powershell/powershell_syntax.htm#Operators_" rel="nofollow noreferrer">here</a>.</p> <p>I have a <a href="http://slipsec.blogspot.com/2008/04/monitoring-remote-event-logs-from.html" rel="nofollow noreferrer">PS script</a> watching logs remotely for me right now - some simple modification should make it work for you.</p> <p>edit: I suppose I should also add that is a cmdlet built for this already if you don't want to unroll the way I did. Check out:</p> <pre><code>man Get-EventLog Get-EventLog -newest 5 -logname System -EntryType Error </code></pre>
3,550
<p>I'm writing a LINQ to SQL statement, and I'm after the standard syntax for a normal inner join with an <code>ON</code> clause in C#.</p> <p>How do you represent the following in LINQ to SQL:</p> <pre><code>select DealerContact.* from Dealer inner join DealerContact on Dealer.DealerID = DealerContact.DealerID </code></pre>
<p>It goes something like:</p> <pre><code>from t1 in db.Table1 join t2 in db.Table2 on t1.field equals t2.field select new { t1.field2, t2.field3} </code></pre> <p>It would be nice to have sensible names and fields for your tables for a better example. :)</p> <p><strong>Update</strong></p> <p>I think for your query this might be more appropriate:</p> <pre><code>var dealercontacts = from contact in DealerContact join dealer in Dealer on contact.DealerId equals dealer.ID select contact; </code></pre> <p>Since you are looking for the contacts, not the dealers.</p>
<p>One Best example</p> <p>Table Names : <code>TBL_Emp</code> and <code>TBL_Dep</code></p> <pre><code>var result = from emp in TBL_Emp join dep in TBL_Dep on emp.id=dep.id select new { emp.Name; emp.Address dep.Department_Name } foreach(char item in result) { // to do} </code></pre>
5,798
<p>I'm using Microsoft AjaxControlToolkit for modal popup window.</p> <p>And on a modal popup window, when a postback occurred, the window was closing. How do I prevent from the closing action of the modal popup?</p>
<p>Put you controls inside the update panel. Please see my sample code, pnlControls is control that holds controls that will be displayed on popup:</p> <pre><code>&lt;asp:Panel ID="pnlControls" runat="server"&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Button ID="TestButton" runat="server" Text="Test Button" onclick="TestButton_Click" /&gt; &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p></p> <p>This will do the job for you :)</p> <p>Best regards, Gregor Primar</p>
<p>Like you prolly already know, the modal popup is clientside only, yeah you can gather informations in it during the postback, but if you do a postback he will hide 100% of the time. </p> <p>Of course, like other proposed, you can do a .show during the postback, but it depends on what you need to do.</p> <p>Actually, I don't know why you need a postback, if it's for some validations try to do them clientside.</p> <p>Could you tell us why you need to do a postback, maybe we could help you better ! :)</p>
6,320
<p>We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see if anyone had done anything like this before.</p>
<p>You can retrieve this information through WMI.</p> <p>See the <a href="http://msdn.microsoft.com/en-us/library/aa394372.aspx" rel="nofollow noreferrer">Win32_Process</a> class, in particular its command line property. This <a href="http://www.codeproject.com/KB/cs/EverythingInWmi02.aspx" rel="nofollow noreferrer">Code Project article</a> provides pointers on how to do this,</p>
<p>For future reference, here is a code snippet from how I got it to work. This was just for a test to see how it all worked. The actual implemented code parses the command line parameters for what we need.</p> <pre><code>try { ManagementScope connectScope = new ManagementScope(); connectScope.Path = new ManagementPath(@"\\" + Environment.MachineName + @"\root\CIMV2"); SelectQuery msQuery = new SelectQuery("SELECT * FROM Win32_Process Where Name = '" + "PROGRAMNAMEHERE.exe" + "'"); ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(connectScope, msQuery); foreach (ManagementObject item in searchProcedure.Get()) { try { MessageBox.Show(item["CommandLine"].ToString()); } catch (SystemException) {} } } </code></pre>
6,597
<p>OK, this kind of follows on from <a href="https://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method">my previous question</a>.</p> <p>What I would really like to do is create some sort of attribute which allows me to decorate a method that will <strong>break the build</strong>. Much like the <em>Obsolete("reason", true)</em> attribute, but without falsely identifying obsolete code.</p> <p><strong>To clarify</strong>: I dont want it to break the build on <em>ANY</em> F6 (Build) press, I only want it to break the build if a method decorated with the attribute is called somewhere else in the code. Like I said, <em>similar</em> to obsolete, but not the same.</p> <p>I know I am not alone in this, since <a href="https://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method#27796">other users want to use it for other reasons</a>. I have never created custom attributes before so it is all new to me!</p>
<p>If this is for XML serialization and NHibernate, where you want the parameterless constructor to be accessible (as is the case in the <a href="https://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method#27796">example</a> you referenced), then use a private or protected parameterless constructor for serialization, or a protected constructor for NHibernate. With the protected version, you are opening yourself up to inherited classes being able to call that code.</p> <p>If you don't want code calling a method, don't make it accessible.</p> <p>EDIT: To perhaps answer the deeper question, AFAIK the compiler only knows about three attributes: <a href="http://msdn.microsoft.com/en-us/library/aa664620(VS.71).aspx" rel="nofollow noreferrer">Obsolete, Conditional, and AttributeUsage</a>. To add special handling for other attributes would require modifying the compiler.</p>
<p>Why not just make something up? An unknown attribute would surely break the build.</p> <pre><code>[MyMadeUpAttributeThatBreaksTheBuildForSure] public class NotDoneYet {} </code></pre>
4,779
<p>I have a setup project created by Visual Studio 2005, and consists of both a C# .NET 2.0 project and C++ MFC project, and the C++ run time. It works properly when run from the main console, but when run over a Terminal Server session on a Windows XP target, the install fails in the following way - When the Setup.exe is invoked, it immediately crashes before the first welcome screen is displayed. When invoked over a physical console, the setup runs normally.</p> <p>I figured I could go back to a lab machine to debug, but it runs fine on a lab machine over Terminal Server.</p> <p>I see other descriptions of setup problems over Terminal Server sessions, but I don't see a definite solution. Both machines have a nearly identical configuration except that the one that is failing also has the GoToMyPC Host installed.</p> <p>Has anyone else seen these problems, and how can I troubleshoot this?</p> <p>Thanks,</p>
<p>I had LOTS of issues with developing installers (and software in general) for terminal server. I hate that damn thing.</p> <p>Anyway, VS Setup Projects are just .msi files, and run using the Windows installer framework.</p> <p>This will drop a log file when it errors out, they're called MSIc183.LOG (swap the c183 for some random numbers and letters), and they go in your logged-in-user account's temp directory.</p> <p>The easiest way to find that is to type <code>%TEMP%</code> into the windows explorer address bar - once you're there have a look for these log files, they might give you a clue.</p> <ul> <li>Note - Under terminal server, sometimes the logs don't go directly into <code>%TEMP%</code>, but under numbered subdirectories. If you can't find any MSIXYZ.LOG files in there, look for directories called <code>1</code>, <code>2</code>, and so on, and look in those.</li> </ul> <p>If you find a log file, but can't get any clues from it, post it here. I've looked at more than I care to thing about, so I may be able to help</p>
<p>Before installing, drop to a command prompt and type</p> <pre><code>CHANGE USER /INSTALL </code></pre> <p>Then install your software. Once the install has completed, drop back to the command prompt and type:</p> <pre><code>CHANGE USER /EXECUTE </code></pre> <p>Alternatively, don't start the installation by a double click but instead go to Add/Remove Programs and select "install software" from there. </p> <p>Good luck!</p>
3,589
<p>I have been writing Flex applications for a few months now and luckily have not needed a full debugger as of yet, so far I have just used a few Alert boxes...</p> <p>Is there an available debugger that is included in the free Flex SDK? I am not using FlexBuilder (I have been using Emacs and compiling with ant).</p> <p>If not, how do you debug Flex applications without FlexBuilder? (note: I have no intentions of using flexbuilder)</p>
<p>A debugger called <code>fdb</code> is included in the Flex SDK. Here's some documentation on how to use it:</p> <ul> <li><a href="http://www.adobe.com/devnet/flex/articles/client_debug_08.html" rel="nofollow noreferrer">Adobe DevCenter: Debugging Client-Side Code in Flex Applications</a></li> <li><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=debugging_01.html" rel="nofollow noreferrer">Flex 3 Help: Using the Command-Line Debugger</a></li> </ul>
<p>I had the same problem when programming with ActionScript and having to test it on a browser. Try <a href="http://www.flex888.com/649/debugging-flex-with-thunderbolt.html" rel="nofollow noreferrer">this</a>. It involves using Firefox (which I believe you do) and FireBug to receive the debug messages.</p>
8,070
<p>I am working on a robotics project and need to print some gears. These will probably by under a LOT of pressure. Which material/filament should I choose so that the gears don't wear off easily?</p> <p>PS: Newbie here...</p> <p><strong>EDIT:</strong> According to my instuctor, it has to be some sort of plastic (not metal). It also has to be lightweight...</p>
<p>So, as you say you want to materials for printing robotics parts. And as you have not given any budget constraint, I would give you a list of materials which would help you achieve the task, and you can choose amongst them accordingly.</p> <ol> <li>Plastics: Basically used for building prototypes. Nylon Polyamide should be a choice for you.</li> </ol> <blockquote> <p>Polyamide 3D printing is achieved through SLS 3D printing. It offers strong and flexible prints. The upside of this material is that the printing technology requires minimum preparation of the 3D file before printing. There is no need for support. And it also offers the possibility to create intricate shapes and moving part in just one go. After the print the polyamide can be polished and dyed.</p> </blockquote> <ol start="2"> <li>Metals: Metals like Brass, Alumunium and Steel should be a good choice.</li> </ol> <p>But, if I were to achieve your task, I would select carbon fiber. some details about it:</p> <blockquote> <p>Carbon fiber consists of 90% carbon atoms, each fiber is 10 times thinner than a human hair. Carbon is especially prized for its lack of combustibility and infusability but also by its incredible strength (stronger than steel) and ability to create flexible structure, light weight and corrosion resistance. Its melting temperature is 1500, this heat there are only carbon.</p> </blockquote>
<p>Filaments that are intended for making parts that require strange should be rated by the manufacturer for strength and flexibility.</p> <p>You need to calculate the required strength and then choose a material with higher rating</p> <p>For example the rating for filaments made by Taulman are at <a href="http://www.taulman3d.com/how-to-choose.html?m" rel="nofollow">http://www.taulman3d.com/how-to-choose.html?m</a></p>
116
<p>I've just created a new Windows XP VM on my Mac using VMware Fusion. The VM is using NAT to share the host's internet connection.</p> <p>How do I access a Rails application, which is accessible on the Mac itself using <code>http://localhost:3000</code>?</p>
<p>On the XP machine, find your IP address by going to the command prompt and typing <code>ipconfig</code>. Try replacing the last number with 1 or 2. For example, if your IP address is 192.168.78.128, use <a href="http://192.168.78.1:3000" rel="noreferrer">http://192.168.78.1:3000</a>.</p>
<ol> <li>On the XP machine, Start -> Connect To -> Show all connections.</li> <li>Double click Local Area Connection.</li> <li>Click the Support tab.</li> <li>Take the Default Gateway IP <code>&lt;gateway-ip</code>> and hit http://<code>&lt;gateway-ip</code>>:3000 in your browser.</li> </ol> <p>Gotcha: You must have http:// in the address or IE will give you "The webpage cannot be displayed".</p>
8,669
<p>I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authentication so you don't ever need a password.</p> <p>So my questions is what is required to get this working? How do I generate certificates? How do I validate them once they're presented back to me?</p> <p>My stack is Rails on Apache using Passenger, but I'm not too particular.</p>
<p>These are usually referred to as client side certificates.</p> <p>I've not actually used it but a modified version of restful-authentication can be found here <a href="http://github.com/labria/restful-authentication/tree/master" rel="noreferrer">here</a> that looks like what your after.</p> <p>I found this via <a href="http://drnicwilliams.com/2008/02/22/zero-sign-on-with-client-certificates/" rel="noreferrer">Dr. Nic's post</a></p>
<p>I've been working on a solution to this problem. I wanted to do the same thing and I know lots of other website owners want this feature, with or without a third party provider. </p> <p>I created the necessary server setup and a firefox plugin to handle the certificate-based authentication. Go to mypassfree.com to grab the free firefox plugin. Email me (link on that page) for the server setup as I haven't packaged it yet with a nice installer.</p> <p>Server setup is Apache2 + OpenSSL + Perl (but you could rewrite the perl scripts in any language) </p> <p>Jonathan</p>
4,822
<p>I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using <code>syncdb</code> to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any other framework). I was already thinking this was too good to be true when I saw this in the <a href="https://docs.djangoproject.com/en/dev/ref/django-admin/" rel="noreferrer">documentation</a>:</p> <blockquote> <p>Syncdb will not alter existing tables</p> <p>syncdb will only create tables for models which have not yet been installed. It will never issue ALTER TABLE statements to match changes made to a model class after installation. Changes to model classes and database schemas often involve some form of ambiguity and, in those cases, Django would have to guess at the correct changes to make. There is a risk that critical data would be lost in the process.</p> <p>If you have made changes to a model and wish to alter the database tables to match, use the sql command to display the new SQL structure and compare that to your existing table schema to work out the changes.</p> </blockquote> <p>It seems that altering existing tables will have to be done &quot;by hand&quot;.</p> <p>What I would like to know is the best way to do this. Two solutions come to mind:</p> <ul> <li>As the documentation suggests, make the changes manually in the DB;</li> <li>Do a backup of the database, wipe it, create the tables again (with syncdb, since now it's creating the tables from scratch) and import the backed-up data (this might take too long if the database is big)</li> </ul> <p>Any ideas?</p>
<p>Manually doing the SQL changes and dump/reload are both options, but you may also want to check out some of the schema-evolution packages for Django. The most mature options are <a href="http://code.google.com/p/django-evolution/" rel="noreferrer">django-evolution</a> and <a href="http://south.aeracode.org/" rel="noreferrer">South</a>.</p> <p><strong>EDIT</strong>: And hey, here comes <a href="https://code.google.com/p/dmigrations/" rel="noreferrer">dmigrations</a>.</p> <p><strong>UPDATE</strong>: Since this answer was originally written, <a href="http://code.google.com/p/django-evolution/" rel="noreferrer">django-evolution</a> and <a href="https://code.google.com/p/dmigrations/" rel="noreferrer">dmigrations</a> have both ceased active development and <a href="http://south.aeracode.org/" rel="noreferrer">South</a> has become the de-facto standard for schema migration in Django. Parts of South may even be integrated into Django within the next release or two.</p> <p><strong>UPDATE</strong>: A schema-migrations framework based on South (and authored by Andrew Godwin, author of South) is included in Django 1.7+.</p>
<p>I've been using django-evolution. Caveats include: </p> <ul> <li>Its automatic suggestions have been uniformly rotten; and</li> <li>Its fingerprint function returns different values for the same database on different platforms. </li> </ul> <p>That said, I find the custom <code>schema_evolution.py</code> approach handy. To work around the fingerprint problem, I suggest code like:</p> <pre><code>BEFORE = 'fv1:-436177719' # first fingerprint BEFORE64 = 'fv1:-108578349625146375' # same, but on 64-bit Linux AFTER = 'fv1:-2132605944' AFTER64 = 'fv1:-3559032165562222486' fingerprints = [ BEFORE, AFTER, BEFORE64, AFTER64, ] CHANGESQL = """ /* put your SQL code to make the changes here */ """ evolutions = [ ((BEFORE, AFTER), CHANGESQL), ((BEFORE64, AFTER64), CHANGESQL) ] </code></pre> <p>If I had more fingerprints and changes, I'd re-factor it. Until then, making it cleaner would be stealing development time from something else. </p> <p><strong>EDIT:</strong> Given that I'm manually constructing my changes anyway, I'll try <a href="http://simonwillison.net/2008/Sep/3/dmigrations/" rel="nofollow noreferrer">dmigrations</a> next time. </p>
5,661
<p>I have a large application (~50 modules) using a structure similar to the following:</p> <ul> <li>Application <ul> <li>Communication modules <ul> <li>Color communication module</li> <li>SSN communication module</li> <li>etc. communication module</li> </ul></li> <li>Router module</li> <li>Service modules <ul> <li>Voting service module <ul> <li>Web interface submodule for voting</li> <li>Vote collector submodule for voting</li> <li>etc. for voting</li> </ul></li> <li>Quiz service module</li> <li>etc. module</li> </ul></li> </ul></li> </ul> <p>I would like to import the application to Maven and Subversion. After some research I found that two practical approaches exists for this.</p> <p>One is using a tree structure just as the previous one. The drawback of this structure is that you need a ton of tweaking/hacks to get the multi-module reporting work well with Maven. Another downside is that in Subversion the standard trunk/tags/branches approach add even more complexity to the repository.</p> <p>The other approach uses a flat structure, where there are only one parent project and all the modules, submodules and parts-of-the-submodules are a direct child of the parent project. This approach works well for reporting and is easier in Subversion, however I feel I lose a bit of the structure this way.</p> <p>Which way would you choose in the long term and why?</p>
<p>We have a largish application (160+ OSGi bundles where each bundle is a Maven module) and the lesson we learned, and continue to learn, is that flat is better. The problem with encoding semantics in your hierarchy is that you lose flexibility. A module that is 100% say "communication" today may be partly "service" tomorrow and then you'll need to be moving things around in your repository and that will break all sorts of scripts, documentation, references, etc.</p> <p>So I would recommend a flat structure and to encode the semantics in another place (say for example an IDE workspace or documentation).</p> <p>I've answered a question about version control layout in some detail <a href="https://stackoverflow.com/questions/16829/structure-of-projects-in-version-control#16915">with examples at another question</a>, it may be relevant to your situation.</p>
<p>I think you're better off flattening your directory structure. Perhaps you want to come up with a naming convention for the directories such that they sort nicely when viewing all of the projects, but ultimately I don't think all of that extra hierarchy is necessary.</p> <p>Assuming you're using Eclipse as your IDE all of the projects are going to end up in a flat list once you import them anyway so you don't really gain anything from the additional sub directories. That in addition to the fact that the configuration is so much simpler without all the extra hierarchy makes the choice pretty clear in my mind.</p> <p>You might also want to consider combining some of the modules. I know nothing about your app or domain, but it seems like a lot of those leaf level modules might be better suited as just packages or sets of packages inside another top level module. I'm all for keeping jars cohesive, but it can be taken too far sometimes.</p>
4,034
<p>I'm trying to write a small class library for a C++ course.</p> <p>I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really programming) that C++ classes only worked with MFC .dlls and not plain ones, but that's just the windows side.</p>
<p>C++ classes work fine in .so shared libraries (they also work in non-MFC DLLs on Windows, but that's not really your question). It's actually easier than Windows, because you don't have to explicitly export any symbols from the libraries.</p> <p>This document will answer most of your questions: <a href="http://people.redhat.com/drepper/dsohowto.pdf" rel="nofollow noreferrer">http://people.redhat.com/drepper/dsohowto.pdf</a></p> <p>The main things to remember are to use the <code>-fPIC</code> option when compiling, and the <code>-shared</code> option when linking. You can find plenty of examples on the net.</p>
<p>As I understand it, this is fine so long as you are linking .so files which were all compiled using the same compiler. Different compilers mangle the symbols in different ways and will fail to link.</p> <p>That is one of the advantages in using COM on Windows, it defines a standard for putting OOP objects in DLLs. I can compile a DLL using GNU g++ and link it to an EXE compiled with MSVC - or even VB!</p>
8,251
<p>I have what I thought would be a simple question.</p> <p>I don't have an auto leveling probe, I do my leveling manually with 4 screws and a piece of paper (I measured the thickness to 0.1&nbsp;mm).</p> <p>For the longest time I would have trouble with the first layer, sometimes having to give the bed screws a quarter turn to bring the bed up a bit. I would see that the nozzle seemed quite far away from the bed. This went on for the longest time and I just chalked it up to the quality of my printer.</p> <p>I realized recently that when I level the bed, I am inserting a piece of paper in between the nozzle and the bed. Obviously, I should be taking the thickness into account as a 0.1mm thick piece of paper accounts for 50&nbsp;% higher than the nozzle should be for a 0.2&nbsp;mm first layer height.</p> <p>My question is, how do I set (either in Cura or directly in Marlin config) the z home offset to account for the 0.1&nbsp;mm thickness of my calibration paper?</p>
<p>It is preferred to get the distance correct by hardware changes (leveling screws). But it is possible to do it with software. You can not only change the Z offset in the slicer or in the configuration of Marlin, but also with G-code commands. </p> <p>The "paper drag" method is perfect for determining the correct Z level. Once you leveled with the paper, you do not need to create an offset to account for the paper thickness, however, there are purists that do that. So basically, what we call Z=0 is in fact Z="paper thickness", unless you are a purist. But a slightly larger gap makes printing much easier. Too small heights cause e.g. rippling effects or too much pressure build-up in the nozzle. In order to change your offset after leveling, you could try one of the following methods. This is sometimes a useful method for creating a little extra offset for printing PETG, but personally I do not do that.</p> <p><strong>In Ultimaker Cura</strong>: Open the plugin manager ("Toolbox"->"Browse packages...") and install "Z Offset Setting", a new parameter will be available in the "Build Plate Adhesion" settings menu called "Z Offset". (See also <a href="/a/5939/5740">this older, not up-to-date answer</a>)</p> <p><strong>In Marlin configuration file</strong>, modify the MANUAL_Z_HOME_POS constant:</p> <pre><code>//#define MANUAL_Z_HOME_POS 0 </code></pre> <p><strong>In G-code</strong>:</p> <p>By adding the following lines to your start G-code (see e.g. <a href="/a/4746/5740">this answer</a>) using the <a href="http://marlinfw.org/docs/gcode/G092.html" rel="nofollow noreferrer"><code>G92</code></a> G-code command:</p> <pre><code>G0 Z0.2 ; Move the head to 0.2 mm (so now 0.3 on your machine) G92 Z0 ; Call this Z = 0 </code></pre> <p>or when you are able to connect to the printer over USB using a printer terminal (e.g. Pronterface, Repetier or OctoPrint) using the <a href="http://marlinfw.org/docs/gcode/M206.html" rel="nofollow noreferrer"><code>M206</code></a> G-code command:</p> <pre><code>M206 Z-0.2 ; Will raise the Z height by 0.2 mm M500 ; Stores the offset in memory </code></pre> <p>Alternatively, when you cannot connect through a terminal, putting the last 2 lines in a text file and saving that as a <code>.gcode</code> file on an SD card and "printing" the file will also store the new offset (if <code>M500</code> is enabled in the configuration file: <code>#define EEPROM_SETTINGS // Enable for M500 and M501 commands</code>)</p>
<p>You don't! Level the bed such that you know the nozzle is above the bed. Stop the print. Disable the steppers. Let it all cool down. Tram the bed (or what you call level). Then start the print again. It doesn't matter what first layer height your slicer thinks it is. All that matters is that it sticks and doesn't elephant foot. Note, if you are using glue stick or white glue (like I do) the thickness of the glue layer will be different between the edge of the glass (I assume you're using glass, otherwise you're never going to get a good tram) and the starting position of the prints. </p>
1,074
<p>Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like:</p> <pre><code>Process.Start("Sample.xls"); </code></pre> <p>However, I need to pass some command line arguments as well. I couldn't get this to work</p> <pre><code> Process p = new Process(); p.StartInfo.FileName = "Sample.xls"; p.StartInfo.Arguments = "/r"; // open in read-only mode p.Start(); </code></pre> <p>Any suggestions on a mechanism to solve this?</p> <p><strong>Edit</strong> @ aku</p> <p>My StackOverflow search skills are weak; I did not find that post. Though I generally dislike peering into the registry, that's a great solution. Thanks!</p>
<p>Using my code from <a href="https://stackoverflow.com/questions/24954/windows-list-and-launch-applications-associated-with-an-extension#24974">this</a> answer you can get command associated with xls extension. Then you can pass this command to <code>Process.Start</code> method.</p>
<p>If you query the registry, you can retrieve the data about the registered file type and then call the app directly passing the command line arguments. See <a href="http://www.blackwasp.co.uk/ProgrammaticFileTypes.aspx" rel="nofollow noreferrer">Programmatically Checking and Setting File Types</a> for an example of retrieving shell information for a file type.</p>
5,651
<p>Unfortunately and regrettably.</p> <p>Whilst trying to install and fit an SKR Turbo 1.4 Turbo Motherboard into 3D printer body, I managed to break the SKR 1.4 Turbo Motherboard SD-card reader. The card reader is not flush and protrudes from the board. It peeled the reader from the PCB.</p> <p>I attempted to fix it without success. I have since removed it from the controller board (the original SD-Card Reader PCB pads are not intact so connecting a new SD-Card Reader in place is not possible)</p> <p><strong>Have I bricked my brand new controller board?</strong></p> <p>Please can anyone suggest (If possible):</p> <ol> <li><p>Is there a way that this could be rectified in respect to uploading/flashing the Marlin 2 firmware to the SKR 1.4 Turbo without the original SD-Card Reader Module?<br> <em>I am under the impression I may be able to use a programmer of some description to upload the firmware?</em></p> </li> <li><p>Installation of a new SD-Card Reader that could be used instead of the built in default SD-Card Reader?<br> <em>I think I would be required to first modify Marlin and then flash the motherboard firmware? Then perhaps be able to connect another SD-Card reader to the motherboard via SPI or alternative e.g wires to the respective pins on the reverse of the board?</em></p> </li> </ol> <p>Could somebody kindly point me in the right direction? I would appreciate some guidance if this indeed possible?</p>
<p>&quot;Completely&quot; is always relative, but for water at the pressures involved it's probably achievable. Normally you need some sort of <em>gasket</em> (material that can bend/compress to slight imperfections in the mating surfaces), and a means of holding the two surfaces tight against the gasket, to get such a seal.</p> <p>With 3D printing, it's plausible that the print itself could be sufficiently non-rigid to achieve this, if you have a way of keeping the lid and box pressed tightly against each other - bolts through the lid, clips around the edges, etc. But it's unlikely to work well.</p> <p>I would either print I suitable gasket in TPU, or cut one from some suitable material if you don't have the capability to print with TPU. Either way you still need to design your box and lid so that they're pressed tightly against the gasket.</p> <p>One possible frame challenge would be doing a round box instead, with a circular threaded lid. It's likely that you could achieve a decent seal for your purposes without any gasket just by tightening the threads, and if not, you still have a really good setup for use with an added gasket.</p>
<p>I know this sounds obvious, but given the box has holes in the top – does it only need to be watertight when it's the right way up? If not, you could just do something like:</p> <p><a href="https://i.stack.imgur.com/JXft9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JXft9.jpg" alt="enter image description here" /></a></p> <p>Assuming that won't work, I think a really good seal would be hard with just something like PLA, because the printing texture alone means there will always be tiny gaps between the mating surfaces. In some cases, those grooves will actually act as capillaries (if you've ever tried to use a sharpie marker on a print, you can imagine what I mean).</p> <p>If the lid fits snugly, then just lining it with something like plumber's thread tape would probably do a good job.</p> <p>If it needs to work straight out of the printer, then I would try something like this (obviously I've exaggerated the detail):</p> <p><a href="https://i.stack.imgur.com/P5Fuc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P5Fuc.jpg" alt="enter image description here" /></a></p> <p>The idea being something like the plastic seal you see on some types of refrigerator door, which has a thin wall with a free edge that allows it to flex.</p> <p>NB in all these cases, sharp corners will cause problems – it will be easier to get a seal if you put a radius (say, 5mm) on the vertical edges of the box.</p>
1,766
<p>I have a <a href="https://www.monoprice.uk/products/monoprice-maker-ultimate-3d-printer-uk" rel="nofollow noreferrer">Monoprice Maker Ultimate 3D Printer</a> and have tried to replace the nozzle.</p> <p>The nozzles I bought turned out to be too small.</p> <p><img src="https://i.imgur.com/iYnMTVf.jpg" alt="Imgur"></p> <p>What are the important specifications of a nozzle?</p> <ul> <li>Thread size</li> <li>Thread length</li> <li>That plastic tube thing?</li> </ul> <p>Monoprice is very bad at publishing the specs, can I work it out with a caliper?</p>
<h2>What part fits?</h2> <p>A replacement nozzle needs to fit 3 parameters:</p> <ul> <li>Thread diameter and pitch need to match up, to allow mounting</li> <li>Thread length should be close to the original to allow secure fastening</li> <li>The style needs to fit: there are quite some styles of nozzle - most are not lined, yours is PTFE lined to the nozzle (see also <a href="https://3dprinting.stackexchange.com/questions/7497/can-the-filament-tube-be-outside-of-the-nozzle/7498#7498">Can the filament tube be outside of the nozzle?</a>)</li> </ul> <p>Monoprice nozzles are <strong>not</strong> compatible with what is known as Ultimaker Mk8 or E3D style (which you bought). They are Ultimaker Mk10 style.</p> <h2>What's a good nozzle?</h2> <p>Now, what separates a good replacement nozzle from a bad one?</p> <ul> <li>good machining to leave no burs and a smooth interior.</li> <li>a good inner geometry that allows easy flow</li> <li>outlet hole is to size</li> </ul> <h2>Finding premade replacement parts</h2> <p>As a first measure to not get the wrong replacement parts, make sure to add the manufacturer of your printer to the search and then check the thread diameter if given. In your case, you might have to add Monoprice or Toymaker, as those use this style of nozzle.</p> <h2>Reverse engineering a Nozzle</h2> <p>Now, which measurements do you need to reverse engineer it?</p> <ul> <li>nozzle front pitch angle</li> <li>hex head flat-to-flat &amp; hight</li> <li>recess diameter &amp; hight</li> <li>screw shaft relief diameter &amp; hight</li> <li>thread outer diameter &amp; length</li> <li>inner bore diameter at entry (and in case of a lined one: after the step) &amp; corresponding depth of drilling</li> <li>amount of chamfering</li> </ul> <p>With these, it's possible to do do a CNC model or a sketch of the outside and produce pretty much blanks or shells on a lathe that just need their last little bit of drilling... and here comes the tricky part: till now, all could be accessed from the outside. We are missing one profile though: the last piece of the inner bore geometry.</p> <p>This one can't easily be measured, but if one can push some plastic in, let it cool and then pull it out, one might get a molding of it, which might allow to reverse engineer a fitting drill for the last piece.</p>
<h2>What part fits?</h2> <p>A replacement nozzle needs to fit 3 parameters:</p> <ul> <li>Thread diameter and pitch need to match up, to allow mounting</li> <li>Thread length should be close to the original to allow secure fastening</li> <li>The style needs to fit: there are quite some styles of nozzle - most are not lined, yours is PTFE lined to the nozzle (see also <a href="https://3dprinting.stackexchange.com/questions/7497/can-the-filament-tube-be-outside-of-the-nozzle/7498#7498">Can the filament tube be outside of the nozzle?</a>)</li> </ul> <p>Monoprice nozzles are <strong>not</strong> compatible with what is known as Ultimaker Mk8 or E3D style (which you bought). They are Ultimaker Mk10 style.</p> <h2>What's a good nozzle?</h2> <p>Now, what separates a good replacement nozzle from a bad one?</p> <ul> <li>good machining to leave no burs and a smooth interior.</li> <li>a good inner geometry that allows easy flow</li> <li>outlet hole is to size</li> </ul> <h2>Finding premade replacement parts</h2> <p>As a first measure to not get the wrong replacement parts, make sure to add the manufacturer of your printer to the search and then check the thread diameter if given. In your case, you might have to add Monoprice or Toymaker, as those use this style of nozzle.</p> <h2>Reverse engineering a Nozzle</h2> <p>Now, which measurements do you need to reverse engineer it?</p> <ul> <li>nozzle front pitch angle</li> <li>hex head flat-to-flat &amp; hight</li> <li>recess diameter &amp; hight</li> <li>screw shaft relief diameter &amp; hight</li> <li>thread outer diameter &amp; length</li> <li>inner bore diameter at entry (and in case of a lined one: after the step) &amp; corresponding depth of drilling</li> <li>amount of chamfering</li> </ul> <p>With these, it's possible to do do a CNC model or a sketch of the outside and produce pretty much blanks or shells on a lathe that just need their last little bit of drilling... and here comes the tricky part: till now, all could be accessed from the outside. We are missing one profile though: the last piece of the inner bore geometry.</p> <p>This one can't easily be measured, but if one can push some plastic in, let it cool and then pull it out, one might get a molding of it, which might allow to reverse engineer a fitting drill for the last piece.</p>
1,196