instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>What is the command to list all triggers in a MySQL database?</p>
|
<p>The command for listing all triggers is:</p>
<pre><code>show triggers;
</code></pre>
<p>or you can access the <code>INFORMATION_SCHEMA</code> table directly by:</p>
<pre><code>select trigger_schema, trigger_name, action_statement
from information_schema.triggers
</code></pre>
<ul>
<li>You can do this from version 5.0.10 onwards.</li>
<li>More information about the <a href="http://dev.mysql.com/doc/refman/5.0/en/triggers-table.html" rel="noreferrer"><code>TRIGGERS</code> table is here</a>.</li>
</ul>
|
<p>This sentence could contribute to solving the problem:</p>
<pre><code>select LOWER(concat('delimiter |', '\n', 'create trigger %data_base_name%.', TRIGGER_NAME, '\n',
' ', ACTION_TIMING, ' ', EVENT_MANIPULATION, ' on %data_base_name%.', EVENT_OBJECT_TABLE, ' for each row', '\n',
ACTION_STATEMENT, '\n',
'|')) AS TablaTriggers from information_schema.triggers where
information_schema.triggers.trigger_schema like '%data_base_name%'
</code></pre>
| 6,957
|
<p>One of my biggest typographical frustrations about HTML is the way that it mangles conjoined whitespace. For example if I have:</p>
<pre><code><span>Following punctuation rules. With two spaces after the period. </span>
</code></pre>
<p>One of the two spaces following the period will be considered to be insignificant whitespace and be removed. I can of course, force the whitespace to be significant with: </p>
<pre><code><span>Following punctuation rules.&nbsp; With two spaces after the period. </span>
</code></pre>
<p>but it just irks me to have to do that and I usually don't bother. Does anyone out there automatically insert significant whitespace into external content submissions that are intended for a web page?</p>
|
<p>For your specific example, there is no need to worry about it. Web browsers perform typographical rendering and place the correct amount of space between periods and whatever character follows (and it's different depending on the next character, according to kerning rules.)</p>
<p>If you want line breaks, <br/> isn't really a big deal, is it?</p>
<hr>
<p>Not sure what's worthy of a downmod here... You should not be forcing two spaces after a period, unless you're using a monospace font. For proportional fonts, the rederer kerns the right amount of space after a period. See <a href="http://www.webword.com/reports/period.html" rel="noreferrer">here</a> and <a href="http://everything2.com/node/540926" rel="noreferrer">here</a> for detailed discussions.</p>
|
<p>You'd better use white-space: pre-wrap than white-space: pre or &nbsp;
With your example, the latter solutions can start a new line on "rules.&nbsp;" just because your <strong>n</strong>on-<strong>b</strong>reakable <strong>sp</strong>ace hit the end of the line.</p>
| 3,710
|
<p>Do you expect your WPF developers to know expression blend?</p>
<p>Any good resources for learning more about Blend?</p>
<p>[UPDATE] Does knowing blend make you more productive?</p>
|
<p>I found Blend a great way to ease into XAML. Many of the common things you want to do are easy in Blend, especially databinding. Databinding has no intellisense and I found doing things in Blend a great way of discovering how do write the databinding syntax.</p>
<p>I now find myself mostly editing raw XAML buy hand. </p>
<p>The areas where blend is really handy:</p>
<ul>
<li>Customizing templates. </li>
<li>Animation</li>
<li>Breaking the UI down into user controls</li>
</ul>
|
<p>Developers don't <strong>need</strong> to know Expression at all.</p>
<p>What you <strong>do</strong> need to know is XAML and not hide behind some tool, which would be the worst thing you could do as a WPF developer. Your tool of choice is yours to decide on. I used to use the XML editor in Visual Studio.</p>
<p>The only persons who <strong>need</strong> to know Blend are the ones in charge of the visual aspect of your WPF application. They have to be able to understand how to skin your application with templates, but other than that, they can keep to Blend exclusively.</p>
| 8,658
|
<p>I'm trying to increase adhesion of the first layer (as well as to fill gaps for a more even surface) by squeezing more material against the bed. The obvious way of doing that in Cura is by increasing the "Initial Layer Flow", i.e. to make the printer push out slightly more material than it normally would.</p>
<p>But then there is also a setting called "Initial Layer Width" and according to the the Cura Settings Guide (see image below), increasing line width will make the nozzle </p>
<blockquote>
<p>extrude more material and that material has to flow wider outward. This causes the nozzle to press the material harder on the build plate (...) Not only will the lines be wider ... but they will also be farther apart ... by the same factor, so it would not produce overextrusion</p>
</blockquote>
<p>This seems to imply that increasing the initial layer width will automatically <em>also</em> increase initial layer flow. If this is so, the question is: which setting is applied first? </p>
<p>In any case, it seems that the two settings should not be applied together, if they manipulate the same variable (but I have not seen this recommendation anywhere). Which leads me to my may question: <strong>what is the difference between the two settings?</strong> More specifically (based on my above reasoning): <strong>what else does "Initial Layer Width" manipulate, apart from the flow rate in the first layer?</strong> Just the distance between the lines so that increasing the setting will lead to fewer lines?</p>
<p><a href="https://i.stack.imgur.com/yzyn4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzyn4.png" alt="enter image description here"></a></p>
|
<p>Cura option <code>Initial Layer Width</code> will cause lines to be further apart or closer together, based on the value you set with respect to the default. The required filament flow to produce these lines is calculated based on the width of the line and the overlap between lines (and layer height).</p>
<p>The Cura option <code>Initial Layer Flow</code> adjusts flow for the current line width with a multiplier, this means that the distance between lines stays the same. I.e. with this parameter you can overextrude to push more material to the build plate. Note that for a well calibrated machine this is not necessary. My printers use the paper method to determine the initial <code>Z=0</code> for levelling and never use a wider initial line width or overextrusion of the first layer to get perfect filled mirror finish first layers on glass. However, if (paper) tape is used, the bed may be less flat and overextrusion might be beneficial for better adhesion.</p>
<p>The options can be used together, the multiplier will act upon the calculated flow.</p>
|
<p>The typical consensus is that you increase the layer flow initially for better adhesion, though from my experience I <strong>decrease</strong> it!<br />
My first layer is printed at between 70-75 % layer flow, this gives the best adhesion and best visuals when printing with ASA or ABS.<br />
From layer 2 on I've 105 % layer flow.</p>
<p>The reason is that my first layer is printed "officially" at 0.27mm but in reality, it's more like 0.05 mm thickness. That's manually finetuned while printing after a material change, basically, the thickness is adjusted for perfect grip on the build plate.<br />
When left at 100 % flow rate this will cause ripples or waves on the bottom, it's excess material that builds up along the printed lines.<br />
At 70 % the wrong initial distance is compensated (visually) while maintaining perfect adhesion.</p>
<p>Conclusion: Fine-tune your printer and settings for each material used, a general answer is not possible. Especially true for difficult materials like ABS, ASS, or Nylon.<br />
The best is to watch the printer while it is printing and adapt the mechanical properties first, then fine tuning the flow rates.</p>
| 1,538
|
<p>I would like to make a 24 V (3D printer board and shield) setup, as opposed to the usual 12 V, and to do so I had been considering using the Taurino Power board, or the clone Eruduino. However, I just found this board:</p>
<p><a href="https://i.stack.imgur.com/FoUYh.jpg" rel="nofollow noreferrer" title="Re-ARM microcontroller, with SD card slot"><img src="https://i.stack.imgur.com/FoUYh.jpg" alt="Re-ARM microcontroller, with SD card slot" title="Re-ARM microcontroller, with SD card slot"></a></p>
<p>The specifications state a DC input of up to 36 V:</p>
<p><a href="https://i.stack.imgur.com/UX1QF.png" rel="nofollow noreferrer" title="Specifications"><img src="https://i.stack.imgur.com/UX1QF.png" alt="Specifications" title="Specifications"></a></p>
<p>Does anyone know whether that <em>really</em> means it can handle 24 V in the same manner as the Taurino/Eruduino? If so, then that looks like a double win: not only 24 V support, but also a faster processor. Anyone have experience with this board?</p>
<p>I was thinking of using with a RAMPS1.6 Plus (maybe), or just a regular RAMPS 1.4 (<a href="https://reprap.org/wiki/RAMPS_24v" rel="nofollow noreferrer">hacked to support 24 V</a>). I'm just shopping about, and I thought that if I was going to spend £14 on an Eruduino, then I just as well spend that money on something better.</p>
<p>It does work with Marlin apparently, as some of the customer reviews would suggest, but none of the reviews that I could find referred to a 24 V setup (heated bed etc.), hence my question.</p>
|
<p>Given that the capacitor near the input is quite clearly marked 35 V, a 36 V rating seems questionable.</p>
<p>The (buck) regulator used on the (genuine version of the) board is the <a href="http://www.aosmd.com/res/data_sheets/AOZ1282CI.pdf" rel="nofollow noreferrer">AOZ1282CI</a> which supports up to 36 V input. This is probably where they got the 36 V rating from, but obviously the 35 V-rated capacitors drop the input voltage down below this.</p>
<p><a href="https://reprap.org/mediawiki/images/f/fa/Re_ARM_Schematic.pdf" rel="nofollow noreferrer">Schematics for the board are available on the RepRap wiki</a> and show that the input voltage only feeds into the regulator. I see no reason why this board couldn't handle 24 V input, as this is well within the rating of both the regulator and the capacitors.</p>
|
<p>For completion, I've just seen this, <a href="https://www.reddit.com/r/3Dprinting/comments/9wfrmk/can_a_ramps_16_support_24v/" rel="nofollow noreferrer">Can a ramps 1.6 support 24v?</a> (which basically confirms the 24 V support of the Re-ARM board) although it isn't particularly useful w.r.t. the RAMPS 1.6 side of things, although I would imagine the the <a href="https://reprap.org/wiki/RAMPS_24v" rel="nofollow noreferrer">24 V RAMPS hack</a> would still apply.</p>
<p>In addition, Alex Kenis does a great review, and he has successfully tried it with 24 V, watch <a href="https://www.youtube.com/watch?v=P-wekOqM5gY" rel="nofollow noreferrer">32-bit series part 4: Re-ARM board "review?"</a>. Whilst the RE-ARm offers a lot of advantages, some of the main down points to be aware of are:</p>
<ul>
<li>No 5 V <em>analogue inputs</em>, they are 3.3 V, so the endstops use 3V3 logic (not a problem from mechanical switches, but 5 V optical endstops will have a problem</li>
<li>Some of the pins of the Mega are missing from the Re-ARM.</li>
</ul>
| 1,412
|
<p>I have a page where there is a column and a content div, somewhat like this:</p>
<pre><code><div id="container">
<div id="content">blahblahblah</div>
<div id="column"> </div>
</div>
</code></pre>
<p>With some styling I have an image that is split between the column and the content but needs to maintain the same vertical positioning so that it lines up.</p>
<p>Styling is similar to this:</p>
<pre class="lang-css prettyprint-override"><code>#column
{
width:150px;
height:450px;
left:-150px;
bottom:-140px;
background:url(../images/image.png) no-repeat;
position:absolute;
z-index:1;
}
#container
{
background:transparent url(../images/container.png) no-repeat scroll left bottom;
position:relative;
width:100px;
}
</code></pre>
<p>This works great when content in <code>#content</code> is dynamically loaded before rendering. This also works great in firefox always. However, in IE6 and IE7 if I use javascript to change the content (and thus height) of <code>#content</code>, the images no longer line up (<code>#column</code> doesn't move). If I use IE Developer Bar to just update the div (say add position:absolute manually) the image jumps down and lines up again.</p>
<p>Is there something I am missing here?</p>
<p>@Ricky - Hmm, that means in this case there is no solution I think. At its best there will be a jaggedy matchup afterwards but as my content expands and contracts etc. hiding/showing doesn't work out to be practical. Still thanks for answering with the best solution.</p>
|
<p>Its a bug in the rendering engine. I run into it all the time. One potential way to solve it is to hide and show the div whenever you change the content (that in turn changes the height):</p>
<pre><code>var divCol = document.getElementById('column');
divCol.style.display = 'none';
divCol.style.display = 'block';
</code></pre>
<p>Hopefully this happens fast enough that it isn't noticeable :)</p>
|
<p>If you are worried about getting a flicker from showing and hiding divCol you can ajust another css property and it will have the same effect
e.g.</p>
<pre><code>var divCol = document.getElementById('column');
divCol.style.zoom = '1';
divCol.style.zoom = '';
</code></pre>
| 5,395
|
<p>I'm taking the leap: my PHP scripts will ALL fail gracefully!</p>
<p>At least, that's what I'm hoping for...`</p>
<p>I don't want to wrap (practically) every single line in <code>try...catch</code> statements, so I think my best bet is to make a custom error handler for the beginning of my files.</p>
<p>I'm testing it out on a practice page:</p>
<pre><code>function customError($level,$message,$file,$line,$context) {
echo "Sorry, an error has occured on line $line.<br />";
echo "The function that caused the error says $message.<br />";
die();
}
set_error_handler("customError");
echo($imAFakeVariable);
</code></pre>
<p>This works fine, returning:</p>
<blockquote>
<p>Sorry, an error has occurred on line 17. The function that caused the
error says Undefined variable: imAFakeVariable.</p>
</blockquote>
<p>However, this setup doesn't work for undefined functions.</p>
<pre><code>function customError($level,$message,$file,$line,$context) {
echo "Sorry, an error has occured on line $line.<br />";
echo "The function that caused the error says $message.<br />";
die();
}
set_error_handler("customError");
imAFakeFunction();
</code></pre>
<p>This returns:</p>
<blockquote>
<p>Fatal error: Call to undefined function: imafakefunction() in
/Library/WebServer/Documents/experimental/errorhandle.php on line 17</p>
</blockquote>
<p>Why isn't my custom error handler catching undefined functions? Are there other problems that this will cause?</p>
|
<p><code>set_error_handler</code> is designed to handle errors with codes of: <code>E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE</code>. This is because <code>set_error_handler</code> is meant to be a method of reporting errors thrown by the <em>user</em> error function <code>trigger_error</code>.</p>
<p>However, I did find this comment in the manual that may help you:</p>
<blockquote>
<p>"The following error types cannot be handled with a user defined function: <code>E_ERROR</code>, <code>E_PARSE</code>, <code>E_CORE_ERROR</code>, <code>E_CORE_WARNING</code>, <code>E_COMPILE_ERROR</code>, <code>E_COMPILE_WARNING</code>, and most of <code>E_STRICT</code> raised in the file where <code>set_error_handler()</code> is called."</p>
<p>This is not exactly true. <code>set_error_handler()</code> can't handle them, but <code>ob_start()</code> can handle at least <code>E_ERROR</code>.</p>
<pre><code><?php
function error_handler($output)
{
$error = error_get_last();
$output = "";
foreach ($error as $info => $string)
$output .= "{$info}: {$string}\n";
return $output;
}
ob_start('error_handler');
will_this_undefined_function_raise_an_error();
?>
</code></pre>
</blockquote>
<p>Really though these errors should be silently reported in a file, for example. Hopefully you won't have many <code>E_PARSE</code> errors in your project! :-)</p>
<p>As for general error reporting, stick with Exceptions (I find it helpful to make them tie in with my MVC system). You can build a pretty versatile Exception to provide options via buttons and add plenty of description to let the user know what's wrong.</p>
|
<p>Very interesting thing that I've discovered today as I was facing the similar problem. If you use the following - it will catch the error with your custom error handler function / method:</p>
<pre><code>ini_set('display_errors', 'Off');
error_reporting(-1);
set_error_handler(array("Cmd\Exception\Handler", "getError"), -1 & ~E_NOTICE & ~E_USER_NOTICE);
</code></pre>
<p>By setting 'display_errors' to 'Off' you can catch still catch them with the handler.</p>
| 5,723
|
<p>I'm trying to extend some "base" classes in Python:</p>
<pre><code>class xlist (list):
def len(self):
return len(self)
def add(self, *args):
self.extend(args)
return None
class xint (int):
def add(self, value):
self += value
return self
x = xlist([1,2,3])
print x.len() ## >>> 3 ok
print x ## >>> [1,2,3] ok
x.add (4, 5, 6)
print x ## >>> [1,2,3,4,5,6] ok
x = xint(10)
print x ## >>> 10 ok
x.add (2)
print x ## >>> 10 # Not ok (#1)
print type(x) ## >>> <class '__main__.xint'> ok
x += 5
print type(x) ## >>> <type 'int'> # Not ok (#2)
</code></pre>
<p>It works fine in the <em>list</em> case because the <em>append</em> method modifies the object "in place", without returning it. But in the <em>int</em> case, the <em>add</em> method doesn't modify the value of the external <em>x</em> variable. I suppose that's fine in the sense that <em>self</em> is a local variable in the <em>add</em> method of the class, but this is preventing me from modifying the initial value assigned to the instance of the class.</p>
<p>Is it possible to extend a class this way or should I define a class property with the base type and map all the needed methods to this property?</p>
|
<p>Your two <code>xint</code> examples don't work for two different reasons.</p>
<p>The first doesn't work because <code>self += value</code> is equivalent to <code>self = self + value</code> which just reassigns the local variable <code>self</code> to a different object (an integer) but doesn't change the original object. You can't really get this </p>
<pre><code>>>> x = xint(10)
>>> x.add(2)
</code></pre>
<p>to work with a subclass of <code>int</code> since integers are <a href="http://docs.python.org/ref/objects.html" rel="noreferrer">immutable</a>.</p>
<p>To get the second one to work you can define an <a href="http://docs.python.org/ref/numeric-types.html" rel="noreferrer"><code>__add__</code> method</a>, like so:</p>
<pre><code>class xint(int):
def __add__(self, value):
return xint(int.__add__(self, value))
>>> x = xint(10)
>>> type(x)
<class '__main__.xint'>
>>> x += 3
>>> x
13
>>> type(x)
<class '__main__.xint'>
</code></pre>
|
<p>Ints are immutable and you can't modify them in place, so you should go with option #2 (because option #1 is impossible without some trickery).</p>
| 5,363
|
<p>What are the best resources for Wordpress theme-development? I am currently in the phase of starting my own blog, and don't want to use one of the many free themes. I already have a theme for my website, so I want to read about best-practices. </p>
<p>Any advice on how to get started would be very welcome :)</p>
<hr>
<p>I have now created my theme (wohoo!), and thought I should summarize the best resources I found. Lets see..</p>
<p><strong>Resources:</strong></p>
<ul>
<li><a href="http://themetation.com/2008/07/14/how-to-create-wordpress-themes-from-scratch-part-1/" rel="nofollow noreferrer">ThemeTation's three-part guide to create a wordpress-theme from scratch</a></li>
<li><a href="https://code.tutsplus.com/articles/how-to-create-a-wordpress-theme-from-scratch--net-706" rel="nofollow noreferrer">Nettuts.com's guide: How to Create a Wordpress Theme from Scratch</a><br>
Didn't actually use this, it's a quite new article, but anyway - it's great. It will get a follow-up in the next few days too..</li>
<li><a href="http://codex.wordpress.org/Theme_Development" rel="nofollow noreferrer">Wordpress.org's own guide on templates</a><br>
Definatly a must-read for everyone new to wordpress-designing.. </li>
<li><a href="http://codex.wordpress.org/The_Loop" rel="nofollow noreferrer">"The loop"</a><br>
Essential knowledge, also a must-read</li>
<li><a href="http://codex.wordpress.org/Template_Tags" rel="nofollow noreferrer">Directory of all the template tags</a><br>
Used by wordpress to actually output blog-content..</li>
</ul>
<p><strong>Inspiration:</strong></p>
<ul>
<li>Smashing Magazine's lists: <a href="http://www.smashingmagazine.com/2008/01/08/100-excellent-free-high-quality-wordpress-themes/" rel="nofollow noreferrer">first</a>, <a href="http://www.smashingmagazine.com/2007/02/09/83-beautiful-wordpress-themes-you-probably-havent-seen/" rel="nofollow noreferrer">one more</a>, <a href="http://www.smashingmagazine.com/2008/08/25/30-free-high-quality-wordpress-themes/" rel="nofollow noreferrer">yet another one</a></li>
<li><a href="http://wordpress.org/extend/themes/" rel="nofollow noreferrer">Wordpress.org's theme-directory</a></li>
</ul>
|
<p>I think that the best way to learn is to look at how other people construct their themes. The first one to start one is the Default Kubrick theme that is included in the standard WordPress install. It has all of the basics and will show you some advanced techniques like including sidebar widgets. Next, in conjunction with the docs on <a href="http://codex.wordpress.org/Theme_Development" rel="noreferrer">theme development</a> (previously mentioned by Mark), <a href="http://codex.wordpress.org/Blog_Design_and_Layout" rel="noreferrer">Blog Design and Layout</a> and <a href="http://codex.wordpress.org/Using_Themes" rel="noreferrer">Using Themes</a>, go to the <a href="http://wordpress.org/extend/themes/" rel="noreferrer">Theme Directory</a> on the Wordpress.org site, download a couple of popular themes, and go through them, looking up any <a href="http://codex.wordpress.org/Stepping_Into_Template_Tags" rel="noreferrer">template tags</a> or techniques that you don't understand. After you do this, you should be more than well-equipped to write your own theme from scratch, or modify an existing theme to your needs. </p>
|
<p>Found a new one over here. it's a good resource if you want to make a simple theme. :)</p>
<p><a href="http://www.webhostingsearch.com/articles/create-your-own-wordpress-theme-tutorial.php" rel="nofollow noreferrer">http://www.webhostingsearch.com/articles/create-your-own-wordpress-theme-tutorial.php</a></p>
| 3,464
|
<p>I get a URL from a user. I need to know:<br/>
a) is the URL a valid RSS feed?<br/>
b) if not is there a valid feed associated with that URL</p>
<p>using PHP/Javascript or something similar</p>
<p>(Ex. <a href="http://techcrunch.com" rel="nofollow noreferrer">http://techcrunch.com</a> fails a), but b) would return their RSS feed)</p>
|
<p>Found something that I wanted:</p>
<p>Google's <a href="http://code.google.com/apis/ajaxfeeds/" rel="noreferrer">AJAX Feed API</a> has a load feed and lookup feed function (Docs <a href="http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_intro_fonje" rel="noreferrer">here</a>).</p>
<p>a) <a href="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.digg.com/rss/index.xml" rel="noreferrer">Load feed</a> provides the feed (and feed status) in JSON</p>
<p>b) <a href="http://ajax.googleapis.com/ajax/services/feed/lookup?v=1.0&q=http://www.techcrunch.com" rel="noreferrer">Lookup feed</a> provides the RSS feed for a given URL</p>
<p>Theres also a find feed function that searches for RSS feeds based on a keyword.</p>
<p>Planning to use this with JQuery's $.getJSON</p>
|
<p>Are you doing this in a specific language, or do you just want details about the RSS specification?</p>
<p>In general, look for the XML prolog:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
</code></pre>
<p>followed by an <rss> element, but you might want to validate it as XML, fully validate it against a DTD, or verify that - for example, each URL referred to is valid, etc. More detail would help.</p>
<p><strong>UPDATE</strong>: Ah - PHP. I've found this library to be pretty useful: <a href="http://magpierss.sourceforge.net/" rel="nofollow noreferrer">MagpieRSS</a></p>
| 8,678
|
<p>I have a list of <code>Foo</code>. Foo has properties <code>Bar</code> and <code>Lum</code>. Some <code>Foo</code>s have identical values for <code>Bar</code>. How can I use lambda/linq to group my <code>Foo</code>s by <code>Bar</code> so I can iterate over each grouping's <code>Lum</code>s?</p>
|
<p><a href="https://stackoverflow.com/questions/46130/how-do-i-group-in-memory-lists#46317">Deeno</a>,</p>
<p>Enjoy:</p>
<pre><code>var foos = new List<Foo> {
new Foo{Bar = 1,Lum = 1},
new Foo{Bar = 1,Lum = 2},
new Foo{Bar = 2,Lum = 3},
};
// Using language integrated queries:
var q = from foo in foos
group foo by foo.Bar into groupedFoos
let lums = from fooGroup in groupedFoos
select fooGroup.Lum
select new { Bar = groupedFoos.Key, Lums = lums };
// Using lambdas
var q = foos.GroupBy(x => x.Bar).
Select(y => new {Bar = y.Key, Lums = y.Select(z => z.Lum)});
foreach (var group in q)
{
Console.WriteLine("Lums for Bar#" + group.Bar);
foreach (var lum in group.Lums)
{
Console.WriteLine(lum);
}
}
</code></pre>
<p>To learn more about LINQ read <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx" rel="nofollow noreferrer">101 LINQ Samples</a></p>
|
<pre><code>var q = from x in list
group x by x.Bar into g
select g;
foreach (var group in q)
{
Console.WriteLine("Group " + group.Key);
foreach (var item in group)
{
Console.WriteLine(item.Bar);
}
}
</code></pre>
| 6,816
|
<p>I have an Ender 5 pro and upgraded from the magnetic bed to the glass version. I print with Prusament PLA on 65 °C bed temp and 220 °C extruder temp. I measured that the glass surface has ~58 °C in the center and ~56 °C on the corners. That should be in the specs of the spool which has a printed recommendation of 50 +- 10 °C for bed and 215 +- 10 °C for extruder temps.</p>
<p>Now I also have a BLTouch and use the TH3D firmware so Z offsets should work correctly and are done with the Z offset wizard present (nozzle touching the bed).</p>
<p>The problem I currently have is that the first layers have "lifts" in them. Also, it seems that the layer itself is not 0.2 mm everywhere. It's close to 0.23 mm on the edges but on the inner there are variances up to 0.36 mm.</p>
<p>Currently, I slice with Cura 4.8.0 on Standard Quality 0.2 mm</p>
<p>How do I get rid of the lifts and irregularity in the layer? Is it a problem with the bed?</p>
<p><a href="https://i.stack.imgur.com/ScOMF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ScOMF.jpg" alt="Lifts" /></a></p>
<p><a href="https://i.stack.imgur.com/wmNBR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wmNBR.jpg" alt="darker areas are 0.36mm" /></a></p>
|
<p>The only time I've seen lifting, away from the edges of the part like this, is when the bed is contaminated with something which will stop the print sticking, like fingerprints and such.</p>
<p>A thorough wipe-down with IPA on the heated bed is usually enough to stop it.</p>
|
<p>I haven't seen lifts that aren't on the edge of the print, such as warping, or the entire printed surface lifts. When I get something like in your photograph, it's because the print surface isn't flat and the first layer matches the surface topology. If the second image shows the print surface, it looks like blobs on the surface that may be keeping it from being flat.</p>
<p>The first layer thickness greatly depends on how high the nozzle is above the print surface. If this distance varies, the first layer thickness will vary. Also make sure your print surface is free of any substances that the hot extruded material might cause to boil.</p>
<p>Any chance you are removing the print from the bed before it cools down. This can distort the print if the material is still soft.</p>
| 1,874
|
<p>I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next time the dbml file is refreshed.</p>
<p>How can this be done?</p>
|
<blockquote>
<p>Is there a way to determine at what point I would encounter a stack overflow?</p>
</blockquote>
<p>Not really. A stack overflow happens when you exhaust the stack space - however...</p>
<ul>
<li>The initial stack size can be changed programatically and may default to different amounts depending on your OS/compiler/etc</li>
<li>How much of it is already used up depends on what your app (and the libraries your app uses) has previously done - this is often impossible to predict</li>
<li>How much of the stack each call requires depends on what you do in your function. If you only allocate say 1 integer on the stack, you may be able to recurse an enourmous amount of times, but if you are allocating a 200k buffer on the stack, not so much.</li>
</ul>
<p>The only times I've ever hit one is in an infinite loop, or using the aforementioned 200k buffer. </p>
<p>I find it far more prefereable for my app to just crash, than for it to loop forever using 100% CPU and have to be forcefully killed (this is a right PITA on a remote server over a bad connection as windows lacks SSH)</p>
<p>A rough guideline: Do you think your recursive function is likely to call itself more than say 10,000 times consecutively? Or are you doing something dumb like allocating 200k buffers on the stack?</p>
<p>If yes, worry about it.<br>
If no, carry on with more important things.</p>
|
<p>Sure - e.g. if you want to traverse a tree structure what else would you use ? </p>
<p>Maybe you would like to have something like a maximum depth to be sure you're not writing an infinite loop. (if this makes sense in your example)</p>
| 5,823
|
<p>I want to print HTML from a C# web service. The web browser control is overkill, and does not function well in a service environment, nor does it function well on a system with very tight security constraints. Is there any sort of free <code>.NET</code> library that will support the printing of a basic HTML page? Here is the code I have so far, which does not run properly.</p>
<pre><code>public void PrintThing(string document)
{
if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
{
Thread thread =
new Thread((ThreadStart) delegate { PrintDocument(document); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
else
{
PrintDocument(document);
}
}
protected void PrintDocument(string document)
{
WebBrowser browser = new WebBrowser();
browser.DocumentText = document;
while (browser.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
browser.Print();
}
</code></pre>
<p>This works fine when called from UI-type threads, but nothing happens when called from a service-type thread. Changing <code>Print()</code> to <code>ShowPrintPreviewDialog()</code> yields the following IE script error:</p>
<blockquote>
<p><strong>Error:</strong> <code>dialogArguments.___IE_PrintType</code> is null or not an object. </p>
<p>URL: <code>res://ieframe.dll/preview.dlg</code></p>
</blockquote>
<p>And a small empty print preview dialog appears.</p>
|
<p>You can print from the command line using the following:</p>
<blockquote>
<p>rundll32.exe
%WINDIR%\System32\mshtml.dll,PrintHTML
"%1"</p>
</blockquote>
<p>Where %1 is the file path of the HTML file to be printed.</p>
<p>If you don't need to print from memory (or can afford to write to the disk in a temp file) you can use:</p>
<pre><code>using (Process printProcess = new Process())
{
string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
printProcess.StartInfo.FileName = systemPath + @"\rundll32.exe";
printProcess.StartInfo.Arguments = systemPath + @"\mshtml.dll,PrintHTML """ + fileToPrint + @"""";
printProcess.Start();
}
</code></pre>
<p>N.B. This only works on Windows 2000 and above I think.</p>
|
<p>I don't know the specific tools, but there are some utilities that record / replay clicks. In other words, you could automate the "click" on the print dialog. (I know this is a hack, but when all else fails...)</p>
| 2,265
|
<p>Using .Net (C#), how can you work with USB devices? </p>
<p>How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write).</p>
<p>Is there a native .Net solution to do this?</p>
|
<p>There is no <em>native</em> (e.g., System libraries) solution for this. That's the reason why <a href="http://www.icsharpcode.net/OpenSource/SharpUSBLib/" rel="nofollow noreferrer">SharpUSBLib</a> exists as mentioned by <a href="https://stackoverflow.com/questions/68749/working-with-usb-devices-in-net#68777">moobaa</a>.</p>
<p>If you wish to roll your own handler for USB devices, you can check out the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.io.ports.serialport" rel="nofollow noreferrer">SerialPort class of System.IO.Ports</a>.</p>
|
<p>Most USB chipsets come with drivers. <a href="https://www.silabs.com/products/mcu/usb/Pages/default.aspx" rel="nofollow noreferrer">Silicon Labs</a> has one.</p>
| 9,429
|
<p>I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically, some resource-intensive calls that get queued, cached and dispatched when the underlying system gets around to it. When the asynchronous call finally receives a response I would like a callback event to be raised.</p>
<p>I am having some problems coming up with a mechanism to do callbacks in PHP. I have come up with a method that works for now but I am unhappy with it. Basically, it involves passing a reference to the object and the name of the method on it that will serve as the callback (taking the response as an argument) and then use eval to call the method when need be. This is sub-optimal for a variety of reasons, is there a better way of doing this that anyone knows of? </p>
|
<p>(Apart from the observer pattern) you can also use <a href="http://php.net/manual/function.call-user-func.php" rel="nofollow noreferrer"><code>call_user_func()</code></a> or <a href="http://php.net/manual/function.call-user-func-array.php" rel="nofollow noreferrer"><code>call_user_func_array()</code></a>.</p>
<p>If you pass an <code>array(obj, methodname)</code> as first parameter it will invoked as <code>$obj->methodname()</code>.</p>
<pre><code><?php
class Foo {
public function bar($x) {
echo $x;
}
}
function xyz($cb) {
$value = rand(1,100);
call_user_func($cb, $value);
}
$foo = new Foo;
xyz( array($foo, 'bar') );
?>
</code></pre>
|
<p>How do you feel about using the <a href="http://en.wikipedia.org/wiki/Observer_Pattern" rel="nofollow noreferrer">Observer</a> pattern? If not, you can implement a true callback this way:</p>
<pre><code>// This function uses a callback function.
function doIt($callback)
{
$data = "this is my data";
$callback($data);
}
// This is a sample callback function for doIt().
function myCallback($data)
{
print 'Data is: ' . $data . "\n";
}
// Call doIt() and pass our sample callback function's name.
doIt('myCallback');
</code></pre>
<p>Displays: Data is: this is my data</p>
| 7,105
|
<p>I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time.</p>
<p>Now, my first idea was <a href="http://www.microsoft.com/sql/editions/compact/default.mspx" rel="nofollow noreferrer">SQL Server Compact edition</a>. That is really nicely integreated, but it can not run off a network.</p>
<p><a href="http://web.archive.org/web/20100615004036/http://firebirdsql.org/dotnetfirebird/" rel="nofollow noreferrer">Firebird</a> seems to have the same issue, but the .net Integration seems to be not really first-class and is largely undocumented.</p>
<p><a href="http://web.archive.org/web/20150510070451/http://www.codegear.com/products/blackfish" rel="nofollow noreferrer">Blackfish SQL</a> looks interesting, but there is no trial of the .net Version. Pricing is also OK.</p>
<p>Any other suggestions of something that works well with .net <strong>and</strong> runs off a network without the need of actually installing a server software?</p>
|
<p><a href="http://www.sqlite.org/" rel="noreferrer">SQLite</a> came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive <em>if</em> you keep yourself to the constraint of 1 user at a time.</p>
<p><a href="http://web.archive.org/web/20100208133236/www.mikeduncan.com/sqlite-on-dotnet-in-3-mins/" rel="noreferrer">SQLite on .NET - Get up and running in 3 minutes</a></p>
|
<p>This question is now ancient, and a lot has changed. For my specific purposes, <a href="https://www.litedb.org/" rel="nofollow noreferrer">LiteDB</a> is the option of choice. It's open source and has a <a href="https://github.com/mbdavid/LiteDB" rel="nofollow noreferrer">GitHub Repository</a>.</p>
<p>Apart from that, <a href="https://sqlite.org/index.html" rel="nofollow noreferrer">SQLite</a> is basically the industry standard for embedded databases. There are attempts to port the code to .NET, but the prime use case involves a native library (e.g., the <a href="https://www.nuget.org/packages/sqlite/" rel="nofollow noreferrer">sqlite Nuget package</a>) and/or a .NET P/Invoke wrapper like <a href="https://www.nuget.org/packages/Microsoft.Data.Sqlite" rel="nofollow noreferrer">Microsoft.Data.SQLite</a>.</p>
| 2,312
|
<p>I wrote a simple batch file as a PowerShell script, and I am getting errors when they run.</p>
<p>It's in a scripts directory in my path. This is the error I get:</p>
<blockquote>
<p>Cannot be loaded because the execution of scripts is disabled on this system.
Please see "get-help about-signing".</p>
</blockquote>
<p>I looked in the help, but it's less than helpful.</p>
|
<p>It could be PowerShell's default security level, which (IIRC) will only run signed scripts.</p>
<p>Try typing this:</p>
<pre class="lang-none prettyprint-override"><code>set-executionpolicy remotesigned
</code></pre>
<p>That will tell PowerShell to allow local (that is, on a local drive) unsigned scripts to run.</p>
<p>Then try executing your script again.</p>
|
<p>On Windows 10:
Click change security property of myfile.ps1 and change "allow access" by right click / properties on myfile.ps1</p>
| 3,184
|
<p>It's common to have a table where for example the the fields are account, value, and time. What's the best design pattern for retrieving the last value for each account? Unfortunately the last keyword in a grouping gives you the last physical record in the database, not the last record by any sorting. Which means IMHO it should never be used. The two clumsy approaches I use are either a subquery approach or a secondary query to determine the last record, and then joining to the table to find the value. Isn't there a more elegant approach?</p>
|
<p>The subquery option sounds best to me, something like the following psuedo-sql. It may be possible/necessary to optimize it via a join, that will depend on the capabilities of the SQL engine.</p>
<pre><code>select *
from table
where account+time in (select account+max(time)
from table
group by account
order by time)
</code></pre>
|
<p>@shs<br>
yes, that select last(value) SHOULD work, but it doesn't... My understanding although I can't produce an authorative source is that the last(value) gives the last physical record in the access file, which means it could be the first one timewise but the last one physically. So I don't think you should use last(value) for anything other than a really bad random row.</p>
| 6,964
|
<p>Has anyone considered using something along the lines of the Amazon SimpleDB data store as their backend database?</p>
<p>SQL Server hosting (at least in the UK) is expensive so could something like this along with cloud file storage (S3) be used for building apps that could grow with your application.</p>
<p>Great in theory but would anyone consider using it. In fact is anyone actually using it now for real production software as I would love to read your comments.</p>
|
<p>This is a good analysis of Amazon services from <a href="http://www.25hoursaday.com/weblog/2008/08/21/SomeThoughtsOnAmazonsElasticBlockStore.aspx" rel="nofollow noreferrer">Dare</a>.</p>
<p><em>S3 handled what I've typically heard described as "blob storage". A typical Web application typically has media files and other resources (images, CSS stylesheets, scripts, video files, etc) that is simply accessed by name/path. However a lot of these resources also have metadata (e.g. a video file on YouTube has metadata about it's rating, who uploaded it, number of views, etc) which need to be stored as well. This need for queryable, schematized storage is where SimpleDB comes in. EC2 provides a virtual server that can be used for computation complete with a local file system instance which isn't persistent if the virtual server goes down for any reason. With SimpleDB and S3 you have the building blocks to build a large class of "Web 2.0" style applications when you throw in the computational capabilities provided by EC2.
However neither S3 nor SimpleDB provides a solution for a developer who simply wants the typical LAMP or WISC developer experience of building a database driven Web application or for applications that may have custom storage needs that don't fit neatly into the buckets of blob storage or schematized storage. Without access to a persistent filesystem, developers on Amazon's cloud computing platform have had to come up with sophisticated solutions involving backing data up manually from EC2 to S3 to get the desired experience.</em> </p>
|
<p>But do you really need SQL Server? Can't you live with PostgreSQL or MySQL? Both have proven to be ok for most tasks. </p>
<p>Now if you need SQL Server features then you're out of luck. </p>
<p>Another option is to rent a server. How expensive is expensive?</p>
<p>(I've used Amazon S3 to store images for an application, it's ok and works fine, at least for that)</p>
| 7,723
|
<p>I have done the calibration for the x, y, and z axis and everything works fine there. However when I went to do the calibration for extruder things got a little weird. The original number programmed on the board for the step per mm was 98 When I did my first measurements I used 120mm as the mark on the filament then extruded 100mm then remeasured the mark it was 37.66. Then by using the new_e_steps = old_e_steps * (100/(120-distance). I would use the new number and upload it to the printer which was 119.0187. After that I took another measurement, the new measurement was 61.27mm after marking 120mm then extruding 100mm of filament. Using the formula it came out to be 202.6540. Then the new measurement was some where around 80 some MM. It seams that the more I do the calibration the less accurate it gets. What am I doing wrong here?<a href="http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide" rel="nofollow">Triffid Hunters Calibration</a> is the guide I have been using and this link is to the specifications to the printer <a href="https://www.3dprintersonlinestore.com/reprap-prusa-xi3" rel="nofollow">HE3D Prusa XI3</a>.</p>
|
<p>It is really strange that although you <em>increased</em> the steps per mm, the amount extruded was <em>less</em>. I can think of two possible explanations:</p>
<ul>
<li><p>You are extruding too quickly, at a rate at which the extruder can't keep up melting the filament fast enough, causing the filament to slip or the extruder to miss steps: try lowering the feedrate (a feedrate like 100mm/min is typical for 1.75mm filament) and make sure that the temperature is appropriate to your filament.</p></li>
<li><p>You are in absolute coordinate mode, and when you try to extrude 100mm it actually extrudes a different amount (based on the previous "position" of the extruder). Enter relative coordinate mode using G91.</p></li>
</ul>
|
<p>I understand you marked at 120mm then tried to extrude 100mm and measured 37.66mm remaining. Take the 120mm - 37.66mm (remaining)= 82.34mm (that was extruded (so you were 17.66mm short of your 100mm).</p>
<p>The formula I use is [New Setting=(Wanted Distance X old setting)/ Actual Distance].</p>
<p>So [New Setting = (100 x Old Setting)/82.34.]</p>
<p>Hope this helps</p>
| 236
|
<p>My Sunhokey Prusa i3 arrived with a corrupted disc. I'm awaiting a new one and finished the mechanical build via YouTube videos. </p>
<p>I've no clue which motor controls the X, Y, and Z, axes. I"m not even positive which axis is which. YouTube vids don't show the origin of all the wires/cables/cords they connect. </p>
<p>Anyone know of any CLEAR and Normal speed (or slow-able) vid/diagram that shows the electronics wiring in detail? </p>
|
<p>X-axis is right-to-left (Carriage motor)</p>
<p>Y-axis is front-to-back (Base/Bed motor)</p>
<p>Z-axis is up-and-down (lead screws)</p>
<p>There are several videos on YouTube.
This <a href="https://www.youtube.com/watch?v=meKht2ObOWw&list=PLEHodQXu836zPQmIkCwLAE2ze_qOxoOvY" rel="nofollow noreferrer">playlist</a> seems good.</p>
|
<p>This diagram would appear to show the connections to the controller board. Taken from <a href="https://hackaday.io/page/1569-3d-printer-sunhokey-prusa-i3-2015-review" rel="nofollow noreferrer">3D Printer: Sunhokey prusa i3 2015 review</a></p>
<blockquote>
<p><a href="https://i.stack.imgur.com/6iKdC.png" rel="nofollow noreferrer" title="Hardware connect"><img src="https://i.stack.imgur.com/6iKdC.png" alt="Hardware connect" title="Hardware connect"></a></p>
</blockquote>
<p>Refer to Mark's answer for what axis/component each stepper motor controls.</p>
| 780
|
<p>In the past we had printers with poor mechanics and with primitive software algorithms, therefore we used to print inner perimeters faster than the outermost one. See for example (generic, found online):</p>
<p><a href="https://i.stack.imgur.com/DJeIV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DJeIV.jpg" alt="enter image description here" /></a></p>
<p>However now we have pressure/linear advance which reduces extra oozing/extrusion in corners or areas with variable speed, and in Klipper we also have <a href="https://www.klipper3d.org/Resonance_Compensation.html" rel="nofollow noreferrer">resonance compensation</a> which takes care of imperfect mechanics allowing printers to be pushed to higher acceleration without visible artifacts (in my case from 2000 to 6000 mm/s^2), see (generic) photo:</p>
<p><a href="https://i.stack.imgur.com/SZhB5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SZhB5.jpg" alt="enter image description here" /></a></p>
<p>However printing slower has a clear disadvantage: E steps calibration is speed dependent with more filament being pushed out at lower speed, see</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/0xRtypDjNvI?start=0"></iframe>
</div></div></p>
<p>Is there any reason left to print outer perimeters at a lower speed? Using one speed only except for specific areas (small perimeters, bridges, support) seems to make more sense to me to improve quality and reduce printing times.</p>
|
<p>Lowering speed on outer perimeter has always been mostly wrong, but possibly useful. Usually, it's a poor approximation for what you really want to do, which is lowering <em>acceleration</em> on the outer perimeter, to avoid surface quality and dimensional accuracy errors due to ringing and backlash. However, on bowden printers without compensation for pressure ("linear advance" in Marlin, aka "pressure advance" in some other firmware), slow acceleration and high speeds give really bad error in extrusion consistency, so you're better off just lowering the max speed too whenever you lower acceleration.</p>
<p>It's also possible that you may want to print at extremely high speeds for inner walls and infill - speeds so high that you get a lot of extrusion consistency problems. If so, it would make sense to retain a sensible max speed on the outer wall. This won't avoid the part strength problems from printing too fast, but if your models are just decorative, it might be worth it.</p>
<p>Generally, though, I'd recommend solving these problems right (using linear advance if your printer needs it, lowering outer perimeter acceleration to get rid of artifacts, printing at a speed your hotend can handle, etc.) and deem "slower outer perimeter" an idea whose time has passed.</p>
<p>Also, note that if you're using a bowden printer <em>without</em> linear advance, sticking to the <em>same speed</em> for all extrusion will largely paper over the problem. This is probably the source of your observation that it "improves print quality" for you.</p>
|
<p>Thanks to Input Shaper, you can print faster, sometimes to the point of reaching your speed limit on the max nozzle flow speed. At that point, if all speeds are hitting that threshold without any changes in quality, you could print every part at the same maximum speed.</p>
| 1,843
|
<p>I want to implement in Java a class for handling graph data structures. I have a Node class and an Edge class. The Graph class maintains two list: a list of nodes and a list of edges. Each node must have an unique name. How do I guard against a situation like this:
</p>
<pre><code>Graph g = new Graph();
Node n1 = new Node("#1");
Node n2 = new Node("#2");
Edge e1 = new Edge("e#1", "#1", "#2");
// Each node is added like a reference
g.addNode(n1);
g.addNode(n2);
g.addEdge(e1);
// This will break the internal integrity of the graph
n1.setName("#3");
g.getNode("#2").setName("#4");
</code></pre>
<p></p>
<p>I believe I should clone the nodes and the edges when adding them to the graph and return a NodeEnvelope class that will maintain the graph structural integrity. Is this the right way of doing this or the design is broken from the beginning ?</p>
|
<p>I work with graph structures in Java a lot, and my advice would be to make any data member of the Node and Edge class that the Graph depends on for maintaining its structure final, with no setters. In fact, if you can, I would make Node and Edge completely immutable, which has <a href="http://www.javapractices.com/topic/TopicAction.do?Id=29" rel="nofollow noreferrer">many benefits</a>.</p>
<p>So, for example:</p>
<pre><code>public final class Node {
private final String name;
public Node(String name) {
this.name = name;
}
public String getName() { return name; }
// note: no setter for name
}
</code></pre>
<p>You would then do your uniqueness check in the Graph object:</p>
<pre><code>public class Graph {
Set<Node> nodes = new HashSet<Node>();
public void addNode(Node n) {
// note: this assumes you've properly overridden
// equals and hashCode in Node to make Nodes with the
// same name .equal() and hash to the same value.
if(nodes.contains(n)) {
throw new IllegalArgumentException("Already in graph: " + node);
}
nodes.add(n);
}
}
</code></pre>
<p>If you need to modify a name of a node, remove the old node and add a new one. This might sound like extra work, but it saves a lot of effort keeping everything straight.</p>
<p>Really, though, creating your own Graph structure from the ground up is probably unnecessary -- this issue is only the first of many you are likely to run into if you build your own.</p>
<p>I would recommend finding a good open source Java graph library, and using that instead. Depending on what you are doing, there are a few options out there. I have used <a href="http://jung.sourceforge.net/" rel="nofollow noreferrer">JUNG</a> in the past, and would recommend it as a good starting point.</p>
|
<p>In addition to the comments by @jhkiley.blogspot.com, you can create a factory for Edges and Nodes that refuses to create objects with a name that was already used.</p>
| 8,914
|
<p>I have a table with many millions of rows. I need to find all the rows with a specific column value. That column is not in an index, so a table scan results.</p>
<p>But would it be quicker to add an index with the column at the head (prime key following), do the query, then drop the index?</p>
<p>I can't add an index permanently as the user is nominating what column they're looking for.</p>
|
<p>I'm no DBA, but I would guess that building the index would require scanning the table anyway. </p>
<p>Unless there are going to be multiple queries on that column, I would recommend not creating the index.</p>
<p>Best to check the explain plans/execution times for both ways, though!</p>
|
<p>Adding an index requires a table scan, so if you can't add a permanent index it sounds like a single scan will be (slightly) faster.</p>
| 4,996
|
<p>Has anyone implements Subversion with Siteminder as authentication provider ? If yes, would it be possible to provide an overview of how the whole setup is done ?</p>
<p>Since I am using only HTTP authentication, I think it would be easier to integrate with SM, but I am not able to find much help on this on the net.</p>
<p>Is there any pitfall with this setup ? is this even possible ?</p>
|
<p>SVN with Siteminder has been implemented and is working now. Since there is not much of information out there on this, I would like to post the overview of steps followed:</p>
<ol>
<li>Cookie based authentcation was disabled on Siteminder end</li>
<li>HTTP AUTH was enabled (in Siteminder) and all webdav methods were added to policy server to be handled by SiteMinder</li>
<li>Authentication was disabled on apache end (HTTP Auth) for SVN</li>
</ol>
|
<p>Look for information about <strong>Apache</strong> and Siteminder as Apache is responsible for the HTTP transport stuff in Subversion</p>
| 9,936
|
<p>I'm needing to check the differences between two XMLs but not "blindly", Given that both use the same DTD, I'm actually interested in verifying wether they have the same amount of elements or if there's differences.</p>
|
<ul>
<li><a href="http://www.logilab.org/859" rel="nofollow noreferrer">xmldiff</a> from Logilab</li>
<li><a href="http://diffxml.sourceforge.net/" rel="nofollow noreferrer">diffxml</a> </li>
<li>A commercial one include in <a href="http://www.altova.com/products/xmlspy/xml_differencing.html" rel="nofollow noreferrer">XMLSpy</a></li>
</ul>
|
<p><a href="http://www.oxygenxml.com/xml_diff_and_merge.html" rel="nofollow noreferrer">oXygen</a> has good XML diff (and merge) support.</p>
| 8,918
|
<p>I have a Struts + Velocity structure like for example, a Person class, whose one property is a Car object (with its own getter/setter methods) and it is mapped to a Velocity form that submits to an Action, using ModelDriven and getModel structure.</p>
<p>I what to put a button on the form that shows "View Car" if car property is not null or car.id != 0 or show another button "Choose Car" if car is null or car.id = 0.</p>
<p>How do I code this. I tried something like that in the template file:</p>
<pre><code>#if($car != null)
#ssubmit("name=view" "value=View Car")
#else
#ssubmit("name=new" "value=Choose Car")
#end
</code></pre>
<p>But I keep getting error about Null value in the <em>#if</em> line. </p>
<p>I also created a boolean method hasCar() in Person to try, but I can't access it and I don't know why.</p>
<p>And Velocity + Struts tutorials are difficult to find or have good information.</p>
<p>Thanks</p>
|
<p>You should change the #if line to:</p>
<pre><code>#if($car)
</code></pre>
|
<p>In the upcoming Velocity 1.6 release, you will be able to do <code>#if( $car == $null )</code> without error messages. This will allow you to distinguish easily between when <code>$car</code> is null and when it is false. To do that now requires <code>#if( $car && $car != false )</code>, which just isn't as friendly.</p>
| 4,410
|
<p>I have a web server and I am currently paying for SVN hosting at a company that specializes in hosting svn.</p>
<p>I am thinking of just installing SVN on my dedicated server, are there any security implications of this? </p>
|
<p>Small correction to Jedi: it's VisualSVN Server from <a href="http://www.visualsvn.com/server/" rel="noreferrer">http://www.visualsvn.com/server/</a></p>
|
<p>SVN is very difficult to get setup in the Windows environment, at least if you want hosted SVN, a local repository is different. My suggestion is stick with the company or search out a cheaper SVN that will not cost as much money. They are not difficult to setup, but you would hate to lose all your source code because of an improper backup.</p>
| 3,415
|
<p>I have printed two objects with my new 3D printer (Anycubic Mega S) and everytime, my prints are stuck to my bed (sort of glued to it). I cannot remove them by hand. I have tried waiting until it cools off, but the only thing that works is scraping really hard the bed with the spatula.</p>
<p>I'm scared that if I have to do that for my next prints, I will break the bed (maybe peel off the element that keeps the plastic and the bed glued together while printing). </p>
<p>What is the safest way to remove a print from the bed ?</p>
|
<p>One method that works at our makerspace and also has worked for a user on another 3d printing forum is to use a 50:50 mix of water and denatured alcohol. While the print bed is warm, apply some to the perimeter of the print at the bed surface. Allow it to cool, try to remove the print. If it does not work, reheat the bed and repeat until you are able to release it.</p>
|
<p>I have had good luck using dental floss. If you can get it under the edge of the print, then you can pull it all the way through and prints come off easily. </p>
| 1,548
|
<p>I spent the last days trying to make the best gears I could but they are not "smooth" nor good. I searched at thingverse with "gear" but I see no set of gears. I would like someone to point me a good set of gears (with 5, 10, 15... teeth for example) so I can use this STL file with Google Sketchup.</p>
<p>Do you guys know any good matching gears that I could print?</p>
<p>I will be using this gear in a fast spinning matching so it would be nice these gears to be well designed to support some fast moving.</p>
<p>Also, I think in my case I would like to use gears with this shape (the white gear). Any idea why is this gear design better than the usual? <a href="https://i.stack.imgur.com/7mHxj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7mHxj.jpg" alt="enter image description here"></a></p>
|
<p>This type of gear is known as a "herringbone" gear. A traditional straight-cut gear is strong, but can cause more vibration as each tooth engages and disengages. A helical gear (slanted tooth) reduces that vibration as the tooth engagement is more uniform. However the angle of the teeth causes a sideways force that may be undesired. A herringbone tooth design effectively cancels the sideways forces but gets the uniform tooth engagement.</p>
<p>A search for "herringbone" on Thingiverse comes up with many gears of this type.</p>
<p>Regarding the quality, if you are not happy with the results of your own design, that's OK - gears are shockingly complex, and people make careers of gear design! However, if you have a good CAD model that just isn't printing well, it's not likely a bad STL.</p>
<p>An STL from a different source is likely to have similar quality with the same slicer/printer setup. You might be able to improve print quality of your design by changing settings on your slicer or adjusting your printer. I'd suggest asking a question with your current setup and specific print quality issues.</p>
|
<p>As for high speed gear ideas why don't you design your own if there aren't any good ones. I will admit sometimes there will be surprising lack of content in some areas and I dont know what you expect, sometimes you do have to do some things your self to bridge the gaps. Maybe try looking into automobile transmission or even jet engines which use two shafts for high speed compressor and low speed fans. Jet engines spin pretty fast over 35k RPM. They may end up using a planetary gear I would think, the forces are well balanced. But you haven't said the purpose of this gear, is it power transmission on separate parallel axis? Speed reduction/change? In engineering, structurally things which use pointy edges can perform poorly under stress, the stress is highly focused geometrically. Instead if manufacturing constraints and design volume allows it, rounded, chamfered, or filleted edges reduce high stress points. Also adding material distributes loads where possible. Smaller teeth may increase vibration frequency but reduce amplitude. Ideally you would want to minimize the relative velocities of the contacting surfaces to reduce waisted force from friction converting to heat. Also heat can reduce strength and increase wear, decreasing life span of the gear.</p>
| 558
|
<p>The easiest way to think of my question is to think of a single, simple unix command (albeit, this is for windows) and I need progmatic access to run it. </p>
<p>I have a single command-line based executable that performs some unit of work. I want to call that executable with the .net process library, as I can do with any other executable.</p>
<p>However, it dawned on me that there is potential for the dll to become useless or break with unintended updates to the executable or a non-existant executable.</p>
<p>Is it possible to run the executable from the Process object in the .net framework, as I would an external executable file?</p>
|
<p>No, you can't execute it directly. You could probably unpack it to a temporary directory and execute it from there.</p>
|
<p>Is this where <a href="http://msdn.microsoft.com/en-us/magazine/cc164123.aspx" rel="nofollow noreferrer">PInvoke</a> can help?</p>
| 8,497
|
<p>What's the best, crossplatform way to perform blackbox tests on AJAX web applications?</p>
<p>Ideally, the solution should have the following attributes:</p>
<ul>
<li>Able to integrate into a continuous integration build loop</li>
<li>Cross platform so I you can run it on Windows laptops and Linux continuous integration servers</li>
<li>Easy way to script the interactions</li>
<li>Free-as-in-freedom so you can adapt it into your tool chain if necessary</li>
</ul>
<p>I've looked into HttpUnit but I'm not conviced it can handle AJAX-heavy websites.</p>
|
<p>Selenium might be what you're looking for: <a href="http://selenium.openqa.org/" rel="noreferrer">http://selenium.openqa.org/</a></p>
<p>It allows you to script actions and evaluate the results. It's open-source (Apache 2.0), cross platform, and has nice tools.</p>
|
<p>I have used Selenium for exactly this task, but found it to be brittle.</p>
<p>Check out this talk by two Googlers: <a href="http://video.google.com/videoplay?docid=4378663232897374824" rel="nofollow noreferrer">Does my button look big in this? Building testable AJAX applications</a></p>
<p>They isolate the testable javascript (non DOM-interaction) and test that using the Rhino javascript engine.</p>
| 9,597
|
<p>Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). </p>
<p>I haven't done any high-tech audio stuff using Flash, so I was wondering if anyone knew if it was possible to do?</p>
<p>Thanks.</p>
|
<p>A quick google search gave me this forum <a href="http://board.flashkit.com/board/showthread.php?t=715062" rel="nofollow noreferrer">http://board.flashkit.com/board/showthread.php?t=715062</a> where they state that Flash is unable to handle 5.1 audio and the alternative is to use another application that can communicate with Flash to handle the audio side of things.</p>
<p>I also found this blog entry from Summit Projects <a href="http://summitprojectsflashblog.wordpress.com/2008/08/07/wave-theory-in-actionscript-3-part-4/" rel="nofollow noreferrer">http://summitprojectsflashblog.wordpress.com/2008/08/07/wave-theory-in-actionscript-3-part-4/</a> where they go into great detail about byte handling and processing audio samples. I'm not sure if they are using their own actionscript libraries for this, or if they are using Adobe's libraries. I'm not too up to speed on the audio side of Flash with respects to surround sound.</p>
<p>I think your two options might have to be either using a separate application to run your audio(which may be less stressful) or maybe getting in touch with the Summit people if you are as lost as I am over some of the concepts they touch on, heh. Good luck!</p>
|
<p>As far as I know this is not possible. </p>
<p>You <strong>might</strong> be able to do it if you use uncompressed wave files already encoded in DTS or something and put a surround receiver in between. This will however stop you from doing anything with the sound before outputting it, not even changing the volume. And I guess that's not an option?
I think going with an external application for sound would be your best choice, maybe you can do something using Director.</p>
| 5,531
|
<p>Has anyone got <a href="http://perldoc.perl.org/Sys/Syslog.html" rel="nofollow noreferrer">Sys::Syslog</a> to work on Solaris? (I'm running Sys::Syslog 0.05 on Perl v5.8.4 on SunOS 5.10 on SPARC). Here's what doesn't work for me:</p>
<pre><code>openlog "myprog", "pid", "user" or die;
syslog "crit", "%s", "Test from $0" or die;
closelog() or warn "Can't close: $!";
system "tail /var/adm/messages";
</code></pre>
<p>Whatever I do, the closelog returns an error and nothing ever gets logged anywhere.</p>
|
<p>By default, Sys::Syslog is going to try to connect with one of the following socket types:</p>
<pre><code>[ 'tcp', 'udp', 'unix', 'stream' ]
</code></pre>
<p>On Solaris, though, you'll need to use an inet socket. Call:</p>
<pre><code>setlogsock('inet', $hostname);
</code></pre>
<p>and things should start working.</p>
|
<p>setlogsock('inet') didn't do it for me (it looks for host "syslog") but building and installing Sys::Syslog from CPAN did. The Sys::Syslog that comes with Solaris 10 is ancient.</p>
| 9,331
|
<p>I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty?</p>
|
<p>I would suggest something like:-</p>
<pre><code> bool nonEmptyDataSet = dataSet != null &&
(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
</code></pre>
<p><strong>Edits:</strong> I have significantly cleaned up the code after due consideration, I think this is much cleaner. Many thanks to Keith for the inspiration regarding the use of .Any().</p>
<p>In line with Keith's suggestion, here is an extension method version of this approach:-</p>
<pre><code>public static class ExtensionMethods {
public static bool IsEmpty(this DataSet dataSet) {
return dataSet == null ||
!(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
}
}
</code></pre>
<p>Note, as Keith rightly corrected me on in the comments of his post, this method will work even when the data set is null.</p>
|
<p>To be clear, you would first need to look at all the DataTables, and then look at the count of Rows for each DataTable.</p>
| 7,010
|
<p>On IIS 6, what does an IIS reset do? </p>
<p>Please compare to recycling an app pool and stopping and starting an ASP.NET web site.</p>
<p>If you replace a DLL or edit/replace the web.config on an ASP.NET web site is that the same as stopping and starting that web site?</p>
|
<p>IISReset stops and restarts the entire web server (including non-ASP.NET apps)<br>
Recycling an app pool will only affect applications running in that app pool.<br>
Editing the web.config in a web application only affects that web application (recycles just that app).<br>
Editing the machine.config on the machine will recycle all app pools running. </p>
<p>IIS will monitor the /bin directory of your application. Whenever a change is detected in those dlls, it will recycle the app and re-load those new dlls. It also monitors the web.config & machine.config in the same way and performs the same action for the applicable apps. </p>
|
<p>Here what's technet has to say about <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/003ed2fe-6339-4919-b577-6aa965994a9b.mspx?mfr=true" rel="nofollow noreferrer">iisreset</a></p>
<blockquote>
<p>You might need to restart Internet Information Services (IIS) before certain configuration changes take effect or when applications become unavailable. Restarting IIS is the same as first stopping IIS, and then starting it again, except it is accomplished with a single command.</p>
</blockquote>
| 4,347
|
<p>I would really like to be able to print moving parts that fit well enough to move without excessive friction, but also aren't excessively loose. Using an Ultimaker 2, what should be my expectations be, and how would I go about produce well fitting parts?</p>
<p>Using a tool like Openscad to generate parametric parts is really useful because it facilitates the creation of geometrically precise parts such as cogs and drive shafts, which also have precise dimensions. The problem arises when the parts are printed and joined together. </p>
<p>I recently printed some cogs that were supposed to be able to rotate freely around a shaft, which was also printed. I made the shaft about 0.1 mm smaller than the center hole of the cog expecting it to be able to rotate freely, however I found that I had to bore out the center hole slightly and sand down the shaft. I then found that the boring was imprecise and the center of rotation was off center. </p>
|
<p>There are a lot of factors to 3D printing parts that work and fit together. </p>
<p>A lot of it will be discovered by trial and error, but let's try to put you on the right path. </p>
<p>First your material is what matters the most. Specifically their coefficient of thermal expansion, i.e. how much can the plastic change when heat is applied. PLA's coefficient is low compared to ABS, for example. Which is why the MakerBot can print without a heated bed, but it cannot print ABS with any success.</p>
<p>Here is a <a href="http://omnexus.specialchem.com/polymer-properties/properties/coefficient-of-linear-thermal-expansion" rel="nofollow noreferrer">list of coefficient of thermal expansions</a> by material.</p>
<p>What you want to do next is to print out a few test items and see for yourself. Below is an example of reality vs. expectation. As you can see the circle shrinks. It will never expand. So you will always make it bigger than you need. It is also good to note in this example below that the block itself is Larger than expected. The best solution is to not expect high tolerances and build a lot of flex into your designs.</p>
<p><a href="https://i.stack.imgur.com/v0e4Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v0e4Q.png" alt="Example of thermal expansion"></a></p>
<p>Generally you want the hole size larger. If I wanted a 4 mm minimum hole, then I would likely make it 5+ mm.</p>
<p>The best thing you can do is print out a tray and document how different the sizes are. Also, do the same with a print of various peg sizes. Below is an example of such a tray.</p>
<p><a href="https://i.stack.imgur.com/1jmQn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1jmQn.png" alt="Example of a print of various holes"></a></p>
<ul>
<li><p>Also, you might want to look into other materials such as Nylon and Carbon fiber.</p></li>
<li><p>A great source of more tips. Here is a great tutorial, <a href="http://www.shapeways.com/tutorials/designing_mechanical_parts_3d_printing_the_whoosh" rel="nofollow noreferrer">Designing Mechanical Parts - The Whoosh Machine by shapeways</a>, on designing parts.</p></li>
<li><p>A <a href="http://reprap.org/wiki/Lubrication" rel="nofollow noreferrer">RepRap Wiki article</a> on different lubricants in regards to 3D printers. Most people use silicon lube for parts to my knowledge. Again, it depends on your material. </p></li>
</ul>
<p>Images taken from this link, <a href="https://innovationstation.utexas.edu/tip-design/" rel="nofollow noreferrer">The Innovation Station - Tips for Designing 3D Printed Parts</a>.</p>
|
<p>I can't attest to the empirical data laid out in the first answer, but I've had to deal with a lot of components printed in two parts to be connected via design-incorporated channels. I always found that, as a reference, a box of width and length 0.98" will slide securely, but freely, into a square channel of width and length 1".</p>
| 462
|
<p>When loading a page for the first time (!IsPostback), I am creating a button in code and adding it to my page, then adding an event handler to the click event.</p>
<p>However, when clicking the button, after the page reloads, my event handler does not fire.</p>
<p>Can anyone explain why?</p>
|
<p>@Brad: Your answer isn't complete; he's most likely doing it too late in the page lifecycle, during the Page_Load event.</p>
<p>Okay, here's what you're missing.</p>
<p>ASP.NET is stateless. That means, after your page is rendered and sent to the browser, the page object and everything on it is destroyed. There is no link that remains on the server between that page and what is on the user's browser.</p>
<p>When the user clicks a button, that event is sent back to the server, along with other information, like the hidden viewstate field. </p>
<p>On the server side, ASP.NET determines what page handles the request, and rebuilds the page from scratch. New instances of server controls are created and linked together according to the .aspx page. Once it is reassembled, the postback data is evaluated. The viewstate is used to populate controls, and events are fired.</p>
<p>This all happens in a specific order, called the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.page_events.aspx" rel="nofollow noreferrer">Page Lifecycle</a>. In order to do more complex things in ASP.NET, such as creating dynamic controls and adding them to the web page at runtime, you MUST understand the page lifecycle. </p>
<p>With your issue, you must create that button every single time that page loads. In addition, you must create that button BEFORE events are fired on the page. Control events fire between Page_Load and Page_LoadComplete.</p>
<p>You want your controls loaded before ViewState information is parsed and added to controls, and before control events fire, so you need to handle the PreInit event and add your button at that point. Again, you must do this EVERY TIME the page is loaded.</p>
<p>One last note; page event handling is a bit odd in ASP.NET because the events are autowired up. Note the Load event handler is called Page_Load...</p>
|
<p>That is because the event binding that happens needs to be translated in to HTML. This postback that happens if bound to the page between OnInit and OnLoad. So if you want the button to bind events correclty make sure you do the work in OnInit.</p>
<p>See the Page Life Cycle explaination.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178472.aspx</a></p>
| 6,409
|
<p>I'm new to 3d printing, so I might be missing something obvious. If so, please let me know. </p>
<p>I printed my model successfully yesterday, but today I'm trying to print the same model and the first layer refuses to adhere, which means at best several layers after that are messed up if it manages to recover, but usually it just means I have to cancel and start again.</p>
<p>It will print one horizontal line (across the x axis), then when it tries to vertical line (across the y axis) the horizontal line doesn't adhere and gets dragged along with the print head and everything is screwed up.</p>
<p>I've tried leveling the bed over and over again. (I use a sheet of paper and try to slip it between the bed and printhead. I adjust the bed so that I feel a bit of resistance as I push and pull the paper under the printhead.)</p>
<p>I've tried increasing the preheat on the printhead and on the bed. I'm using black PLA 1.75mm that says it has a print temp of 205-225. I've tried printing at 205, 210, 215, 220, and 225. I've tried a bed temp of 50, 55, 60, 65, and 70.</p>
<p>I've tried setting the print speed multiplier to 0.5 to give it time to adhere, but no changes.</p>
<p>I'm trying to print something a wireframe cube that is at the extent of my printable size, so I don't know of a way to use a raft or a brim to help adhesion.</p>
<p>This is what my model looks like:</p>
<p><a href="https://i.stack.imgur.com/AkcFA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AkcFA.png" alt="my wifeframe-ish partial cube model"></a></p>
<p>When I printed a good one yesterday, here is what the first two lines looked like:</p>
<p><a href="https://i.stack.imgur.com/ET1Is.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ET1Is.jpg" alt="good first layer"></a></p>
<p>When I print today, even after multiple attempts to level the bed, this is what the first layer tends to look like:</p>
<p><a href="https://i.stack.imgur.com/e7mcL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/e7mcL.jpg" alt="enter image description here"></a></p>
<p>I'm using a Monoprice 15365. I created my model in SketchUp, then exported as STL, which I imported into Cura 2.3.1. Then I used Cura to export a gcode file to an SD card. I put the SD card into my 3d printer and printed from there.</p>
<p>Any advice is welcome. I don't know if the problems I'm having are because the bed is too low or too high or too hot or too cold or if the printhead is too hot or too cold... nothing I've tried seems to change the results.</p>
|
<p>Your nozzle is clearly too far from the bed. The plastic should be squashed down slightly. Some firmwares have an option where you can adjust the height of the nozzle "live" during the first layer, in Marlin this is called "babystepping". This can be very useful because you can get the height correct without having to mess with the physical leveling of the bed.</p>
|
<p>You can use the masking tape as base, however the height of nozzle is higher than required. Check that your fist layer height is 70% lower than your nozzle size. In my opinion this can be the step layer minus 0.05, for example layer height is 0.2, then my first layer is 0.15, this makes that the material squizes a little more. </p>
<p>If this is not possible you might change the offset of printing level until you reach the height required.</p>
<p>Manually you can add some layers of masking tape to minimize the overgap within the nozzle and bed. (some times I do this, due mi home 3D printer gets out of calibration on changing nozzles)</p>
<p>For PLA i´m using 210°C because using 190 and 200 makes some balls like your photo. also try to use a lower speed like 90 or 80 % to allow a good melting inside the heater.</p>
| 476
|
<p>I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.com), and uploading the site files, I get an error... I'm 99.9% sure that it's not file related, so not sure where to begin in the DB. Unfortunately with DotNetNuke you don't get the YSOD, but a generic error, with no real way to find the actual exception that has occured.</p>
<p>I'm just curious if anyone has had similar deployment issues using the Database Publishing Wizard, and if so, how they overcame them? I own the RedGate toolset, but some hosts like GoDaddy don't allow you to direct connect to their servers...</p>
|
<p>The Database Publishing Wizard's generated scripts usually need to be tweaked since it sometimes gets the order wrong of table/procedure creation when dealing with constraints. What I do is first backup the database, then run the script, and if I get an error, I move that query to the end of the script. Continue restoring the database and running the script until it works.</p>
|
<p>You should be able to expose the underlying error message by setting the following in the web.config:</p>
<pre><code>customErrors mode="Off"
</code></pre>
<p>Could you elaborate on "and uploading the site files"? New instance of DNN? updating an existing site? upgrading DNN version? If upgrade or update -- what files are you adding/overwriting?</p>
<p>Also, when using GoDaddy, can you check to verify that the web site's identity (network service or asp.net machine account depending on your IIS version) has sufficient permissions to the website's file system? It should have modify permissions and these may need to be reapplied if you are overwriting files.</p>
<ul>
<li>IIS6 (XP, Server 2000, 2003) = ASP.Net Machine Account</li>
<li>IIS7 (Vista, Server 2008) = Network Service</li>
</ul>
| 3,560
|
<p>Pretty much what the title says really.</p>
<p>We have some code that is .NET 1.1 based and no real desire to up-convert it. However, we are looking to add developers to the team and they will need copies of Visual Studio.</p>
<p>My understanding is that they will need VS 2003 - as this is the only IDE that supports .NET 1.1 but I am wondering if we are still able to purchase it!</p>
|
<p>Visual Studio 2003 is still available to download for MSDN subscribers.</p>
<p>The EULA for Visual Studio includes a 'downgrade' clause, which appears, IMNAL, to allow you to buy Visual Studio 2008 and then install 2003 under the same license.</p>
<blockquote>
<p>DOWNGRADE. You may install and use
this version and an earlier version of
the software at the same time. This
agreement applies to your use of the
earlier version. If the earlier
version includes different components,
any terms for those components in the
agreement that comes with the earlier
version apply to your use of them.
Microsoft is not obligated to supply
earlier versions to you.</p>
</blockquote>
|
<p>Supported: Yes<br>
Available: Not through normal channels. You might still find a boxed copy on Amazon or somewhere.</p>
| 7,266
|
<p>I've been using my Ender 3 for about four months now and it's been working wonderfully. The print quality is amazing and all the prints are very strong. Then about three weeks ago, my entire system crashed while Ultimaker Cura was open and it lost the profile for my 3D printer. I recreated the profile to the best of my ability with other people's working profiles online, but none of them worked right. I've been getting severe under extrusion in all my prints, and they're incredibly fragile. For now, I've just been printing a 1"x1"x1" test cube. I've tried many steps from other people's posts online to fix the problem, including:</p>
<ol>
<li><p>Raising the print temperature for PLA to 200 °C.</p></li>
<li><p>Checking the extruder for signs of too little tension or too much tension. I checked, and the PLA has light tooth imprints on it, and no grinding or damage to the filament.</p></li>
<li><p>Clearing out the extruder. I disassembled the whole extruder assemble, and flushed all the plastic from each part with a heat gun, and metal pick, and then tried reprinting, but it didn't work.</p></li>
<li><p>Trying a newer Ultimaker Cura version. At the time, I was using Ultimaker Cura 3.1 and hadn't updated because it was working well. I then tried the newest stable release of Ultimaker Cura 3.6, with a few different profiles, and then I also tried the beta version of Ultimaker Cura 4.0, but none of these worked.</p></li>
<li><p>Increasing the extrusion rate. I incrementally increased the extrusion rate from 100 % all the way up to 130 %. The prints looked a little better and were a lot stronger, but this still didn't fix it.</p></li>
<li><p>Trying a different slicer. I then downloaded Slic3r and created a new profile in that. The prints turned out a lot better, but there was still significant under extruding.</p></li>
<li><p>Checking the filament tube for any burns or damage, and ensuring it's inside the extruder assembly all the way.</p></li>
</ol>
<p>If anyone can help me figure out what's going on with my printer, I'd really appreciate it!</p>
<p>Here are some pictures of the prints I've been getting:
These were made in Ultimaker Cura with different small changes to the profile made</p>
<p><a href="https://i.stack.imgur.com/zZDWV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zZDWV.jpg" alt="Ultimaker Cura Settings Under Extrusion"></a></p>
<p>These were made in slic3r with a flow rate adjusted up to 130%
<a href="https://i.stack.imgur.com/rV2sO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rV2sO.jpg" alt="Slic3r Under Extrusion"></a></p>
<p>These were prints I made before I lost all my settings in Ultimaker Cura.
<a href="https://i.stack.imgur.com/V7hie.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V7hie.jpg" alt="Good Prints"></a></p>
<p>Here's some of the material I read/watched and checked before posting myself:</p>
<ul>
<li><a href="https://3dprinting.stackexchange.com/questions/2931/i-am-experiencing-some-severe-under-extrusion">I am experiencing some severe under extrusion</a></li>
<li><a href="https://3dprinting.stackexchange.com/questions/6807/sudden-underextrusion-on-ender3">Sudden underextrusion on Ender3</a></li>
<li><a href="https://www.reddit.com/r/3Dprinting/comments/8vxttn/under_extrusion_on_ender_3_sharing_my_mistake_and/" rel="nofollow noreferrer">r/3DPrinting: Under extrusion on Ender 3</a></li>
<li><a href="https://www.youtube.com/watch?v=x35aWmnZ_A0" rel="nofollow noreferrer">Fixing a Filament Flow Problem on CR-10 mini, CR-10 or Ender 3 by CHEP</a></li>
</ul>
<p>Edit: Here's my printer profile:
<a href="https://drive.google.com/file/d/1sn2d9IWmpEiSsuOhOJTkYu7RPEc8xjO1/view?usp=sharing" rel="nofollow noreferrer">Ender 3 Profile Google Drive</a></p>
|
<p>It is not too rare to create a new machine in Ultimaker Cura to be set to 2.85 mm as this is the default. Also some bugs in the past did reset or assume this diameter unless you manually set it, and unless we know your exact version we can't confirm it is really this.</p>
<h2>Underextrusion why?</h2>
<p>The 0.55 mm more radius result in an underextrusion due to the pressed through volume, and since <span class="math-container">$V=A\times l$</span>, we need to see the area to see how severe the underextrusion is for one given extruded length. <span class="math-container">$A_{1.75}=2.405\text{ mm²}$</span> and <span class="math-container">$A_{2.85}=6.379\text{ mm²}$</span> are rather obvious, so <span class="math-container">$\frac {\text{real extrusion diameter}} {\text{calculated extrusion diameter}}=\frac{A_{1.75}}{A_{2.85}}=37.7\ \%$</span>, so only about 40 % of the needed filament is pressed through the nozzle as the slicer thinks it is almost twice the diameter. This matches well with the 130% still being very spotty, as that'd need a much higher factor to compensate for the underextrusion. A compensating extrusion multiplier would be <span class="math-container">$\frac 1 {0.377}=265.25\ \%$</span>.</p>
<h2>Fixing</h2>
<p>To fix this, check under filament and set it to 1.75 mm so you force the correct diameter. Remember that filament diameter is <strong>not</strong> saved in the <em>printer profile</em> but in the <em>material database</em>.</p>
<p>You might need to restart Ultimaker Cura to activate these new settings.</p>
|
<p>The following saved me from under extrusion on Ender 3 Pro.</p>
<ol>
<li><p>Check the diameter of the material referenced and the nozzle parameter in your slicer (Cura, ...). Then re-slice.</p></li>
<li><p>If not sufficient, it may be a printer parameter issue. The extruder parameter is missconfigured: the stepper to filameter distance ratio is not correct and as a result, it does not feed the requested length of filament.
To fix the printer parameter, send the following gcode sequence (use a G-code console like "GCode Sender - Pronterface").
We will follow this procedure:</p>
<ul>
<li>ask to feed 100 mm of filament </li>
<li>mesure the actual length feeded</li>
<li>read the parameter inside the printer</li>
<li>write correct value.</li>
</ul></li>
</ol>
<p>G-code: </p>
<pre><code>M83 ; set to extruder relative mode
; Be ready to mesure how much filament will really be consumed
G1 E100 F100 ; request 100 mm of filament
; Let "L" be the length in mm you mesured
; Now read the extruder related value in the printer
M503 ; and let "V" be the last number at line "echo: M92"
; Then set the correct value
M92 E{V*100/L}; Eg "M92 E222"
M500 ; write to memory
</code></pre>
| 1,242
|
<p>Consider the following 2 queries:</p>
<pre><code>select tblA.a,tblA.b,tblA.c,tblA.d
from tblA
where tblA.a not in (select tblB.a from tblB)
select tblA.a,tblA.b,tblA.c,tblA.d
from tblA left outer join tblB
on tblA.a = tblB.a where tblB.a is null
</code></pre>
<p>Which will perform better? My assumption is that in general the join will be better except in cases where the subselect returns a very small result set.</p>
|
<p>RDBMSs "rewrite" queries to optimize them, so it depends on system you're using, and I would guess they end up giving the same performance on most "good" databases.</p>
<p>I suggest picking the one that is clearer and easier to maintain, for my money, that's the first one. It's much easier to debug the subquery as it can be run independently to check for sanity.</p>
|
<p>From my observations, MSSQL server produces same query plan for these queries.</p>
| 6,968
|
<p>I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?</p>
|
<p>What you are looking to do is called Single Sign On and Single Sign Off. There are differences based on how you have the applications set up. I will try to clarify where those differences come into play.</p>
<p>To implement single sign on and single sign off you need to make the cookie name, protection, and path attributes the same between all the applications.</p>
<pre><code><authentication mode="Forms">
<forms name=".cookiename"
loginUrl="~/Login.aspx"
timeout="30"
path="/" />
</authentication>
</code></pre>
<p>Next you need to add the machine keys and they need to be the same between all your applications.</p>
<pre><code><machineKey validationKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902"
encryptionKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902F8D923AC"
validation="SHA1" />
</code></pre>
<p>Are you using second or third level domains for the applications? If so you will need to do a little bit more by adding the domain to the cookie:</p>
<pre><code>protected void Login(string userName, string password)
{
System.Web.HttpCookie cookie = FormsAuthentication.GetAuthCookie(userName, False);
cookie.Domain = "domain1.com";
cookie.Expires = DateTime.Now.AddDays(30);
Response.AppendCookie(cookie);
}
</code></pre>
<p>Now to do single sign off, calling FormsAuthentication.SignOut may not be enough. The next best thing is to set the cookie expiration to a past date. This will ensure that the cookie will not be used again for authentication.</p>
<pre><code>protected void Logout(string userName)
{
System.Web.HttpCookie cookie = FormsAuthentication.GetAuthCookie(userName, False);
cookie.Domain = "domain1.com";
cookie.Expires = DateTime.Now.AddDays(-1);
Response.AppendCookie(cookie);
}
</code></pre>
<p>I am taking into consideration you are using the same database for all the applications. If the applications use a separate database for registration and authentication, then we will need to do some more. Just let me know if this is the case. Otherwise this should work for you.</p>
|
<p>It could be easier if you are having a central session store for all your applications. You can then set the session to null in one place.</p>
| 7,929
|
<p>We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an easy/free way to do that?</p>
<p><strong>Edit</strong></p>
<p>There are apparently no free tools for this, and I agree that OxygenXML is one of the best tools for this.</p>
|
<p>In Visual Studio 2008 SP1 and later the <a href="http://msdn.microsoft.com/en-us/library/cc716766.aspx" rel="noreferrer">XML Schema Explorer</a> can create an XML document with some basic sample data:</p>
<ol>
<li>Open your XSD document</li>
<li>Switch to XML Schema Explorer</li>
<li>Right click the root node and choose "Generate Sample Xml"</li>
</ol>
<p><img src="https://i.stack.imgur.com/rKUY6.png" alt="Screenshot of the XML Schema Explorer"></p>
|
<p>The <a href="http://www.k-int.com/products/OpenXSD" rel="nofollow">OpenXSD</a> library mentions that they have support for generating XML instances based on the XSD. Check that out.</p>
| 3,780
|
<p>With a distributed application, where you have lots of clients and one main server, should you:</p>
<ul>
<li>Make the clients dumb and the server smart: clients are fast and non-invasive. Business rules are needed in only 1 place</li>
<li>Make the clients smart and the server dumb: take as much load as possible off of the server</li>
</ul>
<p>Additional info:</p>
<ul>
<li>Clients collect tons of data about the computer they are on. The server must analyze all of this info to determine the health of these computers</li>
<li>The owners of the client computers are temperamental and will shut down the clients if the client starts to consume too many resources (thus negating the purpose of the distributed app in helping diagnose problems)</li>
</ul>
|
<p>You should do as much client-side processing as possible. This will enable your application to scale better than doing processing server-side. To solve your temperamental user problem, you could look into making your client processes run at a very low priority so there's no noticeable decrease in performance on the part of the user.</p>
|
<blockquote>
<p>The server must analyze all of this
info to determine the health of these
computers</p>
</blockquote>
<p>That is probably the biggest clue so far explaning what your application is kinda about. Are you able to provide a more elaborate briefing on what this application is seeking to achieve in this distributed environment? We do not even know if the client-side processing is disk I/O or processor intensive. How you design the solution is dependent on the nature of what needs to be done to help the users/business accomplish their jobs and objectives.</p>
| 5,626
|
<p>When interviewing college coops/interns or recent graduates it helps to have a Java programming question that they can do on a white board in 15 minutes. Does anyone have examples of good questions like this? A C++ question I was once asked in an interview was to write a string to integer function which is along the lines of the level of question I am looking for examples of.</p>
|
<p>Some stuff that has showed up on SO:</p>
<ul>
<li>IsPalindrome(string s)</li>
<li>ReverseWordsInString(string s): "I know java" --> "java know I"</li>
</ul>
<p>Other stuff that springs to mind:</p>
<ul>
<li>multiply a Vector with a Matrix (can this be done OO-Style?)</li>
<li><code>echo</code> (yes, a simple clone of the unix tool)</li>
<li><code>cat</code> (15 min should be enough, should weed out the clueless)</li>
<li>a simple container for <code>int</code>s. Like <code>ArrayList</code>. <strong>Bonus question</strong>: Generic?</li>
</ul>
|
<p>I agree with <a href="https://stackoverflow.com/questions/53808/good-15-minute-java-question-to-ask-recent-college-graduate#53847">Nicolas</a> in regards to separating the algorithmic questions from the actual language questions. </p>
<p>One thing that you might want to consider is giving them a couple simple algorithm questions that they can write up the pseudo code for on the white board (ex. "Explain to me the <a href="http://en.wikipedia.org/wiki/Bubble_sort" rel="nofollow noreferrer">Bubble sort</a> and show me the pseudo code for it." </p>
<p>Then once they have demonstrated their algorithmic knowledge you can move on to the Java questions. Since some people work better in front of a computer than in front of the whiteboard, I would give them something simple, but leveraging their knowledge of Java, that they can implement in 30 minutes or so in using the same IDE that you are using at the company. This way if they claim to know the IDE you can also get an idea of how well they know it.</p>
| 7,738
|
<p>In SQL Server 2005, the query analyzer has told me many times to create a non-clustered index on a primary ID column of a table which already has a clustered index. After following this recommendation, the query execution plan reports that the query should be faster.</p>
<p>Why would a Non-Clustered index on the same column (with the same sort order) be faster than a Clustered index?</p>
|
<p>A clustered index has all the data for the table while a non clustered index only has the column + the location of the clustered index or the row if it is on a heap (a table without a clustered index). So if you do a count(column) and that column is indexed with a non clustered index SQL server only has to scan the non clustered index which is faster than the clustered index because more will fit on 8K pages</p>
|
<p>A clustered index will generally be faster, but you can only have 1 clustered index. So if the table <em>already has</em> a clustered index on a different column, then a non-clustered index is the best you can do.</p>
| 6,342
|
<p>We're in the process of redesigning the customer-facing section of our site in .NET 3.5. It's been going well so far, we're using the same workflow and stored procedures, for the most part, the biggest changes are the UI, the ORM (from dictionaries to LINQ), and obviously the language. Most of the pages to this point have been trivial, but now we're working on the heaviest workflow pages.</p>
<p>The main page of our offer acceptance section is 1500 lines, about 90% of that is ASP, with probably another 1000 lines in function calls to includes. I think the 1500 lines is a bit deceiving too since we're working with gems like this</p>
<pre><code>function GetDealText(sUSCurASCII, sUSCurName, sTemplateOptionID, sSellerCompany, sOfferAmount, sSellerPremPercent, sTotalOfferToSeller, sSellerPremium, sMode, sSellerCurASCII, sSellerCurName, sTotalOfferToSeller_SellerCurr, sOfferAmount_SellerCurr, sSellerPremium_SellerCurr, sConditions, sListID, sDescription, sSKU, sInv_tag, sFasc_loc, sSerialNoandModel, sQTY, iLoopCount, iBidCount, sHTMLConditions, sBidStatus, sBidID, byRef bAlreadyAccepted, sFasc_Address1, sFasc_City, sFasc_State_id, sFasc_Country_id, sFasc_Company_name, sListingCustID, sAskPrice_SellerCurr, sMinPrice_SellerCurr, sListingCur, sOrigLocation)
</code></pre>
<p>The standard practice I've been using so far is to spend maybe an hour or so reading over the app both to familiarize myself with it, but also to strip out commented-out/deprecated code. Then to work in a depth-first fashion. I'll start at the top and copy a segment of code in the <code>aspx.cs</code> file and start rewriting, making obvious refactorings as I go especially to take advantage of our ORM. If I get a function call that we don't have, I'll write out the definition.</p>
<p>After I have everything coded I'll do a few passes at refactoring/testing. I'm just wondering if anyone has any tips on how to make this process a little easier/more efficient.</p>
|
<p>Believe me, I know <em>exactly</em> where you are coming from.. I am currently migrating a large app from ASP classic to .NET.. And I am still learning ASP.NET! :S (yes, I am terrified!).</p>
<p>The main things I have kept in my mind is this:</p>
<ul>
<li>I dont stray <em>too</em> far from the current design (i.e. no massive "lets rip ALL of this out and make it ASP.NET magical!) due to the incredibly high amount of coupling that ASP classic tends to have, this would be very dangerous. Of course, if you are confident, fill your boots :) This can always be refactored later.</li>
<li>Back everything up with tests, tests and more tests! I am really trying hard to get into TDD, but its very difficult to test existing apps, so every time I remove a chunk of classic and replace with .NET, I ensure I have as much green-light tests backing me as possible.</li>
<li>Research a lot, there are some MAJOR changes between classic and .NET and sometimes what can be many lines of code and includes in classic can be achieved in a few lines of code, <em>think</em> before coding.. I've learnt this the hard way, several times :D</li>
</ul>
<p>Its very much like playing <a href="http://www.amazon.co.uk/Hasbro-14569186-Jenga/dp/B00004XQW9" rel="nofollow noreferrer">Jenga</a> with your code :)</p>
<p>Best of luck with the project, any more questions, then please ask :)</p>
|
<p>Sounds like you have a pretty good handle on things. I've seen a lot of people try to do a straight-line transliteration, includes and all, and it just doesn't work. You need to have a good understanding of how ASP.Net wants to work, because it's <em>much</em> different from Classic ASP, and it sounds like maybe you have that. </p>
<p>For larger files, I'd try to get a higher level view first. For example, one thing I've noticed is that Classic ASP was horrible about function calls. You'd be reading through some code and find a call to a function with no clue as to where it might be implemented. As a result, Classic ASP code tended to have long functions and scripts to avoid those nasty jumps. I remember seeing a function that printed out to 40 pages! Parsing straight through that much code is no fun. </p>
<p>ASP.Net makes it easier to follow function calls around, so you might start by breaking out your larger code blocks into several smaller functions.</p>
| 5,109
|
<p>I need to come up with an analysis of simultaneus events, when having only starttime and duration of each event.</p>
<p><strong>Details</strong></p>
<p>I've a standard CDR call detail record, that contains among others:</p>
<ul>
<li>calldate (timedate of each call start</li>
<li>duration (int, seconds of call duration)</li>
<li>channel (a string)</li>
</ul>
<p>What I need to come up with is some sort of analysys of simultaneus calls on each second, for a given timedate period. For example, a graph of simultaneous calls we had yesterday.</p>
<p>(The problem is the same if we have visitors logs with duration on a website and wish to obtain simultaneous clients for a group of web-pages)</p>
<p>What would your algoritm be?</p>
<p>I can iterate over records in the given period, and fill an array, where each bucket of the array corresponds to 1 second in the overall period. This works and seems to be fast, but if the timeperiod is big (say..1 year), I would need lots of memory (3600x24x365x4 bytes ~ 120MB aprox).</p>
<p>This is for a web-based, interactive app, so my memory footprint should be small enough. </p>
<p><strong>Edit</strong></p>
<p>By simultaneous, I mean all calls on a given second. Second would be my minimum unit. I cannot use something bigger (hour for example) becuse all calls during an hour do not need to be held at the same time.</p>
|
<p>I would implement this on the database. Using a GROUP BY clause with DATEPART, you could get a list of simultaneous calls for whatever time period you wanted, by second, minute, hour, whatever.</p>
<p>On the web side, you would only have to display the histogram that is returned by the query.</p>
|
<p>@eric-z-beard: I would really like to be able to implement this on the database. I like your proposal, and while it seems to lead to something, I dont quite fully understand it. Could you elaborate? Please recall that each call will span over several seconds, and each second need to count. If using DATEPART (or something like it on MySQL), what second should be used for the GROUP BY. See note on simultaneus.</p>
<p>Elaborating over this, I found a way to solve it using a temporary table. Assuming temp holds all seconds from tStart to tEnd, I could do</p>
<pre><code>SELECT temp.second, count(call.id)
FROM call, temp
WHERE temp.second between (call.start and call.start + call.duration)
GROUP BY temp.second
</code></pre>
<p>Then, as suggested, the web app should use this as a histogram.</p>
| 7,339
|
<p>I've had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers.</p>
<p>Here's our setup. Each developer has a virtual machine running our app and the MySQL database. It is their personal sandbox to do whatever they want. Currently, developers will make a change to the SQL schema and do a dump of the database to a text file that they commit into SVN.</p>
<p>We're wanting to deploy a continuous integration development server that will always be running the latest committed code. If we do that now, it will reload the database from SVN for each build.</p>
<p>We have a test (virtual) server that runs "release candidates." Deploying to the test server is currently a very manual process, and usually involves me loading the latest SQL from SVN and tweaking it. Also, the data on the test server is inconsistent. You end up with whatever test data the last developer to commit had on his sandbox server.</p>
<p>Where everything breaks down is the deployment to production. Since we can't overwrite the live data with test data, this involves manually re-creating all the schema changes. If there were a large number of schema changes or conversion scripts to manipulate the data, this can get really hairy.</p>
<p>If the problem was just the schema, It'd be an easier problem, but there is "base" data in the database that is updated during development as well, such as meta-data in security and permissions tables.</p>
<p>This is the biggest barrier I see in moving toward continuous integration and one-step-builds. How do <strong><em>you</em></strong> solve it?</p>
<hr>
<p>A follow-up question: how do you track database versions so you know which scripts to run to upgrade a given database instance? Is a version table like Lance mentions below the standard procedure?</p>
<hr>
<p>Thanks for the reference to Tarantino. I'm not in a .NET environment, but I found their <a href="http://code.google.com/p/tarantino/wiki/DatabaseChangeManagement" rel="noreferrer">DataBaseChangeMangement wiki page</a> to be very helpful. Especially this <a href="http://tarantino.googlecode.com/svn/docs/Database-Change-Management.ppt" rel="noreferrer">Powerpoint Presentation (.ppt)</a></p>
<p>I'm going to write a Python script that checks the names of <code>*.sql</code> scripts in a given directory against a table in the database and runs the ones that aren't there in order based on a integer that forms the first part of the filename. If it is a pretty simple solution, as I suspect it will be, then I'll post it here.</p>
<hr>
<p>I've got a working script for this. It handles initializing the DB if it doesn't exist and running upgrade scripts as necessary. There are also switches for wiping an existing database and importing test data from a file. It's about 200 lines, so I won't post it (though I might put it on pastebin if there's interest).</p>
|
<p>There are a couple of good options. I wouldn't use the "restore a backup" strategy.</p>
<ol>
<li><p>Script all your schema changes, and have your CI server run those scripts on the database. Have a version table to keep track of the current database version, and only execute the scripts if they are for a newer version.</p></li>
<li><p>Use a migration solution. These solutions vary by language, but for .NET I use Migrator.NET. This allows you to version your database and move up and down between versions. Your schema is specified in C# code.</p></li>
</ol>
|
<p>I've written a tool which (by hooking into <a href="http://www.codeplex.com/OpenDBiff" rel="nofollow noreferrer">Open DBDiff</a>) compares database schemas, and will suggest migration scripts to you. If you make a change that deletes or modifies data, it will throw an error, but provide a suggestion for the script (e.g. when a column in missing in the new schema, it will check if the column has been renamed and create xx - generated script.sql.suggestion containing a rename statement).</p>
<p><a href="http://code.google.com/p/migrationscriptgenerator/" rel="nofollow noreferrer">http://code.google.com/p/migrationscriptgenerator/</a> SQL Server only I'm afraid :( It's also pretty alpha, but it is VERY low friction (particularly if you combine it with Tarantino or <a href="http://code.google.com/p/simplescriptrunner/" rel="nofollow noreferrer">http://code.google.com/p/simplescriptrunner/</a>)</p>
<p>The way I use it is to have a SQL scripts project in your .sln. You also have a db_next database locally which you make your changes to (using Management Studio or <a href="http://wiki.fluentnhibernate.org/show/GettingStarted:+First+Project" rel="nofollow noreferrer">NHibernate Schema Export</a> or <a href="http://msdn.microsoft.com/en-us/library/bb399420.aspx" rel="nofollow noreferrer">LinqToSql CreateDatabase</a> or something). Then you execute migrationscriptgenerator with the _dev and _next DBs, which creates. the SQL update scripts for migrating across.</p>
| 2,811
|
<p>We have literally 100's of Access databases floating around the network. Some with light usage and some with quite heavy usage, and some no usage whatsoever. What we would like to do is centralise these databases onto a managed database and retain as much as possible of the reports and forms within them.</p>
<p>The benefits of doing this would be to have some sort of usage tracking, and also the ability to pay more attention to some of the important decentralised data that is stored in these apps.</p>
<p>There is no real constraints on RDBMS (Oracle, MS SQL server) or the stack it would run on (LAMP, ASP.net, Java) and there obviously won't be a silver bullet for this. We would like something that can remove the initial grunt work in an automated fashion.</p>
|
<p>We upsize (either using the upsize wizard or by hand) users to SQL server. It's usually pretty straight forward. Replace all the access tables with linked tables to the sql server and keep all the forms/reports/macros in access. The investment in access isn't lost and the users can keep going business as usual. You get reliability of sql server and centralized backups. Keep in mind - we’ve done this for a few large access databases, not hundreds. I'd do a pilot of a few dozen and see how it works out.</p>
<p>UPDATE:
I just found this, the sql server migration assitant, it might be worth a look:
<a href="http://www.microsoft.com/sql/solutions/migration/default.mspx" rel="nofollow noreferrer">http://www.microsoft.com/sql/solutions/migration/default.mspx</a></p>
<p>Update: Yes, some refactoring will be necessary for poorly designed databases. As for how to handle access sprawl? I've run into this at companies with lots of technical users (engineers esp., are the worst for this... and excel sprawl). We did an audit - (after backing up) deleted any databases that hadn't been touched in over a year. "Owners" were assigned based the location &/or data in the database. If the database was in "S:\quality\test_dept" then the quality manager and head test engineer had to take ownership of it or we delete it (again after backing it up).</p>
|
<p>So? Dedicate a server to your Access databases. </p>
<p>Now you have the benefit of some sort of usage tracking, and also the ability to pay more attention to some of the important decentralised data that is stored in these apps.</p>
<p>This is what you were going to do anyway, only you wanted to use a different database engine instead of NTFS. </p>
<p>And now you have to force the users onto your server.</p>
<p>Well, you can encourage them by telling them that you aren't going to overwrite their data with old backups anymore, because now you will own the data, and you won't do that anymore. </p>
<p>Also, you can tell them that their applications will run faster now, because you are going to exclude the folder from on-access virus scanning (you don't do that to your other databases, which is why they are full of sql-injection malware, but these databases won't be exposed to the internet), and planning to turn packet signing off (you won't need that on a dedicated server: it's only for people who put their file-share on their domain-server).</p>
<p>Easy upgrade path, improved service to users, greater centralization and control for IT. Everyone's a winner.</p>
| 6,944
|
<p>What techniques can be applied effectively to improve the performance of SQL queries? Are there any general rules that apply?</p>
|
<ul>
<li>Use primary keys</li>
<li>Avoid select *</li>
<li>Be as specific as you can when building your conditional statements </li>
<li>De-normalisation can often be more efficient </li>
<li>Table variables and temporary tables (where available) will often be better than using a large source table </li>
<li>Partitioned views </li>
<li>Employ indices and constraints </li>
</ul>
|
<p>I think using SQL query analyzer would be a good start.</p>
| 6,036
|
<p>Given a string <code>"filename.conf"</code>, how to I verify the extension part?</p>
<p>I need a cross platform solution.</p>
|
<p>Is this too simple of a solution?</p>
<pre><code>#include <iostream>
#include <string>
int main()
{
std::string fn = "filename.conf";
if(fn.substr(fn.find_last_of(".") + 1) == "conf") {
std::cout << "Yes..." << std::endl;
} else {
std::cout << "No..." << std::endl;
}
}
</code></pre>
|
<p>If you happen to use <a href="http://pocoproject.org/" rel="nofollow">Poco</a> libraries you can do:</p>
<pre><code>#include <Poco/Path.h>
...
std::string fileExt = Poco::Path("/home/user/myFile.abc").getExtension(); // == "abc"
</code></pre>
| 7,518
|
<p>Are there any good online resources for how to create, maintain and think about writing test routines for numerical analysis code?</p>
<p>One of the limitations I can see for something like testing matrix multiplication is that the obvious tests (like having one matrix being the identity) may not fully test the functionality of the code.</p>
<p>Also, there is the fact that you are usually dealing with large data structures as well. Does anyone have some good ideas about ways to approach this, or have pointers to good places to look?</p>
|
<p>It sounds as if you need to think about testing in at least two different ways:</p>
<ol>
<li><p>Some numerical methods allow for some meta-thinking. For example, invertible operations allow you to set up test cases to see if the result is within acceptable error bounds of the original. For example, matrix <em>M-inverse</em> times the matrix <em>M</em> * random vector <em>V</em> should result in <em>V</em> again, to within some acceptable measure of error.<br>
Obviously, this example exercises matrix inverse, matrix multiplication and matrix-vector multiplication. I like chains like these because you can generate quite a lot of random test cases and get statistical coverage that would be a slog to have to write by hand. They don't exercise single operations in isolation, though.</p></li>
<li><p>Some numerical methods have a closed-form expression of their error. If you can set up a situation with a known solution, you can then compare the difference between the solution and the calculated result, looking for a difference that exceeds these known bounds.</p></li>
</ol>
<p>Fundamentally, this question illustrates the problem that testing complex methods well requires quite a lot of domain knowledge. Specific references would require a little more specific information about what you're testing. I'd definitely recommend that you at least have <a href="http://steve-yegge.blogspot.com/2006/03/math-for-programmers.html" rel="nofollow noreferrer">Steve Yegge's recommended book list</a> on hand.</p>
|
<p>Check out a book by <a href="http://en.wikipedia.org/wiki/David_Gries" rel="nofollow noreferrer">David Gries</a> called <a href="https://rads.stackoverflow.com/amzn/click/com/0387964800" rel="nofollow noreferrer" rel="nofollow noreferrer">The Science of Programming</a>. It's about proving the correctness of programs. If you want to be sure that your programs are correct (to the point of proving their correctness), this book is a good place to start.</p>
<p>Probably not exactly what you're looking for, but it's the computer science answer to a software engineering question.</p>
| 3,714
|
<p>I have a Prusa i3 MK3 or maybe it was upgraded to a i3 MK3S.</p>
<p>How can I figure out?</p>
<p>The <a href="https://shop.prusa3d.com/en/original-prusa-i3-mk3s/1390-original-prusa-i3-mk3-to-mk3s-upgrade-kit.html" rel="nofollow noreferrer">description of the upgrade kit</a> talks about</p>
<ul>
<li>the SuperPINDA (how is it different from the old one?)</li>
<li>a number of small changes (which?)</li>
<li>improved plastic parts (which parts, how are they different?)</li>
<li>metal clips (where to look for them?)</li>
<li>a number of minor changes to the extruder plastic parts (which ones, before and after?)</li>
</ul>
<p>I'd like to figure that out without taking the printer apart.</p>
|
<p><a href="https://i.stack.imgur.com/1ldX4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ldX4.png" alt="Left right" /></a></p>
<p><a href="https://i.stack.imgur.com/TtrmF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TtrmF.png" alt="Filament sensors" /></a></p>
<p>The MK3 has 4 pins on the filament sensor, the MK3S has only 3 pins. While you need to take the extruder apart to see that, you can also have a look at the cable instead:</p>
<p><a href="https://i.stack.imgur.com/5C6JE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5C6JE.png" alt="Filament sensor cable" /></a></p>
<p>Matching the sensor, the MK3 has a 4 strand wire including blue and the MK3S has a 3 strand cable without blue.</p>
<p><a href="https://i.stack.imgur.com/nuCqp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nuCqp.png" alt="Bearing clips" /></a></p>
<p>Looking under the heatbed, you'll find the MK3 bearings are fixed with U-bolts while the MK3S has broader bearing clips.</p>
|
<p>On the LCD, the MK3 will show <strong>Original Prusa MK3 OK</strong>, while the MK3S/+ will show <strong>Original Prusa MK3S OK</strong></p>
| 1,985
|
<p>I've just purchased an Alladinbox SkyCube 3D that I want to use to print board game miniatures and other fun stuff.</p>
<p>However, the instructions do not give the settings I need to put into software like Ultimaker Cura, and this is where I need some help so that I can generate the G-code files from models I download from MyMiniFactory.</p>
<p>I know it uses PLA and the extrusion temperature should be 210°C. However, I need help with the other settings.</p>
<p>Can someone please point me in the right direction? Is there a better software I could be using? Where can I find settings?</p>
<p>Thanks.</p>
<p>UPDATE: For those wondering "what" settings, I would probably start with the printer and extruder specifications. The following is my best guess.</p>
<p><a href="https://i.stack.imgur.com/FXKEP.png" rel="nofollow noreferrer" title="Machine settings - Printer"><img src="https://i.stack.imgur.com/FXKEP.png" alt="Machine settings - Printer" title="Machine settings - Printer"></a></p>
<p>and</p>
<p><a href="https://i.stack.imgur.com/4BVaF.png" rel="nofollow noreferrer" title="Machine settings - Extruder1"><img src="https://i.stack.imgur.com/4BVaF.png" alt="Machine settings - Extruder1" title="Machine settings - Extruder1"></a></p>
<p>I'm basing these settings on the device specs on this page:
<a href="https://www.gearbest.com/3d-printers-3d-printer-kits/pp_969800.html" rel="nofollow noreferrer">Link to Alladinbox specs</a></p>
|
<p>Okay, after some research and experimentation, I've come up with some settings that seem to work.</p>
<p>Firstly, some specs about the Alladinbox SkyCube 3D:</p>
<ul>
<li>Firmware: Marlin</li>
<li>Nozzle diameter: 0.4 mm</li>
<li>Nozzle speed: 20 to 70 mm/s</li>
<li>Layer thickness: 0.1 to 0.4 mm</li>
<li>Printing area: 110 x 110 x 125 mm (WLH)</li>
</ul>
<p>Note: There is NO cooling fan present and the base is NOT heated.</p>
<p>Now for the actual printing settings... </p>
<p>I'm using the PLA supplied with the printer so far, and it works well at a nozzle temperature of 210C. </p>
<p>I'm printing at 0.2 mm per layer, which seems to afford to a good level of detail. I've printed a scanned Greco-Roman basin, and the details are very nice indeed.</p>
<p>So far I'm using a 20% line filling, and this seems to give the structure a good solidity and strength. I'm also operating the nozzle at its maximum speed of 70 mm/s and it seems to work just fine.</p>
<p>Obviously, I'm still experiments, and different materials may require different settings, but overall I'm very happy. I hope this post helps someone.</p>
|
<p>Ultimaker Cura comes with pre-defined profiles for various materials. PLA filament is present in between them. This could be a good starting point to derive your specific profile for your own material. To do we usually print test objects and look at the quality of the product. Test prints can consist of simple X-Y-Z test cubes, temperature towers, retraction test prints, a "Benchy" or many more.</p>
<p>Generally 210 degC is pretty high for PLA, but may sometimes be necessary when printing high speeds. Just copying the material profiles from someone else may not work for you as it might involve different printer brands and even within the filament brands variations in between rolls of a single line may require additional tweaking.</p>
<hr>
<p><strong>Edit:</strong>
The original question appeared to hint at material settings, but the OP changed the question, hinting on printer settings with accompanying screenshots how to setup the printer in Cura. However, the OP's answer (that the OP accepted) also includes material and other slicing settings (infill, layer height, speed). To help other people I undeleted my answer which discusses using the standard Cura profiles to work on to make your own derivatives.</p>
| 909
|
<p>I printed this <a href="https://www.thingiverse.com/thing:4775702" rel="nofollow noreferrer">Curvy vase</a> from Thingiverse and it came out pretty well on my Chiron.</p>
<p><a href="https://i.stack.imgur.com/AP0wQ.jpg" rel="nofollow noreferrer" title="Curvy vase print"><img src="https://i.stack.imgur.com/AP0wQ.jpg" alt="Curvy vase print" title="Curvy vase print" /></a></p>
<p>However, I am not happy with the Z-seam that is very large. When I look at other people's problems with this, they often seem to have too little filament at the seam, but I have too much. What setting should I change to make it less visible?</p>
<ul>
<li>Printer: Anycubic Chiron with Marlin 2.0.7</li>
<li>Material: PLA</li>
<li>Slicer: Cura 4.8.0.</li>
<li>Nozzle: 0.4 mm</li>
</ul>
<p>All Cura settings are <a href="https://www.telder.com/bilder/stackexchange/curvy_vase/Curvy_Vase.html" rel="nofollow noreferrer">here</a> (except that I lowered printing temperature to 200 ºC while printing).</p>
<p>All files used and some pictures are <a href="https://www.telder.com/bilder/stackexchange/curvy_vase/" rel="nofollow noreferrer">here</a>.</p>
<hr />
<p>2021-03-07 <strong>Addendum</strong> after I made 19 test-prints of a small portion of the vase's neck. Below are some of my notes:</p>
<ol start="8">
<li>Combing Mode=All is better than Off</li>
<li>Speed=60 is worse than 40</li>
<li>Retract Before Outer Wall=On is worse than Off</li>
<li>Outer Wall Line Width 0.45 to 0.35 gave a Z-seam on the outside with more build-up</li>
<li>Inner Wall(s) Line Width 0.45 to 0.35. Some places has less contact between layers, so less appealing and less robust. Also less material use.</li>
<li>Outer Wall Wipe Distance 2.0 spread ot the seam (too much), and also made a ditch before the Z-seam (on the outside of the ring).</li>
<li>Coasting tripled to Vol=0.588 and Wipe Distance 5.0 is more appealing. Two changes at once make it impossible to know which one helped. 5 mm is not enough to completely wipe.</li>
<li>50% printing speed improved Z-seam and surface smoothness</li>
</ol>
<p>In the future I will use slower speed for Outer Walls, test Wipe distance=2*Line Width, use Combing (turned Off because of some advice to do so when LIN_ADVANCE is used) and experiment with faster retractions and Z-movement.
Pictures and complete notes are available <a href="https://www.telder.com/bilder/stackexchange/curvy_vase/" rel="nofollow noreferrer">here</a>.</p>
|
<p>There is a <a href="https://support.ultimaker.com/hc/en-us/articles/360012512340-Shell-settings" rel="nofollow noreferrer">Cura option</a> to choose a random seam alignment in the shell menu:</p>
<p><a href="https://i.stack.imgur.com/I6UXi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I6UXi.png" alt="enter image description here" /></a></p>
<blockquote>
<h2>Z-seam alignment</h2>
<p>This setting allows you to choose where each new layer in the Z direction starts and affects where the seam of the model will be. This is useful for models with consecutive equal layers as the seam can be visible. By changing the Z-seam alignment you can decrease the visibility of the seam. The options available are:</p>
<ul>
<li><strong>User-specified:</strong> Set a coordinate for the X and Y direction of the Z-seam. This coordinate is absolute by default. Example: X 100, Y 200 will move the seam to the center back of the model.</li>
<li><strong>Shortest:</strong> The next layer starts at the endpoint of the previous layer. This is the fastest way of printing, but also creates the most visible seam.</li>
<li><strong>Random:</strong> The next layer starts at a random point of the previous layer, which eliminates the chance of a seam. Print time will increase due to the necessary travel moves.</li>
<li><strong>Sharpest corner:</strong> This puts the seam in the sharpest inward or outward corner of the model, when available. This is the best method to completely hide the seam.</li>
</ul>
</blockquote>
|
<p>Use Cura's "Vase Mode" (known as <code>Spiralize Outer Contour</code>) for seamless printing.</p>
| 1,878
|
<p>I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. </p>
<p>YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to generate them. What's the best way of doing this?</p>
<p>Some ideas:</p>
<blockquote>
<ol>
<li>Build your own Flash player (ew?)</li>
<li>Somehow draw over the YouTube Flash player. Will this work?</li>
<li>Reverse engineer & hijack YouTube's annotation system. Either messing with the local files or redirecting its attempt to download
the annotations. (using Greasemonkey? Firefox plugin?)</li>
</ol>
</blockquote>
<p>Idea that doesn't count: </p>
<blockquote>
<p>download the video</p>
</blockquote>
|
<p>YouTube provides an <a href="http://code.google.com/apis/youtube/flash_api_reference.html" rel="noreferrer">ActionScript API</a>.</p>
<p>Using this, you could load the videos into Flash using their API and then have your Flash app create the annotations on a layer above the video. </p>
<p>Or, alternatively, if you want to stay away from creating something in Flash, using YouTube's JavaScript API you could draw HTML DIVs over the YouTube player on your web page. Just remember when you embed the player to have <code>WMODE="transparent"</code> in the params list. </p>
<p>So using the example from YouTube:</p>
<pre><code> <script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer", wmode: "transparent" };
swfobject.embedSWF("http://www.youtube.com/v/VIDEO_ID&enablejsapi=1&playerapiid=ytplayer",
"ytapiplayer", "425", "356", "8", null, null, params, atts);
</script>
</code></pre>
<p>And then you should be able to draw your annotations over the YouTube movie using CSS/DHTML. </p>
|
<p>The player itself has a <a href="http://code.google.com/apis/youtube/js_api_reference.html" rel="noreferrer">Javascript API</a> that might be useful for syncing the video if you choose to make your own <code>annotation-thingamajig</code>.</p>
| 2,266
|
<p>What are the specifications of the three wires inside a PC cable that is used to connect the switching power supply to a US AC outlet.</p>
<p>The positive, negative and ground appear to be the same gauge stranded cable, and I've heard that it can handle 10A, but beyond that I don't really know what the rest of the specifications for the wire are.</p>
|
<p><em>Very</em> basically speaking, electricity works like this:</p>
<ol>
<li>There's some source that delivers a certain <strong>voltage</strong>.</li>
<li>You have a device that operates at a certain voltage. <strong>The device voltage and supply voltage should always match.</strong> No, don't put that 120V US device in a 230V outlet in Europe.</li>
<li>The device does something. By doing something it draws <strong>current</strong>. Most devices also draw some current when not doing anything.</li>
<li>How much power your device draws is the product of these two values:<code>voltage x current = power</code> </li>
</ol>
<p>So far, so good. In your case:</p>
<ol>
<li><blockquote>
<p>US AC outlet.</p>
</blockquote>
<p>the <strong>voltage is 120V</strong>.</p></li>
<li><p>On <a href="https://3dprinting.stackexchange.com/q/352/10">this other question of yours</a> you linked to <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI" rel="nofollow noreferrer">this power
supply on amazon</a>. Besides being available gift-wrapped, it
states the following feature:</p>
<blockquote>
<p>You can choose the input voltage (110V/240V) by switch.</p>
</blockquote>
<p>110V ≈ 120V, which means the <strong>device voltage matches your supply
voltage</strong>.</p></li>
<li>The supply can deliver 30A at 12V on the DC side which means 360W.
If it could transform the electricity ideally, without any
inefficiency, that would be <strong>3A</strong> at 120V on the AC side. But your
supply is unlikely ideal. <a href="https://en.wikipedia.org/wiki/Switched-mode_power_supply#SMPS_and_linear_power_supply_comparison" rel="nofollow noreferrer">Wikipedia suggests 60-95% efficiency</a>.
Let's be super pessimistic and assume 50%. That means half the power
that goes into the switch power supply is turned into heat. In order
to still get the 360W out, you have to insert 720W. That means
<strong>your device draws 6A</strong> on the AC side.</li>
</ol>
<p>What does this all mean for your wire?
What wire size do you need for this supply?</p>
<p>Coincidentally, the above link to the amazon website showing your power supply also suggests the following PC ATX power supplies to me:</p>
<ul>
<li><a href="http://rads.stackoverflow.com/amzn/click/B00SN6VN7W" rel="nofollow noreferrer">Sentey Power Supply 725 Watt</a></li>
<li><a href="http://rads.stackoverflow.com/amzn/click/B00I3IXEBI" rel="nofollow noreferrer">Sentey Power Supply 1000 Watt</a></li>
</ul>
<p>Let's get this straight: You can buy a power supply for a PC and plug it into your outlet without even thinking about what a wire size is. You'd just plug and play. <strong>That PC power supply will potentially draw more current</strong> than <strong>the power supply of your 3D printer</strong>. A standard wire would be able to supply either one of the PC ATX power supplies linked above and would not have a problem delivering a lower current to the power supply of your 3D printer.</p>
<p>The switching supply doesn't have a plug like a PC ATX supply, but that on its own doesn't make it any less secure (if wired up properly). It's just less common for household appliances.</p>
<blockquote>
<p>Ultimately, I'd like to avoid a fire, or damage to the house wiring.</p>
</blockquote>
<p>That's a good and valid concern. </p>
<p>PC Power supplies deliver 12V and supply more than enough current (like the examples above). They are probably in use in your house already and did neither set it on fire nor damage the house wiring.</p>
<p>A switching mode power supply is just as secure and if bought from a known brand unlikely to do you any harm either if used properly and within its specifications.</p>
<p><strong>Ultimately</strong>, this is not a question of secure electricity but a trade-off between secure electricity and the price to pay for it. The standard wire and it's specifications have little to do with this.</p>
<hr>
<p>Personally, I also use a cheap switching power supply made in china for my printer. It's very noisy and I pull the plug when I leave it unattended.</p>
|
<p>It's somewhat unclear what you mean by "standard PC cable", but virtually all desktop computers use <a href="https://en.wikipedia.org/wiki/IEC_60320#C13.2FC14_coupler" rel="nofollow">IEC C14 sockets/IEC C13 plugs</a>. Such connectors/sockets are rated for 10A 250V and thus you can safely assume that the cord itself will also be able to handle this voltage and current. 10A is what is specified by the IEC, certain North American standards agencies rate C13 cords for up to 15A.</p>
<p>The IEC standard also specifies that the conductors inside of a C13 lead have a cross sectional area of at least 0.75mm^2 and at least 1mm^2 if the cord is longer than 2m.</p>
| 168
|
<p>I am currently designing an application that has one module which will load large amounts of data from a database and reduce it to a much smaller set by various calculations depending on the circumstances.</p>
<p>Many of the more intensive operations behave deterministically and would lend themselves to parallel processing.</p>
<p>Provided I have a loop that iterates over a large number of data chunks arriving from the db and for each one call a deterministic function without side effects, how would I make it so that the program does not wait for the function to return but rather sets the next calls going, so they could be processed in parallel? A naive approach to demonstrate the principle would do me for now.</p>
<p>I have read Google's MapReduce paper and while I could use the overall principle in a number of places, I won't, for now, target large clusters, rather it's going to be a single multi-core or multi-CPU machine for version 1.0. So currently, I'm not sure if I can actually use the library or would have to roll a dumbed-down basic version myself.</p>
<p>I am at an early stage of the design process and so far I am targeting C-something (for the speed critical bits) and Python (for the productivity critical bits) as my languages. If there are compelling reasons, I might switch, but so far I am contented with my choice.</p>
<p>Please note that I'm aware of the fact that it might take longer to retrieve the next chunk from the database than to process the current one and the whole process would then be I/O-bound. I would, however, assume for now that it isn't and in practice use a db cluster or memory caching or something else to be not I/O-bound at this point.</p>
|
<p>I might be missing something here, but this this seems fairly straight forward using pthreads.</p>
<p>Set up a small threadpool with N threads in it and have one thread to control them all.</p>
<p>The master thread simply sits in a loop doing something like:</p>
<ol>
<li>Get data chunk from DB </li>
<li>Find next free thread If no thread is free then wait </li>
<li>Hand over chunk to worker thread</li>
<li>Go back and get next chunk from DB</li>
</ol>
<p>In the meantime the worker threads they sit and do:</p>
<ol>
<li>Mark myself as free</li>
<li>Wait for the mast thread to give me a chunk of data</li>
<li>Process the chunk of data</li>
<li>Mark myself as free again</li>
</ol>
<p>The method by which you implement this can be as simple as two mutex controlled arrays. One has the worked threads in it (the threadpool) and the other indicated if each corresponding thread is free or busy.</p>
<p>Tweak N to your liking ...</p>
|
<p>The same thread pool is used in java. But the threads in threadpools are serialisable and sent to other computers and deserialised to run.</p>
| 8,086
|
<p>I am attempting to parse a string like the following using a .NET regular expression:</p>
<pre><code>H3Y5NC8E-TGA5B6SB-2NVAQ4E0
</code></pre>
<p>and return the following using Split:
H3Y5NC8E
TGA5B6SB
2NVAQ4E0</p>
<p>I validate each character against a specific character set (note that the letters 'I', 'O', 'U' & 'W' are absent), so using string.Split is not an option. The number of characters in each group can vary and the number of groups can also vary. I am using the following expression:</p>
<pre><code>([ABCDEFGHJKLMNPQRSTVXYZ0123456789]{8}-?){3}
</code></pre>
<p>This will match exactly 3 groups of 8 characters each. Any more or less will fail the match.
This works insofar as it correctly matches the input. However, when I use the Split method to extract each character group, I just get the final group. RegexBuddy complains that I have repeated the capturing group itself and that I should put a capture group around the repeated group. However, none of my attempts to do this achieve the desired result. I have been trying expressions like this:</p>
<pre><code>(([ABCDEFGHJKLMNPQRSTVXYZ0123456789]{8})-?){4}
</code></pre>
<p>But this does not work.</p>
<p>Since I generate the regex in code, I could just expand it out by the number of groups, but I was hoping for a more elegant solution. </p>
<hr>
<p>Please note that the character set does not include the entire alphabet. It is part of a product activation system. As such, any characters that can be accidentally interpreted as numbers or other characters are removed. e.g. The letters 'I', 'O', 'U' & 'W' are not in the character set.</p>
<p>The hyphens are optional since a user does not need top type them in, but they can be there if the user as done a copy & paste.</p>
|
<p>I have discovered the answer I was after. Here is my working code:</p>
<pre><code> static void Main(string[] args)
{
string pattern = @"^\s*((?<group>[ABCDEFGHJKLMNPQRSTVXYZ0123456789]{8})-?){3}\s*$";
string input = "H3Y5NC8E-TGA5B6SB-2NVAQ4E0";
Regex re = new Regex(pattern);
Match m = re.Match(input);
if (m.Success)
foreach (Capture c in m.Groups["group"].Captures)
Console.WriteLine(c.Value);
}
</code></pre>
|
<p>Why use Regex? If the groups are always split by a -, can't you use Split()?</p>
| 4,519
|
<p>Anybody ever tried to retrofit a heatbed to the da Vinci mini w with the proper dimensions (165 mm x 165 mm or 6.5" x 6.5").</p>
<p>Where can I find a heatbed that fits and a corresponding power supply / PID controller?</p>
|
<p>The firmware of the printer reads the g-code, in this instance, for z-axis movement. The g-code provides only (primarily) millimeters of movement and direction, along with speed.</p>
<p>The firmware reads those figures, figuratively speaking, and knows from the values stored in the firmware, how many steps to rotate the motor, in what direction and at what rate.</p>
<p>I suppose if you were a glutton for punishment, you could write some code to convert the existing measurements to ones that are adjusted for the new screw, but that's just crazy. Imagine that your new screw provides for 3.729 times the movement that the old screw did per unit of rotation. You'd have to find all the z-movements in the code and apply that factor to those numbers. I suspect rounding errors might make for a less-than-satisfactory print.</p>
<p>As you've mentioned in your question about editing the firmware, one may expect that you have an idea what is involved. If not, that may be the topic of another post.</p>
|
<p>You can set the 'steps per mm' for the extruder (and the other axes) by sending GCODE to the printer, and store this in the internal memory. Re-flashing the firmware only affects the 'factory reset' configuration of the printer parameters.</p>
<p>To see how to calibrate your extruder, you're probably best looking for videos since although the process is just a few GCODE commands, the whole process is not easy to understand.</p>
| 836
|
<p>So I'm using an IDataReader to hydrate some business objects, but I don't know at runtime exactly what fields will be in the reader. Any fields that aren't in the reader would be left null on the resulting object. How do you test if a reader contains a specific field without just wrapping it in a try/catch?</p>
|
<p>This should do the trick:</p>
<pre><code> Public Shared Function ReaderContainsColumn(ByVal reader As IDataReader, ByVal name As String) As Boolean
For i As Integer = 0 To reader.FieldCount - 1
If reader.GetName(i).Equals(name, StringComparison.CurrentCultureIgnoreCase) Then Return True
Next
Return False
End Function
</code></pre>
<p>or (in C#)</p>
<pre><code>public static bool ReaderContainsColumn(IDataReader reader, string name)
{
for (int i = 0; i < reader.FieldCount; i++) {
if (reader.GetName(i).Equals(name, StringComparison.CurrentCultureIgnoreCase)) return true;
}
return false;
}
</code></pre>
<p>:o)</p>
|
<p>You can't just test reader["field"] for null or DBNull because a IndexOutOfRangeException is thrown if the column isn't in the reader.</p>
<p>The code I use in my mapping layer for creating domain objects and the stored procedures that use the mapping layer might have different column names is below; you could modify it to not throw an exception if the column isn't found and return default(t) or null.</p>
<p>I understand this isn't the most elegant or optimal solution (and really, if you can avoid it then you should), however, legacy stored procedures or Sql queries might warrant a work-around.</p>
<pre><code> /// <summary>
/// Grabs the value from a specific datareader for a list of column names.
/// </summary>
/// <typeparam name="T">Type of the value.</typeparam>
/// <param name="reader">Reader to grab data off of.</param>
/// <param name="columnNames">Column names that should be interrogated.</param>
/// <returns>Value from the first correct column name or an exception if none of the columns exist.</returns>
public static T GetColumnValue<T>(IDataReader reader, params string[] columnNames)
{
bool foundValue = false;
T value = default(T);
IndexOutOfRangeException lastException = null;
foreach (string columnName in columnNames)
{
try
{
int ordinal = reader.GetOrdinal(columnName);
value = (T)reader.GetValue(ordinal);
foundValue = true;
}
catch (IndexOutOfRangeException ex)
{
lastException = ex;
}
}
if (!foundValue)
{
string message = string.Format("Column(s) {0} could not be not found.",
string.Join(", ", columnNames));
throw new IndexOutOfRangeException(message, lastException);
}
return value;
}
</code></pre>
| 7,630
|
<p>I am uploading multiple files using the BeginGetRequestStream of HttpWebRequest but I want to update the progress control I have written whilst I post up the data stream. </p>
<p>How should this be done, I have tried calling Dispatch.BeginInvoke (as below) from within the loop that pushes the data into the stream but it locks the browser until its finished so it seems to be in some sort of worker/ui thread deadlock. </p>
<p>This is a code snippet of pretty much what I am doing:</p>
<pre><code>class RequestState
{
public HttpWebRequest request; // holds the request
public FileDialogFileInfo file; // store our file stream data
public RequestState( HttpWebRequest request, FileDialogFileInfo file )
{
this.request = request;
this.file = file;
}
}
private void UploadFile( FileDialogFileInfo file )
{
UriBuilder ub = new UriBuilder( app.receiverURL );
ub.Query = string.Format( "filename={0}", file.Name );
// Open the selected file to read.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create( ub.Uri );
request.Method = "POST";
RequestState state = new RequestState( request, file );
request.BeginGetRequestStream( new AsyncCallback( OnUploadReadCallback ), state );
}
private void OnUploadReadCallback( IAsyncResult asynchronousResult )
{
RequestState state = (RequestState)asynchronousResult.AsyncState;
HttpWebRequest request = (HttpWebRequest)state.request;
Stream postStream = request.EndGetRequestStream( asynchronousResult );
PushData( state.file, postStream );
postStream.Close();
state.request.BeginGetResponse( new AsyncCallback( OnUploadResponseCallback ), state.request );
}
private void PushData( FileDialogFileInfo file, Stream output )
{
byte[] buffer = new byte[ 4096 ];
int bytesRead = 0;
Stream input = file.OpenRead();
while( ( bytesRead = input.Read( buffer, 0, buffer.Length ) ) != 0 )
{
output.Write( buffer, 0, bytesRead );
bytesReadTotal += bytesRead;
App app = App.Current as App;
int totalPercentage = Convert.ToInt32( ( bytesReadTotal / app.totalBytesToUpload ) * 100 );
// enabling the following locks up my UI and browser
Dispatcher.BeginInvoke( () =>
{
this.ProgressBarWithPercentage.Percentage = totalPercentage;
} );
}
}
</code></pre>
|
<p>I was going to say that, I didn't think that Silverlight 2's HttpWebRequest supported streaming, because the request data gets buffered into memory entirely. It had been a while since the last time I looked at it though, therefore I went back to see if Beta 2 supported it. Well turns out it does. I am glad I went back and read before stating that. You can enable it by setting AllowReadStreamBuffering to false. Did you set this property on your HttpWebRequest? That could be causing your block.</p>
<ul>
<li><a href="http://shrinkster.com/11cn" rel="nofollow noreferrer">MSDN Reference</a></li>
<li><a href="http://www.wilcob.com/Wilco/View.aspx?NewsID=212" rel="nofollow noreferrer">File upload component for Silverlight and ASP.NET</a></li>
</ul>
<p>Edit, found another reference for you. You may want to follow this approach by breaking the file into chunks. This was written last March, therefore I am not sure if it will work in Beta 2 or not.</p>
|
<p>Thanks for that, I will take a look at those links, I was considering chunking my data anyway, seems to be the only way I can get any reasonable progress reports out of it.</p>
| 3,421
|
<p>Is there a way to guarantee that a file on Windows (using the NTFS file system) will use contiguous sectors on the hard disk? In other words, the first chunk of the file will be stored in a certain sector, the second chunk of the file will be stored in the next sector, and so on.</p>
<p>I should add that I want to be able to create this file programmatically, so I'd rather not just ask the user to defrag their harddrive after creating this file. If there is a way to programmatically defrag just the file that I create, then that would be OK too.</p>
|
<p>I would start here:</p>
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx</a></p>
<p>and follow Mark's documentation of the defrag stuff:</p>
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897427.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb897427.aspx</a></p>
|
<p>I believe there's no way to achieve that. You can only defragment the file after it's been written.</p>
| 7,897
|
<p>I'm in the unfortunate position of having to implement a drop-down cascading menu on a site I'm building. I'm looking for a Suckerfish-style solution that is primarily CSS-based and works on a simple set of nested ULs and LIs.</p>
<p><a href="http://htmldog.com/articles/suckerfish/dropdowns/" rel="noreferrer">Son of Suckerfish</a> seems like the way to go, but I don't like the way it just disappears the second you move the mouse away, as users with co-ordination difficulties will have a nightmare navigating the site (or just not bother, but since it's a corporate site there are some who will probably <em>have</em> to use whatever I implement).</p>
<p>Neat features that I've not even thought about needing are welcome, but the two main elements I'm looking for are:</p>
<ol>
<li>Multi-level using a nested UL/LI structure</li>
<li>Small (possibly configurable?) delay before disappearing when the menu is "mouseout"-ed, even if it is provided by some extra JavaScript.</li>
</ol>
|
<p>I would <em>strongly</em> suggest that you use <a href="http://users.tpg.com.au/j_birch/plugins/superfish/" rel="noreferrer">superfish</a>, the jQuery adaptation of the suckerfish menu. It has loads of features (and delay is one of them), adds some fancy animation capabilities, and degrades to the normal suckerfish menu gracefully. It also doesn't need any extra markup.</p>
|
<p>I can't see a way to add delay outside of JavaScript - but if you're going to use JavaScript you may as well use a JavaScript controlled menu. </p>
<p>If you follow a semantically-correct nav pattern and set it up so it display's normally (e.g. static) when JavaScript is not present you should be fine with whatever you use.</p>
<p>It's all about your target audience - who's larger? JS-disabled or users with co-ordination difficulties? I would guess that the latter require the priority (if not for percentage use then disability laws).</p>
| 3,667
|
<p>I want to implement a paperless filing system and was looking to use WIA with C# for the image acquisition. There are quite a few sample projects on CodeProject, etc. However, after downloading every one of them that I can find, I have run into a problem.</p>
<p>In each and every one of them, the reference to WIALib is broken. When I go to add "Microsoft Windows Image Acquisition" as a reference, the only version available on my development workstation (also the machine that will run this) is 2.0.</p>
<p>Unfortunately, every one of these sample projects appear to have been coded against 1.x. The reference goes in as "WIA" instead of "WIALib". I took a shot, just changing the namespace import, but clearly the API is drastically different.</p>
<p>Is there any information on either implementing v2.0 or on upgrading one of these existing sample projects out there?</p>
|
<p>To access WIA, you'll need to add a reference to the COM library, "Microsoft Windows Image Acquisition Library v2.0" (wiaaut.dll).
add a "using WIA;"</p>
<pre><code>const string wiaFormatJPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}";
CommonDialogClass wiaDiag = new CommonDialogClass();
WIA.ImageFile wiaImage = null;
wiaImage = wiaDiag.ShowAcquireImage(
WiaDeviceType.UnspecifiedDeviceType,
WiaImageIntent.GrayscaleIntent,
WiaImageBias.MaximizeQuality,
wiaFormatJPEG, true, true, false);
WIA.Vector vector = wiaImage.FileData;
</code></pre>
<p>(System.Drawing)</p>
<pre><code>Image i = Image.FromStream(new MemoryStream((byte[])vector.get_BinaryData()));
i.Save(filename)
</code></pre>
<p>Thats a basic way, works with my flatbed/doc feeder. If you need more than one document/page at a time though, there is probably a better way to do it (from what I could see, this only handles one image at a time, although I'm not entirely sure). While it is a WIA v1 doc, Scott Hanselman's <a href="http://blogs.msdn.com/coding4fun/archive/2006/10/31/912546.aspx" rel="noreferrer">Coding4Fun article on WIA</a> does contain some more info on how to do it for multiple pages, I think (I'm yet to go further than that myself)</p>
<p>If its for a paperless office system, you might want also check out MODI (Office Document Imaging) to do all the OCR for you.</p>
|
<p>It doesn't <strong>need</strong> to be WIA. I was mostly looking at the WIA setup because it offers the same basic interface for different scanners. I've got 3 scanners on this machine and the TWAIN drivers/software for all of them suck (like blocking the screen during scanning).</p>
<p>For document management, I'm really looking for simple 200dpi grayscale scans, so most of the stuff in the TWAIN drivers is overkill. </p>
<p>That said, asking here was part of my last attempt to figure out how to do it in WIA before moving on to TWAIN.</p>
| 3,043
|
<p>This free collection library comes from IT University of Copenhagen.</p>
<p><a href="http://www.itu.dk/research/c5/" rel="noreferrer">http://www.itu.dk/research/c5/</a></p>
<p>There is a video with one of the authors on Channel 9. I am trying to learn how to use these collections and I was wondering whether anyone has more experiences or what are your thoughts on this specific collection library for .NET. Do you like the way they are designed, do you like their performance and what were your major problems with them ?</p>
|
<p>I've used it in the past and there are a couple of notes I must make:</p>
<ol>
<li>The library is very good, very fast and very useful. It has lots of very nice data structures, some of which I did not know before starting to use this library.</li>
<li>It's Open-Source! This is a huge benefit.</li>
<li>Sometimes you don't have exactly what you want. As far as my experience showed, the library's authors decided to go with a very fault-intolerant attitude, throwing exceptions about everything. This caused me to add a few fault-tolerant methods.</li>
</ol>
<p>All in all, a very nice library with some advanced data structures. Unfortunately, support for it is very lacking, as you can see from the fact that new releases (bugfixes, et al) range somewhere from 6 months to a year.</p>
<p><strong>Note:</strong> Starting with Mono 2.0, C5 is <a href="http://www.mono-project.com/Release_Notes_Mono_2.0#Third_Party_APIs_bundled_with_Mono" rel="noreferrer">bundled as a 3rd party API</a>, which I believe to be a wonderful show of faith in the product from the Mono team.</p>
|
<p>In addition to that omer van kloeten's points.</p>
<p>The open source licence is MIT (comparable to BSD licence) this means that if you need make changes to the library you don't have to open-source the changes. (this might be a problem with some companies). For GPL-type licences this can be a problem.</p>
| 6,967
|
<p>In C#, if I have an inherited class with a default constructor, do I have to explicitly call the base class' constructor or will it be implicitly called?</p>
<pre><code>class BaseClass
{
public BaseClass()
{
// ... some code
}
}
class MyClass : BaseClass
{
public MyClass() // Do I need to put ": base()" here or is it implied?
{
// ... some code
}
}
</code></pre>
|
<p>You do not need to explicitly call the base constructor, it will be implicitly called.</p>
<p>Extend your example a little and create a Console Application and you can verify this behaviour for yourself:</p>
<pre><code>using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
MyClass foo = new MyClass();
Console.ReadLine();
}
}
class BaseClass
{
public BaseClass()
{
Console.WriteLine("BaseClass constructor called.");
}
}
class MyClass : BaseClass
{
public MyClass()
{
Console.WriteLine("MyClass constructor called.");
}
}
}
</code></pre>
|
<p>You don’t need call the base constructor explicitly it will be implicitly called, but sometimes you need pass parameters to the constructor in that case you can do something like:</p>
<pre><code>using System;
namespace StackOverflow.Examples
{
class Program
{
static void Main(string[] args)
{
NewClass foo = new NewClass("parameter1","parameter2");
Console.WriteLine(foo.GetUpperParameter());
Console.ReadKey();
}
}
interface IClass
{
string GetUpperParameter();
}
class BaseClass : IClass
{
private string parameter;
public BaseClass (string someParameter)
{
this.parameter = someParameter;
}
public string GetUpperParameter()
{
return this.parameter.ToUpper();
}
}
class NewClass : IClass
{
private BaseClass internalClass;
private string newParameter;
public NewClass (string someParameter, string newParameter)
{
this.internalClass = new BaseClass(someParameter);
this.newParameter = newParameter;
}
public string GetUpperParameter()
{
return this.internalClass.GetUpperParameter() + this.newParameter.ToUpper();
}
}
}
</code></pre>
<p>Note: If someone knows a better solution please tells me.</p>
| 3,872
|
<p>I am writing a client-side <strong>Swing</strong> application (graphical font designer) on <strong>Java 5</strong>. Recently, I am running into <code>java.lang.OutOfMemoryError: Java heap space</code> error because I am not being conservative on memory usage. The user can open unlimited number of files, and the program keeps the opened objects in the memory. After a quick research I found <a href="http://java.sun.com/docs/hotspot/gc5.0/ergo5.html" rel="noreferrer">Ergonomics in the 5.0 Java Virtual Machine</a> and others saying on Windows machine the JVM defaults max heap size as <code>64MB</code>.</p>
<p>Given this situation, how should I deal with this constraint?</p>
<p>I could increase the <strong>max heap size</strong> using <strong>command line</strong> option to java, but that would require figuring out available RAM and writing some launching program or script. Besides, increasing to some <strong>finite</strong> max does not <strong>ultimately</strong> get rid of the issue.</p>
<p>I could rewrite some of my code to persist objects to file system frequently (using database is the same thing) to free up the memory. It could work, but it's probably a lot work too.</p>
<p>If you could point me to details of above ideas or some alternatives like <strong>automatic virtual memory, extending heap size dynamically</strong>, that will be great.</p>
|
<p>Ultimately you always have a finite max of heap to use no matter what platform you are running on. In Windows 32 bit this is around <code>2GB</code> (not specifically heap but total amount of memory per process). It just happens that Java chooses to make the default smaller (presumably so that the programmer can't create programs that have runaway memory allocation without running into this problem and having to examine exactly what they are doing).</p>
<p>So this given there are several approaches you could take to either determine what amount of memory you need or to reduce the amount of memory you are using. One common mistake with garbage collected languages such as Java or C# is to keep around references to objects that you <strong>no longer</strong> are using, or allocating many objects when you could <strong>reuse</strong> them instead. As long as objects have a reference to them they will continue to use heap space as the garbage collector will not delete them.</p>
<p>In this case you can use a Java memory profiler to determine what methods in your program are allocating large number of objects and then determine if there is a way to make sure they are no longer referenced, or to not allocate them in the first place. One option which I have used in the past is "JMP" <a href="http://www.khelekore.org/jmp/" rel="noreferrer">http://www.khelekore.org/jmp/</a>.</p>
<p>If you determine that you are allocating these objects for a reason and you need to keep around references (depending on what you are doing this might be the case), you will just need to increase the max heap size when you start the program. However, once you do the memory profiling and understand how your objects are getting allocated you should have a better idea about how much memory you need. </p>
<p>In general if you can't guarantee that your program will run in some finite amount of memory (perhaps depending on input size) you will always run into this problem. Only after exhausting all of this will you need to look into caching objects out to disk etc. At this point you should have a very good reason to say "I need Xgb of memory" for something and you can't work around it by improving your algorithms or memory allocation patterns. Generally this will only usually be the case for algorithms operating on large datasets (like a database or some scientific analysis program) and then techniques like caching and memory mapped IO become useful.</p>
|
<p>If everything else fails, in addition to increasing the max heap size try also increasing the swap size. For Linux, as of now, relevant instructions can be found in <a href="https://linuxize.com/post/create-a-linux-swap-file/" rel="nofollow noreferrer">https://linuxize.com/post/create-a-linux-swap-file/</a>.</p>
<p>This can help if you're e.g. compiling something big in an embedded platform.</p>
| 5,799
|
<p>Following on from my recent question on <a href="https://stackoverflow.com/questions/17725/large-complex-objects-as-a-web-service-result">Large, Complex Objects as a Web Service Result</a>. I have been thinking about how I can ensure all future child classes are serializable to XML.</p>
<p>Now, obviously I could implement the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx" rel="noreferrer">IXmlSerializable</a> interface and then chuck a reader/writer to it but I would like to avoid that since it then means I need to instantiate a reader/writer whenever I want to do it, and 99.99% of the time I am going to be working with a <em>string</em> so I may just write my own.</p>
<p>However, to serialize to XML, I am simply decorating the class and its members with the <em>Xml???</em> attributes ( <em>XmlRoot</em> , <em>XmlElement</em> etc.) and then passing it to the <em>XmlSerializer</em> and a <em>StringWriter</em> to get the string. Which is all good. I intend to put the method to return the string into a generic utility method so I don't need to worry about type etc.</p>
<p>The this that concerns me is this: If I do not decorate the class(es) with the required attributes an error is not thrown until run time.</p>
<p><strong>Is there any way to enforce attribute decoration? Can this be done with FxCop?</strong> (I have not used FxCop yet)</p>
<h3>UPDATE:</h3>
<p>Sorry for the delay in getting this close off guys, lots to do!</p>
<p>Definitely like the idea of using reflection to do it in a test case rather than resorting to FxCop (like to keep everything together).. <a href="https://stackoverflow.com/questions/19454/enforce-attribute-decoration-of-classesmethods#19455">Fredrik Kalseth's answer</a> was fantastic, thanks for including the code as it probably would have taken me a bit of digging to figure out how to do it myself!</p>
<p>+1 to the other guys for similar suggestions :)</p>
|
<p>I'd write a unit/integration test that verifies that any class matching some given criteria (ie subclassing X) is decorated appropriately. If you set up your build to run with tests, you can have the build fail when this test fails.</p>
<p>UPDATE: You said, "Looks like I will just have to roll my sleeves up and make sure that the unit tests are collectively maintained" - you don't have to. Just write a general test class that uses reflection to find all classes that needs to be asserted. Something like this:</p>
<pre><code>[TestClass]
public class When_type_inherits_MyObject
{
private readonly List<Type> _types = new List<Type>();
public When_type_inherits_MyObject()
{
// lets find all types that inherit from MyObject, directly or indirectly
foreach(Type type in typeof(MyObject).Assembly.GetTypes())
{
if(type.IsClass && typeof(MyObject).IsAssignableFrom(type))
{
_types.Add(type);
}
}
}
[TestMethod]
public void Properties_have_XmlElement_attribute
{
foreach(Type type in _types)
{
foreach(PropertyInfo property in type.GetProperties())
{
object[] attribs = property.GetCustomAttributes(typeof(XmlElementAttribute), false);
Assert.IsTrue(attribs.Count > 0, "Missing XmlElementAttribute on property " + property.Name + " in type " + type.FullName);
}
}
}
}
</code></pre>
|
<p>A good FXCop rule (and one which I am finding I need right now) would be to check that all objects that are being added to the ASP.NET Session have the Serializable attribute. I'm trying to move from InProc session state to SQL Server. First time I requested a page, my site blew up on me because non-serializable objects were being stored in Session. Then came the task of hunting through all the source code looking for every instance where an object is set in the Session... FXCop would be a nice solution. Something to work on...</p>
| 3,992
|
<p>I have a report in Reporting services, and when I preview it, the headers for a table wrap, but when I export it to Excel, the don't. They just get cut off. Any ideas on how to force it to wrap when I export to Excel?</p>
|
<p>Although this link doesn't address your question directly, its fairly comprehensive in terms of design considerations for Report Rendering in in Excel</p>
<p>Link: <a href="http://msdn.microsoft.com/en-us/library/ms159836(SQL.90).aspx" rel="nofollow noreferrer">Designing for Microsoft Excel Output</a>(Reporting Services)</p>
|
<p>If you are importing report from SSRS to EXCEL and if you find some TOP column joined up then the best way to resolve this issue would be:</p>
<ul>
<li>Go back to report designer and adjust all your text boxes. </li>
<li>Adjust to left side of the designer window. You will see a blue line when it's adjusted to left.</li>
<li>Your dataset at top should also be moved toward left side of the designer window.</li>
<li>You might have date time function on left adjust it to top dataset vertically with 0-1 Points gap.</li>
<li>Including your header which would be Title of your company, name of report and all parameter mentioned below should be adjusted just next below to date time function which I have mentioned earlier.</li>
</ul>
<p>Play with report designer by adjusting the text box and you will see the magic.</p>
| 8,931
|
<p>I have an SQL query that takes the following form:</p>
<pre><code>UPDATE foo
SET flag=true
WHERE id=?
</code></pre>
<p>I also have a PHP array which has a list of IDs. What is the best way to accomplish this other than with parsing, as follows, ...</p>
<pre><code>foreach($list as $item){
$querycondition = $querycondition . " OR " . $item;
}
</code></pre>
<p>... and using the output in the <code>WHERE</code> clause?</p>
|
<p>This would achieve the same thing, but probably won't yield much of a speed increase, but looks nicer.</p>
<pre><code>mysql_query("UPDATE foo SET flag=true WHERE id IN (".implode(', ',$list).")");
</code></pre>
|
<p>I haven't ever seen a way to do that other than your foreach loop.</p>
<p>But, if $list is in any way gotten from the user, you should stick to using the prepared statement and just updating a row at a time (assuming someone doesn't have a way to update several rows with a prepared statement). Otherwise, you are wide open to sql injection.</p>
| 6,096
|
<p>I've tried printing in vase mode (or "spiralise outer contour" in Cura) and while the floor looks fine, the vertical sides look "saggy"</p>
<p>I'm using a 0.4 mm nozzle, with eSUN PLA+ at 218 °C and a bed temp of 60 °C. This combination works fine for normal printing. Layer height is 0.28 mm (Low Quality mode in Cura) with a line width of 0.4 mm</p>
<p><a href="https://i.stack.imgur.com/KVFyS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KVFyS.png" alt="enter image description here" /></a> <br> Image is backlit by a monitor to show the laciness in the walls.</p>
<p><a href="https://i.stack.imgur.com/8EnEB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8EnEB.png" alt="enter image description here" /></a> <br></p>
<p>The original model was a 1x1x6 Gridfinity bin that uses less plastic than the original. <br></p>
<p><a href="https://thangs.com/designer/LittleHobbyShop/3d-model/%23gridfinity%20Vase%20Mode%20Single%20Box-65828" rel="nofollow noreferrer">https://thangs.com/designer/LittleHobbyShop/3d-model/%23gridfinity%20Vase%20Mode%20Single%20Box-65828</a></p>
<hr />
<p>Is this insufficient cooling, or too fast a print speed letting the filament sag under gravity before it cools? Or is a 0.4 mm nozzle too small?</p>
<p>This reminds me of brickwork where the mortar is too wet. The bits that work right look fine, but all four sides have bad parts.</p>
<p>What's the trick to vase mode printing?</p>
|
<p>Presuming that you're talking about an 8 hour period, your printer should be designed to run for 8 hours continuous anyway, so nothing will happen regarding the bed or screen that wouldn't happen with a normal print.</p>
<p>If the first few layers stick to the bed, it's likely that you're print will at least be partially completed. So even over night it won't be a full 8 hours of printing while failed. Maybe half that period.</p>
<p>If the problem is bed adhesion, or anything that doesn't effect the filament being supplied to the nozzle, then your only problem will be wasted filament and disposing of the spaghetti. No harm will come to your printer.</p>
<p>If the problem is a break in the filament or filament runout, or a blocked nozzle then you could have damage to the head of the nozzle from printing dry. If you're printing with PLA this isn't really something that you need to worry about too much as you can run a printer dry for several hours without any problems.</p>
<p>If you're printing with ABS or something that needs a hotter head then you could cause damage to it if it's allowed to run dry for an entire night. But again this isn't really something that you need to worry about unless it's running dry for 4 or 6 hours.</p>
<p>Simply checking in on it once in the night should be enough to prevent any problems.</p>
|
<p>There are software solutions like "Spaghetti Detective" (recently renamed to "Obico") which can watch your print via a camera, and potentially stop the job if it looks bad.</p>
<p>Most of the time my print failures come early, in the form of poor bed adhesion - watch the job start for a while before leaving it.</p>
<p>I can also remote-check my cameras and stop the job if required, but that requires me to look.</p>
<p>The second most common failure is lifting from the base at any time in the print, so you have to keep an eye on it.</p>
<p>Filament feed issues are probably third on the common list of causes for problems, including running out.</p>
<p>I also have occasional issues where my Pi running Octoprint just looses connection to the printer, and it freezes in place with the bed/nozzle heaters on. This is just a waste of power, so a future plan is to wire the printer through a relay allowing me to power it on/off from octoprint's web page.</p>
<p>My longest print was ~30 hours - you have to learn to not touch it unless there's a good reason.</p>
<p>Finally, try and maintain the environmental conditions to be fairly constant. I have an enclosure even when printing plain PLA, becuase my printer's location is in a garage, and opening the main door allows the air temp to drop quickly. This would upset a running print until I surrounded it.</p>
<p>You can also make sure there's a smoke or heat detector in the room where the printer is, for added peace of mind.</p>
| 2,158
|
<p>I have mounted two radial fan on my printer as a part cooling solution.</p>
<p><a href="https://i.stack.imgur.com/MTeZ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MTeZ5.png" alt="radial blower fan"></a></p>
<p>As you can see, the fan has input on the left side and blows air down. Does a mirror construction exists? With outlet on the right.</p>
<p>I can even print my own casing, but I'm not sure if the fan will work, if I change the rotation direction.</p>
<p>I'm using this print cooling fan duct: <a href="https://www.thingiverse.com/thing:1850163" rel="nofollow noreferrer">https://www.thingiverse.com/thing:1850163</a></p>
<p>The fan on the right side has the opening facing the hotend, and there is not much space, so the impeller can catch on wiring etc. If the right fan had opening to the right, there would be no such problem.</p>
|
<p>Yes these do exist, but I've never seen them in the size you are interested in, see e.g. these projector fans:</p>
<p><a href="https://i.stack.imgur.com/Jw36Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jw36Y.png" alt="enter image description here"></a></p>
<p>An alternative are fans that attract flow from both sides, like:</p>
<p><a href="https://i.stack.imgur.com/hryYg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hryYg.jpg" alt="enter image description here"></a></p>
<p>but I've not seen them in the small size you are interested in.</p>
<p>Considering the placement of the fans in the printed cooling duct you posted, I see no problem in using 2 similar fans. There is enough free space to suck in air and if you are afraid that the wires are caught by the impeller, you need to properly fasten the wires, ty wraps work wonderfully in securing cables. If I'm not mistaken, you could even use the holes in the fans to secure the cables or otherwise design and print a small bracket for attaching the ty wraps.</p>
|
<p>I did also some research on this and decided to go with this solution. This fan only measures 50x50x10mm and is easy flippable: <a href="https://de.aliexpress.com/item/1005001894771961.html" rel="nofollow noreferrer">https://de.aliexpress.com/item/1005001894771961.html</a></p>
<p><a href="https://i.stack.imgur.com/WYQaY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WYQaY.png" alt="enter image description here" /></a></p>
<p>Another option was this: <a href="https://de.aliexpress.com/item/4001185014078.html" rel="nofollow noreferrer">https://de.aliexpress.com/item/4001185014078.html</a></p>
<p><a href="https://i.stack.imgur.com/wHwkP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wHwkP.png" alt="enter image description here" /></a></p>
<p>Also found a Thingi, where people tried to flip the existing 5015 blower fans. It seems very difficult, since you have to print the fins in flipped direction and they tend to break.. <a href="https://www.thingiverse.com/thing:3716277" rel="nofollow noreferrer">https://www.thingiverse.com/thing:3716277</a></p>
<p><a href="https://i.stack.imgur.com/doFXv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/doFXv.jpg" alt="enter image description here" /></a></p>
| 1,478
|
<p>I am new to 3D printing. I own jewelry stores and want to 3D print my jewelry packaging for rings, necklaces, and bangles as in the picture below:</p>
<p><a href="https://i.stack.imgur.com/NVwgE.png" rel="nofollow noreferrer" title="Product photo of a jewelry ring box"><img src="https://i.stack.imgur.com/NVwgE.png" alt="Product photo of a jewelry ring box" title="Product photo of a jewelry ring box" /></a></p>
<p>I have two main problems:</p>
<ol>
<li><p>Is 3D printing capable of building this package?</p>
</li>
<li><p>I know I can build boxes for jewelry with the outside being made of plastic. But I want the inside to be like a sponge. Is there a filament or a way to print a filament to make it look like cloth or a sponge?</p>
</li>
<li><p>Are there printers on the market which are able to print several copies without the need to set up each time it finishes a single box?</p>
</li>
</ol>
|
<h1>With the right materials</h1>
<p>With the right material, you can get flexible surfaces and prints. Just two random examples:</p>
<ul>
<li>TPU is a flexible material, which can be used to print something like "Lips" that flex and take the jewelry or even strings that suspend the piece in the center.</li>
<li>Foaming TPU is a variant of normal TPU that expands during printing. This makes it somewhat spongey.</li>
</ul>
<p>However, those have downsides: they don't make good rigid shells, so you will need two different materials: one hard for the shell, and something flexible for the holder.</p>
<p>Luckily, any direct drive filament printer can work with flexible filaments, and there are some flexible filaments that work with a Bowden setup. Due to dissimilar materials though, you need to either assemble the part or buy a somewhat specialized printer: one with two nozzles. These are available but are way out of hobby-grade pricing.</p>
<p>Also, you will never get the "smooth" silky look of a fabric insert cover, but always a clearly industrial printed surface.</p>
|
<p>I would advise against this, as you will get layer lines which isn't visible in normal form, and the fit wont be as smooth etc, resulting in a cheaper look & feel. You will spend a lot of effort modifiying the parameters to get a foamy look, but still end up with a worse product.
Instead the best option is probably to buy EVA foam, and cut it with hot hire, or even a blade/knife.</p>
<p>I understand the jewelry is (probably) expensive, and thus you will want to give it a premium feel. One advice I would give is for the plastic box, consider SLA / Resin printing, and you will get almost injection moulding quality. However the chemicals involved with this are not as user friendly, and you will need to wear PPE and ensure a large amount of ventilation (as resin fumes can be toxic), however the quality will be much better</p>
| 2,181
|
<p>I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why having 2 files is better than 1).</p>
<p>What strategies should I use for organizing my code? Is it possible to separate "public" functions from "private" ones for a particular file?</p>
<p><a href="https://stackoverflow.com/questions/47878/codereview-tiny-encryption-algorithm-for-arbitrary-sized-data">This</a> question precipitated my inquiry. The tea.h file makes no reference to the tea.c file. Does the compiler "know" that every .h file has a corresponding .c file?</p>
|
<p>You should regard .h files as <strong>interface files</strong> of your .c file. Every .c file represents a module with a certain amount of functionality. If functions in a .c file are used by other modules (i.e. other .c files) put the function prototype in the .h interface file. By including the interface file in your original modules .c file and every other .c file you need the function in, you make this function available to other modules. </p>
<p>If you only need a function in a certain .c file (not in any other module), declare its scope static. This means it can only be called from within the c file it is defined in. </p>
<p>Same goes for variables that are used across multiple modules. They should go in the header file and there they have to marked with the keyword 'extern'. Note: For functions the keyword 'extern' is optional. Functions are always considered 'extern'.</p>
<p>The inclusion guards in header files help to not include the same header file multiple times.</p>
<p>For example:</p>
<p>Module1.c:</p>
<pre>
#include "Module1.h"
static void MyLocalFunction(void);
static unsigned int MyLocalVariable;
unsigned int MyExternVariable;
void MyExternFunction(void)
{
MyLocalVariable = 1u;
/* Do something */
MyLocalFunction();
}
static void MyLocalFunction(void)
{
/* Do something */
MyExternVariable = 2u;
}
</pre>
<p>Module1.h:</p>
<pre>
#ifndef __MODULE1.H
#define __MODULE1.H
extern unsigned int MyExternVariable;
void MyExternFunction(void);
#endif
</pre>
<p>Module2.c</p>
<pre>
#include "Module.1.h"
static void MyLocalFunction(void);
static void MyLocalFunction(void)
{
MyExternVariable = 1u;
MyExternFunction();
}
</pre>
|
<p>The .h files should be used to define the prototypes for your functions. This is necessary so you can include the prototypes that you need in your C-file without declaring every function that you need all in one file. </p>
<p>For instance, when you <code>#include <stdio.h></code>, this provides the prototypes for printf and other IO functions. The symbols for these functions are normally loaded by the compiler by default. You can look at the system's .h files under /usr/include if you're interested in the normal idioms involved with these files. </p>
<p>If you're only writing trivial applications with not many functions, it's not really necessary to modularize everything out into logical groupings of procedures. However, if you have the need to develop a large system, then you'll need to pay some consideration as to where to define each of your functions. </p>
| 7,026
|
<p>I'm having an issue with my very first printer, a Monoprice Select Mini V2. After doing about 20 successful prints on it, the Z axis is suddenly acting very odd.</p>
<p>When I 'home' the Z axis and move the nozzle on the X and Y, I can do the paper test on all four corners of the bed without issue - the leveling is near-perfect. But when I start a print job, the nozzle is much lower - by at least 1-2 mm. </p>
<p>This causes the print head to grind against the print bed, which I unfortunately need to replace as it's pretty much destroyed. The nozzle is so much lower at the start of a print job than it is at the home position that it ground a permanent line on the bed. It's trying to go so low, there's enough pressure on the nozzle to not let any filament escape - leaving a bad gouge like I dragged a screwdriver across the print surface. Not good.</p>
<p>It's not the Z-axis limiter switch. I confirmed that is both working and secured tightly to the printer body. When homing the Z axis, I can hear the switch click and the printer stops at that position correctly. It's only when I start a print job that it ends up lower, almost as if it's ignoring the switch.</p>
<p>I also eliminated my slicer software from the equation by printing something I had printed successfully just a couple hours prior - without reslicing or modifying the GCODE file at all. I'm at the point now where I can't print anything that I could before, without having this problem. My heat and speed settings remained untouched.</p>
<p>How can I solve this? The issue popped up just after doing a successful print. What gives? I've heard of the opposite problem (Z-Axis 'too high'), especially after changing nozzles, but not 'too low', and I've never seen it where the print job actually starts lower than the true zero position. Help!</p>
|
<p>Check the Z-drive for any component looseness. Look at belts, gears, anything with screws. Wiggle things mercilessly checking for play. </p>
<p>At the start of a normal print run, the the print head typically rises up very high as the head warms up (depends on software) and then lowers to print. If your homing paper test happened with the head near the limit switch, then the difference between those two use cases is the Z-distance traveled to get to the same place. You have eliminated software and electrical considerations, which leaves mechanical considerations. A slipping gear or belt might contribute to this odd behavior you describe.</p>
|
<p>I just had this issue with my Monoprice Select Mini V2. It seems there's some bug in the software if you already have the 3D printer at its lowest Z-elevation before starting the home calibration. To make sure it prints correctly, move the head up using the manual controls, then hit home. It should then go to the correct default location. I then adjusted my print height to that default home location and it seems to be working again.</p>
<p>Hope this helps other people still having difficultly with this is</p>
| 921
|
<p>We have a 4 server cluster running ASP.NET web application using ASP.NET State Server Service for session. On one of the 4 servers ASP.NET State Server Service is running and other servers are configured to look at this. Very often we have to patch the servers, and applying patch on the State Server requires few minutes of downtime. </p>
<p>Is there a way to configure more than two ASP.NET State Server Services in a cluster, so if one goes down, the other takes over?</p>
|
<p>I'd look into Session State Partitioning. Good info here:
<a href="http://blog.maartenballiauw.be/post/2008/01/ASPNET-Session-State-Partitioning-using-State-Server-Load-Balancing.aspx" rel="nofollow noreferrer">http://blog.maartenballiauw.be/post/2008/01/ASPNET-Session-State-Partitioning-using-State-Server-Load-Balancing.aspx</a></p>
|
<p>A second ASP.NET State Server Service cannot take over if the first one fails <em>without</em> losing the part of session info stored on the first server. New sessions will be handled fine by the second server. To get this behaviour you need to set up session state partitioning (see <a href="https://stackoverflow.com/questions/74190/can-you-have-more-than-one-asp-net-state-server-service-in-a-cluster/74221#74221">Jon Galloway's answer</a>).</p>
<p>This behaviour is by design; the ASP.NET state service does not do replication of the session data between servers.</p>
<p>If you need out of process session data replicated to several servers you must either use one of the commercial offerings (ScaleOut, for instance) or wait for Microsoft Project Velocity to become production-ready. Personally I am eagerly awaiting the release of Velocity and will switch to it from ASP.NET state server as soon as I feel confident in the product.</p>
<p><a href="http://blogs.msdn.com/velocity/archive/2008/06/05/how-to-use-session-store-provider-microsoft-project-code-named-velocity.aspx" rel="nofollow noreferrer">This link</a> has more on Velocity for session state for ASP.NET.</p>
| 9,988
|
<p>When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project.</p>
<p>When you are starting, what is your first step? do you plan out the project? make a diagram? write some code on paper? How do you start a project in a manner that you know you will succeed?</p>
|
<p>The only thing that works for me: Create the smallest possible implementation of it that's somehow usable and then use it.</p>
|
<p>First plan out the basic outline of the final application. Most important features, basic GUI, program flow, etc. Then refine that so that you don't take on too much at first, remove unnecessary features, and add what else you want in the first version. Then use that outline to start a task list to create the smallest possible working version of your application. Then it's much easier to add extra features and make it fully functioning.</p>
| 8,603
|
<p>What is an efficient way to implement a singleton design pattern in Java?</p>
|
<p>Use an enum:</p>
<pre><code>public enum Foo {
INSTANCE;
}
</code></pre>
<p>Joshua Bloch explained this approach in his <a href="http://sites.google.com/site/io/effective-java-reloaded" rel="noreferrer">Effective Java Reloaded</a> talk at Google I/O 2008: <a href="http://www.youtube.com/watch?v=pi_I7oD_uGI#t=28m50s" rel="noreferrer">link to video</a>. Also see slides 30-32 of his presentation (<a href="https://14b1424d-a-62cb3a1a-s-sites.googlegroups.com/site/io/effective-java-reloaded/effective_java_reloaded.pdf?attachauth=ANoY7crKCOet2NEUGW7RV1XfM-Jn4z8YJhs0qJM11OhLRnFW_JbExkJtvJ3UJvTE40dhAciyWcRIeGJ-n3FLGnMOapHShHINh8IY05YViOJoZWzaohMtM-s4HCi5kjREagi8awWtcYD0_6G7GhKr2BndToeqLk5sBhZcQfcYIyAE5A4lGNosDCjODcBAkJn8EuO6572t2wU1LMSEUgjvqcf4I-Fp6VDhDvih_XUEmL9nuVJQynd2DRpxyuNH1SpJspEIdbLw-WWZ&attredirects=0" rel="noreferrer">effective_java_reloaded.pdf</a>):</p>
<blockquote>
<h3>The Right Way to Implement a Serializable Singleton</h3>
<pre><code>public enum Elvis {
INSTANCE;
private final String[] favoriteSongs =
{ "Hound Dog", "Heartbreak Hotel" };
public void printFavorites() {
System.out.println(Arrays.toString(favoriteSongs));
}
}
</code></pre>
</blockquote>
<p><strong>Edit:</strong> An <a href="http://www.ddj.com/java/208403883?pgno=3" rel="noreferrer">online portion of "Effective Java"</a> says: </p>
<blockquote>
<p>"This approach is functionally equivalent to the public field approach, except that it is more concise, provides the serialization machinery for free, and provides an ironclad guarantee against multiple instantiation, even in the face of sophisticated serialization or reflection attacks. While this approach has yet to be widely adopted, <strong>a single-element enum type is the best way to implement a singleton</strong>."</p>
</blockquote>
|
<p>Sometimes a simple "<strong><code>static Foo foo = new Foo();</code></strong>" is not enough. Just think of some basic data insertion you want to do.</p>
<p>On the other hand you would have to synchronize any method that instantiates the singleton variable as such. Synchronisation is not bad as such, but it can lead to performance issues or locking (in very very rare situations using this example. The solution is</p>
<pre><code>public class Singleton {
private static Singleton instance = null;
static {
instance = new Singleton();
// do some of your instantiation stuff here
}
private Singleton() {
if(instance!=null) {
throw new ErrorYouWant("Singleton double-instantiation, should never happen!");
}
}
public static getSingleton() {
return instance;
}
}
</code></pre>
<p>Now what happens? The class is loaded via the class loader. Directly after the class was interpreted from a byte Array, the VM executes the <strong>static { }</strong> - block. that's the whole secret: The static-block is only called once, the time the given class (name) of the given package is loaded by this one class loader.</p>
| 9,612
|
<p>OK. This problem is doing my head in. And I don't know if there even IS a definitive answer.</p>
<p>We have a website, lets call it <em>mycompany.com</em>. It's a UK-based site, with UK based content. Google knows about it, and we have done a load of SEO on it. All is well.</p>
<p><strong>Except</strong>, we are about to relaunch <strong>my company, the GLOBAL brand</strong>, so we now need mycompany.com/uk, mycompany.com/us, and mycompany.com/au, for the various countries local content. We are using GEOIP, so if someone from the US loads mycompany.com, they get redirected to mycompany.com/us etc. </p>
<p>If someone isn't in one of those three countries (US, Australia, or UK) they get the UK site.</p>
<p>This is all well and good, but we dont want to lose the rather large amount of Google juice we have on mycompany.com! And worse, the Google bot appears to be 100% based in the US, so the US site (which is pretty much out LEAST important one of the three) will appear to be the main one.</p>
<p><strong>We have thought about detecting the bot</strong>, and serving UK content, but it appears Google may smack us for that.</p>
<p>Has anyone else come across this situation, and have a solution?</p>
|
<p>As long as Google can find mycompany.com/uk and mycompany.com/au, it'll index all three versions of the site. Your domain's Google juice should apply to all three URLs just fine if they're on the same domain.</p>
|
<p>@ross: yes, we have links between the sites. It' just the home page, and which one comes up when someone searches for "my company" in google.</p>
<p>Thanks!</p>
| 5,218
|
<p>How can I create this file in a directory in windows 2003 SP2:</p>
<pre><code>.hgignore
</code></pre>
<p>I get error: You must type a file name.</p>
|
<p>That's a "feature" of Windows Explorer. Try to create your files from a command line (or from a batch/program you wrote) and it should work fine. Try this from a dos prompt:</p>
<pre><code>echo Hello there! > .hgignore
</code></pre>
|
<p>By the way Raymond Chen had a blog post about this topic a while back:</p>
<p><a href="https://devblogs.microsoft.com/oldnewthing/20080414-00/?p=22763" rel="nofollow noreferrer">Why doesn't Explorer let you create a file whose name begins with a dot?</a> (archive.org link with comments: <a href="https://web.archive.org/web/20100305064616/http://blogs.msdn.com/oldnewthing/archive/2008/04/14/8389268.aspx" rel="nofollow noreferrer">https://web.archive.org/web/20100305064616/http://blogs.msdn.com/oldnewthing/archive/2008/04/14/8389268.aspx</a>)</p>
<p>In which he mentions</p>
<blockquote>
<p>You can do it from the command line or
use your favorite file management
tool.</p>
</blockquote>
| 3,989
|
<p>I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why?</p>
<pre><code>(defun biggerElems(x xs)
(let ((xst))
(dolist (elem xs)
(if (> x elem)
(setf xst (remove elem xs))))
xst))
</code></pre>
|
<p>I think it's this line that's not right:</p>
<pre><code>(setf xst (remove elem xs))))
</code></pre>
<p>The first argument to <code>setf</code> is the place, followed by the value. It looks like you have it backwards (and <code>xst</code> is either <code>nil</code> or uninitialized).</p>
<p>You might find it easier to do this:</p>
<pre><code>(defun biggerElems (x xs)
(remove-if (lambda (item) (> item x)) xs))
</code></pre>
|
<blockquote>
<p>What was the '#' for? It didn't
compile with it.</p>
</blockquote>
<p>Typo. Normally you refer to functions with <code>#'</code> (like <code>(remove-if #'oddp list)</code>), but when I was editing, I forgot to remove the '#'.</p>
| 6,856
|
<p>Can the GT2 belts lengthen themselves if they are tentioned too much?</p>
<p>I had them tensioned quite a bit until I saw the <a href="https://youtu.be/zoKmmT0a7jk" rel="nofollow noreferrer">video</a> from "Lost in Tech". I then decided to reduce the tension, but the dimensional precision was all over the place. So my guess is, that the belts are too long now?</p>
|
<p>First of all there are two methods to achieve the belt be tensioned.</p>
<p>First method is when both ends of the belt hard attached. In this case if there is a fluctuation in the mechanical system then it will be absorbed by the belt itself. And in this case with big tension it will result in stretching over time with tension disappearing.</p>
<p>The second method is to use spring at one end. The spring will absorb all the fluctuations with little or no effect on the belt.</p>
<p>But I had really bad problems with GT2 PU belts (including steel reinforced), under big tension they degrade suddenly with big change in the geometry at some position. When removed they look twisted. Looks like some reinforcing wires slipped inside the PU body of the belt.</p>
<p>Once switched to rubber GT2 belts (fibreglass reinforced) I never had problems connected to the belts. I can tell that rubber GT2 belts have no noticeable change in the geometry over many years of constant use under high tension with the spring.</p>
|
<p>As I've seen in todays video from Makers Muse, he also says that these belts can lengthen over time: <div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/-cm1vIER_bk?start=338"></iframe>
</div></div> (Link with time code)</p>
| 2,141
|
<p>In a few weeks, we'll be teaching a crash course on C++ for Java programmers straight out of college. They have little or no experience yet with C or C++.</p>
<p>Previous editions of this course were just 1 or 2 half-day sessions and covered topics including:</p>
<ul>
<li>new language features, e.g.
<ul>
<li>header vs. implementation</li>
<li>pointers and references</li>
<li>memory management</li>
<li>operator overloading</li>
<li>templates</li>
</ul>
</li>
<li>the standard libraries, e.g.
<ul>
<li>the C library headers</li>
<li>basic iostreams</li>
<li>basic STL</li>
</ul>
</li>
<li>using libraries (headers, linking)</li>
<li>they'll be using Linux, so
<ul>
<li>Basic Linux console commands</li>
<li>GCC and how to interpret its error messages</li>
<li>Makefiles and Autotools</li>
</ul>
</li>
<li>basic debugger commands</li>
<li>any topic they ask about</li>
</ul>
<p>During the course, each person individually writes, compiles, runs, and debugs simple programs using the newly introduced features. Is this the best way to learn?</p>
<ol>
<li>Which topics do you consider most crucial?</li>
<li>Which topics should be added or removed?</li>
<li>Which topics just can't be covered adequately in a short time?</li>
</ol>
|
<p>I can only once again point to <a href="http://www.research.att.com/~bs/new_learning.pdf" rel="nofollow noreferrer">Stroustrup</a> and preach: Don't teach the C subset! It's important, but not for beginners! C++ is complex enough as it is and the standard library classes, especially the STL, is much more important and (at least superficially) easier to understand than the C subset of C++.</p>
<p>Same goes for pointers and heap memory allocation, incidentally. Of course they're important but only after having taught the STL containers.</p>
<p>Another important concept that new students have to get their head around is the concept of different compilation units, the One Definition Rule (because if you don't know it you won't be able to decypher error messages) and headers. This is actually quite a barrier and one that has to be breached early on.</p>
<p>Apart from the language features the most important thing to be taught is how to understand the C++ compiler and how to get help. Getting help (i.e. knowing how to search for the right information) in my experience is the single most important thing that has to be taught about C++.</p>
<p>I've had quite good experiences with this order of teaching in the past.</p>
<p>/EDIT: If you happen to know any German, take a look at <a href="http://madrat.net/coding/cpp/skript" rel="nofollow noreferrer">http://madrat.net/coding/cpp/skript</a>, part of a <em>very</em> short introduction used in one of my courses.</p>
|
<p>You should take some time on memory management, and especially RAII.</p>
| 7,096
|
<h2>Overview</h2>
<p>One of the things I've asked a lot about on this site is <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" rel="noreferrer">LINQ</a>. The questions I've asked have been wide and varied and often don't have much context behind them. So in an attempt to consolidate the knowledge I've acquired on Linq I'm posting this question with a view to maintaining and updating it with additional information as I continue to learn about LINQ.</p>
<p>I also hope that it will prove to be a useful resource for other people wanting to learn about LINQ.</p>
<h2>What is LINQ?</h2>
<p>From <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" rel="noreferrer">MSDN</a>:</p>
<blockquote>
<p>The LINQ Project is a codename for a
set of extensions to the .NET
Framework that encompass
language-integrated query, set, and
transform operations. It extends C#
and Visual Basic with native language
syntax for queries and provides class
libraries to take advantage of these
capabilities.</p>
</blockquote>
<p>What this means is that LINQ provides a standard way to query a variety of datasources using a common syntax.</p>
<h2>What flavours of LINQ are there?</h2>
<p>Currently there are a few different LINQ providers provided by Microsoft:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/bb397919.aspx" rel="noreferrer">Linq to Objects</a> which allows you to execute queries on any IEnumerable object.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx" rel="noreferrer">Linq to SQL</a> which allows you to execute queries against a database in an object oriented manner.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb387098.aspx" rel="noreferrer">Linq to XML</a> which allows you to query, load, validate, serialize and manipulate XML documents.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb386964.aspx" rel="noreferrer">Linq to Entities</a> as suggested by <a href="https://stackoverflow.com/questions/16322/all-about-linq#33588">Andrei</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb399399.aspx" rel="noreferrer">Linq to Dataset</a></li>
</ul>
<p>There are quite a few others, many of which are listed <a href="http://blogs.microsoft.co.il/blogs/vardi/archive/2008/10/09/the-linq-list-projects.aspx" rel="noreferrer">here</a>.</p>
<h2>What are the benefits?</h2>
<ul>
<li>Standardized way to query multiple datasources</li>
<li>Compile time safety of queries</li>
<li>Optimized way to perform set based operations on in memory objects</li>
<li>Ability to debug queries</li>
</ul>
<h2>So what can I do with LINQ?</h2>
<p><a href="https://stackoverflow.com/users/489/ch00k">Chook</a> provides a way to <a href="https://stackoverflow.com/questions/4432/csv-string-handling#4441">output CSV files</a><br />
<a href="https://stackoverflow.com/users/1/jeff-atwood">Jeff</a> shows how to <a href="https://stackoverflow.com/questions/9673/remove-duplicates-from-array#9685">remove duplicates from an array</a><br />
Bob gets a <a href="https://stackoverflow.com/questions/59/how-do-i-get-a-distinct-ordered-list-of-names-from-a-datatable-using-linq#62">distinct ordered list from a datatable</a><br />
<a href="https://stackoverflow.com/users/1659/marxidad">Marxidad</a> shows how to <a href="https://stackoverflow.com/questions/15486/sorting-an-ilist-in-c#15495">sort an array</a><br />
Dana gets help implementing a <a href="https://stackoverflow.com/questions/185072/learning-linq-quicksort">Quick Sort Using Linq</a></p>
<h2>Where to start?</h2>
<p><strong>A summary of links from <a href="https://stackoverflow.com/questions/8050/beginners-guide-to-linq">GateKiller's question</a> are below</strong>:<br />
Scott Guthrie provides an <a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx" rel="noreferrer">intro to Linq on his blog</a><br />
An overview of <a href="http://msdn.microsoft.com/en-us/library/bb308959.aspx" rel="noreferrer">LINQ on MSDN</a></p>
<p><strong><a href="https://stackoverflow.com/users/1758/ChrisAnnODell">ChrisAnnODell</a> suggests checking out:</strong></p>
<ul>
<li><a href="http://www.hookedonlinq.com/MainPage.ashx" rel="noreferrer">Hooked on Linq</a></li>
<li><a href="http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b" rel="noreferrer">101 Linq Samples</a></li>
<li><a href="http://www.linqpad.net/" rel="noreferrer">LinqPad</a></li>
</ul>
<h2>What do I need to use LINQ?</h2>
<p>Linq is currently available in VB.Net 9.0 and C# 3.0 so you'll need Visual Studio 2008 or greater to get the full benefits. (You could always write your code in notepad and compile using MSBuild)</p>
<p>There is also a tool called <a href="https://stackoverflow.com/questions/7652/querying-like-linq-when-you-dont-have-linq#7710">LinqBridge</a> which will allow you to run Linq like queries in C# 2.0.</p>
<h2>Tips and tricks using LINQ</h2>
<p><a href="https://stackoverflow.com/questions/28858/coolest-c-linqlambdas-trick-youve-ever-pulled">This question</a> has some tricky ways to use LINQ</p>
|
<p>LINQ to entities:</p>
<ul>
<li><a href="http://blogs.msdn.com/adonet/archive/2008/05/20/how-do-i-new-entity-framework-videos.aspx" rel="noreferrer">Video walkthroughs</a></li>
<li><a href="http://channel9.msdn.com/shows/Going+Deep/ADONET-Entity-Framework-What-How-Why/" rel="noreferrer">Channel 9 video</a></li>
<li><a href="http://blogs.msdn.com/dsimmons/pages/entity-framework-faq.aspx" rel="noreferrer">Entity framework FAQ</a></li>
<li><a href="http://blogs.msdn.com/adonet/archive/2008/03/27/ado-net-entity-framework-performance-comparison.aspx" rel="noreferrer">Entity framework performance</a></li>
</ul>
<p>I've got a lot more I <a href="http://delicious.com/mrshrinkray/entityframework" rel="noreferrer">tagged on Delicious.com</a>.</p>
|
<p><strong>For Linq Practice</strong></p>
<p>If you want some practice on LINQ with exercises and answers, really easy to set up and, in my opinion, awesome:</p>
<p><a href="https://github.com/walkhard/linq-exercises" rel="nofollow noreferrer">https://github.com/walkhard/linq-exercises</a></p>
<p>Download from git, open in Visual Studio. Your job is to make the tests pass.</p>
<p>[disclosure: i learned some linq from it and I contribute to the project so yeah i think it's an awesome, fast and efficient way to learn.]</p>
| 3,703
|
<p>If any of you have worked with a cool tool for viewing/querying the SQL Transaction logs, please let me know. This should show all the transactional sql statements which are committed or rolled back.</p>
<p>For Database files, if it has some additional graphical capabilities like showing the internal Binary Tree structure of the indexes, that will be awesome but I guess I am asking for too much huh..</p>
|
<p>This is only relevant if you're talking SQL Server 2000 but RedGate produced a free tool called <a href="http://www.red-gate.com/products/SQL_Log_Rescue/index.htm" rel="noreferrer">SQL Log Rescue</a>.
Otherwise, for SQL Server 2005 <a href="http://www.apexsql.com/sql_tools_log.asp" rel="noreferrer">ApexSQLLog</a> from ApexSQL is the only other product I'm aware of</p>
|
<p>There are some companies that produce log readers like Lumigent and Red Gate. However they do not work with SQL server versions greater than 2000 because of meta data changes in the underlying system tables and data types, they might work if you do not use any new functionality but if you use varchar(max) XML datatype etc you are out of luck</p>
| 7,274
|
<p>High temperature PTFE tape is rated up to 550°F, which is 288°C. I'm wondering if it would be useful for components on the hot end to prevent oozing. Has anyone tried it?</p>
|
<p>That is perfectly viable these days in Marlin firmware, there are options for setting this up using the configuration file, e.g.:</p>
<pre><code>// :[0, 1, 2, 3, 4, 5, 6, 7, 8]
#define EXTRUDERS 1
...
...
...
// A dual extruder that uses a single stepper motor
//#define SWITCHING_EXTRUDER
#if ENABLED(SWITCHING_EXTRUDER)
#define SWITCHING_EXTRUDER_SERVO_NR 0
#define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3]
#if EXTRUDERS > 3
#define SWITCHING_EXTRUDER_E23_SERVO_NR 1
#endif
#endif
</code></pre>
|
<p>You'll need a custom firmware.</p>
<p>Yur custom firmware will have to react to the "Change extruder" command differently than a normal firmware: instead of just swapping to a different extruder, you'll need to perform some operations to alter the gearing (possibly a solenoid?), and possibly include some kind of "break" to make sure that the filament is not slipping back without the extruder attached. However, there already is a setup that pretty much does this: the Prusa MMU2 uses something similar. The MMU does use a Bowden setup, but you could use Bowden and direct drive in combination, especially if both motors run in sync.</p>
| 1,807
|
<p>I want to extend <strong>all</strong> my CR-10S wires. I have two long wire types: 22 and 18 AWG wires. I've done some research and found the following:</p>
<ul>
<li>Extruder heating element: 22 AWG or lower.</li>
<li>Extruder thermistor sensor: 22 AWG or lower (Doesn't really need much amp).</li>
<li>Fans: 24 AWG or lower (Doesn't really need much amp).</li>
<li>Limit switch/filament sensor: 24 AWG or lower (Doesn't really need
much amp).</li>
</ul>
<p>Here is where I've problems determining which wire gauge to use:</p>
<ul>
<li>Stepper motor wires: ?</li>
<li>Bed heater wires: ?</li>
</ul>
<p>What's the wire gauge needed for the stepper motor and bed heater wires? Obviously, the bed heater needs more amp so I expect lower wire gauge. Is my 18 gauge wire enough for this?</p>
<p>On the <a href="https://reprap.org/wiki/Heated_Bed#Wiring" rel="nofollow noreferrer">Reprap</a> site, it says that 18 AWG or lower is fine for the heating bed.</p>
|
<p>To answer your question directly, the PTFE tube (or a separate thin walled PTFE tube for the bottom part of the heatbreak) <em>generally</em> always is outside the nozzle, so yes (unless you have an all-metal hotend, then there is no PTFE tube up to the nozzle). But as read from your question, your setup has the tube included inside the nozzle (this is described in more detail below). However, you can change the nozzle for one that does not have the PTFE tube go into the nozzle but rest against the nozzle provided you can find the correct sized nozzle/tread for it.</p>
<p>The nozzles your printer uses are non standard nozzles that are featured on a few printer designs. It is called an "MK10" nozzle, but there is <a href="https://3dprinting.stackexchange.com/a/7366/5740">no such thing as a standard "MK10" nozzle</a>. Different designs of the "MK10" nozzle exist. Originally, the "MK nozzles" are the creation of Makerbot; an excellent post found in <a href="https://groups.google.com/forum/m/#!topic/wanhao-printer-3d/TEdslEknny4" rel="nofollow noreferrer">this thread</a> (all credits for the MK history go to user "<em>vermon</em>") discuss the development over time of the "MK" nozzles. An answer based on this posting is found <a href="https://3dprinting.stackexchange.com/a/5437/5740">here</a>.</p>
<p>The nozzle your printer has is slightly larger than normal nozzles. The CEO of ToyBuilder labs explains the difference between an "MK10" and an MK8 in <a href="https://www.youtube.com/watch?v=UnI0aeTw9iA" rel="nofollow noreferrer">this video</a>. Take care of the thread size of such nozzles, the "MK10" uses M7 threads, while M6 is more common!</p>
<p><a href="https://i.stack.imgur.com/Ah8Od.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ah8Od.png" alt=""MK10" vs. MK8 nozzle"></a></p>
<p>As explained in <a href="https://3dprinting.stackexchange.com/a/7498/5740">this answer</a>, the use of the PTFE tube inside the nozzle is questionable. The heating zone in effect is reduced to the tip of the nozzle. The heat transfer from heating element, to heater block to nozzle is only possible because of the enlarged design and the flange that give extra surface area for heat conduction to take place. It is not expected that such nozzles are able to print optimally at high speeds.</p>
|
<p>Yes, you can use a direct drive hotend with a bowden tube, but it won't just plug together. You just need a way to secure the end of the bowden tube to be centered above and as close the the hotend mouth as possible. In a pinch, you can spin a 4mm nut onto the tube and secure it down against the hotend mount with zipties, otherwise I would print a nice bracket.</p>
<p>It may be more prone to jam on filament swaps than a proper bowden configured hotend but it will work fine in normal use.</p>
<p>Edit, I was under the impression you were speaking of the bowden tube between the extruder and the hotend, not the liner inside of the hotend.</p>
| 1,105
|
<p>How do I determine how much an individual print costs?</p>
<p>I'd like an answer including support material, failed prints, and (ideally) wear and tear / printer maintenance costs.</p>
<p>To clarify, I'm not asking how to <em>predict</em> the cost before printing, but rather how to calculate the actual cost after printing. Though predicting the cost beforehand is useful as well.</p>
|
<p>For <a href="http://3dprintingfromscratch.com/common/types-of-3d-printers-or-3d-printing-technologies-overview/#fdm" rel="nofollow noreferrer">FDM</a> printing: </p>
<p>Both Cura and Makerbot Desktop (and perhaps others I'm not as familiar with) will give you a preview of both the length and weight of your print, including supports/rafts. Once the print is done you can weigh it on a kitchen scale.</p>
<p>PLA Filament currently runs about \$23/kg on Amazon, which works out to \$0.023/g. Multiplication can then give you a good estimate of materials costs for a print.</p>
<p>Only experience with your specific printer will give you an idea of how often you're going to hit a failed print, and how often you're going to need to replace parts. For wear and tear you could try using a depreciation model of 2-3 years, but that's only an estimate.</p>
|
<p>I recently faced the problem of calculating the cost of my printed 3D models. I wanted to know what their real value had to be counted in Excel. It was really inconvenient. Then I found a program for counting, it turned out really great, even takes into account the electricity. This is not an advertisement just throwing, maybe someone also encountered such a problem.
<a href="https://codecanyon.net/item/mcc-3d-model-cost-calculation-for-3d-printer/24033425" rel="nofollow noreferrer">https://codecanyon.net/item/mcc-3d-model-cost-calculation-for-3d-printer/24033425</a>
I was interested in the question who solved the given problem in what ways?</p>
| 129
|
<p>The heated bed output on my printer recently stopped working. I have an output for a second hotend. How can I reprogram this output as a heated bed output? The board is a <a href="http://www.geeetech.com/wiki/index.php/GT2560" rel="nofollow noreferrer">Geeetech GT2560 rev A+</a>.</p>
|
<p><em>Although it appears to be a RAMPS compatible board as described in <a href="/a/11477">this <strong>now deleted</strong> answer</a>, <strong>it is not using a RAMPS pin configuration</strong>.</em> </p>
<hr>
<p>To fix this in the firmware, this requires an upload of newly configured firmware to the board. See e.g. question: "<a href="/q/5848">How to upload firmware to reprap printer?</a>". For Marlin firmware (which is also loaded at the factory) You need to assign the correct board number or constant name (amongst several other things) in the <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration.h" rel="nofollow noreferrer">Configuration.h</a> file. Note that this is "clearly" described by the manufacturer <a href="http://www.geeetech.com/wiki/index.php/GT2560A/GT2560A%2B" rel="nofollow noreferrer">here</a>.</p>
<p>From factory, a version of 1.1.X is loaded note that version 1.1.9 is the last of the 1.x branch, the default is now version 2.x.</p>
<p>From the <a href="http://www.geeetech.com/wiki/index.php/GT2560" rel="nofollow noreferrer">manufacturer of your board</a> you find that:</p>
<pre><code>#define MOTHERBOARD 7
</code></pre>
<p>needs to be set. Note that using number is old, nowadays you would use a constant. For board number <code>7</code> this is the constant defined as <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/core/boards.h#L73" rel="nofollow noreferrer"><code>BOARD_ULTIMAKER</code></a>. Note that in version 2.x this number is now 1117, so the preferred usage is the constant name <code>BOARD_ULTIMAKER</code>!</p>
<p>Specifically for your board, the Configuration.h file should contain:</p>
<pre>
#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_ULTIMAKER
#endif
</pre>
<p>The pin arrangement used by this board is found in <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/pins/ramps/pins_ULTIMAKER.h" rel="nofollow noreferrer"><code>pins_ULTIMAKER.h</code></a>.</p>
<p>In this pin file you need to swap the pin numbers that identify the bed and the second extruder (<code>E1</code>) thermistor pin. In this file change:</p>
<pre>
//
// Heaters / Fans
//
#define HEATER_0_PIN 2
#define HEATER_1_PIN 3
#define HEATER_BED_PIN 4
</pre>
<p>to: </p>
<pre>
//
// Heaters / Fans
//
#define HEATER_0_PIN 2
#define HEATER_1_PIN 4 // or -1
#define HEATER_BED_PIN 3
</pre>
<p>Note that it could be that the <code>E1</code> heater output may not be designed to take the high current load the bed requires (depends on the traces on the board and the used MOSFET; with respect to the MOSFET, <a href="http://www.geeetech.com/wiki/index.php/GT2560A/GT2560A%2B" rel="nofollow noreferrer">the manufacturer states</a> that:</p>
<blockquote>
<p>3 55Amp MOSFET (with LED indicator, the actual output is restricted by the PCB board and the connector), all 3 MOSFET are equipped with heat sink to ensure sufficient heat dissipation and stable operation</p>
</blockquote>
<p>, implying that the MOSFETs are identical). It is therefore advised to use an external MOSFET module. This will keep the high currents away from your printer board. Such a module looks like:</p>
<p><a href="https://i.stack.imgur.com/aMcjA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aMcjA.jpg" alt="MOSFET module"></a></p>
<p>You need to wire the second extruder heater leads to the white cable, the power and the bed leads use screw terminals and are clearly labeled.</p>
|
<p>If you want to use Extruder heater and thermistor 2 as a hotbed driver, then you will need to get an external mosfet, since I doubt that the extruder heater mosfet will be able to handle the required current. Then in your slicer, just remap the bed from BED to E2</p>
| 1,524
|
<p>I'm using Repetier and Slic3r and it is printing a gap between the perimeter and infill on the first layer.
Also, the infill is lifting (as in photo).
Any advise?</p>
<p><a href="https://i.stack.imgur.com/mXJCl.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mXJCl.jpg" alt="infill issue"></a> </p>
|
<p>You're not sticking to your bed. Adjust your bed height. You are too far.
Otherwise you are going too fast and or too hot.</p>
<p>Calibrate the bed. Reduce speed. Then adjust temps. </p>
<p>Also could be material contamination</p>
<p>See this link for a visual troubleshooting.</p>
<p><a href="http://reprap.org/wiki/Print_Troubleshooting_Pictorial_Guide" rel="nofollow">http://reprap.org/wiki/Print_Troubleshooting_Pictorial_Guide</a></p>
<p><a href="http://support.3dverkstan.se/article/23-a-visual-ultimaker-troubleshooting-guide" rel="nofollow">http://support.3dverkstan.se/article/23-a-visual-ultimaker-troubleshooting-guide</a></p>
<p>In addition use some gluestick. That will often solve these issues. Last but not least add a raft if it continues. Or just ignore it. My bet is temp is too hot. I also like to smash my first layer, but not everyone likes that technique as it causes elephant footing.</p>
|
<p>I found a solution that works for me.</p>
<p>I have increased my first layer extrusion width to 250 %, reduced the print speed of perimeters to 30 mm/s, reduced the brim width to 1 and increased the infill/perimeter overlap to 30 %.</p>
<p>This was PLA with heat bed off (no heating), printing on glass and using hairspray as an adhesive. Most of my settings were on default. (Repetier & Slic3r).</p>
| 363
|
<p>I'm trying to produce sheets of photographs with captions arranged in a grid using XSLT and XSL-FO. The photo URLs and captions are produced using a FOR XML query against an SQL Server database, and the number of photos returned varies from sheet to sheet. I want to lay the photos out in four columns, filling the grid from left to right and from top to bottom. In HTML I'd do this by putting each photo and caption into a div and using "float: left" to make them flow into the grid. Is there a similarly elegant method using XSL-FO?</p>
|
<p>To keep life simple I would normally setup a table for this, it's quite simple and will ensure that things get laid out right. If you wanted to do it similarly to how you would do it in HTML then you should layout block-container elements.</p>
<p>However you decide to do it I would always recommend using the <a href="http://www.zvon.org/xxl/xslfoReference/Output/index.html" rel="nofollow noreferrer">ZVON Reference</a> site. Nice lookup of elements and available attributes, and while their XSL-FO doesn't include much in the way of explanation every page deep links to the standards document.</p>
|
<p>In the end I used a table with one row and four cells for this. In each one I selected the source elements with position() mod 4 equal to 0, 1, 2 or 3 as appropriate, and then made sure that the photo and caption was always the same height so the rows lined up correctly.</p>
| 7,748
|
<p>I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm trying to integrate the service installation into a larger install and need the service installation to remain silent.</p>
|
<p>I think I may have found it. In the service itself, the automatically created ServiceProcessInstaller component has a property "Account" which can be set to "LocalService", "LocalSystem", "NetworkService" or "User". It was defaulting to "User" which must have displayed the prompt. </p>
|
<p>Are you being asked for the account to run the service under, or for rights to install the service? For the second, installing as admin should prevent that from happening. For the first, you have to add a ServiceProcessInstaller to your Installer.</p>
<p>I believe the design surface for a service has a link to create a Project Installer. On that designer, you can add a process installer of type System.ServiceProcess.ServiceProcessInstaller. The properties of this object allow you to set the account to use for the service.</p>
| 5,212
|
<p>Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for example ) , so that it first goes through your function , before it reaches the actual open ?</p>
|
<p>Why can't you / don't want to use the <a href="https://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick">LD_PRELOAD trick</a>?</p>
<p>Example code here:</p>
<pre><code>/*
* File: soft_atimes.c
* Author: D.J. Capelis
*
* Compile:
* gcc -fPIC -c -o soft_atimes.o soft_atimes.c
* gcc -shared -o soft_atimes.so soft_atimes.o -ldl
*
* Use:
* LD_PRELOAD="./soft_atimes.so" command
*
* Copyright 2007 Regents of the University of California
*/
#define _GNU_SOURCE
#include <dlfcn.h>
#define _FCNTL_H
#include <sys/types.h>
#include <bits/fcntl.h>
#include <stddef.h>
extern int errorno;
int __thread (*_open)(const char * pathname, int flags, ...) = NULL;
int __thread (*_open64)(const char * pathname, int flags, ...) = NULL;
int open(const char * pathname, int flags, mode_t mode)
{
if (NULL == _open) {
_open = (int (*)(const char * pathname, int flags, ...)) dlsym(RTLD_NEXT, "open");
}
if(flags & O_CREAT)
return _open(pathname, flags | O_NOATIME, mode);
else
return _open(pathname, flags | O_NOATIME, 0);
}
int open64(const char * pathname, int flags, mode_t mode)
{
if (NULL == _open64) {
_open64 = (int (*)(const char * pathname, int flags, ...)) dlsym(RTLD_NEXT, "open64");
}
if(flags & O_CREAT)
return _open64(pathname, flags | O_NOATIME, mode);
else
return _open64(pathname, flags | O_NOATIME, 0);
}
</code></pre>
<p>From what I understand... it is pretty much the LD_PRELOAD trick or a kernel module. There's not a whole lot of middle ground unless you want to run it under an emulator which can trap out to your function or do code re-writing on the actual binary to trap out to your function.</p>
<p>Assuming you can't modify the program and can't (or don't want to) modify the kernel, the LD_PRELOAD approach is the best one, assuming your application is fairly standard and isn't actually one that's maliciously trying to get past your interception. (In which case you will need one of the other techniques.)</p>
|
<p>Sounds like you need auditd.</p>
<p>Auditd allows global tracking of all syscalls or accesses to files, with logging. You can set keys for specific events that you are interested in.</p>
| 9,526
|
<p>Have you used VS.NET Architect Edition's Application and System diagrams to start designing a solution?</p>
<p>If so, did you find it useful?
Did the "automatic implementation" feature work ok?</p>
|
<p>I used to use it a lot. This designer worked good for stubbing out prototype projects, but ultimately I found myself wasting a lot of time moving the mouse around when I could be typing. It seemed like an awesome idea to be able to print out the class diagrams to show APIs to other developers while I was prototyping, but it proved quite limiting and it looks awful on a non-color printer.</p>
<p>Now I just use the text editor and some <a href="http://www.autohotkey.com" rel="nofollow noreferrer">AutoHotkey</a> macros to get everything done.</p>
|
<p>Yes, and no, it's not very useful in my opinion. It's not very stable, it's easy to get out of sync, and the "look how fast I generate this" advantage is virtually nil when compared to more mundane things such as code snippets.</p>
<p>Then again, I am a total "Architect" luddite, so take this with a grain of salt.</p>
| 3,727
|
<p>I need to match and remove all tags using a regular expression in Perl. I have the following:</p>
<pre><code><\\??(?!p).+?>
</code></pre>
<p>But this still matches with the closing <code></p></code> tag. Any hint on how to match with the closing tag as well?</p>
<p>Note, this is being performed on xhtml.</p>
|
<p>I came up with this:</p>
<pre><code><(?!\/?p(?=>|\s.*>))\/?.*?>
x/
< # Match open angle bracket
(?! # Negative lookahead (Not matching and not consuming)
\/? # 0 or 1 /
p # p
(?= # Positive lookahead (Matching and not consuming)
> # > - No attributes
| # or
\s # whitespace
.* # anything up to
> # close angle brackets - with attributes
) # close positive lookahead
) # close negative lookahead
# if we have got this far then we don't match
# a p tag or closing p tag
# with or without attributes
\/? # optional close tag symbol (/)
.*? # and anything up to
> # first closing tag
/
</code></pre>
<p>This will now deal with p tags with or without attributes and the closing p tags, but will match pre and similar tags, with or without attributes.</p>
<p>It doesn't strip out attributes, but my source data does not put them in. I may change this later to do this, but this will suffice for now.</p>
|
<p>You should probably also remove any attributes on the <p> tag, since someone bad could do something like:</p>
<pre><code><p onclick="document.location.href='http://www.evil.com'">Clickable text</p>
</code></pre>
<p>The easiest way to do this, is to use the regex people suggest here to search for &ltp> tags with attributes, and replace them with <p> tags without attributes. Just to be on the safe side.</p>
| 4,970
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.