instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I came across this suggestion on the klipper github, <a href="https://www.facebook.com/groups/Hypercube.Evo/permalink/192106034761003/" rel="nofollow noreferrer">https://www.facebook.com/groups/Hypercube.Evo/permalink/192106034761003/</a>. In order to reduce the stretching in the bowden tube you can add fiberglass packaging tape lengthwise along the tube. This would decrease the elasticity while still allowing the plastic filament to run through it. Allowing you to reduce the retraction length and have better control over the amount of plastic being extruded.</p> <p>Is there any reasons that this would not work or actually decrease the performance of the bowden tube? </p>
<p>The question seems to be built on a false premise, namely that the major extrude/retract errors in a Bowden design come from tube stretch. The PTFE tube is <em>not</em> significantly elastic, actually it is reasonably stiff so there is minimal scope for improvement here.</p> <p>A longer tube <em>will</em> contribute to degraded precision, but slack in the filament/tube gap is roughly as significant as stretch (and filament compression). Constraining the tube path may help marginally (but there is no need to 'bond' the tube). There is not much you can to to reduce the gap between filament and tube, but this will dominate the error for a long tube.</p> <p>The most obvious weak point is the clip used to secure the tube at each end. I saw a review of a recent Prusa design where high quality clips were called out as making a big improvement to securing each end of the tube.</p>
<p>The <a href="http://La%20solution%20propos%C3%A9e%20dans%20la%20revendication%201%20de%20la%20pr%C3%A9sente%20demande%20ne%20peut%20%C3%AAtre%20consid%C3%A9r%C3%A9e%20comme%20impliquant%20une%20activit%C3%A9%20inventive%20pour%20les%20motifs%20suivants:%2050%20Ohm%20repr%C3%A9sente%20la%20valeur%20ordinaire%20de%20l&#39;imp%C3%A9dance%20des%20dispositifs%20de%20mesure,%20voir%20D3%20[alin%C3%A9a%2083].%20L&#39;homme%20du%20m%C3%A9tier%20utiliserait%20cette%20valeur%20sans%20faire%20preuve%20d&#39;esprit%20inventif." rel="nofollow noreferrer">Young modulus</a> of <a href="https://www.designerdata.nl/plastics/thermo+plastics/PTFE?cookie=YES" rel="nofollow noreferrer">PTFE</a> is about 500&nbsp;MPa and the surface of a PTFE tube for 1.75&nbsp;mm filament is about 9.4&nbsp;mm<sup>2</sup>.</p> <p>The Young modulus of <a href="https://aip.scitation.org/doi/pdf/10.1063/1.4918424" rel="nofollow noreferrer">PLA</a> is variable, between 350 and 2800&nbsp;MPa, let's say 2000&nbsp;MPa. The filament surface is 2.4&nbsp;mm<sup>2</sup>.</p> <p>The ratio is about 1 because the surface ratio is 4x and the Young's modulus ratio 1/4x. As result, the stretching of PTFE is about similar to the compression of PLA inside it (of course they sum, since they go in opposite directions). PLA is very stiff: other materials will compress much more and make the stretching of PTFE less relevant.</p> <p>However the filament is thinner than the tube, so it will curl a bit, which increases its contraction much more! It is likely that even for PLA the stretching of the PTFE is much less relevant than the compression of the filament.</p> <p>Anyway, <a href="https://www.azom.com/properties.aspx?ArticleID=764" rel="nofollow noreferrer">fiberglass</a> has a Young's modulus of about 80&nbsp;GPa (150 times PTFE), but its thickness is what? 0.1&nbsp;mm? That bring a surface of 2&nbsp;mm<sup>2</sup> at most (and I'm very optimistic, more likely much less than 1&nbsp;mm<sup>2</sup>). Fiberglass helps to strengthen PTFE by a factor of surely less than 30, more likely 10 or less (will the glue hold or slide?).</p> <p>As result, PTFE, from a contribution to the overall stretching/compression of 50&nbsp;% (in fact, much less due to curling), will be reduced to about 5&nbsp;%. It is good, but this is an optimistic value.</p>
997
<p>I started a project a long time ago and created a <strong>Data Access Layer</strong> project in my solution but have never developed anything in it. What is the purpose of a data access layer? Are there any good sources that I could learn more about the Data Access Layer?</p>
<p>In two words: <a href="http://en.wikipedia.org/wiki/Loose_coupling" rel="noreferrer">Loose Coupling</a></p> <p>To keep the code you use to pull data from your data store (database, flat files, web services, whatever) separate from business logic and presentation code. This way, if you have to change data stores, you don't end up rewriting the whole thing.</p> <p>These days, various ORM frameworks are kind of blending the DAL with other layers. This typically makes development easier, but changing data stores can be painful. To be fair, changing data stores like that is pretty uncommon.</p>
<p>I recommend you read up here: <a href="http://msdn.microsoft.com/en-us/practices/default.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/practices/default.aspx</a> Using a DAL will help you isolate your data access from your presentation and business logic. I use it a lot so that I can easily swap out (through reflection and dynamically loading assemblies) data providers. </p> <p>Read up, lots of good info there.</p> <p>Also, look into the <a href="http://msdn.microsoft.com/en-us/library/cc511547.aspx" rel="nofollow noreferrer">Data Access Block</a> if you are planning on using .NET. It can be a big help.</p>
8,471
<p>In my application I have a window which I popup with small messages on it (think similar to tooltip). This window uses the layered attributes to draw alpha backgrounds etc.</p> <p>If I have several of these windows open at once, and I click one with my mouse, when they disappear they cause my application to lose focus (it switches focus to the app behind the current one).</p> <p>How do I stop any interaction in my window?</p>
<p>Multithreaded programming is hard to grasp in the beginning (and veterans still fail sometimes) and BackgroundWorker makes it a bit easier to use. I like the fact that BackgroundWorker has functionality which is easy to implement but even easier to wrongly implement in a subtle way, like cancellation. I use it if I have and need a progress update, so I can display a meaningful progress bar. </p> <p>If not, I use a Thread (or borrow from the ThreadPool), because I don't need all the functionality of BackgroundWorker and am proficient enough with threads to start a Thread and wait for it to stop.</p> <p>As for delegates for non-related tasks, I use those of the Thread classes, like plain <code>void ThreadStart()</code>, or I create my own.</p>
<p>My biggest issue with the background worker class is that there really is no way to know when the worker has finished due to cancellation. The BackgroundWorker does not expose the thread it uses so you can't use the standard techniques for synchronizing thread termination (join, etc.). You also can't just wait in a loop on the UI thread for it to end because the RunWorkerCompleted event will never end up firing. The hack I've always had to use is to simply set a flag and then start a timer that will continue checking for the background worker to end. But it's very messy and complicates the business logic.</p> <p>So it is great as long as you don't need to support deterministic cancellation.</p>
7,241
<p>I am trying to print an item with a rectangular grid (using PLA on Ultimaker 2+):</p> <p><a href="https://i.stack.imgur.com/RHcqX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHcqX.png" alt="item with a grid"></a></p> <p>Holes are 4x4 mm, distance between holes (wall thickness): 1mm. I am printing with 0.4 mm nozzle.</p> <p>Unfortunately, Ultimaker Cura generates G-code which prints each rectangle on its own and in a quite a bad way:</p> <p><a href="https://i.stack.imgur.com/I7nE6.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I7nE6.gif" alt="print preview"></a></p> <p>The printer head tries to draw a rectangle, then moves in the direction opposite to a last laid line, which with not perfect adhesion of single line messes up the print pretty badly: it often picks up last rectangle side and drags it.</p> <p>Any way to change the way Ultimaker Cura approaches to lay out the grid? I would imagine that long lines that are connected to other lines would adhere to bed much better than individual squares, but I don't see any options that would allow to alter it.</p>
<p>Slicers never create a grid by crossing the already printed lines - they print perimeters and thicken them into a shell. So if the picture that is to be printed is a #, it does not lay down first the || and then the = crossing over it, it lays down an inner square and then builds the rest to get to the shape. This operation rule is held for <em>shells</em>, but not for <em>infill</em> patterns.</p> <p>As you describe the printer picking up the printed, you have adhesion problems and your first layer might be not level or too thick. </p> <p>You might also want to enable "print thin walls" and use 2 or 3 perimeters.</p>
<ol> <li>Use the latest stable Cura 3.6.0</li> <li>Ensure that the setting "Wall Line Count" > 1, recommended value is 3-4</li> <li>Uncheck the setting flag "Outer Before Inner Walls"</li> </ol>
1,167
<p>I have a byte array in memory, read from a file. I would like to split the byte array at a certain point (index) without having to just create a new byte array and copy each byte at a time, increasing the in memory foot print of the operation. What I would like is something like this:</p> <pre><code>byte[] largeBytes = [1,2,3,4,5,6,7,8,9]; byte[] smallPortion; smallPortion = split(largeBytes, 3); </code></pre> <p><code>smallPortion</code> would equal 1,2,3,4<br> <code>largeBytes</code> would equal 5,6,7,8,9</p>
<p>This is how I would do that:</p> <pre><code>using System; using System.Collections; using System.Collections.Generic; class ArrayView&lt;T&gt; : IEnumerable&lt;T&gt; { private readonly T[] array; private readonly int offset, count; public ArrayView(T[] array, int offset, int count) { this.array = array; this.offset = offset; this.count = count; } public int Length { get { return count; } } public T this[int index] { get { if (index &lt; 0 || index &gt;= this.count) throw new IndexOutOfRangeException(); else return this.array[offset + index]; } set { if (index &lt; 0 || index &gt;= this.count) throw new IndexOutOfRangeException(); else this.array[offset + index] = value; } } public IEnumerator&lt;T&gt; GetEnumerator() { for (int i = offset; i &lt; offset + count; i++) yield return array[i]; } IEnumerator IEnumerable.GetEnumerator() { IEnumerator&lt;T&gt; enumerator = this.GetEnumerator(); while (enumerator.MoveNext()) { yield return enumerator.Current; } } } class Program { static void Main(string[] args) { byte[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; ArrayView&lt;byte&gt; p1 = new ArrayView&lt;byte&gt;(arr, 0, 5); ArrayView&lt;byte&gt; p2 = new ArrayView&lt;byte&gt;(arr, 5, 5); Console.WriteLine("First array:"); foreach (byte b in p1) { Console.Write(b); } Console.Write("\n"); Console.WriteLine("Second array:"); foreach (byte b in p2) { Console.Write(b); } Console.ReadKey(); } } </code></pre>
<p>You can't. What you might want is keep a starting point and number of items; in essence, build iterators. If this is C++, you can just use <code>std::vector&lt;int&gt;</code> and use the built-in ones.</p> <p>In C#, I'd build a small iterator class that holds start index, count and implements <code>IEnumerable&lt;&gt;</code>.</p>
4,116
<p>I know in php you can embed variables inside variables, like:</p> <pre><code>&lt;? $var1 = "I\'m including {$var2} in this variable.."; ?&gt; </code></pre> <p>But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write:</p> <pre><code>&lt;?php $var1 = "I\'m including "; $var1 .= somefunc(); $var1 = " in this variable.."; ?&gt; </code></pre> <p>But what if I have a long variable for output, and I don't want to do this every time, or I want to use multiple functions:</p> <pre><code>&lt;?php $var1 = &lt;&lt;&lt;EOF &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;AAAHHHHH&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt; &lt;/head&gt; &lt;body&gt; There is &lt;b&gt;alot&lt;/b&gt; of text and html here... but I want some &lt;i&gt;functions&lt;/i&gt;! -somefunc() doesn't work -{somefunc()} doesn't work -$somefunc() and {$somefunc()} doesn't work of course because a function needs to be a string -more non-working: ${somefunc()} &lt;/body&gt; &lt;/html&gt; EOF; ?&gt; </code></pre> <p>Or I want dynamic changes in that load of code:</p> <pre><code>&lt;? function somefunc($stuff) { $output = "my bold text &lt;b&gt;{$stuff}&lt;/b&gt;."; return $output; } $var1 = &lt;&lt;&lt;EOF &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;AAAHHHHH&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt; &lt;/head&gt; &lt;body&gt; somefunc("is awesome!") somefunc("is actually not so awesome..") because somefunc("won\'t work due to my problem.") &lt;/body&gt; &lt;/html&gt; EOF; ?&gt; </code></pre> <p>Well?</p>
<p>Function calls within strings are supported since PHP5 by having a variable containing the name of the function to call:</p> <pre><code>&lt;? function somefunc($stuff) { $output = "&lt;b&gt;{$stuff}&lt;/b&gt;"; return $output; } $somefunc='somefunc'; echo "foo {$somefunc("bar")} baz"; ?&gt; </code></pre> <p>will output "<code>foo &lt;b&gt;bar&lt;/b&gt; baz</code>".</p> <p>I find it easier however (and this works in PHP4) to either just call the function outside of the string:</p> <pre><code>&lt;? echo "foo " . somefunc("bar") . " baz"; ?&gt; </code></pre> <p>or assign to a temporary variable:</p> <pre><code>&lt;? $bar = somefunc("bar"); echo "foo {$bar} baz"; ?&gt; </code></pre>
<p>Expanding a bit on what Jason W said:</p> <pre> I find it easier however (and this works in PHP4) to either just call the function outside of the string: &lt;? echo "foo " . somefunc("bar") . " baz"; ?&gt; </pre> <p>You can also just embed this function call directly in your html, like:</p> <pre>&lt;? function get_date() { $date = `date`; return $date; } function page_title() { $title = "Today's date is: ". get_date() ."!"; echo "$title"; } function page_body() { $body = "Hello"; $body = ", World!"; $body = "\n<br/>\n"; $body = "Today is: " . get_date() . "\n"; } ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;? page_title(); ?&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;? page_body(); ?&gt; &lt;/body&gt; &lt;/html&gt; </pre>
8,526
<p>I frequently find myself writing code like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; foreach (int i in list) { Console.Write("{0}\t", i.ToString()); } Console.WriteLine(); </code></pre> <p>Better would be something like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; Console.WriteLine("{0}\t", list); </code></pre> <p>I suspect there's some clever way of doing this, but I don't see it. Does anybody have a better solution than the first block? </p>
<p>Do this:</p> <pre><code>list.ForEach(i =&gt; Console.Write("{0}\t", i)); </code></pre> <hr> <p>EDIT: To others that have responded - he wants them all on the same line, with tabs between them. :)</p>
<pre><code>public static void WriteLine(this List&lt;int&gt; theList) { foreach (int i in list) { Console.Write("{0}\t", t.ToString()); } Console.WriteLine(); } </code></pre> <p>Then, later...</p> <pre><code>list.WriteLine(); </code></pre>
7,626
<p>What is Thermal Runaway Protection (TRP) and why should I enable it?</p> <p>How does one do so in Marlin?</p>
<h1>What is TRP and how does it work?</h1> <p>Thermal runaway protection is basically self-explaining; it is protection against the temperature getting out of control. Essentially, the firmware checks whether the measured output of the thermistor (<em>What is a thermistor? A thermistor is basically a temperature sensor; it is an electrical component (more specific: a resistor) that has a large reduction of its resistance when heated; it is frequently used for measurement and control as you can link the resistance to the temperature via a table or a curve</em>) is within an expected range for a certain target value within a certain time frame when heating the hotend or the heated bed.</p> <p>E.g. When you request the hotend or heated bed to a certain temperature, the heater elements are being scheduled/switched on to increase the temperature. If the temperature increase as a result of scheduling the hotend or heated bed are not met in time (settings in the firmware configuration), the printer will halt and heating of the heater elements will stop. The printer needs to be reset after such a failure.</p> <h2>What triggers TRP?</h2> <p>Common problems that trigger the thermal runaway protection are:</p> <ul> <li>a faulty thermistor,</li> <li>an incorrectly placed thermistor (e.g. not making good enough contact with the heater block), <ul> <li>including falling out</li> </ul></li> <li>a loose heater cartridge, <ul> <li>including falling out</li> </ul></li> <li>faulty connectors,</li> <li>faulty or partially broken wires,</li> <li>basically, anything that interrupts either heating or the measurement of the signal.</li> </ul> <h2>Why should TRP be active?</h2> <p>Thermal runaway protection is mainly meant to prevent fire hazards by stopping the heater cartridge when it might have fallen out of the heater block and is trying to set the whole surroundings on fire. </p> <p>To illustrate the point: This happens if Thermal Runaway Protection is disabled, and the <a href="https://www.thissmarthouse.net/dont-burn-your-house-down-3d-printing-a-cautionary-tale/" rel="nofollow noreferrer">associated story</a>. Luckily this one did not result in a loss of life and home, but it could have - and the owner was able to do some forensic examination on what caused the fire.</p> <p><a href="https://i.stack.imgur.com/eJput.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJput.png" alt="Anet A8 that has caught fire"></a></p> <h2>How to activate TRP in Marlin firmware?</h2> <p>Please make sure that you have the configuration lines in the Thermal Runaway Protection section (466-485) of your <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration.h" rel="nofollow noreferrer">Configuration.h</a> file uncommented <em>(no // in front of the lines starting with #define THERMAL_...)</em>.</p> <pre> //=========================================================================== //======================== Thermal Runaway Protection ======================= //=========================================================================== /** * Thermal Protection provides additional protection to your printer from damage * and fire. Marlin always includes safe min and max temperature ranges which * protect against a broken or disconnected thermistor wire. * * The issue: If a thermistor falls out, it will report the much lower * temperature of the air in the room, and the the firmware will keep * the heater on. * * If you get "Thermal Runaway" or "Heating failed" errors the * details can be tuned in Configuration_adv.h */ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed </pre> <p>Note that Marlin 2.x has an additional protection for the heating chamber:</p> <pre> #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber </pre> <p>This should generally be enough to enable TRP on your printer, fine tuning can be done by changing the time constant and the temperature increase in the file <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration_adv.h" rel="nofollow noreferrer">Configuration_adv.h</a> in the section:</p> <pre> //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== </pre> <p>However, it is advised to not change these values unless you are absolutely certain; e.g. if your heating cartridge is not powerful enough and you are getting printer halts. When getting false-positive printer halts according to the <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration_adv.h" rel="nofollow noreferrer">Marlin firmware</a> you could:</p> <pre>* If you get false positives for "Thermal Runaway", increase<br> * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD </pre> <h2>How to test if TRP is active on my printer?</h2> <p>To test if thermal runaway protection is enabled on your printer, you can disconnect the heater element of the hotend or the heated bed while printing a print or sending temperature commands to the printer over USB using a terminal to send commands directly to the printer. You can disconnect the heater element while the printer is cold (before start) and also when the heater element is heating up. No heating of the nozzle will take place, so after the period defined by the time constant set in the firmware, the printer will halt if thermal runaway protection is enabled. Power down the machine and reconnect the wires, it is not advised to put them back in on a running machine, as one might touch the open wires; when the printer halted, you should power down or reset the printer anyways. If the printer did not halt, power it down as quickly as possible - TRP is disabled.</p> <h2>Further Considerations</h2> <p>Besides activating thermal runaway protection, it is always a good idea to install a smoke detector and a fire extinguisher in the surroundings of the 3D printer: the smoke detector over it, the extinguisher within arms reach of the door leading to the room.</p>
<h2>What is Thermal Runaway?</h2> <p>Let's look at a <a href="https://www.youtube.com/watch?v=qVjWg2vuWzk" rel="nofollow noreferrer">Thermal Runaway Test (#2)</a> performed by one Chris Bate.</p> <p>In this video the experimenter drove the heating element non-stop until disaster. The Nichrome wire in the heating element melts at about 1,400 °C. Only once it melts, will the circuit will break and the current stop. The aluminum heating block however, melts at 660.3 °C; long before the nichrome melts.</p> <h2>Thermal Runaway Protection</h2> <p>Thermal runaway protection is a piece of code in the firmware of the printer that checks to make sure that once power is being applied to the heater, the thermistor's resistance is changing within a specified frame (time and amount). This is the basic form of a <a href="https://en.wikipedia.org/wiki/Control_loop" rel="nofollow noreferrer">control loop</a>.</p> <p>If the control system is implemented mechanically then it is called a <a href="https://en.wikipedia.org/wiki/Thermostat" rel="nofollow noreferrer">thermostat</a>, usually via a bimetal strip.</p>
1,248
<p>I have an XML document with a DTD, and would love to be able to access the XML model, something like this:</p> <pre><code>title = Thing.Items[0].Title </code></pre> <p>Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML?</p> <p>Thanks!</p>
<p>if you include the active_support gem (comes with rails) it adds the method from_xml to the Hash object. You can then call Hash.from_xml(xml_content) and it'll return a hash that you can use to access the data.</p> <p>I don't know of an easy way to map an xml to an object, but you could create a wrapper class that delegates the method calls to the underlying hash which holds the data.</p>
<p>You can use the ruby version of xml-simple.</p> <p>You shouldn't need to install the gem as I believe it's already installed with rails. <a href="http://xml-simple.rubyforge.org/" rel="nofollow noreferrer">http://xml-simple.rubyforge.org/</a></p>
4,796
<p>I'm trying to let an <code>&lt;input type="text"&gt;</code> (henceforth referred to as “textbox”) fill a parent container by settings its <code>width</code> to <code>100%</code>. This works until I give the textbox a padding. This is then added to the content width and the input field overflows. Notice that in Firefox this only happens when rendering the content as standards compliant. In quirks mode, another box model seems to apply.</p> <p>Here's a minimal code to reproduce the behaviour in all modern browsers.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#x { background: salmon; padding: 1em; } #y, input { background: red; padding: 0 20px; width: 100%; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="x"&gt; &lt;div id="y"&gt;x&lt;/div&gt; &lt;input type="text"/&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>My question: <strong>How do I get the textbox to fit the container?</strong></p> <p><em>Notice</em>: for the <code>&lt;div id="y"&gt;</code>, this is straightforward: simply set <code>width: auto</code>. However, if I try to do this for the textbox, the effect is different and the textbox takes its default row count as width (even if I set <code>display: block</code> for the textbox).</p> <p>EDIT: David's solution would of course work. However, I do not want to modify the HTML – I do especially not want to add dummy elements with no semantic functionality. This is a typical case of <a href="http://en.wiktionary.org/wiki/Citations:divitis" rel="nofollow noreferrer">divitis</a> that I want to avoid at all cost. This can only be a last-resort hack.</p>
<p>With CSS3 you can use the box-sizing property on your inputs to standardise their box models. Something like this would enable you to add padding and have 100% width:</p> <pre class="lang-css prettyprint-override"><code>input[type="text"] { -webkit-box-sizing: border-box; // Safari/Chrome, other WebKit -moz-box-sizing: border-box; // Firefox, other Gecko box-sizing: border-box; // Opera/IE 8+ } </code></pre> <p>Unfortunately this won't work for IE6/7 but the rest are fine (<a href="http://www.quirksmode.org/css/user-interface/" rel="noreferrer">Compatibility List</a>), so if you need to support these browsers your best bet would be Davids solution.</p> <p>If you'd like to read more check out <a href="http://css-tricks.com/box-sizing/" rel="noreferrer">this brilliant article by Chris Coyier</a>.</p> <p>Hope this helps!</p>
<p>i believe you can counter the overflow with a negative margin. ie</p> <pre><code>margin: -1em; </code></pre>
7,580
<p>Typical scenario. We use old-school XML Web Services <em><code>internally</code></em> for communicating between a server farm and several distributed <em>and</em> local clients. No third parties involved, only our applications used by ourselves and our customers.</p> <p>We're currently pondering moving from <code>XML</code> <code>WS</code> to a <code>WCF/object-based</code> model and have been experimenting with various approaches. One of them involves transferring the domain objects/aggregates directly over the wire, possibly invoking DataContract attributes on them.</p> <p>By using <code>IExtensibleDataObject</code> and a <code>DataContract</code> using the Order property on the <code>DataMembers</code>, we should be able to cope with simple property versioning issues (remember, we control all clients and can easily force-update them).</p> <p>I keep hearing that we should use dedicated, transfer-only Data Transfer Objects (<code>DTOs</code>) over the wire.</p> <p>Why? Is there still a reason to do so? We use the same domain model on the server side and client side, of course, prefilling collections, etc. only when deemed right and "necessary." Collection properties utilize the service locator principle and IoC to invoke either an <code>NHibernate-based</code> "service" to fetch data directly (on the server side), and a <code>WCF</code> "service" client on the client side to talk to the <code>WCF</code> server farm.</p> <p>So - why do we need to use <code>DTOs</code>?</p>
<p>In my experience DTOs are most useful for:</p> <ol> <li>Strictly defining what will be sent over the wire and having a type specifically devoted to that definition.</li> <li>Isolating the rest of your application, client and server, from future changes.</li> <li>Interoperability with non-.Net systems. DTOs certainly aren't a requirement, but they make it easier to design "safe" types.</li> </ol> <p>In your scenario these design features may not matter that much. I've used WCF with both strict DTOs and shared Domain Objects and in both scenarios it worked great. The only thing I noticed when sending Domain Objects over the wire was that I tended to send more data (and in unexpected ways) then I needed to. This was likely more due to my lack of experience with WCF than anything else; but it's something you should definitely be wary of should you choose to go that route. </p>
<p>Having worked with both approaches (shared domain objects and DTOs) I'd say the big problem with shared domain objects is when you don't control all clients, but from my past experiences I'd usually use DTOs unless it development speed were of the essence.</p> <p>If there's any chance that you won't always be in control of the clients then I'd definately recommend DTOs, because as soon as you share your domain objects with someone else's client application you start tying your internals to someone else's dev cycle.</p> <p>I've also found DTOs useful when working in a versioned service environment, which allowed us to radically change the internals of our app but still accept calls to the old versions of our service interfaces. </p> <p>Finally, if you have a lot of client applications it might also be beneficial to use DTOs as you're then protected with an easily versionable service.</p>
4,496
<p>Visual Studio 2005 doesn't provide an interface for creating relationships between tables in a SQL Server CE database (I'm using version 3.0) and you can't open a Compact Edition DB using Management Studio as far as I know. Any ideas?</p>
<p>Unfortunately there is currently no designer support (unlike for SQL Server 2005) for building relationships between tables in SQL Server CE. To build relationships you need to use SQL commands such as:</p> <pre><code>ALTER TABLE Orders ADD CONSTRAINT FK_Customer_Order FOREIGN KEY (CustomerId) REFERENCES Customers(CustomerId) </code></pre> <p>If you are doing CE development, i would recomend this FAQ:</p> <p><strong>EDIT</strong>: In Visual Studio 2008 this is now possible to do in the GUI by right-clicking on your table.</p>
<pre><code>create table employee ( empid int, empname varchar(40), designation varchar(30), hiredate datetime, Bsalary int, depno constraint emp_m foreign key references department(depno) ) </code></pre> <p>We should have an primary key to create foreign key or relationship between two or more table . </p>
6,898
<p>I am building an enclosure for an Ender 3 Pro printer, and am planning on the power supply and LCD unit being outside the enclosure. How important is it to move the printer controller (where the SD card is inserted) outside the enclosure? Would leaving it in place affect its longevity?</p> <p>Answers to the first round of comments/questions:</p> <ul> <li>I expect to be primarily printing in the 200C-270C range.</li> <li>I'm not worried about losing heat from opening the doors - I'll be putting the SD card in prior to initiating printing.</li> <li>I'm thinking the stepper motors are somewhat of a moot point, there's no way I could move them outside of the enclosure.</li> <li>My printer is all stock.</li> </ul>
<p>It depends on what kinds of prints you make, and especially what kind of materials you want to use.</p> <p>Certain materials (ABS especially, but also PETG to some degree) will print <em>much better</em> if the entire build area, which usually includes the printer chassis and controls, is enclosed to protect from drafts and allow a much higher ambient temperature.</p> <p>If you print often with these materials, and the control board is included in that enclosed area, you <em><strong>will</strong></em> significantly reduce the life of the electronic components, <a href="https://en.wikipedia.org/wiki/Capacitor_plague" rel="nofollow noreferrer">especially the capacitors on the board</a><sup>1</sup>.</p> <p>On the other hand, if you print mainly with PLA, which is not as susceptible to issues requiring an enclosure, and prints better with an ambient temperature closer to room temperature, you can put the electronic controls wherever you want.</p> <hr /> <p><sub>1 See especially this excerpt from the section on &quot;Premature Failure&quot;:</p> <blockquote> <p>Electrolytic capacitors that operate at a lower temperature can have a considerably longer lifespan. </sub></p> </blockquote>
<p>This guy placed the whole Ender in a 100C environment but he emphasises how important it is to leave the electronics cool:</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/79r5D9nCQfM?start=1216"></iframe> </div></div></p>
1,716
<p>Has anyone used Lucene.NET rather than using the full text search that comes with sql server?</p> <p>If so I would be interested on how you implemented it. </p> <p>Did you for example write a windows service that queried the database every hour then saved the results to the lucene.net index?</p>
<p>Yes, I've used it for exactly what you are describing. We had two services - one for read, and one for write, but only because we had multiple readers. I'm sure we could have done it with just one service (the writer) and embedded the reader in the web app and services.</p> <p>I've used lucene.net as a general database indexer, so what I got back was basically DB id's (to indexed email messages), and I've also use it to get back enough info to populate search results or such without touching the database. It's worked great in both cases, tho the SQL can get a little slow, as you pretty much have to get an ID, select an ID etc. We got around this by making a temp table (with just the ID row in it) and bulk-inserting from a file (which was the output from lucene) then joining to the message table. Was a lot quicker.</p> <p>Lucene isn't perfect, and you do have to think a little outside the relational database box, because it TOTALLY isn't one, but it's very very good at what it does. Worth a look, and, I'm told, doesn't have the "oops, sorry, you need to rebuild your index again" problems that MS SQL's FTI does.</p> <p>BTW, we were dealing with 20-50million emails (and around 1 million unique attachments), totaling about 20GB of lucene index I think, and 250+GB of SQL database + attachments.</p> <p>Performance was fantastic, to say the least - just make sure you think about, and tweak, your merge factors (when it merges index segments). There is no issue in having more than one segment, but there can be a BIG problem if you try to merge two segments which have 1mil items in each, and you have a watcher thread which kills the process if it takes too long..... (yes, that kicked our arse for a while). So keep the max number of documents per thinggie LOW (ie, dont set it to maxint like we did!)</p> <p>EDIT Corey Trager documented how to use Lucene.NET in BugTracker.NET <a href="http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx" rel="noreferrer">here</a>. </p>
<p>I used Lucene.NET along with MySQL. My approach was to store primary key of db record in Lucene document along with indexed text. In pseudo code it looks like:</p> <ul> <li><p>Store record: </p> <p>insert text, other data to the table<br> get latest inserted ID<br> create lucene document<br> put (ID, text) into lucene document update lucene index</p></li> <li><p>Querying<br> search lucene index<br> for each lucene doc in result set load data from DB by stored record's ID</p></li> </ul> <p>Just to note, I switched from Lucene to <a href="http://www.sphinxsearch.com" rel="nofollow noreferrer">Sphinx</a> due to it superb performance</p>
5,772
<p>Most of my experience is on the MSFT stack, but I am now working on a side project, helping someone with a personal site with cheap hosting that is built on the LAMP stack. My options for installing extras are limited, so I'm wondering about how to write my data access code without embedding raw queries in the .php files.</p> <p>I like to keep things simple, even with .NET. I generally write stored procedures for everything, and I have a helper class that wraps all calls to execute procedures and return data sets. I'm not looking for a full-blown ORM, but it might be the way to go and others who view this question might be looking for that. </p> <p>Remember that I'm on a $7/month GoDaddy account, so I'm limited to what's already installed in their basic package.</p> <p><strong>Edit:</strong> Thanks rix0rr, Alan, Anders, dragon, I will check all of those out. I edited the question to be more open to ORM solutions, since they are so popular.</p>
<p>Take a look at the <a href="http://framework.zend.com" rel="nofollow noreferrer">Zend Framework</a>, specifically Zend_Db. It has a Database Abstraction layer that doesn't require anything other than the MySQLi extension to be installed and isn't a full-blown ORM model.</p>
<p>I would try a framework. <em>Zend Framework</em> has been cited. <a href="http://www.symfony-project.org/" rel="nofollow noreferrer">Symfony</a> seems interesting. It's based on ideas from <em>Ruby on Rails</em>.</p>
4,226
<p>Does anyone know if there is a c# Console app, similar to the Python or Ruby console? I know the whole "Compiled versus Interpreted" difference, but with C#'s reflection power I think it could be done.</p> <p><strong>UPDATE</strong> Well, it only took about 200 lines, but I wrote a simple one...It works a lot like osql. You enter commands and then run them with go.</p> <p><a href="http://www.gfilter.net/junk/sharpconsole.jpg">SharpConsole http://www.gfilter.net/junk/sharpconsole.jpg</a></p> <p>If anyone wants it, let me know.</p>
<p>Given your mention of "C#'s reflection power", I am unsure whether you're looking for an interactive C# console for small code snippets of your own (à la Ruby's <code>irb</code>), or a means of interacting with an existing, compiled application currently running as a process.</p> <p>In the former case:</p> <ul> <li><strong>Windows PowerShell</strong> might be your friend</li> <li>Another candidate would be the <a href="http://michael.susens-schurter.com/blog/2006/12/20/cssh-c-shell/" rel="noreferrer"><strong>C# shell</strong></a></li> <li>Finally, <a href="http://www.codeproject.com/KB/cs/csi.aspx" rel="noreferrer"><strong>CSI</strong></a>, a Simple C# Interpreter</li> </ul>
<p>Google reveals a few efforts at this. One in particular illustrates why this is less straightforward than it might seem. <a href="http://www.codeproject.com/KB/cs/csi.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/csi.aspx</a> has a basic interpreter using .NET's built in ability to compile c# code. A key problem is that the author's approach creates a new mini .NET assembly for each interpreted line. C# may have the reflective power to have a python or ruby style console, but the .NET framework libraries are geared toward compiling C#, not dynamically interpreting it. If you are serious about this, you may want to look at <a href="http://www.paxscript.net/" rel="nofollow noreferrer">http://www.paxscript.net/</a>, which seems like a genuine attempt at interpreted C#. </p>
6,982
<p>Are there any codes that allow for numerical formatting of data when using string.format?</p>
<p>Loads, stick <code>string.Format</code> into Google :-)</p> <p>A quite good tutorial is at <a href="http://web.archive.org/web/20150303084355/http://idunno.org:80/archive/2004/07/14/122.aspx" rel="nofollow noreferrer">iduno</a></p>
<p>As Keith said above. The most common one I use is currency:</p> <pre><code>String.Format("{0:c}", 12000); </code></pre> <p>Which would output £12,000.00</p>
3,011
<p>In textmate, when there's a current selection, I hit the " key and the selection gets surrounded by quotes. The same thing happens with other balanced characters like (, {, [ and '.</p> <p>Am I missing something obvious in Emacs configuration that would enable similar behaviour when using transient mark mode, or do I need to break out elisp and write something?</p>
<p>wrap-region.el from <a href="http://sami.samhuri.net/2007/6/23/emacs-for-textmate-junkies" rel="nofollow noreferrer">this guy's blog post</a> will do what you're looking for.</p> <p><a href="http://mumble.net/~campbell/emacs/paredit.el" rel="nofollow noreferrer">Paredit</a> will complete the TextMate-style quoting. When you type one part of a matched pair (quotes, brackets, parentheses, etc), the second will be inserted and the insertion point is moved between them, much like TextMate.</p>
<p>You should check out these older, very similar, questions:</p> <p><a href="https://stackoverflow.com/questions/1023770/automatically-closing-braces-in-emacs/1024531#1024531">Automatically closing braces in Emacs?</a></p> <p><a href="https://stackoverflow.com/questions/848647/emacs-typeover-skeleton-pair-insert-maybe/849218#849218">Emacs typeover skeleton-pair-insert-maybe</a></p> <p>Although the correct answer is Joao's above; I'm about to go and change my answer to those questions, to point to autopair.</p>
9,835
<p>Suppose that two tables exist: <code>users</code> and <code>groups</code>.</p> <p><strong>How does one provide "simple search" in which a user enters text and results contain both users and groups whose names contain the text?</strong></p> <p>The result of the search must distinguish between the two types.</p>
<p>The trick is to combine a <code>UNION</code> with a literal string to determine the type of 'object' returned. In most (?) cases, UNION ALL will be more efficient, and should be used unless duplicates are required in the sub-queries. The following pattern should suffice:</p> <pre><code> SELECT "group" type, name FROM groups WHERE name LIKE "%$text%" UNION ALL SELECT "user" type, name FROM users WHERE name LIKE "%$text%" </code></pre> <p><strong>NOTE</strong>: I've added the answer myself, because I came across this problem yesterday, couldn't find a good solution, and used this method. If someone has a better approach, please feel free to add it.</p>
<p>If you use "UNION ALL" then the db doesn't try to remove duplicates - you won't have duplicates between the two queries anyway (since the first column is different), so UNION ALL will be faster.<br> (I assume that you don't have duplicates inside each query that you want to remove)</p>
8,023
<p>I have a weird problem with a dropdownbox selectedIndex always being set to 0 upon postback. I'm not accidentally rebinding it in my code. In fact I've placed a breakpoint at the very first line of the page_load event and the value is already set to zero. The dropdown is in the master page of my project, I don't know if that makes a difference. I'm not referencing the control in my content holder. </p> <p>If I set my autoPostBack = 'true' the page works fine. I don't have to change any code and the selectedIndex is maintained. I have also tried setting enableViewState on and off and it doesn't make a difference. At this point I'm grasping at straws to figure out what's going on. I've never had this problem before.</p> <p>Here is the code in my page_load event.</p> <pre><code> If CartEstablished Then txtCustNum.Visible = False btnCustSearch.Visible = False lblCustNum.Visible = True ddlSalesType.Visible = False lblSalesType.Visible = True ddlTerms.Visible = False lblTerms.Visible = True lblTerms.Text = TermsDescription Else txtCustNum.Visible = True btnCustSearch.Visible = True lblCustNum.Visible = False lblSalesType.Visible = False ddlSalesType.Visible = True lblTerms.Visible = False ddlTerms.Visible = True End If If Page.IsPostBack Then GetUIValues() Else LoadTermCodes() End If </code></pre> <p>The LoadTermCodes is where I bind the dropdownlist that is causing me problems.</p>
<p>Are you sure you are doing a postback and not a refresh? It is hard to help you without more context into the problem or a chunk of the code.</p>
<p>This may simply be a syntax error, but shouldn't</p> <pre><code> If Page.IsPostBack Then GetUIValues() Else </code></pre> <p>Look like this</p> <pre><code> If NOT Page.IsPostBack Then GetUIValues() Else </code></pre>
9,910
<p>I get this error:</p> <p><code>Can't locate Foo.pm in @INC</code></p> <p>Is there an easier way to install it than downloading, untarring, making, etc?</p>
<p><strong>On Unix</strong>:</p> <p>usually you start <em>cpan</em> in your shell:</p> <p><code>$ cpan</code></p> <p>and type</p> <p><code>install Chocolate::Belgian</code></p> <p>or in short form:</p> <p><code>cpan Chocolate::Belgian</code></p> <p><strong>On Windows</strong>:</p> <blockquote> <p>If you're using ActivePerl on Windows, the <a href="http://docs.activestate.com/activeperl/5.10/faq/ActivePerl-faq2.html#pkg_operations" rel="noreferrer">PPM (Perl Package Manager)</a> has much of the same functionality as CPAN.pm.</p> </blockquote> <p>Example:</p> <p><code>$ ppm</code><br/> <code>ppm&gt; search net-smtp</code><br/> <code>ppm&gt; install Net-SMTP-Multipart</code></p> <p><strong>see <a href="http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules" rel="noreferrer">How do I install Perl modules?</a> in the CPAN FAQ</strong></p> <p>Many distributions ship a lot of perl modules as packages.</p> <ul> <li>Debian/Ubuntu: <code>apt-cache search 'perl$'</code></li> <li>Arch Linux: <code>pacman -Ss '^perl-'</code></li> <li>Gentoo: category <code>dev-perl</code></li> </ul> <p>You should <em>always</em> prefer them as you benefit from automatic (security) <strong>updates</strong> and the ease of <strong>removal</strong>. This can be pretty tricky with the <em>cpan</em> tool itself.</p> <p>For Gentoo there's a nice tool called <strong><a href="https://wiki.gentoo.org/wiki/Project:Perl/g-cpan" rel="noreferrer">g-cpan</a></strong> which builds/installs the module from CPAN and creates a Gentoo package (<a href="http://en.wikipedia.org/wiki/Ebuild" rel="noreferrer">ebuild</a>) for you.</p>
<p>On Windows with the ActiveState distribution of Perl, use the <a href="http://docs.activestate.com/activeperl/5.10/faq/ActivePerl-faq2.html#pkg_operations" rel="nofollow noreferrer">ppm</a> command.</p>
9,152
<p>I want to write a simple colour management framework in C#, Java and AS3. I only want to write the unit tests once though, rather than recreating the unit tests in JUnit, FlexUnit and say NUnit. </p> <p>I have in mind the idea of say an xml file that defines manipulations of "instance" and assertions based on the state of "instance" via setup, teardown and a set tests. Then to have a utility that can convert that XML into xUnit code, for an arbitrary number of xUnits. Before I start wasting time developing such a solution though, I want to make sure no similar solution already exists.</p>
<p>Would FIT/ <a href="http://fitnesse.org/" rel="nofollow noreferrer">Fitnesse</a> be suitable for what you want?</p> <p>FIT is an acceptance test framework rather than unit test framework, but from what you describe you would want to ensure that the three implementations have the same behavior rather than identical designs.</p> <p>FIT has links to <a href="http://fitnesse.org/FitServers" rel="nofollow noreferrer">several languages</a></p>
<p>You could also check out Fitnesse with <a href="http://www.fitnesse.org/FitNesse.SliM" rel="nofollow noreferrer">Slim</a>, as Slim should be a lot more lightweight to implement for new languages (AS3). I guess it's more about acceptance/integration testing than unit testing, but it could be worth looking into.</p>
9,545
<p>If I have a separate system with its own concept of users and presence, what is the most appropriate architecture for creating a bridge to an XMPP server network? As far as I can tell there are three primary ways:</p> <ol> <li><p>Act as a server. This creates one touchpoint, but I fear it has implications for compatibility, and potentially creates complexity in my system for emulating a server.</p></li> <li><p>Act as a clients. This seems to imply that I need one connection per user in my system, which just isn't going to scale well.</p></li> <li><p>I've heard of an XMPP gateway protocol, but it's unclear if this is any better than the client solution. I also can't tell if this is standard or not.</p></li> </ol> <p>Any suggestions or tradeoffs would be appreciated. For example, would any of these solutions require running code inside the target XMPP server (not likely something I can do).</p>
<p>The XMPP gateway protocol you've heard of is most likely to do with transports. A transport is a server that connects to both a XMPP server and a non-XMPP server. By running a transport, I can use my Jabber client to talk to someone using, say, MSN Messenger.</p> <p>A transport typically connects once to the remote network for each JID that it sees as online. That is, it's your option 2 in reverse. This is because there is no special relationship between the transport and the non-XMPP network; the transport is simply acting as a bunch of regular clients. For this to work, XMPP clients must first register with the transport, giving login credentials for the remote network, and allowing the transport to view their presence.</p> <p>The only reason this has a chance of scaling better is that there can be many transports for the same remote network. For example, my Jabber server could run a transport to MSN, another Jabber server could run another one, and so on, each one providing connections for a different subset of XMPP users. While this spreads out the load on the Jabber side, and load balancing on your system may spread out the load as well, it still requires many connections between the two systems.</p> <p>In your case, because (I assume) the non-XMPP side of things is cooperating, putting a XMPP server interface on the non-XMPP server is likely your best bet. That server interface is best suited for managing the mapping between XMPP JIDs and how that JID will appear on its own network, rather than forcing XMPP users to register and so on.</p> <p>In case you haven't seen these, you might find them useful:</p> <ul> <li><a href="http://www.jabber.org/jabber-for-geeks/technology-overview" rel="nofollow noreferrer">http://www.jabber.org/jabber-for-geeks/technology-overview</a></li> <li><a href="http://www.xmpp.org/protocols/" rel="nofollow noreferrer">http://www.xmpp.org/protocols/</a></li> <li><a href="http://www.xmpp.org/extensions/" rel="nofollow noreferrer">http://www.xmpp.org/extensions/</a></li> </ul> <p>Hope that helps.</p>
<p>One other approach is to work with your XMPP server vendor. Most have internal APIs that make injecting presence possible from third party applications. For example, <a href="http://www.jabber.com/CE/JabberXCP" rel="nofollow noreferrer">Jabber XCP</a> provides an API for this that's really easy to use.</p> <p>(Disclosure: I work for Jabber, Inc, the company behind Jabber XCP)</p>
5,622
<p>I'm maintaining some code that uses a *= operator in a query to a Sybase database and I can't find documentation on it. Does anyone know what *= does? I assume that it is some sort of a join.</p> <pre><code>select * from a, b where a.id *= b.id</code></pre> <p>I can't figure out how this is different from:</p> <pre><code>select * from a, b where a.id = b.id</code></pre>
<p>From <a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc34982_1500/html/mig_gde/mig_gde160.htm" rel="noreferrer">http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc34982_1500/html/mig_gde/mig_gde160.htm</a>:</p> <p>Inner and outer tables</p> <p>The terms outer table and inner table describe the placement of the tables in an outer join:</p> <ul> <li><p>In a left join, the outer table and inner table are the left and right tables respectively. The outer table and inner table are also referred to as the row-preserving and null-supplying tables, respectively.</p></li> <li><p>In a right join, the outer table and inner table are the right and left tables respectively.</p></li> </ul> <p>For example, in the queries below, T1 is the outer table and T2 is the inner table:</p> <ul> <li>T1 left join T2</li> <li>T2 right join T1</li> </ul> <p>Or, using Transact-SQL syntax:</p> <ul> <li>T1 *= T2</li> <li>T2 =* T1</li> </ul>
<pre><code>select * from a, b where a.id = b.id</code></pre> <p>Requires that a row exist in where b.id = a.id in order to return an answer</p> <pre><code>select * from a, b where a.id *= b.id</code></pre> <p>Will fill the columns from b with nulls when there wasn't a row in b where b.id = a.id.</p>
6,190
<p>During the load of my cocoa application, my program crashes with the messsage EXC_BAD_ACCESS. The stack trace is not helpful. Any clues to how I can find the problem?</p>
<p>I've seen times where this can happen when you are trying to access a object that you didn't retain properly so its either not pointing to a valid copy of your object or its pointing to an object of another type. Placing breakpoints early and analyzing the objects as you step through startup using po and print in gdb is your best bet.</p>
<p>This is one possible reason. There is a IBOutlet object that isn't being initialized and a message is being invoked on nil. The stack trace might look like this:</p> <pre><code>#0 0x90a594c7 in objc_msgSend #1 0xbffff7b8 in ?? #2 0x932899d8 in loadNib #3 0x932893d9 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #4 0x9328903a in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #5 0x93288f7c in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #6 0x93288cc3 in NSApplicationMain #7 0x00009f80 in main at main.mm:17 </code></pre> <p>Since the stack trace is not helpful you will have to step through your code to find the error. If for some reason you aren't able to set breakpoints early in your execution, try inserting some Debugger(); calls which will break to the debugger.</p>
9,054
<p>I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc".</p> <p>How can I make this work? I'm not averse to canning the whole piece of code... but I'd rather not replace it with a third party library that calls JNI.</p> <pre><code>public static void openDocument(String path) throws IOException { // Make forward slashes backslashes (for windows) // Double quote any path segments with spaces in them path = path.replace("/", "\\").replaceAll( "\\\\([^\\\\\\\\\"]* [^\\\\\\\\\"]*)", "\\\\\\\"$1\""); String command = "C:\\Windows\\System32\\cmd.exe /c start " + path + ""; Runtime.getRuntime().exec(command); } </code></pre> <p><strong>EDIT:</strong> When I run it with the errant file windows complains about finding the file. But... when I run the command line directly from the command line it runs just fine.</p>
<p>If you are using Java 6 you can just use the <a href="http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#open(java.io.File)" rel="nofollow noreferrer">open method of java.awt.Desktop</a> to launch the file using the default application for the current platform.</p>
<p>Not sure if this will help you much... I use java 1.5+'s <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html" rel="nofollow noreferrer">ProcessBuilder</a> to launch external shell scripts in a java program. Basically I do the following: ( although this may not apply because you don't want to capture the commands output; you actually wanna fire up the document - but, maybe this will spark something that you can use )</p> <pre><code>List&lt;String&gt; command = new ArrayList&lt;String&gt;(); command.add(someExecutable); command.add(someArguemnt0); command.add(someArgument1); command.add(someArgument2); ProcessBuilder builder = new ProcessBuilder(command); try { final Process process = builder.start(); ... } catch (IOException ioe) {} </code></pre>
7,849
<p>I am looking for a little bit of JQuery or JS that allows me to produce a horizontally scrolling "news ticker" list.</p> <p>The produced HTML needs to be standards compliant as well.</p> <p>I have tried <a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html" rel="noreferrer">liScroll</a> but this has a habit of breaking (some content ends up on a second line at the start of the scroll), especially with longer lists.</p> <p>I have also tried <a href="http://www.mioplanet.com/rsc/newsticker_javascript.htm" rel="noreferrer">this News Ticker</a> but when a DOCTYPE is included the scrolling will jolt rather than cycle smoothly at the end of each cycle.</p> <p>Any suggestions are appreciated.</p> <p><strong>Edit</strong></p> <p>So thanks to Matt Hinze's suggestion I realised I could do what I wanted to do with JQuery animate (I require continuous scrolling not discrete scrolling like the example). However, I quickly ran into similar problems to those I was having with liScroll and after all that realised a CSS issue (as always) was responsible.</p> <p>Solution: liScroll - change the default 'var stripWidth = 0' to something like 100, to give a little space and avoid new line wrapping.</p>
<p>Smooth Div Scroll can also be used as a news ticker/stock ticker. It can pause on mouse over or mouse down and it can loop endlessly if you want it to.</p> <p>Here's <a href="http://www.maaki.com/" rel="nofollow noreferrer">the example</a> with a running ticker.</p>
<p>An Alternative solution would also be the <a href="http://jonmifsud.com/web-tools/jquery-webticker/" rel="nofollow">jQuery webTicker</a>; its very similar to liscroll however resolves the problem with the ticker stopping after the whole list completes; whilst also adding some new fancy features like; direction of movement; speed; and ability to use multiple tickers per page.</p>
6,231
<p>I have my print settings dialed into a real good spot, but there's one obstacle that's preventing them from coming out flawless; somehow, my print has &quot;fuzz&quot; everywhere. Not traditional stringing like you get from filament oozing while travelling from section to section, nor do I mean over-extrusion that causes the outer walls to sag or bubble out.</p> <p>The final shape/texture of my models are perfect - there's just wispy little hairs sticking out all over the model. They are not even really visible unless you hold it up to the light, or against a dark background.</p> <p>Here's an image of the wing from a dragon I printed. Notice the top edge of the part and how it looks like it's made of cotton or something? That's how it looks everywhere.</p> <p><a href="https://i.stack.imgur.com/tkQPc.jpg" rel="nofollow noreferrer" title="Close up of dragon wing showing cotton effect"><img src="https://i.stack.imgur.com/tkQPc.jpg" alt="Close up of dragon wing showing cotton effect" title="Close up of dragon wing showing cotton effect" /></a></p>
<p>That is the print stringing still. Even thought that you have your printer dialed in, the plastic that is still in the nozzle is still grabbing onto your print and pulling out the nozzle just a tad. This, as far as I know, is unavoidable. The best solution that I could think of fixing this (as far as having your print come perfect off of the bed) would if a company designed the tips, printer, and filament to perfectly match each other, but until that happens, you are gonna be stuck with a lighter balling up the strings and picking them off.</p>
<p>These stringers are common with PETG. You can reduce them by:</p> <ol> <li><p>Increasing retraction reduces the stringers, but too much retraction can cause the filament to jam and stop extruding.</p> </li> <li><p>Lowering the extruder temperature will reduce the stringers, but also reduce adhesion between layers. Stringers usually aren't an issue on the 1st layer, so you can keep the necessary extrusion temperature for the 1st layer to keep adhesion to the bed.</p> </li> </ol> <p>Your stringers are very short thus difficult to reduce. One method to get rid of stringers is to expose the print very quickly with the flame of a blow torch. Important is you don't want to melt the strings. You want them to burn, so that they are ash and easily removed. Melting the stringers will distort your print.</p>
1,978
<p>What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads?</p>
<p>Since programs like AdBlock actually never request the advert, you would have to look the server logs to see if the same user accessed a webpage but didn't access an advert. This is assuming the advert is on the same server.</p> <p>If your adverts are on a separate server, then I would suggest it's impossible to do so.</p> <p>The best way to stop users from blocking adverts, is to have inline text adverts which are generated by the server and dished up inside your html.</p>
<p>I suppose you could compare the ad prints with the page views on your website (which you can get from your analytics software).</p>
2,455
<p>I recently changed the printhead on my DeltaMaker from stock to an E3D Lite6, and am struggling to get back to my original quality, reliability, and repeatability. I thought I had gotten the recipe pretty close to dialed in and tried a bigger print last night. It turned out pretty good in most respects except for where vertical structures rise up from the horizontal surface (and a retraction/stringing issue that I didn't think was but perhaps could be related). </p> <p>The screw hole mounts seem well-designed to me:</p> <p><a href="https://i.stack.imgur.com/4IgaU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4IgaU.png" alt="3D print preview"></a></p> <p>No 90 degree transitions - I would think this would be the least of my problems. But last night they had serious problems:</p> <p><a href="https://i.stack.imgur.com/ZXNsE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZXNsE.jpg" alt="Example 1"></a></p> <p><a href="https://i.stack.imgur.com/USaAE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/USaAE.jpg" alt="Example 2"></a></p> <p>I haven't seen a problem like that before. Extrusion rate seems basically perfect - why does it look like it just stopped extruding around the perimeters?</p> <p>I'm using PLA filament and Simplify3D 3.1.0 slicing. Settings:</p> <ul> <li>0.35 mm nozzle, 0.40 mm extrusion width, 1.05 extrusion multiplier</li> <li>0.15 mm layer height, 3 top, 3 bottom layers, 2 perimeter shells (maybe should try 3?)</li> <li>30% infill, 60% outline overlap, 110% infill extrusion width </li> <li>Temp is 220°C (thermocouple wedged between nozzle and heater block reports about 206°C when thermistor says 220°C) </li> <li>Print speed is 2700 mm/min (45 mm/s)</li> </ul> <p>Has anyone seen this issue before?</p> <p>UPDATE: Increasing outline overlap from 60% to 90% <em>almost</em> fixes the problem (at least visually if not structurally) - there's just one small hole at the base of each structure. (I stopped the print a few layers after the problem layers do ignore the tops.)</p> <p><a href="https://i.stack.imgur.com/YW5JW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YW5JW.jpg" alt="Updated Image"></a></p> <p>Going to 99% (Simplify3D's max) would probably get rid of those last holes but I have to think that maxing out S3D's outline overlap setting to just barely make the print work means I haven't found or addressed the true root cause...</p>
<p>Since you said you don't have a cooling fan, try lowering the temperature on your print head to something like 205. The strings in the first and second picture also occur more often when the print temperature is too high as well. </p> <p>The layer time gets really small at that transition, so make sure the print speed is slowing down while printing that part of the object and pausing in between those layers to allow for cooling.</p> <p>It looks like the plastic is still molten and is being dragged around too me.</p>
<p>It looks like the first layers that are making the vertical transition do not have enough to stick to and are curling up. Are you using a cooling fan?</p>
412
<p>I want to create templates for base new reports on to have common designs. How do you do it?</p>
<p>The need to produce reports with a common starting design and format is key to any project involving clients and their reports. I have been working on reports for over 10 years now. This has not been the largest portion of my jobs through the years but it has been a very import one. The key to any report project is not to recreate the mundane aspects of the reports for each but to use templates. The use of templates is not a common task or knowledge for Microsoft's SQL Server Reporting Services. Knowing how to save reports templates so that you and your team can create these shortcuts at the creation of a new report in Visual Studio 2005 will help save time and have all reports use the same layout and design.</p> <p>Create of a set of reports with the following suggestions:</p> <ul> <li>Page size -- 8.5 by 11 (letter) and 8.5 by 14 (legal)</li> <li>Orientation -- portrait and landscape for all paper sizes </li> <li>Header -- Text Box for report name, Text Box for report subtitle, client or brand logo</li> <li>Footer -- page number/total pages, date and time report printed</li> </ul> <p>Take all the rdl files for the reports created from the suggestions and copy the files to the following directory:</p> <p>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject</p> <p>When creating a new report in your Visual Studio 2005 report project through Add|New Item</p> <p><a href="http://www.cloudsocket.com/images/image-thumb14.png">alt text http://www.cloudsocket.com/images/image-thumb14.png</a></p> <p>The new report dialog will present the list of items from the directory where the new templates were placed.</p> <p><a href="http://www.cloudsocket.com/images/image-thumb15.png">alt text http://www.cloudsocket.com/images/image-thumb15.png</a></p> <p>Select the report that fits the requirement needed and proceed to develop your reports without needing to create the basics.</p>
<p>Further more, I would suggest wrapping up your template perhaps with externally linked images into an .msi for easier distribution. It is a lot easier to ask people in a department to run an installer than it is to hope they find the right path to put the reporting template in. Make sure you use the proper program files variables etc to account for "Program Files" vs "Program Files(x86)" and other variations users sometimes do with their environment variable settings.</p>
9,058
<p>I’m thinking about trying some development for the iPhone, is it possible to install Leopard inside VMWare? I already have a pretty high spec PC with a comfy setup that I’d like to use, or do I need to buy a real Mac?</p>
<p>It is <a href="http://blogs.vmware.com/vmtn/2008/01/virtual-leopa-1.html" rel="noreferrer">legal</a> to run Mac OS X <strong>Server</strong> in a virtual machine <em>on Apple hardware</em>. All other forms of Mac OS X virtualization are currently forbidden.</p>
<p>Unfortunately, there's no legal way to run OS X in a virtual machine.</p> <p>For developing iPhone apps you probably don't need a particularly beefy machine, so maybe look into grabbing a <a href="http://store.apple.com/us/browse/home/shop_mac/family/mac_mini?mco=MTE3MTA" rel="nofollow noreferrer">mac mini</a>? They're the cheapest Macs you can get, and should probably be just fine for doing iPhone work. Plus, now you have a mac that you can use for testing other things too! :)</p>
4,265
<p>My MakerBot printer supports only two filaments at the same time.</p> <p>What are techniques to print objects with more than two colors for one object?</p>
<p>The most obvious solution is to pause the print and swap filament for another color.</p> <p>Another option is to <a href="https://www.youtube.com/watch?v=RdlqGR5n9Zk">splice pieces of filament</a> together, though this does not allow very precise control of when the switch happens. There is also a device that can automatically slice filament this way.</p> <p>Finally, another option that uses very little external equipment is to <a href="http://reprap.org/wiki/Coloring_filament">use (permanent) markers to colorize light-colored filament</a>.</p> <p>Other options include upgrading to a printer with more hotends, or installing a hotend with multiple filament inputs and one outputs, but these options would involve significantly changing your printer setup.</p>
<p>Answering this question fully depends on the type of printer you have. Some printers have a pause capability, while others do not. Some have multiple extruders, while most do not. Some have a tube leading to the extruder and others do not. You specifically are asking about dealing with more than two colors when you have a dual-extruder, but the question generalizes to how to get more colors than you have extruders.</p> <p>Markers probably offer the easiest solution. You could have different markers on the feeds for each extruder.</p> <p>For printers with no pause ability, you might have to snip one filament and hand feed the second color after the first one until it can be caught by the feeder gear.</p> <p>There are rigs that are available, or that you can make, that will let you connect two strands together lengthwise. You can then make up a single piece of filament that has multiple colors. Thus, one extruder head will be generating multiple colors.</p> <p>The Kickstarter mentioned elsewhere essentially does this automatically for several strands whose lengths are calculated precisely by special software. The result is a single strand of filament that goes into one of your extruders - the other extruder would be unused with this solution.</p>
87
<p>In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms.</p> <p>Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?</p>
<p>It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better.</p> <p>Some people like to write up use cases and if they see a lot of the same nouns showing up over and over again (e.g., a person withdraws money from the bank), then they go the OO route and use the nouns as their objects. Conversely, if you don't see a lot of nouns and there's really more verbs going on, then procedural or functional may be the way to go.</p> <p>Steve Yegge has a <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html" rel="noreferrer">great but long post</a> as usual that touches on this from a different perspective that you may find helpful as well.</p>
<p>If you're doing something for yourself, or if you're doing just a prototype, or testing an idea... use the free style that script languages gives you. </p> <p>After that: always think in objects, try to organize your work around the OO paradigm even if you're writing procedural stuff. Then, refactorize, refactorize, refactorize.</p>
2,600
<p>I'm looking for a desktop/embedded database. The two candidates I'm looking at are Microsoft SQL Server CE and Oracle Lite. If anyone's used both of these products, it'd be great if you could compare them. I haven't been able to find any comparisons online.</p> <p>The backend DB is Oracle10g.</p> <p><strong>Update:</strong> Clarification, the business need is a client-server app with offline functionality (hence the need for a local data store on the client)</p>
<p>If the backend database is Oracle 10g it will probably be easier for you to use Oracle Lite - that way you don't have to use two completely different SQL dialects in the same project.</p> <p>BTW, In my product I use SQLite as the desktop database </p>
<p>You might want to look at Oracle XE. I cannot remember all of the differences, but O-Lite didn't fit my project needs. Oracle XE is a very good database for local development.</p> <p>Brad</p>
7,093
<p>My company develops several types of applications. A lot of our business comes from doing multimedia-type apps, typically done in Flash. However, now that side of the house is starting to migrate towards doing Flex development.</p> <p>Most of our other development is done using .NET. I'm trying to make a push towards doing Silverlight development instead, since it would take better advantage of the .NET developers on staff. I prefer the Silverlight platform over the Flex platform for the simple fact that Silverlight is all .NET code. We have more .NET developers on staff than Flash/Flex developers, and most of our Flash/Flex developers are graphic artists (not real programmers). Only reason they push towards Flex right now is because it seems like the logical step from Flash.</p> <p>I've done development using both, and I honestly believe Silverlight is easier to work with. But I'm trying to convince people who are only Flash developers. </p> <p>So here's my question: If I'm going to go into a meeting to praise Silverlight, why would a company want to go with Silverlight instead of Flex? Other than the obvious "not everyone has Silverlight", what are the pros and cons for each?</p>
<p>I think you should look at Silverlight as a long-term play, just as Microsoft seems to be doing. There's an obvious balance on when to use Silverlight vs. Flash when you're concerned about reach and install base, but here are some reasons Silverlight is a good direction to move in:</p> <ol> <li><p>Second mover advantage - Just as Microsoft built a "better Java" with .NET, they're able to look at how you'd design a RIA plugin from scratch, today. They have the advantage of knowing how people use the web today, something the inventors of Flash could never have accurately guessed. Flash can add features, but they can't realistically chuck the platform and start over.</p></li> <li><p>Developer familiarity - While Silverlight is a new model, it's not entirely unfamiliar to developers. They'll "get" the way Silverlight works a lot more quickly than they'll understand firing up a new development environment with a new scripting language and new event paradigms.</p></li> <li><p>Being rid of the timeline model in Flash - Flash was originally built for keyframe based animations, and while there are ways to abstract this away, it's at the core of how Flash works. Silverlight ditches that for an application-centric model. </p></li> <li><p>ScottGu - ScottGu is fired up about Silverlight. Nuff said.</p></li> <li><p>Cool new features - While Silverlight still has some catching up to do with Flash on some obvious features (like webcam / mic integration, or 3d / graphics acceleration), there are some slick new technologies built in to Silverlight - Deep Zoom is one example. I'm seeing more "revolutionary" technologies on the Silverlight side, while Flash seems to be in maintenance mode at this point.</p></li> </ol>
<p>Flash Player is available &amp; supported officially in almost all desktop platforms (Windows, Linux, Mac) whereas Silverlight will be supported mainly in Windows.</p> <p>the following <a href="http://www.brighthub.com/internet/web-development/articles/33696.aspx" rel="nofollow noreferrer">article</a> provides comparision of both the platforms.</p>
4,127
<p>Currently, I don't really have a good method of debugging JavaScript in Internet&nbsp;Explorer and <a href="http://en.wikipedia.org/wiki/Safari_%28web_browser%29" rel="noreferrer">Safari</a>. In Firefox, you can use <a href="http://en.wikipedia.org/wiki/Firebug" rel="noreferrer">Firebug's</a> <a href="http://getfirebug.com/logging.html" rel="noreferrer">logging feature</a> and <a href="http://getfirebug.com/commandline.html" rel="noreferrer">command Line functions</a>. However, this doesn't help me when I move to other browsers.</p>
<p>For Safari you need to enable the "Develop" menu via Preferences (in Safari 3.1; see <a href="http://developer.apple.com/internet/safari/faq.html#anchor14" rel="noreferrer">the entry in Apple's Safari development FAQ</a>) or via</p> <pre><code>$ defaults write com.apple.Safari IncludeDebugMenu 1 </code></pre> <p>at the terminal in Mac OS X. Then from the Develop menu choose Show Web Inspector and click on the Console link. Your script can write to the console using window.console.log.</p> <p>For Internet Explorer, Visual Studio is really the best script debugger but the Microsoft Script Debugger is okay if you don't have Visual Studio. <a href="http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx" rel="noreferrer" title="Scripting Debugging in Internet Explorer">This post on the IE team blog</a> walks you through installing it and connecting to Internet Explorer.</p> <p>Internet Explorer 8 <a href="http://www.west-wind.com/weblog/posts/271352.aspx" rel="noreferrer">looks</a> like it will have a very fancy script debugger, so if you're feeling really adventurous you could install the Internet Explorer 8 beta and give that a whirl.</p>
<p>There is now a <a href="http://getfirebug.com/lite.html" rel="nofollow noreferrer">Firebug Lite</a> that works on other browsers such as Internet&nbsp;Explorer, Safari and Opera built. It does have a limited set of commands and is not as fully featured as the version in Firefox.</p> <p>If you are using <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> in <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008" rel="nofollow noreferrer">Visual&nbsp;Studio&nbsp;2008</a> will also debug JavaScript in Internet&nbsp;Explorer.</p>
2,875
<p>I've got a C++ program that uses SQLite. I want to store the SQL queries in a separate file -- a plain-text file, <em>not</em> a source code file -- but embed that file in the executable file like a resource.</p> <p>(This has to run on Linux, so I can't store it as an actual resource as far as I know, though that would be perfect if it were for Windows.)</p> <p>Is there any simple way to do it, or will it effectively require me to write my own resource system for Linux? (Easily possible, but it would take a lot longer.)</p>
<p>You can use objcopy to bind the contents of the file to a symbol your program can use. See, for instance, <a href="http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967" rel="noreferrer">here</a> for more information.</p>
<p>I have seen this to be done by converting the resource file to a C source file with only one char array defined containing the content of resource file in a hexadecimal format (to avoid problems with malicious characters). This automatically generated source file is then simply compiled and linked to the project. </p> <p>It should be pretty easy to implement the convertor to dump C file for each resource file also as to write some facade functions for accessing the resources.</p>
9,824
<p>I am using an AnyCubic Photon Resin Printer. I have used the (<a href="https://wowmodelviewer.net" rel="nofollow noreferrer">WoW model viewer</a> to export a miniture that I am hoping to 3D print.</p> <p>However, when I look at the model in photon workshop, certain parts appear in a different colour, and those parts are printing incorrectly on the final version. For example, if you look at the model below the headpiece feathers printed as a solid block all the way to the base of the model.</p> <p><a href="https://i.stack.imgur.com/OnmjT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OnmjT.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/UiLiX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UiLiX.png" alt="enter image description here" /></a></p> <p>Looking at the slicing file, this is what photon workshop exported. I believe the issue may be that, because these are models deisigned for games and not 3d printing, they have only one surface and what I am looking at in Blue is what the photon workshop considers to be the inside of the model. Would ye be able to recommend any steps that I could do to adjust the models to allow them be 3D printed?</p> <p><a href="https://mega.nz/file/p6I00JZK#qhQplzOTh6w7yZxbGw2vtRRKc-iVDp_QHOvaWfPtULs" rel="nofollow noreferrer">https://mega.nz/file/p6I00JZK#qhQplzOTh6w7yZxbGw2vtRRKc-iVDp_QHOvaWfPtULs</a></p> <p>The above link is the object as exported from WoW Model viewer.</p>
<p>Aligning build surfaces isn't the main issue with 1 mm thick surfaces when aligning four 200 x 200 mm surfaces to make one 400 x 400 surface. The main issue is slight bucking at the seams from thermal mismatch. Using this with PETG tends to tear up the build surface at the seams. The image shows aligned surfaces.</p> <p><a href="https://i.stack.imgur.com/14q3L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/14q3L.jpg" alt="enter image description here" /></a></p> <p>The above was a poor design because prints tended to always print on the seams, which are more susceptible to damage when removing the print.</p> <p>More reliable was to put one 200 x 200 mm surface in the center of the bed, cut the other three in half, and tile them along the sides. Glue stice helps fill the seams.</p> <p><a href="https://i.stack.imgur.com/mC4ea.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mC4ea.jpg" alt="enter image description here" /></a></p> <p>The center of the surface tends to wear out first. In that case only the center surface would need changing.</p>
<p>I haven't tried such a thing, but a speculative answer covering the constraints and expected failure modes may suffice here.</p> <p>Unless the sheets have squared (rather than rounded) corners, the corners will almost certainly be a problem. In particular you'd end up with a hole right at the middle of the bed.</p> <p>If the sides aren't entirely square (perpendicular) with each other then you'll have large gaps at one end or another.</p> <p>As Trish noted in a comment, it's also possible that you may hit problems due to mismatch in thickness between the different sheets, although I'd expect these are fairly well-controlled in the manufacturing process; otherwise I'd expect bed leveling issues even with just a single sheet. If you do hit this kind of issue, it may be possible to avoid it with shimming of some sort.</p> <p>Assuming you can avoid all of the above potential problems, I would expect what you've proposed to work reasonably well, especially if you're ok with very minor surface defects at the seams.</p>
1,756
<p>I have an app that I've written in C#/WinForms (<a href="http://www.thekbase.com" rel="nofollow noreferrer" title="TheKBase">my little app</a>). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)? Suggestions for cross-platform UI development?</p> <p>By cross-platform I mean, currently, Mac OSX, Windows and Linux.</p> <p>This question was <a href="https://stackoverflow.com/questions/116468/winforms-for-mono-on-mac-linux-and-pc-redux">asked again and answered with better success</a>.</p>
<p>As far as my experience in Flex/AIR/Flash actionscripting goes, Adobe AIR development environment and coding/debugging toolsets are far inferior to the Visual Studio and .NET SDK as of the moment. The UI toolsets are superior though.</p> <p>But as <em>you already have a working C# code</em>, porting it to ActionScript might requires a redesign due to ActionScript having a different way of thinking/programming, they use different primitive data types, for example, they use just a <code>Number</code> instead of <code>int float double</code> etc. and the debugging tools are quiet lacking compared to VS IMO.</p> <p>And I heard that <a href="http://www.mono-project.com/GtkSharp" rel="nofollow noreferrer">Mono's GtkSharp</a> is quiet a decent platform.</p> <p>But if you don't mind the coding/debugging tooling problems, then AIR is a great platform. I like how Adobe integrates the Flash experience into it e.g. you can start an installation of AIR application via a button click in a flash movieclip, that kind of integration.</p>
<p>I don't think there is a future for WinForms at all. Since it appears to have been a stop-gap solution even in MSFT world ( a very thin wrapper around Win32). And virtually no changes seem to have been made to System.Windows.Forms in both .NET 3.0 and 3.5</p> <pre><code>&lt;/speculation&gt; </code></pre> <p>I would use Java or Air.</p>
9,821
<p>I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ <em>and a couple checking in and out from a network share (I forgot about this when I originally posted this question)</em>.</p> <p>This means that I don't have a "subversion" server per-se.</p> <p>How do I integrate TortoiseSVN and Fogbugz?</p> <p><em>Edit: inserted italics</em></p>
<p>I've been investigating this issue and have managed to get it working. There are a couple of minor problems but they can be worked-around.</p> <p>There are 3 distinct parts to this problem, as follows:</p> <ol> <li><p><strong>The TortoiseSVN part</strong> - getting TortoiseSVN to insert the Bugid and hyperlink in the svn log</p></li> <li><p><strong>The FogBugz part</strong> - getting FogBugz to insert the SVN info and corresponding links</p></li> <li><p><strong>The WebSVN part</strong> - ensuring the links from FogBugz actually work</p></li> </ol> <p>Instructions for part 1 are in another answer, although it actually does more than required. The stuff about the hooks is actually for part 2, and as is pointed out - it doesn't work "out of the box"</p> <p><strong>Just to confirm, we are looking at using TortoiseSVN <em>WITHOUT</em> an SVN server (ie. file-based repositories)</strong></p> <p>I'm accessing the repositories using UNC paths, but it also works for local drives or mapped drives.</p> <p>All of this works with TortoiseSVN v1.5.3 and SVN Server v1.5.2 (You need to install SVN Server because part 2 needs <code>svnlook.exe</code> which is in the server package. You don't actually configure it to work as an SVN Server) It may even be possible to just copy <code>svnlook.exe</code> from another computer and put it somewhere in your path.</p> <h1>Part 1 - TortoiseSVN</h1> <p>Creating the TortoiseSVN properties is all that is required in order to get the links in the SVN log.</p> <p>Previous instructions work fine, I'll quote them here for convenience:</p> <blockquote> <h2>Configure the Properties</h2> <ol> <li><p>Right click on the root directory of the checked out project you want to work with.</p></li> <li><p>Select "TortoiseSVN -> Properties"</p></li> <li><p>Add five property value pairs by clicking "New..." and inserting the following in "Property Name" and "Property Value" respectively: (make sure you tick "Apply property recursively" for each one)</p> <pre><code>bugtraq:label BugzID: bugtraq:message BugzID: %BUGID% bugtraq:number true bugtraq:url http://[your fogbugz URL here]/default.asp?%BUGID% bugtraq:warnifnoissue false </code></pre></li> <li><p>Click "OK"</p></li> </ol> </blockquote> <p>As Jeff says, you'll need to do that for each working copy, so follow his instructions for migrating the properties.</p> <p>That's it. TortoiseSVN will now add a link to the corresponding FogBugz bugID when you commit. If that's all you want, you can stop here.</p> <h1>Part 2 - FogBugz</h1> <p>For this to work we need to set up the hook scripts. Basically the batch file is called after each commit, and this in turn calls the VBS script which does the submission to FogBugz. The VBS script actually works fine in this situation so we don't need to modify it.</p> <p>The problem is that the batch file is written to work as a <em>server</em> hook, but we need a <em>client</em> hook.</p> <p>SVN server calls the post-commit hook with these parameters:</p> <pre><code>&lt;repository-path&gt; &lt;revision&gt; </code></pre> <p>TortoiseSVN calls the post-commit hook with these parameters:</p> <pre><code>&lt;affected-files&gt; &lt;depth&gt; &lt;messagefile&gt; &lt;revision&gt; &lt;error&gt; &lt;working-copy-path&gt; </code></pre> <p>So that's why it doesn't work - the parameters are wrong. We need to amend the batch file so it passes the correct parameters to the VBS script.</p> <p>You'll notice that TSVN doesn't pass the repository path, which is a problem, but it does work in the following circumstances:</p> <ul> <li>The repository name and working copy name are the same</li> <li>You do the commit at the root of the working copy, not a subfolder.</li> </ul> <p>I'm going to see if I can fix this problem and will post back here if I do.</p> <p>Here's my amended batch file which does work (please excuse the excessive comments...)</p> <p>You'll need to set the hook and repository directories to match your setup.</p> <pre><code>rem @echo off rem SubVersion -&gt; FogBugz post-commit hook file rem Put this into the Hooks directory in your subversion repository rem along with the logBugDataSVN.vbs file rem TSVN calls this with args &lt;PATH&gt; &lt;DEPTH&gt; &lt;MESSAGEFILE&gt; &lt;REVISION&gt; &lt;ERROR&gt; &lt;CWD&gt; rem The ones we're interested in are &lt;REVISION&gt; and &lt;CWD&gt; which are %4 and %6 rem YOU NEED TO EDIT THE LINE WHICH SETS RepoRoot TO POINT AT THE DIRECTORY rem THAT CONTAINS YOUR REPOSITORIES AND ALSO YOU MUST SET THE HOOKS DIRECTORY setlocal rem debugging rem echo %1 %2 %3 %4 %5 %6 &gt; c:\temp\test.txt rem Set Hooks directory location (no trailing slash) set HooksDir=\\myserver\svn\hooks rem Set Repo Root location (ie. the directory containing all the repos) rem (no trailing slash) set RepoRoot=\\myserver\svn rem Build full repo location set Repo=%RepoRoot%\%~n6 rem debugging rem echo %Repo% &gt;&gt; c:\temp\test.txt rem Grab the last two digits of the revision number rem and append them to the log of svn changes rem to avoid simultaneous commit scenarios causing overwrites set ChangeFileSuffix=%~4 set LogSvnChangeFile=svn%ChangeFileSuffix:~-2,2%.txt set LogBugDataScript=logBugDataSVN.vbs set ScriptCommand=cscript rem Could remove the need for svnlook on the client since TSVN rem provides as parameters the info we need to call the script. rem However, it's in a slightly different format than the script is expecting rem for parsing, therefore we would have to amend the script too, so I won't bother. rem @echo on svnlook changed -r %4 %Repo% &gt; %temp%\%LogSvnChangeFile% svnlook log -r %4 %Repo% | %ScriptCommand% %HooksDir%\%LogBugDataScript% %4 %temp%\%LogSvnChangeFile% %~n6 del %temp%\%LogSvnChangeFile% endlocal </code></pre> <p>I'm going to assume the repositories are at <code>\\myserver\svn\</code> and working copies are all under `C:\Projects\</p> <ol> <li><p>Go into your FogBugz account and click Extras -> Configure Source Control Integration</p></li> <li><p>Download the VBScript file for Subversion (don't bother with the batch file)</p></li> <li><p>Create a folder to store the hook scripts. I put it in the same folder as my repositories. eg. <code>\\myserver\svn\hooks\</code></p></li> <li><p>Rename VBscript to remove the <code>.safe</code> at the end of the filename.</p></li> <li><p>Save my version of the batch file in your hooks directory, as <code>post-commit-tsvn.bat</code></p></li> <li><p>Right click on any directory.</p></li> <li><p>Select "TortoiseSVN > Settings" (in the right click menu from the last step)</p></li> <li><p>Select "Hook Scripts"</p></li> <li><p>Click "Add" and set the properties as follows:</p> <ul> <li><p>Hook Type: Post-Commit Hook</p></li> <li><p>Working Copy Path: <code>C:\Projects</code> (or whatever your root directory for all of your projects is.)</p></li> <li><p>Command Line To Execute: <code>\\myserver\svn\hooks\post-commit-tsvn.bat</code> (this needs to point to wherever you put your hooks directory in step 3)</p></li> <li><p>Tick "Wait for the script to finish"</p></li> </ul></li> <li><p>Click OK twice.</p></li> </ol> <p>Next time you commit and enter a Bugid, it will be submitted to FogBugz. The links won't work but at least the revision info is there and you can manually look up the log in TortoiseSVN.</p> <p>NOTE: You'll notice that the repository root is hard-coded into the batch file. As a result, if you check out from repositories that don't have the same root (eg. one on local drive and one on network) then you'll need to use 2 batch files and 2 corresponding entries under Hook Scripts in the TSVN settings. The way to do this would be to have 2 separate Working Copy trees - one for each repository root.</p> <h1>Part 3 - WebSVN</h1> <p>Errr, I haven't done this :-)</p> <p>From reading the WebSVN docs, it seems that WebSVN doesn't actually integrate with the SVN server, it just behaves like any other SVN client but presents a web interface. In theory then it should work fine with a file-based repository. I haven't tried it though.</p>
<p>I am not sure I follow you. Do you have the repositories on the network or on your C:\ drive? According to two of your posts, you have both, or neither, or one of them or...</p> <p>You can not get VisualSVN or Apache to safely serve repositories from a network share. Since you originally said you had the repositories on your C:\ drive, that's what you get advice for. If you have a different setup, you need to tell us about that.</p> <p>If you have the repositories on your local harddisk, I would install VisualSVN, or integrate it into Apache. VisualSVN can run fine alongside Apache so if you go that route you only have to install it. Your existing repositories can also just be copied into the repository root directory of VisualSVN and you're up and running.</p> <p>I am unsure why that big post here is labelled as incomplete, as it details the steps necessary to set up a hook script to inform FogBugz about the new revisions linked to the cases, which should be what the <em>incomplete</em> message says it doesn't do. Is that not working?</p>
2,568
<p><code>NSInteger</code>/<code>NSUInteger</code> are Cocoa-defined replacements for the regular built-in types.</p> <p>Is there any benefit to using the NS* types over the built-ins? Which do you prefer and why? Are <code>NSInteger</code> and <code>int</code> the same width on 32-bit / 64-bit platforms?</p>
<p>The way I understand it is that NSInteger et al. are architecture safe versions of the corresponding C types. Basically their size vary depending on the architecture, but NSInteger, for example, is guaranteed to hold any valid pointer for the current architecture.</p> <p>Apple recommends that you use these to work with OS X 10.5 and onwards, and Apple's API:s will use them, so it's definitely a good idea to get into the habit of using them. They require a little more typing, but apart from that it doesn't seem to be any reason not to use them.</p>
<p>I prefer the standard c style declarations but only because I switch between several languages and I don't have to think too much about it but sounds like I should start looking at nsinteger</p>
3,466
<p>In a JSP page, I created a <code>&lt;h:form enctype="multipart/form-data"&gt;</code> with some elements: <code>&lt;t:inputText&gt;</code>, <code>&lt;t:inputDate&gt;</code>, etc. Also, I added some <code>&lt;t:message for="someElement"&gt;</code> And I wanted to allow the user upload several files (one at a time) within the form (using <code>&lt;t:inputFileUpload&gt;</code> ) At this point my code works fine.</p> <hr> <p>The headache comes when I try to put the form inside a <code>&lt;t:panelTabbedPane serverSideTabSwitch="false"&gt;</code> (and thus of course, inside a <code>&lt;t:panelTab&gt;</code> ) </p> <p>I copied the structure shown in the source code for TabbedPane example from <a href="http://www.irian.at/myfacesexamples/tabbedPane.jsf" rel="nofollow noreferrer">Tomahawk's examples</a>, by using the <code>&lt;f:subview&gt;</code> tag and putting the panelTab tag inside a new jsp page (using <code>&lt;jsp:include page="somePage.jsp"&gt;</code> directive)</p> <p>First at all, the <code>&lt;t:inputFileUpload&gt;</code> fails to load the file at the value assigned in the Managed Bean UploadedFile attribute <code>#{myBean.upFile}</code></p> <p>Then, <a href="http://markmail.org/message/b4nht4f6xb74noxp" rel="nofollow noreferrer" title="That has no answer when I readed it">googling for a clue</a>, I knew that <code>&lt;t:panelTabbedPane&gt;</code> generates a form called "autoform", so I was getting nested forms. Ok, I fixed that creating the <code>&lt;h:form&gt;</code> out of the <code>&lt;t:panelTabbedPane&gt;</code> and eureka! file input worked again! (the autoform doesn't generate) </p> <p>But, oh surprise! oh terrible Murphy law! All my <code>&lt;h:message&gt;</code> begins to fail. The Eclipse console's output show me that all <code>&lt;t:message&gt;</code> are looking for nonexistents elements ID's (who have their ID's in part equals to they are looking for, but at the end of the ID's their names change)</p> <p>At this point, I put a <code>&lt;t:mesagges&gt;</code> tag (note the "s" at the end) to show me all validation errors at once at the beginning of the Panel, and it works fine. So, validation errors exists and they show properly at the beginning of the Panel.</p> <p>All validation error messages generated in this page are the JSF built-in validation messages. The backing bean at this moment doesn't have any validators defined.</p> <h3>¿How can I get the <code>&lt;t:message for="xyz"&gt;</code> working properly?</h3> <hr> <p>I'm using Tomahawk-1.1.6 with myFaces-impl-1.2.3 in a eclipse Ganymede project with Geronimo as Application Server (Geronimo gives me the myFaces jar implementation while I put the tomahawk jar in the WEB-INF/lib folder of application) </p> <hr> <h2>"SOLVED": This problem is an issue reported to myFaces forum.</h2> <p>Thanks to Kyle Renfro for the soon response and information. (Good job Kyle!) <a href="https://issues.apache.org/jira/browse/MYFACES-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&amp;focusedCommentId=12567158#action_12567158" rel="nofollow noreferrer">See the issue</a></p> <hr> <p><strong>EDIT 1</strong></p> <p>1.- Thanks to Kyle Renfro for his soon response. The forceID attribute used inside the input element doesn't works at first time, but doing some very tricky tweaks I could make the <code>&lt;t:message for="xyz"&gt;</code> tags work.</p> <p>What I did was:<br> 1. Having my tag <code>&lt;inputText id="name" forceId="true" required="true"&gt;</code> The <code>&lt;t:message&gt;</code> doesn't work.<br> 2. Then, after looking the error messages on eclipse console, I renamed my "id" attribute to this: &lt;inputText id="<strong>namej_id_1</strong>" forceId="true" required="true"&gt;<br> 3. Then the <code>&lt;t:message&gt;</code> worked!! but after pressing the "Submit" button of the form the second time. ¡The second time! (I suspect that something is going on at the JSF lifecycle)<br> 4. This implies that the user have to press 2 times the submit button to get the error messages on the page.<br> 5. And using the "j_id_1" phrase at the end of IDs is very weird. </p> <hr> <p><strong>EDIT 2</strong></p> <p>Ok, here comes the code, hope it not be annoying.</p> <p>1.- <strong>mainPage.jsp</strong> (here is the <code>&lt;t:panelTabbedPane&gt;</code> and <code>&lt;f:subview&gt;</code> tags) </p> <pre><code>&lt;%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%&gt; &lt;%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%&gt; &lt;%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%&gt; &lt;html&gt; &lt;body&gt; &lt;f:view&gt; &lt;h:form enctype="multipart/form-data"&gt; &lt;t:panelTabbedPane serverSideTabSwitch="false" &gt; &lt;f:subview id="subview_tab_detail"&gt; &lt;jsp:include page="detail.jsp"/&gt; &lt;/f:subview&gt; &lt;/t:panelTabbedPane&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><br /> 2.- <strong>detail.jsp</strong> (here is the <code>&lt;t:panelTab&gt;</code> tag) </p> <pre><code>&lt;%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%&gt; &lt;%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%&gt; &lt;%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%&gt; &lt;t:panelTab label="TAB_1"&gt; &lt;t:panelGrid columns="3"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="CREATING A TICKET" /&gt; &lt;/f:facet&gt; &lt;t:outputLabel for="ticket_id" value="TICKET ID" /&gt; &lt;t:inputText id="ticket_id" value="#{myBean.ticketId}" required="true" /&gt; &lt;t:message for="ticket_id" /&gt; &lt;t:outputLabel for="description" value="DESCRIPTION" /&gt; &lt;t:inputText id="description" value="#{myBean.ticketDescription}" required="true" /&gt; &lt;t:message for="description" /&gt; &lt;t:outputLabel for="attachment" value="ATTACHMENTS" /&gt; &lt;t:panelGroup&gt; &lt;!-- This is for listing multiple file uploads --&gt; &lt;!-- The panelGrid binding make attachment list grow as the user inputs several files (one at a time) --&gt; &lt;t:panelGrid columns="3" binding="#{myBean.panelUpload}" /&gt; &lt;t:inputFileUpload id="attachment" value="#{myBean.upFile}" storage="file" /&gt; &lt;t:commandButton value="ADD FILE" action="#{myBean.upload}" /&gt; &lt;/t:panelGroup&gt; &lt;t:message for="attachment" /&gt; &lt;t:commandButton action="#{myBean.create}" value="CREATE TICKET" /&gt; &lt;/t:panelGrid&gt; &lt;/t:panelTab&gt; </code></pre> <hr> <p><strong>EDIT 3</strong></p> <p>On response to Kyle Renfro follow-up:</p> <blockquote> <p>Kyle says:</p> <blockquote> <p>"At the first view of the page, if you press the "CREATE TICKET" button with nothing in any of the inputTexts and no files uploaded, do the message tags work for the inputTexts? (ie. required = true) I'm just curious if the messages for the inputTexts are working but the message for the inputFileUpload is not." </p> </blockquote> </blockquote> <p>Here is the behavior found:<br> 1.- There is no validation error messages shown at all (the message tags don't work) Even when I try to test only one validation error message (for example, testing the message for the first input text) none of them shows up.<br> 2.- The eclipse console shows me these internal errors: </p> <pre><code>ERROR [HtmlMessageRendererBase] Could not render Message. Unable to find component 'ticket_id' (calling findComponent on component 'j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:j_id_jsp_1716158401_5j_id_1'). If the provided id was correct, wrap the message and its component into an h:panelGroup or h:panelGrid. ERROR [HtmlMessageRendererBase] Could not render Message. Unable to find component 'description' (calling findComponent on component 'j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:j_id_jsp_1716158401_8j_id_1'). If the provided id was correct, wrap the message and its component into an h:panelGroup or h:panelGrid. ERROR [HtmlMessageRendererBase] Could not render Message. Unable to find component 'attachment' (calling findComponent on component 'j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:j_id_jsp_1716158401_14j_id_1'). If the provided id was correct, wrap the message and its component into an h:panelGroup or h:panelGrid. </code></pre> <p>Here is when I saw the <code>"j_id_1"</code> word at the generated IDs, for example, for the id "ticket_id": </p> <pre><code>j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:j_id_jsp_1716158401_5j_id_1 </code></pre> <p>And, viewing the resulting HTML generated page, I saw that the IDs names are like this (whitout using "ForceId" atribute): </p> <pre><code>&lt;input id="j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:ticket_idj_id_1" name="j_id_jsp_1383779881_1:subview_tab_detail:j_id_jsp_1716158401_0j_id_1:ticket_idj_id_1"&gt; </code></pre> <hr>
<p>The <em>forceId</em> attribute of the tomahawk components should solve this problem.</p> <p>something like:</p> <pre><code>&amp;lt;t:outputText id="xyz" forceId="true" value="#{mybean.stuff}"/&amp;gt; </code></pre> <p>At the first view of the page, if you press the "CREATE TICKET" button with nothing in any of the inputTexts and no files uploaded, do the message tags work for the inputTexts? (ie. required = true) I'm just curious if the messages for the inputTexts are working but the message for the inputFileUpload is not. </p>
<p>The <em>forceId</em> attribute of the tomahawk components should solve this problem.</p> <p>something like:</p> <pre><code>&amp;lt;t:outputText id="xyz" forceId="true" value="#{mybean.stuff}"/&amp;gt; </code></pre> <p>At the first view of the page, if you press the "CREATE TICKET" button with nothing in any of the inputTexts and no files uploaded, do the message tags work for the inputTexts? (ie. required = true) I'm just curious if the messages for the inputTexts are working but the message for the inputFileUpload is not. </p>
9,247
<p>I have an Ender 3 V1 with a glass Creality plate. I was having difficulty using manual levelling and my prints were struggling, so I ordered a 3DTouch. I have installed the 3DTouch and used Creality's BLTouch firmware. But my bed is still not level.</p> <p>So my build is an Ender 3 V1 with:</p> <ul> <li>Extruder upgraded to all-metal extruder</li> <li>Glass bed upgrade</li> <li>3DTouch Upgrade</li> <li>Capricorn Tubing</li> <li>Yellow bed springs</li> </ul> <p>I manually levelled my bed using my 3DTouch. I used the <code>G30</code> command in <code>Pronterface</code> to probe each corner of the plate. At each corner, I would adjust the knob until the 3DTouch read 0.0. I did this iteratively multiple times until I thought it was reasonably level. The four corner values were something like 0.1, 0.0, -0.2, and 0.3 mm.</p> <p>I have also put a straight edge with an Angle Finder Phone App. The bed is quite level. It reads 0, 1, or 2° depending on how I place the level. X-axis gantry has a 1° tilt.</p> <p>Here is my current bed levelling mesh:</p> <p><a href="https://i.stack.imgur.com/kepvq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kepvq.png" alt="My mesh bed levelling result" /></a></p> <p>After doing this, I added <code>G29</code> after <code>G28</code> in my starting G-Code in Cura. I sliced a model from Thingiverse that had 5 squares and some lines. Here are the results:</p> <p><a href="https://i.stack.imgur.com/we8Sk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/we8Sk.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/XWZZB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWZZB.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/ONbBq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ONbBq.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/h3aib.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h3aib.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/YBnku.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YBnku.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/O7gkY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O7gkY.jpg" alt="enter image description here" /></a></p> <p>I am using:</p> <ul> <li>Filament : PLA</li> <li>Bed Temp : 60 °C</li> <li>Nozzle Temp : 200 °C</li> </ul> <p>Some miscellaneous notes:</p> <ul> <li>The bed was cleaned thoroughly prior to use</li> <li>I rotated the bed 90° and the print looked the exact same way</li> <li>I ensured that the bed soaked in some heat for some time prior to printing</li> <li>I have set my Z offset to -1.800 mm</li> <li>The frame and components seem to be square and tightened down. Nothing is shaking around and seems to be in order.</li> </ul> <p>I would really appreciate help on this. I'm really not sure what to do next. I've been really excited about 3D printing and I hope I can find a solution to this.</p> <p><strong>Leveling using CHEP's video</strong></p> <p>So I have rebuilt my 3D printer using CHEP's video. I noticed that one or two things were off compared to how it was supposed to be. I will be doing some test prints to see if that actually fixed things. I am hopeful.</p> <p>I did a mesh before any other changes, and the slant is very clear now. See below. I believe one of the plates on the gantry wasn't completely straight.</p> <p><a href="https://i.stack.imgur.com/XjTYg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjTYg.png" alt="enter image description here" /></a></p> <p><strong>Leveling after rebuilding printer</strong></p> <p>Here is my latest mesh, after rebuilding the printer and then re-levelling its bed manually.</p> <p><a href="https://i.stack.imgur.com/fn3G9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fn3G9.png" alt="enter image description here" /></a></p> <p>These are the results of the print. I had to change my Z offset to -1.60 mm. The broken line is my fault. It was caused by my finger. The focus is the corners. As I mentioned, this is after rebuilding my printer.</p> <p><a href="https://i.stack.imgur.com/JFJ6U.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JFJ6U.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/xyD3N.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xyD3N.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/P3fjP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P3fjP.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/b6IWZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6IWZ.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/2oNF7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2oNF7.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/MR0WM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MR0WM.jpg" alt="enter image description here" /></a></p> <p><strong>Edit</strong></p> <p>I would like to have more probing points than Creality's 3x3 grid. To my understanding, Creality's source code is not available, and so I will be rolling my own with Marlin 2.0. I downloaded the latest Marlin from <a href="https://github.com/MarlinFirmware/Marlin/releases" rel="nofollow noreferrer">https://github.com/MarlinFirmware/Marlin/releases</a>, and copied the 4.2.2 Creality configuration from the default Configurations. I then changed the following:</p> <ol> <li>I ensured <code>#define PDITEMP</code> is not commented so that I can do PID tuning of the nozzle.</li> <li>Similar to 1., I ensured that <code>#define PIDTEMPBED</code> is not commented so that I can do PID tuning of the bed.</li> <li>I commented <code>#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN</code> since I will be using the 5-pin BLTouch port that is on my 4.2.2. board.</li> <li>I uncommented <code>#define USE_PROBE_FOR_Z_HOMING</code> since I removed my z-axis endstop and want to use my 3DTouch as the z endstop.</li> <li>Uncommented <code>#define BLTOUCH</code> since the 3DTouch is a BLTouch clone.</li> <li>Changed my x and y offsets in the setting <code>#define NOZZLE_TO_PROBE_OFFSET { -42, -8, 0 }</code>. I left the z-offset 0, since I will be using the tuning tool to adjust that and observe the squish. For the x and y, I measured the distance between my probe and the nozzle using a digital caliper.</li> <li>I adjusted the probe margin from 10 to 15, since I have clips that previously would interfere with the 3DTouch. 15 should give more distance. <code>#define PROBING_MARGIN 15</code></li> <li>I enabled and set MULTIPLE_PROBING to 3. I'm paranoid about the current accuracy, and am willing to see if that improves anything at the expense of a few additional minutes. <code>#define MULTIPLE_PROBING 3</code>. I think 2 should be fine for general use.</li> <li>Uncommented <code>#define Z_MIN_PROBE_REPEATABILITY_TEST</code>. I want to test my 3DTouch and uncommenting allows the use of M48 to test it.</li> <li>Uncommented <code>#define PROBING_FANS_OFF</code>, <code>#define PROBING_ESTEPPERS_OFF</code>, <code>#define PROBING_STEPPERS_OFF</code>, <code>#define DELAY_BEFORE_PROBING 200</code>. The documentation this may improve probing results. I'm all in.</li> <li>Uncommented <code>#define NO_MOTION_BEFORE_HOMING</code> and <code>#define HOME_AFTER_DEACTIVATE</code>.</li> <li>Uncommented <code>#define AUTO_BED_LEVELING_BILINEAR</code></li> <li>Uncommented <code>#define RESTORE_LEVELING_AFTER_G28</code>. This is to ensure the mesh is applied even after G28, which disables the mesh otherwise.</li> <li>Ensures that this setting was 10. <code>#define DEFAULT_LEVELING_FADE_HEIGHT 10.0</code></li> <li>I set the following : <code>#define GRID_MAX_POINTS_X 7</code>. Ensures a 7x7 mesh grid is created. This could be more or less. 49 points is an improvement over Creality's 9, although a bit much. Worthwhile in my case.</li> <li>Uncommented <code>#define EXTRAPOLATE_BEYOND_GRID</code>. I was actually wondering if this was causing some of the inconsistent prints near the edge.</li> <li>Uncommented <code>#define LCD_BED_LEVELING</code>. This is to unlock more options for ABL in the menu.</li> <li>Uncommented <code>#define LEVEL_BED_CORNERS</code>. This should make moving between corners for manual levelling easier.</li> <li>Uncommented <code>#define LEVEL_CORNERS_USE_PROBE</code>. This is to achieve exactly what I was doing with G30 in Pronterface. I changed to tolerance with <code>#define LEVEL_CORNERS_PROBE_TOLERANCE 0.03</code></li> <li>Uncommented <code>#define Z_SAFE_HOMING</code>, which is important for the BLTouch.</li> <li>Changed my PLA profile according to what I have determined to be best with <code>#define PREHEAT_1_TEMP_HOTEND 200</code> and <code>#define PREHEAT_1_TEMP_BED 60</code></li> </ol> <p>I had to comment <code>#define BLTOUCH_SET_5V_MODE</code> for things to compile. I also had to modify <code>#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 45, 45 }</code>, due to the margin I set as well as the offset of my touch. Otherwise, the above configuration was fine, in terms of compilation.</p> <p>I'll post back with the results.</p> <p>Here are the results for the M48 3DTouch test. Are these values good?</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Measurement</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>Mean</td> <td>0.063667</td> </tr> <tr> <td>Min</td> <td>0.061</td> </tr> <tr> <td>Max</td> <td>0.068</td> </tr> <tr> <td>Range</td> <td>0.007</td> </tr> <tr> <td>STD</td> <td>0.002478</td> </tr> </tbody> </table> </div> <p>I reduced the speed of the probing in half in order to make the probing more accurate. This was done by changing from <code>#define Z_PROBE_FEEDRATE_FAST (4*60)</code> to <code>#define Z_PROBE_FEEDRATE_FAST (2*60)</code>. I also made the mesh grid 8x8 because might as well.</p> <p>These are my M48 repeatability results. Interesting to compare to the above table which probed at double the speed.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Measurement</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>Mean</td> <td>0.005500</td> </tr> <tr> <td>Min</td> <td>0.002</td> </tr> <tr> <td>Max</td> <td>0.010</td> </tr> <tr> <td>Range</td> <td>0.008</td> </tr> <tr> <td>STD</td> <td>0.001908</td> </tr> </tbody> </table> </div> <p>I also changed the filament (brand new). Just as another variable to modify.</p> <p>The following prints are the result.</p> <p>The mesh before this print is as follows:</p> <p><a href="https://i.stack.imgur.com/tk0TQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tk0TQ.png" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/MJAWB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MJAWB.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/v9LPr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v9LPr.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/JVV4Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JVV4Y.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/MndtV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MndtV.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/IE4eq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IE4eq.jpg" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/LY47R.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LY47R.jpg" alt="enter image description here" /></a></p> <p><strong>Levelling the X-Axis Gantry</strong></p> <p>As Oscar in the comments has mentioned, I have read some other forum posts that described the cause of uneven lines and similar inconsistencies as what I am noticing, as being due to the X-axis Gantry that moves up and down as not being level.</p> <p>I used a digital caliper and measured the x axis gantry relative to the frame of the 3D printer. So for example, I put my caliper against the base metal extrusion and then against the x-axis gantry. I did this on both sides.</p> <p>The side without the Z-Axis lead screw (right side) was above the side with the Z-Axis lead screw (left side) by about 1.7mm. I'm surprised that CHEP and some other build videos never mentioned to check this, but it does seem logical to consider. Making the brackets flush is NOT adequate. When I do make it flush, then one side is higher than the other. The build videos say to make it flush. This will make things OFF.</p> <p>To adjust this, I took off the gantry, slightly loosened the bolts on both side plates, so that it was stiff enough that it wouldn't move easily, but could make subtle adjustments by twisting it hard enough. I then put the gantry back on the printer, did some measurements and corresponding adjustments. I then carefully threaded the gantry off and tightened the plates.</p> <p>Currently, my left and right side have a difference of .17mm. I figured I won't get anything better by hand. I'll do another test print tonight. 1.7mm vs .17mm is a reasonable difference.</p>
<p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can often determine the stepper drivers by one of a few ways:</p> <ol> <li><p>Listen to the sound. The 'TMC22**' will sound much quieter</p> </li> <li><p>Look for a marking in Sharpie on the SD Card reader</p> <pre><code>C = HR4998 E = A4988 A = TMC2208 B = TMC2209 H = TMC2225 </code></pre> </li> <li><p>Remove the heat sync</p> <p><a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995480295" rel="nofollow noreferrer">https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995480295</a></p> <p>After removing the heat sync, it appears that the Chip is actually a <code>MS35775</code></p> <p><a href="https://i.stack.imgur.com/0o5mK.jpg" rel="nofollow noreferrer" title="Closeup of MS35775 on board"><img src="https://i.stack.imgur.com/0o5mK.jpg" alt="Closeup of MS35775 on board" title="Closeup of MS35775 on board" /></a></p> </li> </ol>
<p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p> <ul> <li>2-Phase stepping motor peak current of 2A</li> <li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li> <li>Internal 256 micro steps</li> <li>Quiet mode</li> <li>Fast mode</li> <li>HS Rdson 0.29 Ω ,LS Rdson 0.28 Ω</li> <li>Voltage range 4.75 ~ 36V</li> <li>When the motor is still, it will enter into the power saving mode automatically</li> <li>Internal resistor mode is optional (no need for external sense resistor)</li> <li>Single wire UART bus and OTP control</li> <li>QFN28 package</li> </ul>
2,074
<p>I've observed printing PETG that the primary if not the only reason for using a high bed temperature seems to be preventing the bed from acting as a huge heat sink and rapidly cooling the initial layers such that they don't bond well to each other. In particulat, the heat is not needed for adhesion-to-the-bed purposes. This got me thinking whether there's a way we could get rid of the requirement, as a way to save time and all the energy spent heating the bed and cooling the room it's eventually dumped into.</p> <p>With that in mind, are there viable bed materials that are good thermal insulators? Just putting down a layer of any insulating material between the underlying bed and buildtak or whatever surface you want might work, but I would think these kinds of print surfaces are designed for moderate to high thermal conductivity themselves, and wouldn't be as bad a heat sink as the underlying metal, but might still sap a noticable amount of heat out of the part right away.</p>
<p>You can place a 2-4 mm thick MDF board on the bed and print directly on it, or you can place a 2 mm thick cork foil (IKEA office desk supplies) between magnetic plate and aluminium heater. The magnetic plate should not absorb too much heat and the cork will avoid conduction to the aluminium heater.</p> <p>If you want to avoid the magnetic plate, print on paper/cardboard on top of cork.</p>
<p>I’m pretty sure it can be brought separately but usually comes with a lot of heat-beds; It is a type of foam that has adhesive on one side and aluminum foil on the other. <a href="https://www.ebay.com.au/itm/3D-Printer-Parts-Heat-Insulation-Cotton-200-220-300mm-Foil-cotton-3D-printer-/193735774067?_trksid=p2349624.m46890.l49286" rel="nofollow noreferrer">Here</a> is an example of what I mean:</p> <p><a href="https://i.stack.imgur.com/R9Qw9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R9Qw9.jpg" alt="Bed insulation material" /></a></p>
1,945
<p>I am charged with designing a web application that displays very large geographical data. And one of the requirements is that it should be optimized so the PC still on dial-ups common in the suburbs of my country could use it as well.</p> <p>Now I am permitted to use Flash and/or Silverlight if that will help with the limited development time and user experience.</p> <p>The heavy part of the geographical data are chunked into tiles and loaded like map tiles in Google Maps but that means I need a lot of HTTP requests.</p> <p>Should I go with just javascript + HTML? Would I end up with a faster application regarding Flash/Silverlight? Since I can do some complex algorithm on those 2 tech (like DeepZoom). Deploying desktop app though, is out of the question since we don't have that much maintenance funds.</p> <p>It just needs to be fast... really fast..</p> <p>p.s. faster is in the sense of "download faster"</p>
<p>Is something like <a href="http://gears.google.com/" rel="nofollow noreferrer">Gears</a> acceptable? This will let you store data locally to limit re-requests.</p> <p>I would also stay away from flash and Silverlight and go straight to javascript/AJAX. jQuery is a ton-O-fun.</p>
<p>I believe Microsoft's <a href="http://livelabs.com/seadragon/" rel="nofollow noreferrer">Seadragon</a> is your answer. However, I am not sure if that is available to developers.</p> <p>It looks like some of it has found its way into Silverlight</p>
4,808
<p>Sometimes when I'm editing page or control the .designer files stop being updated with the new controls I'm putting on the page. I'm not sure what's causing this to happen, but I'm wondering if there's any way of forcing Visual Studio to regenerate the .designer file. I'm using Visual Studio 2008</p> <p><strong>EDIT:</strong> Sorry I should have noted I've already tried:</p> <ul> <li>Closing &amp; re-opening all the files &amp; Visual Studio</li> <li>Making a change to a runat="server" control on the page</li> <li>Deleting &amp; re-adding the page directive</li> </ul>
<p>If you open the .aspx file and switch between design view and html view and back it will prompt VS to check the controls and add any that are missing to the designer file.</p> <p>In VS2013-15 there is a <strong>Convert to Web Application</strong> command under the <strong>Project</strong> menu. Prior to VS2013 this option was available in the right-click context menu for as(c/p)x files. When this is done you should see that you now have a *.Designer.cs file available and your controls within the Design HTML will be available for your control.</p> <p>PS: This should not be done in debug mode, as not everything is "recompiled" when debugging.</p> <p>Some people have also reported success by (making a backup copy of your .designer.cs file and then) deleting the .designer.cs file. Re-create an empty file with the same name.</p> <p>There are many comments to this answer that add tips on how best to re-create the designer.cs file.</p>
<ol> <li>replace your custom tag with a invalid tag name. Save it</li> <li>restore the invalid tag name back to custom tag name. Save it. Then you will be prompted to checkout the *.designer.cs files(or silently modify the designer.cs) and produce correct variable of custom tag control.</li> </ol>
6,717
<p>I know I need to have (although I don't know why) a <code>GROUP BY</code> clause on the end of a SQL query that uses any aggregate functions like <code>count</code>, <code>sum</code>, <code>avg</code>, etc:</p> <pre><code>SELECT count(userID), userName FROM users GROUP BY userName </code></pre> <p>When else would <code>GROUP BY</code> be useful, and what are the performance ramifications?</p>
<p>To retrieve the number of widgets from each widget category that has more than 5 widgets, you could do this:</p> <pre><code>SELECT WidgetCategory, count(*) FROM Widgets GROUP BY WidgetCategory HAVING count(*) &gt; 5 </code></pre> <p>The "having" clause is something people often forget about, instead opting to retrieve all their data to the client and iterating through it there.</p>
<p>GROUP BY also helps when you want to generate a report that will average or sum a bunch of data. You can GROUP By the Department ID and the SUM all the sales revenue or AVG the count of sales for each month.</p>
2,479
<p>I am trying to create a web application using Pylons and the resources on the web point to the <a href="http://pylonsbook.com/alpha1/authentication_and_authorization" rel="noreferrer">PylonsBook</a> page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work easily with Pylons?</p> <p>I tried downloading the <a href="http://pypi.python.org/pypi/SimpleSiteTemplate/" rel="noreferrer">SimpleSiteTemplate</a> from the cheeseshop but wasn't able to run the setup-app command. It throws up an error:</p> <pre><code> File "/home/cnu/env/lib/python2.5/site-packages/SQLAlchemy-0.4.7-py2.5.egg/sqlalchemy/schema.py", line 96, in __call__ table = metadata.tables[key] AttributeError: 'module' object has no attribute 'tables' </code></pre> <p>I use Pylons 0.9.7rc1, SQLAlchemy 0.4.7, Authkit 0.4.</p>
<p>Ok, another update on the subject. It seems that the cheeseshop template is broken. I've followed the chapter you linked in the post and it seems that authkit is working fine. There are some caveats:</p> <ol> <li>sqlalchemy has to be in 0.5 version</li> <li>authkit has to be the dev version from svn (easy_install authkit==dev)</li> </ol> <p>I managed to get it working fine.</p>
<p>This actually got me interested:<a href="http://groups.google.com/group/pylons-discuss/browse_thread/thread/644deb53612af362?hl=en" rel="nofollow noreferrer">Check out this mailing on the pylons list</a>. So AuthKit is being developed, and I will follow the book and get back on the results.</p>
7,006
<p>I'm thinking of starting a wiki, probably on a low cost LAMP hosting account. I'd like the option of exporting my content later in case I want to run it on <code>IIS/ASP.NET</code> down the line. I know in the weblog world, there's an open standard called BlogML which will let you export your blog content to an <strong>XML</strong> based format on one site and import it into another. Is there something similar with wikis?</p>
<p>The correct answer is ... "it depends".</p> <p>It depends on which wiki you're using or planning to use. I've used various over the years <a href="http://moinmo.in/" rel="noreferrer">MoinMoin</a> was ok, used files rather than database, <a href="https://help.ubuntu.com/" rel="noreferrer">Ubuntu</a> seem to like it. <a href="http://www.mediawiki.org/wiki/MediaWiki" rel="noreferrer">MediaWiki</a>, everyone knows about and <a href="http://jamwiki.org" rel="noreferrer">JAMWiki</a> is a java clone(ish) of MediaWiki with the aim to be markup compatible with MediaWiki, both use databases and you can generally connect whichever database you want, JAMWiki is pre-configured to use an internal HSQLDB instance.</p> <p>I recently converted about 80 pages from a MoinMoin wiki into JAMWiki pages and this was probably 90% handled by a tiny perl script I found somewhere (I'll provide a link if I can find it again). The other 10% was unfortunately a by-hand experience (they were of the utmost importance with them being recipies for the missus) ;-)</p> <p>I also recently setup a Mediawiki instance for work and that took all of about 8 minutes to do. So that'd be my choice.</p>
<p>I haven't heard of WikiML.</p> <p>I think your biggest obstacle is gonna be converting one wiki markup to another. For example, some wikis use markdown (which is what Stack Overflow uses), others use another markup syntax (e.g. BBCode, ...), etc.. The bottom line is - assuming the contents are databased it's not impossible to export and parse it to make it "fit" in another system. It might just be a pain in the ass.</p> <p>And if the contents are not databased, it's gonna be a royal pain in the ass. :D</p> <p>Another solution would be to stay with the same system. I am not sure what the reason is for changing the technology later on. It's not like a growing project requires IIS/ASP.NET all of the sudden. (It might just be the other way around.) But for example, if you could stick with PHP for a while, you could also run that on IIS.</p>
5,980
<p>I have been trying to print an object that is 4 inches tall. About at 3 inches it falls off the bed. I am using tape on the heated bed and right before the print I am wiping the bed with rubbing alcohol. After the first time I tried hot gluing it to the bed when it was mid way through so that it wouldn't fall off but that didn't work. I am printing at 185°C and the bed is 55°C. I am using PLA to print. Should I increase the temperature of the bed or is there something else that is wrong?</p>
<p>Even though knowing the model of printer is slightly helpful, it's not critical to making your print work. Your PLA manufacturer should have recommendations for both the bed temperature and the nozzle temperature. Is your print bed glass or metal?</p> <p>As an example, my bed is glass and I set the temperature to 70°C for PLA, but the real temperature at the bed is slightly lower than that. </p> <p>I'm using 3M brand blue painters tape. What type of tape are you using? It will make a difference. I originally used cleaner on the tape, but found it was not needed. Blue tape means parts stick so well that you have to get them free before the bed cools too much, or you'll have to remove the tape to get the part free.</p> <p>My PLA nozzle temperature settings range from 190°C to 230°C, depending on the filament. I use the manufacturer's figures and vary them five to ten degrees depending on the results.</p> <p>Too hot at the nozzle will burn the filament possibly causing a clog, while too cold will cause extruder feeding problems. You did not reference having feeding problems, which implies your nozzle settings are acceptable.</p> <p>Consider to change your tape and to increase the bed temperature. At a 55°C starting point, you could jump five degrees at a time until you get a good bond.</p> <p>Also be certain that your bed is level and properly calibrated. The first layer should apply in a slightly "squashed" manner. Too close and the nozzle tears up the tape, but too far and the filament will sit on top and not properly adhere.</p>
<p>If you have a dual-extruder printer, your second nozzle could be hitting the part. As the print grows taller, each hit with the nozzle has more chance to knock the part off the build plate.</p> <p>This can happen from some of the following reasons:</p> <ul> <li>Nozzles aren't level to each other</li> <li>Build plate is not level</li> <li>Material oozed and solidify on second nozzle. (Similar to nozzles aren't level)</li> </ul>
530
<p>Does anyone know if silverlight plugs into chrome, or when they plan to support it?</p>
<p>This guy have had partial success with silverlight in chrome, but it does not seem to be supported:</p> <p><a href="http://wildermuth.com/2008/09/02/Silverlight_2_and_Google_Chrome" rel="nofollow noreferrer">http://wildermuth.com/2008/09/02/Silverlight_2_and_Google_Chrome</a></p> <p>From The Microsoft Silverlight Team in the <a href="http://silverlight.net/forums/t/24044.aspx" rel="nofollow noreferrer">silverlight forum</a>:</p> <blockquote> <p>Hello, currently we don't have plans to support Chrome. We will support it in the future if it gains enough market share. Please understand, each browser implements the plug-in model differently, so it'll be a lot of effort to officially support a browser 100%... By the way, IE 8 also runs each tab in its own process. If a tab crashes, other tabs will still work fine.</p> </blockquote> <p><strong>UPDATE:</strong></p> <p>Jon Galloway has just posted instructions on how to get silverlight successfully running on Chrome here:</p> <p><a href="http://weblogs.asp.net/jgalloway/archive/2008/09/17/running-silverlight-2-on-google-chrome-using-the-chrome-dev-channel.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/jgalloway/archive/2008/09/17/silverlight-on-chrome.aspx</a></p>
<p>Silverlight already works with web-kit, and since Google's Chrome is based on web-kit, it shouldn't be too much effort to get it working.</p> <p>Indeed, <a href="http://bits.samiq.net/2008/09/silverlight-and-flash-running-on-google.html" rel="nofollow noreferrer">this</a> gentleman seems to have had some success.</p> <p>Based on this, I would suspect that Silverlight will be fully supported by Chrome by the time it goes gold. </p>
7,322
<p>I need to grab the <code>base64-encoded</code> representation of the <code>ViewState</code>. Obviously, this would not be available until fairly late in the request lifecycle, which is OK.</p> <p>For example, if the output of the page includes:</p> <pre><code>&lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODU0Njc5MD...==" /&gt; </code></pre> <p>I need a way on the server-side to get the value <code>"/wEPDwUJODU0Njc5MD...=="</code></p> <p>To clarify, I need this value when the page is being rendered, not on PostBack. e.g. I need to know the ViewState value that is being <em>sent</em> to the client, not the ViewState I'm getting back from them.</p>
<p>Rex, I suspect a good place to start looking is solutions that <strong>compress the ViewState</strong> -- they're grabbing ViewState on the server before it's sent down to the client and gzipping it. That's exactly where you want to be.</p> <ul> <li><a href="http://www.hanselman.com/blog/CommentView,guid,febce059-7e7c-439e-af3d-c53d250b3e9c.aspx" rel="noreferrer">Scott Hanselman on ViewState Compression</a> (2005)</li> <li><a href="http://www.bloggingdeveloper.com/post/How-To-Compress-ViewState-in-ASPNET-20-ViewState-Compression-with-SystemIOCompression.aspx" rel="noreferrer">ViewState Compression with System.IO.Compression</a> (2007)</li> </ul>
<p>See this <a href="http://aspguy.wordpress.com/2008/07/09/reducing-the-page-size-by-storing-viewstate-on-server/" rel="nofollow noreferrer">blog post</a> where the author describes a method for overriding the default behavior for generating the ViewState and instead shows how to save it on the server Session object.</p> <blockquote> <p>In ASP.NET 2.0, ViewState is saved by a descendant of PageStatePersister class. This class is an abstract class for saving and loading ViewsState and there are two implemented descendants of this class in .Net Framework, named HiddenFieldPageStatePersister and SessionPageStatePersister. By default HiddenFieldPageStatePersister is used to save/load ViewState information, but we can easily get the SessionPageStatePersister to work and save ViewState in Session object.</p> </blockquote> <p>Although I did not test his code, it seems to show exactly what you want: a way to gain access to ViewState code while still on the server, before postback. </p>
2,341
<p>An <a href="https://stackoverflow.com/questions/15241/does-anyone-have-any-real-world-experience-of-csla#15357">answer</a> to a Stack Overflow question stated that a particular framework violated a plain and simple OOP rule: Single Responsibility Principle (SRP).</p> <p><strong>Is the Single Responsibility Principle <em>really</em> a rule of OOP?</strong></p> <p>My understanding of the definition of Object Orientated Programming is "a paradigm where objects and their behaviour are used to create software". This includes the following techniques: Encapsulation, Polymorphism &amp; Inheritance.</p> <p>Now don't get me wrong - I believe SRP to be the key to most good OO designs, but I feel there are cases where this principle can and should be broken (just like database normalization rules). I aggressively push the benefits of SRP, and the great majority of my code follows this principle. </p> <p><em>But, is it a rule, and thus implies that it shouldn't be broken?</em></p>
<p>Very few rules, if any, in software development are without exception. Some people think there are no place for <em>goto</em> but they're wrong. </p> <p>As far as OOP goes, there isn't a single definition of object-orientedness so depending on who you ask you'll get a different set of hard and soft principles, patterns, and practices.</p> <p>The classic idea of OOP is that messages are sent to otherwise opaque objects and the objects interpret the message with knowledge of their own innards and then perform a function of some sort.</p> <p>SRP is a software engineering principle that can apply to the role of a class, or a function, or a module. It contributes to the cohesion of something so that it behaves well put together without unrelated bits hanging off of it or having multiple roles that intertwine and complicate things.</p> <p>Even with just one responsibilty, that can still range from a single function to a group of loosely related functions that are part of a common theme. As long as you're avoiding jury-rigging an element to take the responsibilty of something it wasn't primarily designed for or doing some other ad-hoc thing that dilute the simplicity of an object, then violate whatever principle you want.</p> <p>But I find that it's easier to get SRP correct then to do something more elaborate that is just as robust.</p>
<p>SRP is just another expression of ISP :-) . </p> <p>And the "P" means "principle" , not "rule" :D </p>
3,624
<p>I am trying to implement an "out of proc" COM server written in C#. How do I do this?</p> <p>I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space </p> <p><em>WHY?:</em><br> My C++ code is in a DLL that is loaded into many different customer EXE's, some of which use different versions of the .NET runtime. Since there can only be one runtime loaded into a single process, my best bet seems to be to put my C# code into another process.</p>
<p>You can create COM+ components using System.EnterpriseServices.ServicedComponent. Consequently, you'll be able to create out-of-proc and in-proc (client) component activation as well as all COM+ benefits of pooling, remoting, run as a windows service etc.</p>
<p>I cannot recommend this as <em>the way</em>, but you could create a COM-callable wrapper for your C# library, then create a VB6 ActiveX exe project that delegates calls to your C# library.</p>
5,053
<p>It is very easy to ask questions that only tangentially involve 3D printing, such as:</p> <ul> <li><p>How do I drill a hole in a 3D printed part?</p></li> <li><p>How do I paint 3D printed parts?</p></li> <li><p>How do I sand, smooth, etc...?</p></li> <li><p>How do I take a picture with a 3D printed camera?</p></li> </ul> <p>My last example is clearly not on topic, and the other examples aren't </p> <blockquote> <p>difficult, specific questions — the kind of questions pros and experts ask each other, not the kind of questions novices ask pros.</p> </blockquote> <p>However, the point is that it's very easy to involve 3D printing in a question that isn't about 3D printing. Drilling a hole in a 3D printed part is, for the most part, just like drilling one in wood. Such questions may be more suited for a general DIY/makers-type site.</p> <p>On the other hand, there do exist 3D printing specific issues (for instance, low infill or delamination can be a problem when drilling in a (FDM) 3D printed part).</p> <p>At what point does a question involving 3D printing become on-topic for our site? Should questions identify a specific issue ("I've tried drilling a hole, now my part has delaminated, what now?")?. Queries for general advice and best practice don't seem to fit the bill of being difficult and specific.</p>
<p>The dividing line of "tangentially off topic" is typically when the <em>actual</em> subject of the question being asked is only <strong><em>coincidentally</em></strong> adjacent to 3D printing. </p> <p>Here is a <em>clear</em> example illustrating the "tangential issue:"</p> <blockquote> <p>I printed a crane mechanism in 3D. How much voltage must I apply to the motor to lift 150 grams?</p> </blockquote> <p>I see this type of thing all the time. Users will go to the mat arguing that they are printing in 3D, so their question is on topic. It is not. The actual <em>expertise</em> needed to answer this question is in electronics. With a question like this, the premise that the user <em>happens</em> to be printing in 3D is entirely coincidental to the actual issue. </p> <p>The examples you cited above are a bit more iffy. I might argue some of them could (potentially) be on topic&hellip; if the issue of the material being printed in 3D is somehow germane to the problem. I actually don't know enough about the subject to say, so I'm only considering the possibility that it <em>is</em> relevant to this subject space.</p> <p>Let's not be too quick to start barring questions that aren't explicitly about the physical process of 3D printing literally. There are a lot of <em>industry issues</em> that could be interesting to include here. It's probably better to <strong><em>wait for actual examples before trying to create a general rule around this issue.</em></strong></p> <p>As a general rule for building this site, it is often better to wait for a preponderance of problems that occur <em>in actual practice</em> before we start seeking to create a lot of rules around hypothetical situations. Words to live by.</p>
<p>The problem with the questions you raised are (except for the camera one) that they are all about dealing with the materials that are used with 3D-printing and not about the mechanics of printing. But when I started 3D-printing, that's certainly where a large part of my questions lay. It's because the materials are DIFFERENT than ones we're used to dealing with, and if it weren't for 3D-printing, I wouldn't have been working with them then. It's BECAUSE I was 3D-printing that the questions arose. There are certainly similarities between the materials used for 3D-printing and other materials we might run into, but there are also vast differences. For example, ABS is the same plastic that we know from Legos. But how does working with the plastic that's been 3D-printed differ from working with a Lego? I would consider any question about that area to be valid. You mention drilling plastic, but then got the answer wrong. It is NOT like drilling wood; the way you drill plastic should be different from how you deal with wood, such as the speeds used and the use of hand drills. There are even special plastic bits that you can buy that make it easier to drill plastic. Good questions might be: for PLA, ABS and other 3dpg plastics, when is it appropriate to use such bits and when can you get away with using high speed drill bits like you would use for wood? Are higher drill speeds better than lower speeds for some 3D-printed plastics and not others, or vice versa?</p> <p>In summary, I feel that questions about a technique or material that is being used in the 3D-printing process, or dealing with the materials afterward, should be valid because 3D-printing changes how the techniques are done or the materials are dealt with.</p>
7
<p>As <a href="https://blog.stackoverflow.com/2008/09/podcast-20/">Jeff Atwood asked</a>: &quot;What’s your logging philosophy? Should all code be littered with <code>.logthis()</code> and <code>.logthat()</code> calls? Or do you inject logging after the fact somehow?&quot;</p>
<p>My logging philosophy is pretty easily summarized in four parts:</p> <p>Auditing, or business logic logging</p> <blockquote> <p>Log those things that are required to be logged. This comes from the application requirements, and may include logging every change made to any database (as in many financial applications) or logging accesses to data (as may be required in the health industry to meet industry regulations)</p> <p>As this is part of the program requirements many do not include it in their general discussions of logging, however there is overlap in these areas, and for some applications it is useful to consider all logging activities together.</p> </blockquote> <p>Program logging</p> <blockquote> <p>Messages which will help developers test and debug the application, and more easily follow the data flow and program logic to understand where implementation, integration, and other errors may exist.</p> <p>In general this logging is turned on and off as needed for debugging sessions.</p> </blockquote> <p>Performance logging</p> <blockquote> <p>Add later logging as needed to find and resolve performance bottlenecks and other program issues which aren't causing the program to fail, but will lead to better operation. Overlaps with Program logging in the case of memory leaks and some non-critical errors.</p> </blockquote> <p>Security logging</p> <blockquote> <p>Logging user actions and interactions with external systems where security is a concern. Useful for determining how an attacker broke a system after an attack, but may also tie into an intrusion detection system to detect new or ongoing attacks.</p> </blockquote>
<p>I agree with Adam, but I also would consider logging things of interest or things that you can demonstrate as achievements as a kind of proof of them happening.</p>
6,633
<p>This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model. I usually end up adding a method named EvChanged to indicate a .Net event Changed.</p> <p>What is the right way to show that a type publishes a specific event?</p>
<p>Just add an «event» stereotype to a classifier attribute.</p>
<p>Not the type of answer that I like to give, but <a href="http://office.microsoft.com/en-us/visio/HP815503691033.aspx" rel="nofollow noreferrer">Microsoft</a> has an answer on the Office website.</p>
7,452
<p>I am playing with Microsoft's TreeView control and I am trying to force a data update of some sorts while editing a node's label, similar to UpdateData for a grid.</p> <p>Basically, in my editor, I have a Save button and this TreeView control: what I want is when I am editing a node's label in the TreeView, if I click on the Save button I want to be able to commit the node's label I was editing.</p>
<p><code>volatile</code> is needed if you are reading from a spot in memory that, say, a completely separate process/device/whatever may write to.</p> <p>I used to work with dual-port ram in a multiprocessor system in straight C. We used a hardware managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did this:</p> <pre><code>void waitForSemaphore() { volatile uint16_t* semPtr = WELL_KNOWN_SEM_ADDR;/*well known address to my semaphore*/ while ((*semPtr) != IS_OK_FOR_ME_TO_PROCEED); } </code></pre> <p>Without <code>volatile</code>, the optimizer sees the loop as useless (The guy never sets the value! He's nuts, get rid of that code!) and my code would proceed without having acquired the semaphore, causing problems later on.</p>
<p>One use I should remind you is, in the signal handler function, if you want to access/modify a global variable (for example, mark it as exit = true) you have to declare that variable as 'volatile'.</p>
9,816
<p>I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown. </p> <p>The blinking input caret is confusing. How do I hide it?</p>
<p>You can do through a win32 call</p> <pre><code>[DllImport("user32.dll")] static extern bool HideCaret(IntPtr hWnd); public void HideCaret() { HideCaret(someTextBox.Handle); } </code></pre>
<p>AFAIK, this <strong>cannot</strong> be done. The TextBox control is a funny control because it actually has a <em>lot</em> of behaviour that can't be modified due to the way it taps into the operating system. This is why many of the cool custom TextBoxes are written from scratch.</p> <p>I am afraid you may not be able to do what you wish to do :(</p>
6,579
<p>And if you do, can you give some background information on the implementation and the reasons for implementing this pattern?</p> <p>The pattern is described in more detail in these articles:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/ms997506.aspx" rel="nofollow noreferrer">Microsoft Inductive User Interface Guidelines</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/ms951103.aspx" rel="nofollow noreferrer">IUIs and Web-Style Navigation in Windows Forms, Part 1</a> &amp; <a href="http://msdn.microsoft.com/en-us/library/ms951278.aspx" rel="nofollow noreferrer">Part 2</a></li> </ul>
<p>Yes - we had a problem in that many of the administrators of our software found it too difficult to use. To solve this we used Microsoft's WinForms IUI framework build a new configuration and management tool for our software. </p> <p>User feedback has been extremely positive, particularly with everything being task driven - i.e. the links on our home page include thing like "Create new user", "Create new department" - rather then the user having to discover how to do this by clicking through a series of menus. Since the inductive interface is more similar to a web-browser (hypertext links, back/forward buttons) it seems much easier for new users to learn.</p>
<p>You should be careful about making a too simple system. Expert users (bankers, insurers, CRMs, etc) should have as much information an possibilites on the screen as possible. Proceeding through forms that validate slowly has been found to be annyoing if you use that form several times during the workday.</p>
9,620
<p>Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a pop-up that says the usual "This process is no longer responding" message.</p> <p>Console applications work fine, and my Swing code works fine when launching from Netbeans or from the command line. I'm running Windows Vista x64 with the JDK 1.6 Update 10 beta, which may be a configuration the Jetbrains guys haven't run into yet.</p>
<p>Ask your question directly on the IDEA website. They always react fast and the problem you have is probably either fixed or documented.</p>
<p>IDEA 8 Milestone 1 is a beta(ish) "based on a new platform". This may have changed the way that swing is handled. Also you are running a beta JDK.</p> <p>You will probably get more help/submit a bug at the Jetbrain forums unless they are on SO also. <a href="http://www.jetbrains.net/jira/browse/IDEA/" rel="nofollow noreferrer" title="Jetbrains jira tracker">Here is the bug tracker link</a></p>
4,185
<p>We are working on a winforms app in Visual Studio 2005 and the setup project we created output both an MSI and an EXE. We aren't sure what the EXE file is used for because we are able to install without the EXE.</p>
<p>It's a bootstrapper that checks to make sure that the .NET Framework is installed, before launching the MSI. It's pretty handy.</p> <p>I suggest using something like SFX Compiler to package the two together into one self-extracting .exe and then launch the extracted setup.exe. This way you retain the benefits of the bootstrapper, but your users only download a single thing.</p> <p><strong>Edit</strong>: also see</p> <ul> <li>The official line: <a href="http://msdn.microsoft.com/en-us/library/k3bxs9z6(VS.80).aspx" rel="noreferrer">MSDN documentation</a></li> <li>Some bootstrapper customization: <a href="http://www.coversant.net/Coversant/Blogs/tabid/88/EntryID/16/Default.aspx" rel="noreferrer">some guy's blog post about what he did</a></li> </ul>
<p>I think the EXE is just a wrapper/bootstrapper for the MSI in case you don't have Window Installer. If you have the requisite Windows Installer version installed then the MSI should work fine on its own.</p>
6,381
<p>I have a method in .NET (C#) which returns <code>string[][]</code>. When using RegAsm or TlbExp (from the .NET 2.0 SDK) to create a COM type library for the containing assembly, I get the following warning:</p> <blockquote> <p>WARNING: There is no marshaling support for nested arrays.</p> </blockquote> <p>This warning results in the method in question not being exported into the generated type library. I've been told there's ways around this using Variant as the COM return type, and then casting/etc on the COM client side. For this particular assembly, the target client audience is VB6. <b>But how do you actually do this on the .NET side?</b></p> <p><i>Note</i>: I have an existing legacy DLL (with its exported type library) where the return type is Variant, but this DLL (and the .tlb) is generated using pre-.NET legacy tools, so I can't use them. </p> <p>Would it help at all if the assembly was written in VB.NET instead?</p>
<p>Even if you were to return an Object (which maps to a Variant in COM Interop), that doesn't solve your problem. VB will be able to "hold" onto it and "pass it around", but it won't be able to do anything with it.</p> <p>Technically, there is no exact equivalent in VB for a string[][]. However, if your array is not "jagged" (that is, all the sub-arrays are the same length), you should be able to use a two-dimensional array as your return type. COM Interop should be able to translate that.</p> <pre><code>string [,] myReturnValue = new string[rowCount,colCount]; </code></pre> <p>Whether your method formally returns an Object (which will look like a Variant to VB), or a string[,] (which will look like an Array of Strings in VB), is somewhat immaterial. The String array is a nicer return, but not a requirement.</p> <p>If you array <em>is</em> jagged, then you are going to have to come up with a different method. For example, you could choose to make your return 2D array as big as the biggest of the sub-arrays, and then pass the length information in a separate [out] int[] parameter, so that VB can know which elements are used.</p>
<p>The equivalent of variant in C# is System.Object. So you might want to try to return the result cast to object and pick it back up on the other side as a variant.</p> <p>VB doesn't have any facilities that C# lacks, so I doubt it would be better or easier if the .NET side was written in VB.</p>
9,590
<p>I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before dropping the dependent table.</p>
<p>This is extremely messy to write from scratch. Have you considered a 3rd party tool like <a href="http://www.red-gate.com/products/SQL_Dependency_Tracker/index.htm" rel="nofollow noreferrer" title="Red-Gate SQL Dependency Tracker">Red-Gate SQL Dependency Tracker</a>?</p>
<p>You can use the sp_depends stored procedure to do this:</p> <p><code>USE AdventureWorks GO EXEC sp_depends @objname = N'Sales.Customer' ;</code></p> <p><a href="http://msdn.microsoft.com/en-us/library/ms189487(SQL.90).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms189487(SQL.90).aspx</a></p>
7,648
<p>I'm working on some code to colorize an image in Java. Basically what I'd like to do is something along the lines of GIMP's colorize command, so that if I have a BufferedImage and a Color, I can colorize the Image with the given color. Anyone got any ideas? My current best guess at doing something like this is to get the rgb value of each pixel in the BufferedImage and add the RGB value of the Color to it with some scaling factor.</p>
<p>Let <code>Y = 0.3*R + 0.59*G + 0.11*B</code> for each pixel in the image, then set them to be</p> <p><code>((R1+Y)/2,(G1+Y)/2,(B1+Y)/2)</code></p> <p>if <code>(R1,G1,B1)</code> is what you are colorizing with.</p>
<p>I wanted to do the exact same thing as the question poster wanted to do but the above conversion did not remove colors like the GIMP does (ie green with a red overlay made an unpleasant brown color etc). So I downloaded the source code for GIMP and converted the c code over to Java.</p> <p>Posting it in this thread just in case anyone else wants to do the same (since it is the first thread that comes up in Google). The conversion still changes the white color when it should not, it's probably a casting issue from double to int. The class converts a BufferedImage in-place.</p> <pre><code>public class Colorize { public static final int MAX_COLOR = 256; public static final float LUMINANCE_RED = 0.2126f; public static final float LUMINANCE_GREEN = 0.7152f; public static final float LUMINANCE_BLUE = 0.0722f; double hue = 180; double saturation = 50; double lightness = 0; int [] lum_red_lookup; int [] lum_green_lookup; int [] lum_blue_lookup; int [] final_red_lookup; int [] final_green_lookup; int [] final_blue_lookup; public Colorize( int red, int green, int blue ) { doInit(); } public Colorize( double t_hue, double t_sat, double t_bri ) { hue = t_hue; saturation = t_sat; lightness = t_bri; doInit(); } public Colorize( double t_hue, double t_sat ) { hue = t_hue; saturation = t_sat; doInit(); } public Colorize( double t_hue ) { hue = t_hue; doInit(); } public Colorize() { doInit(); } private void doInit() { lum_red_lookup = new int [MAX_COLOR]; lum_green_lookup = new int [MAX_COLOR]; lum_blue_lookup = new int [MAX_COLOR]; double temp_hue = hue / 360f; double temp_sat = saturation / 100f; final_red_lookup = new int [MAX_COLOR]; final_green_lookup = new int [MAX_COLOR]; final_blue_lookup = new int [MAX_COLOR]; for( int i = 0; i &lt; MAX_COLOR; ++i ) { lum_red_lookup [i] = ( int )( i * LUMINANCE_RED ); lum_green_lookup[i] = ( int )( i * LUMINANCE_GREEN ); lum_blue_lookup [i] = ( int )( i * LUMINANCE_BLUE ); double temp_light = (double)i / 255f; Color color = new Color( Color.HSBtoRGB( (float)temp_hue, (float)temp_sat, (float)temp_light ) ); final_red_lookup [i] = ( int )( color.getRed() ); final_green_lookup[i] = ( int )( color.getGreen() ); final_blue_lookup [i] = ( int )( color.getBlue() ); } } public void doColorize( BufferedImage image ) { int height = image.getHeight(); int width; while( height-- != 0 ) { width = image.getWidth(); while( width-- != 0 ) { Color color = new Color( image.getRGB( width, height ) ); int lum = lum_red_lookup [color.getRed ()] + lum_green_lookup[color.getGreen()] + lum_blue_lookup [color.getBlue ()]; if( lightness &gt; 0 ) { lum = (int)((double)lum * (100f - lightness) / 100f); lum += 255f - (100f - lightness) * 255f / 100f; } else if( lightness &lt; 0 ) { lum = (int)(((double)lum * lightness + 100f) / 100f); } Color final_color = new Color( final_red_lookup[lum], final_green_lookup[lum], final_blue_lookup[lum], color.getAlpha() ); image.setRGB( width, height, final_color.getRGB() ); } } } </code></pre>
4,362
<p>I have issues with this overhang:</p> <p><a href="https://i.stack.imgur.com/7dMhQ.jpg" rel="nofollow noreferrer" title="Damaged overhang"><img src="https://i.stack.imgur.com/7dMhQ.jpg" alt="Damaged overhang" title="Damaged overhang"></a></p> <p>The whole part always breaks in this overhang during the print.</p> <p>I tried to increase the count of wall lines and decrease printing speed, but none of those things help. Do you have any idea how to fix it? Is possible to create support inside a model to print this overhang?</p> <p>(I´m using Cura 4.1.0.)</p> <p>I´m using 3 wall´s lines and 15% gyroid infill. My bed has 70&nbsp;°C and nozzle 205&nbsp;°C. I am using PLA Prusament galaxy black. The part is oriented the right way. By overhang I mean damaged part above holes.</p>
<p>When you get upwards facing things failing it can be because the slicer has too few top layers which makes angled faces have gaps. While you may think it is a wall the slicer sees it as top layer. Try increasing the number of top layers and check in the preview how it appears.</p> <p>Infill will normally support those faces so no separate support is needed. Just make sure you have enough top layers that no gaps form, 3-5 layers should be alright.</p>
<p>As @r-ahlskog pointed out, it was due to the top layers count being too low. Adding some, now it looks perfect:</p> <p><a href="https://i.stack.imgur.com/DEdbO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DEdbO.jpg" alt="enter image description here"></a></p>
1,383
<p>Surprisingly as you get good at vim, you can code even faster than standard IDEs such as Eclipse. But one thing I really miss is code completion, especially for long variable names and functions.</p> <p>Is there any way to enable code completion for Perl in vim?</p>
<p><kbd>Ctrl</kbd>-<kbd>P</kbd> (Get Previous Match) and <kbd>Ctrl</kbd>-<kbd>N</kbd> (Get Next Match) are kind of pseudo code completion. They basically search the file (Backwards for <kbd>Ctrl</kbd>-<kbd>P</kbd>, Forwards for <kbd>Ctrl</kbd>-<kbd>N</kbd>) you are editing (and any open buffers, and if you are using TAGS anything in your TAG file) for words that start with what you are typing and add a drop down list. It works surprisingly well for variables and function names, even if it isn't intellisense. Generally I use <kbd>Ctrl</kbd>-<kbd>P</kbd> as the variable or function I am looking for is usually behind in the code. Also if you keep the same copy of Vim open, it will search the files you have previously opened.</p>
<p><kbd>Ctrl</kbd>+<kbd>N</kbd></p> <p>This is explained in the Perl Hacks book, along with how to do Package completion. Highly recommended.</p>
7,771
<p>I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory.</p> <p>To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that.</p>
<p>To add to @David Crow, here's <a href="http://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html" rel="noreferrer">a dependency:tree example</a> from the Maven site:</p> <pre><code>mvn dependency:tree -Dincludes=velocity:velocity </code></pre> <p>might output</p> <pre><code>[INFO] [dependency:tree] [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT [INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile [INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile [INFO] \- velocity:velocity:jar:1.4:compile </code></pre>
<p>The dependency information is also included in the Project Information/Dependencies report if you have maven generate a site for the project, using mvn site.</p>
5,432
<p>Say you have 2 database servers, one database is the 'master' database where all write operations are performed, it is treated as the 'real/original' database. The other server's database is to be a mirror copy of the master database (slave?), which will be used for read only operations for a certain part of the application.</p> <p>How do you go about setting up a slave database that mirrors the data on the master database? From what I understand, the slave/readonly database is to use the master db's transaction log file to mirror the data correct?<br> What options do I have in terms of how often the slave db mirrors the data? (real time/every x minutes?).</p>
<p>What you want is called Transactional Replication in SQL Server 2005. It will replicate changes in near real time as the publisher (i.e. "master") database is updated.</p> <p><a href="http://blogs.techrepublic.com/howdoi/?p=123" rel="nofollow noreferrer">Here is a pretty good walk through of how to set it up.</a></p>
<p>The answer to this will vary depending on the database server you are using to do this.</p> <p>Edit: Sorry, maybe i need to learn to look at the tags and not just the question - i can see you tagged this as sqlserver.</p>
3,403
<p>We're looking at moving from a check-out/edit/check-in style of version control system to Subversion, and during the evaluation we discovered that when you perform an Update action in TortoiseSVN (and presumably in any Subversion client?), if changes in the repository that need to be applied to files that you've been editing don't cause any conflicts then they'll be automatically/silently merged.</p> <p>This scares us a little, as it's possible that this merge, while not producing any compile errors, could at least introduce some logic errors that may not be easily detected.</p> <p>Very simple example: I'm working within a C# method changing some logic in the latter-part of the method, and somebody else changes the value that a variable gets initialised to at the start of the method. The other person's change isn't in the lines of code that I'm working on so there won't be a conflict; but it's possible to dramatically change the output of the method.</p> <p>What we were hoping the situation would be is that if a merge needs to occur, then the two files would be shown and at least a simple accept/reject change option be presented, so that at least we're aware that something has changed and are given the option to see if it impacts our code.</p> <p>Is there a way to do this with Subversion/TortoiseSVN? Or are we stuck in our present working ways too much and should just let it do it's thing...</p>
<p>The best way around this is to educate the developers. After you do an update in TortoiseSVN it shows you a list of affected files. Simply double clicking each file will give you the diff between them. Then you'll be able to see what changed between your version and the latest repository version.</p>
<p>This is why automated (unit) testing is a fundamental part of distributed software development. In the example you give, at least one unit test should fail on svn update and alert you to the error.</p> <p>Remember what Subversion is: a version control system, not a perfectly-working-code-merging-tool.</p>
7,735
<p>Right up front: I do <em>not</em> want to start a religious war.</p> <p>I've used <em>vi</em> for as long as I can remember, and the few times I've tried to pick up <em>Emacs</em> I've been so lost that I've quickly given up. Lots of people find Emacs very powerful, however. Its programmability is somewhat legendary. I'm primarily doing Solaris+Java development, and I'd like to ask a simple question: will my productivity increase if I invest time in getting my head around Emacs? Is the functionality that it offers over <em>Vim</em> going to be paid back in productivity increases in a reasonable timeframe?</p> <p><em>Repeat: I don't want a "my editor is better than yours" answer. I just want a yes or no answer as to whether it's worth investing the time or not. Will my productivity really increase?</em></p>
<p>I prefer emacs to vi, but I'm comfortable in both. </p> <p>There are some things that you can do in emacs that make it more powerful than vi, but not all of them are even programming-related. (Can you send email or read news from within vi? No, but who cares?) If you're comfortable with lisp (I'm not), you might be able to write add-ons and modes and stuff to make your life easier, but that's just likely to be syntax colouring and brace matching and eye candy like that.</p> <p>I will stop rambling now. Will your <strong>productivity</strong> increase using emacs? No.</p> <p><strong>Update</strong>: See my comment below. Since I posted this, I <em>have</em> come across ways that using emacs has made me more productive than using vi.</p>
<p>I really see no reason to switch. I've used vi for a long time and am quite comfortable with it; about every six months I would install emacs to give it a go, then quickly just switch back. Yes there were things I much preferred about vi, but the main reason I never stuck with it is because the time investment to fully learn another editor when I already know an extremely capable one isn't worth it.<br> I'm reminded of this <a href="http://www.users.qwest.net/~eballen1/knottenbelt.txt" rel="nofollow noreferrer">rather dated study.</a></p> <p>In my opinion, SLIME is about the only reason to switch to emacs if you're already proficient with vi.</p>
7,036
<p>What is the best way to use multiple EVAL fields in a GridView ItemTemplate?</p> <p>Looking to have some control over formatting for appearance as well as setting up hyperlinks/javascript etc.</p>
<p>Even clearer, IMO, is:</p> <pre><code>&lt;%# String.Format("{0} - {1}", Eval("Name1"), Eval("Name2")) %&gt; </code></pre>
<p>I have a easiest way to do this same thing...</p> <pre><code>&lt;asp:Label ID="lblName" runat="server" Text='&lt;%#Eval("FirstName").ToString() +", "+ Eval("LastName").ToString() %&gt;'&gt;&lt;/asp:Label&gt; </code></pre> <p>.</p> <pre><code>&lt;%#Eval("FirstName").ToString() +", "+ Eval("LastName").ToString() %&gt; </code></pre> <p>Here both objects are converted into string the concatenate them.</p>
7,941
<p>Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python.</p>
<p>Use <a href="http://lxml.de/" rel="nofollow noreferrer">lxml</a> which is the best xml/html library for python.</p> <pre><code>import lxml.html t = lxml.html.fromstring("...") t.text_content() </code></pre> <p>And if you just want to sanitize the html look at the lxml.html.clean <a href="http://lxml.de/lxmlhtml.html#cleaning-up-html" rel="nofollow noreferrer">module</a></p>
<p>Regular expressions are not scary, but writing your own regexes to strip HTML is a sure path to madness (and it won't work, either). Follow the path of wisdom, and use one of the many good HTML-parsing libraries.</p> <p>Lucas' example is also broken because "sub" is not a method of a Python string. You'd have to "import re", then call re.sub(pattern, repl, string). But that's neither here nor there, as the correct answer to your question does not involve writing any regexes.</p>
5,819
<p>What is the best approach to define additional data for typedef enums in C?</p> <p>Example:</p> <pre><code>typedef enum { kVizsla = 0, kTerrier = 3, kYellowLab = 10 } DogType; </code></pre> <p>Now I would like to define names for each, for example <code>kVizsla</code> should be "vizsla". I currently use a function that returns a string using a large switch block.</p>
<p>@dmckee: I think the suggested solution is good, but for simple data (e.g. if only the name is needed) it could be augmented with auto-generated code. While there are lots of ways to auto-generate code, for something as simple as this I believe you could write a simple XSLT that takes in an XML representation of the enum and outputs the code file.</p> <p>The XML would be of the form:</p> <pre><code>&lt;EnumsDefinition&gt; &lt;Enum name="DogType"&gt; &lt;Value name="Vizsla" value="0" /&gt; &lt;Value name="Terrier" value="3" /&gt; &lt;Value name="YellowLab" value="10" /&gt; &lt;/Enum&gt; &lt;/EnumsDefinition&gt; </code></pre> <p>and the resulting code would be something similar to what dmckee suggested in his solution.</p> <p>For information of how to write such an XSLT try <a href="http://www.w3schools.com/xsl/" rel="nofollow noreferrer">here</a> or just search it up in google and find a tutorial that fits. Writing XSLT is not much fun IMO, but it's not that bad either, at least for relatively simple tasks such as these.</p>
<p>That's kind of an open ended question, but one suggestion would be to use a map with the enum as the key type and the extra information in the value. (If your indices are continuous, unlike the example, you can use a sequence container instead of a map).</p>
5,657
<p>I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and running and am now looking towards improving performance, particularly at doing I/O more efficiently since the input file gets scanned many times.</p> <p>Is there a rule of thumb for using <code>mmap()</code> versus reading in blocks via C++'s <code>fstream</code> library? What I'd like to do is read large blocks from disk into a buffer, process complete records from the buffer, and then read more.</p> <p>The <code>mmap()</code> code could potentially get very messy since <code>mmap</code>'d blocks need to lie on page sized boundaries (my understanding) and records could potentially lie across page boundaries. With <code>fstream</code>s, I can just seek to the start of a record and begin reading again, since we're not limited to reading blocks that lie on page sized boundaries.</p> <p>How can I decide between these two options without actually writing up a complete implementation first? Any rules of thumb (e.g., <code>mmap()</code> is 2x faster) or simple tests?</p>
<p>I was trying to find the final word on mmap / read performance on Linux and I came across a nice post (<a href="http://marc.info/?l=linux-kernel&amp;m=95496636207616&amp;w=2" rel="noreferrer">link</a>) on the Linux kernel mailing list. It's from 2000, so there have been many improvements to IO and virtual memory in the kernel since then, but it nicely explains the reason why <code>mmap</code> or <code>read</code> might be faster or slower.</p> <ul> <li>A call to <code>mmap</code> has more overhead than <code>read</code> (just like <code>epoll</code> has more overhead than <code>poll</code>, which has more overhead than <code>read</code>). Changing virtual memory mappings is a quite expensive operation on some processors for the same reasons that switching between different processes is expensive.</li> <li>The IO system can already use the disk cache, so if you read a file, you'll hit the cache or miss it no matter what method you use.</li> </ul> <p>However,</p> <ul> <li>Memory maps are generally faster for random access, especially if your access patterns are sparse and unpredictable.</li> <li>Memory maps allow you to <em>keep</em> using pages from the cache until you are done. This means that if you use a file heavily for a long period of time, then close it and reopen it, the pages will still be cached. With <code>read</code>, your file may have been flushed from the cache ages ago. This does not apply if you use a file and immediately discard it. (If you try to <code>mlock</code> pages just to keep them in cache, you are trying to outsmart the disk cache and this kind of foolery rarely helps system performance).</li> <li>Reading a file directly is very simple and fast.</li> </ul> <p>The discussion of mmap/read reminds me of two other performance discussions:</p> <ul> <li><p>Some Java programmers were shocked to discover that nonblocking I/O is often slower than blocking I/O, which made perfect sense if you know that nonblocking I/O requires making more syscalls.</p></li> <li><p>Some other network programmers were shocked to learn that <code>epoll</code> is often slower than <code>poll</code>, which makes perfect sense if you know that managing <code>epoll</code> requires making more syscalls.</p></li> </ul> <p><strong>Conclusion:</strong> Use memory maps if you access data randomly, keep it around for a long time, or if you know you can share it with other processes (<code>MAP_SHARED</code> isn't very interesting if there is no actual sharing). Read files normally if you access data sequentially or discard it after reading. And if either method makes your program less complex, do <em>that</em>. For many real world cases there's no sure way to show one is faster without testing your actual application and NOT a benchmark.</p> <p>(Sorry for necro'ing this question, but I was looking for an answer and this question kept coming up at the top of Google results.)</p>
<p>I think the greatest thing about mmap is potential for asynchronous reading with:</p> <pre><code> addr1 = NULL; while( size_left > 0 ) { r = min(MMAP_SIZE, size_left); addr2 = mmap(NULL, r, PROT_READ, MAP_FLAGS, 0, pos); if (addr1 != NULL) { /* process mmap from prev cycle */ feed_data(ctx, addr1, MMAP_SIZE); munmap(addr1, MMAP_SIZE); } addr1 = addr2; size_left -= r; pos += r; } feed_data(ctx, addr1, r); munmap(addr1, r);</code></pre> <p>Problem is that I can't find the right MAP_FLAGS to give a hint that this memory should be synced from file asap. I hope that MAP_POPULATE gives the right hint for mmap (i.e. it will not try to load all contents before return from call, but will do that in async. with feed_data). At least it gives better results with this flag even that manual states that it does nothing without MAP_PRIVATE since 2.6.23.</p>
6,800
<p>I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page. </p> <p>I think my header control which displays static content and my footer control could benefit from being cached. </p> <p>How can I go about caching just those controls?</p>
<p>Take a look <a href="https://web.archive.org/web/20081207012138/http://asp.dotnetheaven.com/aspnet/doc/caching/fragment.aspx" rel="nofollow noreferrer">here</a><br> You can use <code>VaryByParam</code> and <code>VaryByControl</code> in the output cache.</p>
<p>I think you can specify OutputCache in the control's markup file like you'd do on an ASPX page. And it'd get properly cached automatically.</p> <p>Just read up on OutputCache page directive on MSDN and get the parameters right and it should do what you want it to.</p> <p>It's been a long time since I write classic ASP.NET but I believe that's how it's done.</p>
6,649
<p>When double-probing, sometimes the BLTouch will hit the bed before the z-axis goes down:</p> <ol> <li>The BLTouch deploys </li> <li>The bed goes up</li> <li>The sensor triggers</li> <li>The BLTouch stows</li> <li>The BLTouch deploys and crashes the bed before the z-axis goes down for the second probe</li> </ol> <p>It happens only on the second probe of double-probing (slow speed) - the bed can't move out of the way fast enough. This happens in 2/16 probe points.</p> <p><em>Probe Accuracy Test result:</em></p> <ul> <li><em>Mean: 0.023075 mm</em></li> <li><em>Min: 0.018 mm</em></li> <li><em>Max: 0.027 mm</em></li> <li><em>Range: 0.008 mm</em></li> <li><em>Standard Deviation: 0.002584 mm</em></li> </ul>
<p>First, make sure to check if stow, deploy and the trigger are working correctly.</p> <p>Second, check the pins files to make sure you put it in the correct pins. Black and White probe pin might need to go to Z-min or probe pin depending on. Make sure to check that.</p> <p>Third, add "BLTOUCH delay". It might be triggering too slow or too fast for the next one to react. So after the first trigger, there should be a time for it to "re-setup" for the second. But if there is no time to do that then it won't trigger. </p> <p>To add examples: If you have SKR 1.4 Turbo, then use BLTouch probe pins (black and white) on the board. IT will NOT recognize. You have to use Z-min endstop pins. Reason for this?:</p> <pre><code>#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN </code></pre> <p>If this has been used, Z-min probe will use Z-min endstop pin instead of Z-min probe.</p>
<p>This sounds like the firmware setting for your BLtouch is not set up properly. Look at the line in Config H where it deploys the BLtouch. make sure nothing is commented out and that the 2nd deploy is shown. </p>
1,224
<p>I'm trying to make it so when a user scrolls down a page, click a link, do whatever it is they need to do, and then come back to the pages w/ links, they are at the same (x-y) location in the browser they were before. How do I do that?</p> <p>I'm a DOM Newbie so I don't know too much about how to do this. </p> <p>Target Browsers: IE6/7/8, Firefox 2/3, Opera, Safari</p> <p>Added: I'm using a program called JQuery to help me learn</p>
<p>To get the x-y location of where a user clicked on a page, use the following jQuery code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ $("#special").click(function(e){ $('#status2').html(e.pageX +', '+ e.pageY); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h2 id="status2"&gt; 0, 0 &lt;/h2&gt; &lt;div style="width: 100px; height: 100px; background:#ccc;" id="special"&gt; Click me anywhere! &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
<p>you can use offsetLeft and offsetTop</p>
9,323
<p>I have a column which is of type nvarchar(max). How do I find the length of the string (or the number of bytes) for the column for each row in the table?</p>
<blockquote> <p>SELECT LEN(columnName) AS MyLength FROM myTable</p> </blockquote>
<p>If you want to find out the max there should be a way for you to get the schema of the table. Normally you can do something like <a href="http://dev.mysql.com/doc/refman/5.0/en/show-columns.html" rel="nofollow noreferrer">SHOW COLUMNS</a> in SQL or a <a href="http://dev.mysql.com/doc/refman/5.0/en/describe.html" rel="nofollow noreferrer">DESCRIBE</a> style command. In a mysql shell that can be shortened to:</p> <pre><code>desc tablename; </code></pre> <p>Then if you want to determine the length of a string there is normally a function like <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_length" rel="nofollow noreferrer">LENGTH</a> <em>(for bytes)</em> or <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length" rel="nofollow noreferrer">CHAR_LENGTH</a> <em>(for characters)</em>.</p> <pre><code>SELECT *, LENGTH(fieldname) AS len FROM tablename </code></pre>
5,719
<p>I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links:</p> <pre><code>&lt;A HREF="path to file"&gt;filename&lt;/A&gt; </code></pre> <p>The filenames can be complicated:</p> <pre><code>LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf </code></pre> <p>What is the correct way to link to this file on a Linux/Apache server?</p> <p>Is there a PHP function to do this conversion?</p>
<p>You can use <a href="http://php.net/manual/en/function.rawurlencode.php" rel="nofollow noreferrer">rawurlencode()</a> to convert a string according to the RFC 1738 spec. This function replaces all non-alphanumeric characters by their associated code.</p> <p>The difference with <a href="http://php.net/manual/en/function.urlencode.php" rel="nofollow noreferrer">urlencode()</a> is that spaces are encoded as plus signs.</p> <p>You'll probably want to use the last one.</p> <p>This technique is called Percent or URL encoding. See <a href="http://en.wikipedia.org/wiki/Url_encoding" rel="nofollow noreferrer">Wikipedia</a> for more details.</p>
<p><a href="http://se.php.net/manual/en/function.urlencode.php" rel="nofollow noreferrer">urlencode()</a> should probably do what you want.</p> <p><strong>Edit</strong>: urlencode() works fine on swedish characters.</p> <pre><code> &lt;?php echo urlencode("åäö"); ?&gt; </code></pre> <p>converts to:</p> <pre><code> %E5%E4%F6 </code></pre>
5,547
<p>As part of improvements to our build process, we are currently debating whether we should have separate project/solution files on our CI production environment from our local development environments.</p> <p>The reason this has come about is because of reference problems we experienced in our previous project. On a frequent basis people would mistakenly add a reference to an assembly in the wrong location, which would mean it would work okay on their local environment, but might break on someone else's or on the build machine.</p> <p>Also, the reference paths are in the csproj.user files which means these must be committed to source control, so everyone has to share these same settings.</p> <p>So we are thinking about having separate projects and solutions on our CI server, so that when we do a build it uses these projects rather than local development ones.</p> <p>It has obvious drawbacks such as an overhead to maintaining these separate files and the associated process that would need to be defined and followed, but it has benefits in that we would be in more control over <em>EXACTLY</em> what happens in the production environment. </p> <p>What I haven't been able to find is anything on this subject - can't believe we are the only people to think about this - so all thoughts are welcome.</p>
<p>In our largest project (a system comprising of many applications) we have the following structure</p> <blockquote> <p>/3rdPartyAssemblies<br/> /App1<br/> /App2<br/> /App3<br/> /.....</p> </blockquote> <p>All external assemblies are added to 3rdPartyAssemblies/Vendor/Version/...</p> <p>We have a CoreBuild.sln file which acts as an MSBuild script for all of the assemblies that are shared to ensure building in dependancy order (ie, make sure App1.Interfaces is built before App2 as App2 has a reference to App1.Interfaces).</p> <p>All inter-application references target the /bin folder (we don't use bin/debug and bin/release, just bin, this way the references remain the same and we just change the release configuration depending on the build target).</p> <p>Cruise Control builds the core solution for any dependencies before building any other app, and because the 3rdPartAssemblies folder is present on the server we ensure developer machines and build server have the same development layout.</p>
<p>Usually, you would be creating Build projects/scripts in some form or another for your Production, and so putting together another Solution file doesn't come in the picture.</p> <p>It would be easier to train everyone to use project references, and create a directory under the project file structure for external assembly references. This way everyone follows the same environment.</p>
3,547
<p>I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from another machine and copy it over my existing Aptana installation?</p> <p>Update: Found a link for download <a href="http://update.aptana.com/install/rails/3.2/" rel="nofollow noreferrer">here</a> (Access denied now)</p>
<p>I wrote down <a href="http://madcoderspeak.blogspot.com/2008/02/showmethemoney-15-aptana-radrails-hell.html" rel="nofollow noreferrer">my duel with Aptana Rails</a> - See if this helps you. There is a link on manual installation that may be what you're looking for.</p>
<p>If you're able to actually install it on the machine with the Internet connection, then you can simply copy over the directory you installed it in. Eclipse installations are completely self-contained in their installation directories.</p>
5,418
<p>I am printing a print using PLA on a Prusa i3 printer and an MK8 extruder, at 210 degrees celsius, 60 mm/sec, sliced with slic3r. The print consists of a base, with 4 tower-like projections that then join with a near-vertical overhang slope that isn't posing a problem for my printer.</p> <p>However, even before the overhang begins, I am getting large amounts of strings as the extruder head jumps between the four towers in the print, leading to a "spiderweb" effect between them. How can I deal with these strings, and are they a warning that there might be something amiss with my printer, or possible other failures in other parts of the print?</p>
<p>Stringing is often a result of too-high a temperature, or insufficient retraction. When there is highly liquid filament in the nozzle tip, it can adhere to the remainder of the print while dripping as the nozzle moves, leading to a thin string of the filament forming. As further travel moves are performed in each layer, this turns to a web.</p> <p>The high temperature causes filament to be very liquid, causing it to move downward in the nozzle chamber easily, as opposed to having to be extruded forcefully due to viscosity. The temperature setpoint of 210 was high enough to cause this to happen.</p> <p>A second possible cause, insufficient retraction, can also be blamed for this issue. Retraction is a process in which the extruder reverses its movement to pull filament back up the hotend, preventing it from dripping at the tip, and forming a string. Most slicers will allow specifying a numeric value in millimeters of filament to be retracted. Remember that printers with Bowden tubes between nozzle/hotend and extruder motor will require increased retraction and priming (extrusion when starting to print after a retract-and-move). Note that too much retraction can cause other problems, such as insufficient plastic in the hotend chamber at the start of the next printing move, which can cause gaps and other issues.</p>
<p>Here's just a few of the things you might want to look into.</p> <ul> <li>plastic - some plastic types are more stringy than others and there's also variation between brands and colors.</li> <li>moisture in filament - water turning to steam tends to cause the extruder to ooze when it isn't printing, which can cause stringing.</li> <li>temperature - too hot or too cold can cause stringiness.</li> <li>retraction distance - not enough retraction can leave some nozzle pressure, causing it to ooze during travel moves (not sure how much retraction speed matters but I suspect it can make a difference too).</li> <li>acceleration - if it's too slow it's more likely to draw out strings.</li> <li>travel speed - faster travel speeds are more likely to prevent strings or make them thinner and less of a problem.</li> <li>z-hop - raising the extruder on travel moves makes stringing more likely.</li> <li>wipe - a longer wipe distance can be helpful to reduce stringing, especially with some of the more stringy filaments.</li> <li>combing - avoiding passing over open spaces can reduce stringing in some cases</li> <li>part cooling fan - more cooling might help to reduce stringiness.</li> </ul> <p>There are other things too, the extruder design makes a big difference with longer bowden tubes being more challenging to tune. The order in which the layers are printed can make a difference too in some more specialized cases.</p>
99
<p>I want to get my Ender 5 plus to print at 300 °C. As such, I've edited the firmware and increased the <code>HEATER_0_MAXTEMP</code> to 315 °C.</p> <p>In my slicer, I can slice and print at 300 °C, however, I cannot manually adjust the temperature on the LCD screen past the stock setting of 260 °C.</p> <p>Any help in getting the manual adjustment fixed would be greatly appreciated.</p>
<p>Your formula doesn't seem to take into account two important factors: layer height and average speed.</p> <p>Do the math differently:</p> <p>voumetric flow rate [mm^3/s] = layer height [mm] * line width [mm] * speed [mm/s]</p> <p>For example, 0.2 * 0.45 * 70 = 6.3 mm^3/s</p> <p>which is realistic, the extruder on the Ender 3 cannot go much faster than that reliably.</p> <p>PLA weighs 1.24 g/cm^3 = 0.00124 g/mm^3</p> <p>To extrude 1 kg you need 1000/(0.00124 * 6.3) = 35 hours (70 for 2 kg).</p> <p>However the printer does not reach 70 mm except on straight long moves, the average speed may be lower or much lower depending on what you print.</p> <p>If you print technical parts with straight edges, maybe you can multiply by 1.5 (50 hours/kg), but if you print models and small statues or similar you may need to double it (70 hours/kg).</p> <p>I use Klipper as firmware and I have a macro which keeps track of printing time and filament length used.</p>
<p>Your math looks correct, and is also a good approximation for what I've seen in the first few weeks with my own Ender 3.</p> <p>Another way to calculate (to check yourself) is to calculate the volume extruded (nozzle area times extrusion percentage times print speed -- be sure you convert everything to the same units!) in a given second, multiply by the density of your filament (common PLA runs about 1.2 g/cm^3), and get a rough figure for how long it takes to print a kilogram of filament. Your actual print time will always be higher than this approximation, because there are moves during which the extruder isn't running, infill is often set to lower extrusion level, and of course there's setup and cleanup time to account for.</p>
1,951
<p>Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process.</p> <p>Soon the update frequency will increase by an order of magnitude (maybe two). Someone suggested that committing every N updates instead of after every update will help performance.</p> <p>I have a few questions:</p> <ul> <li>Will that be faster or slower or it depends (planning to benchmark both way as soon as can get a decent simulation of the new load)</li> <li>Why will it help / hinder performance.</li> <li>If "it depends ..." , on what ?</li> <li>If it helps what's the best value of N ?</li> <li>Why can't my local DBA have an helpful straight answer when I need one? <br />(Actually I know the answer to that one) :-) </li> </ul> <blockquote> <p>EDIT:</p> <p>@codeslave : Thanks, btw losing uncommited changes is not a problem, I don't delete the original data used for updating till I am sure everything is fine , btw cleaning lady did unplugs the server, TWICE :-)</p> <p>Some googling showed it might help because of issue related to rollback segments, but I still don't know a rule of thumb for N every few tens ? hundreds? thousand ?</p> <p>@diciu : Great info, I'll definitely look into that.</p> </blockquote>
<p>A commit results in Oracle writing stuff to the disk - i.e. in the redo log file so that whatever the transaction being commited has done can be recoverable in the event of a power failure, etc. Writing in file is slower than writing in memory so a commit will be slower if performed for many operations in a row rather then for a set of coalesced updates.</p> <p>In Oracle 10g there's an asynchronous commit that makes it much faster but less reliable: <a href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6158695.html" rel="nofollow noreferrer">https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6158695.html</a></p> <p>PS I know for sure that, in a scenario I've seen in a certain application, changing the number of coalesced updates from 5K to 50K makes it faster by an order of magnitude (10 times faster).</p>
<blockquote> <p>Faster/Slower? </p> </blockquote> <p>It will probably be a little faster. However, you run a greater risk of running into deadlocks, losing uncommitted changes should something catastrophic happen (cleaning lady unplugs the server), FUD, Fire, Brimstone, etc.</p> <blockquote> <p>Why would it help? </p> </blockquote> <p>Obviously fewer commit operations, which in turn means fewer disk writes, etc.</p> <blockquote> <p>DBA's and straight answers? </p> </blockquote> <p>If it was easy, you won't need one.</p>
5,319
<p>I just finish building a Graber i3 printer from mixed parts (a MDF clone of Prusa i3 MK2). For the hotend, I've bought the Greetech MK8 extruder. However, the temperature sensor is driving me up the wall.</p> <p>I've already checked the wires and connections, but the darn thing keeps showing a steady 500 degrees Celsius. In Marlin, it shows it right up (I'm using the 1st option for a 100k thermistor), in Repetier Firmware (using the same one), it shows 0.00°C, until I tell the printer to heat up, when it shoots to 500°C just like before with Marlin. The documentation for this extruder only lists it as a "100K NTC Thermistor", so I tried to select one of the NTC options on the list for both Marlin and Repetier and the temp sensor reads steady 3.600°C!!!</p> <p>Measuring it with the multimeter, it shows around 60k, it's 31°C outside.</p> <p>Is it broken or am I selecting the wrong thermistor type?</p> <p><a href="http://www.geeetech.com/assembled-mk8-extruder-p-857.html" rel="nofollow noreferrer">Documentation for MK8</a></p>
<p>A brand new thermistor shows about 95-105k ohm (depends on the multimeter quality), so it looks like that one is out of the range. To be sure that it is a thermistor, you could connect a 100k potentiometer, play with it and see readings on the lcd. If the readings are OK, then mainboard is good so replace the thermistor.</p> <p><a href="https://arduino.stackexchange.com/a/36420/26303">A 100k thermistor curve</a> </p>
<p>If your printer is a cheap one that uses a ribbon cable or other combined cables, verify your thermal sensor's polarity. I know, I know - it's a resistor (in most cases) and that means there's no such thing as polarity. Bear with me - I just helped a friend diagnose his printer (Geeetech, for the record) for showing 500C on one sensor and 'def' on the other, after replacing the mainboard with a different/more capable model. Turns out, they SHARE PINS, which suddenly makes polarity important. Swap the pins in the connector, and it might just work. First time I've run into this. We swapped only the Ext0 sensor and left the bed disconnected - Ext0 read normal, so we swapped both, and everything's been perfect since.</p>
850
<p>We're working on an application that displays information through a Direct3D visualisation. A late client request is the ability to view this application via some Remote Desktop solution.</p> <p>Has anyone done anything similar? What options are available / unavailable? I'm thinking RDC, VNC, Citrix...</p> <p>Any advice?</p>
<p>I think you can still use all of the normal D3D tools, but you won't be able to render to a surface associated with the screen. You'll have to render to a DIB (or some such) and Blt it with GDI to a normal window HDC. RDC/VNC/Citrix should all work with this technique.</p> <p>Performance will definitely suffer - but that's going to be the case over remote desktop anyway. In fact, if I were you, I would mock up a VERY simple prototype and demonstrate the performance before committing to it. </p> <p>Good luck!</p>
<p>The build-in remote desktop works. (You don't have to do anything special)</p> <p>But it is extremely slow, because when in doubt, it just sends the contents of a window as a bitmap.</p>
5,720
<p>In my ASP.NET User Control I'm adding some JavaScript to the <code>window.onload</code> event:</p> <pre><code>if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true); </code></pre> <p>My problem is, if there is already something in the <code>onload</code> event, than this overwrites it. How would I go about allowing two user controls to each execute JavaScript in the <code>onload</code> event?</p> <p><strong>Edit:</strong> Thanks for the info on third party libraries. I'll keep them in mind. </p>
<p>Most of the "solutions" suggested are Microsoft-specific, or require bloated libraries. Here's one good way. This works with W3C-compliant browsers and with Microsoft IE.</p> <pre><code>if (window.addEventListener) // W3C standard { window.addEventListener('load', myFunction, false); // NB **not** 'onload' } else if (window.attachEvent) // Microsoft { window.attachEvent('onload', myFunction); } </code></pre>
<p>I don't know a lot about ASP.NET, but why not write a custom function for the onload event that in turn calls both functions for you? If you've got two functions, call them both from a third script which you register for the event.</p>
3,085
<p>I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...).</p> <p>So the question is: Portlets, tiles or some other technology?</p>
<p>If you are using Spring MVC, then I would recommend using Portlets. In Spring, portlets are just lightweight controllers since they are only responsible for a fragment of the whole page, and are very easy to write. If you are using Spring 2.5, then you can enjoy all the benefits of the new annotation support, and they fit nicely in the whole Spring application with dependency injection and the other benefits of using Spring.</p> <p>A portlet controller is pretty much the same as a servlet controller, here is a simple example:</p> <pre><code>@RequestMapping("VIEW") @Controller public class NewsPortlet { private NewsService newsService; @Autowired public NewsPortlet(NewsService newsService) { this.newsService = newsService; } @RequestMapping(method = RequestMethod.GET) public String view(Model model) { model.addAttribute(newsService.getLatests(10)); return "news"; } } </code></pre> <p>Here, a NewsService will be automatically injected into the controller. The view method adds a List object to the model, which will be available as ${newsList} in the JSP. Spring will look for a view named news.jsp based on the return value of the method. The RequestMapping tells Spring that this contoller is for the VIEW mode of the portlet.</p> <p>The XML configuration only needs to specify where the view and controllers are located:</p> <pre><code>&lt;!-- look for controllers and services here --&gt; &lt;context:component-scan base-package="com.example.news"/&gt; &lt;!-- look for views here --&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/WEB-INF/jsp/news/"/&gt; &lt;property name="suffix" value=".jsp"/&gt; &lt;/bean&gt; </code></pre> <p>If you want to simply embed the portlets in your existing application, the you can bundle a portlet container, such as <a href="http://www.exoplatform.com" rel="nofollow noreferrer">eXo</a>, <a href="https://portlet-container.dev.java.net/" rel="nofollow noreferrer">Sun</a>, or <a href="http://portals.apache.org/pluto/" rel="nofollow noreferrer">Apache</a>. If you want to build your application as a set of portlets, the you might want to consider a full blown portlal solution, such as <a href="http://liferay.com" rel="nofollow noreferrer">Liferay Portal</a>.</p>
<p><a href="http://tapestry.apache.org" rel="nofollow noreferrer">Tapestry</a> is a Java web app framework with an emphasis on easily creating reusable components.</p> <p>I have used sitemesh, and it is good for wrapping a set of pages in standard headers and footers, but Tapestry is better for creating components which are used on many pages, possibly many times per page. Tapestry components can take other components as parameters, which allows the Sitemesh style wrapping.</p>
9,721
<p>I have a databound TextBox in my application like so: (The type of <code>Height</code> is <code>decimal?</code>)</p> <pre class="lang-xml prettyprint-override"><code> &lt;TextBox Text=&quot;{Binding Height, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, Converter={StaticResource NullConverter}}&quot; /&gt; </code></pre> <pre class="lang-cs prettyprint-override"><code> public class NullableConverter : IValueConverter { public object Convert(object o, Type type, object parameter, CultureInfo culture) { return o; } public object ConvertBack(object o, Type type, object parameter, CultureInfo culture) { if (o as string == null || (o as string).Trim() == string.Empty) return null; return o; } } </code></pre> <p>Configured this way, any non-empty strings which cannot be converted to decimal result in a validation error which will immediately highlight the textbox. However, the TextBox can still lose focus and remain in an invalid state. What I would like to do is either:</p> <ol> <li>Not allow the TextBox to lose focus until it contains a valid value.</li> <li>Revert the value in the TextBox to the last valid value.</li> </ol> <p>What is the best way to do this?</p> <p><strong>Update:</strong></p> <p>I've found a way to do #2. I don't love it, but it works:</p> <pre><code>private void TextBox_LostKeyboardFocus(object sender, RoutedEventArgs e) { var box = sender as TextBox; var binding = box.GetBindingExpression(TextBox.TextProperty); if (binding.HasError) binding.UpdateTarget(); } </code></pre> <p>Does anyone know how to do this better? (Or do #1.)</p>
<p>You can force the keyboard focus to stay on the <code>TextBox</code> by handling the <code>PreviewLostKeyBoardFocus</code> event like this:</p> <pre class="lang-xml prettyprint-override"><code> &lt;TextBox PreviewLostKeyboardFocus=&quot;TextBox_PreviewLostKeyboardFocus&quot; /&gt; </code></pre> <pre class="lang-cs prettyprint-override"><code> private void TextBox_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { e.Handled = true; } </code></pre>
<p>It sounds to me that you'll want to handle two events:</p> <p>GotFocus: Will trigger when the textbox gains focus. You can store the initial value of the box.</p> <p>LostFocus: Will trigger when the textbox loses focus. At this point you can do your validation and decide if you want to roll back or not.</p>
6,605
<p>I'm using MySQL in particular, but I'm hoping for a cross-vendor solution. I'm using the NOW() function to add a timestamp as a column for each record.</p> <pre><code>INSERT INTO messages (typeId, messageTime, stationId, message) VALUES (?, NOW(), ?, ?) </code></pre>
<pre><code>SELECT * FROM messages WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) &lt;= messageTime </code></pre>
<p>There is no cross database solution, as most of them have their own date handling (and mainly interval representation) syntax and semantics. </p> <p>In <code>PostgreSQL</code> it would be</p> <pre><code>SELECT * FROM messages WHERE messagetime &gt;= messagetime - interval '1 day' </code></pre>
8,401
<p>So I want to get a project on a distributed version control system, such as mercurial, git, or bazaar. The catch is that I need the Windows support to be good, i.e. no instructions that start off with "install cygwin...". Now I've <em>heard</em> that git's Windows support is decent these days, but don't have any first hand experience. Also, it sounds like the bazaar team has an explicit goal of making it as multiplatform as possible. Can I get any recommendations?</p>
<p>I use <a href="http://code.google.com/p/msysgit/" rel="nofollow noreferrer">msys-git</a> on windows every single day. Works fast and flawlessly.</p> <p>Although the newer build has some problems with git-svn, <a href="http://msysgit.googlecode.com/files/Git-1.5.5-preview20080413.exe" rel="nofollow noreferrer">this build (Git-1.5.5-preview20080413.exe)</a> has a working git-svn.</p>
<p>In my experience using GIT on windows is a major pain. But I have been using Fossil SCM for some time now, and I think it actually fits your needs exactly.</p> <p>It also has a built in Ticket system and a Wiki. And the whole program is contained in 1 file and it works right out of the box.</p> <p>I totally recommend it.</p> <p>Here is a link to the site <a href="http://www.fossil-scm.org/" rel="nofollow noreferrer">http://www.fossil-scm.org/</a></p> <p>Remember, this site is self hosting, what that means is you are looking at the web interface to fossil it self, when you look at tickets and the wiki and documentation, you actually are using fossil.</p> <p>But if your project has millions of lines of code and is a few gigabytes in size, you have to use GIT, there is no way around that problem.</p> <p>Enjoy.</p>
2,669
<p>How does the compiler know the prototype of sleep function or even printf function, when I did not include any header file in the first place?</p> <p>Moreover, if I specify <code>sleep(1,1,"xyz")</code> or any arbitrary number of arguments, the compiler still compiles it. But the strange thing is that gcc is able to find the definition of this function at link time, I don't understand how is this possible, because actual <code>sleep()</code> function takes a single argument only, but our program mentioned three arguments.</p> <pre><code>/********************************/ int main() { short int i; for(i = 0; i&lt;5; i++) { printf("%d",i);`print("code sample");` sleep(1); } return 0; } </code></pre>
<p>Lacking a more specific prototype, the compiler will assume that the function returns int and takes whatever number of arguments you provide.</p> <p>Depending on the CPU architecture arguments can be passed in registers (for example, a0 through a3 on MIPS) or by pushing them onto the stack as in the original x86 calling convention. In either case, passing extra arguments is harmless. The called function won't use the registers passed in nor reference the extra arguments on the stack, but nothing bad happens.</p> <p>Passing in fewer arguments is more problematic. The called function will use whatever garbage happened to be in the appropriate register or stack location, and hijinks may ensue.</p>
<p>Depends on the compiler, but with gcc (for example, since that's the one you referred to), some of the standard (both C and POSIX) functions have builtin "compiler intrinsics". This means that the compiler library shipped with your compiler (libgcc in this case) contains an implementation of the function. The compiler will allow an implicit declaration (i.e., using the function without a header), and the linker will find the implementation in the compiler library because you're probably using the compiler as a linker front-end.</p> <p>Try compiling your objects with the '-c' flag (compile only, no link), and then link them directly using the linker. You will find that you get the linker errors you expect.</p> <p>Alternatively, gcc supports options to disable the use of intrinsics: <code>-fno-builtin</code> or for granular control, <code>-fno-builtin-function</code>. There are further options that may be useful if you're doing something like building a homebrew kernel or some other kind of on-the-metal app.</p>
9,436
<p>A problem I ran into a while back I never found a good solution for...</p> <p>Say you have a working copy checked out from subversion at revision 7500, and the disk holding the current repository dies. You've got a backup of the repository at, say, revision 7450. It's easy to restore the repository backup, but any attempt to use the working copy against it gives an error saying that revision 7500 doesn't exist in the repository.</p> <p>What is the best way to check in one gigantic revision to bring the content of the repository up to match the content of the working copy and get he working copy back to a functional state?</p> <p>(Ideally I'd like something easier than having to check out a brand new working copy and then copying over all the files manually - I think at the time the working copies were used to configuration manage servers, so it was a real pain to have to check out clean working copies)</p>
<p>You could check out a rev.7450 copy somewhere, then export your 7500 copy (to remove the .svn folders). Drag the exported copy (which is the latest copy) over the 7450 copy. All the new files should simply overwrite the older ones, leaving the .svn folders the same. </p> <p>Subversion will assume you just made a bunch of changes to 7450, and the next checkin will set it as 7451.</p>
<p>If you are positive you've got the latest version in your directory, then do this:</p> <ol> <li>Delete the item from the repository</li> <li>Delete the SVN references from your copy</li> <li>Check your code in as a new copy.</li> <li>Check out the code you just checked in</li> </ol>
8,047
<p>I have an SKR PRO control board with a dead (shorted, it's burning hot) main processor. I ordered a new board, it was my mistake.</p> <p>The voltage regulators work, so I ordered a replacement STM32F407 processor from STM (a free sample actually) and I'll repair the board in my free time.</p> <p>How can I test all pins of the new board, so that I can ensure the board is working when I'll sell it/when I'll use it for my next project?</p> <p>I think that programmatically turning on and off each pin would be enough, then I would use an oscilloscope or a LED to verify the result. The pins which have special functions (heater, fan, MOSFET in general) would be tested accordingly, but I still need the pulsating input.</p>
<p>&quot;Completely&quot; is always relative, but for water at the pressures involved it's probably achievable. Normally you need some sort of <em>gasket</em> (material that can bend/compress to slight imperfections in the mating surfaces), and a means of holding the two surfaces tight against the gasket, to get such a seal.</p> <p>With 3D printing, it's plausible that the print itself could be sufficiently non-rigid to achieve this, if you have a way of keeping the lid and box pressed tightly against each other - bolts through the lid, clips around the edges, etc. But it's unlikely to work well.</p> <p>I would either print I suitable gasket in TPU, or cut one from some suitable material if you don't have the capability to print with TPU. Either way you still need to design your box and lid so that they're pressed tightly against the gasket.</p> <p>One possible frame challenge would be doing a round box instead, with a circular threaded lid. It's likely that you could achieve a decent seal for your purposes without any gasket just by tightening the threads, and if not, you still have a really good setup for use with an added gasket.</p>
<p>I know this sounds obvious, but given the box has holes in the top – does it only need to be watertight when it's the right way up? If not, you could just do something like:</p> <p><a href="https://i.stack.imgur.com/JXft9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JXft9.jpg" alt="enter image description here" /></a></p> <p>Assuming that won't work, I think a really good seal would be hard with just something like PLA, because the printing texture alone means there will always be tiny gaps between the mating surfaces. In some cases, those grooves will actually act as capillaries (if you've ever tried to use a sharpie marker on a print, you can imagine what I mean).</p> <p>If the lid fits snugly, then just lining it with something like plumber's thread tape would probably do a good job.</p> <p>If it needs to work straight out of the printer, then I would try something like this (obviously I've exaggerated the detail):</p> <p><a href="https://i.stack.imgur.com/P5Fuc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P5Fuc.jpg" alt="enter image description here" /></a></p> <p>The idea being something like the plastic seal you see on some types of refrigerator door, which has a thin wall with a free edge that allows it to flex.</p> <p>NB in all these cases, sharp corners will cause problems – it will be easier to get a seal if you put a radius (say, 5mm) on the vertical edges of the box.</p>
1,765
<p>I am trying to control a laser with the fan (D9) and ran into problems. So I tried P44, no good then P6 also not good.\ What my problem is I am trying to "burn" a group of vertical lines spaced about 0.75" apart, and randomly the drive to the laser power supply is either "skipping" (missing the control pulse) or stretching the pulse. This results in missed burns and/or "streaks" where the laser does not turn off. I am using Marlin 1.1.4 on a RAMPS 1.4 board (clone) on an Arduino close also. When I am not printing, the pulses are perfect and I can control the pulse width with M42 P6(or 44) S0 (to 255) and it follows just fine. It is ONLY while I am printing and the steppers are moving that things go south. This also occurs on D9 (fan) and that is why I am trying these other outputs. These other outputs use different timers in the 2560 as well. I have tried all sorts and combinations of firmware settings, different USB cable and different USB ports on my computer, with no change. What might I be missing?</p>
<p>Thank you all for your suggestions and help.</p> <p>It appears that I was just running the printer too fast and slowing it down to about 10% of my original speed "fixed" my problem. I don't know where i got the rediculous speed from, but 1200 mm/min is WAY too fast. More like 150 to maybe 200 mm/min is what it should have been.</p> <p>Oh well.. comes under the heading "pay attention" I guess!</p>
<p>This is a stab in the dark but maybe the Arduino (clone or genuine) and RAMPS1.4 combination is not powerful enough to handle the calculations required to control the laser and printing simultaneously (although I can't really see why the additional processing to control a laser would be over taxing the processor. However your comment about slowing the printing seems to help alleviate the issue, does back up the hypothesis). I have read that the ATmega256, and lesser AVR microcontrollers, can be working at its limits, when controlling a 3D printer and having to deal with arcs, or something that requires complex calculations. </p> <p>Some printer control boards, such as the Smoothie, use different processors (ARM?) in order to supersede these issues. From <a href="http://hackaday.com/2013/09/06/3d-printering-electronics-boards/" rel="nofollow noreferrer">3D Printering: Electronics boards</a>. </p> <blockquote> <p>The above boards use AVR microcontrollers. While they work for what they’re intended to do, there are a few limitations. Arcs and circles are a little weird to program, and using these boards for something other than a cartesian 3D printer – a CNC machine, or a laser cutter, for example – is a bit out of the ordinary. The Smoothie board is the solution to these problems.</p> </blockquote> <p>So, if you have discounted power issues, it could be due to computing power and it <em>may</em> be worth considering using a different, more powerful, controller?</p>
650
<p>As an example take the following code:</p> <pre><code>public enum ExampleEnum { FooBar, BarFoo } public class ExampleClass : INotifyPropertyChanged { private ExampleEnum example; public ExampleEnum ExampleProperty { get { return example; } { /* set and notify */; } } } </code></pre> <p>I want a to databind the property ExampleProperty to a ComboBox, so that it shows the options "FooBar" and "BarFoo" and works in mode TwoWay. Optimally I want my ComboBox definition to look something like this:</p> <pre><code>&lt;ComboBox ItemsSource="What goes here?" SelectedItem="{Binding Path=ExampleProperty}" /&gt; </code></pre> <p>Currently I have handlers for the ComboBox.SelectionChanged and ExampleClass.PropertyChanged events installed in my Window where I do the binding manually.</p> <p>Is there a better or some kind of canonical way? Would you usually use Converters and how would you populate the ComboBox with the right values? I don't even want to get started with i18n right now.</p> <p><strong>Edit</strong></p> <p>So one question was answered: How do I populate the ComboBox with the right values.</p> <p>Retrieve Enum values as a list of strings via an ObjectDataProvider from the static Enum.GetValues method:</p> <pre><code>&lt;Window.Resources&gt; &lt;ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="ExampleEnumValues"&gt; &lt;ObjectDataProvider.MethodParameters&gt; &lt;x:Type TypeName="ExampleEnum" /&gt; &lt;/ObjectDataProvider.MethodParameters&gt; &lt;/ObjectDataProvider&gt; &lt;/Window.Resources&gt; </code></pre> <p>This I can use as an ItemsSource for my ComboBox:</p> <pre><code>&lt;ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}"/&gt; </code></pre>
<p>You can create a custom markup extension.</p> <p>Example of usage:</p> <pre><code>enum Status { [Description(&quot;Available.&quot;)] Available, [Description(&quot;Not here right now.&quot;)] Away, [Description(&quot;I don't have time right now.&quot;)] Busy } </code></pre> <p>At the top of your XAML:</p> <pre><code> xmlns:my=&quot;clr-namespace:namespace_to_enumeration_extension_class </code></pre> <p>and then...</p> <pre><code>&lt;ComboBox ItemsSource=&quot;{Binding Source={my:Enumeration {x:Type my:Status}}}&quot; DisplayMemberPath=&quot;Description&quot; SelectedValue=&quot;{Binding CurrentStatus}&quot; SelectedValuePath=&quot;Value&quot; /&gt; </code></pre> <p>And the implementation...</p> <pre><code>public class EnumerationExtension : MarkupExtension { private Type _enumType; public EnumerationExtension(Type enumType) { if (enumType == null) throw new ArgumentNullException(&quot;enumType&quot;); EnumType = enumType; } public Type EnumType { get { return _enumType; } private set { if (_enumType == value) return; var enumType = Nullable.GetUnderlyingType(value) ?? value; if (enumType.IsEnum == false) throw new ArgumentException(&quot;Type must be an Enum.&quot;); _enumType = value; } } public override object ProvideValue(IServiceProvider serviceProvider) // or IXamlServiceProvider for UWP and WinUI { var enumValues = Enum.GetValues(EnumType); return ( from object enumValue in enumValues select new EnumerationMember{ Value = enumValue, Description = GetDescription(enumValue) }).ToArray(); } private string GetDescription(object enumValue) { var descriptionAttribute = EnumType .GetField(enumValue.ToString()) .GetCustomAttributes(typeof (DescriptionAttribute), false) .FirstOrDefault() as DescriptionAttribute; return descriptionAttribute != null ? descriptionAttribute.Description : enumValue.ToString(); } public class EnumerationMember { public string Description { get; set; } public object Value { get; set; } } } </code></pre>
<p>Try using </p> <pre><code>&lt;ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}" SelectedValue="{Binding Path=ExampleProperty}" /&gt; </code></pre>
8,317
<p>I have a start of a webapp that I wrote without using the Object Oriented features of PHP.</p> <p>I don't really know if it is worth it to go back and rewrite the parts I have finished. Is object oriented PHP worth rewriting all or part of a decent working app?</p>
<p>Given that you have an incomplete app I would say that reworking it into an Object based app will probably be helpful. </p> <p>One thing to consider is the expected size of the end application. Below a certain complexity Object based may be overkill except for the learning experience.</p> <p>I started out avoiding Objects like the plague because my initial introduction to them in university classes was terrible. I somewhat recently had to work on a project which was implemented in php objects. making the required changes was much easier than other projects. I have since then worked in the object model frequently and find it very handy for quick creation and easier upkeep.</p>
<p>I would say try and go OO just because what you have can be reused much easier than procedural <em>if done right</em> </p> <p>I will also say that OO is much more organized then procedural. When your at a small scale it's easy to get away with sloppy code OO or not. But when you get to larger projects your procedural must be much more organized and thought out. Where as on some larger projects OO tends to force you to be more organized making things a little easier.</p>
8,197
<p>I want to get the results of a stored procedure and place them into a CSV file onto an FTP location.</p> <p>The catch though is that I cannot create a local/temporary file that I can then FTP over.</p> <p>The approach I was taking was to use an SSIS package to create a temporary file and then have a FTP Task within the pack to FTP the file over, but our DBA's do not allow temporary files to be created on any servers.</p> <h2><a href="https://stackoverflow.com/questions/20587/execute-stored-procedure-sql-2005-and-place-results-into-a-csv-file-on-a-ftp-lo#20596">in reply to Yaakov Ellis</a></h2> <p>I think we will need to convince the DBA's to let me use at least a share on a server that they do not operate, or ask them how they would do it.</p> <h2><a href="https://stackoverflow.com/questions/20587/execute-stored-procedure-sql-2005-and-place-results-into-a-csv-file-on-a-ftp-lo#20689">in reply to Kev</a></h2> <p>I like the idea of the CLR integration, but I don't think our DBA's even know what that is <em>lol</em> and they would probably not allow it either. But I will probably be able to do this within a Script Task in an SSIS package that can be scheduled.</p>
<p>This step-by-step example is for others who might stumble upon this question. This example uses <em>Windows Server 2008 R2 server</em> and <em>SSIS 2008 R2</em>. Even though, the example uses <em>SSIS 2008 R2</em>, the logic used is applicable to <em>SSIS 2005</em> as well. Thanks to <code>@Kev</code> for the <em>FTPWebRequest</em> code.</p> <p>Create an SSIS package (<a href="http://learnbycoding.com/2011/07/creating-a-simple-ssis-package-using-bids/">Steps to create an SSIS package</a>). I have named the package in the format YYYYMMDD_hhmm in the beginning followed by <em>SO</em> stands for Stack Overflow, followed by the <em>SO question id</em>, and finally a description. I am not saying that you should name your package like this. This is for me to easily refer this back later. Note that I also have two Data Sources namely <em>Adventure Works</em> and <em>Practice DB</em>. I will be using <em>Adventure Works</em> data source, which points to <em>AdventureWorks</em> database downloaded from <a href="http://msftdbprodsamples.codeplex.com/">this link</a>. Refer screenshot <strong>#1</strong> at the bottom of the answer.</p> <p>In the <em>AdventureWorks</em> database, create a stored procedure named <em>dbo.GetCurrency</em> using the below given script.</p> <pre><code>CREATE PROCEDURE [dbo].[GetCurrency] AS BEGIN SET NOCOUNT ON; SELECT TOP 10 CurrencyCode , Name , ModifiedDate FROM Sales.Currency ORDER BY CurrencyCode END GO </code></pre> <p>On the package’s Connection Manager section, right-click and select <em>New Connection From Data Source</em>. On the <em>Select Data Source</em> dialog, select <em>Adventure Works</em> and click <em>OK</em>. You should now see the Adventure Works data source under the Connection Managers section. Refer screenshot <strong>#2</strong>, <strong>#3</strong> and <strong>#4</strong>.</p> <p>On the package, create the following variables. Refer screenshot <strong>#5</strong>.</p> <ul> <li><p><em>ColumnDelimiter</em>: This variable is of type String. This will be used to separate the column data when it is written to the file. In this example, we will be using comma (,) and the code is written to handle only displayable characters. For non-displayable characters like tab (\t), you might need to change the code used in this example accordingly.</p></li> <li><p><em>FileName</em>: This variable is of type String. It will contain the name of the file. In this example, I have named the file as Currencies.csv because I am going to export list of currency names.</p></li> <li><p><em>FTPPassword</em>: This variable is of type String. This will contain the password to the FTP website. Ideally, the package should be encrypted to hide sensitive information.</p></li> <li><p><em>FTPRemotePath</em>: This variable is of type String. This will contain the FTP folder path to which the file should be uploaded to. For example if the complete FTP URI is <a href="ftp://myFTPSite.com/ssis/samples/uploads">ftp://myFTPSite.com/ssis/samples/uploads</a>, then the RemotePath would be /ssis/samples/uploads.</p></li> <li><p><em>FTPServerName</em>: This variable is of type String. This will contain the FTP site root URI. For example if the complete FTP URI is <a href="ftp://myFTPSite.com/ssis/samples/uploads">ftp://myFTPSite.com/ssis/samples/uploads</a>, then the FTPServerName would contain <a href="ftp://myFTPSite.com">ftp://myFTPSite.com</a>. You can combine FTPRemotePath with this variable and have a single variable. It is up to your preference.</p></li> <li><p><em>FTPUserName</em>:This variable is of type String. This will contain the user name that will be used to connect to the FTP website.</p></li> <li><p><em>ListOfCurrencies</em>: This variable is of type Object. This will contain the result set from the stored procedure and it will be looped through in the Script Task.</p></li> <li><p><em>ShowHeader</em>: This variable is of type Boolean. This will contain values true/false. True indicates that the first row in the file will contain Column names and False indicates that the first row will not contain Column names.</p></li> <li><p><em>SQLGetData</em>: This variable is of type String. This will contain the Stored Procedure execution statement. This example uses the value EXEC dbo.GetCurrency</p></li> </ul> <p>On the package’s <em>Control Flow</em> tab, place an <em>Execute SQL Task</em> and name it as <em>Get Data</em>. Double-click on the Execute SQL Task to bring the <em>Execute SQL Task Editor</em>. On the <em>General</em> section of the <em>Execute SQL Task Editor</em>, set the <em>ResultSet</em> to <code>Full result set</code>, the <em>Connection</em> to <code>Adventure Works</code>, the <em>SQLSourceType</em> to <code>Variable</code> and the <em>SourceVariable</em> to <code>User::SQLGetData</code>. On the Result Set section, click Add button. Set the Result Name to <code>0</code>, this indicates the index and the Variable to <code>User::ListOfCurrencies</code>. The output of the stored procedure will be saved to this object variable. Click <em>OK</em>. Refer screenshot <strong>#6</strong> and <strong>#7</strong>.</p> <p>On the package’s <em>Control Flow</em> tab, place a Script Task below the Execute SQL Task and name it as <em>Save to FTP</em>. Double-click on the Script Task to bring the <em>Script Task Editor</em>. On the Script section, click the <code>Edit Script…</code> button. Refer screenshot <strong>#8</strong>. This will bring up the Visual Studio Tools for Applications (VSTA) editor. Replace the code within the class <code>ScriptMain</code> in the editor with the code given below. Also, make sure that you add the using statements to the namespaces <code>System.Data.OleDb</code>, <code>System.IO</code>, <code>System.Net</code>, <code>System.Text</code>. Refer screenshot <strong>#9</strong> that highlights the code changes. Close the VSTA editor and click Ok to close the Script Task Editor. Script code takes the object variable ListOfCurrencies and stores it into a DataTable with the help of OleDbDataAdapter because we are using OleDb connection. The code then loops through each row and if the variable ShowHeader is set to true, the code will include the Column names in the first row written to the file. The result is stored in a stringbuilder variable. After the string builder variable is populated with all the data, the code creates an FTPWebRequest object and connects to the FTP Uri by combining the variables FTPServerName, FTPRemotePath and FileName using the credentials provided in the variables FTPUserName and FTPPassword. Then the full string builder variable contents are written to the file. The method WriteRowData is created to loop through columns and provide the column names or data information based on the parameters passed.</p> <pre><code>using System; using System.Data; using Microsoft.SqlServer.Dts.Runtime; using System.Windows.Forms; using System.Data.OleDb; using System.IO; using System.Net; using System.Text; namespace ST_7033c2fc30234dae8086558a88a897dd.csproj { [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")] public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase { #region VSTA generated code enum ScriptResults { Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success, Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure }; #endregion public void Main() { Variables varCollection = null; Dts.VariableDispenser.LockForRead("User::ColumnDelimiter"); Dts.VariableDispenser.LockForRead("User::FileName"); Dts.VariableDispenser.LockForRead("User::FTPPassword"); Dts.VariableDispenser.LockForRead("User::FTPRemotePath"); Dts.VariableDispenser.LockForRead("User::FTPServerName"); Dts.VariableDispenser.LockForRead("User::FTPUserName"); Dts.VariableDispenser.LockForRead("User::ListOfCurrencies"); Dts.VariableDispenser.LockForRead("User::ShowHeader"); Dts.VariableDispenser.GetVariables(ref varCollection); OleDbDataAdapter dataAdapter = new OleDbDataAdapter(); DataTable currencies = new DataTable(); dataAdapter.Fill(currencies, varCollection["User::ListOfCurrencies"].Value); bool showHeader = Convert.ToBoolean(varCollection["User::ShowHeader"].Value); int rowCounter = 0; string columnDelimiter = varCollection["User::ColumnDelimiter"].Value.ToString(); StringBuilder sb = new StringBuilder(); foreach (DataRow row in currencies.Rows) { rowCounter++; if (rowCounter == 1 &amp;&amp; showHeader) { WriteRowData(currencies, row, columnDelimiter, true, ref sb); } WriteRowData(currencies, row, columnDelimiter, false, ref sb); } string ftpUri = string.Concat(varCollection["User::FTPServerName"].Value, varCollection["User::FTPRemotePath"].Value, varCollection["User::FileName"].Value); FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpUri); ftp.Method = WebRequestMethods.Ftp.UploadFile; string ftpUserName = varCollection["User::FTPUserName"].Value.ToString(); string ftpPassword = varCollection["User::FTPPassword"].Value.ToString(); ftp.Credentials = new System.Net.NetworkCredential(ftpUserName, ftpPassword); using (StreamWriter sw = new StreamWriter(ftp.GetRequestStream())) { sw.WriteLine(sb.ToString()); sw.Flush(); } Dts.TaskResult = (int)ScriptResults.Success; } public void WriteRowData(DataTable currencies, DataRow row, string columnDelimiter, bool isHeader, ref StringBuilder sb) { int counter = 0; foreach (DataColumn column in currencies.Columns) { counter++; if (isHeader) { sb.Append(column.ColumnName); } else { sb.Append(row[column].ToString()); } if (counter != currencies.Columns.Count) { sb.Append(columnDelimiter); } } sb.Append(System.Environment.NewLine); } } } </code></pre> <p>Once the tasks have been configured, the package’s Control Flow should look like as shown in screenshot <strong>#10</strong>.</p> <p>Screenshot <strong>#11</strong> shows the output of the stored procedure execution statement EXEC dbo.GetCurrency. </p> <p>Execute the package. Screenshot <strong>#12</strong> shows successful execution of the package.</p> <p>Using the <em>FireFTP</em> add-on available in <em>FireFox</em> browser, I logged into the FTP website and verified that the file has been successfully uploaded to the FTP website. Refer screenshot #<strong>13</strong>.</p> <p>Examining the contents by opening the file in Notepad++ shows that it matches with the stored procedure output. Refer screenshot #<strong>14</strong>.</p> <p>Thus, the example demonstrated how to write results from database to an FTP website without having to use temporary/local files.</p> <p>Hope that helps someone.</p> <p><strong>Screenshots:</strong></p> <p><strong>#1</strong>: Solution_Explorer</p> <p><img src="https://i.stack.imgur.com/1C8VG.png" alt="Solution_Explorer"></p> <p><strong>#2</strong>: New_Connection_From_Data_Source</p> <p><img src="https://i.stack.imgur.com/hYZqX.png" alt="New_Connection_From_Data_Source"></p> <p><strong>#3</strong>: Select_Data_Source</p> <p><img src="https://i.stack.imgur.com/ccxdu.png" alt="Select_Data_Source"></p> <p><strong>#4</strong>: Connection_Managers</p> <p><img src="https://i.stack.imgur.com/Rw8xv.png" alt="Connection_Managers"></p> <p><strong>#5</strong>: Variables</p> <p><img src="https://i.stack.imgur.com/Ov6Ac.png" alt="Variables"></p> <p><strong>#6</strong>: Execute_SQL_Task_Editor_General</p> <p><img src="https://i.stack.imgur.com/sMP6f.png" alt="Execute_SQL_Task_Editor_General"></p> <p><strong>#7</strong>: Execute_SQL_Task_Editor_Result_Set</p> <p><img src="https://i.stack.imgur.com/D7iKl.png" alt="Execute_SQL_Task_Editor_Result_Set"></p> <p><strong>#8</strong>: Script_Task_Editor</p> <p><img src="https://i.stack.imgur.com/Yz20f.png" alt="Script_Task_Editor"></p> <p><strong>#9</strong>: Script_Task_VSTA_Code</p> <p><img src="https://i.stack.imgur.com/C39Xc.png" alt="Script_Task_VSTA_Code"></p> <p><strong>#10</strong>: Control_Flow_Tab</p> <p><img src="https://i.stack.imgur.com/kFLeF.png" alt="Control_Flow_Tab"></p> <p><strong>#11</strong>: Query_Results</p> <p><img src="https://i.stack.imgur.com/t3aGT.png" alt="Query_Results"></p> <p><strong>#12</strong>: Package_Execution_Successful</p> <p><img src="https://i.stack.imgur.com/tYKwu.png" alt="Package_Execution_Successful"></p> <p><strong>#13</strong>: File_In_FTP</p> <p><img src="https://i.stack.imgur.com/Yt8fD.png" alt="File_In_FTP"></p> <p><strong>#14</strong>: File_Contents</p> <p><img src="https://i.stack.imgur.com/nuf2M.png" alt="File_Contents"></p>
<p>Try using a CLR stored procedure. You might be able to come up with something, but without first creating a temporary file, it might still be difficult. Could you set up a share on another machine and write to that, and then ftp from there?</p>
4,092