instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>For my own project at home, I'm using the rather excellent managed subversion hosting from <a href="http://cvsdude.com/" rel="nofollow noreferrer">CVSDude</a>. As it's only me working on the code right now, I'm not using CruiseControl.net, however I expect this will change in the next couple of months and will want a full build process to kick off upon check-in.</p> <p>Has anyone managed to get CruiseControl.net working with CVSDude? My collegue Mike has this <a href="http://mikehadlow.blogspot.com/2008/01/more-on-source-repository-hosting-what.html" rel="nofollow noreferrer">blog post</a> where someone from CVSDude said: </p> <blockquote> <p>"Your can use our post-commit call back facility to call a URL on your server, which passes variables relating to the last checkin (variables detailed in our specification). Your CGI script will these variables and perform whatever tasks are required i.e. updating Cruise Control, etc."</p> </blockquote> <p>Sounds lovely. But has anyone <em>actually done it</em> with cruisecontrol?</p>
<p>Use a subrange of <code>[\u0000-\uFFFF]</code> for what you want.</p> <p>You can also use the <code>re.UNICODE</code> compile flag. <a href="http://docs.python.org/lib/re-syntax.html" rel="nofollow noreferrer">The docs</a> say that if <code>UNICODE</code> is set, <code>\w</code> will match the characters <code>[0-9_]</code> plus whatever is classified as alphanumeric in the Unicode character properties database. </p> <p>See also <a href="http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-05/2560.html" rel="nofollow noreferrer">http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-05/2560.html</a>.</p>
<p>\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.</p>
3,518
<p>Really strange observation with my MP Select Mini V2 printing PLA. I've printed a dual-fan shroud so I can have a dedicated part-cooling fan. I've noticed that when I turn it on, the extruder starts stringing everywhere. Little tiny spider-web wisps. No amount of temperature change will make them go away (printing at 200&nbsp;&deg;C). But if I simply turn off the part-cooling fan, I get a perfect print. This doesn't make sense to me - isn't the part-cooling fan supposed to reduce stringing by cooling the filament faster?</p> <p>More info: Using Ultimaker Cura 3.4.1, retraction enabled at 3.5&nbsp;mm and 40&nbsp;mm/s, which works great when the part-cooling fan is OFF. But when I turn it on without changing any other settings, I get stringing everywhere.</p> <p>Please see picture below. The part on the left was printed using the part-cooling fan and the one on the right was printed without the part-cooling fan. No other changes. The part-cooling fan is pictured in upper left (bottom fan).</p> <p><img src="https://i.stack.imgur.com/dB744.jpg" alt="Two printed fan shrouds" title="Two printed fan shrouds"></p> <p>Why does my part-cooling fan cause stringing?</p> <p>Note that I print at 0.175&nbsp;mm layer height, or "Normal" for the MP Mini. The cooling fan can be controlled but if I turn it completely off then the cold end part of the nozzle won't get actively cooled. Using Cura I can slowly increase the fan over the first several levels as well, but I'm worried that if the cold end doesn't stay cold it will get clogged up with melted filament. I will try some different fan speed settings and report back - currently running at 100&nbsp;% all the time.</p> <hr> <p><em>I went back to the stock shroud with single fan to remove variables. The stock shroud has a small vent at the bottom where air blows over the part, but not much. I had the same problem - I had to put a piece of tape over the blow hole to get the part to print without strings. I also couldn't get the PLA to stick to the bed easily when the blow hole was open. I'm not using the heated bed in any cases - I've found I can print most PLA without heating the bed at all. I'm beginning to think maybe this PLA is just extremely temperature sensitive. The brand is 3D Solutech Printer Filament Real Black.</em></p>
<p>Prior to a move the print cooling fan causes the filament to cool on the outside while the nozzle is still hot, when it then moves it causes a strings to form that will be cooled instantly. This means that the cooling you have is too much and should be reduced.</p> <p>This printer has a single fan to cool the cold-end and the print through a slot with the same fan. As this fan can be scheduled, it would be recommended to create a dual fan on the carriage where you have a dedicated fan cooling the cold end at a fixed voltage, while the print is cooled by a separate fan that can be scheduled through slicer settings.</p>
<p>The fans are allowing the strings to harden instead of break. Maybe you should use more retraction or wipe before crossing perimeters to reduce material ooze during moves.</p>
1,035
<p>Is it possible in <code>PHP (as it is in C++)</code> to declare a <code>class method</code> OUTSIDE the <code>class definition?</code></p>
<p>No, as of PHP 5.2. However, you may use <code>__call</code> magic method to forward call to arbitrary function or method.</p> <pre><code>class A { public function __call($method, $args) { if ($method == 'foo') { return call_user_func_array('bar', $args); } } } function bar($x) { echo $x; } $a = new A(); $a-&gt;foo('12345'); // will result in calling bar('12345') </code></pre> <p>In PHP 5.4 there is support for <em>traits</em>. Trait is an implementation of method(s) that cannot be instantiated as standalone object. Instead, trait can be used to extend class with contained implementation. Learn more on Traits <a href="http://www.stefan-marr.de/artikel/rfc-traits-for-php.html" rel="nofollow noreferrer">here</a>.</p>
<p>No it is not posible. if you define function/method outside class construct it becomes global function.</p>
9,699
<p>I've downloaded the IKVM sources (<a href="http://www.ikvm.net/" rel="nofollow noreferrer">http://www.ikvm.net/</a>) from <a href="http://sourceforge.net/cvs/?group_id=69637" rel="nofollow noreferrer">http://sourceforge.net/cvs/?group_id=69637</a></p> <p>Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?</p> <p>I've tried opening the ikvm8.sln, which opens all the projects, but trying to build the solution leads to a bunch of "type or namespace could not be found" errors.</p> <p>As you can probably guess I'm no Visual Studio expert, but rather am used to working with Java in Eclipse.</p> <p>So again, I'm looking for either: step-by-step instructions or a link to documentation on how to build IKVM in Visual Studio.</p> <p>Let me know if you need any more info. Thanks for any help!</p> <p><strong>Edit:</strong> I've also tried a manual "MsBuild.exe IKVM8.sln", but also get a bunch of:</p> <pre><code>JniInterface.cs(30,12): error CS0234: The type or namespace name 'Internal' does not exist in the namespace 'IKVM' (a re you missing an assembly reference?) JniInterface.cs(175,38): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi ssing a using directive or an assembly reference?) JniInterface.cs(175,13): error CS0246: The type or namespace name 'ClassLoaderWrapper' could not be found (are you mi ssing a using directive or an assembly reference?) </code></pre> <p><strong>Edit #2</strong>: I noticed a "ikvm.build" file so I downloaded and ran nant on the folder, which got me a step further. A few things start to build successfully, unfortunately I now get the following error:</p> <p>ikvm-native-win32:</p> <pre><code> [mkdir] Creating directory 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'. [cl] Compiling 2 files to 'C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\Release'. BUILD FAILED C:\Documents and Settings\...\My Documents\ikvm\ikvm\native\native.build(17,10): 'cl' failed to start. The system cannot find the file specified Total time: 0.2 seconds. </code></pre> <p><strong>Edit #3</strong>: OK solved that by putting <code>cl.exe</code> in the path, still getting other errors though. <strong><em>Note this is all for building it on the console e.g. with Nant. Is there no way to get it to build in Visual Studio? That would be sad...</em></strong></p> <p><strong>Edit #4</strong>: Next step was installing GNU classpath 0.95, and now it looks like I need a specific OpenJDK installation... Linux AMD64?!</p> <pre><code> [exec] javac: file not found: ..\..\openjdk6-b12\control\build\linux-amd64\gensrc\com\sun\accessibility\internal\resources\accessibility.java [exec] Usage: javac &lt;options&gt; &lt;source files&gt; [exec] use -help for a list of possible options </code></pre> <p><strong>Edit #5</strong>: Got an answer from the author. See below or at <a href="http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf" rel="nofollow noreferrer">http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf</a> Let's see if it works...</p> <p><strong>Edit #6</strong> As I feared, next problem: "cannot open windows.h", see separate question <a href="https://stackoverflow.com/questions/80788/fatal-error-c1083-cannot-open-include-file-windowsh-no-such-file-or-directory">here</a>.</p> <p><strong>Final Edit: Found Solution!</strong> After getting the Platform SDK folders in the Lib and Path environment variables, the solution I described below worked for me.</p>
<p>I don't know that this would do it for you but can you try building from the command line?</p> <p>msbuild ________</p> <p>I think that's how I built the application due to the same issues.</p>
<p>This is how I built IKVM 8.1.5717.0 from source. Visual Studio is not required.</p> <ul> <li><p>Create a folder: c:\ikvm\</p></li> <li><p>Add the above folder to PATH (e.g. set PATH=%PATH%;c:\ikvm and leave command prompt open for later).</p></li> <li><p>Download: ikvmsrc-8.1.5717.0.zip (<a href="http://www.frijters.net/ikvmsrc-8.1.5717.0.zip" rel="nofollow noreferrer">http://www.frijters.net/ikvmsrc-8.1.5717.0.zip</a>)</p></li> <li><p>Unzip and place "ikvm-8.1.5717.0" folder in c:\ikvm\</p></li> <li><p>Download: openjdk-8u45-b14-stripped.zip (<a href="http://www.frijters.net/openjdk-8u45-b14-stripped.zip" rel="nofollow noreferrer">http://www.frijters.net/openjdk-8u45-b14-stripped.zip</a>)</p></li> <li><p>Unzip and place "openjdk-8u45-b14" folder in c:\ikvm\</p></li> <li><p>Download: Java 8 SDK (<a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" rel="nofollow noreferrer">http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html</a>)</p></li> <li><p>Install and make sure location is added to path</p></li> <li><p>Download: NAnt 0.92 (<a href="https://sourceforge.net/projects/nant/files/nant/0.92/nant-0.92-bin.zip/download" rel="nofollow noreferrer">https://sourceforge.net/projects/nant/files/nant/0.92/nant-0.92-bin.zip/download</a>)</p></li> <li><p>Unzip and place "nant-0.92" folder in c:\ikvm\</p></li> <li><p>ICSharpCode.SharpZipLib.dll (<a href="http://www.icsharpcode.net/opensource/sharpziplib/Download.aspx" rel="nofollow noreferrer">http://www.icsharpcode.net/opensource/sharpziplib/Download.aspx</a>)</p></li> <li><p>Place "ICSharpCode.SharpZipLib.dll" in C:\ikvm\ikvm-8.1.5717.0\bin\</p></li> <li><p>Open the following file in a text editor and change the version number: C:\ikvm\ikvm-8.1.5717.0\CommonAssemblyInfo.cs.in</p></li> <li><p>Using command prompt from earlier, cd to: C:\ikvm\ikvm-8.1.5717.0\ikvm\</p></li> <li><p>Run: ..\nant-0.92\bin\NAnt.exe</p></li> <li><p>If successful all the binaries will be in: C:\ikvm\ikvm-8.1.5717.0\bin</p></li> </ul>
9,713
<p>Older versions of the .Net Framework used to install "Microsoft .NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewhere else, or do I have to use the command-line tools instead?</p>
<p>Both 3 and 3.5 still use the <a href="http://en.wikipedia.org/wiki/Microsoft_.NET#.NET_Framework_3.0" rel="nofollow noreferrer">Common Language Runtime of .NET Framework 2.0</a>. So no control panel is needed, as you can still use the 2.0 control panel.</p>
<p>To sort out the confusion between the apparently conflicting answers above, this is my current understanding of the answer:</p> <ul> <li>Use the 2.0 version, as DAC and Codeslayer recommended</li> <li>If you don't <em>have</em> the 2.0 version (mine was helpfully uninstalled when I removed VS2005 and installed VS2008), then you can either install VS2005, or download the Windows SDK, as per GateKiller's link</li> </ul> <p>On my PC, even downloading the SDK didn't work; it installed mscorcfg.msc but not mscorcfg.dll. Digging about in the GAC, I notice mscorcfg.dll v3.5, which confuses me even more. Anyway, there is an iffy-looking copy-dlls-and-hack-registry solution at <a href="http://home.hot.rr.com/graye/Articles/CodeAccessSecurity.htm" rel="nofollow noreferrer">http://home.hot.rr.com/graye/Articles/CodeAccessSecurity.htm</a>, and that's what I'm going to try next. Wish me luck!</p>
6,511
<p>I have an interface that I have defined in C++ which now needs to be implemented in C#. What is the best way to go about this? I don't want to use COM at all in my interface definition. The way I have solved this right now is to to have two interface definitions, one in C++ and one in C#. I then expose the C# interfaces as a COM server. This was my application which is written in C++ can call into C#. Is there anyway I can avoid having to define my implementation in C++ as well as C#?</p>
<p>If you are willing to use C++/CLI for your managed code instead of C#, then you can just consume the native C++ interface definition directly via the header file. How easy this will be will depend on exactly what is in your interface - simplest case is something that you could use from C.</p> <p>Take a look at Marcus Heege's <a href="https://rads.stackoverflow.com/amzn/click/com/1590597567" rel="nofollow noreferrer" rel="nofollow noreferrer">Expert C++/CLI: .NET for Visual C++ Programmers</a>, for a lot of helpful information on mixing native and managed C++ in .NET.</p>
<p>You don't mention which version of .NET you're using, but something that's worked for me in using Visual Studio .NET 2003 is to provide a thin C# wrapper around the pimpled implementation of the real C++ class:</p> <pre><code>public __gc class MyClass_Net { public: MyClass_Net() :native_ptr_(new MyClass()) { } ~MyClass_Net() { delete native_ptr_; } private: MyClass __nogc *native_ptr_; }; </code></pre> <p>Obviously, one would prefer to use a Boost shared_ptr there, but I could never get them to play nicely with V.NET 2003...</p> <p>Methods simply forward to the underlying C++ methods through the pointer. Method arguments may have to be converted. For example, to call a C++ method which takes a string, the C# method should probably take a System.String (System::String in Managed C++). You'd have to use System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi() to do that.</p> <p>One nice thing about this approach is because Managed C++ is a .NET language, you get to expose accessors as properties (__property). You can even expose attributes, very much like in C#.</p>
9,024
<p>My Alfawise EX8 (Anet A8 Clone) had an issue, so I flashed the <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0" rel="nofollow noreferrer">firmware</a> provided on the GearBest page. After the flash the LCD is no longer doing anything and I can't really identify the LCD to confirm whether the correct one is selected in configuration.h </p> <p>Currently the firmware had 'Mini VIKI' selected, but I'm not confident it works.</p> <p>I cannot see anything on the screen, but I can still turn the dial and click things to make it do stuff.</p> <p></p> <p><a href="https://i.stack.imgur.com/YMky7m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YMky7m.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/aAhbkm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aAhbkm.jpg" alt="enter image description here"></a></p> <p>I really hope somebody can help!</p>
<p>According to the <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0" rel="nofollow noreferrer">link to the fork of Marlin</a> you need to be sure that a bootloader is present before flashing, see <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0&amp;file_subpath=%2FMarlin%2Fpins_MELZI_WYH.h" rel="nofollow noreferrer">pins_MELZI_WYH.h</a>:</p> <blockquote> <pre>/** * Melzi (WYH) pin assignments * * The WYH-128 board needs a bootloader installed before Marlin can be uploaded. * If you don't have a chip programmer you can use a spare Arduino plus a few * electronic components to write the bootloader. * * See http://www.instructables.com/id/Burn-Arduino-Bootloader-with-Arduino-MEGA/ */</pre> </blockquote> <p>From this same pins layout file you can find hints to the usage of the <code>REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER</code> display:</p> <blockquote> <pre>// For the stock M18 use the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER // option for the display in Configuration.h</pre> </blockquote> <p>Maybe you can use that one instead of the "Mini VIKI". Though, an internet search, does hint to the "Mini VIKI" being the correct display for this printer, but it does look different from other Mini VIKI displays.</p> <p>Note that in the <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0&amp;file_subpath=%2FMarlin%2FConfiguration.h" rel="nofollow noreferrer">Configuration.h</a>, by default this display is not enabled as can be seen:</p> <blockquote> <pre>// RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER </pre> </blockquote>
<p>I have the same problem.</p> <p>I think it is not a bootloader problem because the screen is all blue but machine can work with serial connexion. I tried to use the new Jakub's file but it doesn't work either.</p> <p>I found new type of screen for EX8 on Marlin V2 called &quot;WYH_L12864_LCD&quot; - Has anyone tried this solution?</p>
1,482
<p>I have a TronXY printer (i3 Clone). It has a 220x220&nbsp;mm heated aluminum bed and I print with a Borosilicate glass plate.</p> <p>I have a slightly longer print (245&nbsp;mm) I would like to do and I think I could adjust to settings and end stop to stretch the y-dimension travel and I have found a 229x257&nbsp;mm plate. This would extend over the edge of the aluminum bed.</p> <p>Will the thermal conduction and mass of the glass plate be sufficient to still keep the bed warm enough?</p>
<p>The aluminum plate is being heated by the heater element although I suspect the element does not encompass the entire area of the aluminum portion. There are going to be cooler spots on the aluminum but not enough to significantly affect the transfer to the glass.</p> <p>Once you extend the glass, without a corresponding extension to the aluminum and/or heater element, you are ensuring cooler spots. The glass will be surrounded by air, and begin to conduct some of the heat, certainly, but will also radiate a substantial amount.</p> <p>If you are printing with PLA, you may get away with doing this modification. Very little of the heat from the aluminum will reach the glass.</p> <p>A quick check shows the thermal conductivity of aluminum to be 205 W/m K compared to borosilicate glass at 1.2 W/m K in the range of temperature used for 3D printing. I did not research the rate of energy dissipation for the same range of temperatures, but if it's not too high (unlikely), it would still take forever for the unheated areas of glass to reach temperature.</p> <p>Consider your extension to be an unheated bed and print accordingly.</p>
<p>After Fred's answer, I realized there was a way to test out how much the temperature would drop by offsetting my current glass base to extend past the exge then using a <a href="http://www.flir.com" rel="nofollow noreferrer">FLIR</a> IR Camera to see what the effect would be.</p> <p>Here are the results:</p> <p>The the glass plate does seem act a bit as an insulator causing the print surface to be about 1°C cooler. Here are two photos showing that.</p> <p><a href="https://i.stack.imgur.com/KCCQZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KCCQZ.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/pINUZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pINUZ.jpg" alt="enter image description here"></a></p> <p>As Fred proposed, where the glass extends past the base, the temperature drops pretty quickly. It is still warmer than ambient; but is definitely not "Hot".</p> <p><a href="https://i.stack.imgur.com/4j7Cs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4j7Cs.jpg" alt="enter image description here"></a></p>
651
<p>I am pretty sure that the settings that I am using are correct, so all possible things can be wrong which I should check out so that I can make authentication with our Active Directory work.</p>
<p>Try test if PHP can connect to active directory</p> <pre><code>&lt;?php $ds = ldap_connect('host.ad.lan', 389); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); ldap_bind($ds, 'admin@ad.lan', 'xxx'); $sr = ldap_search($ds, 'CN=Cameron Zemek,OU=Users,OU=BRC,DC=ad,DC=lan', '(objectclass=*)', array('cn')); $entryID = ldap_first_entry($ds, $sr); $data = ldap_get_attributes($ds, $entryID); print_r($data); ldap_close($ds); </code></pre> <p>What do you have has your $config['ldap_user'] and $config['ldap_uid'] ? You want to set $config['ldap_uid'] to sAMAccountName</p>
<p>@grom... thanks but, yes PHP is working just fine. I have a WordPress and a MediaWiki installation on the same server, and they are both authenticating against the same active directory just fine.</p>
6,254
<p>I have a Tevo Tornado Gold 24&nbsp;V. I want to use this LJ12 A3-4-Z/BX Inductive NPN NO 4&nbsp;mm with 6-36&nbsp;V operation current as a Z probe. I do not want to fry my machine by putting in 24&nbsp;V into the sensor input.</p> <p>What do I have is a 12&nbsp;V, single channel optocoupler isolation module.</p> <p>I want to know if this 12&nbsp;V optocoupler module can be used with a 24&nbsp;V power supply, or do I need another module in order to prevent me frying my sensor.</p> <p>If I do need another what would I need? <a href="https://i.stack.imgur.com/cxoYG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxoYG.png" alt="enter image description here"></a></p>
<p><strong>You can safely use the module with 24V.</strong></p> <p>The input side shows a red LED, optocoupler and 1k resistor in series. The LED and optocoupler probably have a voltage drop in the neighbourhood of 3.1-3.5&nbsp;V put together, so for a 12&nbsp;V input you will get a current of approximately 9&nbsp;mA-.</p> <p>For a 24 V input voltage the increased current will cause a slightly higher voltage drop, but even if the voltage drop remains as low as 3.1&nbsp;V the current will still only be 21&nbsp;mA. This is well within the rating of the optocoupler (similar optocouplers are often rated for 60&nbsp;mA) and slightly pushing the rating of the LED (similar LEDs are usually rated for 20&nbsp;mA) but it will probably be fine.</p> <p>For extra peace of mind you could connect an additional resistor in series with the input. The "ideal" value (that is, to keep the current identical to that at 12&nbsp;V) would be 1.3&nbsp;kΩ, though any small value resistor (above 100&nbsp;Ω) would be fine.</p>
<h2>Not using a 12 V rated module <em>&quot;on its own&quot;</em>.</h2> <p>Using a 12 V/5 V optocoupler to try to connect 24 V to the 5 V circuit is running the optocoupler outside of its rating, meaning you will destroy it, either immediately or after a short time.</p> <h2>A properly rated one</h2> <p>To shield the 5 V against the maximal 24 V from the probe without extra parts, you will need to use a 24 V/5 V optocoupler.</p> <h3>Trickery with voltage dividers</h3> <p>With a 50 % <a href="https://en.wikipedia.org/wiki/Voltage_divider" rel="nofollow noreferrer">voltage divider</a> made from two properly rated resistors, you could limit the voltage to the optocoupler, which in turn would turn the 24 V signal into a 12 V signal, which would protect our optocoupler and the board beyond.</p>
1,435
<p>Okay, here's the scenario. I have a utility that processes tons of records, and enters information to the Database accordingly.</p> <p>It works on these records in multi-threaded batches. Each such batch writes to the same log file for creating a workflow trace for each record. Potentially, we could be making close to a million log writes in a day.</p> <p>Should this log be made into a database residing on another server? Considerations:</p> <ol> <li>The obvious disadvantage of multiple threads writing to the same log file is that the log messages are shuffled amongst each other. In the database, they can be grouped by batch id.</li> <li>Performance - which would slow down the batch processing more? writing to a local file or sending log data to a database on another server on the same network. Theoretically, the log file is faster, but is there a gotcha here?</li> </ol> <p>Are there any optimizations that can be done on either approach?</p> <p>Thanks.</p>
<p>I second the other answers here, <strong>depends on what you are doing with the data</strong>.</p> <p>We have two scenarios here:</p> <ol> <li><p>The majority of the logging is to a DB since admin users for the products we build need to be able to view them in their nice little app with all the bells and whistles.</p></li> <li><p>We log all of our diagnostics and debug info to file. We have no need for really "prettifying" it and TBH, we don't even often need it, so we just log and archive for the most part.</p></li> </ol> <p>I would say if the user is doing anything with it, then log to DB, if its for you, then a file will probably suffice.</p>
<p>I think it depends greatly on what you are doing with the log files afterwards.</p> <p>Of the two operations writing to the log file will be faster - especially as you are suggesting writing to a database on another server.</p> <p>However if you are then trying to process and search the log files on a regular basis then the best place to do this would be a database.</p> <p>If you use a logging framework like log4net they often provide simple config file based ways of redirecting input to file or database.</p>
4,930
<p>I work on a complex application where different teams work on their own modules with a degree of overlap. A while back we got a Mediawiki instance set up, partly at my prompting. I have a hard job getting people to actually use it, let alone contribute.</p> <p>I can see a lot of benefit in sharing information. It may at least reduce the times we reinvent the wheel.</p> <p>The wiki is not very structured, but I'm not sure that is a problem as long as you can search for what you need.</p> <p>Any hints?</p>
<p>Some tips:</p> <p>Any time someone sends information by email that really should be in a wiki, make a page for that topic and add what they put in the email. Then reply "Thanks for that info, I've put it into the wiki here so that it's easier to find in the future." </p> <p>Likewise, if you have information you need to share that should be in the wiki, put it there and just send an email with a link to it, rather than email people. </p> <p>When you ask people for information, phrase it so that putting such documentation in the wiki should be considered the default or standard: "I searched in the wiki but I couldn't find it. Have you put that info up there yet?"</p> <p>If you are the "wiki champion", make sure other people know how to use it, e.g. "Did I go through how to create a new page with you yet?"</p> <p>Edit the sidebar to make sure it is relevant to your work.</p> <p>Use "nav box" style templates on related pages for easier navigation.</p> <p>Put something like {{Special:NewPages/5}} on the front page, or recent changes, so that people can see the activity.</p> <p>Take a peek at Recent changes every few days or week, and if you notice someone adding information without being prodded, send them an email or drop by and give them a little compliment.</p>
<p>Find "sticky" items (sub-3 pg. docs / diagrams / etc) something that the team seems to be creating again and again &amp; post it on the wiki. Make sure everyone has access to the wiki and knows its there - set up a notification mechanism if possible. With some luck, the next time they have to access, rather than dig it out of version control or their machines - they should hit the wiki. If they still don't, try to see if the team has enough slack to actually use the wiki - Subtler issues may lie beneath their reluctance. </p>
3,668
<p>This is a self-explanatory question:</p> <p>Why does this thing bubble into my try catch's even when nothing is wrong? </p> <p>Why is it showing up in my log, hundreds of times?</p> <p><strong>I know its a newb question, but if this site is gonna get search ranking and draw in newbs we have to ask them</strong></p>
<p>This is probably coming from a Response.Redirect call. Check this link for an explanation:</p> <p><a href="http://dotnet.org.za/armand/archive/2004/11/16/7088.aspx" rel="noreferrer">http://dotnet.org.za/armand/archive/2004/11/16/7088.aspx</a></p> <p>(In most cases, calling Response.Redirect(url, false) fixes the problem)</p>
<p>Knowing that there are (at least) three APIs that internally use <code>Thread.Abort</code>, I'd like to answer in more practical terms, how to work out what to do about it.</p> <p>For us, this error started being logged all-of-a-sudden. What changed? We fixed a bug in some database procedure that was dealing with sitemaps.</p> <p>The log4net logs showed the X-Forwarded-For header (we're behind an NLB) was Googlebot's IP address, 66.249.78.x which bolstered my theory about the sitemap change leading to Google crawling our site more aggressively looking for images.</p> <p>The first thing was to find out why only the Googlebot was able to cause this problem. No other client was triggering whatever code path uses <code>Response.Redirect</code>, or whatever.</p> <p>So in the <code>HttpApplication.Error</code> handler, I added some code to log extra detailed output with all headers, and most data in the <code>HttpResponse</code> and <code>HttpContext</code> spewed to log.</p> <p>This let me see that the problem was that Googlebot is using an iPhone user agent string and armed with that, I was able to search the codebase for "iPhone" and come up with:</p> <pre><code>private void CheckIPhoneAccess() { ... } </code></pre> <p>And that uses a Redirect.</p> <p>What to do about it?</p> <p>Well, for this aged codebase, it's not worth retro-patching all the <code>Response.Redirect</code> calls, so I'm going to lower the logging level for <code>ThreadAbortException</code> for the application.</p> <p>I will change the behaviour for Googlebot's mobile crawler, that would <em>not</em> lead to 'lies' about what our site serves to mobiles since it only redirects on the first hit, subsequently it reads a cookie and shows the image. Googlebot does not seem to cache that cookie.</p> <p>It's not perfect, but the site is due to be rebuilt. probably by another team using Scala or something, so in practical terms, I think this is a good choice. I'll add comments and may revisit the issue later, build a <code>Response.SafeRedirect</code> extension that encapsulates this advice:</p> <p><a href="https://stackoverflow.com/questions/2777105/why-response-redirect-causes-system-threading-threadabortexception">Why Response.Redirect causes System.Threading.ThreadAbortException?</a></p> <p>Luke</p>
3,348
<p>What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?</p>
<p>You can have almost any character, including most Unicode characters! The exact definition is in <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8" rel="noreferrer">the Java Language Specification under section 3.8: Identifiers</a>.</p> <blockquote> <p>An <em>identifier</em> is an unlimited-length sequence of <em>Java letters</em> and <em>Java digits</em>, the first of which must be a <em>Java letter</em>. ...</p> <p>Letters and digits may be drawn from the entire Unicode character set, ... This allows programmers to use identifiers in their programs that are written in their native languages.</p> <p>An identifier cannot have the same spelling (Unicode character sequence) as a keyword (§3.9), boolean literal (§3.10.3), or the null literal (§3.10.7), or a compile-time error occurs.</p> </blockquote> <p>However, see <a href="https://stackoverflow.com/questions/61615/should-you-use-international-identifiers-in-javac">this question</a> for whether or not you should do that.</p>
<p>Class names should be nouns in UpperCamelCase, with the first letter of every word capitalised. Use whole words — avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML). The naming conventions can be read over here:</p> <p><a href="http://www.oracle.com/technetwork/java/codeconventions-135099.html" rel="nofollow">http://www.oracle.com/technetwork/java/codeconventions-135099.html</a></p>
9,121
<p>On the UNIX bash shell (specifically Mac OS X Leopard) what would be the simplest way to copy every file having a specific extension from a folder hierarchy (including subdirectories) to the same destination folder (without subfolders)?</p> <p>Obviously there is the problem of having duplicates in the source hierarchy. I wouldn't mind if they are overwritten.</p> <p>Example: I need to copy every .txt file in the following hierarchy</p> <pre><code>/foo/a.txt /foo/x.jpg /foo/bar/a.txt /foo/bar/c.jpg /foo/bar/b.txt </code></pre> <p>To a folder named 'dest' and get:</p> <pre><code>/dest/a.txt /dest/b.txt </code></pre>
<p>In bash:</p> <pre><code>find /foo -iname '*.txt' -exec cp \{\} /dest/ \; </code></pre> <p><code>find</code> will find all the files under the path <code>/foo</code> matching the wildcard <code>*.txt</code>, case insensitively (That's what <code>-iname</code> means). For each file, <code>find</code> will execute <code>cp {} /dest/</code>, with the found file in place of <code>{}</code>.</p>
<p>As far as the man page for cp on a FreeBSD box goes, there's no need for a -t switch. cp will assume the last argument on the command line to be the target directory if more than two names are passed.</p>
4,726
<p>Came across this error today. Wondering if anyone can tell me what it means:</p> <blockquote> <blockquote> <p>Cannot sort a row of size 9522, which is greater than the allowable maximum of 8094.</p> </blockquote> </blockquote> <p>Is that 8094 bytes? Characters? Fields? Is this a problem joining multiple tables that are exceeding some limit?</p>
<p>In SQL 2000, the row limit is 8K bytes, which is the same size as a page in memory. </p> <p>[Edit]</p> <p>In 2005, the page size is the same (8K), but the database uses pointers on the row in the page to point to other pages that contain larger fields. This allows 2005 to overcome the 8K row size limitation.</p>
<p>That used to be a problem in SQL 2000, but I thought that was fixed in 2005.</p>
3,746
<p>I'm trying to print <a href="https://www.thingiverse.com/thing:4461654" rel="nofollow noreferrer">a gear for a robovac deal</a>.</p> <p>The issue I'm having is with gaps between the walls of the top part of the gear. It needs to have the corners filled to provide stability or else the tabs easily snap. I've tried adjusting the nozzle size, line width, filter gaps and print thin walls but seems to slice with variations on the same issue. Is this a Cura issue? Is there anyway to slice and print this to fill those gaps?</p> <p><a href="https://i.stack.imgur.com/0g7zy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0g7zy.png" alt="gear with gaps between walls" /></a></p>
<p>The problem isn't Cura, rather its the precision of the 3D model. If parts of the model is smaller than the line width the model cannot be printed. A solution to this would be to increase the thickness of the cylinder, decrease the size of the square or reduce the line width to allow that region to be properly fabricated, another solution would be to decrease the line width (line width option) however, keep in mind that you should not reduce the line width beyond the nozzle hole size (nozzle hole &gt; line width). As mentioned before, if the model requires sections that are smaller than the line width, Cura will ignore it. From the image you provided it would seem that the corners are extremely close to the wall of the cylinder which prevents Cura from making a extrusion path, the reason of which I explained above.</p>
<p>You can fix it by changing <strong>Experimental</strong> &gt; <strong>Slicing Tolerance</strong> &gt; <strong>Exclusive</strong></p> <p><a href="https://i.stack.imgur.com/htVjk.jpg" rel="nofollow noreferrer" title="Cura screenshot of a model with the Slicing tolerance set to Middle"><img src="https://i.stack.imgur.com/htVjk.jpg" alt="Cura screenshot of a model with the Slicing tolerance set to Middle" title="Cura screenshot of a model with the Slicing tolerance set to Middle" /></a></p> <p><a href="https://i.stack.imgur.com/JGAoE.jpg" rel="nofollow noreferrer" title="Cura screenshot of a model with the Slicing tolerance set to Exclusive"><img src="https://i.stack.imgur.com/JGAoE.jpg" alt="Cura screenshot of a model with the Slicing tolerance set to Exclusive" title="Cura screenshot of a model with the Slicing tolerance set to Exclusive" /></a></p>
1,802
<p>I have been working hard the last year on the model below. I am new to everything 3D that is modeling and especially 3D printing. I have however successfully concluded quite a good number of 3D prints which I created in blender with my Creality Ender 3 Pro so I have a bit of experience.</p> <p>All this new experience for me started with the desire to do this project I have been working on for all this year. A complex 3D model of a knight's tomb which I would like to print.</p> <p><a href="https://i.stack.imgur.com/NZ5Lx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NZ5Lx.png" alt="enter image description here"></a></p> <p>As you can see Cura is clearly indicating that there is a need for supports in these red areas. The model will be printed in a 15&nbsp;cm size. I have also managed to resize the model from a 22 million face mesh full of holes to a 900k manifold model.</p> <p>However, when I slice it I get this.</p> <p><a href="https://i.stack.imgur.com/fx5o8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fx5o8.jpg" alt="enter image description here"></a></p> <p>As you can see supports are only generated for the outer column part. None are generated for the arches which are totally absent when the model is sliced.</p> <p>I have tried to alter the model's orientation but with no result. I will try to separate this mesh in parts but it would mean restarting all from scratch since I found no good software to slice it precisely.</p> <p>I am quite sure that the main problem lies in the fact the Ender 3 pro is an FDM printer an that the vertical lines of the arches are too thin. Since I tried to upload my model on 3D printing services to see if it could be printed in other materials and could be printed in finely detailed resin. </p> <p>I would like at least to know if I am right in my problem spotting or if there could be any solution to the present problem so that not to go wrong if I will redesign this part.</p>
<p>Basically you need to write a G-code file yourself. This is a plain text file with a <code>.g</code> extension.</p> <p>You need to home the printer with <code>G28</code>, then move the Y axis all the way forward (for a Prusa style printer) with <code>G1 F1500 Y{ymax}</code> (where <code>{ymax}</code> is the length of the bed). Now raise the head with a similar command <code>G1 F500 Z{zmax}</code> (where <code>{zmax}</code> is the height of the printer volume).</p> <p>Heating the bed is done with <a href="https://reprap.org/wiki/G-code#M190:_Wait_for_bed_temperature_to_reach_target_temp" rel="nofollow noreferrer"><code>M190 S60</code></a> (set and wait to reach 60&nbsp;&deg;C).</p> <p>You can now rock the Y axis by moving it fast, e.g. with <code>G1 F5000 Y{ymax-5}</code>, <code>G1 Y{ymax-1}</code>, <code>Y{ymax-5}</code>, <code>Y{ymax-1}</code>, etc.</p>
<p>Never mind, figured the quickest dirtiest way myself - created a tall thin cylinder shape model in Blender and positioned it in Repetier so the printer head will be clear of the table as it moves. Then just broke off the filament that was currently in the printer so it will stop feeding once the current piece gets to the end of the feeder wheel. - not an endless loop but should give me a good 10 or 20 minutes of agitation before I need to restart the print if necessary.</p>
1,648
<p>I've had issues with my hot end and decided to replace the whole assembly with <a href="https://www.amazon.ca/Ewigkeit-Extruder-Printer-Assembled-Aluminum/dp/B07Q493RYW/ref=sr_1_4_sspa?keywords=hot%20end&amp;qid=1574768751&amp;sr=8-4-spons&amp;psc=1&amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUFYVDRSMjVZRDU3QkMmZW5jcnlwdGVkSWQ9QTAwODExMTRZSzAwSjdZQzJJTzkmZW5jcnlwdGVkQWRJZD1BMDMxMzczNDNZWjNVUTRNNUU0MSZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=" rel="nofollow noreferrer">this</a>. After the replacement, my printer started reading about 135/185&nbsp;&deg;C for the hot end and bed are both at room temperature. It also gives the "Heating Failed" error message. Printer halted when I tried to heat it. </p> <p>Things I've tried:</p> <ol> <li>Checked the wiring, the thermistors are reading about 110k and 10k at end of the wires.</li> <li>Tried updating the firmware with a few different thermistor settings. Only the static (dummy) ones worked (reading a static value of 25/100&nbsp;&deg;C)</li> <li>Tried with old thermistor and reading stayed at 135/185&nbsp;&deg;C.</li> </ol> <p>I'm suspecting something wrong with the motherboard but was hoping I could figure out what's wrong before going ahead and buying a new board. Would appreciate any thoughts/suggestions.</p> <p>In troubleshooting the issue, I tried disconnecting one/both of the thermistors at a time and the reading stayed unchanged. Now thinking I might've somehow broken the board when I was disassembling it.</p> <p>Upon receiving a new motherboard, that fixed the bed temperature reading. The hot end is now reading -14&nbsp;&deg;C with the thermistor plugged/unplugged. Took the resistances on the old and new hot end thermistors and couldn't get reading from either. So turned out both the stock motherboard and my hot end thermistors were not working. Ordered new thermistors and that should fix the problem. </p>
<p>I got my printer fixed and am posting steps I took for people with similar problems in the future. </p> <p><strong>Initial problem:</strong></p> <p>After I replaced my entire heating unit and reconnected the wires, my printer started to read about 135/185 °C for the nozzle and bed at room temperature. It gives the "Heating failed, printer halted, please reset" error when I tried to heat the hot end and bed. </p> <p><strong>Troubleshooting steps:</strong></p> <ol> <li>Checked the resistance of the thermistors. Both the hot end and bed were about 100k. </li> <li>Reflashed Marlin with different thermistor settings. Only the static (dummy) ones worked (reading a static value of 25/100 °C). All the other settings were giving very high readings at room temperature. </li> <li>Replaced the mainboard. This fixed the bed reading but hot end was still not working. Checked the hot end thermistor again at this point and couldn't get any values, which suggests the thermistor wire was broken somewhere. </li> <li>Replaced the hot end thermistor and that fixed all the issues. </li> </ol> <p>So what I think happened was that I messed up the board when I was reconnecting the heating unit. Then at some point after I first measured the thermistor resistance, the hot end thermistor broke. Replaced the thermistor and that solved the issue. </p>
<p>For future readers,</p> <p>On a second-hand 3D printer with unknown firmware, I compiled the Marlin 2.1.1 firmware for the Creality 4.2.7 board with the default configurations for the <code>BOARD_CREALITY_V427</code> board, and at room temperature, the hotend reads about 121 °C.</p> <p>I then measured the hotend thermistor by disconnecting the JST cable and got 9.1 kΩ with the room temperature of about 30 °C. This tells me the thermistor is a 10 kΩ NTC type.</p> <p>The default configuration for Marlin is 100 kΩ NTC.</p> <p>So, if you have a 10 kΩ hotend thermistor, either <a href="https://ericdraken.com/compile-marlin-firmware/" rel="nofollow noreferrer">recompile</a> the Marlin firmware for a 10 kΩ NTC thermistor (more trouble than it is worth if you do not know the temperature curve data), or get a new thermistor specifically listed in <code>Configuration.h</code>, for example:</p> <pre><code> * Analog Thermistors - 4.7 kΩ pullup - Normal * ------- * 1 : 100 kΩ EPCOS - Best choice for EPCOS thermistors * 331 : 100 kΩ Same as #1, but 3.3V scaled for MEGA * 332 : 100 kΩ Same as #1, but 3.3V scaled for DUE * 2 : 200 kΩ ATC Semitec 204GT-2 * 202 : 200 kΩ Copymaster 3D * 3 : ??? Ω Mendel-parts thermistor * 4 : 10 kΩ Generic Thermistor !! DO NOT use for a hotend - it gives bad resolution at high temp. !! * 5 : 100 kΩ ATC Semitec 104GT-2/104NT-4-R025H42G - Used in ParCan, J-Head, and E3D, SliceEngineering 300 °C * 501 : 100 kΩ Zonestar - Tronxy X3A * 502 : 100 kΩ Zonestar - used by hot bed in Zonestar Průša P802M * 503 : 100 kΩ Zonestar (Z8XM2) Heated Bed thermistor * 504 : 100 kΩ Zonestar P802QR2 (Part# QWG-104F-B3950) Hotend Thermistor * 505 : 100 kΩ Zonestar P802QR2 (Part# QWG-104F-3950) Bed Thermistor ... </code></pre>
1,523
<p>As a project manager, you are required to organize time so that the project meets a deadline.</p> <p>Is there some sort of equations to use for estimating how long the development will take?</p> <p>let's say the database</p> <p><code>time = sql storedprocedures * tables manipulated or something similar</code></p> <p>Or are you just stuck having to get the experience to get adequate estimations? </p>
<p>As project manager you have to remember that the best you will ever we be able to do <em>on your own</em> is give your best guess as to how long a given project will take. How accurate you are. depends on your experience and the scope of the project.</p> <p>The only way I know of to get a reasonably accurate estimate that is it to break the project into individual tasks and get the developer <em>who will be doing the actual work</em> to put an estimate on each task. You can then use an evidence based algorithm that takes the estimation accuracy of each developer into account to give you the probability of hitting a given deadline.</p> <p>If the probability is too low, you have two choices: remove features or move the deadline.</p> <p>Further reading:</p> <ul> <li><a href="http://www.joelonsoftware.com/items/2007/10/26.html" rel="nofollow noreferrer">http://www.joelonsoftware.com/items/2007/10/26.html</a></li> <li><a href="http://www.wordyard.com/2007/10/11/evidence-based-scheduling/" rel="nofollow noreferrer">http://www.wordyard.com/2007/10/11/evidence-based-scheduling/</a></li> <li><a href="http://en.wikipedia.org/wiki/Monte_Carlo_method" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Monte_Carlo_method</a></li> </ul>
<p>There will be such a formula as soon as computers can start generating <em>all</em> code themselves. Until then you are stuck with human developers who all have different levels of skill and development speed.</p>
6,596
<p>It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life.</p> <p>Are there any other methods that you've found that might be of use to me and anybody else that's hit the same problem?</p> <p>Example, all on one line:</p> <pre><code>if (var1 = true &amp;&amp; var2 = true &amp;&amp; var2 = true &amp;&amp; var3 = true &amp;&amp; var4 = true &amp;&amp; var5 = true &amp;&amp; var6 = true) { </code></pre> <p>Example, multi-line:</p> <pre><code>if (var1 = true &amp;&amp; var2 = true &amp;&amp; var2 = true &amp;&amp; var3 = true &amp;&amp; var4 = true &amp;&amp; var5 = true &amp;&amp; var6 = true) { </code></pre> <p>Example-nested:</p> <pre><code>if (var1 = true &amp;&amp; var2 = true &amp;&amp; var2 = true &amp;&amp; var3 = true) { if (var4 = true &amp;&amp; var5 = true &amp;&amp; var6 = true) { </code></pre>
<p>Separate the condition in several booleans and then use a master boolean as the condition.</p> <pre><code>bool isOpaque = object.Alpha == 1.0f; bool isDrawable = object.CanDraw &amp;&amp; object.Layer == currentLayer; bool isHidden = hideList.Find(object); bool isVisible = isOpaque &amp;&amp; isDrawable &amp;&amp; ! isHidden; if(isVisible) { // ... } </code></pre> <p>Better yet:</p> <pre><code>public bool IsVisible { get { bool isOpaque = object.Alpha == 1.0f; bool isDrawable = object.CanDraw &amp;&amp; object.Layer == currentLayer; bool isHidden = hideList.Find(object); return isOpaque &amp;&amp; isDrawable &amp;&amp; ! isHidden; } } void Draw() { if(IsVisible) { // ... } } </code></pre> <p>Make sure you give your variables name that actualy indicate intention rather than function. This will greatly help the developer maintaining your code... it could be YOU!</p>
<p>If you do this:</p> <pre><code>if (var1 == true) { if (var2 == true) { if (var3 == true) { ... } } } </code></pre> <p>Then you can also respond to cases where something isn't true. For example, if you're validating input, you could give the user a tip for how to properly format it, or whatever.</p>
2,793
<p>Assuming you have a suitable oven to maintain temperature at the filament melting point and a suitable mold that can handle the temperature, is a commodity 3D printer hotend and extruder, with large nozzle, suitable for injecting material into the mold? I'm thinking of a setup like having the hotend mounted through a wall of the oven, braced against a hole in the mold inside the oven, and feeding filament via motor or manual cranking outside. Or is much higher pressure needed to make something like this work?</p> <p>Certainly there are better setups to do this for manufacturing at scale, but the point of this question is whether you can do it with minimal setup effort and cost using commodity parts and filaments rather than needing expensive or custom-built equipment and material sourcing.</p> <p>For relevance to the site in case it's questionable: certainly if this technique is possible, it could be used along with initial 3D printing of a design and using that to produce a (e.g. high-temperature epoxy) mold.</p>
<p>Injection molding requires two major components: pressure and heat. So your question can be broken down into those two halves: can your average extruder handle injection molding temperatures, and can it handle injection molding pressures?</p> <p><strong>Let's start with pressure.</strong> Per <a href="http://www.me.umn.edu/%7Ekstelson/research_sbp/sbp/case/case_general.html" rel="nofollow noreferrer">this page</a> on the University of Minnesota's site, plastic injection molding tends to require pressures of around 2 to 8 tons per square inch. Assuming you're using a 0.4 mm nozzle, which has a cross-section of 0.126 mm², that works out to be 0.000195 (1.95E-4) square inches, which translates to about 3 lb of pressure total at the nozzle assuming you're going for the high end of 8 tons (16,000 lb). However because of the way that you're treating the molten filament in the extruder as a hydraulic fluid, you've got to deal with the fact that the &quot;piston&quot; on one end is actually quite a lot larger area, which means you have to multiply the force by that difference in size. The cross-section of 1.75 mm filament is approx. 9.62 mm², or 0.149 in². That's 76.4 times larger, which means you need to be pushing on the end of that filament with roundabout 230 pounds, or 105 kg, of force.</p> <p>For reference, the Nema 17 that's on my extruder is spec'd at 76 oz-in of torque, geared down 4:1 through a Wade's extruder, and then acting on a hobbed gear with a 6 mm effective diameter (3 mm radius). Much to my own surprise, as I write this, that means that my little plastic extruder is actually capable of just north of 160 lb of pressure force! All these numbers would need to be recalculated for 3 mm filament, and I have no experience with 3 mm, so we're going to skip that one for now.</p> <p>Now, that being said, my extruder is also capable of shredding filament if conditions aren't just right. The main two problems you'll have to overcome is 1) gripping the filament hard enough without destroying it, and 2) keeping the filament from buckling. I think if you got clever with some gears keeping multiple hobbed gears synced up, and a polished aluminum or steel feed tube, you could absolutely make your own extruder that's capable of consistently putting 300+ pounds of force on your plastic filament without it buckling or stripping. The downside is that your feed rates are going to be fairly slow, so each injection molding is likely going to take you quite a bit of time. A larger motor such as a beefy NEMA23 might help offset that by giving you much higher torque at higher speeds, so long as you can melt the filament fast enough. However we'll need to revisit these pressure numbers in a few moments, after I explain a few things about temperature.</p> <p><strong>Next, let's look at temperatures.</strong> Obviously we know that we can melt the filament itself as it's moving through the extruder. Using a Volcano nozzle or something, you can even guarantee molten filament at a fairly high extrusion rate. However most printers are designed such that the filament cools to solid (60-80 °C normally) almost immediately. Injection molding designs require that the entire mass of plastic be kept molten. Fortunately, ABS and PLA melting temps are easily reached by literally any toaster oven, so stick your setup in there and you're golden, right?</p> <p><strong>But wait, there's more!</strong> One of the problems you'll run into immediately is that extruders are carefully designed so that the plastic is molten for as little time as possible, because molten plastic against a metal tube introduces a bunch of friction, hence the need for super high pressures during injection molding. If the plastic melts too soon, then you'll clog up your heatsink (the &quot;cold&quot; side of the extruder), and won't be able to extrude at all. This is a fairly common source of jams in 3D printing, where you're extruding too slowly and there's not enough cooling on the heatsink. Fortunately, E3D sells a water-cooled Titan extruder that would keep the heatsink cool. However the rest of your gearing assembly, and the motor, will also need active cooling, as heat damages the permanent magnets in the rotors, and the printed geared assembly obviously will melt if put inside an oven. Your best bet might be a water-cooled Bowden setup, assuming you can find tube fittings that can withstand several hundred pounds of force. You might look into using solid tubes like brake line rather than your normal PTFE shenanigans.</p> <p><strong>TL;DR:</strong> Get you a water-cooled extruder, make a super-strong Bowden setup, and gear down a huge motor with a bunch of synchronized hobbed gears, and you might actually pull it off! There's plenty of Thingiverse extruder files you can use as a starting point.</p> <p>As far as commercially available extruders go, however, I don't think you're going to find anything that's immediately available that can handle what you need it to without some level of modification depending on your selected injection pressures.</p>
<p>An injection molding injector melts all the plastic needed for the shot and pushes it into the mold and through the sprue very quickly. Perhaps that is why it is called a "shot".</p> <p>Injection molding machines do not heat the mold to plastic-melting temperatures. This works because the plastic is injected quickly, and fills the mold before the plastic cools. Molds are designed so that this happens, and often include multiple thick sprues to direct plastic to all parts of the hold.</p> <p>Injecting with a 3D printer extruder will be a slow process. If the mold is not above the melting point, the plastic will cool and likely become a tangle of thread at the entrance of the mold. To combat that, you could heat the mold. This is doable, and will suitable insulation the temperature of the cold end and the extruder should be acceptable.</p> <p>With the mold heated, you would inject plastic until the mold is full. The mold heater would then be disabled and the mold would cool. This would take a long time.</p> <p>Injection molding machines typically have water-cooled molds to cool the plastic more quickly. Time is money for an injection molding factory, and cooling quickly is key to productivity.</p> <p>For the 3D printer injection molding machine, the time when the plastic is hot could be fairly long -- longer than would typically be found in injection molding. I am concerned that some plastics, perhaps such as PLA, would degrade or burn during the long molten time. Experience would be required.</p>
1,332
<p>Does a new <code>SessionFactor</code>y and <code>Session</code> object have to be created for each database? I have a data store for my application data, and a separate data store for my employee security, which is used to validate users. Do I have to create a new SessionFactory ans Session object for calls to the 2 different databases?</p>
<p>ok so this doesn't answer your question directly but it might offer an insight as to why you should create multiple session objects for each datastore.</p> <p><a href="http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx" rel="nofollow noreferrer">This article</a> explains how you can implement a thread safe lazy singleton for each type of Session you need so that you only have one session per datastore but it's shared across the entire application. So at most you're only ever going to have 2 session objects.</p> <p>To directly answer your question however, you will need 1 session object per database.</p>
<h1>General case</h1> <p>The general case answer is no, you need at least different sessions for the general case.</p> <p>You may use a single session factory by using the <code>OpenSession</code> overload taking an opened connection as argument, allowing you to switch database for the session requiring it.</p> <p>This has some drawbacks, like lack of connection auto-releasing after transactions, disabling of second level cache, ... Better have two session factories in my opinion, rather than supplying your own connection on session opening.</p> <h1>Database specific cases</h1> <p>Depending on the database server you use, you may be able to use a single connection string for accessing both with NHibernate. If you can use a single connection string, then you can use a single session factory and use the same session for accessing your entities split between two databases.</p> <h2>Simplest case</h2> <p>Using SQL Server, you may have your two databases on the same SQL Server. In such case, you can use a single connection string and adjust the <code>catalog</code> attribute on your <code>&lt;class&gt;</code> mappings for telling in which database the table is to be found. (<code>schema</code> can be used too, by appending a dot. It is available in NHibernate since longer, so with an old version you may only have <code>schema</code>.)</p> <p>Of course, the connection credentials must be valid for accessing both databases.</p> <h2>Other cases</h2> <p>Still using SQL Server, if the second database is on another server, you may use a linked server. You would adjust again the <code>catalog</code> attribute on classes requiring it for specifying the appropriate <code>linkedServerName.DbName</code>.</p> <p>Maybe other databases could have similar solutions.</p>
8,055
<p>I've written a Python package that includes a bsddb database of pre-computed values for one of the more time-consuming computations. For simplicity, my setup script installs the database file in the same directory as the code which accesses the database (on Unix, something like /usr/lib/python2.5/site-packages/mypackage/).</p> <p>How do I store the final location of the database file so my code can access it? Right now, I'm using a hack based on the <code>__file__</code> variable in the module which accesses the database:</p> <pre> dbname = os.path.join(os.path.dirname(__file__), "database.dat") </pre> <p>It works, but it seems... hackish. Is there a better way to do this? I'd like to have the setup script just grab the final installation location from the distutils module and stuff it into a "dbconfig.py" file that gets installed alongside the code that accesses the database.</p>
<p>Try using pkg_resources, which is part of setuptools (and available on all of the pythons I have access to right now):</p> <pre><code>&gt;&gt;&gt; import pkg_resources &gt;&gt;&gt; pkg_resources.resource_filename(__name__, "foo.config") 'foo.config' &gt;&gt;&gt; pkg_resources.resource_filename('tempfile', "foo.config") '/usr/lib/python2.4/foo.config' </code></pre> <p>There's more discussion about using pkg_resources to get resources on the <a href="http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources" rel="noreferrer">eggs</a> page and the <a href="http://peak.telecommunity.com/DevCenter/PkgResources" rel="noreferrer">pkg_resources</a> page.</p> <p>Also note, where possible it's probably advisable to use pkg_resources.resource_stream or pkg_resources.resource_string because if the package is part of an egg, resource_filename will copy the file to a temporary directory.</p>
<p>That's probably the way to do it, without resorting to something more advanced like using setuptools to install the files where they belong.</p> <p>Notice there's a problem with that approach, because on OSes with real a security framework (UNIXes, etc.) the user running your script might not have the rights to access the DB in the system directory where it gets installed.</p>
6,015
<p>Dear experts and 3D printer users;</p> <p>I am a beginner in 3D printing field. I read couple of answers in forums and i cannot find exact answer to my problem. </p> <p>Printing quality dropped when i try to write vertical axis (i mean, columns). There is no problem in horizontal axis. </p> <p>My column width must be 0.5 mm, and printer nozzle diameter is 0.4 mm. I think I should write 0.5 mm column with 0.4 mm nozzle with ease. </p> <p>I added messy structure to this post and you can find writing details below. <a href="https://i.stack.imgur.com/VbBo0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VbBo0.jpg" alt="Printed Structure"></a> What do you think? What is your suggestion to overcome this problem? </p> <p>Printer:Ultimaker 3, Slicer:Cura,</p> <p>Printing Details; Nozzle diameter:0.4 mm, Profile:Fine 0.1 mm, Layer height:0.1 mm, Wall thickness:1 mm, Top bottom thickness:1 mm, Infill density: 100 %, Gradual infill steps:0, Printing Temp:240 C, Build plate Temp:65 C, Diameter: 2.85 mm, Dimensions of the material:10X10X5 mm</p>
<p><strong>The main problem with your setup is the nozzle width</strong>. It is simply too big to accurately print a structure that tiny. An integral part of the filament deposition is the "smearing" of the molted plastic, that clearly can't happen if the structure is about the same size of the nozzle bore. Also the printed structure is too flimsy to resist the "suction" of such a big nozzle moving away.</p> <p><strong>I would suggest to use a smaller nozzle and/or increase the size of your pillars</strong>. A good combo would be 0.2mm nozzle with 0.6mm or 0.8mm pillars. For these small details, it would be best to have a pillar size that is a perfect multiple of your nozzle diameter.</p> <p>Other settings that will help you:</p> <ul> <li>reduce the print dramatically (try 20 or 30 mm/s)</li> <li>use retraction (or increase its amount/speed)</li> <li>make sure your cooling fan is 100%</li> <li>use a sensible "minimum layer time" (try 10 seconds for a start)</li> </ul> <p>The first two settings should reduce the force/impulse applied by the nozzle on the pillar.</p> <p>The latter two should make sure your pillar is "solid" when extruding a new layer on top of it.</p>
<p>You cannot hope to print 0.5mm columns with a 0.4mm print head successfully using an FDM printer. Basically, you are asking the printer to lay down tiny blobs of filament, one of top of another. You have two options:</p> <ol> <li><p>Use a finer nozzle (e.g. 0.1mm). However, such nozzles are reported as being very difficult to use.</p></li> <li><p>Switch to a different printing technology (e.g. SLA). Resin and powder-based printers have much finer resolutions, and will have no difficulty printing the model that you describe.</p></li> </ol>
798
<p>How do I do backups in MySQL? </p> <p>I'm hoping there'll be something better than just running mysqldump every "x" hours.</p> <p>Is there anything like SQL Server has, where you can take a full backup each day, and then incrementals every hour, so if your DB dies you can restore up to the latest backup?</p> <p>Something like the DB log, where as long as the log doesn't die, you can restore up to the exact point where the DB died?</p> <p>Also, how do these things affect locking? I'd expect the online transactions to be locked for a while if I do a mysqldump.</p>
<p>You might want to look at <a href="http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html" rel="noreferrer">incremental backups</a>.</p>
<p>@Daniel,</p> <p>in case you are still interested, there is a newish (new to me) solution shared by <a href="http://capttofu.livejournal.com/" rel="nofollow noreferrer">Paul Galbraith</a>, a tool that allows for online backup of innodb tables called <a href="http://www.innodb.com/hot-backup/" rel="nofollow noreferrer">ibbackup</a> from oracle which to quote Paul,</p> <blockquote> <p>when used in conjunction with <a href="http://www.innodb.com/support/documentation/innodb-hot-backup-manual/#innobackup" rel="nofollow noreferrer">innobackup</a>, has worked great in creating a nightly backup, with no downtime during the backup</p> </blockquote> <p>more detail can be found on <a href="http://capttofu.livejournal.com/12455.html" rel="nofollow noreferrer">Paul's blog</a></p>
6,870
<p>I have some code like this:</p> <pre><code>If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then DoSomething() End If </code></pre> <p>I don't care about the case. Should I use <code>OrdinalIgnoreCase</code>, <code>InvariantCultureIgnoreCase</code>, or <code>CurrentCultureIgnoreCase</code>?</p>
<p><strong><a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#choosing-a-stringcomparison-member-for-your-method-call" rel="noreferrer">Newer .Net Docs now has a table to help you decide which is best to use in your situation.</a></strong></p> <p>From MSDN's "<a href="https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/ms973919(v=msdn.10)" rel="noreferrer">New Recommendations for Using Strings in Microsoft .NET 2.0</a>"</p> <blockquote> <p>Summary: Code owners previously using the <code>InvariantCulture</code> for string comparison, casing, and sorting should strongly consider using a new set of <code>String</code> overloads in Microsoft .NET 2.0. <em>Specifically, data that is designed to be culture-agnostic and linguistically irrelevant</em> should begin specifying overloads using either the <code>StringComparison.Ordinal</code> or <code>StringComparison.OrdinalIgnoreCase</code> members of the new <code>StringComparison</code> enumeration. These enforce a byte-by-byte comparison similar to <code>strcmp</code> that not only avoids bugs from linguistic interpretation of essentially symbolic strings, but provides better performance.</p> </blockquote>
<p>The very simple answer is, unless you are using Turkish, you don't need to use InvariantCulture.</p> <p>See the following link:</p> <p><a href="https://stackoverflow.com/questions/3550213/in-c-sharp-what-is-the-difference-between-toupper-and-toupperinvariant">In C# what is the difference between ToUpper() and ToUpperInvariant()?</a> </p>
9,832
<p>Are there any good solutions to represent a parameterized enum in <code>C# 3.0</code>? I am looking for something like <a href="http://www.ocaml.org" rel="nofollow noreferrer">OCaml</a> or <a href="http://www.haxe.org" rel="nofollow noreferrer">Haxe</a> has. I can only think of class hierarchy with a simple enum field for easy switching for now, maybe there are better ideas?</p> <p>See Ocaml example below in one of the replies, a Haxe code follows:</p> <pre><code>enum Tree { Node(left: Tree, right: Tree); Leaf(val: Int); } </code></pre>
<p>Not being familiar with OCaml or Haxe, and not being clever enough to understand the other explanations, I went and looked up the <a href="https://haxe.org/manual/types-enum-instance.html" rel="nofollow noreferrer">Haxe enum documentation</a> - the 'Enum Type Parameters' bit at the bottom seems to be the relevant part.</p> <p>My understanding based on that is as follows:</p> <p>A 'normal' enum is basically a value which is restricted to the things that you have defined in your enum definition. C# Example:</p> <pre><code>enum Color{ Red, Green, Yellow, Blue }; Color c = Color.Red; </code></pre> <p><code>c</code> can either be <code>Red</code>, <code>Green</code>, <code>Yellow</code>, or <code>Blue</code>, but nothing else.</p> <p>In Haxe, you can add complex types to enums, Contrived example from their page:</p> <pre><code>enum Cell&lt;T&gt;{ empty; cons( item : T, next : Cell&lt;T&gt; ) } Cell&lt;int&gt; c = &lt;I don't know&gt;; </code></pre> <p>What this <em>appears</em> to mean is that <code>c</code> is restricted to either being the literal value <code>empty</code> (like our old fashioned C# enums), or it can also be a complex type <code>cons(item, next)</code>, where <code>item</code> is a <code>T</code> and <code>next</code> is a <code>Cell&lt;T&gt;</code>.</p> <p>Not having ever used this it looks like it is probably generating some anonymous types (like how the C# compiler does when you do <code>new { Name='Joe'}</code>.<br> Whenever you 'access' the enum value, you have to declare <code>item</code> and <code>next</code> when you do so, and it looks like they get bound to temporary local variables.</p> <p>Haxe example - You can see 'next' being used as a temporary local variable to pull data out of the anonymous cons structure:</p> <pre><code>switch( c ) { case empty : 0; case cons(item,next): 1 + cell_length(next); } </code></pre> <p>To be honest, this blew my mind when I 'clicked' onto what it seemed to be doing. It seems incredibly powerful, and I can see why you'd be looking for a similar feature in C#.</p> <p>C# enums are pretty much the same as C/++ enums from which they were originally copied. It's basically a nice way of saying <code>#define Red 1</code> so the compiler can do comparisons and storage with integers instead of strings when you are passing <code>Color</code> objects around.</p> <p>My stab at doing this in C# would be to use generics and interfaces. Something like this:</p> <pre><code>public interface ICell&lt;T&gt; { T Item{ get; set; } ICell&lt;T&gt;{ get; set; } } class Cons&lt;T&gt; : ICell&lt;T&gt; { public T Item{ get; set; } /* C#3 auto-backed property */ public Cell&lt;T&gt; Next{ get; set; } } class EmptyCell&lt;T&gt; : ICell&lt;T&gt;{ public T Item{ get{ return default(T); set{ /* do nothing */ }; } public ICell&lt;T&gt; Next{ get{ return null }; set{ /* do nothing */; } } </code></pre> <p>Then you could have a <code>List&lt;ICell&lt;T&gt;&gt;</code> which would contain items and next cell, and you could insert <code>EmptyCell</code> at the end (or just have the <code>Next</code> reference explicitly set to null). The advantages would be that because <code>EmptyCell</code> contains no member variables, it wouldn't require any storage space (like the <code>empty</code> in Haxe), whereas a <code>Cons</code> cell would.<br> The compiler may also inline / optimize out the methods in <code>EmptyCell</code> as they do nothing, so there may be a speed increase over just having a <code>Cons</code> with it's member data set to null.</p> <p>I don't really know. I'd welcome any other possible solutions as I'm not particularly proud of my one :-)</p>
<p>C# (the .NET framework in general, as far as I know) doesn't support parametrized enums like Java does. That being said, you might want to look at Attributes. Some of the features that Java enums are capable of are somewhat doable through Attributes.</p>
9,237
<p>I currently use <a href="http://subversion.tigris.org/" rel="nofollow noreferrer">subversion</a> for my version control via <a href="http://ankhsvn.open.collab.net/" rel="nofollow noreferrer">AhnkSVN</a> and Visual Studio. I recently started using <a href="http://www.codeplex.com/treesurgeon" rel="nofollow noreferrer">Tree Surgeon</a> to set up my projects. It creates a build script automatically using <a href="http://nant.sourceforge.net/" rel="nofollow noreferrer">NAnt</a>. I would like to be able to automate builds regularly projects within SVN. I like the idea of doing a build on every check in but nightly builds would work as well. I would give more information or more of my thoughts but figured I would leave it open and see what the SO community has to say.</p>
<p>You could use <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" rel="nofollow noreferrer">CruiseControl.Net</a>, which can do a build on every check in, nightly builds, or however you want to do it. A quick google search suggests CC.Net has some <a href="http://ccnet.sourceforge.net/CCNET/NAnt%20Task.html" rel="nofollow noreferrer">integration with NAnt</a> already.</p>
<p>You might want to consider CI-Factory. It's a continuous integration environment builder that uses CruiseControl.NET and a dozen other tools. There's an excellent screencast here: <a href="http://www.dnrtv.com/default.aspx?showID=64" rel="nofollow noreferrer">http://www.dnrtv.com/default.aspx?showID=64</a></p>
5,718
<p>The table doesn't have a last updated field and I need to know when existing data was updated. So adding a last updated field won't help (as far as I know).</p>
<p>SQL Server 2000 does not keep track of this information for you. </p> <p>There may be creative / fuzzy ways to guess what this date was depending on your database model. But, if you are talking about 1 table with no relation to other data, then you are out of luck.</p>
<p>You can add a timestamp field to that table and update that timestamp value with an update trigger.</p>
2,495
<p>The <code>printf</code> function takes an argument type, such as <code>%d</code> or <code>%i</code> for a <code>signed int</code>. However, I don't see anything for a <code>long</code> value.</p>
<p>Put an <code>l</code> (lowercased letter L) directly before the specifier. </p> <pre><code>unsigned long n; long m; printf("%lu %ld", n, m); </code></pre>
<p>I think to answer this question definitively would require knowing the compiler name and version that you are using and the platform (CPU type, OS etc.) that it is compiling for.</p>
5,944
<p>Do we need mold release agent in 3D printing mold? If it is not used, what effect will it have on the product?</p>
<p>It seems I misread your question. </p> <h2>3D Printed Mold</h2> <p>You were asking about (or the question now states) use of a mold release compound to prevent a molded part from sticking to a 3d print mold.</p> <p>Yes. It is always beneficial for the molded part to not stick to the mold. Easy separation and part removal is important for the life of the mold and for the surface finish of the part.</p> <p>There are two molding situations that seem important. </p> <h2>Flexible Mold or Object</h2> <p>In the first, either the part of the mold is elastic, so the actual sliding of one surface on the other isn't important. Here, a mold release agent would help by preventing the cast object from binding to the mold material.</p> <h2>Stiff Mold and Object</h2> <p>The second case is where both the mold and the object are stiff, and the object must slide out of the mold. Here the layer lines should be considered, since there may, locally, be reverse draft angles where the larger part can not slip past an obstructing filament line. Using a process that doesn't leave filament lines, or using the thinnest possible filament layers, or smoothing the mold internal surfaces, or possibly filling the spaces between the ridges with another material may eliminate the problem. A "mold release agent" would still be used to reduce the attachment of the object to the mold, although one may be able to use ample release agent both to fill the groves in the mold and prevent adhesion.</p>
<p>Welcome to the 3D Printing Stack Exchange site.</p> <h2>Used in Casting</h2> <p>A mold release agent is commonly used when a part is cast. The release agent is placed on the inside of the mold before the liquid object is added. As the object becomes solid, the release agent prevents the object from adhering to the mold. As a result, the objects are easier to pop out of the mold, and in some processes, the mold can be reused.</p> <h2>3D Printing is Different</h2> <p>A mold release agent is used to allow the desired part to be separated from the mold. In FDM (thin plastic extrusions bonding together into objects) 3D printing, the object is surrounded by air, except for the bottom where the object contacts the print bed.</p> <h2>Bed Adhesion</h2> <p>For most materials, getting the bottom of the object to stick firmly enough is the problem faced, rather than making it easy to remove. In many cases, a compound is placed on the top of the bed to help the plastic stick to the bed. It is a "mode adhesion agent" rather than a release agent.</p> <p>For some combinations of materials, the bed material and the plastic have a particularly strong adhesion, such that it can be difficult to remove the object without damaging the bed surface. Notably, this occurs with a PEI bed and PETG plastic. In this and similar cases, the mold adhesion agents can be used on the bed. This slightly separates the plastic from the bed material, and we can avoid bed damage.</p> <h2>Internal Adhesion</h2> <p>With multimaterial printers becoming more common, there are cases where two parts which might touch and stich during printing should be isolated during the printing process. A second (or third) material can be used to isolate the parts. If the isolation material is sufficiently different from the desired objects, it can be removed by a solvent.</p> <p>This approach is limited to cases where the objects should be separated by at least one printer thickness of the soluble material.</p>
1,459
<p>I save stuff in an <a href="http://msdn.microsoft.com/en-us/library/3ak841sy.aspx" rel="nofollow noreferrer">Isolated Storage</a> file (using class IsolatedStorageFile). It works well, and I can retrieve the saved values when calling the saving and retrieving methods in my <a href="http://en.wikipedia.org/wiki/Data_access_layer" rel="nofollow noreferrer">DAL</a> layer from my GUI layer. However, when I try to retrieve the same settings from another assembly in the same project, it gives me a FileNotFoundException. What do I do wrong? This is the general concept:</p> <pre><code> public void Save(int number) { IsolatedStorageFile storage = IsolatedStorageFile.GetMachineStoreForAssembly(); IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filename, FileMode.OpenOrCreate, storage); StreamWriter writer = new StreamWriter(fileStream); writer.WriteLine(number); writer.Close(); } public int Retrieve() { IsolatedStorageFile storage = IsolatedStorageFile.GetMachineStoreForAssembly(); IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filename, FileMode.Open, storage); StreamReader reader = new StreamReader(fileStream); int number; try { string line = reader.ReadLine(); number = int.Parse(line); } finally { reader.Close(); } return number; } </code></pre> <p>I've tried using all the GetMachineStoreFor* scopes.</p> <p>EDIT: Since I need several assemblies to access the files, it doesn't seem possible to do with isolated storage, unless it's a <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="nofollow noreferrer">ClickOnce</a> application.</p>
<p>When you instantiated the IsolatedStorageFile, did you scope it to IsolatedStorageScope.Machine?</p> <p>Ok now that you have illustrated your code style and I have gone back to retesting the behaviour of the methods, here is the explanation:</p> <ul> <li>GetMachineStoreForAssembly() - scoped to the machine and the assembly identity. Different assemblies in the same application would have their own isolated storage.</li> <li>GetMachineStoreForDomain() - a misnomer in my opinion. scoped to the machine and the domain identity <em>on top of</em> the assembly identity. There should have been an option for just AppDomain alone.</li> <li>GetMachineStoreForApplication() - this is the one you are looking for. I have tested it and different assemblies can pick up the values written in another assembly. The only catch is, the <em>application identity</em> must be verifiable. When running locally, it cannot be properly determined and it will end up with exception "Unable to determine application identity of the caller". It can be verified by deploying the application via Click Once. Only then can this method apply and achieve its desired effect of shared isolated storage.</li> </ul>
<p>When you are saving, you are calling GetMachineStoreForDomain, but when you are retrieving, you are calling GetMachineStoreForAssembly.</p> <p>GetMachineStoreForAssembly is scoped to the assembly that the code is executing in, while the GetMachineStoreForDomain is scoped to the currently running AppDomain and the assembly where the code is executing. Just change your these calls to GetMachineStoreForApplication, and it should work.</p> <p>The documentation for IsolatedStorageFile can be found at <a href="http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile_members.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile_members.aspx</a></p>
9,825
<p>Do I need to register new extension types with Apple before I release an application that would create them on OS X?</p>
<p>No, there's no need to register extensions.</p>
<p>As a follow up, there is a little more information in the FAQs at the Apple Developer Connection (ADC) website:</p> <p><a href="http://developer.apple.com/faq/datatype.html" rel="nofollow noreferrer">http://developer.apple.com/faq/datatype.html</a></p>
6,197
<p>The company I'm currently working for is using <a href="http://selenium.openqa.org/" rel="noreferrer">Selenium</a> for Uniting-Testing our User Interface. What do you use to Unit-Test your Web UI and how effective do you find it? </p>
<p>We use Watin at my place of employment, we are a .net shop so this solution made a lot of sense. We actually started with Watir (the original ruby implementation) and switched after. It's been a pretty good solution for us so far</p>
<p>We use <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WatiN</a> for system testing, and <a href="http://docs.jquery.com/QUnit" rel="nofollow noreferrer">QUnit</a> for JavaScript unit testing.</p>
2,898
<p>I'm writing a Telnet client of sorts in C# and part of what I have to parse are ANSI/VT100 escape sequences, specifically, just those used for colour and formatting (detailed <a href="http://www.termsys.demon.co.uk/vtansi.htm#colors" rel="noreferrer">here</a>).</p> <p>One method I have is one to find all the codes and remove them, so I can render the text without any formatting if needed:</p> <pre><code> public static string StripStringFormating(string formattedString) { if (rTest.IsMatch(formattedString)) return rTest.Replace(formattedString, string.Empty); else return formattedString; } </code></pre> <p>I'm new to regular expressions and I was suggested to use this:</p> <pre><code>static Regex rText = new Regex(@"\e\[[\d;]+m", RegexOptions.Compiled);</code></pre> <p>However, this failed if the escape code was incomplete due to an error on the server. So then this was suggested, but my friend warned it might be slower (this one also matches another condition (z) that I might come across later):</p> <pre><code>static Regex rTest = new Regex(@"(\e(\[([\d;]*[mz]?))?)?", RegexOptions.Compiled);</code></pre> <p>This not only worked, but was in fact faster to and reduced the impact on my text rendering. Can someone explain to a regexp newbie, why? :)</p>
<p>The reason why #1 is slower is that [\d;]+ is a greedy quantifier. Using +? or *? is going to do lazy quantifing. See <a href="http://msdn.microsoft.com/en-us/library/3206d374(VS.80).aspx" rel="nofollow noreferrer">MSDN - Quantifiers</a> for more info.</p> <p>You may want to try:</p> <pre><code>"(\e\[(\d{1,2};)*?[mz]?)?" </code></pre> <p>That may be faster for you.</p>
<p>Without doing detailed analysis, I'd guess that it's faster because of the question marks. These allow the regular expression to be "lazy," and stop as soon as they have enough to match, rather than checking if the rest of the input matches.</p> <p>I'm not entirely happy with this answer though, because this mostly applies to question marks after * or +. If I were more familiar with the input, it might make more sense to me.</p> <p>(Also, for the code formatting, you can select all of your code and press <kbd>Ctrl</kbd>+<kbd>K</kbd> to have it add the four spaces required.)</p>
2,685
<p>I'm developing a multi-threaded app for a Linux embedded platform.</p> <p>At the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would like to fine tune that value for each thread to something smaller to reduce my application's memory usage. I could go through the trial and error route of setting each thread's stack size to progressively smaller values until the program crashed, but the application uses ~15 threads each with completely different functionality/attributes so that approach would be extremely time consuming.</p> <p>I would much rather prefer being able to directly measure each thread's stack usage. Is there some utility people can recommend to do this? (For example, I come from a vxWorks background and using the 'ti' command from the vxWorks shell directly gives stats on the stack usage as well as other useful info on the task status.)</p> <p>Thanks</p>
<p>Here are two tools that measure (native pthreads) stack usage in Linux applications:</p> <ul> <li><a href="http://valgrind.org" rel="nofollow noreferrer" title="Valgrind">Valgrind</a></li> <li><a href="https://github.com/d99kris/stackusage" rel="nofollow noreferrer" title="stackusage">Stackusage</a></li> </ul> <p><strong>Valgrind</strong></p> <p>Usage:</p> <pre><code>valgrind --tool=drd --show-stack-usage=yes PROG </code></pre> <p>Valgrind is a stable and powerful tool, useful not only for measuring stack usage. It may not support all embedded CPU models though.</p> <p><strong>Stackusage</strong></p> <p>Usage:</p> <pre><code>stackusage PROG </code></pre> <p>Stackusage is a light-weight tool specifically designed for measuring thread stack usage which should be portable for most embedded Linux platforms equipped with glibc. It is likely not as well-tested or mature as Valgrind/drd at this point.</p> <p>Full disclosure: I'm the author of Stackusage.</p>
<p>I do not know any good tools but as last resort you could include some code in your application to check it, similar to the following:</p> <pre><code>__thread void* stack_start; __thread long stack_max_size = 0L; void check_stack_size() { // address of 'nowhere' approximates end of stack char nowhere; void* stack_end = (void*)&amp;nowhere; // may want to double check stack grows downward on your platform long stack_size = (long)stack_start - (long)stack_end; // update max_stack_size for this thread if (stack_size &gt; stack_max_size) stack_max_size = stack_size; } </code></pre> <p>The check_stack_size() function would have to be called in some of the functions that are most deeply nested.</p> <p>Then as last statement in the thread you could output stack_max_size to somewhere.</p> <p>The stack_start variable would have to be initialized at start of your thread:</p> <pre><code>void thread_proc() { char nowhere; stack_start = (void*)&amp;nowhere; // do stuff including calls to check_stack_size() // in deeply nested functions // output stack_max_size here } </code></pre>
8,299
<p>I want to make an anime-style figurine in Blender with long strands of wavy hair coming down from pigtails, similar to sailor moon, but more so.</p> <p>They are going to be extremely challenging to print in place as they will be very thin and difficult to support.</p> <p>Would it be possible simply to print long flat strips of PLA straight onto my bed 5 mm wide, 200 mm long, and a couple of mm thick, and then to heat them up after printing with a heat gun or some other means, and reshape them to make them wavy, then attach them to my model with glue before painting?</p> <p>I haven't started on the model yet so I have no pictures to provide.</p>
<p>Yes, printing a flat strand structure and then shaping it using heat to form hair is something people already do, for example with the <a href="https://www.thingiverse.com/thing:2007221" rel="nofollow noreferrer">Hairy Lion model</a>.</p>
<p>YES you can reshape printed PLA with heat.</p> <p>I have a bin for all my brim/cleanup offcuts, stored at the printer. When it gets a bit full I simply blast it with my hot-air gun normally used for finishing prints. This shrinks the wispy bits, and thicker parts soften and droop down under their own weight.</p> <p>Downside, I think hair that is printed flat, and then softened with hot air runs the risk of looking like &quot;just got out of a swimming pool&quot; hair instead of anything styled or realistic.</p> <p>Definitely worth a try though!</p>
2,064
<p>First of all, I'm quite new to 3D printing. After printing some temperature towers, stringing and bridging tests, I wanted to print the Bechys to see everything working together. I'm getting some strange &quot;bumps&quot; in the outer walls. It looks like for 2-3 layers, the filament gets lifted up.</p> <p><a href="https://i.stack.imgur.com/l0w83.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l0w83.jpg" alt="infill before walls set" /></a></p> <p><a href="https://i.stack.imgur.com/VNmNB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VNmNB.jpg" alt="infill before walls unset" /></a></p> <p>I first thought, the infill is printed too far in the outer shell, so I unchecked &quot;Infill Before Walls&quot; in Cura. Surprisingly the outcome did not change and the &quot;bumps&quot; where in the exact same spots as before.</p> <p>I am aware of a part cooling problem, but my stock cooler already sits at 100 %. I don't think, the extruder temperature is too hot, with it being only 200 °C. As you can see, the printer only has a one sided cooling solution with a very small fan conduct.</p> <p><a href="https://i.stack.imgur.com/bOANt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bOANt.jpg" alt="fan conduct" /></a></p> <p>Print settings:</p> <ul> <li>Printer: Anycubic I3 Mega S</li> <li>Slicer: Cura</li> <li>Material: PLA</li> <li>Extruder Temp: 200 °C</li> <li>Bed Temp: 60 °C</li> <li>Print speed: 45 mm/s</li> <li>Travel speed: 100mm/s</li> <li>Layer height: 0.2 mm</li> <li>Layer width: 0.4 mm</li> <li>Nozzle: 0.4 mm</li> <li>Infill: 10 %</li> <li>Retraction distance: 4.5 mm<br /> Retraction speed: 40 mm/s</li> </ul> <p>So I am suspecting it must have something to do with the way, it is sliced. Does anyone have an idea?</p> <p>Update: I started the print again with aligned seams. Now you can clearly see the artifact. At the point of the seam the print is warped inwards and upwards.</p> <p><a href="https://i.stack.imgur.com/TK9IT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TK9IT.jpg" alt="aligned seams" /></a></p> <p>I did some more prints and tried to increase retraction distance up to 10 mm and retraction speed up to 60 mm/s, but I also did not manage to improve the print. I also tried to enable the &quot;retract at layer change&quot; option and to disable &quot;Z Hop When Retracted&quot; but without success.</p> <p>I set the travel speed down to 45 mm/s with no change in print quality.</p>
<p>There are a few issues that could cause this. Roughness in your z-axis lead screw as pointed out by @TheLamestUsername is a leading contender I would say. I'd also extended that answer to include checking the belts for your X and Y axes as well as making sure that the rods the gantry slide on are smooth since the fault appears to be in about the same X-Y location as well in the one image.</p> <p>However, there are a few alternatives as well. Check/confirm that the material that you're using doesn't have a lot of absorbed moisture in it. This can cause little bits of steam to 'pop' when they're extruded causing some bubbles</p> <p>Because of how the material is folding at the location in the &quot;updated&quot; image this looks to be an issue with the starting and stopping. All of the layer's problems appear to be happening when the gantry moves up to the next layer. Essentially more material is coming out of the nozzle there (I think) than is what should be. Confirming material diameter with some calipers can help if there's just an offset (not too unlikely I don't think).</p> <p>If the diameters are dead on I'd suggest reducing the nozzle temperature by a few degrees. The sensors used to measure the temperature aren't usually all that accurate, though their precision is often pretty good. While you may have it set at 200C that might not be the actual temperature. Calibration of the thermal sensors can drift over time, so while it might have been good on the last roll it may have drifted slightly. Or the material might be of slightly different composition. Try lowering the nozzle temp by 2-5 degrees and see if that has any effect.</p> <p>You may also have a retraction setting that can be modified. Pulling the material back ever so slightly when it finishes the one layer as it moves to the next could alos reduce some of the extra material that's coming out.</p>
<p>The fact that the bumps were in the same spots on multiple occasions points to z-axis problems. Turn your printer off and manually turn the z-axis all the way from bottom to top. If there are any tight spots, there is some <em>z-axis binding</em>. If there are no tight spots, skip to the last paragraph.</p> <p>Try taking off the z-axis by removing the set screws (pictured below). Remember which side was pointing up for a later step.</p> <p><a href="https://i.stack.imgur.com/GnC4r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GnC4r.jpg" alt="enter image description here" /></a></p> <p>Once you do that, clean the screw thoroughly with a brush, cloth, solution, or a combination of those. Put the screw back in the opposite way this time.</p> <p>If you get no bumps, then it was indeed the z-axis</p> <p>If the bumps are still there, try lowering your temperature some more(200 is still a little high compared to what I do for PLA), and <a href="https://all3dp.com/2/extruder-calibration-6-easy-steps-2/" rel="nofollow noreferrer">calibrate your e-steps</a> if you haven't already.</p>
1,688
<p>A few minutes after finishing a print job, the filament is solidified in the nozzle and the nozzle-throat. When I start another print job a while later, the filament is not sufficiently melted and the nozzle is obstructed. Do I need to clean the nozzle after every print job ? or is there a practical method to overcome this difficulty ?</p>
<p>Cooling any single face of the motor is fine. The motor case conducts heat <em>very</em> well. Many 3d printers effectively cool the motors merely by having the output drive face of the motor bolted to a metal bracket which is bolted to the aluminum extrusion frame. That's it. That contact alone cools the motor, which is shown by how the motors overheat when people install vibration dampers, which puts rubber between the motor and the extrusion.</p> <p>The only thing I would worry about is the surface area inside this particular style of block, and ensuring that you use an all-aluminum radiator since the block is aluminum.</p> <p>There is another type of cheap 40x40 aluminum block with the nipples on the face instead of on the edge. That style has fins and a lot of surface area inside. This style with the nipples on the edge has a big S channel inside and not much surface area. It may still be more than enough. I'm just saying it's a significant difference and it might make a difference. If you find you're not cooling enough, all you may need to do is switch to that other style of block, not try to install 3 blocks per motor or any other exotic nonsense.</p> <p>But no way do you have to worry about coooling more than one face of the motor, nor does it matter rwhich face it is, especially not with active water cooling like this, as long as the block is actually making good thermal contact with the motor (thermal tape, or thermal epoxy, or thermal pad &amp; zip ties)</p>
<p>Your solution will not cool all sides effectively. Firstly don't use zip ties; get thermal tape.</p> <p><a href="https://i.stack.imgur.com/uC6tD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uC6tD.jpg" alt="Thermal Tape"></a> (<a href="https://rads.stackoverflow.com/amzn/click/com/B00QSHPH8E" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/Thermal-Interface-Products-Heat-Sink/dp/B00QSHPH8E/</a></p> <p>Secondly, the heat will need to travel around the outside of the motor to get from the side that doesn't have the water block. Its expensive but you could use <a href="https://www.digikey.com/en/product-highlight/p/panasonic/pyrolytic-graphite-sheets" rel="nofollow noreferrer">Pyrolytic Graphite Sheets</a> to wrap around the outside of the motor, to get the heat to the water block faster.</p>
1,452
<p>I have a directory structure like the following;</p> <blockquote> <p>script.php</p> <p>inc/include1.php<br/> inc/include2.php</p> <p>objects/object1.php<br/> objects/object2.php</p> <p>soap/soap.php</p> </blockquote> <p>Now, I use those objects in both <code>script.php</code> and <code>/soap/soap.php</code>, I could move them, but I want the directory structure like that for a specific reason. When executing <code>script.php</code> the include path is <code>inc/include.php</code> and when executing <code>/soap/soap.php</code> it's <code>../inc</code>, absolute paths work, <code>/mnt/webdev/[project name]/inc/include1.php...</code> But it's an ugly solution if I ever want to move the directory to a different location.</p> <p>So is there a way to use relative paths, or a way to programmatically generate the <code>"/mnt/webdev/[project name]/"</code>?</p>
<p>This should work </p> <pre><code>$root = realpath($_SERVER["DOCUMENT_ROOT"]); include "$root/inc/include1.php"; </code></pre> <hr> <p><strong>Edit:</strong> added imporvement by <a href="https://stackoverflow.com/questions/4369/include-files-requiring-an-absolute-path#4388">aussieviking</a></p>
<blockquote> <blockquote> <p>@Flubba, does this allow me to have folders inside my include directory? flat include directories give me nightmares. as the whole objects directory should be in the inc directory.</p> </blockquote> </blockquote> <p>Oh yes, absolutely. So for example, we use a single layer of subfolders, generally:</p> <pre><code>require_once('library/string.class.php') </code></pre> <p>You need to be careful with relying on the include path too much in really high traffic sites, because php has to hunt through the current directory and then all the directories on the include path in order to see if your file is there and this can slow things up if you're getting hammered. </p> <p>So for example if you're doing MVC, you'd put the path to your application directoy in the include path and then specify refer to things in the form</p> <pre><code>'model/user.class' 'controllers/front.php' </code></pre> <p>or whatever.</p> <p>But generally speaking, it just lets you work with really short paths in your PHP that will work from anywhere and it's a lot easier to read than all that realpath document root malarkey. </p> <p>The benefit of those script-based alternatives others have suggested is they work anywhere, even on shared boxes; setting the include path requires a little more thought and effort but as I mentioned lets you start using __autoload which just the coolest.</p>
2,638
<p>I am currently working through various different iterations ofccreating a propeller for a model ICE (nitro engine). So far I have managed to disintegrate each of them eventually. I have been experimenting mostly with PLA and PETG so far. I am currently thinking about using carbon-infused PLA or using PC (I found one that is printable on my printer). However, I am not so sure what properties I exactly have to look for when it comes to a propeller.</p> <p>I am making the following assumptions:</p> <ul> <li>When rotating fast (5-6k RPM) there it probably has to create quite some centripetal force and I assume this would translate to tensile strength</li> <li>When the engine starts or stops it gets accelerated and decelerated almost instantly which probably causes quite some jerk to the propeller. However, I do not know what property that would translate to, also tensile strength.</li> </ul> <p>So far the PLA propeller has held up the longest and I cannot rule out that it accidentally touched something when it broke. That is of course something it does not have to be able to handle, so I am probably going to give PLA another chance.</p> <p>The PETG propellers all literally broke apart the second the engine started, and it did not even hold up one rotation.</p> <p>The design of the propeller is actually sacrificing some aerodynamic efficiency in order to make sure there are no &quot;thin&quot; parts. It is typically breaking in the section I have highlighted in the the following picture.</p> <p><a href="https://i.stack.imgur.com/Lttne.png" rel="nofollow noreferrer" title="3D rendering of a propeller with a circle around a section"><img src="https://i.stack.imgur.com/Lttne.png" alt="3D rendering of a propeller with a circle around a section" title="3D rendering of a propeller with a circle around a section" /></a></p> <p>I have also a picture of the &quot;remains&quot; of the broken PLA propeller. It actually held up many runs before it eventually broke. It actually partially delaminated the entire wall.</p> <p><a href="https://i.stack.imgur.com/15u6P.jpg" rel="nofollow noreferrer" title="A damaged print of a propeller"><img src="https://i.stack.imgur.com/15u6P.jpg" alt="A damaged print of a propeller" title="A damaged print of a propeller" /></a></p> <p>I am looking for two recommendations/tips:</p> <ul> <li>What material properties should I look for in my use case?</li> <li>Less important, but some tips regarding print settings are also appreciated. So far I could notice that smaller layer size helps, and thicker walls also helped.</li> </ul>
<p>As Kezat noted, your part has very low infill, but infill is not what provides most of the part strength anyway. From what I can see of the broken part, it looks like you only have 1 or at most 2 walls, and these are what contribute most to part strength, especially in the orientation you're working in.</p> <p>You should probably increase the number of walls to the point where the part is entirely solid, and has no infill region in any layers. This gives much better strength than selecting &quot;100% infill&quot;, which will normally use alternating diagonal lines to fill the region; even if &quot;concentric&quot; is selected, which &quot;looks like&quot; more walls, there are subtle reasons it's not quite as good.</p> <p>You may be able to get away with fewer walls, possibly just 3 or 4. If you're trying to keep total mass low, that might be worth trying first. But you definitely need more than the 1 or 2 you have now.</p>
<p>For safety on a project like this, it's best to have a self-contained chamber to run a life test until the propeller falls apart. Once a material and design has a reasonable lifetime, then you could use the print.</p> <p>Reputable propeller manufacturers will already do this. They may even run a shorter burn-in test on product being sold to eliminate defects.</p> <p>I would suspect PLA as being too brittle. Nylon carbon fiber is probably a better material, but not easy to use. Unless you're wanting to experiment with propeller design, printing propellers will cost you more then buying them.</p> <p>As Brydon mentioned life testing usually does acceleration such as twice the rate. Temperature is also important. Plastic is more brittle cold and softer hot. You may even want to off balance the axis slightly to accelerate the testing.</p>
2,005
<p>I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so :</p> <p>What is a good browser that I can use as a client to a web application?</p> <p>General functionalities I would like to have:</p> <ul> <li>opening the browser from a shortcut, directly to the application's URL </li> <li>ability to restrict navigation to a set of allowed URLs </li> <li>fullscreen mode, no menu, no address bar</li> <li>javascript </li> <li>good CSS support</li> <li>ability to cancel Back button (or at least solve the "Webpage has expired" IE problem)</li> </ul> <p>IE7 and FireFox are good candidates, but each seem to have it's own problems and issues.</p>
<p><a href="http://developer.mozilla.org/en/Prism" rel="noreferrer">Mozilla Prism</a> seems ideal for your purposes.</p> <p>It shares code with Firefox but is designed to run web applications without the usual Browser interface to make them appear more like desktop applications. So no back button or address bar to worry about.</p> <p><strong>Edit:</strong> <a href="http://www.google.com/chrome" rel="noreferrer">Google Chrome</a> has <a href="http://www.google.com/support/chrome/bin/answer.py?answer=95710&amp;hl=en_GB" rel="noreferrer">Application Shortcuts</a> so that may now be a better option.</p>
<p>When you run into serious issues, with Firefox you can trace it down to the code and maybe get someone to fix it. With IE, you can't.</p>
5,916
<p>I have the following code snippet.</p> <pre><code>$items['A'] = "Test"; $items['B'] = "Test"; $items['C'] = "Test"; $items['D'] = "Test"; $index = 0; foreach($items as $key =&gt; $value) { echo "$index is a $key containing $value\n"; $index++; } </code></pre> <p>Expected output:</p> <pre><code>0 is a A containing Test 1 is a B containing Test 2 is a C containing Test 3 is a D containing Test </code></pre> <p>Is there a way to leave out the <code>$index</code> variable?</p>
<p>Your $index variable there kind of misleading. That number isn't the index, your "A", "B", "C", "D" keys are. You can still access the data through the numbered index $index[1], but that's really not the point. If you really want to keep the numbered index, I'd almost restructure the data:</p> <pre> $items[] = array("A", "Test"); $items[] = array("B", "Test"); $items[] = array("C", "Test"); $items[] = array("D", "Test"); foreach($items as $key => $value) { echo $key.' is a '.$value[0].' containing '.$value[1]; } </pre>
<p>Be careful how you're defining your keys there. While your example works, it might not always:</p> <pre><code>$myArr = array(); $myArr[A] = "a"; // "A" is assumed. echo $myArr['A']; // "a" - this is expected. define ('A', 'aye'); $myArr2 = array(); $myArr2[A] = "a"; // A is a constant echo $myArr['A']; // error, no key. print_r($myArr); // Array // ( // [aye] =&gt; a // ) </code></pre>
9,410
<p>How can I pipe the new password to smbpasswd so I can automate my installation process.</p>
<p>Thanks to Mark I found the answer:</p> <pre><code>(echo newpassword; echo confirmNewPassword) | smbpasswd -s </code></pre> <p>BTW: (echo oldpasswd; echo newpasswd) | smbpasswd -s does not work.</p>
<p>using either <a href="http://en.wikipedia.org/wiki/Pipeline_(Unix)" rel="nofollow noreferrer">pipelines</a> or <a href="http://en.wikipedia.org/wiki/Redirection_(Unix)" rel="nofollow noreferrer">redirection</a>.</p>
3,312
<p>I thought jQuery Intellisense was supposed to be improved with SP1. I even downloaded an annotated version of jQuery 1.2.6, but intellisense will not work in a separate jscript file. I have the jQuery library referenced first on my web page in the &lt;head> tag. Am I doing anything wrong?</p>
<p>At the top of your external JavaScript file, add the following:</p> <pre><code>/// &lt;reference path="jQuery.js"/&gt; </code></pre> <p>Make sure the path is correct, relative to the file's position in the folder structure, etc.</p> <p>Also, any references need to be at the top of the file, before <em>any</em> other text, including comments - literally, the very first thing in the file. Hopefully future version of Visual Studio will work regardless of where it is in the file, or maybe they will do something altogether different...</p> <p>Once you have done that and <em>saved the file</em>, hit <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd> to force Visual Studio to update Intellisense.</p>
<p>Make sure you're not using a minimized jQuery file.</p> <p>Use <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd> to make it work after adding JavaScript files to the project.</p>
8,446
<p>what is the best method for inter process communication in a multithreaded java app.</p> <p>It should be performant (so no JMS please) easy to implement and reliable,so that objects &amp; data can be bound to one thread only?</p> <p>Any ideas welcome!</p>
<p>Could you clarify a bit? Do you mean IPC in a single JVM? (Multiple threads, yes, but at an OS-level only one process.) Or do you mean multiple JVMs? (And truly OS-level inter process communications.)</p> <p>If it is the first, then maybe something out of <strong>java.util.concurrent</strong>, like <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html" rel="noreferrer">ConcurrentLinkedQueue</a> would do the trick. (I pass message around inbetween my threads with classes from java.util.concurrent with success.)</p> <p>If the later, then I'm going to just guess and suggest taking a look at <strong><a href="http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp" rel="noreferrer">RMI</a></strong>, although I don' think it qualifies as fully reliable--you'd have to manage that a bit more 'hands on' like.</p>
<p>I recommend looking into the entire <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" rel="nofollow noreferrer">java.util.concurrent</a> package, which have multiple classes for dealing with concurrency and different communication means between threads. All depends on what you want to achieve, as your question is pretty general.</p>
7,450
<p>I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on other forums suggesting that the only approach is to write a Wagon specifically for SourceForge.</p> <p>Has anybody had any recent experience with this?</p>
<p>I'm not able to test this to confirm, but I believe it is possible without writing any plugins.</p> <p>You can <a href="http://sourceforge.net/apps/trac/sourceforge/wiki/SCP" rel="noreferrer">deploy to SourceForge using SCP</a>, and the maven-deploy-plugin can be configured to <a href="http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html" rel="noreferrer">use SCP</a> so it should work. You can also deploy your <a href="http://maven.apache.org/plugins/maven-site-plugin/examples/site-deploy-to-sourceforge.net.html" rel="noreferrer">site to SourceForge</a> via SCP.</p> <p>You would configure the SourceForge server in your settings.xml to use a "combined" username with a comma separator. With these credentials:</p> <pre><code>SourceForge username: foo SourceForge user password: secret SourceForge project name: bar Path: /home/frs/project/P/PR/PROJECT_UNIX_NAME/ - Substitute your project UNIX name data for /P/PR/PROJECT_UNIX_NAME </code></pre> <p>The server element would look like this:</p> <pre><code>&lt;server&gt; &lt;id&gt;sourceforge&lt;/id&gt; &lt;username&gt;foo,bar&lt;/username&gt; &lt;password&gt;secret&lt;/password&gt; &lt;/server&gt; </code></pre> <p>And the distributionManagement section in your POM would look like this:</p> <pre><code>&lt;!-- Enabling the use of FTP --&gt; &lt;distributionManagement&gt; &lt;repository&gt; &lt;id&gt;ssh-repository&lt;/id&gt; &lt;url&gt; scpexe://frs.sourceforge.net:/home/frs/project/P/PR/PROJECT_UNIX_NAME&lt;/url&gt; &lt;/repository&gt; &lt;/distributionManagement&gt; </code></pre> <p>Finally declare that ssh-external is to be used:</p> <pre><code>&lt;build&gt; &lt;extensions&gt; &lt;extension&gt; &lt;groupId&gt;org.apache.maven.wagon&lt;/groupId&gt; &lt;artifactId&gt;wagon-ssh-external&lt;/artifactId&gt; &lt;version&gt;1.0-alpha-5&lt;/version&gt; &lt;/extension&gt; &lt;/extensions&gt; &lt;/build&gt; </code></pre> <hr> <p>If this doesn't work, you may be able to use the recommended approach in the site reference above, i.e. create a shell on shell.sourceforge.net with your username and project group:</p> <pre><code>ssh -t &lt;username&gt;,&lt;project name&gt;@shell.sf.net create </code></pre> <p>Then use shell.sourceforge.net (instead of web.sourceforge.net) in your site URL in the diestributionManagement section:</p> <pre><code>&lt;url&gt;scp://shell.sourceforge.net/home/frs/project/P/PR/PROJECT_UNIX_NAME/&lt;/url&gt; </code></pre>
<p>The Maven SourceForge plug-in does not work with Maven 2. Also I believe this plug-in uses FTP which is no longer supported.</p>
3,722
<p>I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement. </p> <pre><code>s/\bBoolean\b/bool/g </code></pre> <p>There are a few conditions. </p> <p>1) We have CORBA in our code and \b matches CORBA::Boolean which should <strong>not</strong> be changed.<br> 2) It should not match if it was found as a string (i.e. "Boolean")</p> <p><strong>Updated:</strong></p> <p>For #1, I used lookbehind</p> <pre><code>s/(?&lt;!:)\bBoolean\b/bool/g; </code></pre> <p>For #2, I used lookahead.</p> <pre><code>s/(?&lt;!:)\bBoolean\b(?!")/bool/g&lt;/pre&gt; </code></pre> <p>This will most likely work for my situation but how about the following improvements?</p> <p>3) Do not match if in the middle of a string (thanks <a href="https://stackoverflow.com/users/3101/nohat">nohat</a>).<br> 4) Do not match if in a comment. (// or /**/) </p>
<blockquote> <p>s/[^:]\bBoolean\b(?!")/bool/g</p> </blockquote> <p>This does not match strings where Boolean is at that the beginning of the line becuase [^:] is "match a character that is not :".</p>
<p>To fix condition 1 try:</p> <pre><code>s/[^:]\bBoolean\b(?!")/bool/g </code></pre> <p>The [^:] says to match any character other than ":". </p>
5,560
<p>Is it possible to read a disk directly with .NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way &quot;\Device\Ide\IdeDeviceP2T0L0-1&quot; for example.</p> <p>If I can't open the device with a .NET API, knowing which Win32 API to use would be helpful.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa363858.aspx" rel="noreferrer">CreateFile</a> has support for direct disk access. Read the notes under "Physical Disks and Volumes". You should be able to P/Invoke the call.</p> <p>Note that Vista and Server 2008 have <a href="http://support.microsoft.com/kb/942448" rel="noreferrer">severely restricted</a> this.</p>
<p>In .NET 5, you can use the FileStream method to read a file on the disk.</p> <pre><code>new FileStream(@&quot;\\.\PhysicalDrive1&quot;, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) </code></pre>
5,909
<p>I printed a case for my phone, a Motorola G4 Plus. I found the model of the casing on <a href="https://www.thingiverse.com/thing:2482011" rel="nofollow noreferrer">Thingiverse</a></p> <p>I just downloaded the model, used Meshmixer to check for issues, after that, opened Simplify3d and saved it for printing using an SD Card. The printed size of the model was smaller than expected.</p> <p>The model designer, says in the description that he used flexible filament. Is it possible than if I change to that filament, the model result is completely different? </p> <p>Print result - phone casing:</p> <p><a href="https://i.stack.imgur.com/T6V14.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T6V14.jpg" alt="1"></a> <a href="https://i.stack.imgur.com/nDTld.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nDTld.jpg" alt="2"></a> <a href="https://i.stack.imgur.com/S71JO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S71JO.jpg" alt="3"></a></p>
<p>In short: Not really.</p> <p>longer version: It depends.</p> <p>The main culprit of losing details in this case would be the weight and speed of the thing moving. So if you have a heavy X-axis carriage, acceleration and decelerating the carriage won't be instant. Same with the bed (Y-axis).</p> <p>Another culprit can be slop in the system, so check your linear bearings and belt tension.</p> <p>Also keep in mind that you are printing on the bed, so the weight of the Y-axis increases while the print progresses. This shouldn't be a problem for small prints, but if your print becomes bigger it can decrease the quality. Another factor is that every print will bend a little the higher it gets, so if you print a tall slender object, don't accelerate the bed too fast ;)</p> <p>To summarize, for high detailed prints:</p> <ul> <li>Lower the speed</li> <li>Check the system for slop (tighten belts, and align linear bearings)</li> <li>Take the lightest axis for the highest detail (keep the weight of the print in mind)</li> </ul> <p>One thing that you can do to test your machine is to test the ghosting on each axis (<a href="https://www.thingiverse.com/thing:277394" rel="nofollow noreferrer">https://www.thingiverse.com/thing:277394</a>).</p>
<p>I'm under the impression that your question hints on rectilinear motion by aligning the print part to the axes motion of the printer. So, placing it under 45&deg; would suggest movement of both steppers to make a straight line opposed to one stepper movement for a straight line.</p> <p>Basically, the weight of the carriage and the play in the system determine the quality of the details. Not how much steppers are involved to print the part. As an example, CoreXY or H-bot style printers use 2 steppers to print a straight line and a single stepper to print diagonally. These printers are capable of producing very accurate prints.</p> <p>On a Prusa i3 style printer it is not expected to see large differences unless you print very fast so that the inertia or play take a predominant role in the quality.</p>
1,302
<p>I have downloaded a font that looks less than desirable if it is not anti-aliased. I can not figure out how to enable anti-aliasing in VS, I have changed the 'Smooth Edges of Screen Fonts' in the system performance options but that does not seem to help.</p> <p>VS2008 on XP SP3.</p> <p>What am I missing?</p>
<p>Try using ClearType, not Standard font smoothing. </p> <p>It's in Display properties, Appearance, Effects.</p>
<p>Could it be a problem with the color combination? Some fonts look really ugly on high contrast combinations with a black background.</p> <p>Also, can you see the difference in the fonts in any other application?</p> <p>Which font is it?</p>
6,647
<p>Header, footer and sidebars have fixed position. In the center a content area with both scroll bars. No outer scroll bars on the browser. I have a layout that works in IE7 and FF. I need to add IE6 support. How can I make this work?</p> <p>Here is an approximation of my current CSS.</p> <pre class="lang-html prettyprint-override"><code> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Layout&lt;/title&gt; &lt;style&gt; * { margin: 0px; padding: 0px; border: 0px; } .sample-border { border: 1px solid black; } #header { position: absolute; top: 0px; left: 0px; right: 0px; height: 60px; } #left-sidebar { position: absolute; top: 65px; left: 0px; width: 220px; bottom: 110px; } #right-sidebar { position: absolute; top: 65px; right: 0px; width: 200px; bottom: 110px; } #footer { position: absolute; bottom: 0px; left: 0px; right: 0px; height: 105px; } @media screen { #content { position: absolute; top: 65px; left: 225px; bottom: 110px; right: 205px; overflow: auto; } body #left-sidebar, body #right-sidebar, body #header, body #footer, body #content { position: fixed; } } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;header&quot; class=&quot;sample-border&quot;&gt;&lt;/div&gt; &lt;div id=&quot;left-sidebar&quot; class=&quot;sample-border&quot;&gt;&lt;/div&gt; &lt;div id=&quot;right-sidebar&quot; class=&quot;sample-border&quot;&gt;&lt;/div&gt; &lt;div id=&quot;content&quot; class=&quot;sample-border&quot;&gt;&lt;img src=&quot;/broken.gif&quot; style=&quot;display: block; width: 3000px; height: 3000px;&quot; /&gt;&lt;/div&gt; &lt;div id=&quot;footer&quot; class=&quot;sample-border&quot;&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
<p>Might be overkill for your project, but <a href="http://dean.edwards.name/IE7/" rel="noreferrer">Dean Edwards' IE7 javascript adds support for fixed positioning to IE6</a>.</p>
<p>Try IE7.js. Should fix your problem without having to make any modifications.</p> <p>Link: <a href="http://code.google.com/p/ie7-js/" rel="nofollow noreferrer">IE7.js</a></p>
5,027
<p>I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like <code>play()</code>, <code>stop()</code>, <code>pause()</code>, <code>record()</code> etc... Then I have workhorse classes which do the video decoding and video encoding. </p> <p>I just learned about the existence of nested classes in C++, and I'm curious to know what programmers think about using them. I am a little wary and not really sure what the benefits/drawbacks are, but they seem (according to the book I'm reading) to be used in cases such as mine.</p> <p>The book suggests that in a scenario like mine, a good solution would be to nest the workhorse classes inside the interface class, so there are no separate files for classes the client is not meant to use, and to avoid any possible naming conflicts? I don't know about these justifications. Nested classes are a new concept to me. Just want to see what programmers think about the issue.</p>
<p>I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a "multimedia driver" to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate media type and situation) and perform the abstract operations on the workhorse structure.</p> <p>My philosophy would be to go ahead and make both structures accessible to the client in a polished way, just under the assumption they would be used in tandem.</p> <p>I would reference something like a <a href="http://qt-project.org/doc/qt-4.8/qtextdocument.html" rel="noreferrer">QTextDocument</a> in Qt. You provide a direct interface to the bare metal data handling, but pass the authority along to an object like a QTextEdit to do the manipulation.</p>
<p>One reason to avoid nested classes is if you ever intend to wrap the code with swig (<a href="http://www.swig.org" rel="nofollow noreferrer">http://www.swig.org</a>) for use with other languages. Swig currently has problems with nested classes, so interfacing with libraries that expose any nested classes becomes a real pain.</p>
2,282
<p>This question is kind of an add-on to this <a href="https://stackoverflow.com/questions/44905/c-switch-statement-limitations-why">question</a></p> <p>In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month total for the selected month and each subsequent month thereafter. (simple example, not meant to be real) </p> <pre><code>switch (month) { case 0: add something to month totals case 1: add something to month totals case 2: add something to month totals default: break; } </code></pre> <p>Is there a logical alternative to this in C# without having to write out a ton of if statements?</p> <pre><code>if (month &lt;= 0) add something to month if (month &lt;= 1) add something to month if (month &lt;= 2) add something to month .... etc </code></pre>
<p>Often times when you see the noise from a huge switch statement or many if statements that might fall into more than one block, you're trying to suppress a bad design.</p> <p>Instead, what if you implemented the Specification pattern to see if something matched, and then act on it?</p> <pre><code>foreach(MonthSpecification spec in this.MonthSpecifications) { if(spec.IsSatisfiedBy(month)) spec.Perform(month); } </code></pre> <p>then you can just add up different specs that match what you're trying to do.</p> <p>It's hard to tell what your domain is, so my example might be a little contrived.</p>
<p>Write the switch cases in reverse order</p> <pre><code>case 2: case 1: case 0: break; default: </code></pre> <p>Hope that helps!</p>
7,554
<p>When I do a file search on eclipse it includes the <code>.svn</code> directories by default. I tried excluding them from the build path but they still appear on file search results.</p>
<p>Spaceman is right. With Helios, choose <code>Project -&gt; Properties -&gt; Resource -&gt; Resource Filters</code> and then add an <code>exclude</code> filter for type "Folder" with name <code>.svn</code>.</p>
<p>Click on the drop-down triangle in the top-right corner of the Navigator and choose "Filters..".</p> <p>By default Eclipse only offers you "<em>.class" and ".</em>".</p> <p>If you choose ".*" you'll hide .svn files. Obviously all other .something files will also be hidden.</p>
6,334
<p>I am building out a solution that will be deployed in multiple data centers in multiple regions around the world, with each data center having a replicated copy of data actively updated in each region. I will have a combination of multiple databases and file systems in each data center, the state of which must be kept consistent (within a data center). These multiple repositories will be fronted by a SOA service tier. </p> <p>I can tolerate some latency in the replication, and need to allow for regions to be off-line, and then catch up later.</p> <p>Given the multiple back end repositories of data, I can't easily rely on independent replication solutions for each one to maintain a consistent state. I am thus lead to implementing replication at the application layer -- by replicating the SOA requests in some manner. I'll need to make sure that replication loops don't occur, and that last writer conditions are sorted out correctly.</p> <p>In your experience, what is the best pattern for solving this problem, and are there good products (free or otherwise) that should be investigated?</p>
<p>Lotus/ Domino is your answer. I've been working with it for ten years and its exactly what you need. It may not be trendy (a perception that I would challenge) but its powerful, adaptable and very secure, The latest version R8 is the best yet.</p>
<p>You dont give enough specifics to be certain of your needs but I think you should check out SQL Server Merge replication. It allows for asynchronous replication of multiple databases with full conflict resolution. You will need to designate a Global master and all the other databases will replicate to that one, but all the database instances are fully functional (read/write) and so you can schedule replication at whatever intervals suit you. If any region goes offline they can catch up later with no issues - if the master goes offline everyone will work independantly until replication can resume.</p> <p>I would be interested to know of other solutions this flexible (apart from Lotus Notes/Domino of course which is not very trendy these days).</p>
9,172
<p>I know almost nothing about linq.</p> <p>I'm doing this:</p> <pre><code>var apps = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.MainWindowHandle != IntPtr.Zero select app; </code></pre> <p>Which gets me all the running processes which match that criteria.</p> <p>But I don't know how to get the first one. The examples I can find on the net seem to imply I have to do this</p> <pre><code>var matchedApp = (from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.MainWindowHandle != IntPtr.Zero select app).First(); </code></pre> <p>which strikes me as somewhat ugly, and also throws an exception if there are no matching processes. Is there a better way?</p> <p><strong>UPDATE</strong></p> <p>I'm actually trying to find the first matching item, and call <code>SetForegroundWindow</code> on it</p> <p>I've come up with this solution, which also strikes me as ugly and awful, but better than above. Any ideas?</p> <pre><code>var unused = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.MainWindowHandle != IntPtr.Zero select SetForegroundWindow( app.MainWindowHandle ); // side-effects in linq-query is technically bad I guess </code></pre>
<p>@FryHard FirstOrDefault will work but remember that it returns null if none are found. This code isn't tested but should be close to what you want:</p> <pre><code>var app = Process.GetProcesses().FirstOrDefault(p =&gt; p.ProcessName.Contains("MyAppName") &amp;&amp; p.MainWindowHandle != IntPtr.Zero); if (app == null) return; SetForegroundWindow(app.MainWindowHandle); </code></pre>
<p>Assuming that in your first example apps is an IEnumerable you could make use of the .Count and .FirstOrDefault properties to get the single item that you want to pass to SetForegroundWindow.</p> <pre><code>var apps = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.MainWindowHandle != IntPtr.Zero select app; if (apps.Count &gt; 0) { SetForegroundWindow(apps.FirstOrDefault().MainWindowHandle ); } </code></pre>
2,904
<p>Can anyone point me to some decent introductions to WS-Security?</p> <p>I'm looking for tutorials or something that provide a fairly gentle introduction to the subject, though I don't mind if it assumes basic knowledge of web services and SOAP. Most of the stuff I've seen so far is very technical and you need a lot of complex, detailed background knowledge to understand it properly.</p> <p>We have to implement a web service in PHP and one or more clients in .NET, so resources covering both would be much appreciated.</p>
<p>I think the best introduction to the (any) subject are some good examples.<br> <a href="http://www.codeproject.com/KB/webservices/WS-Security.aspx" rel="nofollow noreferrer">This article</a> at codeProject gives a fairly easy to follow guide trough web service security for a .NET application.</p>
<p>You can find some good article on WS-Security and <a href="http://ws.apache.org/rampart/" rel="nofollow noreferrer">Apache Rampart</a> - the open source WS-Security implementation - in <a href="http://wso2.org/library" rel="nofollow noreferrer">WSO2 Online Library</a>.</p> <p><a href="http://wso2.org/downloads/wsf/php" rel="nofollow noreferrer">WSO2 WSF/PHP</a> is a PHP Web services extension that has support for WS-Security and also interops with .NET Web services/clients seamlessly.</p>
2,916
<p>I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to <code>append a div</code> to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do:</p> <pre><code>$("#somediv &gt; ul").after("&lt;div id='xxx'&gt;&lt;/div&gt;").append($("#someotherdiv").clone()); </code></pre> <p>This seems to be close, but not quite there. The problem with this is that the "append" seems to be operating on the original <code>#somediv &gt; ul</code> selector. This sort of makes sense, but it's not what I wanted. How can I most efficiently select that intermediate div that I added with the <code>after</code> and put my <code>#someotherdiv</code> into it?</p>
<p>Go the other way around and use <code>insertAfter()</code>.</p> <pre><code>$("&lt;div id='xxx'&gt;&lt;/div&gt;") .append($("#someotherdiv").clone()) .insertAfter("#somediv &gt; ul") </code></pre> <p>Try to add your generated DOM nodes to the document only after finishing your work.</p> <p>Once the nodes are added to the displayed document, the browser starts listening to any change to refresh the view. Doing all the work before adding the nodes to the displayed document does improve browser performance.</p>
<blockquote> <p>How can I most efficiently select that intermediate div that I added with the "after" and put my "#someotherdiv" into it?</p> </blockquote> <p>@Vincent's solution is probably the fastest way to get the same result. However if for whatever reason you need add the div with <code>after()</code> then need to select it and operate on it you can use </p> <blockquote> <p><code>.nextAll( [expr] )</code></p> <p><code>Find all sibling elements after the current element.<br> Use an optional expression to filter the matched set.</code></p> </blockquote> <p>So your js becomes:</p> <pre><code>$("#somediv &gt; ul") .after("&lt;div id='xxx'&gt;&lt;/div&gt;") .nextAll('#xxx') .append($("#someotherdiv").clone()); </code></pre>
7,853
<p>I'm in the process of building the <a href="http://www.thingiverse.com/thing:1001065" rel="nofollow noreferrer">D-Bot core XY</a> printer, and I was hoping to know if the Z-axis 'zero' is near the hot end or near the bottom of the printer furthest away from the hotend? In this printer the Z-platform moves up and down and the nozzle stays at the same height.</p>
<p>Generally, Z-axis zero is when the hot end and the build plate are close to each other. Some printers keep the hot end up at the top, and bring the build plate up to reach it. Other printers keep the build plate at the bottom, and lower the hot end down to reach it. As such, "Z axis zero" doesn't specify top or bottom of the physical printer, it just specifies that the hot end is right up against the build plate, ready to print its first layer. In the printer you describe, where the hot end remains at the top, that's where Z zero is.</p> <p>In terms of the model being printed, Z axis zero is always the bottom of the model, the first layer to be deposited on the build plate. The numbers increase from there, either lifting the hot end up, or pushing the build plate down, depending on the design of the printer.</p>
<p>Yes, Z-Zero is typically at the "top" of the printer, closest to the nozzle(s). X and Y zeros are also typically in the lower-left corner of the buildplate.</p> <p>However, the XY zeros are re-interpreted in slicing software to produce cleaner G-Code as it's sometimes difficult to read G-Code in negative coordinates. For this functionality, slicing engines utilize the machine build space length and width.</p> <p>So if you encounter a situation where your machine "over travels" in either -X or -Y direction during startup, verify that the length and width of your build space is correct in your slicing engine.</p>
456
<p>I'm attemping my first print where I pause the print, change the filament, and resume to achieve a two-color print. My first attempt failed when the printer resumed printing over a centimeter away from where it should have on the X axis. My second attempt was much better, but still resumed about 1.5mm off-target.</p> <p>Here's specifically what I did:</p> <ol> <li><p>Loaded the STL in Cura, the design has a 1mm "base" with an additional 1mm design on top of the base.</p></li> <li><p>I used Cura's "Pause at Height" feature to specify the printer should pause after completing the first 1mm.</p></li> <li><p>I sent the print to Octoprint, via the Cura plugin.</p></li> <li><p>The pause began and went as-expected for the first 1mm. It paused after finishing the layer, as expected.</p></li> <li><p>To switch filament I used the controls to raise the nozzle by 1cm, then moved it to home (X/Y, away from the print). I swapped filaments, hand-feeding the 2nd color until the old color was no longer coming out the nozzle, then gently cleaned up the nozzle.</p></li> <li><p>I lowered the nozzle back to the height it paused at (down 1cm), then resumed the print. The printer moved the X/Y back to the print and resumed.</p></li> </ol> <p>I'm guessing either I shouldn't move the printer head away from the print when changing filament, or perhaps need to re-home after the new filament is in.</p> <p>What should I do to resume a print precisely where it paused? Is there a better approach?</p>
<p>You are out of luck:</p> <p>Print gcode is written in relative coordinates. If you move the printhead manually, the printer does not know this, and will just follow its relative path from the new position - which is what commonly is called layer-shifting.</p> <p>To try to mitigate this, there are ways, but they are a little tricky:</p> <ol> <li>If your printer has a <em>change filament</em> option, then choose that - this saves the absolute position of the printhead before moving it to X0Y0, then usually extracts the filament and waits for the new filament to be inserted and the printer waits till given a resume-OK. Then it will move to the saves absolute position, and resume the code from the point it paused.</li> <li>If your printer has a <em>pause</em> option that moves the printhead to X0Y0, this can be used, using a manual extraction. Resuming the print will be easy.</li> <li>Some slicers support to call "Change filament at layer X", which will call a move to X0Y0 and pause, allowing manual change even if the normal pause behavior is not to move to X0Y0.</li> </ol> <p>As you see: NO manual commands are given here! You can not move the printhead up/down/sideways without having a good chance of inducing a layer shift.</p> <p>The Pause behavior can be adjusted in the firmware.</p>
<p>You may have moved the nozzle in the X or Y direction a bit. Instead of resuming right away (that is, after step 5), send it to the X/Y home.</p> <p>Additionally, if you have a removable build plate like in Prusas, you can remove the print, send the model to the X/Y/Z home, raise the nozzle very high, then replace the print</p>
1,128
<p>I'm losing my mind, it all started out with the idea of a project where I want an abstract shape (I'm going to call it a stretched cube with an angle), now I know a bit of Vectorworks - a 3D/Architecture drawing program. I found nothing in all the tutorials how to make something low poly but still be able to for example screw the bottom of with a thread for example.</p> <p>I found numerous shapes I like on Thingiverse but they are all STL files which I've learned so far are hard to edit and make them functionally usable when cross transferring them for one to another program. </p> <p>Today I gave it another try to find other programs which can give me the result and functionality I want. Thus far I've only found program where you make the shape perfectly and then by using a mesh program like 123make and Meshmixer to then change the outcome of the rendering. But in my case this makes some parts unable to use anymore as example the threading? </p> <p>So for the question I their a program which I can make a low poly shape (example below) where I still can add holes and threading like you can do with AutoCAD, Vectorworks. </p> <p>I hope somebody knows how to do this I've been searching and asking around for weeks!!</p> <p>This is an example of the type of shape I would like to create, <a href="https://www.google.be/search?q=low%20poly%20vase&amp;espv=2&amp;biw=1567&amp;bih=976&amp;tbm=isch&amp;imgil=s0wM9Yoq8UTF1M%253A%253BNVFfgWtuiEyI8M%253Bhttps%25253A%25252F%25252Fwww.etsy.com%25252Flisting%25252F221563489%25252Fartsy-vases-redux-golden-polygon-modern&amp;source=iu&amp;pf=m&amp;fir=s0wM9Yoq8UTF1M%253A%252CNVFfgWtuiEyI8M%252C_&amp;usg=__9w_ZHPGpome2_nNv4VJ7ZRwwRUw%3D&amp;ved=0ahUKEwiPqO-qpYzMAhUIow4KHY7BDmoQyjcIJg&amp;ei=VJYOV4-uIojGOo6Du9AG#imgrc=s0wM9Yoq8UTF1M%3A" rel="nofollow noreferrer">Low poly vase</a> - mine would be exactly the same but it would be to give you an idea</p> <p>Example of the thread I would like to implement in the shape above, <a href="http://www.thingiverse.com/thing:227192" rel="nofollow noreferrer">Tap and Die for 3D printed threads </a></p>
<p>Yes, you can accomplish threading easily with something like 3Ds Max, Blender, Maya etc. I use Maya personally so, in Maya, all you have to do is:</p> <ol> <li>Create a cylinder. This will be the main body of your 'screw'.</li> <li>To make the thread, you need to create a helix primitive. You can edit the number of coils and the coil thickness in the Maya GUI.</li> <li>Once you have the thread, it is a simple matter of performing a couple of boolean operations. The first boolean (union) operation will unite the screw made in step 1 with the thread made in step 2. The second boolean (subtract) operation will cut out the thread from the object within which you want your screw to be driven into. When you print the two models, you should find that the screw nicely turns into the object from which you cut out the thread.</li> </ol> <p>The point is: yes, it is easy to do such things in most 3D software packages. Maya comes with a nice selection of default objects you can use, so essentially you need to do no 'modeling' yourself to create something like the example you showed us.</p> <p>Your next question, about editing models on Thingiverse. The reason why you cannot edit them easily is because most models there have been decimated and triangulated, which makes them very difficult to reshape or edit because the topology is no longer strictly manifold -- it is just a big mess of triangles! </p> <p>If you want to edit Thingiverse models, I recommend something like ZBrush. You can import triangulated models and then rebuild the geometry into quads (using DynaMesh, for example), which you can then edit to your liking. Once done, you can simply decimate and re-export as STL or whatever extension you need.</p> <p>Finally, low/high poly is not so relevant in 3D print outs, especially in mechanically functioning parts. This is because most models are created in high resolution (high polygon count) and then decimated + triangulated down to truncate file sizes. But the functionality and physical feel of the model should not change due to this process - it just takes practice and lots of experimentation.</p> <p>Hope this helps :)</p> <p>Hassan</p>
<p>I've had my share of struggles with the issues you're having - bridging the software gap between hard-edge, parametric modeling tools (typically CAD) and more free-form, 'soft'/organic, modeling tools. It's not a trivial task to work across both domains simultaneously.</p> <p>The simplest workflow I've developed is:</p> <ol> <li>Create a simple CAD model of parts of the object you're trying to make that have mechanical/precision features (e.g. threaded screw holes, joints) in a CAD program (e.g. AutoCAD, Inventor, Solidworks, Fusion 360).</li> <li>Export a high-precision STL of those parts</li> <li>Create/generate the 'soft'/organic portions of the model in your software suite of choice (e.g. Blender, Maya)</li> <li>Export an OBJ file (or STL, if the option is available) of the 'soft' parts</li> <li>Import both sets of parts into <a href="http://www.meshmixer.com/" rel="nofollow">Meshmixer</a> and combine them there.</li> <li>Export to a single, combined STL</li> <li>(Optional) Pass the 'end product' STL through a model "fixer" - I quite like the <a href="https://modelrepair.azurewebsites.net/" rel="nofollow">Microsoft Model Repair Service</a></li> </ol> <p>Meshmixer is a powerful but poorly documented tool. In my experience, it's capable of accomplishing most of the basic "fixes" most models need in preparation for 3d-printing. It is possible to do some amount of sculpting/organic modeling within Meshmixer itself but you'll probably find it inferior in that regard to other software suites, if you know how to use them.</p>
259
<p>I am currently learning OLAP &amp; MDX after many years of relational database development. </p> <p>Any tips on getting started in MDX? What are the best books and resources to learn MDX?</p>
<p>A classic, albeit a bit dated, book is <a href="https://rads.stackoverflow.com/amzn/click/com/1846281741" rel="nofollow noreferrer" rel="nofollow noreferrer">Fast Track to MDX</a>. It's a great overview and a quick read, though it doesn't cover the new MDX features of SQL Server 2005.</p> <p>The Spofford book <a href="https://rads.stackoverflow.com/amzn/click/com/0471748080" rel="nofollow noreferrer" rel="nofollow noreferrer">MDX Solutions</a> is more up date and a little deeper, but a bit harder to get through.</p> <p>I also highly recommend the blogs of <a href="https://web.archive.org/web/20180325203953/http://sqlblog.com:80/blogs/mosha/default.aspx" rel="nofollow noreferrer">Mosha Pasumansky</a>, <a href="https://blog.crossjoin.co.uk/" rel="nofollow noreferrer">Chris Webb</a>, and <a href="https://web.archive.org/web/20210211164051/http://www.geekswithblogs.net/darrengosbell/Default.aspx" rel="nofollow noreferrer">Darren Gosbell</a>.</p>
<p>We used the LearnItFirst.com training videos and found them to be a very thorough introduction to SSAS and MDX. There are around 40 hours of content plus exercises including around 6 hours of pure MDX Training.</p> <p>The details for the SSAS Course can be found at: <a href="http://www.learnitfirst.com/Course/165/SSAS-2008.aspx" rel="nofollow">Learn IT First SSAS Training</a></p>
4,461
<p>My new Ender 5 Plus' Bowden tube keeps popping out of its socket on the extruder mid-print, I've tried several times and it keeps doing it even though it's locked into place securely at the start every time. Is this a known issue? And how do I resolve it?</p> <p>I just got it so I doubt it's the coupler, I replaced it with a spare as my first solution, I did notice that it got almost stringy plastic around it whenever it gets popped out.... could that be indicative of what the problem is?</p>
<p>The coupler for the Bowden tube is probably worn out or the tube end has been scraped so that the coupler can't grab it or you have left out the clamp on the coupler.</p> <p>The coupler has a sleeve that when pressed down releases the Bowden tube. There is a C-shaped clip that should go between the top lip of the sleeve and the body of the coupler that prevents the sleeve from moving and should help hold the tube more firmly. Make sure this is installed.</p> <p>If the tube outside is visibly worn with scrape marks (this is rare), it might help to cut a few cm off the end so that a fresh section is gripped by the coupler. Be sure to cut the end flush so that there is no gap between the heat break and the Bowden tube or you will have other problems.</p> <p>Alternately (and this is more likely), the coupler itself is worn out, possibly with bent or broken-off teeth. If this is the case, you will need to replace the coupler.</p>
<p>OK well I feel silly, it turns out it wasn't fully pushed into place, I pushed it in feeling it lock and thought it was secure, when it actually wasn't, pushing it in till it feels locked up twice resulted in it being properly secured. (sorry if my description doesn't make a lot of sense, I'm not good at that kind of thing, so I'm trying my best.)</p>
2,066
<p>In my Servlet I would like to access the root of the context so that I can do some JavaScript minifying.</p> <p>It would be possible to do the minify as part of the install process but I would like to do it on Servlet startup to reduce the implementation cost.</p> <p>Does anyone know of a method for getting the context directory so that I can load and write files to disk?</p>
<p>This should give you the real path that you can use to extract / edit files.</p> <p><a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)" rel="noreferrer">Javadoc Link</a></p> <p>We're doing something similar in a context listener.</p> <pre><code>public class MyServlet extends HttpServlet { public void init(final ServletConfig config) { final String context = config.getServletContext().getRealPath("/"); ... } ... } </code></pre>
<p>Do you mean:</p> <pre><code>public class MyServlet extends HttpServlet { public void init(final ServletConfig config) { final String context = config.getServletContext(); ... } ... } </code></pre> <p>Or something more complex?</p>
8,182
<p>I've got some (C#) code that relies on today's date to correctly calculate things in the future. If I use today's date in the testing, I have to repeat the calculation in the test, which doesn't feel right. What's the best way to set the date to a known value within the test so that I can test that the result is a known value?</p>
<p>My preference is to have classes that use time actually rely on an interface, such as</p> <pre><code>interface IClock { DateTime Now { get; } } </code></pre> <p>With a concrete implementation</p> <pre><code>class SystemClock: IClock { DateTime Now { get { return DateTime.Now; } } } </code></pre> <p>Then if you want, you can provide any other kind of clock you want for testing, such as</p> <pre><code>class StaticClock: IClock { DateTime Now { get { return new DateTime(2008, 09, 3, 9, 6, 13); } } } </code></pre> <p>There may be some overhead in providing the clock to the class that relies on it, but that could be handled by any number of dependency injection solutions (using an Inversion of Control container, plain old constructor/setter injection, or even a <a href="http://codebetter.com/blogs/jean-paul_boodhoo/archive/2007/10/15/the-static-gateway-pattern.aspx" rel="noreferrer">Static Gateway Pattern</a>).</p> <p>Other mechanisms of delivering an object or method that provides desired times also work, but I think the key thing is to avoid resetting the system clock, as that's just going to introduce pain on other levels.</p> <p>Also, using <code>DateTime.Now</code> and including it in your calculations doesn't just not feel right - it robs you of the ability to test particular times, for example if you discover a bug that only happens near a midnight boundary, or on Tuesdays. Using the current time won't allow you to test those scenarios. Or at least not whenever you want.</p>
<p>Have you considered using conditional compilation to control what happens during debug/deployment?</p> <p>e.g.</p> <pre><code>DateTime date; #if DEBUG date = new DateTime(2008, 09, 04); #else date = DateTime.Now; #endif </code></pre> <p>Failing that, you want to expose the property so you can manipulate it, this is all part of the challenge of writing <em>testable</em> code, which is something I am currently wrestling myself :D</p> <h3>Edit</h3> <p>A big part of me would preference <a href="https://stackoverflow.com/questions/43711/whats-a-good-way-to-overwrite-datetimenow-during-testing#43720">Blair's approach</a>. This allows you to &quot;hot plug&quot; parts of the code to aid in testing. It all follows the design principle <em>encapsulate what varies</em> test code is no different to production code, its just no one ever sees it externally.</p> <p>Creating and interface may seem like a lot of work for this example though (which is why I opted for conditional compilation).</p>
6,528
<p>Given a controller method like: </p> <pre><code>def show @model = Model.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml =&gt; model } end end </code></pre> <p>What's the best way to write an integration test that asserts that the return has the expected XML?</p>
<p>A combination of using the format and assert_select in an integration test works great:</p> <pre><code>class ProductsTest &lt; ActionController::IntegrationTest def test_contents_of_xml get '/index/1.xml' assert_select 'product name', /widget/ end end </code></pre> <p>For more details check out <a href="http://apidock.com/rails/ActionController/Assertions/SelectorAssertions/assert_select" rel="noreferrer">assert_select</a> in the Rails docs.</p>
<p>Set the request objects accept header:</p> <pre><code>@request.accept = 'text/xml' # or 'application/xml' I forget which </code></pre> <p>Then you can assert the response body is equal to what you were expecting</p> <pre><code>assert_equal '&lt;some&gt;xml&lt;/some&gt;', @response.body </code></pre>
8,431
<p>We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the "form" part of this? I get how to expose "read" of our data by creating RESTful URLs that essentially function as method calls and return the data:</p> <pre><code>GET /restapi/myobject?param=object-id-maybe </code></pre> <p>...and an XML document representing some data structure is returned. Fine.</p> <p>But, normally, in a web application, an "edit" would involve two requests: one to load the current version of the resources and populate the form with that data, and one to post the modified data back. </p> <p>But I don't get how you would do the same thing with HTTP methods that REST is sort of mapped to. It's a PUT, right? Can someone explain this?</p> <p>(Additional consideration: The UI would be primarily done with AJAX)</p> <p>-- Update: That definitely helps. But, I am still a bit confused about the server side? Obviously, I am not simply dealing with files here. On the server, the code that answers the requests should be filtering the request method to determine what to do with it? Is that the "switch" between reads and writes?</p>
<p>There are many different alternatives you can use. A good solution is provided at the <a href="http://microformats.org/wiki/rest/urls" rel="nofollow noreferrer">microformats wiki</a> and has also been referenced by the RESTful JSON crew. As close as you can get to a standard, really.</p> <pre><code> Operate on a Record GET /people/1 return the first record DELETE /people/1 destroy the first record POST /people/1?_method=DELETE alias for DELETE, to compensate for browser limitations GET /people/1/edit return a form to edit the first record PUT /people/1 submit fields for updating the first record POST /people/1?_method=PUT alias for PUT, to compensate for browser limitations </code></pre>
<p>The load should just be a normal GET request, and the saving of new data should be a POST to the URL which currently has the data...</p> <p>For example, load the current data from <a href="http://www.example.com/record/matt-s-example" rel="nofollow noreferrer">http://www.example.com/record/matt-s-example</a> and then, change the data, and POST back to the same URL with the new data.</p> <p>A PUT request could be used when creating a new record (i.e. PUT the data at a URL which doesn't currently exist), but in practice just POSTing is probably a better approach to get started with.</p>
6,804
<p>I have been searching around on google and not found any answers to this dilemma. I am using a Prusa I3 printer with PLA, trying to print horseshoes for the company I work for. They are for model horses, so quality is fairly important. I seem to have gotten all the settings dialed in just the way I want them and for the most part, the prints come out fine. There is however one annoying thing that keeps happening. When the filament is going around the curve of the top of the horseshoe on layers beyond the first, the filament does not follow the curves of the first layer. But its not every time. It seems like it is just the 2nd or 3rd Layers that are doing it. I have adjusted the flow rate, the speed, the layer height, temperature, and nothing seems to get rid of this irksome issues. I can of course provide more in depth details, and am including a pic of what i am getting. Any Ideas?<a href="https://i.stack.imgur.com/vr1tx.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/vr1tx.jpg" alt="enter image description here"></a></p>
<p>It could very well be that your print speed is too high (starting from the 2nd layer) for the motors to keep up comfortably. Try reducing the print speed to perhaps 75-80% of what you are using to see if it addresses the issue. You should also check you model to make sure there are errors in the STL. Sometimes such mesh errors can cause funny things to happen. Do you see the irregularities in the print preview at all?</p>
<p>Is that printed on to tape? It looks <em>very</em> uneven. I'm guessing this is general bad adhesion and its just showing up best when going around curves. If you print onto tape, try putting it down with a squeegee, so it's absolutely flat and level with no creases or bubbles.</p> <p>I've personally had very little luck printing onto masking tape.</p>
862
<p>I want to setup a cron job to rsync a remote system to a backup partition, something like:</p> <pre><code>bash -c 'rsync -avz --delete --exclude=proc --exclude=sys root@remote1:/ /mnt/remote1/' </code></pre> <p>I would like to be able to "set it and forget it" but what if <code>/mnt/remote1</code> becomes unmounted? (After a reboot or something) I'd like to error out if <code>/mnt/remote1</code> isn't mounted, rather than filling up the local filesystem.</p> <p><strong>Edit:</strong><br /> Here is what I came up with for a script, cleanup improvements appreciated (especially for the empty then ... else, I couldn't leave them empty or bash errors)</p> <pre><code>#!/bin/bash DATA=data ERROR="0" if cut -d' ' -f2 /proc/mounts | grep -q "^/mnt/$1\$"; then ERROR=0 else if mount /dev/vg/$1 /mnt/$1; then ERROR=0 else ERROR=$? echo "Can't backup $1, /mnt/$1 could not be mounted: $ERROR" fi fi if [ "$ERROR" = "0" ]; then if cut -d' ' -f2 /proc/mounts | grep -q "^/mnt/$1/$DATA\$"; then ERROR=0 else if mount /dev/vg/$1$DATA /mnt/$1/data; then ERROR=0 else ERROR=$? echo "Can't backup $1, /mnt/$1/data could not be mounted." fi fi fi if [ "$ERROR" = "0" ]; then rsync -aqz --delete --numeric-ids --exclude=proc --exclude=sys \ root@$1.domain:/ /mnt/$1/ RETVAL=$? echo "Backup of $1 completed, return value of rsync: $RETVAL" fi </code></pre>
<pre><code>if cut -d' ' -f2 /proc/mounts | grep '^/mnt/remote1$' &gt;/dev/null; then rsync -avz ... fi </code></pre> <p>Get the list of mounted partitions from <code>/proc/mounts</code>, only match <code>/mnt/remote1</code> (and if it is mounted, send grep's output to <code>/dev/null</code>), then run your <code>rsync</code> job.</p> <p>Recent <code>grep</code>s have a <code>-q</code> option that you can use instead of sending the output to <code>/dev/null</code>.</p>
<p>I am skimming This but I would think you would rather rsync -e ssh and setup the keys to accept the account.</p>
4,699
<p>I am using LINQ to query a generic dictionary and then use the result as the datasource for my ListView (WebForms).</p> <p>Simplified code:</p> <pre><code>Dictionary&lt;Guid, Record&gt; dict = GetAllRecords(); myListView.DataSource = dict.Values.Where(rec =&gt; rec.Name == "foo"); myListView.DataBind(); </code></pre> <p>I thought that would work but in fact it throws a <strong>System.InvalidOperationException</strong>: </p> <blockquote> <p>ListView with id 'myListView' must have a data source that either implements ICollection or can perform data source paging if AllowPaging is true.</p> </blockquote> <p>In order to get it working I have had to resort to the following:</p> <pre><code>Dictionary&lt;Guid, Record&gt; dict = GetAllRecords(); List&lt;Record&gt; searchResults = new List&lt;Record&gt;(); var matches = dict.Values.Where(rec =&gt; rec.Name == "foo"); foreach (Record rec in matches) searchResults.Add(rec); myListView.DataSource = searchResults; myListView.DataBind(); </code></pre> <p>Is there a small gotcha in the first example to make it work?</p> <p>(Wasn't sure what to use as the question title for this one, feel free to edit to something more appropriate)</p>
<p>Try this:</p> <pre><code>var matches = dict.Values.Where(rec =&gt; rec.Name == "foo").ToList(); </code></pre> <p>Be aware that that will essentially be creating a new list from the original Values collection, and so any changes to your dictionary won't automatically be reflected in your bound control.</p>
<p>Just adding knowledge the next sentence doesn´t recover any data from de db. Just only create the query (for that it is iqueryable type). For launching this query you must to add .ToList() or .First() at the end.</p> <pre><code>dict.Values.Where(rec =&gt; rec.Name == "foo") </code></pre>
5,164
<p>I have created a UserControl that has a <code>ListView</code> in it. The ListView is publicly accessible though a property. When I put the UserControl in a form and try to design the <code>ListView</code> though the property, the <code>ListView</code> stays that way until I compile again and it reverts back to the default state. </p> <p>How do I get my design changes to stick for the <code>ListView</code>?</p>
<p>You need to decorate the ListView property with the DesignerSerializationVisibility attribute, like so:</p> <pre><code>[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ListView MyListView { get { return this.listView1; } } </code></pre> <p>This tells the designer's code generator to output code for it.</p>
<p>Just so I'm clear, you've done something like this, right?</p> <pre><code>public ListView MyListView { get { return this.listView1; } } </code></pre> <p>So then you are accessing (at design time) the MyListView property on your UserControl?</p> <p>I think if you want proper design-time support you're better off changing the "Modifier" property on the ListView itself (back on the original UserControl) to Public - that way you can modify the ListView directly on instances of the UserControl. I've had success doing that anyway.</p>
3,653
<p>SketchUp Make is licensed for non-commercial work only. This includes the output from the software.</p> <blockquote> <p>Trimble Navigation Limited and/or its affiliates (&quot;Trimble&quot;) gives you a personal, worldwide, royalty-free, non-assignable and non-exclusive license to use the executable version of the Software for non-commercial use only. Non-commercial use means: you may not sell, rent, lease or lend the output of the Software or the Services.</p> </blockquote> <p>The above retrieved 2016-02-07. The full <a href="https://web.archive.org/web/20181005195026/https://www.sketchup.com/license/b/sketchup-make" rel="nofollow noreferrer">SketchUp Make license</a> can be found on the <a href="https://www.sketchup.com/" rel="nofollow noreferrer">SketchUp website</a>.</p> <p>In what ways does this restrict my use of SketchUp Make generated material with sites that allow the sharing of models (and deisgn files)? This would include sites such as <a href="https://www.thingiverse.com/" rel="nofollow noreferrer">Thingiverse</a>, <a href="https://www.myminifactory.com/" rel="nofollow noreferrer">MyMiniFactory</a> and <a href="https://3dwarehouse.sketchup.com/?hl=en" rel="nofollow noreferrer">3D Warehouse</a>.</p> <hr /> <p>For example, must I always set a non-commercial license for my designs? Thingiverse allows several different license choices to be selected.</p> <p>Can I permit the design to be printed by someone for money?<br /> Thingiverse has links to <a href="https://www.hubs.com/" rel="nofollow noreferrer">3D HUBS</a> and <a href="https://printathing.com/" rel="nofollow noreferrer">Print a Thing</a> which can be disabled per model.</p> <p>Obviously <a href="https://www.sketchup.com/license/b/sketchup-pro" rel="nofollow noreferrer">the SketchUp Pro license</a> makes many of the restrictions on what can be done with the output go away, which would be much simpler. However I do not expect to generate anywhere near the costs of purchasing a license ($695 US at the time of writing) by tweaking a few designs now and then.</p> <hr /> <p>I want to comply with the licenses but I need to understand the limits of what I am permitted to do with SketchUp Make in order to do that. It may be much more prudent for me to invest my time in learning other tools that have no restrictions on what can be done with the output.</p> <p>As this is a legal question it might matter what jurisdiction I am in and what jurisdiction the sites I may share to are in. I am based in the UK. Thingiverse is based in the State of New York. MyMiniFactory uses the Laws of England as a base. 3D Warehouse selects the State of California.</p>
<p>Again, I'm not a specialist in intellectual property law (or any other sort of lawyer), but I have a different interpretation.</p> <p>There is a potential difference between the use of the product, and the use of the derivatives of the product. For example, GCC has a restrictive (open) license, but its OK (in some contexts) to use the compiled code in a commercial product.</p> <p>Generally, you (as creator of a work) will own all of the rights to a work. The supplier of the tools you use does not <em>usually</em> gain any rights to the resulting work.</p> <p>So long as <em>you</em> don't gain from your use of the tool, it is probably OK for other people to profit from the use. Sharing with non-commercial should be your safest option if you're worried - but be aware that this doesn't prevent people from taking your design to a print service indirectly.</p> <p>Their <a href="http://www.sketchup.com/license/d/sketchup" rel="nofollow noreferrer">license</a> says:</p> <blockquote> <p>Non-commercial use means that you may not sell, rent, or lease the output of the Software</p> </blockquote> <p>This implies that they are not making any claims to restrict how other non-connected persons might use your works. Its specifically talking about use as part of employment, or you making a gain.</p> <p>I would also note that to me the language in the license does not look to have been drafted with a clear understanding of intent on this issue.</p>
<p>IANAL, naturally, so take this with that in mind.</p> <p>From what I've read and been instructed, any software which is licenced as non-commercial cannot be redistributed or incorporated into any commercial software product. The other thing about "noncommercial" software licenses is that they can't be used for corporate design work -- as opposed to home user hacking. </p> <p>Now, all you need to do is ensure that the license restrictions remain with the mixup files you post. There is no doubt that, so long as you do that, you are free from any legal problems that a downstream vendor may incur upon trying to sell the hardware produced. </p>
511
<p>I have a ListView control, and I'm trying to figure out the easiest/best way to disallow changing the selected row(s), without <em>hiding</em> the selected row(s).</p> <p>I know there's a <code>HideSelection</code> property, but that only works when the <code>ListView</code> is still enabled (but not focused). I need the selection to be viewable even when the ListView is disabled.</p> <p>How can I implement this?</p>
<p>You could also make the ListView ownerdraw. You then have complete control over how the items look whether they are selected or not or whether the ListView itself is enabled or not. The DrawListViewItemEventArgs provides a way to ask the ListView to draw individual parts of the item so you only have to draw the bits you're interested in. For example, you can draw the background of the item but leave it up to the ListView to draw the text.</p>
<p>Implement SelectedIndexChanged and do this</p> <pre><code> private void listViewABC_SelectedIndexChanged(object sender, EventArgs e) { listViewABC.SelectedItems.Clear(); } </code></pre>
3,489
<p>I'm writing a web app that points to external links. I'm looking to create a non-sequential, non-guessable id for each document that I can use in the URL. I did the obvious thing: treating the url as a string and str#crypt on it, but that seems to choke on any non-alphanumberic characters, like the slashes, dots and underscores.</p> <p>Any suggestions on the best way to solve this problem?</p> <p>Thanks!</p>
<p>Depending on how long a string you would like you can use a few alternatives:</p> <pre><code>require 'digest' Digest.hexencode('http://foo-bar.com/yay/?foo=bar&amp;a=22') # "687474703a2f2f666f6f2d6261722e636f6d2f7961792f3f666f6f3d62617226613d3232" require 'digest/md5' Digest::MD5.hexdigest('http://foo-bar.com/yay/?foo=bar&amp;a=22') # "43facc5eb5ce09fd41a6b55dba3fe2fe" require 'digest/sha1' Digest::SHA1.hexdigest('http://foo-bar.com/yay/?foo=bar&amp;a=22') # "2aba83b05dc9c2d9db7e5d34e69787d0a5e28fc5" require 'digest/sha2' Digest::SHA2.hexdigest('http://foo-bar.com/yay/?foo=bar&amp;a=22') # "e78f3d17c1c0f8d8c4f6bd91f175287516ecf78a4027d627ebcacfca822574b2" </code></pre> <p>Note that this won't be unguessable, you may have to combine it with some other (secret but static) data to salt the string:</p> <pre><code>salt = 'foobar' Digest::SHA1.hexdigest(salt + 'http://foo-bar.com/yay/?foo=bar&amp;a=22') # "dbf43aff5e808ae471aa1893c6ec992088219bbb" </code></pre> <p>Now it becomes much harder to generate this hash for someone who doesn't know the original content and has no access to your source.</p>
<p>Use <a href="http://ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html" rel="nofollow noreferrer">Digest::MD5</a> from Ruby's standard library:</p> <pre><code>Digest::MD5.hexdigest(my_url) </code></pre>
9,344
<p>There are times when certain standardised comments are called for.</p> <p>Here are some examples (the links go to the various sections below, under the Answers):</p> <ul> <li><a href="https://3dprinting.meta.stackexchange.com/questions/303/do-we-have-standardised-comments#answer-305">General comments</a></li> <li>Prompting user to accept an answer - <em>in order to clear the unanswered question list</em></li> <li><a href="https://3dprinting.meta.stackexchange.com/questions/303/do-we-have-standardised-comments#answer-304">Problems with comments</a> <ul> <li>Answer posted in comments - <em>Solutions to the question posted in the comments, do not show up in searches</em></li> <li>Limiting comments - <em>Additional information, that <strong>may or may not</strong> have been requested is posted in comments, rather than as an edit to the question</em></li> </ul> </li> <li><a href="https://3dprinting.meta.stackexchange.com/questions/303/do-we-have-standardised-comments#answer-402">Poor quality questions</a> <ul> <li>Ask a good question</li> <li>Unbounded questions</li> </ul> </li> <li><a href="https://3dprinting.meta.stackexchange.com/questions/303/do-we-have-standardised-comments#answer-393">Poor quality answers</a> <ul> <li>Short answer - <em>An answer lacking detail, no explanation provided</em></li> <li>Repetition - <em>No new information, the contents of a previously posted answer is repeated by a different user</em></li> <li>Link only answer - <em>Only a link is provided, with no summary, or content, of the link included</em></li> <li>Question posted as answer - <em><strong>Another</strong> question, (possibly) related to the OP's question, is posted as an answer</em></li> <li>&quot;Me too&quot; answer - <em>&quot;I <strong>also</strong> have this issue&quot;</em></li> <li>Edit to a previous answer - <em>user posts second answer with additional information, not realising that there is an edit button for their first answer</em></li> </ul> </li> </ul> <p><em>et cetera</em>...</p>
<h1>Comments</h1> <blockquote> <h2>Question in a comment</h2> <p>Hi and welcome to SE.3DP! Please do not ask new questions in comments. Without wishing to sound harsh, StackExchange is a Q&amp;A site, and not a forum of threaded messages. The reason for this is to aid the search for answers to issues, and provide it in a structured Q&amp;A way. I know that this might seem a pain, but can you repost your question using the <a href="https://x" rel="nofollow noreferrer">Ask Question</a> link at the top of the page? When you repost your new question, please feel free to refer back to this original question using the URL, seeing as it is the reason why you posted in the first place.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Hi and welcome to SE.3DP! Please do not ask new questions in comments. Without wishing to sound harsh, StackExchange is a Q&amp;A site, and not a forum of threaded messages. The reason for this is to aid the search for answers to issues, and provide it in a structured Q&amp;A way. I know that this might seem a pain, but can you repost your question using the [Ask Question](/questions/ask) link at the top of the page? When you repost your new question, please feel free to refer back to this original question using the URL, seeing as it is the reason why you posted in the first place. </code></pre> <blockquote> <h2>Answer in a comment</h2> <p>Comments are not recommended for any of the following: <a href="https://3dprinting.stackexchange.com/help/privileges/comment">Answering a question or providing an alternate solution to an existing answer; instead, post an actual answer (or edit to expand an existing one)</a>. Feel free to post an answer instead. Thanks.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Comments are not recommended for any of the following: [Answering a question or providing an alternate solution to an existing answer; instead, post an actual answer (or edit to expand an existing one)](https://3dprinting.stackexchange.com/help/privileges/comment);. Feel free to post an answer instead. Thanks. </code></pre> <blockquote> <h2>Limit Comments</h2> <p>It is better to <a href="https://x" rel="nofollow noreferrer">edit</a> your question to add information requested in comments, rather than adding more comments. Comments are for helping to improve questions and answers, and are distracting, so we try to keep them to a minimum. All of this information can be edited into your question to make it easier for people to answer your question. If all of the information is contained in one block then people don't have to read all of the comments to discover all of the information. Once all of the information needed to answer the question is contained within it, the comments can be tidied &amp; deleted.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>It is better to [edit] your question to add information requested in comments, rather than adding more comments. Comments are for helping to improve questions and answers, and are distracting, so we try to keep them to a minimum. All of this information can be edited into your question to make it easier for people to answer your question. If all of the information is contained in one block then people don't have to read all of the comments to discover all of the information. Once all of the information needed to answer the question is contained within it, the comments can be tidied &amp; deleted. </code></pre> <blockquote> <h2><em>Self</em>-answered in a comment - Initial request</h2> <p>Did any of the posted answers solve your issue? If so, please mark it as the accepted answer. If not, then either refine your question or please post your comment above (which appears to contain the solution) as an answer, and then mark it as accepted in 48 hours, in order to remove your question from the unanswered queue. Answers are not allowed in comments, and may be deleted. If your answer is posted as an answer then it becomes searchable and may help others with the same issue.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Did any of the posted answers solve your issue? If so, please mark it as the accepted answer. If not, then either refine your question or please post your comment above (which appears to contain the solution) as an answer, and then mark it as accepted in 48 hours, in order to remove your question from the unanswered queue. Answers are not allowed in comments, and may be deleted. If your answer is posted as an answer then it becomes searchable and may help others with the same issue. </code></pre> <blockquote> <h2><em>Self</em>-answered in a comment - Second request (citing comment - obviously replacing the <code>blah blah blah</code>!)</h2> <p>Hi, could you post your comment <code>blah blah blah</code> as an answer (maybe expanding upon it as well, if possible) and mark it as accepted. That way your question will no longer be in the unanswered list. Thanks</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Hi, could you post your comment `blah blah blah` as an answer (maybe expanding upon it as well, if possible) and mark it as accepted. That way your question will no longer be in the unanswered list. Thanks </code></pre> <blockquote> <h2><em>Self</em>-answered in a comment - Final Reminder (also citing the comment)</h2> <p>Hi, <em><strong>please</strong></em> could you post your comment <code>blah blah blah</code> as an answer (and expanding upon it as well, if possible and a photo as &lt;username2&gt; says) and mark it as accepted. That way your question will no longer be in the unanswered list. Thanks. (1) Comments do not show up in searches, (2) Your answer may help someone else (3) As we are a beta site we <em>really</em> need to keep the number of unanswered questions to a minimum, if we are to continue as a site (4) You will earn more reputation from votes and accepting your answer. Thanks in advance</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Hi, ***please*** could you post your comment `blah blah blah` as an answer (and expanding upon it as well, if possible and a photo as &lt;username2&gt; says) and mark it as accepted. That way your question will no longer be in the unanswered list. Thanks. (1) Comments do not show up in searches, (2) Your answer may help someone else (3) As we are a beta site we *really* need to keep the number of unanswered questions to a minimum, if we are to continue as a site (4) You will earn more reputation from votes and accepting your answer. Thanks in advance </code></pre>
<h1>Questions</h1> <p><em>Please note that if a user is new and has shown some research effort in composing the question, gently guide the new user in completing the question rather than using some of the statements below. If a question needs some more information or an image, use comments or flag for moderator attention if you don't have enough reputation to post comments. We welcome every new member, but not everybody is acquainted with the SE Q/A style (frequently it is assumed that it is similar to a forum of threaded messages).</em></p> <blockquote> <h2>New user, forum style question</h2> <p>Hi and welcome to 3D printing.SE! SE websites are driven by questions and answers, your question is more a forum style question where you ask for help to start a discussion. Please read the help section, accessible through the button with the question mark at the top right menu.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Hi and welcome to 3D printing.SE! SE websites are driven by questions and answers, your question is more a forum style question where you ask for help to start a discussion. Please read the [help] section, accessible through the button with the question mark at the top right menu. </code></pre> <blockquote> <h2>Ask a good question</h2> <p>I would recommend that in addition to reading some highly voted questions to gauge the standard expected, that you take a look at the help section relating to <a href="https://3dprinting.stackexchange.com/help/asking">asking</a> questions, in particular <a href="https://3dprinting.com/help/how-to-ask" rel="nofollow noreferrer">How to ask a good question</a>, and take the <a href="http://3dprinting.stackexchange.com/tour">tour</a> for more information on how stack exchange works. Thanks :-)</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>I would recommend that in addition to reading some highly voted questions to gauge the standard expected, that you take a look at the help section relating to [asking](https://3dprinting.stackexchange.com/help/asking) questions, in particular [How to ask a good question](https://3dprinting.com/help/how-to-ask), and take the [tour](http://3dprinting.stackexchange.com/tour) for more information on how stack exchange works. Thanks :-) </code></pre> <blockquote> <h2>Unbounded questions</h2> <p>Welcome to SE 3D Printing &lt;username&gt;, but I'm afraid that Unbounded Design Questions are off-topic because there are many ways to solve any given design problem, so questions that ask for a list of approaches, a subjective recommendation on a method (for how to build something, how to accomplish something, what something is capable of, etc.) or shopping selection are off-topic. We prefer <a href="http://3dprinting.stackexchange.com/help/dont-ask">practical, answerable questions based on actual problems that you face</a>. Take a look at <a href="http://3dprinting.stackexchange.com/help/how-to-ask">How to Ask</a> &amp; <a href="http://3dprinting.stackexchange.com/tour">tour</a> for more information on how Stack Exchange works.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Welcome to SE 3D Printing &lt;username&gt;, but I'm afraid that Unbounded Design Questions are off-topic because there are many ways to solve any given design problem, so questions that ask for a list of approaches, a subjective recommendation on a method (for how to build something, how to accomplish something, what something is capable of, etc.) or shopping selection are off-topic. We prefer [practical, answerable questions based on actual problems that you face](http://3dprinting.stackexchange.com/help/dont-ask). Take a look at [ask] &amp; [tour] for more information on how Stack Exchange works. </code></pre> <blockquote> <h2>Too localised (?)</h2> <p>As it stands this question is unlikely to help future visitors and may get closed as <a href="http://3dprinting.stackexchange.com/help/closed-questions">too localized</a>. While it is useful to have all of the background in one place, could I suggest dividing this up into a series of <a href="http://3dprinting.stackexchange.com/help/dont-ask">practical, answerable questions based on actual problems that you face</a>. See <a href="http://meta.3dprinting.stackexchange.com/questions/153/is-it-ok-to-ask-for-opinions/154#154">Is it ok to ask for opinions?</a> for more background.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>As it stands this question is unlikely to help future visitors and may get closed as [too localized](http://3dprinting.stackexchange.com/help/closed-questions). While it is useful to have all of the background in one place, could I suggest dividing this up into a series of [practical, answerable questions based on actual problems that you face](http://3dprinting.stackexchange.com/help/dont-ask). See [Is it ok to ask for opinions?](http://meta.3dprinting.stackexchange.com/questions/153/is-it-ok-to-ask-for-opinions/154#154) for more background. </code></pre> <blockquote> <h2>Bad fit questions/Questions by new users for closed for other reasons</h2> <p>Welcome to 3D Printing.SE &lt;username&gt;, but I'm afraid that questions like this really aren't a good fit for a stack exchange site. We prefer <a href="http://3dprinting.stackexchange.com/help/dont-ask">practical, answerable questions based on actual problems that you face</a>. Take a look at <a href="http://3dprinting.stackexchange.com/help/how-to-ask">How to Ask</a> and <a href="http://3dprinting.stackexchange.com/tour">tour</a> for more information on how stack exchange works. Also, the <a href="http://meta.3dprinting.stackexchange.com/questions/1302/3dprinting-stack-exchange-question-checklist">3D Printing question checklist</a> has good advice on how to write a good question. If you <a href="https://x" rel="nofollow noreferrer">edit</a> your question to fit our community guidelines we can reopen it for you.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Welcome to SE.3DP, but I'm afraid that questions like this really aren't a good fit for a stack exchange site. We prefer *[practical, answerable questions based on actual problems that you face](http://3dprinting.stackexchange.com/help/dont-ask)*. Take a look at [ask] and [about] for more information on how stack exchange works. Also, the [*3DP* question checklist](https://3dprinting.meta.stackexchange.com/q/340) has good advice on how to write a good question. If you [edit] your question to fit our community guidelines we can reopen it for you. </code></pre> <blockquote> <h2>Old question, no accepted answer - With multiple answers available</h2> <p>Have you found &amp; fixed the problem? If any of the answers helped you to get an answer to your question or come to your own conclusions then please do vote &amp; accept an answer (using the tick button next to it). This helps us reduce the <a href="https://3dprinting.stackexchange.com/unanswered">unanswered questions list</a> &amp; stops the question from being bumped once in a while. If you found another answer (than those already posted), please add that answer (&amp; accept after 48 hours) to share your experience with the community. If you have not been able to address the problem please update your question.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Have you found &amp; fixed the problem? If any of the answers helped you to get an answer to your question or come to your own conclusions then please do vote &amp; accept an answer (using the tick button next to it). This helps us reduce the [unanswered questions list](https://3dprinting.stackexchange.com/unanswered) &amp; stops the question from being bumped once in a while. If you found another answer (than those already posted), please add that answer (&amp; accept after 48 hours) to share your experience with the community. If you have not been able to address the problem please update your question. </code></pre> <blockquote> <h2>Old question, no accepted answer - With multiple answers available (alternative)</h2> <p>Hello @[UserName], I noticed your question has been up for a while now. Have any of the answers below been able to solve your question? If so, would you mind accepting the appropriate answer. If not, what is missing so that we may help you further? Also, if you have figured it out on your own, you can always answer and accept your own solution. Thank you.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Hello @[UserName], I noticed your question has been up for a while now. Have any of the answers below been able to solve your question? If so, would you mind accepting the appropriate answer. If not, what is missing so that we may help you further? Also, if you have figured it out on your own, you can always answer and accept your own solution. Thank you. </code></pre> <blockquote> <h2>Old question, no accepted answer - If there is only one answer</h2> <p>Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question. </code></pre> <blockquote> <h2>Old question, no answer</h2> <p>Unfortunately, up to now, no answers are given on your question! Have you found an answer yourself? If so, you may add your own solution and accept that after 48 hours. If you have not been able to address the problem please update your question so other people may help you find an answer. You can even decide to delete the question. We need to reduce the <a href="https://3dprinting.stackexchange.com/unanswered">unanswered questions list</a> to graduate from the Beta stage.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Unfortunately, up to now, no answers are given on your question! Have you found an answer yourself? If so, you may add your own solution and accept that after 48 hours. If you have not been able to address the problem please update your question so other people may help you find an answer. You can even decide to delete the question. We need to reduce the [unanswered questions list](https://3dprinting.stackexchange.com/unanswered) to graduate from the Beta stage. </code></pre> <blockquote> <h2>Self answered but not accepted any answer</h2> <p>Good to see you solved the problem and took the time to share it with us! Please accept your answer so that it does not pop up to the top of the queue once in a while. This also will help us reducing the <a href="https://3dprinting.stackexchange.com/unanswered">unanswered questions list</a>.</p> </blockquote> <p><strong>C&amp;P ⎘</strong></p> <pre><code>Good to see you solved the problem and took the time to share it with us! Please accept your answer so that it does not pop up to the top of the queue once in a while. This also will help us reducing the [unanswered questions list](https://3dprinting.stackexchange.com/unanswered). </code></pre> <blockquote> <h2>Multiple questions post</h2> <p>Hi and welcome to 3D printing.SE! SE websites are driven by questions and answers, your question contains multiple questions which makes it more difficult to answer as there are multiple answers. Please read the [help] section, accessible through the button with the question mark at the top right menu and read [ask]. Please split up your question by adding the other questions in a separate question!</p> </blockquote> <p>C&amp;P ⎘</p> <pre><code>Hi and welcome to 3D printing.SE! SE websites are driven by questions and answers, your question contains multiple questions which makes it more difficult to answer as there are multiple answers. Please read the [help] section, accessible through the button with the question mark at the top right menu and read [ask]. Please split up your question by adding the other questions in a separate question! </code></pre> <blockquote> <h2>Cross-posted question</h2> <p>Hi and welcome to 3D printing.SE! Hi and welcome to 3D printing.SE! I see that you have cross-posted this question on another Stack Exchange site. Cross posting is frowned upon, please see <a href="https://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu">Is cross-posting a question on multiple Stack Exchange sites permitted if the question is on-topic for each site?</a>. Please delete one of copies of the question.</p> </blockquote> <p>C&amp;P ⎘</p> <pre><code>Hi and welcome to 3D printing.SE! I see that you have cross-posted this question on another Stack Exchange site. Cross posting is frowned upon, please see [Is cross-posting a question on multiple Stack Exchange sites permitted if the question is on-topic for each site?](https://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu). Please delete one of copies of the question. </code></pre>
52
<p>We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours.</p> <p><strong>Update:</strong> If there's an option I need to turn on to enable this in the future, what is it?</p> <p>Also, as a corollary question, if I have to use the file creation time, how can I do that quickly in a recursive manner for a large folder?</p> <hr> <p>If I have to check creation times, then <a href="https://stackoverflow.com/questions/56682/how-to-see-if-a-subfile-of-a-directory-has-changed">this question</a> will be helpful to the solution as well.</p>
<p>All the code in the web folder should be backed by SVN commits, shouldn't it?</p> <p>If this is the case you should easily be able to track the problem down just by looking through your SVN logs at the last few changes that got committed. <code>svn info</code> will tell you which revision the working copy currently is at, so you know where to start looking</p> <p>Once you track down the commit with the bug in it, you can use <code>svn blame</code> to find the person that did it, and explain to them what they overlooked and how they caused the bug. Then you can make them buy everyone lunch for screwing up the site.</p> <p>If you have locally modified/added any files which aren't in SVN, then <code>svn stat</code> and <code>svn diff</code> will show you what those changes are, so you can figure out if they are causing the problem too. You should then revert those changes so your working copy is a clean checkout, or commit the changes into the repository. </p> <p>There's nothing worse than trying to track down a bug in your code only to find out 3 hours later that the bug is not actually in any of your code, but in some stupid local tweak someone made in the working copy that never got committed :-(</p>
<p>I would run a <em>svn st</em> in the web folder (to find any files that are changed since the checkout) and compare that to the repository.</p>
7,882
<p>I have recently begun working on a project to establish how best to leverage the processing power available in modern graphics cards for general programming. It seems that the field general purpose GPU programming (GPGPU) has a large bias towards scientific applications with a lot of heavy math as this fits well with the GPU computational model. This is all good and well, but most people don't spend all their time running simulation software and the like so we figured it might be possible to create a common foundation for easily building GPU-enabled software for the masses.</p> <p>This leads to the question I would like to pose; What are the most common types of work performed by programs? It is not a requirement that the work translates extremely well to GPU programming as we are willing to accept modest performance improvements (Better little than nothing, right?).</p> <p>There are a couple of subjects we have in mind already:</p> <ul> <li>Data management - Manipulation of large amounts of data from databases and otherwise. </li> <li>Spreadsheet type programs (Is somewhat related to the above).</li> <li>GUI programming (Though it might be impossible to get access to the relevant code).</li> <li>Common algorithms like sorting and searching.</li> <li>Common collections (And integrating them with data manipulation algorithms)</li> </ul> <p>Which other coding tasks are very common? I suspect a lot of the code being written is of the category of inventory management and otherwise tracking of real 'objects'.</p> <p>As I have no industry experience I figured there might be a number of basic types of code which is done more often than I realize but which just doesn't materialize as external products.</p> <p>Both high level programming tasks as well as specific low level operations will be appreciated.</p>
<p>General programming translates terribly to GPUs. GPUs are dedicated to performing fairly simple tasks on streams of data at a massive rate, with massive parallelism. They do not deal well with the rich data and control structures of general programming, and there's no point trying to shoehorn that into them.</p>
<p>I do a lot of simplifying of configuration. That is I wrap the generation/management of configuration values inside a UI. The primary benefit is I can control work flow and presentation to make it simpler for non-techie users to configure apps/sites/services.</p>
6,656
<p>How do I determine the size of my array in C? </p> <p>That is, the number of elements the array can hold?</p>
<p><strong>Executive summary:</strong></p> <pre><code>int a[17]; size_t n = sizeof(a)/sizeof(a[0]); </code></pre> <hr> <p><strong>Full answer:</strong></p> <p>To determine the size of your array in bytes, you can use the <code>sizeof</code> operator:</p> <pre><code>int a[17]; size_t n = sizeof(a); </code></pre> <p>On my computer, ints are 4 bytes long, so n is 68.</p> <p>To determine the number of elements in the array, we can divide the total size of the array by the size of the array element. You could do this with the type, like this:</p> <pre><code>int a[17]; size_t n = sizeof(a) / sizeof(int); </code></pre> <p>and get the proper answer (68 / 4 = 17), but if the type of <code>a</code> changed you would have a nasty bug if you forgot to change the <code>sizeof(int)</code> as well.</p> <p>So the preferred divisor is <code>sizeof(a[0])</code> or the equivalent <code>sizeof(*a)</code>, the size of the first element of the array.</p> <pre><code>int a[17]; size_t n = sizeof(a) / sizeof(a[0]); </code></pre> <p>Another advantage is that you can now easily parameterize the array name in a macro and get:</p> <pre><code>#define NELEMS(x) (sizeof(x) / sizeof((x)[0])) int a[17]; size_t n = NELEMS(a); </code></pre>
<p><strong>Note:</strong> This one can give you undefined behaviour as <a href="https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c/37539#comment91048046_51392277">pointed out by M.M</a> in the comment.</p> <pre><code>int a[10]; int size = (*(&amp;a+1)-a); </code></pre> <p>For more details, see <a href="https://aticleworld.com/how-to-find-sizeof-array-in-cc-without-using-sizeof/" rel="nofollow noreferrer">here</a> and also <a href="https://www.geeksforgeeks.org/how-to-find-size-of-array-in-cc-without-using-sizeof-operator/" rel="nofollow noreferrer">here</a>.</p>
5,828
<p>Given an empty method body, will the JIT optimize out the call (I know the C# compiler won't). How would I go about finding out? What tools should I be using and where should I be looking?</p> <p>Since I'm sure it'll be asked, the reason for the empty method is a preprocessor directive.</p> <hr> <p>@Chris: Makes sense, but it could optimize out calls to the method. So the method would still exist, but static calls to it could be removed (or at least inlined...)</p> <p>@Jon: That just tells me the language compiler doesn't do anything. I think what I need to do is run my dll through ngen and look at the assembly.</p>
<p>This chap has quite a good treatment of JIT optimisations, do a search on the page for 'method is empty', it's about half way down the article -</p> <p><a href="http://www.codeproject.com/KB/dotnet/JITOptimizations.aspx" rel="noreferrer">http://www.codeproject.com/KB/dotnet/JITOptimizations.aspx</a></p> <p>Apparently empty methods do get optimised out through inlining what is effectively no code.</p> <p>@Chris: I do realise the that the methods will still be part of the binary and that these are JIT optimisations :-). On a semi-related note, Scott Hanselman had quite an interesting article on inlining in Release build call stacks:</p> <p><a href="http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx" rel="noreferrer">http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx</a></p>
<p>All things being equal, yes it should be optimized out. The JIT inlines functions where appropriate and there are few things more appropriate than empty functions :)</p> <p>If you really want to be sure then change your empty method to throw an exception and print out the stack trace it contains.</p>
3,289
<p>I have a 3D printer that is going crazy with x-axis shift, and I need a tension gauge belt to measure the tension.</p> <p>I've never used one before, and looking online, I can't tell which one would be the right fit.</p> <p>Any ideas? What things should I look for?</p>
<p>It's extremely unlikely that belt tension is actually your problem. I've never heard of anyone using a gauge to measure their belt tension. Typically you just pull your belt tight by hand so that it produces a low note when plucked. It's far more likely that you're experiencing shifts due to too high or too low stepper current.</p> <p>Unless your belt is so loose that it easily skips over the pulley (which should be obvious without using a gauge) or so tight that it completely binds up (it would be impossible to get it that tight without some kind of superhuman force) it's definitely not the problem.</p>
<p>People are using this <a href="https://i.stack.imgur.com/zA3d9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zA3d9.png" alt="Clothpin springs repurposed into a makeshift belt tensioner" /></a> to tighten the belt but I would totally agree with @Tom - there is no need to use such devices or gauges and your problem lies in stepsticks current.</p> <p>It would be also problem with endstops so PCB doesn;t know it's time to stop :)</p>
253
<p>Is it possible to get UI text from an external application in C#. </p> <p>In particular, is there a way to read Unicode text from a label (I assume it's a normal Windows label control) from an external Win32 app that was written by a 3rd party? The text is visible, but not selectable by mouse in the UI.</p> <p>I assume there is some accessibility API (e.g. meant for screen readers) that allows this. </p> <p>Edit: Currently looking into using something like the <a href="http://msdn.microsoft.com/en-us/magazine/cc163617.aspx" rel="nofollow noreferrer">Managed Spy App</a> but would still appreciate any other leads.</p>
<p>You could do it if that unicode text is actually a window with a caption by sending a <a href="http://msdn.microsoft.com/en-us/library/ms632627.aspx" rel="nofollow noreferrer">WM_GETTEXT</a> message. </p> <pre><code>[DllImport("user32.dll")] public static extern int SendMessage (IntPtr hWnd, int msg, int Param, System.Text.StringBuilder text); System.Text.StringBuilder text = new System.Text.StringBuilder(255) ; // or length from call with GETTEXTLENGTH int RetVal = Win32.SendMessage( hWnd , WM_GETTEXT, text.Capacity, text); </code></pre> <p>If it is just painted on the canvas you might have some luck if you know what framework the application uses. If it uses WinForms or Borland's VCL you could use that knowledge to get to the text.</p>
<p>didn't see the values for wm_gettext or wm_gettextlength in that article, so just in case..</p> <pre><code>const int WM_GETTEXT = 0x0D; const int WM_GETTEXTLENGTH = 0x0E; </code></pre>
3,919
<p>I recently printed out Jeff Atwood's <a href="http://www.codinghorror.com/blog/archives/001157.html" rel="nofollow noreferrer">Understanding The Hardware</a> blog post and plan on taking it to Fry's Electronics and saying to them "Give me all the parts on these sheets so I can put this together." However, I'm going to be installing 64bit Windows Server 2008 on this machine so before I get all the parts:</p> <p>Will all this hardware be 64bit Server 2008 compatible? - i.e. all drivers available for this hardware for this OS?</p>
<p>Hardware's generally pretty OS-agnostic (at least in terms of Windows flavors) these days. Your only concern is getting drivers for other devices (scanners, printers, IR remotes) that won't work on 64bit and/or won't work on "Server" OSes. Online backup software like Mozy generally won't even install on a Server OS, so it depends on what you're going to use it for.</p> <p>That said, if you're just going to use it for a home machine, then without even looking at the hardware list Jeff put together, I'd be confident in saying it'll probably work just fine.</p>
<p>You have a $1000 operating system license and you're going to put it on ~$1100 worth of hardware purchased at Fry's and presumably put together by yourself?</p>
5,984
<p>I'm trying to use one of the RAMPS GPIOs to control an external device that requires a 5V low-current logic level signal from Marlin. In order to do this programmatically, my host software (Octoprint) is sending an M42 command. I am using the following syntax:</p> <pre><code>M42 P4 S255 </code></pre> <p>according to the pinout in the following image:</p> <p><a href="https://i.stack.imgur.com/TRInv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TRInv.png" alt="enter image description here"></a></p> <p>However, the pin appears to not be driven to a logic HIGH level. Is there firmware-level configuration I need to do as well, or is my syntax/pin number incorrect?</p>
<p>I looked at the current Marlin code and the P24 command should work as you expect it unless the pin you are trying to use in listed as the "SENSITIVE_PINS" list:</p> <pre><code>#define SENSITIVE_PINS { 0, 1, \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \ Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \ PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS BED_PINS \ _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \ _X2_PINS _Y2_PINS _Z2_PINS \ X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \ } </code></pre> <p>These pins are printer specific; so, without access to your Marlin build, I can't see if pin 4 corresponds to one of these. If this is the problem, the command should be returning an error. If there is no error, I would look closely at the hardware.</p>
<p>Might be because servo pins are not connected to 5V. use Jumper as shown</p> <p><a href="https://i.stack.imgur.com/ycegg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ycegg.png" alt="enter image description here"></a></p>
485
<p>I'm trying to mixin the <code>MultiMap</code> trait with a <code>HashMap</code> like so:</p> <pre><code>val children:MultiMap[Integer, TreeNode] = new HashMap[Integer, Set[TreeNode]] with MultiMap[Integer, TreeNode] </code></pre> <p>The definition for the <code>MultiMap</code> trait is:</p> <pre><code>trait MultiMap[A, B] extends Map[A, Set[B]] </code></pre> <p>Meaning that a <code>MultiMap</code> of types <code>A</code> &amp; <code>B</code> is a <code>Map</code> of types <code>A</code> &amp; <code>Set[B]</code>, or so it seems to me. However, the compiler complains:</p> <pre><code>C:\...\TestTreeDataModel.scala:87: error: illegal inheritance; template $anon inherits different type instances of trait Map: scala.collection.mutable.Map[Integer,scala.collection.mutable.Set[package.TreeNode]] and scala.collection.mutable.Map[Integer,Set[package.TreeNode]] new HashMap[Integer, Set[TreeNode]] with MultiMap[Integer, TreeNode] ^ one error found </code></pre> <p>It seems that generics are tripping me up again.</p>
<p>I had to import <code>scala.collection.mutable.Set</code>. It seems the compiler thought the Set in <code>HashMap[Integer, Set[TreeNode]]</code> was <code>scala.collection.Set</code>. The Set in the MultiMap def is <code>scala.collection.</code><strong><code>mutable</code></strong><code>.Set</code>. </p>
<p>That can be annoying, the name overloading in Scala's collections is one of its big weaknesses.</p> <p>For what it's worth, if you had <code>scala.collection._</code> imported, you could probably have written your <code>HashMap</code> type as:</p> <pre><code>new HashMap[ Integer, mutable.Set[ TreeNode ] ] </code></pre>
7,314
<p>My current employer uses a 3rd party hosted CRM provider and we have a fairly sophisticated integration tier between the two systems. Amongst the capabilities of the CRM provider is for developers to author business logic in a Java like language and on events such as the user clicking a button or submitting a new account into the system, have validation and/or business logic fire off. </p> <p>One of the capabilities that we make use of is for that business code running on the hosted provider to invoke web services that we host. The canonical example is a sales rep entering in a new sales lead and hitting a button to ping our systems to see if we can identify that new lead based on email address, company/first/last name, etc, and if so, return back an internal GUID that represents that individual. This all works for us fine, but we've run into a wall again and again in trying to setup a sane dev environment to work against.</p> <p>So while our use case is a bit nuanced, this can generally apply to any development house that builds APIs for 3rd party consumption: <b>what are some best practices when designing a development pipeline and environment when you're building APIs to be consumed by the outside world?</b></p> <p>At our office, all our devs are behind a firewall, so code in progress can't be hit by the outside world, in our case the CRM provider. We could poke holes in the firewall but that's less than ideal from a security surface area standpoint. Especially if the # of devs who need to be in a DMZ like area is high. We currently are trying a single dev machine in the DMZ and then remoting into it as needed to do dev work, but that's created a resource scarcity issue if multiple devs need the box, let alone they're making potentially conflicting changes (e.g. different branches).</p> <p>We've considered just mocking/faking incoming requests by building fake clients for these services, but that's a pretty major overhead in building out feature sets (though it does by nature reinforce a testability of our APIs). This also doesn't obviate the fact that sometimes we really do need to diagnose/debug issues coming from the real client itself, not some faked request payload.</p> <p>What have others done in these types of scenarios? In this day and age of mashups, there have to be a lot of folks out there w/ experiences of developing APIs--what's worked (and not worked so) well for the folks out there?</p>
<pre><code>Map map = new HashMap(); Hashtable ht = new Hashtable(); </code></pre> <p>Both classes can be found from the java.util package. The difference between the 2 is explained in the following <a href="http://www.jguru.com/faq/view.jsp?EID=430247" rel="noreferrer">jGuru FAQ entry</a>.</p>
<pre><code>Hashtable&lt;Object, Double&gt; hashTable = new Hashtable&lt;&gt;(); </code></pre> <p><strong>put values</strong> ...</p> <p><strong>get max</strong></p> <pre><code>Optional&lt;Double&gt; optionalMax = hashTable.values().stream().max(Comparator.naturalOrder()); if (optionalMax.isPresent()) System.out.println(optionalMax.get()); </code></pre>
4,898
<p>My model is a keycap for mechanical keyboards. There is the cap itself, and a stem with a hole in the form of a cross, which fits the switches themselves.</p> <p><a href="https://i.stack.imgur.com/r0Xxb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r0Xxb.jpg" alt="Print at bottom, the other caps are reference"></a></p> <p><a href="https://i.stack.imgur.com/DkBxu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DkBxu.jpg" alt="Bottom view"></a></p> <p>I print in the same position as it is intended to be used, top up. This means that the stem and the cap are not connected until quite a few print layers.</p> <p>To prevent the stem from falling off during the print (it has a small footprint), I created connectors in the first layers, to hold it in place. <a href="https://i.stack.imgur.com/MXDEn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MXDEn.jpg" alt="enter image description here"></a></p> <p>The issue: it seems like all my prints have a rotation of the stem, compared to the cap. It probably rather is the cross-shaped hole, or its walls, that are not completely symmetrical. I do not think it is only the edges against the printing bed that are the cause, since I have trimmed them with a scalpel. The rotation is always in the same direction.</p> <p>The twist is detectable when watching the keycap with the switch, and more so with keycaps on switches on a keyboard plate (you can see that the edges of the caps do not align. They do in my CAD program): <a href="https://i.stack.imgur.com/0aJ5S.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0aJ5S.jpg" alt="Bottom view with switch"></a> <a href="https://i.stack.imgur.com/nvUvU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nvUvU.jpg" alt="enter image description here"></a></p> <p>I use Cura as my slicer, layer height 0.06 mm, and ABS. I attempted a slow print (30 mm/s), which didn't help.</p> <p>The first work-around that comes to mind is to measure the twist and compensate for that in my model. But I believe that since the problem is in the printing process, the problem would best be solved in the slicer.</p> <p>What could possibly be the issue? Is there an option is Cura to compensate for this? Short of the work-around mentioned above, what are other steps I should look into?</p>
<h2>This looks like a shift rather than a twist.</h2> <p>Looking closely at the "+" opening, it doesn't look as much twisted as it looks as if the top and bottom halves are sheared, with the top half shifted slightly right and the bottom shifted slightly left. The horizontal part of the plus seems aligned on the left and right halves.</p> <p>When you press-fit the keycaps, you will "average" the displacement forces and the keycap will twist.</p> <p>I am suspicious of a backlash problem in the X axis (left to right). Perhaps the belt isn't tight enough, or some part shifts differently. It could be in the rails, the belt, a loose drive pulley, the hot end being slightly loose on the carriage, or any uncontrolled movement. It could be a high-friction x-axis which causes spring wind-up in the drive system.</p> <p>I recommend carefully examining the printer for any excess friction or movement, and taking action to fix that first before tweaking the model to compensate for what can not be fixed.</p> <h2>If it is a twist, use more cooling.</h2> <p>If the photos have misled me, and the vertical "+" shaft if actually twisting, you may need to use higher cooling. The drag of the filament as the head traces the perimeter can create a torque on the shaft, and if the plastic is not sufficiently cooled it could be dragged around. I consider this more of a theoretical problem than a real one, and have not yet seen it in practice.</p> <h2>This is a beautiful design</h2> <p>This is a wonderful application of 3D printing. With a multi-material printer it would be tempting to label the keys similar to old-style multi-shot keycaps.</p>
<p>Another possibility is that those connectors you put in are pulling the cross-pattern off-center. Is there enough height that you could specify supports in that area instead? If so I'd recommend a brim "everywhere" to help stabilize the supports under the centerpost. </p> <p>If there is sufficient clearance in the mechanism itself, consider expanding the diameter of the post (not the cross itself) to increase stability as the print is in progress. </p>
1,597
<p></p> <p>It is supposed to be backwards compatible with HTML4 and XHTML. <a href="http://ejohn.org/blog/html5-doctype/" rel="nofollow noreferrer">John Resig posted about some of the benefits</a>.</p> <p>As long as we don't use any of the new and not supported yet features, would there be any downside to start building sites with this doctype?</p>
<p>Well consider this:</p> <p>When serving as text/html, all you need a doctype for is to trigger standards mode. Beyond that, the doctype does nothing as far as browsers are concerned.</p> <p>When serving as text/html, whether you use XHTML markup or HTML markup, it's treated by browsers as HTML.</p> <p>So, really it comes down to using the shortest doctype that triggers standards mode (&lt;!DOCTYPE html>) and using HTML markup that produces the correct result in browsers.</p> <p>The rest is about conforming, validation and markup prerference.</p> <p>With that said, using &lt;!DOCTYPE html&gt; now and trying to make your markup conform to HTML5 is not a bad idea as long as you stick to stable features that work in browsers now. You wouldn't use anything in HTML4 or XHTML 1.x that doesn't work in browsers, would you?</p> <p>In other words, you use &lt;!DOCTYPE html&gt; with HTML4-like markup while honoring things that have been clarified in HTML5. HTML5 is about browser compatibility after all.</p> <p>The downside to using HTML5 now is that the spec can change quite often. This makes it important for you to keep up with the spec as it actively changes. Also <a href="http://validator.nu/" rel="nofollow noreferrer">http://validator.nu/</a> might not always be up-to-date, but <a href="http://validator.w3.org/" rel="nofollow noreferrer">http://validator.w3.org/</a> isn't always up-to-date either, so don't let that stop you.</p> <p>Of course, if you want to use XHTML 1.0 markup and conform to XHTML 1.0, then you shouldn't use &lt;!DOCTYPE html&gt;.</p> <p>Personally, I always use &lt;!DOCTYPE html&gt; for HTML.</p>
<p>Personally I'd say no. There is no clear benefit to HTML5 and in fact would go as far as to say that the whole thing is botched from the start.</p> <p>Having specialised tags for header, footers and sidebars is a huge mistake - you've got them already in the form of tags (div) and names (classes/id's). Why do we need the specialist ones? XHTML1.1 is good enough, period. In fact, since most browsers don't support HTML4 correctly, there is little point in using a doctype that is going to take years to get proper support.</p>
2,750
<p><strong>Is there a way to enforce/limit the types that are passed to primitives?</strong> <em>(bool, int, string, etc.)</em></p> <p>Now, I know you can limit the generic type parameter to a type or interface implementation via the <em>where</em> clause. However, this doesn't fit the bill for primitives (AFAIK) because they do not all have a common ground (apart from <em>object</em> before someone says! :P).</p> <p>So, my current thoughts are to just grit my teeth and do a big <em>switch</em> statement and throw an <em>ArgumentException</em> on failure.</p> <hr /> <p><strong>EDIT 1:</strong></p> <p>Just to clarify:</p> <p>The code definition should be like this:</p> <pre><code>public class MyClass&lt;GenericType&gt; .... </code></pre> <p>And instantiation:</p> <pre><code>MyClass&lt;bool&gt; = new MyClass&lt;bool&gt;(); // Legal MyClass&lt;string&gt; = new MyClass&lt;string&gt;(); // Legal MyClass&lt;DataSet&gt; = new MyClass&lt;DataSet&gt;(); // Illegal MyClass&lt;RobsFunkyHat&gt; = new MyClass&lt;RobsFunkyHat&gt;(); // Illegal (but looks awesome!) </code></pre> <hr /> <p><strong>EDIT 2</strong></p> <p>@Jon Limjap - Good point, and something I was already considering. I'm sure there is a generic method that can be used to determine if the type is of a value or reference type.</p> <p>This could be useful in instantly removing a lot of the objects I don't want to deal with (but then you need to worry about the structs that are used such as <em>Size</em> ). Interesting problem no? :)</p> <p>Here it is:</p> <pre><code>where T: struct </code></pre> <p>Taken from <a href="http://msdn.microsoft.com/en-us/library/d5x73970.aspx" rel="nofollow noreferrer">MSDN</a>.</p> <hr /> <p>I'm curious. Could this be done in .NET 3.x using extension methods? Create an interface, and implement the interface in the extension methods (which would probably be cleaner than a bit fat switch). Plus if you then need to later extend to any lightweight custom types, they can also implement the same interface, with no changes required to the base code.</p> <p>What do you guys think?</p> <p>The sad news is I am working in Framework 2!! :D</p> <hr /> <p><strong>EDIT 3</strong></p> <p>This was so simple following on from <a href="https://stackoverflow.com/questions/8941/generic-type-checking#8956">Jon Limjaps Pointer</a>.. So simple I almost want to cry, but it's great because the code works like a charm!</p> <p>So here is what I did (you'll laugh!):</p> <h2>Code added to the generic class</h2> <pre><code>bool TypeValid() { // Get the TypeCode from the Primitive Type TypeCode code = Type.GetTypeCode(typeof(PrimitiveDataType)); // All of the TypeCode Enumeration refer Primitive Types // with the exception of Object and Empty (Null). // Since I am willing to allow Null Types (at this time) // all we need to check for is Object! switch (code) { case TypeCode.Object: return false; default: return true; } } </code></pre> <p>Then a little utility method to check the type and throw an exception,</p> <pre><code>private void EnforcePrimitiveType() { if (!TypeValid()) throw new InvalidOperationException( &quot;Unable to Instantiate SimpleMetadata based on the Generic Type of '&quot; + typeof(PrimitiveDataType).Name + &quot;' - this Class is Designed to Work with Primitive Data Types Only.&quot;); } </code></pre> <p>All that then needs to be done is to call <em>EnforcePrimitiveType()</em> in the classes constructors. Job done! :-)</p> <p>The only downside, it only throws an exception at runtime (obviously) rather than design time. But that's no big deal and could be picked up with utilities like <a href="http://en.wikipedia.org/wiki/FxCop" rel="nofollow noreferrer">FxCop</a> (which we don't use at work).</p> <p>Special thanks to Jon Limjap on this one!</p>
<pre><code>public class Class1&lt;GenericType&gt; where GenericType : struct { } </code></pre> <p>This one seemed to do the job..</p>
<p>In dotnet 6, I encountered this error when using <code>struct</code>:</p> <blockquote> <p>The type 'string' must be a non-nullable value type in order to use it as parameter 'T'</p> </blockquote> <p>So I use IConvertible instead</p> <pre><code>var intClass = new PrimitivesOnly&lt;int&gt;(); var doubleClass = new PrimitivesOnly&lt;double&gt;(); var boolClass = new PrimitivesOnly&lt;bool&gt;(); var stringClass = new PrimitivesOnly&lt;string&gt;(); var myAwesomeClass = new PrimitivesOnly&lt;MyAwesomeClass&gt;(); // illegal // The line below encounter issue when using &quot;string&quot; type // class PrimitivesOnly&lt;T&gt; where T : struct class PrimitivesOnly&lt;T&gt; where T : IConvertible { } class MyAwesomeClass { } </code></pre>
3,039
<p>Is there someway to have a part of the page that renders like a little sub-page, like components?</p> <p>For example, if I have a shopping cart on all my pages?</p>
<p>If you want it to render another controllers action, as a component, to get encapsulation, you use.</p> <p>Html.RenderAction</p> <p>uses routedata to get you there, has its own viewdata and kind of mini life cycle</p>
<p>You are looking for <a href="http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a" rel="nofollow noreferrer">subcontrollers</a>. This implementation is the best way to do what you are talking about.</p> <p>Edit: I just posted about this here: <a href="http://mhinze.com/subcontrollers-in-aspnet-mvc/" rel="nofollow noreferrer">http://mhinze.com/subcontrollers-in-aspnet-mvc/</a></p>
9,961
<p>Does anyone have any experience with how well web services build with Microsoft's WCF will scale to a large number of users?</p> <p>The level I'm thinking of is in the region of 1000+ client users connecting to a collection of WCF services providing the business logic for our application, and these talking to a database - similar to a traditional 3-tier architecture. </p> <p>Are there any particular gotchas that have slowed down performance, or any design lessons learnt that have enabled this level of scalability?</p>
<p>To ensure your WCF application can scale to the desired level I think you might need to tweak your thinking about the stats your services have to meet.</p> <p>You mention servicing "1000+ client users" but to gauge if your services can perform at that level you'll also need to have some estimated usage figures, which will help you calculate some simpler stats such as the number of requests per second your app needs to handle.</p> <p>Having just finished working on a WCF project we managed to get 400 requests per second on our test hardware, which combined with our expected usage pattern of each user making 300 requests a day indicated we could handle an average of 100,000 users a day (assuming a flat usage graph across the day). </p> <p>In addition, since it's fairly common to make the WCF service code stateless, it's pretty easy to scale out the actual WCF code by adding additional boxes, which means the overall performance of your system is much more likely to be limited by your business logic and persistence layer than it is by WCF.</p>
<p><a href="http://weblogs.asp.net/paolopia/archive/2008/03/23/wcf-configuration-default-limits-concurrency-and-scalability.aspx" rel="nofollow noreferrer">WCF configuration default limits, concurrency and scalability</a></p>
6,545
<p>Building a 3-D printer is obviously a huge undertaking.</p> <p>Does anyone know of any reasonably cheap guides to build my own 3-D printer?</p>
<p>Building a 3-D printer is actually very easy, assuming that you are electronically and mechanically competent, and there are a whole bunch of websites devoted to doing just that. The principal of which would be the <a href="http://reprap.org/wiki/Main_Page" rel="noreferrer">RepRapWiki</a>.</p> <p>There are a number of different designs, mostly from a few basic designs:</p> <ul> <li>Cartesian</li> <li>Delta</li> <li>Polar</li> <li>Scara</li> </ul> <p>Take a look at <a href="https://all3dp.com/know-your-fdm-3d-printers-cartesian-delta-polar-and-scara/" rel="noreferrer">3D Printers Explained: Delta, Cartesian, Polar, Scara</a>, for further details.</p> <p>I, personally, would suggest looking at the following 3D printer designs (although there are many more out there):</p> <ul> <li><a href="http://reprap.org/wiki/Prusa_i3" rel="noreferrer">Prusa i3</a> (arguably the most common/popular), or its derivative the <a href="http://reprap.org/wiki/P3Steel" rel="noreferrer">P3Steel</a></li> <li><a href="http://reprap.org/wiki/Category:Wilson_II" rel="noreferrer">Wilson II</a></li> <li><a href="http://reprap.org/wiki/Kossel" rel="noreferrer">Kossel</a></li> </ul> <p>On the web, i.e. eBay/Amazon, there are plenty of ready assembled versions, DIY kits, or you can source all of the individual parts yourself. I seriously recommend reading this question <a href="https://3dprinting.stackexchange.com/questions/409/what-are-the-pros-and-cons-of-collecting-parts-yourself-versus-getting-a-diy-ki">What are the pros and cons of collecting parts yourself, versus getting a DIY kit and then modifying it?</a></p> <p>I would strongly suggest that you do a <em>lot</em> of googling, and read around the subject for a couple of weeks: </p> <ul> <li>Reading other peoples blogs;</li> <li>Watching construction videos on YouTube to get a better understanding, and;</li> <li>Going through the issues that other people have experienced whilst building there own printers</li> </ul> <p>Doing this will help you glean a greater understanding of what is required, and what to expect when building yours - as well as getting an understanding of the individual parts required and how they all fit together.</p> <p>Spending a fair bit of time on this site, SE 3D Printing, and slowly going through the questions and answers is also strongly recommended.</p> <p>Building your own printer is, ultimately, more rewarding that purchasing a ready built one. This is because, due to its nascent nature of 3D printing, the printer that you purchase <em>will</em>, most likely, go wrong, and you will need to fix it. If you have built it yourself then you <em>should</em> be able to easily understand what is wrong, and then be capable of repairing it yourself. It is somewhat similar to the situation when the automobile first became popular, back in the 20's/30's (?) - the driver was, usually, also a mechanically competent engineer (unless they were filthy rich and were able to afford to pay a dedicated mechanic to accompany them - which was also the case, in those days). </p>
<p>If you just want to build your own, get a kit. There are several out there. Most kits take from 1-5 days to complete depending on the kit.</p> <p>If you want to design your own is quite a different story. The effort is totally dependent on how much you want to do yourself. My guess is the statement that you don't know the amount of effort indicates that you are probably not ready to design your own.</p>
638
<p>While printing a <a href="https://www.thingiverse.com/thing:3932302" rel="nofollow noreferrer">paint rack from thingiverse</a> I keep getting jams. Other prints (shorter) work fine. Can anyone give me a clue?</p> <p>Here's a <a href="https://photos.app.goo.gl/PQuJwqNdYWSMTiwm6" rel="nofollow noreferrer">video of the printer</a></p> <p>I thought it was heat creep so I increased the speed and decreased the hot end temperature. It generally prints for several hours then jams.</p>
<p>When I started printing ABS with my Prusa i3 MK3 MMU2+ printer, I started experiencing jams on some longer prints, which was heat creap, possibly combined with old filament.</p> <p>I improved the cooling by filling the gap between the sides of the heat sink and the plastic extruder body. I think I stuffed it with some soft foam rubber, but anything that can handle the (what should be fairly cool) temperature should work.</p> <p>My hypothesis is that with gap allowed too much of the air to pass without engaging the heat sink, compromising the cooling.</p> <p>With that change, I haven't had heat-creap jams.</p> <p>You aren't printing ABS, but the temperature is high, and PLA softens as a low temperature. IMO, it would still be worth making the change.</p> <p>It is the gap on the front and rear sides that I blocked. The heatsink fins are fully open for air flow.</p> <p>Some people here have changed out the Noctua fan for one that is noisier and pushes more air, which should also work. I appreciate the quiet fan, so I tried to get more work out of the fan I had.</p>
<p>The maker geeks formulation of PLA requires much hotter temperatures. The plastic was not melted enough for good flow.</p>
1,804
<p>I am pretty sure that sanding makes a lot of microplastics, so it would be nice to collect the dust, and melt it to got a blob of plastic again instead of millions of tiny particles. What is the best way for collecting it, do you use any dust extractor, or are there different techniques like sanding wet surfaces and filtering it from water?</p>
<p>I decided to collect the dust and treat both PLA and ABS with chemicals to completely break them down. That solves the issue and I won't rely on false hopes that somehow it does not end up in the environment.</p>
<p>As an environmental thing, micro plastics are an urgent problem for ocean life, it’s getting into the entire food chain. With that in mind dumping it down the drain would be the worst, city filtration systems can’t get the tiny bits of plastic before it drains into the ocean. Sanding outside is kind of bad. I sand stuff over a lined waste basket outside, which maybe catches 75% of the dust. Inside (or outside) with a vacuum running would be good, I think best would be a vacuum with disposable bags. Yes it is still micro plastics, but it ends up at the dump, where the soil is already poisoned, and hopefully nowhere near the ocean/waterways, and likely will stay there while it breaks down. PLA takes ~80 years, but ABS takes 1000 years.</p> <p>The idea of collecting the dust and fusing it sounds like it would be too much hassle to be feasible long term, it’s good, sustainable habits over years that add up.</p> <p>As a side note, card scraping is a nice way to smooth 3D prints, that doesn’t make fine dust.</p>
1,974
<p>I've been successful with writing my own SQL access code with a combination of stored procedures and parameterized queries and a little wrapper library I've written to minimize the ADO.NET grunge. This has all worked very well for me in the past and I've been pretty productive with it. </p> <p>I'm heading into a new project--should I put my old school stuff behind me and dig into an ORM-based solution? (I know there are vast high-concepts differences between NHibernate and EF--I don't want to get into that here. For the sake of argument, let's even lump LINQ with the old-school alternatives.) I'm looking for advice on the real-world application of ORM type stuff against what I know (and know pretty well). </p> <p>Old-school ADO.NET code or ORM? I'm sure there is a curve--does the curve have an ROI that makes things worthwhile? I'm anxious and willing to learn, but do have a deadline.</p>
<p>I find that LINQ to SQL is much, much faster when I'm prototyping code. It just blows away any other method when I need something now.</p> <p>But there is a cost. Compared to hand-rolled stored procs, LINQ is slow. Especially if you aren't very careful as seemingly minor changes can suddenly make a single turn into 1+N queries.</p> <p>My recommendation. Use LINQ to SQL at first, then swtich to procs if you aren't getting the performance you need.</p>
<p>There was a great discussion on this topic at DevTeach in Montreal. If you go to this URL: <a href="http://www.dotnetrocks.com/default.aspx?showNum=240" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=240</a> you will be able to hear two experts in the field (Ted Neward and Oren Eini) discuss the pros and cons of each approach. Probably the best answer you will find on a subject that has no real definite answer. </p>
8,474
<p>My good friend, Wikipedia, <a href="http://en.wikipedia.org/wiki/Language_binding" rel="noreferrer">didn't give me a very good response</a> to that question. So:</p> <ul> <li>What are language bindings?</li> <li>How do they work?</li> </ul> <p>Specifically accessing functions from code written in language X of a library written in language Y.</p>
<p>Let's say you create a C library to post stuff to stackoverflow. Now you want to be able to use the same library from Python. In this case, you will write Python bindings for your library.</p> <p>Also see SWIG: <a href="http://www.swig.org" rel="noreferrer">http://www.swig.org</a></p>
<p>In Flex (Actionscript 3). <a href="http://livedocs.adobe.com/flex/1/flex_builder_en/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Using_Flex_Builder&amp;file=brady712.htm" rel="nofollow noreferrer">Source</a></p> <p>A data binding copies the value of a property in one object to a property in another object. You can bind the properties of following objects: Flex components, Flex data models, and Flex data services.</p> <p>The object property that provides the data is known as the source property. The object property that receives the data is known as the destination property.</p> <p>The following example binds the text property of a TextInput component (the source property) to the text property of a Label component (the destination property) so that text entered in the TextInput component is displayed by the Label component:</p> <pre><code>&lt;mx:TextInput id="LNameInput"&gt;&lt;/mx:TextInput&gt; ... &lt;mx:Label text="{LNameInput.text}"&gt;&lt;/mx:Label&gt; </code></pre> <hr> <p>Data binding is usually a simple way to bind a model to user interface components. For example, you have a class with a FirstName property. In flex you could easily bind that property to a textbox by setting the value of the textbox to {Object.FirstName}. Then, every time that FirstName property changes, the textbox will be updated without requiring you to write any code to monitor that property for changes.</p> <p>Hope that helps.</p> <p>Matt</p>
4,545
<p>While it would be very convenient to use inline functions at some situations,</p> <p>Are there any drawbacks with inline functions?</p> <p><strong>Conclusion</strong>:</p> <p>Apparently, There is nothing wrong with using inline functions.</p> <p>But it is worth noting the following points!</p> <ul> <li><p>Overuse of inlining can actually make programs slower. Depending on a function's size, inlining it can cause the code size to increase or decrease. Inlining a very small accessor function will usually decrease code size while inlining a very large function can dramatically increase code size. On modern processors smaller code usually runs faster due to better use of the instruction cache. <a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Inline_Functions" rel="noreferrer">- Google Guidelines</a></p></li> <li><p>The speed benefits of inline functions tend to diminish as the function grows in size. At some point the overhead of the function call becomes small compared to the execution of the function body, and the benefit is lost <a href="http://www-rocq.inria.fr/who/Marc.Thiriet/Langages/tic0324.html" rel="noreferrer">- Source</a></p></li> <li><p>There are few situations where an inline function may not work:</p> <ul> <li>For a function returning values; if a return statement exists.</li> <li>For a function not returning any values; if a loop, switch or goto statement exists. </li> <li>If a function is recursive. <a href="http://www-rocq.inria.fr/who/Marc.Thiriet/Langages/tic0324.html" rel="noreferrer">-Source</a></li> </ul></li> <li><p>The <code>__inline</code> keyword causes a function to be inlined only if you specify the optimize option. If optimize is specified, whether or not <code>__inline</code> is honored depends on the setting of the inline optimizer option. By default, the inline option is in effect whenever the optimizer is run. If you specify optimize , you must also specify the noinline option if you want the <code>__inline</code> keyword to be ignored. <a href="http://support.sas.com/documentation/onlinedoc/sasc/doc750/html/clug/zcoptinl.htm" rel="noreferrer">-Source</a></p></li> </ul>
<p>It worth pointing out that the inline keyword is actually just a hint to the compiler. The compiler may ignore the inline and simply generate code for the function someplace.</p> <p>The main drawback to inline functions is that it can <strong>increase the size of your executable</strong> (depending on the number of instantiations). This can be a problem on some platforms (eg. embedded systems), especially if the function itself is recursive.</p> <p>I'd also recommend making inline'd functions <strong>very small</strong> - The speed benefits of inline functions tend to diminish as the function grows in size. At some point the overhead of the function call becomes small compared to the execution of the function body, and the benefit is lost.</p>
<ol> <li><p>As other people said that inline function can create a problem if the the code is large.As each instruction is stored in a specific memory location ,so overloading of inline function make a code to take more time to get exicuted.</p></li> <li><p>there are few other situations where inline may not work</p> <ol> <li>does not work in case of recursive function.</li> <li>It may also not work with static variable.</li> <li>it also not work in case there is use of a loop,switch etc.or we can say that with multiple statements.</li> <li>And the function main cannot work as inline function.</li> </ol></li> </ol>
8,588
<p>I would like to do some integration testing of a web service from within NUnit or MBUnit. I haven't delved into this too deeply yet, but I am pretty sure I will need to spin up WebDev.WebServer.exe within the "unit test" to do this. (I know it's not really a unit test).</p> <p>Yes, I can test the underlying objects the web service uses on their own (which I am), but what I am interested in testing in this cases is that the proxies are all working and handled as expected, etc. </p> <p>Any advice?</p>
<p>I found <a href="http://haacked.com/archive/2006/12/12/using_webserver.webdev_for_unit_tests.aspx" rel="nofollow noreferrer">this post</a> and <a href="http://www.hanselman.com/blog/NUnitUnitTestingOfASPNETPagesBaseClassesControlsAndOtherWidgetryUsingCassiniASPNETWebMatrixVisualStudioWebDeveloper.aspx" rel="nofollow noreferrer">this one</a> which have some solutions on how to start up WebDev.WebServer.exe from within a unit test. Looks like I'll need to do something along these lines.</p> <p>Until I get that going, I found that what works is to simply run the web service project within VS, let the WebDev server start up that way, and then run the unit tests. Not ideal, but it's OK for now.</p>
<p>Not sure what you're asking. If you're looking to do this without some sort of webserver in between your test and the service, you're going to be disappointed.</p> <p>If that's not what you're asking... maybe some clarification?</p>
4,124
<p>So I have a function that looks something like this:</p> <pre><code>float function(){ float x = SomeValue; return x / SomeOtherValue; } </code></pre> <p>At some point, this function overflows and returns a really large negative value. To try and track down exactly where this was happening, I added a cout statement so that the function looked like this:</p> <pre><code>float function(){ float x = SomeValue; cout &lt;&lt; x; return x / SomeOtherValue; } </code></pre> <p>and it worked! Of course, I solved the problem altogether by using a double. But I'm curious as to why the function worked properly when I couted it. Is this typical, or could there be a bug somewhere else that I'm missing?</p> <p>(If it's any help, the value stored in the float is just an integer value, and not a particularly big one. I just put it in a float to avoid casting.)</p>
<p>Welcome to the wonderful world of floating point. The answer you get will likely depend on the floating point model you compiled the code with. </p> <p>This happens because of the difference between the IEEE spec and the hardware the code is running on. Your CPU likely has 80 bit floating point registers that get use to hold the 32-bit float value. This means that there is far more precision while the value stays in a register than when it is forced to a memory address (also known as 'homing' the register).</p> <p>When you passed the value to cout the compiler had to write the floating point to memory, and this results in a lost of precision and interesting behaviour WRT overflow cases.</p> <p>See the MSDN documentation on VC++ <a href="http://msdn.microsoft.com/en-us/library/e7s85ffb(VS.80).aspx" rel="noreferrer">floating point switches</a>. You could try compiling with /fp:strict and seeing what happens.</p>
<p>I dont think the cout has any effect on the variable, the problem would have to be somewhere else.</p>
7,151