instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>In Eclipse, I have a workspace that contains all of my projects. Each project builds and compiles separately. A project does not interact with another project.</p>
<p>How does this relate to Visual Studio and Projects/Solutions there?</p>
|
<p>A VS project is it's own entity. It will build and compile by itself. A Solution is just a way to contain multiple projects. The projects don't necessarily need the other projects to compile (though, they can depend on the other projects). </p>
<p>This just lets you conceptually group projects together into one Big Project. For instance, you can have a separate testing project. It depends on the code from the actual project, and should be kept together with the actual project, but it does not need to be in the same exe/dll.</p>
|
<p>A Solution has 0 or many Projects...</p>
| 8,163
|
<ul>
<li>I am curious, what is the purpose of printing a single-height outline around the objects to be printed?</li>
<li>Also, how would it affect the outline if the object to be printed extends to (very near) the very edge of the print area?</li>
</ul>
<p><a href="https://i.stack.imgur.com/vEr8Z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vEr8Z.png" alt="finished print on print bed, with outlines annotated"></a></p>
<p>Update, I received a hint that an existing question has the answer; that link was not really to my satisfaction -- but it did link to another one that did: <a href="https://3dprinting.stackexchange.com/questions/20/what-are-main-differences-between-rafts-skirts-and-brims">What are main differences between rafts, skirts and brims?</a></p>
|
<blockquote>
<p>I am curious, what is the purpose of printing a single-height outline around the objects to be printed?</p>
</blockquote>
<p>The (equidistant) lines at distance from the print object is called the "skirt", the skirt is an option found under the "Build Plate Adhesion" options in your slicer. The primary function of the skirt is to get the flow going, but there are more benefits you can get from the skirt:</p>
<ul>
<li>You can find out whether the bed is correctly levelled, or if the bed has concave or convex areas (the skirt should be a line, I prefer at least 2 lines, of consistent thickness, if not, this may hint to incorrect levelling;</li>
<li>You can find out if there is enough or a sufficient amount of adhesive (e.g. glue stick, hair spray, specific print adhesion sprays like 3DLAC or DimaFix, etc), if not the bed might be greasy or lacking the adhesion product;</li>
<li>You can configure the skirt height to use the skirt as a shield for draft or ooze and distance to product);</li>
</ul>
<blockquote>
<p>Also, how would it affect the outline if the object to be printed extends to (very near) the very edge of the print area?</p>
</blockquote>
<p>Do note that a skirt limits the useable build area by the distance and width of the skirt.</p>
<hr>
<p><em>Basically this has been answered (see <a href="/a/11303">this answer</a> and <a href="/a/11304">this answer</a>) in a different question (<a href="https://3dprinting.stackexchange.com/questions/11300/random-lines-are-being-printed">"Random lines are being printed?"</a>), but it might be beneficial to answer this question rather than closing this for a dupe. This question is focussed on the skirt, the equidistant lines around the print object, while the other question focuses on the priming line.</em></p>
<hr>
|
<p>My understand is that's is basically a purging extrusion, so that you get flow through the extruder before you start printing the object, as filament that's been inside the hotend during warm-up might have been "overcooked" by spending too much time in the hotend at temperature. It also helps stabilise the PID loop controlling the extruder temperature by allowing the PID loop to stabilise the temperature of the hotend as it's got filament flowing through it compared to it being idle. </p>
<p>It also shows the user where it intends to start printing, which is a useful check if something went wrong with Gcode generation. </p>
| 1,640
|
<p>If you had to provide a wizard like form entry experience in mvc how would you abstract the page flow?</p>
|
<p>Investigate the post-redirect-get pattern.</p>
<p><a href="http://weblogs.asp.net/mhawley/archive/tags/MVC/default.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/mhawley/archive/tags/MVC/default.aspx</a><br>
<a href="http://devlicio.us/blogs/tim_barcz/archive/2008/08/22/prg-pattern-in-the-asp-net-mvc-framework.aspx" rel="nofollow noreferrer">http://devlicio.us/blogs/tim_barcz/archive/2008/08/22/prg-pattern-in-the-asp-net-mvc-framework.aspx</a></p>
<p>Use that along with a robust domain model (for tracking steps or form completion state or whatever you call it) and you're golden.</p>
|
<p>There are a couple ways, create an action for each step of the wizard process, or create a parameter that is passed in to the action method. Like <em>step</em> that will allow you to know what the state of the wizard is in.</p>
| 3,705
|
<p>For me <strong>usable</strong> means that:</p>
<ul>
<li>it's being used in real-wold</li>
<li>it has tools support. (at least some simple editor)</li>
<li>it has human readable syntax (no angle brackets please) </li>
</ul>
<p>Also I want it to be as close to XML as possible, i.e. there must be support for attributes as well as for properties. So, no <a href="http://en.wikipedia.org/wiki/YAML" rel="noreferrer">YAML</a> please. Currently, only one matching language comes to my mind - <a href="http://en.wikipedia.org/wiki/JSON" rel="noreferrer">JSON</a>. Do you know any other alternatives?</p>
|
<p>YAML is a 100% superset of JSON, so it doesn't make sense to reject YAML and then consider JSON instead. YAML does everything JSON does, but YAML gives so much more too (like references).</p>
<p>I can't think of anything XML can do that YAML can't, except to validate a document with a DTD, which in my experience has never been worth the overhead. But YAML is so much faster and easier to type and read than XML.</p>
<p>As for attributes or properties, if you think about it, they don't truly "add" anything... it's just a notational shortcut to write something as an attribute of the node instead of putting it in its own child node. But if you like that convenience, you can often emulate it with YAML's inline lists/hashes. Eg:</p>
<pre><code><!-- XML -->
<Director name="Spielberg">
<Movies>
<Movie title="Jaws" year="1975"/>
<Movie title="E.T." year="1982"/>
</Movies>
</Director>
# YAML
Director:
name: Spielberg
Movies:
- Movie: {title: E.T., year: 1975}
- Movie: {title: Jaws, year: 1982}
</code></pre>
<p>For me, the luxury of not having to write each node tag twice, combined with the freedom from all the angle-bracket litter makes YAML a preferred choice. I also actually like the lack of formal tag attributes, as that always seemed to me like a gray area of XML that needlessly introduced two sets of syntax (both when writing and traversing) for essentially the same concept. YAML does away with that confusion altogether.</p>
|
<p>AFAIK, JSON and YAML are exactly equivalent in data structure terms. YAML just has less brackets and quotes and stuff. So I don't see how you are rejecting one and keeping the other.</p>
<p>Also, I don't see how XML's angle brackets are less "human readable" than JSON's square brackets, curly brackets and quotes.</p>
| 7,455
|
<p>I would like to compare a screenshot of one application (could be a Web page) with a previously taken screenshot to determine whether the application is displaying itself correctly. I don't want an exact match comparison, because the aspect could be slightly different (in the case of a Web app, depending on the browser, some element could be at a slightly different location). It should give a measure of how similar are the screenshots.</p>
<p>Is there a library / tool that already does that? How would you implement it?</p>
|
<p>This depends entirely on how smart you want the algorithm to be.</p>
<p>For instance, here are some issues:</p>
<ul>
<li>cropped images vs. an uncropped image</li>
<li>images with a text added vs. another without</li>
<li>mirrored images</li>
</ul>
<p>The easiest and simplest <em>algorithm</em> I've seen for this is just to do the following steps to each image:</p>
<ol>
<li>scale to something small, like 64x64 or 32x32, disregard aspect ratio, use a combining scaling algorithm instead of nearest pixel</li>
<li>scale the color ranges so that the darkest is black and lightest is white</li>
<li>rotate and flip the image so that the lighest color is top left, and then top-right is next darker, bottom-left is next darker (as far as possible of course)</li>
</ol>
<p><strong>Edit</strong> A <em>combining scaling algorithm</em> is one that when scaling 10 pixels down to one will do it using a function that takes the color of all those 10 pixels and combines them into one. Can be done with algorithms like averaging, mean-value, or more complex ones like bicubic splines.</p>
<p>Then calculate the mean distance pixel-by-pixel between the two images.</p>
<p>To look up a possible match in a database, store the pixel colors as individual columns in the database, index a bunch of them (but not all, unless you use a very small image), and do a query that uses a range for each pixel value, ie. every image where the pixel in the small image is between -5 and +5 of the image you want to look up.</p>
<p>This is easy to implement, and fairly fast to run, but of course won't handle most advanced differences. For that you need much more advanced algorithms.</p>
|
<p>Well a really base-level method to use could go through every pixel colour and compare it with the corresponding pixel colour on the second image - but that's a probably a very <strong>very</strong> slow solution.</p>
| 4,555
|
<p>There is this great hotend called a <a href="http://reprap.org/wiki/Diamond_Hotend#Benefits_of_this_design" rel="noreferrer">diamond hotend</a>, which can be used to print in 3 colors and mix them into hundreds? of colors. This can for example be used with Red, Green and Blue filament to mix a RGB palette. They don't have to be these colors, but I believe RGB would give the maximum range of colors when constrained to 3.</p>
<p>However true RGB in physical printing would use separate colored <a href="https://en.wikipedia.org/wiki/Voxel" rel="noreferrer">voxels</a> to create the appearance of a color, just like monitors display colors. As far as I know only HP Jet Fusion 3D printer uses this process, but it uses a process vastly different from normal diy 3D FDM printers.</p>
<p>CMYK is mixed physically like you would mix watercolors together to make new colors. It is used for printing on paper by <strong>all</strong> laserjet and inkjet printers (and in printing presses).
So that means even the 3 input diamond hotend is actually mixed like CMYK. Repetier firmware v92.9 has this built in with support up to 16 inputs for a nozzle, but Marlin firmware v1.0.x only supports 4 inputs per nozzle at this time.</p>
<p>Using RGB for the 3 inputs of a hotend, means the printing color palette lacks White and also it seems that CMYK would give a bigger range of colors. That brings our tally to 4 inputs. It still needs a white filament to print white, so that means 5 inputs. And while we are at it, probably a 6th input would be useful: like for printing black infill (to save using CMYK to mix into black) or for using transparent filament or elastic filament.</p>
<p>So why isn't there a nozzle with 5-6 inputs already? Could it be done? Are there such hotends already?</p>
<p>P.S These are just theoretical assumptions. I just discovered 3D printing and I am in the planning phase of building my first 3D printer, so I am a total n00b in this. Please correct any assumptions I got wrong.</p>
|
<p>You may be a bit misled here. First of all, you do <strong>not</strong> want "RGB" , as those are additive colors such as used when combining light sources. You <strong>do</strong> want "RYB" (red-yellow-blue) or the more accurate CMY(plus K just to get a 'truer' black) for subtractive colors.</p>
<p>Next, there's really no reason to attempt pixel-mixing. What should happen, ideally, is that pigments get fully mixed upon extrusion so that the desired color is actually in place. Pretty much any pixel-based setup will not "blend" into the desired visual perception. And as you propose, you really need a White and a Black to adjust the saturation (take a look at the Wikipedia pages on Hue and Saturation color maps).<br>
So I'm not convinced that separate extrusion heads will ever get you a decent color continuum. I don't know if anyone has, or is planning, a multi-input, single-output head but I'd sure like one. </p>
|
<p>So whilst this is not quite what you were talking about I think this is the closest to the effect you’re looking for that I’ve seen.</p>
<p><a href="https://www.xyzprinting.com/en-US/product/da-vinci-color" rel="nofollow noreferrer">https://www.xyzprinting.com/en-US/product/da-vinci-color</a></p>
<p>This da Vinci printer uses a CMYK inkjet to colour a white filament as its being extruded. This allows for very quick changes in colour as well a nearly infinite combination of colours.</p>
<p>This means it only needs a single extruder and hotend but obviously the hotend needs to be built to allow the injection of pigment from the inkjet.</p>
| 402
|
<p>I want to shift the contents of an array of bytes by 12-bit to the left.</p>
<p>For example, starting with this array of type <code>uint8_t shift[10]</code>:</p>
<pre><code>{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xBC}
</code></pre>
<p>I'd like to shift it to the left by 12-bits resulting in:</p>
<pre><code>{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xC0, 0x00}
</code></pre>
|
<p>Hurray for pointers! </p>
<p>This code works by looking ahead 12 bits for each byte and copying the proper bits forward. 12 bits is the bottom half (nybble) of the next byte and the top half of 2 bytes away.</p>
<pre><code>unsigned char length = 10;
unsigned char data[10] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0A,0xBC};
unsigned char *shift = data;
while (shift < data+(length-2)) {
*shift = (*(shift+1)&0x0F)<<4 | (*(shift+2)&0xF0)>>4;
shift++;
}
*(data+length-2) = (*(data+length-1)&0x0F)<<4;
*(data+length-1) = 0x00;
</code></pre>
<blockquote>
<p>Justin wrote:<br>
@Mike, your solution works, but does not carry. </p>
</blockquote>
<p>Well, I'd say a normal shift operation does just that (called overflow), and just lets the extra bits fall off the right or left. It's simple enough to carry if you wanted to - just save the 12 bits before you start to shift. Maybe you want a circular shift, to put the overflowed bits back at the bottom? Maybe you want to realloc the array and make it larger? Return the overflow to the caller? Return a boolean if non-zero data was overflowed? You'd have to define what carry means to you.</p>
<pre><code>unsigned char overflow[2];
*overflow = (*data&0xF0)>>4;
*(overflow+1) = (*data&0x0F)<<4 | (*(data+1)&0xF0)>>4;
while (shift < data+(length-2)) {
/* normal shifting */
}
/* now would be the time to copy it back if you want to carry it somewhere */
*(data+length-2) = (*(data+length-1)&0x0F)<<4 | (*(overflow)&0x0F);
*(data+length-1) = *(overflow+1);
/* You could return a 16-bit carry int,
* but endian-ness makes that look weird
* if you care about the physical layout */
unsigned short carry = *(overflow+1)<<8 | *overflow;
</code></pre>
|
<p>@Joseph, notice that the variables are 8 bits wide, while the shift is 12 bits wide. Your solution works only for N <= variable size.</p>
<p>If you can assume your array is a multiple of 4 you can cast the array into an array of uint64_t and then work on that. If it isn't a multiple of 4, you can work in 64-bit chunks on as much as you can and work on the remainder one by one.
This may be a bit more coding, but I think it's more elegant in the end.</p>
| 4,909
|
<p>I'm new to SQL Server Reporting Services, and was wondering the best way to do the following:</p>
<blockquote>
<ul>
<li>Query to get a list of popular IDs</li>
<li>Subquery on each item to get properties from another table</li>
</ul>
</blockquote>
<p>Ideally, the final report columns would look like this:</p>
<pre><code>[ID] [property1] [property2] [SELECT COUNT(*)
FROM AnotherTable
WHERE ForeignID=ID]
</code></pre>
<p>There may be ways to construct a giant SQL query to do this all in one go, but I'd prefer to compartmentalize it. Is the recommended approach to write a VB function to perform the subquery for each row? Thanks for any help.</p>
|
<p>I would recommend using a <a href="http://msdn.microsoft.com/en-us/library/ms160348.aspx" rel="nofollow noreferrer">SubReport</a>. You would place the SubReport in a table cell.</p>
|
<p>Simplest method is this:</p>
<pre><code>select *,
(select count(*) from tbl2 t2 where t2.tbl1ID = t1.tbl1ID) as cnt
from tbl1 t1
</code></pre>
<p>here is a workable version (using table variables):</p>
<pre><code>declare @tbl1 table
(
tbl1ID int,
prop1 varchar(1),
prop2 varchar(2)
)
declare @tbl2 table
(
tbl2ID int,
tbl1ID int
)
select *,
(select count(*) from @tbl2 t2 where t2.tbl1ID = t1.tbl1ID) as cnt
from @tbl1 t1
</code></pre>
<p>Obviously this is just a raw example - standard rules apply like don't select *, etc ...</p>
<hr>
<p><strong>UPDATE from Aug 21 '08 at 21:27:</strong><br>
@AlexCuse - Yes, totally agree on the performance.</p>
<p>I started to write it with the outer join, but then saw in his sample output the count and thought that was what he wanted, and the count would not return correctly if the tables are outer joined. Not to mention that joins can cause your records to be multiplied (1 entry from tbl1 that matches 2 entries in tbl2 = 2 returns) which can be unintended.</p>
<p>So I guess it really boils down to the specifics on what your query needs to return.</p>
<hr>
<p><strong>UPDATE from Aug 21 '08 at 22:07:</strong><br>
To answer the other parts of your question - is a VB function the way to go? No. Absolutely not. Not for something this simple.</p>
<p>Functions are very bad on performance, each row in the return set executes the function.</p>
<p>If you want to "compartmentalize" the different parts of the query you have to approach it more like a stored procedure. Build a temp table, do part of the query and insert the results into the table, then do any further queries you need and update the original temp table (or insert into more temp tables).</p>
| 4,125
|
<p>How to obtain Vista Edition programmatically, that is Home Basic, Home Premium, Business or Ultimate ?</p>
|
<p>MSDN gives extensive answer:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms724429%28VS.85%29.aspx" rel="nofollow noreferrer">Getting the System Version</a></p>
|
<p>Brilliant! This is just what I need as well. Thanks aku.</p>
<p>edg: Environment.OSVersion contains a version string but this doesn't generally give enough information to differentiate editions (also applies to XP Home/XP Pro). Also, there's the risk that this string will be localised so matching on it woudn't necessarily work.</p>
| 8,007
|
<p>I'm trying to do a simple rotation in OpenGL but must be missing the point.
I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally.</p>
<p>At the moment I have code like this:</p>
<pre><code>glPushMatrix();
glRotatef(90.0, 0.0, 1.0, 0.0);
glBegin(GL_TRIANGLES);
glVertex3f( 1.0, 1.0, 0.0 );
glVertex3f( 3.0, 2.0, 0.0 );
glVertex3f( 3.0, 1.0, 0.0 );
glEnd();
glPopMatrix();
</code></pre>
<p>But the result is not a triangle rotated 90 degrees.</p>
<p><strong>Edit</strong>
Hmm thanks to Mike Haboustak - it appeared my code was calling a SetCamera function that use glOrtho. I'm too new to OpenGL to have any idea of what this meant but disabling this and rotating in the Z-axis produced the desired result. </p>
|
<p>Do you get a 1 unit straight line? It seems that 90deg rot. around Y is going to have you looking at the side of a triangle with no depth.</p>
<p>You should try rotating around the Z axis instead and see if you get something that makes more sense. </p>
<p>OpenGL has two matrices related to the display of geometry, the ModelView and the Projection. Both are applied to coordinates before the data becomes visible on the screen. First the ModelView matrix is applied, transforming the data from model space into view space. Then the Projection matrix is applied with transforms the data from view space for "projection" on your 2D monitor. </p>
<p>ModelView is used to position multiple objects to their locations in the "world", Projection is used to position the objects onto the screen.</p>
<p>Your code seems fine, so I assume from reading the documentation you know what the nature of functions like glPushMatrix() is. If rotating around Z still doesn't make sense, verify that you're editing the ModelView matrix by calling glMatrixMode.</p>
|
<p>When I had a first look at OpenGL, the <a href="http://nehe.gamedev.net/" rel="nofollow noreferrer">NeHe tutorials</a> (see the left menu) were invaluable.</p>
| 4,371
|
<p>When doing calculations on very large numbers where integral data types such as double or int64 falls short, a separate class to handle such large numbers may be needed. </p>
<p>Does anyone care to offer an efficient algorithm on how best to do this?</p>
|
<p>There are 2 solutions to your problem:</p>
<ul>
<li><p><strong>Easy way:</strong>
Use an external library such as '<a href="http://gmplib.org/" rel="noreferrer">The GNU MP Bignum Library</a> and forget about implementation details.</p></li>
<li><p><strong>Hard way:</strong>
Design your own class/structure containing multiple higher order datatypes like double or int64 variables and define basic math operations for them using operator overloading (in C++) or via methods named add, subtract, multiply, shift, etc. (in JAVA and other OO languages). </p></li>
</ul>
<p>Let me know if you need any further help. I have done this a couple of times in the past.</p>
|
<p>Using the built-in features of a language work for me.</p>
<p>Java has <code>BigInteger</code> and <code>BigDecimal</code>, and Python automagicaly switches to an object similar to Java's if a number gets out of the range of an <code>integer</code> or whatnot.</p>
<p>As for other languages though, I have no idea.</p>
<p>I hate re-inventing the wheel.</p>
| 4,567
|
<p>How can a <code>sdbm</code> hash function (such as <a href="http://www.cse.yorku.ca/~oz/hash.html" rel="nofollow noreferrer">this</a>) be implemented in C# ?</p>
|
<p>You can take the C code almost without changes:</p>
<pre><code>uint sdbm( string str )
{
uint hash = 0;
foreach( char ch in str )
{
hash = ch + (hash << 6) + (hash << 16) - hash;
}
return hash;
}
</code></pre>
<p>Or did you think of something more sophisticated?</p>
|
<p>The result from the hash differs between the C++ and C# implementation. I figured out that str parameter needs to be passed as a byte array.</p>
<pre><code>private uint sdbm(byte[] str)
{
uint hash = 0;
foreach (char ch in str)
hash = ch + (hash << 6) + (hash << 16) - hash;
return hash;
}
</code></pre>
<p>Call the method by converting the value to be hashed with the <code>BitConverter.GetBytes</code> method.</p>
<pre><code>uint Hash = sdbm(BitConverter.GetBytes(myID));
</code></pre>
| 3,673
|
<p>I'm planning on doing more coding from home but in order to do so, I need to be able to edit files on a Samba drive on our dev server. The problem I've run into with several editors is that the network latency causes the editor to lock up for long periods of time (Eclipse, TextMate). Some editors cope with this a lot better than others, but are there any file system or other tweaks I can make to minimize the impact of lag?</p>
<p>A few additional points:</p>
<ul>
<li>There's a policy against having company data on personal machines, so I'd like to avoid checking out the code locally.</li>
<li>The mount is over a PPTP VPN connection.</li>
<li>Mounting to Linux or OS X client</li>
</ul>
|
<p>Use a source control system — Subversion, Perforce, Git, Mercurial, Bazaar, etc. — so you're never editing code on a shared server. Instead you should be editing a local work area and committing changes to a repository located on the network.</p>
<p>Also, convince your company to adapt their policy such that company code is allowed on personal machines <strong>if</strong> it's on an encrypted volume. Encrypted disk images that you can use for this are <em>trivial</em> to create using Disk Utility, and can use strong cryptography. You can get even more security by not storing your encryption passphrase in your keychain, and instead typing it every time you mount the encrypted volume; this means that even if your local user account is compromised, as long as you don't have the volume mounted, nobody else will be able to mount it.</p>
<p>I did this all the time when I was consulting and none of my clients — some of whom had similar rules about company code — ever had a problem with it once I explained how things worked. (I think some of them even started using encrypted disk images even within their offices.)</p>
|
<p>Short answer: you can do no trick. CIFS is really geared towards LAN with a reasonably calm trafic, so you have zero chance to not suffer intermittent lag accessing a share through a VPN. The editor at some point needs to access the file in blocking IO, because it makes no real sense to do otherwise.</p>
<p>You could switch editor and use Emacs + <a href="http://www.gnu.org/software/tramp/" rel="nofollow noreferrer">TRAMP</a> which is geared to work on remote files.</p>
| 5,396
|
<p>I can never remember the differences in regular expression syntax used by tools like <a href="http://en.wikipedia.org/wiki/Grep" rel="noreferrer">grep</a> and <a href="http://en.wikipedia.org/wiki/AWK" rel="noreferrer">AWK</a>, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm often hamstrung by the limitations of even <code>egrep</code> ("extended" <code>grep</code>).</p>
<p>Is there a site that lists the differences in a concise and easy-to-read fashion?</p>
|
<p><a href="https://rads.stackoverflow.com/amzn/click/com/0596528124" rel="nofollow noreferrer" rel="nofollow noreferrer">Mastering Regular Expressions</a>, devotes the last four chapters to Java, PHP, Perl, and <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a>. One chapter for each. From what I know, the <a href="https://rads.stackoverflow.com/amzn/click/com/0596514271" rel="nofollow noreferrer" rel="nofollow noreferrer">pocket edition</a> contains just those final four chapters. </p>
|
<p>I find this site helpful: <a href="http://www.regular-expressions.info/" rel="noreferrer">http://www.regular-expressions.info/</a></p>
<p>Other than that, I use the corresponding documentation extensively and I believe, all said and done, there's no way around that.</p>
| 4,322
|
<p>I am planning a mechanical 40% keyboard build and are coincidentally on the home stretch of a homemade CNC project.</p>
<p>The only thing the CNC needs to do for the keyboard project is to drill 7*48 holes. So what I need to do now is layout those holes in SVG. Therein lies the question. What resolution should I use for the SVG? I want to space the center of the keyboard switches 19 mm apart. An online pixel to mm converter suggested that 72 pixels is exactly 19.05 mm (which actually is what Cherry MX says should be their spacing).</p>
<p>Now, I do understand that this really doesn't matter, but I am curious as I am new on CNCs and was suspecting that there is a number that will "just work". </p>
<p>EDIT:
For example, if I where to print the template (SVG) on a regular printer, what pixel to mm ratio should I use so that it would come out the size I want?</p>
|
<p><strike>I found one of those printer things that puts ink on dead trees and tested to print a simple SVG file.</p>
<pre><code><svg xmlns="http://www.w3.org/2000/svg"
width="400px" height="800px">
<rect x="10" y="10" width="72" height="72" fill="#999999" />
<rect x="10" y="100" width="378" height="378" fill="#999999" />
</svg>
</code></pre>
<p>As I suspected 72 pixels came out pretty much exactly 19mm. (72/19.05)*100~=378 came out 100mm.</p>
<p>Given this I am going to assume that 72/19.05 is the de facto best pixel to mm ratio to use for CNC projects.</strike></p>
<p>EDIT:</p>
<p>Found this documentation: <a href="http://w3.org/TR/SVG/coords.html#Units" rel="noreferrer">http://w3.org/TR/SVG/coords.html#Units</a></p>
<pre><code><svg xmlns="http://www.w3.org/2000/svg"
width="400px" height="800px">
<rect x="10" y="10" width="19.05mm" height="19.05mm" fill="#999999" />
<rect x="10" y="100" width="100mm" height="100mm" fill="#999999" />
</svg>
</code></pre>
<p>Much simpler to use mm as units right away </p>
|
<p>SVG is a vector-graphics format, there's no particular reason it can't scale arbitrarily. Presumably the CNC software will allow you to select the scale of a pixel? If so, pick a scale that makes the math work out easily (so some integer number of pixels per millimeter). If not, it's probably documented somewhere for the specific tool you're using.</p>
| 446
|
<p>Can we achieve 100% decoupling between components of a system or different systems that communicate with each other? I don't think its possible. If two systems communicate with each other then there should be some degree of coupling between them. Am I right?</p>
|
<p>If components are 100% decoupled, it means that they don't communicate with each other.</p>
<p>Actually there are <a href="http://en.wikipedia.org/wiki/Coupling_%28computer_science%29" rel="nofollow noreferrer">different types of coupling</a>. But the general idea is that objects are not coupled if they don't depend on each other.</p>
|
<p>You can achieve that. Think of two components that communicate with each other through network. One component can run on Windows while other on Unix. Isn't that 100% decoupling?</p>
| 9,586
|
<p>Some code that rounds up the division to demonstrate (C-syntax):</p>
<pre><code>#define SINT64 long long int
#define SINT32 long int
SINT64 divRound(SINT64 dividend, SINT64 divisor)
{
SINT32 quotient1 = dividend / divisor;
SINT32 modResult = dividend % divisor;
SINT32 multResult = modResult * 2;
SINT32 quotient2 = multResult / divisor;
SINT64 result = quotient1 + quotient2;
return ( result );
}
</code></pre>
<p>Now, if this were User-space we probably wouldn't even notice that our compiler is generating code for those operators (e.g. <code>divdi3()</code> for division). Chances are we link with <code>libgcc</code> without even knowing it. The problem is that Kernel-space is different (e.g. no <code>libgcc</code>). What to do?</p>
<p>Crawl Google for a while, notice that pretty much everyone addresses the unsigned variant:</p>
<pre><code>#define UINT64 long long int
#define UINT32 long int
UINT64 divRound(UINT64 dividend, UINT64 divisor)
{
UINT32 quotient1 = dividend / divisor;
UINT32 modResult = dividend % divisor;
UINT32 multResult = modResult * 2;
UINT32 quotient2 = multResult / divisor;
UINT64 result = quotient1 + quotient2;
return ( result );
}
</code></pre>
<p>I know how to fix this one: Override <code>udivdi3()</code> and <code>umoddi3()</code> with <code>do_div()</code> from <em>asm/div64.h</em>. Done right? Wrong. Signed is not the same as unsigned, <code>sdivdi3()</code> does not simply call <code>udivdi3()</code>, they are separate functions for a reason.</p>
<p>Have you solved this problem? Do you know of a library that will help me do this? I'm really stuck so whatever you might see here that I just don't right now would be really helpful.</p>
<p>Thanks,
Chad</p>
|
<p>This functionality is introduced in <a href="http://lxr.linux.no/linux+v2.6.22/lib/div64.c" rel="noreferrer">/linux/lib/div64.c</a> as early as kernel v2.6.22.</p>
|
<p><code>ldiv</code> ?</p>
<p>Edit: reread title, so you might want to ignore this. Or not, depending on if it has an appropriate non-library version.</p>
| 5,593
|
<p>In my web application I have a file which hold the current revision number via $Rev$. This work fine except, if I don't make any changes to that file, it doesn't get committed.</p>
<p><strong>Is there anyway I can force a single file to always get committed to the SVN server?</strong></p>
<p><em>I'm using TortoiseSVN for Windows so any code or step-by-step instructions would be helpful.</em></p>
|
<p>Basically, you want the output of the <code>svnversion</code> command in a file.</p>
<p>Such files are usually kept out of the repository, and automatically created by a build script. I suggest you do the same. If you don't build, but just to a <code>svn up</code> on the server side, just call <code>svnversion</code> after <code>svn up</code> or create a shell script to do both actions.</p>
<p>If you <strong>have</strong> to keep it in the repository on the other hand, calling <code>svnversion</code> in a pre-commit hook would be your best bet.</p>
|
<p>Depending on your client, some of them offer a pre-commit hook that you can implement something that simply "touches" the file and flags it as changed. If your using something like Visual Studio you could create a post build task that would "touch" the file but you would have to make sure that you do a build before committing changes.</p>
| 2,781
|
<p>I'm working on an installer (using Wise Installer, older version from like 1999).</p>
<p>I'm creating a shortcut in the Programs group to an EXE. I'm also creating a shortcut on the Desktop.</p>
<p>If the install is run from an Admin account, then I create the shortcut on the Common Desktop and Common Program Group (i.e., read from the HKEY_LOCAL_MACHINE\Explorer\Shellfor All Users).
If it's installed from a NonAdmin account, then I install to the HKEY_CURRENT_USER's desktop and Program Group.</p>
<p><strong>Behavior</strong></p>
<p>Install on:</p>
<p><em>XP NonAdmin</em> - Desktop and Program Shortcuts install OK.</p>
<p><em>Vista Admin</em> - Desktop & Program Shortcuts install OK.</p>
<p><em>Vista Non-Admin, UAC off</em>- <strong>Desktop shortcut installs, but Program Shortcut does not</strong>. However, the Program group <em>folder</em> they're supposed to be installed to <em>does</em> get created.</p>
<p>At the end of the install, I launch the Program Group that has the shorcut. It launches in all of the above. I can manually drag a shortcut into that folder and it works just fine.</p>
<p>I'm bloody baffled.</p>
<p>I've tried installing some other commercial apps (Opera, Foxit, FireFox) Only FireFox will install under NonAdmin (and only if you select something other than Program Files, which I was aware is off limits to nonAdmin acounts). And FF doesn't install an Uninstall Icon nor
Uninstall support from the Remove Programs.</p>
<p>I tried installing IE 7 and it <em>requires Admin</em> to install. It won't even install with temporarily elevated Admin.</p>
<p><strong>Perhaps the idea is that you're not supposed to install software in Vista from a NonAdmin account?</strong></p>
|
<p>Vista does some nifty transparent redirection to provide backwards compatibility with non-vista applications. Try installing to the All Users location as a non-admin, and Vista should transparently put your shortcuts somewhere unique to that user.</p>
|
<p>I had a permissions issue with an installer I created when users started installing on Vista. What solved my problem was renaming the installer to install.exe (or setup.exe). </p>
<p>-Dave</p>
| 8,214
|
<p>I have an application that's a mix of Java and C++ on Solaris. The Java aspects of the code run the web UI and establish state on the devices that we're talking to, and the C++ code does the real-time crunching of data coming back from the devices. Shared memory is used to pass device state and context information from the Java code through to the C++ code. The Java code uses a PostgreSQL database to persist its state.</p>
<p>We're running into some pretty severe performance bottlenecks, and right now the only way we can scale is to increase memory and CPU counts. We're stuck on the one physical box due to the shared memory design.</p>
<hr>
<p>The really big hit here is being taken by the C++ code. The web interface is fairly lightly used to configure the devices; where we're really struggling is to handle the data volumes that the devices deliver once configured.</p>
<p>Every piece of data we get back from the device has an identifier in it which points back to the device context, and we need to look that up. Right now there's a series of shared memory objects that are maintained by the Java/UI code and referred to by the C++ code, and that's the bottleneck. Because of that architecture we cannot move the C++ data handling off to another machine. We need to be able to scale out so that various subsets of devices can be handled by different machines, but then we lose the ability to do that context lookup, and that's the problem I'm trying to resolve: how to offload the real-time data processing to other boxes while still being able to refer to the device context.</p>
<p>I should note we have no control over the protocol used by the devices themselves, and there is no possible chance that situation will change.</p>
<hr>
<p>We know we need to move away from this to be able to scale out by adding more machines to the cluster, and I'm in the early stages of working out exactly how we'll do this.</p>
<p>Right now I'm looking at Terracotta as a way of scaling out the Java code, but I haven't got as far as working out how to scale out the C++ to match.</p>
<p>As well as scaling for performance we need to consider high availability as well. The application needs to be available pretty much the whole time -- not absolutely 100%, which isn't cost effective, but we need to do a reasonable job of surviving a machine outage.</p>
<p>If you had to undertake the task I've been given, what would you do?</p>
<p><em>EDIT: Based on the data provided by @john channing, i'm looking at both GigaSpaces and Gemstone. Oracle Coherence and IBM ObjectGrid appear to be java-only.</em></p>
|
<p>The first thing I would do is construct a model of the system to map the data flow and try to understand precisely where the bottleneck lies. If you can model your system as a <a href="http://en.wikipedia.org/wiki/Pipeline_(software)" rel="nofollow noreferrer">pipeline</a>, then you should be able to use the theory of constraints (most of the literature is about optimising business processes but it applies equally to software) to continuously improve performance and eliminate the bottleneck.</p>
<p>Next I would collect some hard empirical data that accurately characterises the performance of your system. It is something of a cliché that you cannot manage what you cannot measure, but I have seen many people attempt to optimise a software system based on hunches and fail miserably.</p>
<p>Then I would use the <a href="http://en.wikipedia.org/wiki/Pareto_principle" rel="nofollow noreferrer">Pareto Principle (80/20 rule)</a> to choose the small number of things that will produce the biggest gains and focus only on those.</p>
<p>To scale a Java application horizontally, I have used <a href="http://www.oracle.com/technology/products/coherence/index.html" rel="nofollow noreferrer">Oracle Coherence</a> extensively. Although some dismiss it as a very expensive <a href="http://en.wikipedia.org/wiki/Distributed_hash_table" rel="nofollow noreferrer">distributed hashtable</a>, the functionality is much richer than that and you can, for example, directly access data in the cache from <a href="http://coherence.oracle.com/pages/viewpage.action?pageId=1343579" rel="nofollow noreferrer">C++ code</a> .</p>
<p>Other alternatives for horizontally scaling your Java code would be <a href="http://www.gigaspaces.com/" rel="nofollow noreferrer">Giga Spaces</a>, <a href="http://www.infoq.com/news/IBM-ObjectGrid-Cache" rel="nofollow noreferrer">IBM Object Grid</a> or <a href="http://www.gemstone.com/" rel="nofollow noreferrer">Gemstone Gemfire</a>.</p>
<p>If your C++ code is stateless and is used purely for number crunching, you could look at distributing the process using <a href="http://www.zeroc.com/icegrid/index.html" rel="nofollow noreferrer">ICE Grid</a> which has bindings for all of the languages you are using.</p>
|
<p>You need to scale sideways and out. Maybe something like a <a href="http://en.wikipedia.org/wiki/Java_Message_Service" rel="nofollow noreferrer">message queue</a> could be the backend between the frontend and the crunching.</p>
| 7,428
|
<p>I want to write a word addin that does some computations and updates some ui whenever the user types something or moves the current insertion point. From looking at the MSDN docs, I don't see any obvious way such as an TextTyped event on the document or application objects.</p>
<p>Does anyone know if this is possible without polling the document?</p>
|
<p>As you've probably discovered, <a href="http://msdn.microsoft.com/en-us/library/aa269681(office.10).aspx" rel="nofollow noreferrer">Word has events</a>, but they're for really coarse actions like a document open or a switch to another document. I'm guessing MS did this intentionally to prevent a crappy macro from slowing down typing.</p>
<p>In short, there's no great way to do what you want. <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.office.developer.com.add_ins&tid=4c3e438e-d9ab-4384-b29c-105175fd252e&cat=&lang=&cr=&sloc=&p=1" rel="nofollow noreferrer">A Word MVP confirms that in this thread.</a></p>
|
<p>As you've probably discovered, <a href="http://msdn.microsoft.com/en-us/library/aa269681(office.10).aspx" rel="nofollow noreferrer">Word has events</a>, but they're for really coarse actions like a document open or a switch to another document. I'm guessing MS did this intentionally to prevent a crappy macro from slowing down typing.</p>
<p>In short, there's no great way to do what you want. <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.office.developer.com.add_ins&tid=4c3e438e-d9ab-4384-b29c-105175fd252e&cat=&lang=&cr=&sloc=&p=1" rel="nofollow noreferrer">A Word MVP confirms that in this thread.</a></p>
| 7,957
|
<p>I have a Visual Studio 2005 Solution workspace which in turn has 8 projects included in it. I want to profile the complete code(all the projects) and get some measure about the absolute cycles taken by each function to execute, or at least percentage cycle consumptions.</p>
<p>I checked out help for VS 2005, and also the project setiings options but could not find any pointers on hwo to get the profile info.
Any help regarding this would be beneficial.</p>
<p>-AD.</p>
|
<p>I guess the inbuilt profiler of Visual Studio 2005 comes onyl with the Developer Edition and Team Edition. I have a Professional edition which, it seems doesnot have the inbuilt profiler tool.</p>
<p>-AD</p>
|
<p>Red-gate's <a href="http://www.red-gate.com/products/ants_profiler/index.htm" rel="nofollow noreferrer">Profiler</a> is great for this.</p>
| 6,775
|
<p>I am trying to set a <code>javascript</code> <code>date</code> so that it can be submitted via <code>JSON</code> to a <code>.NET</code> type, but when attempting to do this, <code>jQuery</code> sets the <code>date</code> to a full <code>string</code>, what format does it have to be in to be converted to a <code>.NET</code> type?</p>
<pre><code>var regDate = student.RegistrationDate.getMonth() + "/" + student.RegistrationDate.getDate() + "/" + student.RegistrationDate.getFullYear();
j("#student_registrationdate").val(regDate); // value to serialize
</code></pre>
<p>I am using <code>MonoRail</code> on the server to perform the binding to a <code>.NET</code> type, that aside I need to know what to set the form hidden field value to, to get properly sent to <code>.NET</code> code.</p>
|
<p><a href="http://support.microsoft.com/kb/320687" rel="nofollow noreferrer" title="KB Article 320687">Microsoft KB Article 320687</a> has a detailed answer to this question.</p>
<p>Basically, you override the WndProc method to return HTCAPTION to the WM_NCHITTEST message when the point being tested is in the client area of the form -- which is, in effect, telling Windows to treat the click exactly the same as if it had occured on the caption of the form.</p>
<pre><code>private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if ((int)m.Result == HTCLIENT)
m.Result = (IntPtr)HTCAPTION;
return;
}
base.WndProc(ref m);
}
</code></pre>
|
<p>VC++ 2010 Version (of FlySwat's):</p>
<pre><code>#include <Windows.h>
namespace DragWithoutTitleBar {
using namespace System;
using namespace System::Windows::Forms;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void) { InitializeComponent(); }
protected:
~Form1() { if (components) { delete components; } }
private:
System::ComponentModel::Container ^components;
HWND hWnd;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->SuspendLayout();
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(640, 480);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew EventHandler(this, &Form1::Form1_Load);
this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Form1_MouseDown);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void Form1_Load(Object^ sender, EventArgs^ e) {
hWnd = static_cast<HWND>(Handle.ToPointer());
}
private: System::Void Form1_MouseDown(Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
if (e->Button == System::Windows::Forms::MouseButtons::Left) {
::ReleaseCapture();
::SendMessage(hWnd, /*WM_NCLBUTTONDOWN*/ 0xA1, /*HT_CAPTION*/ 0x2, 0);
}
}
};
}
</code></pre>
| 5,008
|
<p>I have values stored as strings in a <code>DataTable</code> where each value could really represent an <code>int</code>, <code>double</code>, or <code>string</code> (they were all converted to strings during an import process from an external data source). I need to test and see what type each value really is.</p>
<p>What is more efficient for the application (or is there no practical difference)?</p>
<ol>
<li>Try to convert to <code>int</code> (and then <code>double</code>). If conversion works, the return <code>true</code>. If an exception is thrown, return <code>false</code>.</li>
<li>Regular expressions designed to match the pattern of an <code>int</code> or <code>double</code></li>
<li>Some other method?</li>
</ol>
|
<p>Would use double.TryParse, it has performance benefits.</p>
|
<p>I'd personally use int.tryparse, then double.tryparse. Performance on those methods is quite fast. They both return a Boolean. If both fail then you have a string, per how you defined your data.</p>
| 2,422
|
<p>I know the following libraries for drawing charts in an SWT/Eclipse RCP application:</p>
<ul>
<li><a href="http://www.eclipse.org/articles/article.php?file=Article-BIRTChartEngine/index.html" rel="noreferrer">Eclipse BIRT Chart Engine</a> (Links to an article on how to use it)</li>
<li><a href="http://www.jfree.org/jfreechart/" rel="noreferrer">JFreeChart</a></li>
</ul>
<p>Which other libraries are there for drawing pretty charts with SWT? Or charts in Java generally? After all, you can always display an image...</p>
|
<p>I have not used BIRT or JGraph, however I use JFreeChart in my SWT application. I have found the best way to use JFreeChart in SWT is by making a composite an AWT frame and using the AWT functionality for JFreeChart. The way to do this is by creating a composite </p>
<pre><code>Composite comp = new Composite(parent, SWT.NONE | SWT.EMBEDDED);
Frame frame = SWT_AWT.new_Frame(comp);
JFreeChart chart = createChart();
ChartPanel chartPanel = new ChartPanel(chart);
frame.add(chartPanel);
</code></pre>
<p>There are several problems in regards to implementations across different platforms as well as the SWT code in it is very poor (in its defense Mr. Gilbert does not know SWT well and it is made for AWT). My two biggest problems are as AWT events bubble up through SWT there are some erroneous events fired and due to wrapping the AWT frame JFreeChart becomes substantially slower.</p>
<p>@zvikico</p>
<p>The idea of putting the chart into a web page is probably not a great way to go. There are a few problems first being how Eclipse handles integrating the web browser on different platforms is inconsistent. Also from my understanding of a few graphing packages for the web they are server side requiring that setup, also many companies including mine use proxy servers and sometimes this creates issues with the Eclipse web browsing.</p>
|
<p>There's also JGraph, but I'm not sure if that's only for graphs (i.e. nodes and edges), or if it does charts also.</p>
| 4,285
|
<p>My Anet A8 was working and printing great until my hotbed connector snapped and shorted out my motherboard. After replacing the connections to my hotbed and my motherboard I can't print anything because the filament flow is very inconsistent. It often laying down nothing. See my included picture. </p>
<p>I've tried a bunch of suggested calibration settings but none of them worked:</p>
<ul>
<li>increased extruder temp, </li>
<li>decreased speed, </li>
<li>increased flow, </li>
</ul>
<p>Any ideas or thoughts would be great. </p>
<p><a href="https://i.stack.imgur.com/NzZwN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NzZwN.jpg" alt="First layer view of a printed product"></a></p>
|
<p>Thanks everyone for the tips. I posted this question on another board and it was suggested my extruder was clogged. After unclogging everything works great again. </p>
|
<p><em>Please note that the problems you faced are typical for the Anet A8, the connectors are underrated for the application. Also, do note that the stock firmware does not have thermal runaway protection, which is considered to be very unsafe and could potentially lead to burning down your house! Please flash a firmware that supports thermal runaway protection, like e.g. Marlin Firmware.</em></p>
<hr>
<p>Basically you just tried to change some parameters to see if they have an effect. This is generally a good idea to get an idea of the problem, but a more technical approach would be to start from the beginning and exclude things you have tested. As for now you cannot conclude why the print looks as shown in the image, e.g. it also looks as if the nozzle to bed distance is too large.</p>
<p>The question remains if your 3D printer board did survive the shorting of the hotbed leads!</p>
<p>To troubleshoot this particular problem it is advised to check whether the extrusion process still does what it is asked to do. Disconnecting the hotend from the extruder and measuring how much filament is extruded would be the first thing to check. Please look into <a href="https://3dprinting.stackexchange.com/questions/6483/how-do-i-calibrate-the-extruder-of-my-printer">How do I calibrate the extruder of my printer?</a>. It seems odd that the extrusion is off if the firmware has not changed, or alternative settings stored, but to be sure it would be the first thing to check. From this exercise you'll learn whether the firmware is set correctly and the extruder working properly. It can still be that the extruder gear slips, e.g. because the filament does not have a lot of friction when disconnected from the hotend.</p>
<p>When the extrusion process works and the commanded length is extruded, you can update the question with what you have done. After this, and if the problem persists, you can look into nozzle clogging and filament resistance for instance.</p>
| 1,067
|
<p>When I am writing code in Python, I often need to remove items from a list or other sequence type based on some criteria. I haven't found a solution that is elegant and efficient, as removing items from a list you are currently iterating through is bad. For example, you can't do this:</p>
<pre><code>for name in names:
if name[-5:] == 'Smith':
names.remove(name)
</code></pre>
<p>I usually end up doing something like this:</p>
<pre><code>toremove = []
for name in names:
if name[-5:] == 'Smith':
toremove.append(name)
for name in toremove:
names.remove(name)
del toremove
</code></pre>
<p>This is innefficient, fairly ugly and possibly buggy (how does it handle multiple 'John Smith' entries?). Does anyone have a more elegant solution, or at least a more efficient one? </p>
<p>How about one that works with dictionaries?</p>
|
<p>Two easy ways to accomplish just the filtering are:</p>
<ol>
<li><p>Using <code>filter</code>:</p>
<p><code>names = filter(lambda name: name[-5:] != "Smith", names)</code></p></li>
<li><p>Using list comprehensions:</p>
<p><code>names = [name for name in names if name[-5:] != "Smith"]</code></p></li>
</ol>
<p>Note that both cases keep the values for which the predicate function evaluates to <code>True</code>, so you have to reverse the logic (i.e. you say "keep the people who do not have the last name Smith" instead of "remove the people who have the last name Smith").</p>
<p><strong>Edit</strong> Funny... two people individually posted both of the answers I suggested as I was posting mine.</p>
|
<p>Well, this is clearly an issue with the data structure you are using. Use a hashtable for example. Some implementations support multiple entries per key, so one can either pop the newest element off, or remove all of them.</p>
<p>But this is, and what you're going to find the solution is, elegance through a different data structure, not algorithm. Maybe you can do better if it's sorted, or something, but iteration on a list is your only method here.</p>
<p><em>edit:</em> one does realize he asked for 'efficiency'... all these suggested methods just iterate over the list, which is the same as what he suggested. </p>
| 3,899
|
<p>Can the glTF format be used for 3D printing?</p>
<p>If not, is there any tool can convert it to another format such as STL, OBJ, STEP, and IGES? </p>
|
<p>As far as can be found it should be possible to convert glTF into STL (or OBJ).</p>
<p>You could try to use an online converter to do this, e.g. <a href="http://www.greentoken.de/onlineconv/" rel="nofollow noreferrer">this one (greentoken)</a>; and <a href="http://assimp.sourceforge.net/main_features_formats.html" rel="nofollow noreferrer">this (assimp)</a> may be useful too. </p>
<p>According to <a href="https://b2b.partcommunity.com/community/faq/view/211/95/105/0/how-to-convert-3d-models-between-file-formats-i-e-fbx-to-obj-o" rel="nofollow noreferrer">this</a> greentoken supports glTF as input and STL as output, but it is reported by @Trish that that does not work. Assimp could output STL files which then could be used by slicer programs to generate the specific G-code file to print the model on your printer.</p>
|
<p>No, <code>gltf</code> is not a format that slicers accept commonly, and indeed, it is not even intended to be reverseable in the 1.0 format version. This has changed a little for the 2.0 standard. Some programs that allow exporting into the sliceable <code>stl</code> and <code>obj</code> formats can also import <code>gltf</code>:</p>
<ul>
<li><a href="https://www.blender.org/" rel="nofollow noreferrer">blender</a> has an <a href="https://github.com/KhronosGroup/glTF-Blender-IO" rel="nofollow noreferrer">importer plugin</a> - more info <a href="https://blender.stackexchange.com/questions/93415/how-to-open-a-glb-or-gltf-file-in-blender">here</a></li>
<li><a href="https://www.sketchup.com/" rel="nofollow noreferrer">SketchUpp</a> has an <a href="https://www.simlab-soft.com/3d-plugins/GLTF_Importer_For_Sketchup-main.aspx" rel="nofollow noreferrer">importer plugin</a></li>
</ul>
<p>You have to be careful though: formats like <code>dae</code> or <code>stl</code> are meant to transfer 3d objects usually without the loss of information or with just a minimal loss (stl, for example, does technically not contain a <em>scale</em> natively), while <code>gltf</code> is end users and <a href="https://stackoverflow.com/questions/40549453/is-there-a-way-to-convert-gltf-to-dae">does not contain all the information</a>. This can lead to models getting distorted and destroyed on importing them into a rendering or modeling software.</p>
| 1,037
|
<p>We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively?</p>
<blockquote>
<p><a href="http://code.google.com/support/bin/answer.py?answer=65301&topic=10945" rel="noreferrer">Will the Maps API work over SSL (HTTPS)?</a></p>
<p>At this time, the Maps API is not
available over a secure (SSL)
connection. If you are running the
Maps API on a secure site, the browser
may warn the user about non-secure
objects on the screen.</p>
</blockquote>
<p>We have considered the following options</p>
<ol>
<li>Splitting the page so that credit card collection (the requirement for SSL) is not on the same page as the Google Map.</li>
<li>Switching to another map provider, such as Virtual Earth. Rumor has it that they support SSL.</li>
<li>Playing tricks with IFRAMEs. Sounds kludgy.</li>
<li>Proxying the calls to Google. Sounds like a lot of overhead.</li>
</ol>
<p>Are there other options, or does anyone have insight into the options that we have considered?</p>
|
<p>I'd agree with the previous two answers that in this instance it may be better from a usability perspective to split the two functions into separate screens. You really want your users to be focussed on entering complete and accurate credit card information, and having a map on the same screen may be distracting.</p>
<p>For the record though, Virtual Earth certainly does fully support SSL. To enable it you simple need to change the script reference from http:// to https:// and append &s=1 to the URL, e.g.</p>
<pre><code><script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1" type="text/javascript"></script>
</code></pre>
<p>becomes</p>
<pre><code><script src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1&s=1" type="text/javascript"></script>
</code></pre>
|
<p>I 've just removed the http protocol and it worked!</p>
<p>From this:</p>
<pre><code><script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
</code></pre>
<p>To this:</p>
<pre><code><script src="//maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
</code></pre>
| 2,556
|
<p>What are attributes in .NET, what are they good for, and how do I create my own attributes?</p>
|
<p>Metadata. Data about your objects/methods/properties. </p>
<p>For example I might declare an Attribute called: DisplayOrder so I can easily control in what order properties should appear in the UI. I could then append it to a class and write some GUI components that extract the attributes and order the UI elements appropriately.</p>
<pre><code>public class DisplayWrapper
{
private UnderlyingClass underlyingObject;
public DisplayWrapper(UnderlyingClass u)
{
underlyingObject = u;
}
[DisplayOrder(1)]
public int SomeInt
{
get
{
return underlyingObject .SomeInt;
}
}
[DisplayOrder(2)]
public DateTime SomeDate
{
get
{
return underlyingObject .SomeDate;
}
}
}
</code></pre>
<p>Thereby ensuring that SomeInt is always displayed before SomeDate when working with my custom GUI components.</p>
<p>However, you'll see them most commonly used outside of the direct coding environment. For example the Windows Designer uses them extensively so it knows how to deal with custom made objects. Using the BrowsableAttribute like so:</p>
<pre><code>[Browsable(false)]
public SomeCustomType DontShowThisInTheDesigner
{
get{/*do something*/}
}
</code></pre>
<p>Tells the designer not to list this in the available properties in the Properties window at design time for example.</p>
<p>You <em>could</em> also use them for code-generation, pre-compile operations (such as Post-Sharp) or run-time operations such as Reflection.Emit.
For example, you could write a bit of code for profiling that transparently wrapped every single call your code makes and times it. You could "opt-out" of the timing via an attribute that you place on particular methods.</p>
<pre><code>public void SomeProfilingMethod(MethodInfo targetMethod, object target, params object[] args)
{
bool time = true;
foreach (Attribute a in target.GetCustomAttributes())
{
if (a.GetType() is NoTimingAttribute)
{
time = false;
break;
}
}
if (time)
{
StopWatch stopWatch = new StopWatch();
stopWatch.Start();
targetMethod.Invoke(target, args);
stopWatch.Stop();
HandleTimingOutput(targetMethod, stopWatch.Duration);
}
else
{
targetMethod.Invoke(target, args);
}
}
</code></pre>
<p>Declaring them is easy, just make a class that inherits from Attribute. </p>
<pre><code>public class DisplayOrderAttribute : Attribute
{
private int order;
public DisplayOrderAttribute(int order)
{
this.order = order;
}
public int Order
{
get { return order; }
}
}
</code></pre>
<p>And remember that when you use the attribute you can omit the suffix "attribute" the compiler will add that for you.</p>
<p><strong>NOTE:</strong> Attributes don't do anything by themselves - there needs to be some other code that uses them. Sometimes that code has been written for you but sometimes you have to write it yourself. For example, the C# compiler cares about some and certain frameworks frameworks use some (e.g. NUnit looks for [TestFixture] on a class and [Test] on a test method when loading an assembly).<br>
So when creating your own custom attribute be aware that it will not impact the behaviour of your code at all. You'll need to write the other part that checks attributes (via reflection) and act on them. </p>
|
<p>Attributes are also commonly used for Aspect Oriented Programming. For an example of this check out the <a href="http://www.postsharp.org" rel="nofollow noreferrer">PostSharp</a> project.</p>
| 4,072
|
<p>In your applications, what's a "long time" to keep a transaction open before committing or rolling back? Minutes? Seconds? Hours?</p>
<p>and on which database?</p>
|
<p>transactions: minutes.</p>
<p>Cursors: 0seconds maximum, if you use a cursor we fire you. </p>
<p><strong>This is not ridiculous when you consider we are in a high availability web environment, that has to run sql server, and we don't even allow stored procs because of inability to accurately version and maintain them. If we were using oracle maybe.</strong></p>
|
<p>Generally I agree with the other answers: Avoid cursors when possible (in most cases) and close them as fast as possible.</p>
<p>However: It all depends on the environment you're working in. </p>
<ul>
<li>If it is a production website environment with lots of users, make sure that the cursor goes away before someone gets a timeout. </li>
<li>If you're - for example - writing a "log analyzing stored procedure" (or whatever) on a proprietary machine that does nothing else: feel free to do whatever you want to do. You'll be the only person who has to wait. It's not as if the database server is going to die because you use cursors. You should consider, though, that maybe usage behaviour will change over time and at some point there might be 10 people using that application. So try to find another way ;)</li>
</ul>
| 3,190
|
<p>I would like to parse a string such as <code>p1=6&p2=7&p3=8</code> into a <code>NameValueCollection</code>.</p>
<p>What is the most elegant way of doing this when you don't have access to the <code>Page.Request</code> object?</p>
|
<p>There's a built-in .NET utility for this: <a href="http://msdn.microsoft.com/en-us/library/ms150046.aspx" rel="noreferrer">HttpUtility.ParseQueryString</a></p>
<pre class="lang-cs prettyprint-override"><code>// C#
NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring);
</code></pre>
<pre class="lang-vb prettyprint-override"><code>' VB.NET
Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(querystring)
</code></pre>
<p>You may need to replace <code>querystring</code> with <code>new Uri(fullUrl).Query</code>.</p>
|
<p>This is my code, I think it's very useful: </p>
<pre><code>public String GetQueryString(string ItemToRemoveOrInsert = null, string InsertValue = null )
{
System.Collections.Specialized.NameValueCollection filtered = new System.Collections.Specialized.NameValueCollection(Request.QueryString);
if (ItemToRemoveOrInsert != null)
{
filtered.Remove(ItemToRemoveOrInsert);
if (!string.IsNullOrWhiteSpace(InsertValue))
{
filtered.Add(ItemToRemoveOrInsert, InsertValue);
}
}
string StrQr = string.Join("&", filtered.AllKeys.Select(key => key + "=" + filtered[key]).ToArray());
if (!string.IsNullOrWhiteSpace(StrQr)){
StrQr="?" + StrQr;
}
return StrQr;
}
</code></pre>
| 9,416
|
<p>Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.</p>
<p>But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.</p>
<p>Why does Java choose this strategy and what is the benefit from this?</p>
<p>Is this better than the Python approach?</p>
|
<p>There are drawbacks of using reference counting. One of the most mentioned is circular references: Suppose A references B, B references C and C references B. If A were to drop its reference to B, both B and C will still have a reference count of 1 and won't be deleted with traditional reference counting. CPython (reference counting is not part of python itself, but part of the C implementation thereof) catches circular references with a separate garbage collection routine that it runs periodically...</p>
<p>Another drawback: Reference counting can make execution slower. Each time an object is referenced and dereferenced, the interpreter/VM must check to see if the count has gone down to 0 (and then deallocate if it did). Garbage Collection does not need to do this.</p>
<p>Also, Garbage Collection can be done in a separate thread (though it can be a bit tricky). On machines with lots of RAM and for processes that use memory only slowly, you might not want to be doing GC at all! Reference counting would be a bit of a drawback there in terms of performance...</p>
|
<p>Late in the game, but I think one significant rationale for RC in python is its simplicity. See this <a href="http://mail.python.org/pipermail/python-list/2005-October/921938.html" rel="nofollow noreferrer">email by Alex Martelli</a>, for example.</p>
<p>(I could not find a link outside google cache, the email date from 13th october 2005 on python list).</p>
| 4,194
|
<p>I am using MSBuild to build my stuff. I want to use CruiseControl.net as by Build Server.</p>
<p>Now, CCNET refers nAnt a lot, but it looks as if ccnet can do most of the stuff nant could do through the project configuration and msbuild. Also, nAnt seems a bit unsupported, with a Beta release that is almost a year old now.</p>
<p>In short: I am actually quite happy with MSBuild (especially since it's the "official" compiler front end) and a bit uncomfortable with nAnt, but I do not want to judge prematurely.</p>
<p>What would be reasons to use nAnt over MSBuild? Especially with ccnet, which seems to overlap a bit with nant in terms of features (and adding the automated build related stuff)</p>
|
<p>If you are quite happy with MSBuild, then I would stick with MSBuild. This may be one of those cases where the tool you learn first is the one you will prefer. I started with NAnt and can't quite get used to MSBuild. I'm sure they will both be around for quite some time.</p>
<p>There are some fundamental differences between the two, probably best highlighted by <a href="http://forums.msdn.microsoft.com/en-US/msbuild/thread/994761a3-ea9d-40c7-8d4f-4c208b2023f6/" rel="noreferrer">this conversation between some NAnt fans and a Microsoftie</a>.</p>
<p>Interestingly, <a href="http://codebetter.com/blogs/jeremy.miller/default.aspx" rel="noreferrer">Jeremy Miller</a> asked the exact opposite question <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/09/20/is-there-a-good-reason-to-switch-to-msbuild.aspx" rel="noreferrer">on his blog</a> last year. </p>
|
<p>Like what so many people have already indicated, the answer here is "it depends". There are some things like <em>repeating operations</em> that are much simpler and cleaner in NAnt. See <a href="http://forums.msdn.microsoft.com/en-US/msbuild/thread/417329cb-a6f6-45dd-9a56-98bb4aee74f9" rel="nofollow noreferrer">the MSDN forums</a> for a discussion about this.</p>
| 2,369
|
<p>I have created a design with fusion 360. I tried to print it with my M3D Pro printer but it seems the designs have a flaw. </p>
<p>If I try to print the bottom part, the second layer is wrong. It seems to have moved to the left by a few centimeters.</p>
<p>Here is the link to the <code>.stl</code> files and pictures of how the first few layers turned out.</p>
<p><a href="https://seafile.fmk.me/d/09e43aa7fc8e416ab187/" rel="nofollow noreferrer">https://seafile.fmk.me/d/09e43aa7fc8e416ab187/</a></p>
<p><a href="https://i.stack.imgur.com/uOtTN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uOtTN.jpg" alt="broken print"></a>
<a href="https://i.stack.imgur.com/IrAGq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IrAGq.jpg" alt="broken print 2"></a>
<a href="https://i.stack.imgur.com/KYEfD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KYEfD.png" alt="bottom.stl"></a>
<a href="https://i.stack.imgur.com/vtCyf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vtCyf.png" alt="top.stl"></a></p>
<p>The <code>bottom.stl</code> file can be loaded and viewed in the m3d software but leads to faulty print after the first layer. The <code>top.stl</code> cannot even be viewed in the M3D software.</p>
<p>Other 3D files from thingiverse etc. can be printed without a problem.
Do I need to enable any special features to be able to print those files correctly?</p>
<p>Yours, Felix</p>
|
<blockquote>
<p>and found out it has a resistance of 1.5kΩ, while it should have a resistance of 4.7kΩ, so I suspect this is the main reason behind this high reading. Now the only thing left to figure out is how the resistance of this resistor changed.</p>
</blockquote>
<p>You can't measure the resistance of a resistor in circuit - the resistance probably appears to be lower to your multimeter because of some other circuit elements. There's also no reasonable explanation for how a 4.7k resistor could suddenly turn into a 1.5k one. It's highly unlikely this resistor is the cause of your issues.</p>
<p>It is more likely something else is damaged, likely the AtMega1284p microcontroller itself. When your extruder touched the bed clip, perhaps the 12V from the bed shorted through the clip and to the extruder? I would guess that the 12V shorted itself to the thermistor input, which subsequently blew the ESD protection diode on that input. This might explain the high reading and the low apparent resistance of R41.</p>
|
<blockquote>
<p>and found out it has a resistance of 1.5kΩ, while it should have a resistance of 4.7kΩ, so I suspect this is the main reason behind this high reading. Now the only thing left to figure out is how the resistance of this resistor changed.</p>
</blockquote>
<p>You can't measure the resistance of a resistor in circuit - the resistance probably appears to be lower to your multimeter because of some other circuit elements. There's also no reasonable explanation for how a 4.7k resistor could suddenly turn into a 1.5k one. It's highly unlikely this resistor is the cause of your issues.</p>
<p>It is more likely something else is damaged, likely the AtMega1284p microcontroller itself. When your extruder touched the bed clip, perhaps the 12V from the bed shorted through the clip and to the extruder? I would guess that the 12V shorted itself to the thermistor input, which subsequently blew the ESD protection diode on that input. This might explain the high reading and the low apparent resistance of R41.</p>
| 762
|
<p>Does anybody know of any sample databases I could download, preferably in CSV or some similar easy to import format so that I could get more practice in working with different types of data sets? </p>
<p>I know that the Canadian Department of Environment has <a href="http://www.climate.weatheroffice.ec.gc.ca/Welcome_e.html" rel="noreferrer">historical weather data</a> that you can download. However, it's not in a common format I can import into any other database. Moreover, you can only run queries based on the included program, which is actually quite limited in what kind of data it can provide. </p>
<p>Does anybody know of any interesting data sets that are freely available in a common format that I could use with mySql, Sql Server, and other types of database engines?</p>
|
<p>The datawrangling blog posted a nice list a while back:</p>
<p><a href="http://www.datawrangling.com/some-datasets-available-on-the-web" rel="noreferrer">http://www.datawrangling.com/some-datasets-available-on-the-web</a></p>
<p>Includes financial, government data (labor, housing, etc.), and too many more to list here.</p>
|
<p>What database engine are you importing into? That will help determine what formats you can include in your search.</p>
<p>The <a href="http://www.ferc.gov/docs-filing/eqr/soft-tools/sample-csv.asp" rel="nofollow noreferrer">Federal Energy Regulatory</a> Commission has some sample data for download in CSV format.</p>
| 8,126
|
<p>When using custom-draw (NM_CUSTOMDRAW) to draw the entire contents of a ListView SubItem (in Report/Details view), it would be nice to be able to apply the same left and right
padding in my custom paint method that is applied by the control itself for non-custom-drawn items.</p>
<p>Is there a way to programmatically retrieve this padding value? Is it
related to the width of a particular character (" " or "w" or something?) or
is it a fixed value (6px on left and 3px on right or something) or...?</p>
<p>EDIT: To clarify, <strong>I want to add the same padding to my NM_CUSTOMDRAWn SubItems that the control adds to items that it draws</strong>, and the metric that I'm looking for, for example, is the white space between the beginning of the 2nd column and the word "Siamese" in the following screenshot (<em>Note: screenshot from MSDN added to help explain my question</em>):</p>
<p><a href="https://i.stack.imgur.com/yTHoy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yTHoy.png" alt="List View in Report View" /></a><br />
<sub>(source: <a href="https://msdn.microsoft.com/Bb774735.lv_detailsview(en-us,VS.85).png" rel="nofollow noreferrer">microsoft.com</a>)</sub></p>
<p>Note that the word "Siamese" is aligned with the header item ("Breed"). I would like to be able to guarantee the same alignment for custom-drawn items.</p>
|
<p>use ListView Header message HDM_GETBITMAPMARGIN
see <a href="http://msdn.microsoft.com/en-us/library/bb775314(VS.85).aspx" rel="nofollow noreferrer">link text</a></p>
|
<p>I would assume that <em>GetSystemMetrics()</em> is that you need to look at. I think that <strong>SM_CXEDGE</strong> and <strong>SM_CYEDGE</strong> are probably the values you want, but don't quote me on that. ;-)</p>
| 7,400
|
<p>What is the most proper way to sending email of minimal 1000 or more in PHP? Any reliable email queuing technique that is capable to handle that?
</p>
|
<p>You could just insert your emails into a Mail Queue database table, and have a separate process check the queue and batch send a certain number at once.</p>
|
<p>I've generally relied on a hack.
I have a database list of email addresses and then use a meta-redirect to self with an increasing 'offset' parameter that specifies which row in the database I am up to. Server redirects cause problems because browsers assume that the time taken indicates an infinite loop.</p>
| 3,820
|
<p>I want to wrap a piece of code that uses the Windows Impersonation API into a neat little helper class, and as usual, I'm looking for a way to go test-first. However, while WindowsIdentity is a managed class, the LogonUser call that is required to actually perform the logging in as another user is an unmanaged function in advapi32.dll. </p>
<p>I think I can work around this by introducing an interface for my helper class to use and hiding the P/Invoke calls in an implementation, but testing that implementation will still be a problem. And you can imagine actually performing the impersonation in the test can be a bit problematic, given that the user would actually need to exist on the system.</p>
|
<p><em>Guideline: Don't test code that you haven't written.</em><br>
You shouldn't be concerned with WinAPI implementation not working (most probably it works as expected).
Your concern should be testing the 'Wiring' i.e. if your code makes the right WinAPI call. In which case, all you need is to mock out the interface and let the mock framework tell if you the call was made with the right params. If yes, you're done.</p>
<ul>
<li>Create IWinAPIFacade (with relevant WinAPI methods) and implementation CWinAPIFacade.</li>
<li>Write a test which plugs in a mock of IWinAPIFacade and verify that the appropriate call is made</li>
<li>Write a test to ensure that CWinAPIFacade is created and plugged in as a default (in normal functioning)</li>
<li>Implement CWinAPIFacade which simply blind-delegates to Platform Invoke calls - no need to auto-test this layer. Just do a manual verification. Hopefully this won't change that often and nothing breaks. If you find that it <em>does</em> in the future, barricade it with some tests.</li>
</ul>
|
<p>I am not sure if I follow you.. You don't want to test the PInvoke yourself (you didn't write it) so you want to test that the wrapper class is performing as expected right?</p>
<p>So, just create your interface in the wrapper class and test against that?</p>
<p>In terms of needing to set up users etc, I think that would be a bullet you need to bite. It would seem odd to mock a wrapper PInvoke call, since you would simply just confirm and interface exists :)</p>
| 7,689
|
<p>Some RepRap models use only a single motor for the Z axis, others use two.</p>
<p>For example, there is the <a href="http://reprap.org/wiki/3drag" rel="noreferrer">3drag</a> that has only one motor and a smooth rod on the other side. There are modifications that add a threaded rod on the other side that is connected to the motor axis with a belt - which seems to be a really good solution.</p>
<p>Other printers, like the <a href="http://reprap.org/wiki/Prusa_i3" rel="noreferrer">Prusa i3</a> or the Mendel90 have two Z motors. And after playing around with a two motor model, I find it pretty annoying when they get out of sync and I need to calibrate the axis and the print bed again. So two motors seem more like an disadvantage to me.</p>
<p>Could someone please shed some light on why most RepRaps have two Z motors (nowadays)?</p>
|
<p>There are three main options here for Mendel style ZX gantries:</p>
<ul>
<li>One Z screw and motor, which is similar to a cantilevered design but somewhat more stable because of the opposite smooth rod</li>
<li>Two Z screws and two motors</li>
<li>Two Z screws and one motor, with belt synchronization of the two sides</li>
</ul>
<p><strong>Of all of these, running two screws off one motor is clearly superior in reliability and user-friendliness.</strong> There is no risk of the two sides of the Z stage going out of sync. One motor running at higher current will generally out-perform two motors splitting one driver's current via parallel wiring, because one motor with twice the torque can push much harder when one side of the gantry binds up or hits a rough spot. </p>
<p>The only real downside to the single motor, double screw approach is that it requires more engineering and parts. A closed-loop timing belt must be run between the two screws, with associated pulleys, tensioner, and support bearings. In comparison, using a separate motor for each screw is very simple. It adds a stepper and a shaft coupler, but saves a lot of vitamins and design complexity.</p>
<p>Two-motor, two-screw solutions are lower-cost and simpler to design. That's why they're used. End of story.</p>
<p>One-motor, one-screw Mendel style printers are quite rare. The passive side of the Z mechanism does add a little bit of stability to the X stage, but not a lot. It's possible to rack the X stage out of square with the bed and bind up the gantry. In order to work at all, they require a very wide/tall bearing footprint on the driven side to resist torque exerted on the driven side by the weight of the X stage and extruder carriage. So it's true that they don't have synchronization issues, but additional design challenges and undesirable flexure modes are introduced. It's much more common for one-screw designs to simply cantilever out the X stage, like a SmartRap or Printrbot Simple. </p>
|
<p>The general concept is to provide additional stability during the print. In the case of the 3drag machine you mentioned, you could run the risk of the -X- axis sagging due to the weight of the print head and/or additional wear on the rod or bearings on the one side (smooth side) as a result of the off balance weight. However, you may find "hacks" like <a href="http://www.thingiverse.com/thing:538770" rel="nofollow">this</a> can potentially help reduce the affects by providing a bit more stability.</p>
<p>Having two -Z- axis motors with the threaded rods can help ensure stability of the -X- axis during print and can, overall, reduce wear on the mechanical components.</p>
| 218
|
<p>I've had the Ender 5 Pro, as is, for 3 months.</p>
<p>After I tried a cheap PLA filament (maybe too cheap), it clogged the nozzle. I cleaned it, but any other filament I have would have similar problems from then on. After some days doing test prints, it clogged again. This time, I heated it up to 240 ºC, I unscrew the nozzle, cleaned it up, chopped the Capricorn tube (it had clear symptoms of a previous tube not reaching the bottom of the hotend and leaking material around it), perfectly aligned, cleaned the heating block with a brass brush, started screwing the nozzle… and it never reaches the end. It even jiggles a little bit (by "jiggles", I mean that when the hotend is hot, you can push the nozzle back and forth, and it does move... like it was a joint, and not a threaded bolt), like it was too small for the block. I try screwing a new nozzle. Same happens.</p>
<p>To me it looks like the heating block thread broke, but I can't be sure. I tried a thicker nozzle (0.8 mm, but same thread in the end) and it worked. I could feed filament and it wouldn't look like clogged (at least for 15 cm of feeding filament, when in previous cases it was almost instantaneous).</p>
<p>Time to get a new heating block? Any recommendation?</p>
<p>Would another kind of heating block be better?</p>
<p>Edit: Here's a picture of the bottom of the heating block. Now it's clear there's a metal chip glued with material, and almost (if any) no thread at all.</p>
<p><a href="https://i.stack.imgur.com/gt8Cb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gt8Cb.jpg" alt="broken heating material"></a></p>
<p>Another question. Could it have been that cheap material that caused the clogging, or was it just a lack of proper maintenance?</p>
|
<p>Without images of the problem it is difficult to diagnose, but, the described symptoms sounds as if the nozzle is too close to the bed. If the nozzle is too close to the bed, and the extruder not strong enough, the filament flow is very limited due to pressure caused by a very small opening between the nozzle and the bed. Skipping of the extruder may wear out (grind) the filament and stop extrusion altogether.</p>
<p>Re-level the bed with a (thicker) piece of paper or with a feeler gauge. Alternatively, increase the height of the nozzle by re-defining the height or add an extra Z raise in the slicer (see question: "<a href="https://3dprinting.stackexchange.com/questions/13330/how-can-i-add-an-offset-to-the-first-layer-to-increase-clearance/13334">How can I add an offset to the first layer to increase clearance?</a>").</p>
|
<p>Clearly you're having an extrusion problem. Extrusion problems usually come either from a clogged nozzle (as @Adam S. said) or from the extruder it self. To determine where the problem is located I would first do a flow rate test using <a href="https://www.youtube.com/watch?v=lWBkPIXTOlo&feature=emb_logo" rel="nofollow noreferrer">this</a>. When doing this test you can determine if the extruder is grinding the filament or if it's not grabbing it too much. After the calibration of the flowrate you can be certain that the printer is (by .gcode) pushing the correct amount of filament. If the problem persist I would first do an unclogging (since it's cheaper than the following option) using something like <a href="https://www.youtube.com/watch?v=XR7tUVLku14" rel="nofollow noreferrer">this</a>. </p>
<p>If both previous options do not solve the problem, I would highly recommend you to by a mk-8 like metal extruder. After a while, the plastic one that comes with the printer loses force and you'll lose steps. Personally, I had a similar problem where the first layer was printed in a droplet pattern and was solved by changing the extruder to a metal one.</p>
<p>Try these options and if the problem persist you could upload some pictures of the first layer or a video. Other possibilities I think of are that the filament is having trouble passing through the Bowden tube or maybe you'll have to reasemble the hotend.</p>
| 1,660
|
<p>I'm writing a Perl script and would like to use a n-ary tree data structure.</p>
<p>Is there a good implementation that is available as source code (rather than part of a Perl library) ?</p>
|
<p>Adding to what Matthew already said, it looks like the following modules would be suitable:</p>
<p><a href="http://search.cpan.org/perldoc?Tree::Nary" rel="nofollow noreferrer">Tree::Nary</a><br>
<a href="http://search.cpan.org/perldoc?Tree::Simple" rel="nofollow noreferrer">Tree::Simple</a><br>
<a href="http://search.cpan.org/perldoc?Tree" rel="nofollow noreferrer">Tree</a></p>
|
<p>I don't really understand why you want it was "source" rather than as a perl library, but you can download the source for any CPAN module. </p>
<p>I haven't used it, but <a href="http://search.cpan.org/~rkinyon/Tree-1.01/lib/Tree.pm" rel="nofollow noreferrer">Tree</a> looks to fill your requirements.</p>
| 5,844
|
<p>I want to grab the value of a hidden input field in HTML.</p>
<pre><code><input type="hidden" name="fooId" value="12-3456789-1111111111" />
</code></pre>
<p>I want to write a regular expression in Python that will return the value of <code>fooId</code>, given that I know the line in the HTML follows the format</p>
<pre><code><input type="hidden" name="fooId" value="**[id is here]**" />
</code></pre>
<p>Can someone provide an example in Python to parse the HTML for the value?</p>
|
<p>For this particular case, BeautifulSoup is harder to write than a regex, but it is much more robust... I'm just contributing with the BeautifulSoup example, given that you already know which regexp to use :-)</p>
<pre><code>from BeautifulSoup import BeautifulSoup
#Or retrieve it from the web, etc.
html_data = open('/yourwebsite/page.html','r').read()
#Create the soup object from the HTML data
soup = BeautifulSoup(html_data)
fooId = soup.find('input',name='fooId',type='hidden') #Find the proper tag
value = fooId.attrs[2][1] #The value of the third attribute of the desired tag
#or index it directly via fooId['value']
</code></pre>
|
<pre><code>/<input type="hidden" name="fooId" value="([\d-]+)" \/>/
</code></pre>
| 7,914
|
<p>Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but I don't know why. Does anyone else know?</p>
<p>My question stems from the fact that with Mercurial you can adopt a working practice similar to that of Subversions/CVSs central repository and everything will work just fine. You can do multiple merges on the same branch and you won't need endless scraps of paper with commit numbers and tag names.</p>
<p>I know the latest version of Subversion has the ability to track merges to branches so you don't get quite the same degree of hassle but it was a huge and major development on their side and it still doesn't do everything the development team would like it to do.</p>
<p>There must be a fundamental difference in the way it all works.</p>
|
<blockquote>
<p>In Subversion (and CVS), the repository is first and foremost. In git
and mercurial there is not really the concept of a repository in the
same way; here changes are the central theme.</p>
</blockquote>
<p>+1</p>
<p>The hassle in CVS/SVN comes from the fact that these systems do <strong>not</strong>
remember the parenthood of changes. In Git and Mercurial,
not only can a commit have multiple children, it can also have multiple
parents!</p>
<p>That can easily observed using one of the graphical tools, <code>gitk</code> or <code>hg
view</code>. In the following example, branch #2 was forked from #1 at
commit A, and has since been merged once (at M, merged with commit B):</p>
<pre><code>o---A---o---B---o---C (branch #1)
\ \
o---o---M---X---? (branch #2)
</code></pre>
<p>Note how A and B have two children, whereas M has two <strong>parents</strong>. These
relationships are <em>recorded</em> in the repository. Let's say the maintainer of
branch #2 now wants to merge the latest changes from branch #1, they can
issue a command such as:</p>
<pre><code>$ git merge branch-1
</code></pre>
<p>and the tool will automatically know that the <em>base</em> is B--because it
was recorded in commit M, an ancestor of the tip of #2--and
that it has to merge whatever happened
between B and C. CVS does not record this information, nor did SVN prior to
version 1.5. In these systems, the graph
would look like:</p>
<pre><code>o---A---o---B---o---C (branch #1)
\
o---o---M---X---? (branch #2)
</code></pre>
<p>where M is just a gigantic "squashed" commit of everything that happened between A and B,
applied on top of M. Note that after the deed is done, there is <em>no trace
left</em> (except potentially in human-readable comments) of where M did
originate from, nor of <em>how many</em> commits were collapsed together--making
history much more impenetrable.</p>
<p>Worse still, performing a second merge becomes a nightmare: one has to figure out
what the merge base was at the time of the first merge (and one <em>has</em> to <em>know</em>
that there has been a merge in the first place!), then
present that information to the tool so that it does not try to replay A..B on
top of M. All of this is difficult enough when working in close collaboration, but is
simply impossible in a distributed environment.</p>
<p>A (related) problem is that there is no way to answer the question: "does X
contain B?" where B is a
potentially important bug fix. So, why not just record that information in the commit, since
it is <em>known</em> at merge time!</p>
<p>P.-S. -- I have no experience with SVN 1.5+ merge recording abilities, but the workflow seems to be much more
contrived than in the distributed systems. If that is indeed the case, it's probably because--as mentioned
in the above comment--the focus is put on repository organization rather than on the changes themselves.</p>
|
<p>I only have experience with Subversion but I can tell you that the merge screen in TortoiseSVN is horribly complicated. Luckily they include a dry run button so that you can see if you are doing it right. The complication is in the configuration of what you want to merge to where. Once you get that set up for the merge the merge generally goes fine. Then you need to resolve any and all conflicts and then commit your merged in working copy to the repository.</p>
<p>If Mercurial can make the configuration of the merge easier then I can say that would make merging 100% easier then Subversion.</p>
| 6,562
|
<p>I have two options - to buy either the Ender 3 or the Mega Zero. I'm heading towards Ender 3 because the Mega Zero doesn't have a heated bed. </p>
<p>My question is, how is a printer without a heated bed (the Mega Zero) a better option than one with a heated bed (the Ender 3)?</p>
<p>Why would I even consider buying a printer without a heated bed when the Ender 3 can do the same things <strong>and</strong> has a heated bed? I want be able to print not only PLA but other materials as well. Doesn't the Mega Zero limit you to using only PLA?</p>
|
<p>Lack of a heated bed does not necessarily limit you to using PLA. I would say (among those I've used) the material that's least sensitive to whether you have a heated bed is probably TPU. Depending on your model, it can even be hard to print PLA without a heated bed, unless perhaps you're willing to use a brim or raft. Printing ABS or ASA without a heated bed is almost certainly out of the question, and PETG <em>might</em> be possible, but I'd expect it to be difficult.</p>
<p>Mechanically, the Anycubic Mega Zero looks very similar to the Ender 3. The claimed bed size on the Mega Zero is slightly smaller (220 mm vs 235 mm) but they might just be counting the usable part.</p>
<p>The only possible objective advantage to the Mega Zero I could find is the double gear extruder, which may help with printing faster or flexible filaments.</p>
<p>Presumably you could add a heating element to the bed if you want.</p>
|
<p>Lack of a heated bed does not necessarily limit you to using PLA. I would say (among those I've used) the material that's least sensitive to whether you have a heated bed is probably TPU. Depending on your model, it can even be hard to print PLA without a heated bed, unless perhaps you're willing to use a brim or raft. Printing ABS or ASA without a heated bed is almost certainly out of the question, and PETG <em>might</em> be possible, but I'd expect it to be difficult.</p>
<p>Mechanically, the Anycubic Mega Zero looks very similar to the Ender 3. The claimed bed size on the Mega Zero is slightly smaller (220 mm vs 235 mm) but they might just be counting the usable part.</p>
<p>The only possible objective advantage to the Mega Zero I could find is the double gear extruder, which may help with printing faster or flexible filaments.</p>
<p>Presumably you could add a heating element to the bed if you want.</p>
| 1,635
|
<p>I have a sample held in a buffer from DirectX. It's a sample of a note played and captured from an instrument. How do I analyse the frequency of the sample (like a guitar tuner does)? I believe FFTs are involved, but I have no pointers to HOWTOs.</p>
|
<p>The FFT can help you figure out where the frequency is, but it can't tell you <em>exactly</em> what the frequency is. Each point in the FFT is a "bin" of frequencies, so if there's a peak in your FFT, all you know is that the frequency you want is somewhere within that bin, or range of frequencies.</p>
<p>If you want it really accurate, you need a long FFT with a high resolution and lots of bins (= lots of memory and lots of computation). You can also guess the true peak from a low-resolution FFT using <a href="https://ccrma.stanford.edu/%7Ejos/sasp/Quadratic_Interpolation_Spectral_Peaks.html" rel="nofollow noreferrer">quadratic interpolation</a> on the log-scaled spectrum, which works surprisingly well.</p>
<p>If computational cost is most important, you can try to get the signal into a form in which you can count zero crossings, and then the more you count, the more accurate your measurement.</p>
<p>None of these will work if the <a href="http://en.wikipedia.org/wiki/Missing_fundamental" rel="nofollow noreferrer">fundamental is missing</a>, though. :)</p>
<p>I've outlined a few different algorithms <a href="https://gist.github.com/endolith/255291" rel="nofollow noreferrer">here</a>, and the interpolated FFT is usually the most accurate (though this only works <a href="https://www.flickr.com/photos/omegatron/4180172061/" rel="nofollow noreferrer">when the fundamental is the strongest harmonic</a> - otherwise you need to be smarter about finding it), with zero-crossings a close second (though this only works <a href="https://www.flickr.com/photos/omegatron/4180888094/" rel="nofollow noreferrer">for waveforms with one crossing per cycle</a>). Neither of these conditions is typical.</p>
<p>Keep in mind that the partials above the fundamental frequency are <strong>not</strong> perfect harmonics in many instruments, like piano or guitar. Each partial is <a href="https://www.flickr.com/photos/omegatron/4166565758/" rel="nofollow noreferrer">actually a little bit out of tune</a>, or <a href="http://en.wikipedia.org/wiki/Inharmonicity" rel="nofollow noreferrer"><em>inharmonic</em></a>. So the higher-frequency peaks in the FFT will not be exactly on the integer multiples of the fundamental, and the wave shape will change slightly from one cycle to the next, which throws off autocorrelation.</p>
<p>To get a really accurate frequency reading, I'd say to use the autocorrelation to guess the fundamental, then find the true peak using quadratic interpolation. (You can do the autocorrelation in the frequency domain to save CPU cycles.) There are a lot of gotchas, and the right method to use really depends on your application.</p>
|
<p>Apply a <a href="http://en.wikipedia.org/wiki/Discrete_Fourier_transform" rel="nofollow noreferrer">DFT</a> and then derive the fundamental frequency from the results. Googling around for DFT information will give you the information you need -- I'd link you to some, but they differ greatly in expectations of math knowledge.</p>
<p>Good luck.</p>
| 9,104
|
<p>I'm looking to replace a couple of machines in the office with a more powerful multi-processor machine running either VMware or Microsoft's Hyper-V with a view to hosting a mix of Windows Server 2003, Windows Server 2008 and Linux operating systems. The machines are used mainly for testing ASP.Net or Perl web sites. I don't need advanced features like live migration of running systems but it would be useful to be able to restore a machine to a known state. Performance is not really a big issue either unless one is noticeable faster than the other.</p>
<p>My question is: Should I play safe and go with VMware or is Hyper-V mature enough to be a candidate?</p>
|
<p>VMware did recently release a free version of ESXi recently.</p>
<p>VMware has a few advantages:<br>
1. VMware virtual machines are portable across different types of hardware. IIRC, Hyper-V uses the drivers from the Host OS.<br>
2. VMware virtual machines are portable across different VMware products (although you may need to use their converter tool to go from some hosted virtual machines to ESX or ESXi).<br>
3. The VMware platforms have been in use much longer, and are quite mature products and generally better-known for troubleshooting.</p>
<p>With VMware, you could develop and test a virtual machine on your local system using VMware Workstation, Fusion, Server, or Player, and then deploy it to a production server later. With Hyper-V, I believe you would have to build the virtual machine on the target box for best results. If performance isn't really that big of an issue, then VMware Server may be the best option, for it can run most .vmx machines directly and is generally a bit easier to manage; if performance becomes critical, you still have the ESX or ESXi upgrade option that you can use those same virtual machines with.</p>
<p>This entry talks about how Virtual Server machines will not run on Hyper-V:<br>
<a href="http://blogs.technet.com/jhoward/archive/2008/02/28/are-vhds-compatible-between-hyper-v-and-virtual-server-and-virtual-pc.aspx" rel="noreferrer">http://blogs.technet.com/jhoward/archive/2008/02/28/are-vhds-compatible-between-hyper-v-and-virtual-server-and-virtual-pc.aspx</a></p>
|
<p><em>Necros the thread</em> Just wanted to add my 2c since the last post has been a while.</p>
<p>I have been using VMWare Server since version 1.6 all the way up to 2.0.</p>
<p>Just out of curiosity, I tried out Hyper-V, and there's a real definitive performance gain. Hyper-V is plain faster.</p>
<p>Switched over 2 months ago and never looked back.</p>
| 5,923
|
<p>Recently I have started using a fairly large LCD resin printer. (Yidimu Falcon Pro)
It has a fairly large 260x160mm perforated and coated steel build plate and a decent dual rail Z axis with a ballscrew. It has a 10" LCD. It prints ChiTuBox files from a USB stick.</p>
<p>I have been having a mostly successful print, at good quality, but the bed adhesion keeps haunting me. The best print on this machine had parts curling up from the build plate, however most of the print succeeded.</p>
<ul>
<li><p>Two times I have had a very well adhering raft, however delamination occured directly after the raft.</p></li>
<li><p>Usually the left side lifts from the bed while the model stays on the build plate.</p></li>
</ul>
<p>I have tried:</p>
<p>Changing resin (tried Druckwerk Pro D Black and Anycubic Black)</p>
<ul>
<li>Decreasing lift speed</li>
<li>Increasing lift distance</li>
<li>Increasing bottom layer exposure time (from 60 to 180, as suggested by Druckwerck supplier)</li>
<li>Increasing bottom layer count to 9</li>
<li>Using a large raft</li>
<li>Using a very large raft</li>
<li>Using a very small raft</li>
<li>Leveling build plate without vat in place, using paper</li>
<li>Leveling build plate while keeping vat in place</li>
</ul>
<p>What would be a good next troubleshooting step?</p>
<p><a href="https://i.stack.imgur.com/VpZWt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VpZWt.png" alt="first layer with small raft"></a></p>
<p><a href="https://i.stack.imgur.com/rRWtS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rRWtS.png" alt="first layer with large raft"></a>
<a href="https://i.stack.imgur.com/CtYl8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CtYl8.jpg" alt="model peeling off of print bed"></a></p>
|
<p>looks like you have done a lot of work to try to get it working.</p>
<p>considering you are having issues on one side of the build plate my thought is that it is a levelling issue or an issue with the plate itself. Try levelling it using the video <a href="https://www.youtube.com/watch?v=K4G6ExEtk70" rel="nofollow noreferrer">"Getting Started: Leveling the Build Plate"</a> it's for a different printer but pay attention to the part where he goes over making sure the left and right sides are level and how to check that. I had a problem like yours, and the issue was that as I tightened the screw to keep the build plate in the levelled position I ended up causing it to move. I made the same mistake a few times before realizing that I was messing it up the same way every time because I'm right-handed. after realizing that it was easier to fix.</p>
<p>If the issue is the build plate it's self it may be a matter of it not being flat (unlikely), Or not providing a good bonding surface. if the latter I suggest you do some research and decide for yourself as there are a lot of dividing views on how to fix that issue.</p>
<p>It also looks like you are having issues with the print after the bottom layers. It could be caused but the separation issue but it could be that you just need to increase your exposure time for your non-bottom layers</p>
|
<p>I had an issue with my Vat Bolts, one being cracked and leveling at a greater tension than the other. With the compressible feet of my Vat this caused a problem in the FEP. This was enough to cause failure on one side more than the other. Cause was verified by switching the left and right knobs, thus shifting the failures to the opposite side of the print.</p>
<p>Just a thought.</p>
| 1,677
|
<p>I am having some trouble with model adherence to my print bed. As shown in the attached photo, my model is pulled away at the sides leaving it bowed even though it is designed to be flat. Other than this "bowing", the model is of good quality.</p>
<p>The model is printed solid on an Anycubic Photon M3 Plus with Anycubic 3D Printing UV Sensitive Resin. My print settings are:</p>
<ul>
<li>Bottom layer count: 6</li>
<li>Bottom layer exposure: 22 secs (also tried 30 secs and 40 secs with the same results)</li>
<li>Normal layer height: 0.05 mm</li>
<li>Normal layer exposure: 2.5 secs</li>
<li>Off time: 0.5 secs</li>
<li>Z lift height: 6 mm</li>
<li>Z lift speed : 360 mm/sec</li>
<li>Z lift retract: 6 mm</li>
</ul>
<p>The bed is aligned. Could anyone suggest what is wrong and what I could try to remove this "bowing" effect?</p>
<p><a href="https://i.stack.imgur.com/VmF9H.jpg" rel="nofollow noreferrer" title="Resin printed model with a bowing effect"><img src="https://i.stack.imgur.com/VmF9H.jpg" alt="Resin printed model with a bowing effect" title="Resin printed model with a bowing effect" /></a></p>
|
<h2>Print orientation</h2>
<p>Your model is pulled up from the FEP film with a huge force. It releases from the film first at the corners, then progresses to the center. The force bends the model down as it is still flexible, so it creates a bent item.</p>
<p>This can be mitigated by reducing the area that you pull at. Commonly, you'll turn the item so the area is minimized, and you also might want to angle the item. This will cost some material in support structure, but you reduce the force on the part that can deform it in printing.</p>
|
<h2>Print orientation</h2>
<p>Your model is pulled up from the FEP film with a huge force. It releases from the film first at the corners, then progresses to the center. The force bends the model down as it is still flexible, so it creates a bent item.</p>
<p>This can be mitigated by reducing the area that you pull at. Commonly, you'll turn the item so the area is minimized, and you also might want to angle the item. This will cost some material in support structure, but you reduce the force on the part that can deform it in printing.</p>
| 2,204
|
<p>I have built a 3D printer from parts. It is using a standard 12V power supply, an Arduino Mega 2560 replica and a RAMPS 1.4 board. The hotend cooling fan is connected to the 12V-AUX pin (the one right next to the x axis stepper driver) on the RAMPS board so that it continuously receives power as long as the machine is turned on. The printer is controlled by the Marlin firmware.</p>
<p>When I give power to the board, the cooling fan starts spinning with a lot of noise. It sounds like it is receiving a higher amount of current than it should. Moreover, the noise is not steady, but fluctuates slightly. After about 30 seconds, it gets slightly quieter; after about 40-50 seconds, there is a sudden break. From then on, the fan spins quietly and regularly.</p>
<p>According to measurements with a multimeter, the power supply is keeping a constant and correct voltage of slightly over 12V right from the beginning. Hence, I suspect the issue is somewhere on the RAMPS board.</p>
<p>I am worried about this being more than a problem of unpleasant noisiness. What could be the cause and is there more to worry about?</p>
<p>You can listen to a recording of the sound: <a href="https://soundcloud.com/user-769347820/3d-printer-hotend-cooling-fan-noise/s-OizCr" rel="nofollow noreferrer">3D printer hotend cooling fan noise</a></p>
<p>Note that I am not talking about a fan for cooling the extruded plastic, but the one sitting on the extruder heatsink.</p>
<hr>
<p>Shutting down the printer (even literally unplugging the power supply) and plugging it back in does not lead to the startup noise appearing again. Only when waiting for multiple minutes before reconnecting does it happen again.</p>
<p>The voltage to the fan is measured to be constant. The current, on the other hand, correlates with the sounds heard. It starts at 110 - 115 mA. When the fan is quiet, it is at about 90 mA.</p>
|
<p>Now that you have done some measurements, you could make some conclusions.</p>
<blockquote>
<p>The voltage over the fan is reported to be constant, but the current
starts at 110-115 mA and reduces to 90 mA over time.</p>
</blockquote>
<p>With limited knowledge of electronics you can conclude that the resistance of the fan is not constant as the resistance determines the amount of current through the fan. So the fan resistance increases over time. This could just be a manufacturing problem or characteristics of the fan. You could try to replace the fan with another fan to see if this fixes your problem.</p>
|
<p>I propose examining the current voltage of the motor and the arm. The fluctuation of voltage causes the noise.</p>
| 962
|
<p>How do I ask PowerShell where something is? </p>
<p>For instance, "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.</p>
|
<p>The very first alias I made once I started customizing my profile in PowerShell was 'which'.</p>
<pre class="lang-sh prettyprint-override"><code>New-Alias which get-command
</code></pre>
<p>To add this to your profile, type this:</p>
<pre class="lang-sh prettyprint-override"><code>"`nNew-Alias which get-command" | add-content $profile
</code></pre>
<p>The `n at the start of the last line is to ensure it will start as a new line.</p>
|
<p>There also always the option of using which. there are actually three ways to access which from Windows powershell</p>
<ul>
<li>The first, (though not the best) is wsl(windows subsystem for linux)</li>
</ul>
<pre class="lang-sh prettyprint-override"><code>wsl -e which command
</code></pre>
<p>This requires installation of windows subsystem for Linux and a running distro.</p>
<ul>
<li><p>Next is <a href="http://gnuwin32.sourceforge.net/packages.html" rel="nofollow noreferrer">gnuwin32</a> which is a port of several gnu binaries in .exe format as standle alone bundled lanunchers</p>
</li>
<li><p>Third, install <a href="https://www.msys2.org/" rel="nofollow noreferrer">msys2</a> (cross compiler platform) if you go where it installed in /usr/bin you'll find many many gnu utils that are more up-to-date. most of them work as stand alone exe and can be copied from the bin folder to your home drive somewhere amd added to your PATH.</p>
</li>
</ul>
| 8,927
|
<p>I recently saw <a href="https://www.youtube.com/watch?v=TpvNEZCvk84" rel="noreferrer">this</a> video of super-swellable polymer and felt inspired. Printing a swellable structure would be sort of interesting. However, sodium polyacrylate isn't a printable material. Does anyone know of a material that is? Preferably, swelling activated by water. </p>
|
<p>To print with 2 extruders simultaneously you need a firmware that supports that. Luckily, there is a firmware called Sailfish that is able to do that. The feature you are looking for is called <code>Ditto</code> printing.</p>
<p>Sailfish firmware is found <a href="http://www.sailfishfirmware.com" rel="nofollow noreferrer">here</a></p>
|
<p>If you want a ditto printing is not mandatory to have a specific firmware (or g-code), you only need to add extruder to your end effector and - because of electrical power requirements - add further stepper driver for further stepper motor.
Please note that the maximum footprint of your printed object is less than the extruders distance, for obvious physical reasons, therefore is not that common to see, the typical dual extruder goal is to use different filament/color.
Of course, you have to achieve a notable calibration skill, and of course you have to modify the electronics of your printer (but this can be done quite easily, you only have to share the enable/step/dir signals with all the stepper driver).
This has been already done with the <a href="https://www.youtube.com/watch?time_continue=5&v=DeVeyUas5vU" rel="nofollow noreferrer">MPCNC project</a>.</p>
<p>Otherwise, if you want something more flexible, there are commercial printers with independent extruder. <a href="https://www.lpfrg.com/en/benefits-of-independent-dual-extruders/" rel="nofollow noreferrer">This one, for example</a></p>
<p>Edit: i can't comment your answer yet, but can you describe your current 3d printer setup? Because if you have the two hot ends that are only few mm apart it makes little sense to ditto-print something.</p>
| 913
|
<p>Technical Debt <a href="http://www.martinfowler.com/bliki/TechnicalDebt.html" rel="noreferrer">via Martin Fowler</a>, <a href="http://forums.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx" rel="noreferrer">via Steve McConnell</a></p>
<p>YAGNI (You Ain't Gonna Need It) <a href="http://en.wikipedia.org/wiki/You_Ain%27t_Gonna_Need_It" rel="noreferrer">via Wikipedia</a></p>
<p>BDUF (Big Design Up Front) <a href="http://en.wikipedia.org/wiki/BDUF" rel="noreferrer">via Wikipedia</a></p>
<p>UPDATE: To clarify the question, I think I can also state it this way and keep my meaning:</p>
<p><em>"In what ways do you, as an Agile practioner, find the right balance between "quick and dirty" (unintentionally risking Technical Debt while attempting to adhere to YAGNI) and over-engineering (BDUF) <strong>within</strong> each iteration?"</em></p>
|
<p>There was an interesting discussion of Technical Debt based on your definition of done on HanselMinutes a couple of weeks ago -- <a href="http://www.hanselminutes.com/default.aspx?showID=137" rel="nofollow noreferrer">What is Done</a>. The basics of the show were that if you re-define 'Done' to increase perceived velocity, then you will amass Technical Debt. The corollary of this is that if you do not have a proper definition of 'Done' then you most likely are acquiring a list of items that will need to be finished before release irrespective of the design methodology.</p>
|
<p>That's why it's always easier to write nice "acadamic papers" talking about how Agile development is good, what are the "best practices" and so on.</p>
<p>That's why you find a lot of "suited engineers" making up new software engineering techniques.</p>
<p>Process is important, keeping best practices is cool but over any other thing, common sense drive design process. Software is developed by people so YAGNI really should be: </p>
<p>I might not gonna needed but maybe I will because in my concrete bussiness/company/department this thing do happen or I will need it but I just haven't the time right no so quick and dirty hack to make the cash and keep my job, or I might need it and refactoring later will be a pain in the ass costing 10 times more than just doing it now from the scratch, and I have the time NOW.</p>
<p>So use your common sense, trust it or trust the common sense of the people working for you. Don't take every academic paper as proven fact, experience is the best teacher and your company should improve their way or making things with time and its own experience.</p>
<p><strong>Edit:</strong> Incidentally, TDD is the opposite of YAGNI you're building test before even knowing if you are gonna need them. Seriously, stop listening to academics!! There's no magical way to produce software.</p>
| 8,595
|
<p>I need to cool some liquid (250 °C) while it’s flowing through a tube which has to be able to bend and flex.
My idea is to make a flexible tube with a second tube spiraling around it through which coolant will flow.</p>
<p>I’d like to 3D print this tube if possible so I wonder if there is some printable filament that:</p>
<ul>
<li>doesn’t melt at 250 °C</li>
<li>is flexible enough that it can print some tube that can bend (bending radius of 30 cm)</li>
<li>optimally also has good heat conductivity</li>
</ul>
<p>Is there any 3D printer filament available that has these properties?</p>
|
<p>Ok, so to answer the primary question: What flexible filament will operate consistently at 250 °C?</p>
<p>Man, this is a tough one. Some filaments, like PEEK and ULTEM 1010 can operate up in the 200 °C range, but they're not flexible at all.</p>
<p>Silicon might be able to work, but you're still pushing boundaries.</p>
<p>Now, I'm lucky to be in a 3D printing company and we're testing a super-high-temp flexible material, very similar in temperatures to ULTEM. I'll definitely check back and let you know how it goes, but...</p>
<p>Honestly, that's so hot! Readily available thermoplastics may not be an option unless you're in aerospace with an unlimited budget which, based on the requirements, would make sense, lol!</p>
<p>I'd say the most readily available way to get this done would be 3D printing a mold, in which to put your silicone, and bam -- you've got the part.</p>
|
<p>3D printing nerd showed a couple of filaments that fits this in his latest video "Printers at RAPID + TCT 2019":</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/obCgJQp5Yj8?start=0"></iframe>
</div></div></p>
<p>Firstly a <a href="https://www.youtube.com/watch?v=obCgJQp5Yj8&t=35" rel="nofollow noreferrer">Nylon 6 high temperature filament</a>:</p>
<p><a href="https://i.stack.imgur.com/x7lo5.jpg" rel="nofollow noreferrer" title="Flexible 3D printed part - printed from high temperature nylon"><img src="https://i.stack.imgur.com/x7lo5.jpg" alt="Flexible 3D printed part - printed from high temperature nylon" title="Flexible 3D printed part - printed from high temperature nylon"></a> </p>
<p>Another part of the video shows another flexible print, created on a four axis 3D printer, using <a href="https://www.youtube.com/watch?v=obCgJQp5Yj8&t=987" rel="nofollow noreferrer">TPU filament</a>:</p>
<p><a href="https://i.stack.imgur.com/Wrgxm.png" rel="nofollow noreferrer" title="Flexible 3D printed part - printed from TPU"><img src="https://i.stack.imgur.com/Wrgxm.png" alt="Flexible 3D printed part - printed from TPU" title="Flexible 3D printed part - printed from TPU"></a></p>
| 1,338
|
<p>We have a PHP project that we would like to version control. Right now there are three of us working on a development version of the project which resides in an external folder to which all of our Eclipse IDEs are linked, and thus no version control.</p>
<p>What is the right way and the best way to version control this?</p>
<p>We have an SVN set up, but we just need to find a good way to check in and out that allows us to test on the development server. Any ideas?</p>
|
<p>We were in a similar situation, and here's what we ended up doing:</p>
<ul>
<li>Set up two branches -- the release and development branch.</li>
<li>For the development branch, include a post-commit hook that deploys the repository to the dev server, so you can test.</li>
<li>Once you're ready, you merge your changes into the release branch. I'd also suggest putting in a post-commit hook for deployment there.</li>
</ul>
<p>You can also set up individual development servers for each of the team members, on their workstations. I find that it speeds things up a bit, although you do have some more setup time.</p>
<p>We had to use a single development server, because we were using a proprietary CMS and ran into licensing issues. So our post-commit hook was a simple FTP bot.</p>
|
<p>Each of you could run it locally, or on your own dev server (or even the same one with a different port...).</p>
| 2,694
|
<p>Here's a quick question I've been banging my head against today.</p>
<p>I'm trying to convert a .Net dataset into an XML stream, transform it with an xsl file in memory, then output the result to a new XML file. </p>
<p>Here's the current solution:</p>
<pre><code> string transformXML = @"pathToXslDocument";
XmlDocument originalXml = new XmlDocument();
XmlDocument transformedXml = new XmlDocument();
XslCompiledTransform transformer = new XslCompiledTransform();
DataSet ds = new DataSet();
string filepath;
originalXml.LoadXml(ds.GetXml()); //data loaded prior
StringBuilder sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb);
transformer.Load(transformXML);
transformer.Transform(originalXml, writer); //no need to select the node
transformedXml.LoadXml(sb.ToString());
transformedXml.Save(filepath);
writer.Close();
</code></pre>
<p>Here's the original code:</p>
<pre><code>BufferedStream stream = new BufferedStream(new MemoryStream());
DataSet ds = new DataSet();
da.Fill(ds);
ds.WriteXml(stream);
StreamReader sr = new StreamReader(stream, true);
stream.Position = 0; //I'm not certain if this is necessary, but for the StreamReader to read the text the position must be reset.
XmlReader reader = XmlReader.Create(sr, null); //Problem is created here, the XmlReader is created with none of the data from the StreamReader
XslCompiledTransform transformer = new XslCompiledTransform();
transformer.Load(@"<path to xsl file>");
transformer.Transform(reader, null, writer); //Exception is thrown here, though the problem originates from the XmlReader.Create(sr, null)
</code></pre>
<p>For some reason in the transformer.Transform method, the reader has no root node, in fact the reader isn't reading anything from the StreamReader.</p>
<p>My questions is what is wrong with this code? Secondarily, is there a better way to convert/transform/store a dataset into XML?</p>
<p>Edit: Both answers were helpful and technically aku's was closer. However I am leaning towards a solution that more closely resembles Longhorn's after trying both solutions.</p>
|
<p>I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it.</p>
<p><strong>EDIT</strong>:</p>
<p>Just tried following code and it worked perfectly:</p>
<pre><code> BufferedStream stream = new BufferedStream(new MemoryStream());
stream.Write(Encoding.ASCII.GetBytes("<xml>foo</xml>"), 0, "<xml>foo</xml>".Length);
stream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(stream);
XmlReader reader = XmlReader.Create(sr);
while (reader.Read())
{
Console.WriteLine(reader.Value);
}
stream.Close();
</code></pre>
|
<p>please look it and use..</p>
<pre><code>using (MemoryStream memStream = new MemoryStream())
{
memStream.Write(Encoding.UTF8.GetBytes(xmlBody), 0, xmlBody.Length);
memStream.Seek(0, SeekOrigin.Begin);
using (StreamReader reader = new StreamReader(memStream))
{
// xml reader setting.
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings()
{
IgnoreComments = true,
IgnoreWhitespace = true,
};
// xml reader create.
using (XmlReader xmlReader = XmlReader.Create(reader, xmlReaderSettings))
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(LoginInfo));
myObject = (LoginInfo)xmlSerializer.Deserialize(xmlReader);
}
}
}
</code></pre>
| 6,228
|
<p>Should the folders in a solution match the namespace?</p>
<p>In one of my teams projects, we have a class library that has many sub-folders in the project.</p>
<p>Project Name and Namespace: <code>MyCompany.Project.Section</code>.</p>
<p>Within this project, there are several folders that match the namespace section:</p>
<ul>
<li>Folder <code>Vehicles</code> has classes in the <code>MyCompany.Project.Section.Vehicles</code> namespace</li>
<li>Folder <code>Clothing</code> has classes in the<code>MyCompany.Project.Section.Clothing</code> namespace</li>
<li>etc.</li>
</ul>
<p>Inside this same project, is another rogue folder</p>
<ul>
<li>Folder <code>BusinessObjects</code> has classes in the <code>MyCompany.Project.Section</code> namespace</li>
</ul>
<p>There are a few cases like this where folders are made for "organizational convenience".</p>
<p>My question is: What's the standard? In class libraries do the folders usually match the namespace structure or is it a mixed bag?</p>
|
<p>Also, note that if you use the built-in templates to add classes to a folder, it will by default be put in a namespace that reflects the folder hierarchy.</p>
<p>The classes will be easier to find and that alone should be reasons good enough.</p>
<p>The rules we follow are:</p>
<ul>
<li>Project/assembly name is the same as the root namespace, except for the .dll ending</li>
<li>Only exception to the above rule is a project with a .Core ending, the .Core is stripped off</li>
<li>Folders equals namespaces</li>
<li>One type per file (class, struct, enum, delegate, etc.) makes it easy to find the right file</li>
</ul>
|
<blockquote>
<p>What's the standard?</p>
</blockquote>
<p>There is no official standard but conventionally the folder-to-namespace mapping pattern is most widely used.</p>
<blockquote>
<p>In class libraries do the folders usually match the namespace
structure or is it a mixed bag?</p>
</blockquote>
<p>Yes, in most class libraries the folders match the namespace for organizational ease.</p>
| 2,667
|
<p>Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better, or not all problems should be modeled as objects. From your personal programming adventures, when do you think a problem is better solved by OOP?</p>
|
<p>There is no hard and fast rule. A problem is better solved with OOP when you are better at solving problems and thinking in an OO mentality. Object Orientation is just another tool which has come along through trying to make computing a better tool for solving problems. </p>
<p>However, it can allow for better code reuse, and can also lead to neater code. But quite often these highly praised qualities are, in-relity, of little real value. Applying OO techniques to an existing functional application could really cause a lot of problems. The skill lies in learning many different techniques and applying the most appropriate to the problem at hand.</p>
<p>OO is often quoted as a Nirvana-like solution to the software development, however there are many times when it is not appropriate to be applied to the issue at hand. It can, quite often, lead to over-engineering of a problem to reach the perfect solution, when often it is really not necessary.</p>
<p>In essence, OOP is not really Object Oriented Programming, but mapping Object Oriented Thinking to a programming language capable of supporting OO Techniques. OO techniques can be supported by languages which are not inherently OO, and there are techniques you can use within functional languages to take advantage of the benefits.</p>
<p>As an example, I have been developing OO software for about 20 years now, so I tend to think in OO terms when solving problems, irrespective of the language I am writing in. Currently I am implementing polymorphism using Perl 5.6, which does not natively support it. I have chosen to do this as it will make maintenance and extension of the code a simple configuration task, rather than a development issue.</p>
<p>Not sure if this is clear. There are people who are hard in the OO court, and there are people who are hard in the Functional court. And then there are people who have tried both and try to take the best from each. Neither is perfect, but both have some very good traits that you can utilise no matter what the language.</p>
<p>If you are trying to learn OOP, don't just concentrate on OOP, but try to utilise Object Oriented Analysis and general OO principles to the whole spectrum of the problem solution.</p>
|
<p>I tell you when OOP is bad. </p>
<p>When the architect writes really complicated, non-documented OOP code. Leaves half way through the project. And many of his common code pieces he used across various project has missing code. Thank god for .NET Reflector.</p>
<p>And the organization was not running Visual Source Safe or Subversion.</p>
<p>And I'm sorry. 2 pages of code to login is rather ridiculous even if it is cutely OOPed.... </p>
| 2,843
|
<p>Every time I write "Cura" in a question or answer, it gets edited to "Ultimaker Cura", <a href="https://3dprinting.stackexchange.com/a/10940/11157">most recently</a> resulting in awkward verbose repetition that required additional edits to fix. I don't see any justification for requiring use of official verbose names for software products that can be clearly identified by a well-known shorter name. For example on computing SE sites we don't force users to write "Microsoft Windows" or "Redhat Linux" in contexts where "Windows" or "Redhat" would be understood. And even on this site I don't recall every mention of "Ender 3" getting edited into "Creality Ender 3".</p>
<p>Is such a policy (it's effectively a policy, since it's enforced by edits made by a moderator) appropriate for this site?</p>
<p>For what it's worth, as a new-ish contributor to this SE site, having nitpicky edits to all of my posts does not make me feel welcome and appreciated.</p>
|
<h1>Laundry list:</h1>
<h2>Open</h2>
<ul>
<li><a href="https://3dprinting.meta.stackexchange.com/a/438">e3d</a></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/436">Creality</a></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/434">Filled PLA</a></li>
</ul>
<h2>Done</h2>
<ul>
<li><a href="https://3dprinting.meta.stackexchange.com/a/431">Anet</a></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/435">Flashforge</a></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/432">Ultimaker</a>
<ul>
<li><a href="https://3dprinting.meta.stackexchange.com/a/437">Ultimaker 1</a></li>
</ul></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/433">Cura</a></li>
<li><a href="https://3dprinting.meta.stackexchange.com/a/445">Monoprice</a></li>
</ul>
|
<h1>Manufacturer: Monoprice</h1>
<p>Status: <strong>Done</strong></p>
<p>This tag (<a href="https://3dprinting.stackexchange.com/questions/tagged/monprice" class="post-tag" title="show questions tagged 'monprice'" rel="tag">monprice</a>) is used for tagging questions regarding various printer types while the tag itself is the manufacturer. In analogy to the other printer tags and types these should be re-tagged with the proper printer types.</p>
<p>The tag appears to be used 52 times, of which 27 times used this year. Printers that are tagged under the <a href="https://3dprinting.stackexchange.com/questions/tagged/monoprice" class="post-tag" title="show questions tagged 'monoprice'" rel="tag">monoprice</a> manufacturer tag are:</p>
<ul>
<li>Monoprice Architect</li>
<li>Monoprice Select Mini (v1/v2)</li>
<li>Monoprice Maker Select</li>
<li>Monoprice Maker Select Plus</li>
<li>Monoprice Maker Ultimate</li>
<li>Monoprice Mini Delta</li>
<li>Monoprice Dual Extrusion</li>
</ul>
| 71
|
<p>I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My initial target platform, Blackberry, limits each to 64KB.</p>
<p>I'm wondering if anyone else has had to tackle the problem of storing a large amount of data in the RMS and how they managed it? I'm thinking of having to calculate record sizes and split one data set accross multiple stores if its too large, but that adds a lot of complexity to keep it intact.</p>
<p>There is lots of different types of data being stored but only one set in particular will exceed the 64KB limit.</p>
|
<p>For anything past a few kilobytes you need to use either JSR 75 or a remote server. RMS records are extremely limited in size and speed, even in some higher end handsets. If you need to juggle 1MB of data in J2ME the only reliable, portable way is to store it on the network. The HttpConnection class and the GET and POST methods are always supported.</p>
<p>On the handsets that support JSR 75 FileConnection it may be valid alternative but without code signing it is an user experience nightmare. Almost every single API call will invoke a security prompt with no blanket permission choice. Companies that deploy apps with JSR 75 usually need half a dozen binaries for every port just to cover a small part of the possible certificates. And this is just for the manufacturer certificates; some handsets only have carrier-locked certificates.</p>
|
<p>I'm just starting to code for JavaME, but have experience with old versions of PalmOS, where all data chunks are limited in size, requiring the design of data structures using record indexes and offsets.</p>
| 3,951
|
<p>I'm new to 3D Printing and recently purchased an Ender 3D PRO I'm having an issue with the filament guide tube getting pushed out of the nozzle on the feeding mechanism. The assembly instructions don't include a whole lot of detail about installing this guide tube but there are blue clips that were included along with the spare nozzle. There are no instructions on where to use these blue clips and I have a hunch this might be the problem. </p>
|
<p>The blue clips stick in the connector on the extruder end of the feed tube. They are to keep it from opening as the printer extrudes and retracts filament.</p>
<p>To install them, push them in between the white part of the fitting on the feed tube (not the hot end). You should only need one or two, and they are all of varying thicknesses. If you're not familiar with these fittings, I found a <a href="https://www.youtube.com/watch?v=6BummHzgf5c" rel="nofollow noreferrer">YouTube video</a> on how to use them.</p>
<p><a href="https://i.stack.imgur.com/JsuQ4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JsuQ4.jpg" alt="Fitting clips on a Creality Ender-3 feed tube"></a></p>
|
<p>The clips or collet clips as they are called are to secure the Bowden tube more solidly to improve printer extrusion; more specifically: extruder retraction performance.</p>
<p>E3D has explained this very nicely on their site under <a href="https://e3d-online.com/blog/2017/10/27/bowden-tube-physics/" rel="nofollow noreferrer">Bowden tube physics</a>:</p>
<blockquote>
<p>For the bowden couplings (which can have some wiggle room in them) we are introducing collet clips, which slide under the toothed collet part of the coupling that physically holds the tube and locks it into place with a little pre-tension to boot. This reduces coupling lash to near zero as the collet and tube it is holding are locked into place.</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/YobdM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YobdM.png" alt="Bowden collet clips principle"></a></p>
<p>From the <a href="https://i.imgur.com/RTWnzB5.gif" rel="nofollow noreferrer">animated gif from the E3D website</a> (animated gifs are not allowed on SE) it can be seen that without clips, the tube can move in the tube coupling:
<a href="https://i.stack.imgur.com/YfzfWm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YfzfWm.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/2OpuTm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2OpuTm.png" alt="enter image description here"></a></p>
| 1,624
|
<p>I've kept up to date with new features in the C# language as it's moved from version 1 through version 3. I haven't done such a good job keeping up to date with ASP.NET. I feel like some of the post version 1 features are not so good (e.g. the AJAX framework) or are just not that useful to me (e.g. the membership framework). Can anyone recommend any new killer ASP.NET features that might have gone unnoticed?</p>
|
<p>For ASP.NET, you have a lot of improvements:</p>
<ul>
<li>split view (code and design)</li>
<li>faster switching between code and design view</li>
<li>embedded master pages (one master page in another)</li>
<li>javascript debugging</li>
</ul>
<p>Anyway most of the useful stuff are really in the meat of the language, and for .NET 3.5 the new language features for C# 3.0 will be (and yes, I find ALL of them useful)</p>
<ul>
<li>anonymous objects</li>
<li>automatic properties</li>
<li>object initializers</li>
<li>collection initializers (inline initialization for collections)</li>
<li>implicit typing (var keyword)</li>
<li>lambda expressions</li>
<li>LINQ</li>
<li>Extension methods</li>
</ul>
<p>I might have forgotten a few, but I think this is about most of the new cool <em>and</em> useful stuff.</p>
|
<p>I don't think the MVC Framework is quite ready for prime time yet, though I definitely plan to use it sometime next year. I love the clean URLs, clean XHTML (web forms can really spew out some nasty HTML) and the ability to create controller actions with no associated view.</p>
<p>I've been using Master Pages since they were released and they've been a big help. I do really dislike the way the master pages add the nasty prefixes to the control IDs. It makes for some ugly CSS. I think the MVC Framework may eliminate this problem though.</p>
<p>Any other killer features?</p>
| 3,147
|
<p>I have a "watcher" module that is currently using global hierarchies inside it. I need to instantiate a second instance of this with a second global hierarchy.</p>
<p>Currently:</p>
<pre><code>module watcher;
wire sig = `HIER.sig;
wire bar = `HIER.foo.bar;
...
endmodule
watcher w; // instantiation
</code></pre>
<p>Desired:</p>
<pre><code>module watcher(input base_hier);
wire sig = base_hier.sig;
wire bar = base_hier.foo.bar;
...
endmodule
watcher w1(`HIER1); // instantiation
watcher w2(`HIER2); // second instantiation, except with a different hierarchy
</code></pre>
<p>My best idea is to use vpp (the Verilog preprocessor) to brute-force generate two virtually-identical modules (one with each hierarchy), but is there a more elegant way?</p>
|
<p>My preference is to have a single module (or a small number of modules) in your testbench that contains all your probes but no other functionality. All other modules in your testbench that require probes then connect to that "probe module". Use SystemVerilog interfaces in preference to raw wires if that's an option for you. This circumvents your problem since no watcher will require global hierarchies and your testbench on the whole will be considerably easier to maintain. See the <a href="http://en.wikipedia.org/wiki/Law_of_Demeter" rel="noreferrer" title="Law of Demeter">Law of Demeter</a>.</p>
<p>Alternatively... (but this puts hierarchy in your instantiations...)</p>
<pre><code>module watcher(sig, bar);
input sig;
input bar;
...
endmodule
watcher w1(`HIER1.sig, `HIER1.foo.bar); // instantiation
watcher w2(`HIER2.sig, `HIER2.foo.bar); // second instantiation, except with a different hierarchy
</code></pre>
<p>Subsequently you can also:</p>
<pre><code>`define WATCHER_INST(NAME, HIER) watcher NAME(HIER.sig, HIER.foo.sig)
`WATCHER_INST(w1, `HIER1);
`WATCHER_INST(w2, `HIER2);
</code></pre>
|
<p>Can you use the SystemVerilog <code>bind</code> keyword to bind the module into every hierarchy that requires it? (This requires that you use SystemVerilog, and have a license for a simulator.)</p>
<p>Using bind is like instantiating a module in the normal way, except that you provide a path to hierarchy into which the module is "remotely" instantiated:</p>
<pre><code>bind top.my.hier my_module instance_name(.*);
bind top.my_other.hier my_module instance_name(.*);
</code></pre>
<p>Even better: assume that each hierarchy that you are binding into is a separate instance of the same module. Then:</p>
<pre><code>bind remote_module my_module instance_name(.*);
</code></pre>
<p>This binds your module into <strong>every instance</strong> of the target, no matter where it is in the design. This is very powerful if your module is a verification checker.</p>
| 9,296
|
<p>I'm new to 3D printing. I modeled an empty bird in Blender (the stl file of model is presented). I tested the model in Blender (using 3D printing tool) and also the Netfabb software. They don't show any error. However, when I load this model in Ultimaker Cura for printing, as shown in the last image, the result is only a cylinder shape bird. I have seen many 3D printed empty models on internet. Why can't my model be printed correctly?
<a href="https://www.dropbox.com/s/ymhpc8c1qne1i2c/bird_model.stl?dl=0" rel="nofollow noreferrer">the download link of the model</a></p>
<blockquote>
<p><a href="https://i.stack.imgur.com/EB3Tq.png" rel="nofollow noreferrer" title="The top view of the model in Blender"><img src="https://i.stack.imgur.com/EB3Tq.png" alt="The top view of the model in Blender" title="The top view of the model in Blender"></a> </p>
<p><a href="https://i.stack.imgur.com/5Xu4F.png" rel="nofollow noreferrer" title="The bottom view of the model in Blender"><img src="https://i.stack.imgur.com/5Xu4F.png" alt="The bottom view of the model in Blender" title="The bottom view of the model in Blender"></a></p>
<p><a href="https://i.stack.imgur.com/9bVef.png" rel="nofollow noreferrer" title="The 3D printing parameters in Blender"><img src="https://i.stack.imgur.com/9bVef.png" alt="The 3D printing parameters in Blender" title="The 3D printing parameters in Blender"></a></p>
<p><a href="https://i.stack.imgur.com/fh4q8.png" rel="nofollow noreferrer" title="The model in Cura"><img src="https://i.stack.imgur.com/fh4q8.png" alt="The model in Cura" title="The model in Cura"></a></p>
<p><a href="https://i.stack.imgur.com/evekb.png" rel="nofollow noreferrer" title="The 3D printing preview of model in Cura"><img src="https://i.stack.imgur.com/evekb.png" alt="The 3D printing preview of model in Cura" title="The 3D printing preview of model in Cura"></a></p>
</blockquote>
|
<p>You have modeled your bird. So far so good, but you likely only modeled a single surface and not a closed surface body. The crucial step was forgotten, as your pictures 1 and 2 show: you have designed a single surface for most of the object, not a body. To turn the bird into a printable object needs it not to be a single surface but a surface enclosing a volume that has some thickness.</p>
<p>At the moment, it looks like this: 640 vertices, NO enclosed space.</p>
<p><a href="https://i.stack.imgur.com/UzNV4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UzNV4.png" alt="Model as shared"></a></p>
<p>To achieve an even thickness object in blender:</p>
<ul>
<li><code>A</code> to choose the whole model</li>
<li><code>E</code> for extrude Region</li>
<li><code>Z</code> <code>Z</code> to constrain movement to Z axis</li>
<li>type in the wanted thickness
<ul>
<li>remember, that the grid in Blender is usually in cm, while slicing programs reference in mm!</li>
</ul></li>
<li>close the edges by creating faces there (chose 3 and <code>F</code>)
<a href="https://i.stack.imgur.com/1Lg9T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Lg9T.png" alt="Fix step 1"></a></li>
<li><code>A</code> to grab everything</li>
<li><code>W</code> then <code>R</code> to <em>remove doubles</em>, increase the merging distance to 0.05 (it takes away hundreds of superfluous, slightly shifted vertices!)</li>
<li><code>CTRL</code>+<code>N</code> to <a href="https://all3dp.com/2/blender-recalculate-normals-simply-explained/" rel="nofollow noreferrer">recalculate normals</a>
<a href="https://i.stack.imgur.com/ErQqb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ErQqb.png" alt="With normals turned visible - spiky = good!"></a>
Make sure to check the slicer, because we have some strays, visible in red... where are those? They are faces hidden in the body!
<a href="https://i.stack.imgur.com/8XS9I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8XS9I.png" alt="enter image description here"></a></li>
</ul>
<p>Hide the underside (Select nothing, allow viewing through the object, <code>3</code> > <code>B</code> > draw a box around the lowest layer > <code>H</code>)</p>
<p>If you have the normals visible, you'll see the iffy areas now. Fix them by removing the superfluous faces and flipping those that are not superfuous but just inside out (<code>W</code>><code>F</code>). One example area I highlight in the next picture
<a href="https://i.stack.imgur.com/MgF9E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MgF9E.png" alt="This is the inside, we don't want long lines here!"></a></p>
<p>In the end, it should look like this in cura:
<a href="https://i.stack.imgur.com/Ohylv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ohylv.png" alt="Hunt for flipped vertices done"></a>
<a href="https://i.stack.imgur.com/qxAij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qxAij.png" alt="It slices..."></a></p>
<p>Make sure to check layer view and possibly thicken some areas manually - or make a box-part for the top, so you can ensure printability. As you'll see, at some scales, some walls are too thin due to how we extruded along Z only.</p>
<p><a href="https://i.stack.imgur.com/nLbEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nLbEp.png" alt="A too thin wall"></a></p>
<h3>Alternate ways</h3>
<p>As noted in the comments, instead of the Z-Extrude, a model with very vertical walls could benefit from using the <a href="https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/solidify.html" rel="nofollow noreferrer"><code>solidify</code> modifier.</a> You will have to add it via object mode, modifiers and then choosing <code>solidify</code> and setting a positive thickness. To properly convert the visible modifier into an actual change of the model for the export, you will have to <code>Apply</code> the modifier.</p>
<p>Afterwards, go back to hunting stray internal surfaces and flipped faces.</p>
|
<p>Slicers don't do well with "empty" (hollow) bodies, or bodies with secret holes in it. You need to supply a filled body<sup>1</sup>, the slicer will make it mostly empty anyways (depending on the infill percentage). Also, you need to have infill, else the top cannot be printed as it does not have any support.</p>
<hr />
<h3>Footnote</h3>
<p><sup>1</sup> This means the body has to have one continuous surface without gaps or holes that encloses a volume. Among the most simple examples are spheres and cubes.</p>
| 1,386
|
<p>I have been told that there is a performance difference between the following code blocks.</p>
<pre><code>foreach (Entity e in entityList)
{
....
}
</code></pre>
<p>and </p>
<pre><code>for (int i=0; i<entityList.Count; i++)
{
Entity e = (Entity)entityList[i];
...
}
</code></pre>
<p>where</p>
<pre><code>List<Entity> entityList;
</code></pre>
<p>I am no CLR expect but from what I can tell they should boil down to basically the same code. Does anybody have concrete (heck, I'd take packed dirt) evidence one way or the other?</p>
|
<p>foreach creates an instance of an enumerator (returned from GetEnumerator) and that enumerator also keeps state throughout the course of the foreach loop. It then repeatedly calls for the Next() object on the enumerator and runs your code for each object it returns.</p>
<p>They don't boil down to the same code in any way, really, which you'd see if you wrote your own enumerator.</p>
|
<p>I think one possible situation where you <em>might</em> get a performance gain is if the enumerable type's size and the loop condition is a constant; for example:</p>
<pre><code>const int ArraySize = 10;
int[] values = new int[ArraySize];
//...
for (int i = 0; i </pre>
<p>In this case, depending on the complexity of the loop body, the compiler might be able to replace the loop with inline calls. I have no idea if the .NET compiler does this, and it's of limited utility if the size of the enumerable type is dynamic.</p>
<p>One situation where <code>foreach</code> might perform better is with data structures like a linked list where random access means traversing the list; the enumerator used by <code>foreach</code> will probably iterate one item at a time, making each access O(1) and the full loop O(n), but calling the indexer means starting at the head and finding the item at the right index; O(N) each loop for O(n^2).</p>
<p>Personally I don't usually worry about it and use <code>foreach</code> any time I need all items and don't care about the index of the item. If I'm not working with all of the items or I really need to know the index, I use for</code>. The only time I could see it being a big concern is with structures like linked lists.</p>
| 6,593
|
<p>If I have 2 query sources how do I find ones that are in one that are not in the other?</p>
<p>example of join to find items in both:</p>
<pre><code>var results = from item1 in qs1.Items
join item2 in qs2 on item1.field1 equals item2.field2
select item1;
</code></pre>
<p>So what would the linq code be to return the items in qs1 that are not in qs2?</p>
|
<p>Darren Kopp's <a href="https://stackoverflow.com/questions/50702/linq-how-do-you-do-a-query-for-items-in-one-query-source-that-are-not-in-anothe/50724#50724">answer</a>:</p>
<pre><code>var excluded = items1.Except(items2);
</code></pre>
<p>is the best solution from a performance perspective.</p>
<p><em>(NB: This true for at least regular LINQ, perhaps LINQ to SQL changes things as per <a href="http://programminglinq.com/blogs/marcorusso/archive/2008/01/14/the-not-in-clause-in-linq-to-sql.aspx" rel="nofollow noreferrer">Marco Russo's blog post</a>. However, I'd imagine that in the "worst case" Darren Kopp's method will return at least the speed of Russo's method even in a LINQ to SQL environment).</em></p>
<p>As a quick example try this in <a href="http://www.linqpad.net/" rel="nofollow noreferrer">LINQPad</a>:</p>
<pre><code>void Main()
{
Random rand = new Random();
int n = 100000;
var randomSeq = Enumerable.Repeat(0, n).Select(i => rand.Next());
var randomFilter = Enumerable.Repeat(0, n).Select(i => rand.Next());
/* Method 1: Bramha Ghosh's/Marco Russo's method */
(from el1 in randomSeq where !(from el2 in randomFilter select el2).Contains(el1) select el1).Dump("Result");
/* Method 2: Darren Kopp's method */
randomSeq.Except(randomFilter).Dump("Result");
}
</code></pre>
<p>Try commenting one of the two methods out at a time and try out the performance for different values of n.</p>
<p>My experience (on my Core 2 Duo Laptop) seems to suggest:</p>
<pre><code>n = 100. Method 1 takes about 0.05 seconds, Method 2 takes about 0.05 seconds
n = 1,000. Method 1 takes about 0.6 seconds, Method 2 takes about 0.4 seconds
n = 10,000. Method 1 takes about 2.5 seconds, Method 2 takes about 0.425 seconds
n = 100,000. Method 1 takes about 20 seconds, Method 2 takes about 0.45 seconds
n = 1,000,000. Method 1 takes about 3 minutes 25 seconds, Method 2 takes about 1.3 seconds
</code></pre>
<p><em>Method 2 (Darren Kopp's answer) is clearly faster.</em></p>
<p>The speed decrease for Method 2 for larger n is most likely due to the creation of the random data (feel free to put in a DateTime diff to confirm this) whereas Method 1 clearly has algorithmic complexity issues (and just by looking you can see it is at least O(N^2) as for each number in the first collection it is comparing against the entire second collection).</p>
<p><strong>Conclusion:</strong> Use Darren Kopp's answer of LINQ's 'Except' method</p>
|
<p>Here's a more simple version of the same thing, you don't need to nest the query:</p>
<pre><code>List<string> items1 = new List<string>();
items1.Add("cake");
items1.Add("cookie");
items1.Add("pizza");
List<string> items2 = new List<string>();
items2.Add("pasta");
items2.Add("pizza");
var results = from item in items1
where items2.Contains(item)
select item;
foreach (var item in results)
Console.WriteLine(item); //Prints 'pizza'
</code></pre>
| 7,346
|
<p>This is my problem:</p>
<p>I'm assembling a 3D printer with the RAMPS 1.4 board and Arduino Mega. I have assembled the structure and the electronics (set drivers, placed the jumpers, connected stepper motors...) and have uploaded Marlin firmware (configuring: thermistor, endstops...) on the Arduino Mega.</p>
<p>I've tried to connect, via USB, to the computer and using the Repetier software I have commanded the printer which did do some movement. The printer worked perfectly. After a few tests, however, I've noticed that the Arduino was restarting several times and at one point I saw a component on the Arduino board burning. Searching the internet I saw that the burned component was the voltage regulator.</p>
<p>I heard also about unplugging the screen because it consumes a lot of current, that passes through the voltage regulator, thereby heating it up. I then proceeded to buy another Arduino Mega. I also checked the voltage of my 12V 360W power supply and it is correct. I always powered the Arduino with USB and RAMPS 1.4 was connected to the power supply from the two terminals.</p>
<p><a href="https://i.stack.imgur.com/PFSWR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PFSWR.png" alt="Power Terminals of RAMPS 1.4" /></a></p>
<p>When the new Arduino arrived, I connected the whole (without connecting the screen) and tried. The printer worked very well until it started giving the same problem as the first Arduino board. Someone can tell me if I have done something wrong, or is it the RAMPS board that does not work properly?</p>
<h3>EDIT:</h3>
<p>I read that the endstops can cause this problem. I have these endstops: <a href="https://it.aliexpress.com/item/1PCS-High-Quality-Mechanical-Endstop-For-Reprap-ramps-1-4-3D-printer-With-independent-packing-diy/32454910275.html" rel="noreferrer">1 PZ di Alta Qualità Finecorsa Meccanico Per rampe Reprap 1.4 stampante 3D Con imballaggio indipendente kit fai da te</a> and I connected the black wire to GND, red wire to 5V and the green wire to SIGNAL.</p>
|
<p>The demo files are gcode files generated for use with the sample PLA that comes with the printer. If you want to print it with ABS select the file and set the temperature manually afterwards. </p>
|
<p>If you want to use the demo files, you can probably pause the print as soon as it starts, and manually set the extruder temperatures before resuming the print. Easier to generate new g-code though.</p>
| 466
|
<p>When using a heated bed with your printer, I have seen claims of running temperatures of 90c throughout the print.</p>
<p>That seems like a fairly high power use to keep a large slab of, say, aluminium at 90c for long print times (ie multiple hours).</p>
<p>Is there a common 'sweet spot' for operating temperature?</p>
<p>Does it depend on material?</p>
<p>Is a heated bed required?</p>
|
<p>Heatbeds have two purposes:</p>
<ol>
<li>Increase surface energy of the print bed to improve bonding strength of the first layer (particularly important when using surfaces like PEI or Kapton)</li>
<li>Keep the bottom few millimeters of the print hot enough to provide a warp-free foundation for the rest of the print. </li>
</ol>
<p>The bit about surface energy is straightforward. Most materials are stickier when hot than cold. In comparison, pure mechanical-bonding bed surfaces like fibrous painter's tape and perfboard don't particularly benefit from bed heat.</p>
<p>Warping is a bit more complicated. The basic cause of warping is when the previous layer is allowed to cool and thermally contract before the next layer is deposited. When you stick hot, expanded material on top of cold, contracted material, large shear stresses are generated when the fresh material cools and contracts. Those inter-layer shear stresses then accumulate over many layers into large-scale bending stresses that try to lift the edges of the print off the bed.</p>
<p>So, to prevent warping, we should minimize the amount that the previous layer is allowed to cool before the next layer goes down. But we DO need it to cool solid so the print doesn't sag in a mushy mess. This is a balancing act: cooling the plastic solid without over-cooling it. The optimal temperature for the print is right around the glass point of the plastic: this is the temperature at which the plastic becomes fully solid and thermal contraction stresses start to accumulate. </p>
<p>The extruder pumps more heat into the print as it deposits molten plastic and radiates a little bit of heat. So we want to set the heatbed temp a little bit below the glass point to ensure the print is able to cool solid. Now, this gets a bit difficult, because everyone's print bed temperature sensor is different. What matters is bed surface temp. Many people have to set their bed temp quite a bit higher than the actual surface temp. It's just something you have to calibrate via print results. The exact filament glass point (Tg) also depends on the blend. </p>
<ul>
<li>ABS: Tg is around 105C, optimal bed temp 95C in a warm, low-airflow environment</li>
<li>PLA: Tg is around 55C, optimal bed temp is 55C in a cool, high-airflow environment because PLA holds heat and is slow to cool compared to other filaments</li>
<li>PETG: Tg is around 70C, optimal bed temp is 60-70C with mild airflow</li>
<li>Nylon doesn't really work with these rules because it's semi-crystalline, meaning it "freezes" far above its Tg and thus starts accumulating warping stress at fairly high temps... advice varies wildly, from printing cold to 120C bed</li>
<li>PC: Tg is around 150C, optimal bed temp is 130C</li>
</ul>
<p>There are other schools of thought, for example printing the first layer onto a surface much hotter than Tg for good adhesion, and then dropping the bed temp to a value somewhat below Tg to allow the print to solidify. That works fine too. </p>
<p>But, with all that said, it's important to understand that the heatbed only keeps the bottom of the print warm. A centimeter up from the build plate, the print is typically much closer to ambient temp than it is to the bed temp. Heated build chambers are thus much more effective for large prints. But heatbeds are still quite effective, because they allow building a strong, warp-free foundation that resists warping stresses induced by the cooler zones higher up in the print. </p>
|
<p>First you say 90c, which means you are talking about ABS likely. I state this as some PLA printers do not even use heated beds, and instead use elaborate rafts only. (Makerbot)</p>
<p>Now that I have gotten that out of the way I wanted to point out to you that it really isn't using that much power. 110 watts (based off this fellow)</p>
<p><a href="http://reprage.com/post/39698552378/how-much-power-does-a-3d-printer-use" rel="nofollow">http://reprage.com/post/39698552378/how-much-power-does-a-3d-printer-use</a></p>
<p>8 hours. 0.11 USD. </p>
<p><a href="http://energy.gov/energysaver/estimating-appliance-and-home-electronic-energy-use" rel="nofollow">http://energy.gov/energysaver/estimating-appliance-and-home-electronic-energy-use</a></p>
<p>I am sure this number is not 100% spot on. That said having had used a power monitor when I first started out I can confirm getting very cheap results. Actually I calculated the costs of powering my 1 meter by 1 meter silicon heater. It was not that much.</p>
<p>This will not apply to every printer. Some are built better than others.</p>
<p>Last for Min Temp. You will pick the temp that works for the specific plastic. Every plastic is different. Materials with high pigments usually need higher temps for extrusions. That said, generally PLA is 60. ABS is 90-100. When it is wrong you will see more (almost always see some) heat warping.</p>
<p>I also want to mention that heat chambers give the best result and would not require you to use the bed as much. You don't see these on printers for two reasons. Heaters can catch fire, and because of patents blocking people from selling (nothing stopping you though. Look into just using a Box without an active heater if it is still a concern</p>
| 361
|
<p>I want to convert a primitive to a string, and I tried:</p>
<pre><code>myInt.toString();
</code></pre>
<p>This fails with the error:</p>
<pre><code>int cannot be dereferenced
</code></pre>
<p>Now, I get that primitives are not reference types (ie, not an Object) and so cannot have methods. However, Java 5 introduced autoboxing and unboxing (a la C#... which I never liked in C#, but that's beside the point). So with autoboxing, I would expect the above to convert myInt to an Integer and then call toString() on that.</p>
<p>Furthermore, I believe C# allows such a call, unless I remember incorrectly. Is this just an unfortunate shortcoming of Java's autoboxing/unboxing specification, or is there a good reason for this?</p>
|
<p>Java autoboxing/unboxing doesn't go to the extent to allow you to dereference a primitive, so your compiler prevents it. Your compiler still knows <code>myInt</code> as a primitive. There's a paper about this issue at <a href="http://jcp.org/aboutJava/communityprocess/jsr/tiger/autoboxing.html" rel="noreferrer">jcp.org</a>.</p>
<p>Autoboxing is mainly useful during assignment or parameter passing -- allowing you to pass a primitive as an object (or vice versa), or assign a primitive to an object (or vice versa).</p>
<p>So unfortunately, you would have to do it like this: (kudos Patrick, I switched to your way)</p>
<pre><code>Integer.toString(myInt);
</code></pre>
|
<p>In C#, integers are neither reference types nor do they have to be boxed in order for <em>ToString()</em> to be called. They <strong>are</strong> considered objects in the Framework (as a ValueType, so they have value semantics), however. In the CLR, methods on primitives are called by "indirectly" loading them onto the stack (ldind).</p>
| 2,626
|
<p>I'm still new to 3D printing and I want to print something. I expect that I'll mess it up since I find nothing to adjust it but it is now laying around for 4 months and I'm sick of it.</p>
<p>So my question is where do I find Windows software to print something and of course where do I get a 3D model?</p>
<p>I own a Geeetech i3 Pro W.</p>
|
<h2>First; find a model!</h2>
<p>To print something you require a <strong>model</strong> (usually this is in STL format, look into websites called <a href="http://www.thingiverse.com" rel="nofollow noreferrer">Thingiverse</a> and <a href="https://www.myminifactory.com/" rel="nofollow noreferrer">MyMiniFactory</a> for examples). Once you have a model file, you need to make it readable for the printer firmware.</p>
<p>If you can't find suitable model, then you need to design a model yourself (or ask someone to do it for you) or adjust an existing model to suit your needs. "<a href="/q/740/">Good (preferably free) Beginner Software for Part Creation?</a>" is a good place to start.</p>
<h2>Second; use slicer software</h2>
<p>For a printer to be able to print the model, the model needs to be sliced into layers. These layers need to be printed at specific speeds, temperatures, etc. Search online and look at the filament packaging (usually the ideal temperatures are on the packaging) to find the ideal temperature for your filament. If you are not using the right temperatures, your print will most likely fail. Programs that are able to slice models are called <strong>slicers</strong>. The most popular free (and Windows compatible) slicers are <a href="https://ultimaker.com/en/products/ultimaker-cura-software" rel="nofollow noreferrer">Ultimaker Cura</a> and <a href="https://slic3r.org" rel="nofollow noreferrer">Slic3r</a> (or its <a href="https://www.prusa3d.com/slic3r-prusa-edition/" rel="nofollow noreferrer">Prusa distribution</a>).</p>
<p>The slicer produces a printer readable file called a G-code file (file filled with printer instructions for e.g. movement and heating). This G-code file can be sent to the printer using specific printer software (e.g. OctoPrint, Repetier-Host, etc.) but more common or simple is to put the G-code file on an SD card and print the file using the print menu on the printer LCD.</p>
|
<p>If you're just starting out then Tinkercad (website) is a good place to start designing your own objects. Later you can get to grips with OpenScad for more complex shapes. Both are free.</p>
| 1,294
|
<p>I did a lot of PHP programming in the last years and one thing that keeps annoying me is the weak support for Unicode and multibyte strings (to be sure, natively there is none). For example, "htmlentities" seems to be a much used function in the PHP world and I found it to be absolutely annoying when you've put an effort into keeping every string localizable, only store UTF-8 in your database, only deliver UTF-8 webpages etc. Suddenly, somewhere between your database and the browser there's this hopelessly naive function pretending every byte is a character and messes everything up.</p>
<p>I would just <i>love</i> to just dump this kind of functions, they seem totally superfluous. <b>Is it still necessary these days to write '&auml;' instead of 'ä'?</b> At least my Firefox seems perfectly happy to display even the strangest Asian glyphs as long as they're served in a proper encoding.</p>
<p><b>Update:</b> To be more precise: Are named entities necessary for <i>anything else than displaying HTML tags</i> (as in "&lt;" for "<")</p>
<h3>Update 2:</h3>
<p>@Konrad: Are you saying that, no, named entities are not needed?</p>
<p>@Ross: But wouldn't it be better to sanitize user input when it's entered, to keep my output logic free from such issues? (assuming of course, that reliable sanitizing on input is possible - but then, if it isn't, can it be on output?)</p>
|
<p>Named entities in "real" XHTML (i.e. with <code>application/xhtml+xml</code>, rather than the more frequently-used <code>text/html</code> compatibility mode) are discouraged. Aside from the five defined in XML itself (<code>&lt;</code>, <code>&gt;</code>, <code>&amp;</code>, <code>&quot;</code>, <code>&apos;</code>), they'd all have to be defined in the DTD of the particular DocType you're using. That means your browser has to explicitly support that DocType, which is far from a given. Numbered entities, on the other hand, obviously only require a lookup table to get the right Unicode character.</p>
<p>As for whether you need entities at all these days: you can pretty much expect any modern browser to support UTF-8. Therefore, as long as you can guarantee that the database, the markup and the web server all agree to serve that, ditch the entities.</p>
|
<p>Safari seems to have issues with some glyphs but not others, it may not be <strong>needed</strong> but it's probably best to do so, of course, this is my opinion and not backed up by anything but my own observations.</p>
| 4,474
|
<p>A discussion about Singletons in <strong>PHP</strong> has me thinking about this issue more and more. Most people instruct that you shouldn't make a bunch of DB connections in one request, and I'm just curious as to what your reasoning is. My first thought is the expense to your script of making that many requests to the DB, but then I counter myself with the question: wouldn't multiple connections make concurrent querying more efficient?</p>
<p>How about some answers (with evidence, folks) from some people in the know?</p>
|
<p>Database connections are a limited resource. Some DBs have a very low connection limit, and wasting connections is a major problem. By consuming many connections, you may be blocking others for using the database.</p>
<p>Additionally, throwing a ton of extra connections at the DB doesn't help anything unless there are resources on the DB server sitting idle. If you've got 8 cores and only one is being used to satisfy a query, then sure, making another connection might help. More likely, though, you are already using all the available cores. You're also likely hitting the same harddrive for every DB request, and adding additional lock contention.</p>
<p>If your DB has anything resembling high utilization, adding extra connections won't help. That'd be like spawning extra threads in an application with the blind hope that the extra concurrency will make processing faster. It <em>might</em> in some certain circumstances, but in other cases it'll just slow you down as you thrash the hard drive, waste time task-switching, and introduce synchronization overhead.</p>
|
<p>I would assume that it is because your requests are not being sent asynchronously, since your requests are done iteratively on the server, blocking each time, you have to pay for the overhead of creating a connection each time, when you only have to do it once...</p>
<p>In Flex, all web service calls are automatically called asynchronously, so you it is common to see multiple connections, or queued up requests on the same connection.</p>
<p>Asynchronous requests mitigate the connection cost through faster request / response time...because you cannot <em>easily</em> achieve this in PHP without out some threading, then the performance hit is greater then simply reusing the same connection. </p>
<p>that's my 2 cents...</p>
| 4,821
|
<p>What would be the best method for getting a custom element (that is using J2ME native Graphics) painted on LWUIT elements?</p>
<p>The custom element is an implementation from mapping library, that paints it's content (for example Google map) to Graphics object. How would it be possible to paint the result directly on LWUIT elements (at the moment I am trying to paint it on a Component). </p>
<p>Is the only way to write a wrapper in LWUIT package, that would expose the internal implementation of it?</p>
<p><strong>Edit:</strong></p>
<p><strong><em>John:</em></strong> your solution looks like a lot of engineering :P What I ended up using is following wrapper:</p>
<pre><code>package com.sun.lwuit;
public class ImageWrapper {
private final Image image;
public ImageWrapper(final Image lwuitBuffer) {
this.image = lwuitBuffer;
}
public javax.microedition.lcdui.Graphics getGraphics() {
return image.getGraphics().getGraphics();
}
}
</code></pre>
<p>Now I can get the 'native' Graphics element from LWUIT. Paint on it - effectively painting on LWUIT image. And I can use the image to paint on a component.</p>
<p>And it still looks like a hack :)</p>
<p>But the real problem is 50kB of code overhead, even after obfuscation. But this is a issue for another post :)</p>
<p>/JaanusSiim</p>
|
<p>I do not think any hacking is necessary. You can subclass the LWTUI Component class and then you can pain whatever you want on to the graphic context of the component. You do not get the native lcdui.Graphics object but an object with a same interface that is easy to use.</p>
<p>If you really need to pass a lcdui.Graphics to some underlying library to display its output then I would suggest this:</p>
<p>Somewhere in your component code (do only when the component contents really need to be changed):</p>
<pre><code>private Image buffer = null; // keep this
int[] bufferArray = new int[desiredWidth * desiredHeight];
javax.microedition.lcdui.Image bufferImage =
Image.createEmptyImage(desiredWidth, desiredHeight);
thirPartyComponent.paint(bufferImage.getGraphics());
bufferImage.getRGB(bufferArray,0,1,0,0,desiredWidth, desiredHeight);
bufferImage = null; //no longer needed
buffer = Image.createImage(bufferArray, desiredWidth, desiredHeight);
</code></pre>
<p>In the component paint(g) method:</p>
<pre><code>g.drawImage(0,0, buffer);
</code></pre>
<p>By doing the hack you did you are losing portablity and also sice you are exposing implementation private object you might also break other things.</p>
<p>Hope this helps.</p>
|
<p>Based on the javadoc for LWUIT and J2ME and guessing that the custom J2ME class is a <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Canvas.html" rel="nofollow noreferrer">Canvas</a> it looks like you would have to:</p>
<ul>
<li>Subclass <a href="https://lwuit.dev.java.net/javadocs/com/sun/lwuit/Component.html" rel="nofollow noreferrer">LWUIT's Component class</a> wrapping the custom J2ME component</li>
<li>Override the paint() method of the LWUIT Component</li>
<li>Subclass the <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html" rel="nofollow noreferrer">J2ME Graphics class</a> wrapping the LWUIT Graphics class and pass all the method calls through</li>
<li>Pass in the wrapped J2ME Graphics implementation to the custom J2ME component's paint method</li>
</ul>
<p>That third step is an ugly one. Check on the <a href="https://lwuit.dev.java.net/servlets/SummarizeList?listName=users" rel="nofollow noreferrer">LWUIT mailing list</a> to see if anyone has dome this before. From the published APIs I don't see another way to do it. </p>
<p>Edit: The hack added in the question looks better than my hack for an Image. What I have <em>may</em> be better for a general case, but I don't know either LWUIT or J2ME well enough to really say that. </p>
| 4,332
|
<p>What is the approved way to convert from char* to System::string and back in C++/CLI? I found a few references to marshal_to<> templated functions on Google, but it appears that this feature never made the cut for Visual Studio 2005 (and isn't in Visual Studio 2008 either, AFAIK). I have also seen some code on <a href="http://blogs.msdn.com/slippman/archive/2004/06/02/147090.aspx" rel="noreferrer">Stan Lippman's blog</a>, but it's from 2004. I have also seen Marshal::StringToHGlobalAnsi(). Is there a method that is considered "best practice"?</p>
|
<p>System::String has a constructor that takes a char*:</p>
<pre><code> using namespace system;
const char* charstr = "Hello, world!";
String^ clistr = gcnew String(charstr);
Console::WriteLine(clistr);
</code></pre>
<p>Getting a char* back is a bit harder, but not too bad:</p>
<pre><code> IntPtr p = Marshal::StringToHGlobalAnsi(clistr);
char *pNewCharStr = static_cast<char*>(p.ToPointer());
cout << pNewCharStr << endl;
Marshal::FreeHGlobal(p);
</code></pre>
|
<p>One additional link to a summary of possible ways:</p>
<p><a href="http://support.microsoft.com/?kbid=311259" rel="nofollow">http://support.microsoft.com/?kbid=311259</a></p>
| 8,052
|
<p>I've been trying to convert SVG images to PNG using C#, without having to write too much code. Can anyone recommend a library or example code for doing this?</p>
|
<p>You can call the command-line version of inkscape to do this:</p>
<p><a href="http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx" rel="noreferrer">http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx</a></p>
<p>Also there is a C# SVG rendering engine, primarily designed to allow SVG files to be used on the web on codeplex that might suit your needs if that is your problem:</p>
<p><strong>Original Project</strong><br>
<a href="http://www.codeplex.com/svg" rel="noreferrer">http://www.codeplex.com/svg</a></p>
<p><strong>Fork with fixes and more activity:</strong> (added 7/2013)<br>
<a href="https://github.com/vvvv/SVG" rel="noreferrer">https://github.com/vvvv/SVG</a></p>
|
<p>you can use altsoft xml2pdf lib for this</p>
| 8,335
|
<p>I am looking for a way to easily separate the wires between the power supply and the Einsy board of my Prusa Mk 3S+ with a connector. The power supply delivers 10 A at 24 V.</p>
<p>I thought about a <a href="https://www.jst.com/products/wire-to-wire/yl-connector/" rel="nofollow noreferrer">YL wire-to-wire electrical connector</a> as it can handle up to 7 A at 300 V. This should be enough since the two cables share the total load.</p>
<p><a href="https://i.stack.imgur.com/WOMTO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WOMTO.png" alt="enter image description here" /></a></p>
<p>The 6 cables (4 power cables & 2 PSU power panic cables) have different diameters. Is it better to use one connector (6 pin) or two connectors (4 pin, 2 pin)?</p>
|
<p>I have used a standard soldering iron to modify and fix 3D prints in the past. You have to keep some things in mind when doing so:</p>
<ul>
<li>Don't overheat your material. PLA can take a soldering iron of about 230 °C before charring.</li>
<li>Don't use a tip with solder, or you will get grey deposits in the plastic.</li>
<li>Round tips or flat tips both work fine, but you want to not dump <em>too</em> much heat into the model or you start to deform the print as it needs to cool again.</li>
<li>Using snippets from the end of the spool for soldering is a good way to recycle the "waste".</li>
</ul>
|
<p>Cutting materials with a 'hot knife' isn't anything new. There should be a fairly established toolset for working foam. For 3D prints, I prefer to add coatings rather than modify surfaces with a hand held tool after. I do run a drill bit through printed holes though.</p>
| 1,915
|
<p>I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and security trimmings. There are only 21 menu options, but the results HTML of the menu is a whopping 14k. The site is hosted on our company's intranet and must be serverd to people worldwide on limited bandwidth, so I'd like to reduce the size of the menus.</p>
<p>What is the best way to do this? Does anybody have a good reference? I have the following constraints:</p>
<ul>
<li>The solution must not reference any 3rd part DLL files (getting approval would be a nightmare)</li>
<li>Has to work with IE 6</li>
</ul>
<p>CSS and JavaScript are fine, as long as they work with IE 6.</p>
|
<p>Take a look at:
<a href="http://www.asp.net/CSSAdapters/Menu.aspx" rel="nofollow noreferrer">http://www.asp.net/CSSAdapters/Menu.aspx</a></p>
<p>The default Menu control is rendering far too much HTML.</p>
|
<p>You might have a look at my <a href="http://jagbarcelo.blogspot.com/2009/03/aspnet-menu-control-optimization.html" rel="nofollow noreferrer">ASP.NET menu optimization post</a>. What I do is extracting the common part of the menu rendered in every page to an external file that is loaded and cached only once at the user browser. This way the pages are 60-70% smaller in some cases.</p>
| 2,702
|
<p>I have a script that renders graphs in gnuplot. The graphs all end up with an ugly white background. How do I change this? (Ideally, with a command that goes into a gnuplot script, as opposed to a command-line option or something in a settings file)</p>
|
<p>You can change the background color by command <code>set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"green" behind</code> to set the background color to the the color you specified (here is green).</p>
<p>To get more knowledge about setting the background in gnuplot, you can visit this <a href="http://gnuplot-surprising.blogspot.com/" rel="noreferrer" title="blog">blog</a>. There are even provided methods to set a gradient color background and background pictures. Good luck!</p>
|
<p>According to the <a href="http://www.gnuplot.info/documentation.html" rel="nofollow noreferrer">official documentation</a>, as of version 5.4 the right way to set the background color in a gnuplot script is something like the following:</p>
<pre><code>set term wxt background rgb "gray75"
</code></pre>
<p>Note that the color must be quoted. Beside color names you can use hex values with the format "#AARRGGBB" or "0xAARRGGBB</p>
| 9,487
|
<p>I'm working on a web-based contest which is supposed to allow anonymous users to vote, but we want to prevent them from voting more than once. IP based limits can be bypassed with anonymous proxies, users can clear cookies, etc. It's possible to use a Silverlight application, which would have access to isolated storage, but users can still clear that.</p>
<p>I don't think it's possible to do this without some joker voting himself up with a bot or something. Got an idea?</p>
|
<p>The short answer is: no. The longer answer is: but you can make it arbitrarily difficult. What I would do:</p>
<ul>
<li>Voting requires solving a captcha (to avoid as much as possible automated voting). To be even more effective I would recommend to have prepared multiple types of simple captchas (like "pick the photo with the cat", "what is 2+2", "type in the word", etc) and rotate them both by the time of the day and by IP, which should make automatic systems ineffective (ie if somebody using IP A creates a bot to solve the captcha, this will become useless the next day or if s/he distributes it onto other computers/uses proxies)</li>
<li>When filtering by IP you should be careful to consider situations where multiple hosts are behind one public IP (AFAIK AOL proxies all of their customers through a few IPs - so such a limitation would effectively ban AOL users). Also, many proxies send along headers pointing to the original IP (like X-Forwarded-For), so you can take a look at that too.</li>
<li>Finally, using something like FSO (Flash Shared Objects - "Flash cookies") is obscure enough for 99.99% of the people not to know about. Silverlight is even more obscure. To be even sneakier, you could buy an other domain and set the FSO from that domain (so, if the user is looking for FSO's set by your domain, they won't see any)</li>
</ul>
<p>None of these methods is 100%, but hopefully combined they give you the level of assurance you need. If you want to take this a level higher, you need to add some kind of user registration (which can be as simple as asking a valid e-mail address when the vote occurs and sending a confirmation link to the given address and not counting the votes for which the link wasn't clicked - so it doesn't need to be a full-fledged "create an account with username / password / firs name / last name / etc").</p>
|
<p>Nope, it's the user's computer and they're in control.
Unfortunately the only solution is to bring it back on your court so to speak and require authentication.</p>
<p>However, a CAPTCHA helps limit the votes to human users at least.</p>
<p>Of course even with authentication you can't enforce single voting because then they teach the bots to register...</p>
| 7,965
|
<p>Say I have the following methods:</p>
<pre><code>def methodA(arg, **kwargs):
pass
def methodB(arg, *args, **kwargs):
pass
</code></pre>
<p>In methodA I wish to call methodB, passing on the kwargs. However, it seems that if I define <code>methodA</code> as follows, the second argument will be passed on as positional rather than named variable arguments.</p>
<pre><code>def methodA(arg, **kwargs):
methodB("argvalue", kwargs)
</code></pre>
<p>How do I make sure that the **kwargs in methodA gets passed as **kwargs to methodB?</p>
|
<p>Put the asterisks before the kwargs variable. This makes Python pass the variable (which is assumed to be a dictionary) as keyword arguments.</p>
<pre><code>methodB("argvalue", **kwargs)
</code></pre>
|
<p>Some experimentation and I figured this one out:</p>
<p>def methodA(arg, **kwargs):
methodB("argvalue", **kwargs)</p>
<p>Seems obvious now...</p>
| 7,446
|
<p>I remember back in the day with the old borland DOS compiler you could do something like this:</p>
<pre><code>asm {
mov ax,ex
etc etc...
}
</code></pre>
<p>Is there a semi-platform independent way to do this now? I have a need to make a BIOS call, so if there was a way to do this without asm code, that would be equally useful to me.</p>
|
<p>Using <a href="http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html" rel="noreferrer">GCC</a></p>
<pre><code>__asm__("movl %edx, %eax\n\t"
"addl $2, %eax\n\t");
</code></pre>
<p>Using <a href="http://msdn.microsoft.com/en-us/library/4ks26t93(VS.71).aspx" rel="noreferrer">VC++</a></p>
<pre><code>__asm {
mov eax, edx
add eax, 2
}
</code></pre>
|
<p>use of <code>asm</code> or <code>__asm__</code> function ( in compilers have difference )</p>
<p>also you can write fortran codes with <code>fortran</code> function</p>
<pre><code>asm("syscall");
fortran("Print *,"J");
</code></pre>
| 8,650
|
<p>I had been printing with ABS and took the advice to alter the fan so I can see the filament when I am loading it into the cold end. It was tricky but doable. I am now trying with PLA and getting it to line up with the whole is a nightmare. Can the driving cog and guide wheel be moved? A couple of mm would stop the driving cog pushing the filament off line.</p>
|
<p>I was having the same issue as you and know what you are talking about and there is a file that you should print that will help you (I have printed this).</p>
<p>While the file says for the Anet A6, I think the extrude are the same on the Anet A8. It goes under the gear and bearing and guides the filament to the hole. Should work well for you.</p>
<p>Other things that you can do is straighten out the filament. That is what I do, it helps that much more. You can also cut the end at a angle to sharpen the end with a pencil sharpener, also helps find the hole. </p>
<p>So try the file, I think it will help you would. </p>
<p>File --> <a href="https://www.thingiverse.com/thing:2242903" rel="noreferrer">https://www.thingiverse.com/thing:2242903</a> </p>
|
<p>A lot of people complain on the filament insertion of the Anet A8. Personally, I have no problems at all. I cut the filament under a sharp angle and pre-bend the filament (not completely straight) and push it in the hole, it works every time without having to disassemble the extruder fan. Note that if you have the throat screwed in too much that it sticks out of the aluminum throat holder of the extruder (so not the part where the brass nozzle screws in) it is way more difficult to insert. I kept the top of the throat more or less flush with the block.</p>
<p>Other techniques to insert filament include:</p>
<ul>
<li>cutting the old filament (straight cut) and let the extruder feed while you press the new filament on top of the old filament stump, if done correctly the friction will feed the new filament right after the old,</li>
<li>print <a href="https://www.thingiverse.com/thing:2366523" rel="nofollow noreferrer">filament guides</a> for inside the extruder gear cavity,</li>
<li>removable or magnetic fan brackets.</li>
</ul>
| 810
|
<p>First off, there's a bit of background to this issue available on my blog:</p>
<ul>
<li><a href="http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html" rel="nofollow noreferrer">http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html</a></li>
<li><a href="http://www.codebork.com/coding/2008/07/31/message-passing-2.html" rel="nofollow noreferrer">http://www.codebork.com/coding/2008/07/31/message-passing-2.html</a> </li>
</ul>
<p>I'm aware that the descriptions aren't hugely clear, so I'll try to summarise what I'm attempting as best I can here. The application is a personal finance program. Further background on the framework itself is available at the end of this post.</p>
<p>There are a number of different types of plug-in that the framework can handle (e.g., accounts, export, reporting, etc.). However, I'm focussing on one particular class of plug-in, so-called data plug-ins, as it is this class that is causing me problems. I have one class of data plug-in for accounts, one for transactions, etc.</p>
<p>I'm midway through a vast re-factoring that has left me with the following architecture for data plug-ins:</p>
<ul>
<li>The data plug-in object (implementing intialisation, installation and plug-in metadata) [implements <code>IDataPlugin<FactoryType></code>] </li>
<li>The data object (such as an account) [implements, e.g., <code>IAccount</code>] </li>
<li>A factory to create instances of the data object [implements, e.g., <code>IAccountFactory</code>]</li>
</ul>
<p>Previously the data object and the plug-in object were combined into one, but this meant that a new transaction plug-in had to be instantiated for each transaction recorded in the account which caused a number of problems. Unfortunately, that re-factoring has broken my message passing. The data object implements <code>INotifyPropertyChanged</code>, and so I've hit a new problem, and one that I'm not sure how to work around: the plug-in object is registering events with the message broker, but it's the data objects that actually fire the events. This means that <strong>the subscribing plug-in currently has to subscribe to each created account, transaction, etc.!</strong> This is clearly not scalable. </p>
<p>As far as I can tell at the moment I have two possible solutions:</p>
<ol>
<li>Make the data plug-in object a go-between for the data-objects and message broker, possibly batching change notifications. I don't like this because it adds another layer of complexity to the messaging system that I feel I should be able to do without. </li>
<li>Junk the current event-based implementation and use something else that's more easily manageable (in-memory WCF?!).</li>
</ol>
<p>So I guess I'm really asking: </p>
<ol>
<li>How would you solve this problem?</li>
<li>What potential solutions do you think I've overlooked?</li>
<li>Is my approach even vaguely on-track/sensible?! :-)</li>
</ol>
<p>As you will be able to tell from the dates of the blog posts, some variant of this problem has been taxing me for quite a long time now! As such, any and all responses will be greatly appreciated. </p>
<p>The background to the framework itself is as follows: </p>
<blockquote>
<p>My plug-in framework consists of three main components: a plug-in broker, a preferences manager and a message broker. The plug-in broker does the bread-and-butter plug-in stuff: discovering and creating plug-ins. The preferences manager manages user preferences for the framework and individual plug-ins, such as which plug-ins are enabled, where data should be saved, etc. Communication is via publish/subscribe, with the message broker sitting in the middle, gathering all published message types and managing subscriptions. The publish/subscribe is currently implemented via the .NET <code>INotifyPropertyChanged</code> interface, which provides one event called <code>PropertyChanged</code>; the message broker builds a list of all plug-ins implementing <code>INotifyPropertyChanged</code> and subscribes other plug-ins this event. The purpose of the message passing is to allow the account and transaction plug-ins to notify the storage plug-ins that data has changed so that it may be saved. </p>
</blockquote>
|
<p>This is my understanding of your question: You have a plugin object that may have to listen for events on x data objects - you don't want to subscribe to the event on each data object though. I'm assuming that several plugins may want to listen to events on the same data object.</p>
<p>You could create a session type object. Each plugin listens for events on the session object. The data object no longer raises the event - it calls the session object to raise the event (one of the parameters would have to be the data object raising the event).</p>
<p>That means that your plugins only have to subscribe to one event, but they get the event from all data objects.</p>
<p>On the other hand, if only one plugin will ever listen to a data object at a time, why not just have the data object call the plugin directly?</p>
|
<p>It's early yet, but have you considered trying to use <a href="http://www.codeplex.com/MEF" rel="nofollow noreferrer">MEF</a> instead of rolling your own?</p>
| 7,363
|
<p>I'm doing some research on what types of LCD displays can be used to filter and pass UV light for resin curing - specifically in the context of building a DIY 3D SLA printer.</p>
<p>The community commonly uses the Sharp LS055R1SX03 module. Looking through the datasheet, there doesn't seem to be any information pertaining to the characteristics of the device when passing UV wavelengths. Is there something special about this module that allows it to filter/pass UV wavelengths compared to other common LCD displays?</p>
|
<p>Hmm I seen videos off people pealing filters off of lcd screens to let uv pass through.</p>
<p>I believe the sharp unit maybe popular because not all lcds have square pixels and have poor pixel alignment towards the edges, (the focus of the eye can only take in so much information why waste materials producing inperceptable rises in quality, much like having a 8k small screen unless the picture is static your hard pushed to notice difference).</p>
<p>There is also diffraction to think about, crystal size in the resin, oxygen membrane or delamination layer to stop cured resin sticking to lcd, I think there are projects of floating resin on another liquid (fluorinated oils work).</p>
<p>Even with better resolution(4k,) the voxel size does not increase in a linear manner, unless the uv light source is focused an colimated like in a lazer.</p>
<p>I don't know much its just info I've gleaned whilst browsing, I'm sure someone will correct any inaccuracies. </p>
|
<p>I am not an expert by any stretch but I hope this helps, but these are regular old TFT LCD screens. You can even get 4K ones and use them for the same process. You can for example pick up 4K displays such as the H546UAN01.0 and do the same with them. </p>
| 1,432
|
<p>I'm trying to write a Wordpress plug-in that automatically posts a blog post at a certain time of day. For example, read a bunch of RSS feeds and post a daily digest of all new entries.</p>
<p>There are plug-ins that do something similar to what I want, but many of them rely on a cron job for the automated scheduling. I'll do that if I have to, but I was hoping there was a better way. Getting a typical Wordpress user to add a cron job isn't exactly friendly.</p>
<p>Is there a good way to schedule a task that runs from a Wordpress plug-in? It doesn't have to run at exactly the right time.</p>
|
<p><a href="http://codex.wordpress.org/Function_Reference/wp_schedule_event" rel="nofollow noreferrer">http://codex.wordpress.org/Function_Reference/wp_schedule_event</a></p>
|
<p>vBulletin uses a sort of Pseudo-Cron system, that basically checks a schedule on every page access, and fires any processes that are due then.</p>
<p>It's been a while since I worked with Wordpress, but I think something like this should work if it runs on each page view. </p>
| 7,762
|
<p>There are lot of advices on the web how to paint the 3D printed objects, but generally they are advices for manual painting and this required special skills, especially if the object is small. My guess is that maybe 3D printer can lay the color layers as well? I am especially interested in the layering of enamel paints (which can be transparent and which can required high temperature heating afterwards). Medieval art has fine examples how detailed enamel art was created on the metal. Maybe something like this can be achieved with 3D printers as well?</p>
<p>If 3D priner with the paint-printing capability is not available generally then what are the prospects when such printer can be available? Maybe there are some early, experimental efforts to create such printer and maybe test devices are available?</p>
|
<p>So, there's not really anything like a 3D painting machine/robot like I think you're looking for, but there are printers that do fine detail with actual paint, usually oils, but not on 3D materials.</p>
<p>I found a <a href="https://studioartist.ning.com/forum/topics/paint-printers-do-they-exist" rel="nofollow noreferrer">thread</a> that talks about canvas printing about 8 years ago, along with a couple of videos that show <a href="https://www.youtube.com/watch?v=vj3NKmIKErE" rel="nofollow noreferrer">current machines</a> doing <a href="https://www.youtube.com/watch?v=0Ri7sa90EVk" rel="nofollow noreferrer">just that</a>, but that's still not what I think you're looking for.</p>
<p>There are also <a href="https://www.youtube.com/watch?v=SK0r7PfMUwQ" rel="nofollow noreferrer">CNC machines</a> that print with enamel paints, but these are usually for 2D again, and not very precise, as they are used for lapel pins that have cavities to hole the paint while it dries. I'm sure something like this could be used without the cavities, but you'd have to do a lot of testing to make sure the paint stays put or mixes as you want it.</p>
<p>Just like the oil printers, these enamel printers are likely very large and costly.</p>
<h2>Alternatively</h2>
<p>What might work for you is hydrodipping. There's a variety of methods to this, but one company has done a bunch of research on this and can do extremely accurate detail printing to "paint" 3D objects. The below video shows a variety of these hydrodipping techniques, but I've skipped to the most relevant part.</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/3y40JWmlU3E?start=240"></iframe>
</div></div></p>
<p>Here's the original video of what I think you're most interested in. It's not 3D printing in the way most of us think, but it's definitely a fantastic outcome.</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/YlUhPrAqiY0?start=0"></iframe>
</div></div></p>
<p>To explain, if these videos are ever deleted: detailed prints are made of a 3D model to color it exactly the way it needs to be, sometimes using multiple steps and computer positioning to get the object colored/"painted" correctly and seamlessly. One part of the video shows how the software can accurately make straight lines on a human-contoured face mask, while another part shows how a blank, fully 3D cat model can have spots or stripes added in 3 steps with the seams being completely invisible as well as it detailed enough to be mistaken for a real housecat beyond first glance.</p>
<p>As it turns out, you can do (some of) this yourself. After doing some research, I've found that you can actually get blank (instead of pre-printed) films and use an off the shelf printer, as long as it meets certain requirements. (I'm not recommending a site, brand, or anything else, this is just the first/only option I can find. If you do more research, I'm sure there's more options out there.)</p>
<p><a href="https://www.tsautop.com/blank-hydrographic-film/" rel="nofollow noreferrer">https://www.tsautop.com/blank-hydrographic-film/</a></p>
<p><a href="https://www.tsautop.com/blank-hydrographic-water-transfer-printing-inkjet-printer-6-color-inks/" rel="nofollow noreferrer">https://www.tsautop.com/blank-hydrographic-water-transfer-printing-inkjet-printer-6-color-inks/</a></p>
|
<h2>Painting Prints</h2>
<p>Yes, you can paint your models with <a href="https://en.wikipedia.org/wiki/Enamel_paint" rel="nofollow noreferrer">enamel paints</a>. Actually, most paints will work. You might need to roughen the surface with sandpaper a tiny bit. Note that some spray paints might contain solvents that might soften or melt the prints, so read your ingredients!</p>
<h3>...not with vitreous enamel</h3>
<p>However, you can't use <a href="https://en.wikipedia.org/wiki/Vitreous_enamel" rel="nofollow noreferrer">proper enamel</a>, as that needs to be sintered after the paints have dried, and that will destroy your print unless you have used a metal-printer.</p>
<h2>Printing Color</h2>
<p>Now, if you want a printer to print a paste of vitreous enamel, you are looking for a <strong>paste printer</strong>. However, the paint for such a device needs to be very viscous, and the print quality (due to the large nozzle) will be far below what a skilled artisan can achieve. Also, you'd need one paste extruder per color.</p>
<h2>Foils?</h2>
<p>One could possibly work with foils, cutting them on a plotter and then carefully transferring them to the printed object. This would allow much finer details than a paste printer currently is able to create. Such a foil can also be printed upon by special printers - possibly achieving the full spectrum in a single application step.</p>
<p>Alternatively, one would use a "puzzle" of smaller pieces and apply each piece separately. The result might actually be somewhat similar to the <em>Chromolith</em> (Colored Stone) stonewares that had been created by Villeroy & Boch starting 1876.</p>
| 1,779
|
<p>Anyone have a decent example, preferably practical/useful, they could post demonstrating the concept?</p>
|
<blockquote>
<p>(Edit: a small <a href="http://web.archive.org/web/20041012103936/http%3A//www.bagley.org/~doug/ocaml/Notes/okoans.shtml" rel="nofollow noreferrer">Ocaml FP Koan</a> to start things off)</p>
<blockquote>
<p><strong>The Koan of Currying (A koan about food, that is not about food)</strong></p>
<blockquote>
<p>A student came to Jacques Garrigue and said, "I do not understand what currying is good for." Jacques replied, "Tell me your favorite meal and your favorite dessert". The puzzled student replied that he liked okonomiyaki and kanten, but while his favorite restaurant served great okonomiyaki, their kanten always gave him a stomach ache the following morning. So Jacques took the student to eat at a restaurant that served okonomiyaki every bit as good as the student's favorite, then took him across town to a shop that made excellent kanten where the student happily applied the remainder of his appetite. The student was sated, but he was not enlightened ... until the next morning when he woke up and his stomach felt fine. </p>
</blockquote>
</blockquote>
</blockquote>
<p>My examples will cover using it for the reuse and encapsulation of code. This is fairly obvious once you look at these and should give you a concrete, simple example that you can think of applying in numerous situations.</p>
<p>We want to do a map over a tree. This function could be curried and applied to each node if it needs more then one argument -- since we'd be applying the one at the node as it's final argument. It doesn't have to be curried, but writing <em>another</em> function (assuming this function is being used in other instances with other variables) would be a waste.</p>
<pre><code>type 'a tree = E of 'a | N of 'a * 'a tree * 'a tree
let rec tree_map f tree = match tree with
| N(x,left,right) -> N(f x, tree_map f left, tree_map f right)
| E(x) -> E(f x)
let sample_tree = N(1,E(3),E(4)
let multiply x y = x * y
let sample_tree2 = tree_map (multiply 3) sample_tree
</code></pre>
<p>but this is the same as:</p>
<pre><code>let sample_tree2 = tree_map (fun x -> x * 3) sample_tree
</code></pre>
<p>So this simple case isn't convincing. It really is though, and powerful once you use the language more and naturally come across these situations. The other example with some code reuse as currying. A <a href="https://stackoverflow.com/questions/7272/of-ways-to-count-the-limitless-primes#7487">recurrence relation to create prime numbers</a>. Awful lot of similarity in there:</p>
<pre><code>let rec f_recurrence f a seed n =
match n with
| a -> seed
| _ -> let prev = f_recurrence f a seed (n-1) in
prev + (f n prev)
let rowland = f_recurrence gcd 1 7
let cloitre = f_recurrence lcm 1 1
let rowland_prime n = (rowland (n+1)) - (rowland n)
let cloitre_prime n = ((cloitre (n+1))/(cloitre n)) - 1
</code></pre>
<p>Ok, now rowland and cloitre are curried functions, since they have free variables, and we can get any index of it's sequence without knowing or worrying about f_recurrence.</p>
|
<p>I gave a good example of simulating currying in C# <a href="http://azurecoding.net/blogs/brownie/archive/2010/01/18/accounting-for-cost-of-sales-with-currying.aspx" rel="nofollow">on my blog</a>. The gist is that you can create a function that is closed over a parameter (in my example create a function for calculating the sales tax closed over the value of a given municipality)out of an existing multi-parameter function.</p>
<p>What is appealing here is instead of having to make a separate function specifically for calculating sales tax in Cook County, you can create (and reuse) the function dynamically at runtime.</p>
| 2,988
|
<p>On my Mac I've got two versions of Cura installed, in <code>/Applications/Cura250</code> and <code>/Applications/Cura262</code>.</p>
<p>How can I copy my printer and profile settings from Cura 2.5 to Cura 2.6?</p>
|
<p>Much of the software used in 3D printing is open-source, and so are some slicers. Cura, for instance, does (or did, this source code is from an older branch) its print time estimation in <a href="https://github.com/smorloc/Curation/blob/master/Cura/util/gcodeInterpreter.py" rel="noreferrer">gcodeInterpreter.py</a>.</p>
<p>The relevant portion of the source code is (simplified and with many lines removed for clarity):</p>
<pre><code> totalMoveTimeMinute = 0.0
pos = util3d.Vector3()
for line in gcodeFile:
G = self.getCodeInt(line, 'G')
if G is not None:
if G == 0 or G == 1: #Move
x = self.getCodeFloat(line, 'X')
y = self.getCodeFloat(line, 'Y')
z = self.getCodeFloat(line, 'Z')
e = self.getCodeFloat(line, 'E')
f = self.getCodeFloat(line, 'F')
oldPos = pos.copy()
pos.x = x
pos.y = y
pos.z = z
feedrate = f
currentE = e
totalMoveTimeMinute += (oldPos - pos).vsize() / feedRate
</code></pre>
<p>As you can see, (this version of) Cura simply:</p>
<ul>
<li><p>Loops over all the G-code instructions,</p></li>
<li><p>Computes the length of each move (in X/Y/Z) and divides that by the feedrate to get the time that move will take,</p></li>
<li><p>Sums this up over all the moves.</p></li>
</ul>
<p>and does not take into account:</p>
<ul>
<li><p>Acceleration or deceleration. It assumes the printer is always operating at the maximum feedrate,</p></li>
<li><p>The length of filament extruded. The feedrate is the speed for the move in (X,Y,Z,E), but Cura only looks at (X,Y,Z).</p></li>
<li><p>The time it takes to heat up the print bed/hotend or homing/autoleveling,</p></li>
<li><p>The effects of the printer slowing down if moves can not be read (from USB/SD-card) sufficiently fast (though this would be rather hard to include in any estimate).</p></li>
</ul>
<p>The accuracy of this estimate can be arbitrarily bad if the feedrate is set to some unrealistic value.</p>
<p>Newer versions of Cura use a much more advanced time estimate method, and it can be found in <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/timeEstimate.cpp" rel="noreferrer">timeEstimate.cpp</a>. It is much more complicated, and actually takes jerk/acceleration/deceleration into account. It is much more accurate.</p>
<p>We know <em>exactly</em> how 3D (open source) 3D printer firmwares work, so estimating print time is as easy as simulating execution of the G-code by your given firmware. There is no reason you can't get a really good estimation (if you take into account all of the intricacies of your given firmware's acceleration/deceleration techniques) but writing the code for it is rather involved.</p>
|
<p>Generally speaking, the typical algorithm takes into account the slicer's speed settings for specific features of the build, such as infill, perimeters, top/bottom layers, etc. The distance traveled by the nozzle at a specific speed for each feature is also part of the equations involved. There are some rather vague portions of the nozzle movement based on acceleration and other factors which makes the calculations less accurate.</p>
<blockquote>
<p>How accurate is it?</p>
</blockquote>
<p>Not too accurate. My experience with three different slicers is that it's never been within better than ten percent. I believe the various combinations of features of a build are not going to be identical from one model to the next, preventing even a ballpark figure to be created from previous builds.</p>
| 665
|
<p>I printed a lot of models in last month. I spent 2 kg filament in total. I want to know how many hours have been passed while printing. As far as I read, 1 kg PLA (1.75 mm) is about 110 meters long. My default print speed is 70 mm/s. The nozzle diameter is 0.4 mm. The nozzle multiplier in the simplify3d is 0.9 .</p>
<p>In a very basic math,
220÷(0.7×0.04÷0.0175×0.9)=~ 153 hours.</p>
<p>Is this correct?</p>
|
<p>Your formula doesn't seem to take into account two important factors: layer height and average speed.</p>
<p>Do the math differently:</p>
<p>voumetric flow rate [mm^3/s] = layer height [mm] * line width [mm] * speed [mm/s]</p>
<p>For example, 0.2 * 0.45 * 70 = 6.3 mm^3/s</p>
<p>which is realistic, the extruder on the Ender 3 cannot go much faster than that reliably.</p>
<p>PLA weighs 1.24 g/cm^3 = 0.00124 g/mm^3</p>
<p>To extrude 1 kg you need 1000/(0.00124 * 6.3) = 35 hours (70 for 2 kg).</p>
<p>However the printer does not reach 70 mm except on straight long moves, the average speed may be lower or much lower depending on what you print.</p>
<p>If you print technical parts with straight edges, maybe you can multiply by 1.5 (50 hours/kg), but if you print models and small statues or similar you may need to double it (70 hours/kg).</p>
<p>I use Klipper as firmware and I have a macro which keeps track of printing time and filament length used.</p>
|
<p>Your math looks correct, and is also a good approximation for what I've seen in the first few weeks with my own Ender 3.</p>
<p>Another way to calculate (to check yourself) is to calculate the volume extruded (nozzle area times extrusion percentage times print speed -- be sure you convert everything to the same units!) in a given second, multiply by the density of your filament (common PLA runs about 1.2 g/cm^3), and get a rough figure for how long it takes to print a kilogram of filament. Your actual print time will always be higher than this approximation, because there are moves during which the extruder isn't running, infill is often set to lower extrusion level, and of course there's setup and cleanup time to account for.</p>
| 1,950
|
<p>We are currently using MySQL for a product we are building, and are keen to move to PostgreSQL as soon as possible, primarily for licensing reasons.</p>
<p>Has anyone else done such a move? Our database is the lifeblood of the application and will eventually be storing TBs of data, so I'm keen to hear about experiences of performance improvements/losses, major hurdles in converting SQL and stored procedures, etc.</p>
<p>Edit: Just to clarify to those who have asked why we don't like MySQL's licensing. We are developing a commercial product which (currently) depends on MySQL as a database back-end. Their license states we need to pay them a percentage of our list price per installation, and not a flat fee. As a startup, this is less than appealing.</p>
|
<p>Steve, I had to migrate my old application the way around, that is PgSQL->MySQL. I must say, you should consider yourself lucky ;-)
Common gotchas are:</p>
<ul>
<li>SQL is actually pretty close to language standard, so you may suffer from MySQL's dialect you already know</li>
<li>MySQL quietly truncates varchars that exceed max length, whereas Pg complains - quick workaround is to have these columns as 'text' instead of 'varchar' and use triggers to truncate long lines</li>
<li>double quotes are used instead of reverse apostrophes</li>
<li>boolean fields are compared using IS and IS NOT operators, however MySQL-compatible INT(1) with = and <> is still possible</li>
<li>there is no REPLACE, use DELETE/INSERT combo</li>
<li>Pg is pretty strict on enforcing foreign keys integrity, so don't forget to use ON DELETE CASCADE on references</li>
<li>if you use PHP with PDO, remember to pass a parameter to lastInsertId() method - it should be sequence name, which is created usually this way: [tablename]_[primarykeyname]_seq</li>
</ul>
<p>I hope that helps at least a bit. Have lots of fun playing with Postgres!</p>
|
<p>We did a move from a MySQL3 to PostgreSQL 8.2 then 8.3. PostgreSQL has the basic of SQL and a lot more so if your MYSQL do not use fancy MySQL stuff you will be OK.</p>
<p>From my experience, our MySQL database (version 3) doesn't have Foreign Key... PostgreSQL lets you have them, so we had to change that... and it was a good thing and we found some mistake.</p>
<p>The other thing that we had to change was the coding (C#) connector that wasn't the same in MySQL. The MySQL one was more stable than the PostgreSQL one. We still have few problems with the PostgreSQL one.</p>
| 3,829
|
<p>I'm looking for suggestions on possible IPC mechanisms that are:</p>
<ul>
<li><strong>Cross platform</strong> (Win32 and Linux at least)</li>
<li>Simple to implement in <strong>C++</strong> as well as the <strong>most common scripting languages</strong> (perl, ruby, python, etc).</li>
<li>Finally, <strong>simple to use</strong> from a programming point of view!</li>
</ul>
<p>What my options are? I'm programming under Linux, but I'd like what I write to be portable to other OSes in the future. I've thought about using sockets, named pipes, or something like DBus.</p>
|
<p>In terms of speed, the best cross-platform IPC mechanism will be pipes. That assumes, however, that you want cross-platform IPC on the same machine. If you want to be able to talk to processes on remote machines, you'll want to look at using sockets instead. Luckily, if you're talking about TCP at least, sockets and pipes behave pretty much the same behavior. While the APIs for setting them up and connecting them are different, they both just act like streams of data.</p>
<p>The difficult part, however, is not the communication channel, but the messages you pass over it. You really want to look at something that will perform verification and parsing for you. I recommend looking at Google's <a href="http://code.google.com/apis/protocolbuffers/docs/overview.html" rel="noreferrer">Protocol Buffers</a>. You basically create a spec file that describes the object you want to pass between processes, and there is a compiler that generates code in a number of different languages for reading and writing objects that match the spec. It's much easier (and less bug prone) than trying to come up with a messaging protocol and parser yourself.</p>
|
<p>Python has a pretty good IPC library: see <a href="https://docs.python.org/2/library/ipc.html" rel="nofollow noreferrer"><a href="https://docs.python.org/2/library/ipc.html" rel="nofollow noreferrer">https://docs.python.org/2/library/ipc.html</a></a></p>
| 8,558
|
<p>So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based on the fact that I added an <code>std::string</code> to a class and assigning it a value from another <code>std::string</code>:</p>
<pre><code>std::string hello = "Hello, world.\n";
/* exampleString = "Hello, world.\n" would work fine. */
exampleString = hello;
</code></pre>
<p>crashes on my system with a stack dump. So basically I need to <strong>stop</strong> and go through all my code and memory management stuff and find out where I've screwed up. The codebase is still small (about 1000 lines), so this is easily do-able. </p>
<p>Still, I'm over my head with this kind of stuff, so I thought I'd throw it out there. I'm on a Linux system and have poked around with <code>valgrind</code>, and while not knowing completely what I'm doing, it did report that the <code>std::string</code>'s destructor was an invalid free. I have to admit to getting the term 'Heap Corruption' from a Google search; any general purpose articles on this sort of stuff would be appreciated as well.</p>
<p>(In before <code>rm -rf ProjectDir</code>, do again in C# :D)</p>
<p>EDIT:
I haven't made it clear, but what I'm asking for are ways an advice of diagnosing these sort of memory problems. I know the std::string stuff is right, so it's something I've done (or a bug, but there's Not A Problem With Select). I'm sure I could check the code I've written up and you very smart folks would see the problem in no time, but I want to add this kind of code analysis to my 'toolbox', as it were.</p>
|
<p>These are relatively cheap mechanisms for possibly solving the problem:</p>
<ol>
<li>Keep an eye on my <a href="https://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate">heap corruption question</a> - I'm updating with the answers as they shake out. The first was balancing <code>new[]</code> and <code>delete[]</code>, but you're already doing that.</li>
<li>Give <a href="http://valgrind.org/" rel="nofollow noreferrer">valgrind</a> more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents.</li>
<li>Think about using the <a href="http://code.google.com/p/google-perftools/" rel="nofollow noreferrer">Google Performance Tools</a> as a replacement malloc/new.</li>
<li>Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal"</li>
<li>You're not <code>assert()</code>ing enough in your code. How do I know that without having seen it? Like flossing, no-one <code>assert()</code>s enough in their code. Add in a validation function for your objects and call that on method start and method end.</li>
<li>Are you <a href="http://gcc.gnu.org/onlinedocs/gcc-4.3.0/cpp/Invocation.html#Invocation" rel="nofollow noreferrer">compiling -wall</a>? If not, do so.</li>
<li>Find yourself a lint tool like <a href="http://www.gimpel.com/" rel="nofollow noreferrer">PC-Lint</a>. A small app like yours might fit in the <a href="http://gimpel-online.com/cgi-bin/genPage.py?srcFile=diy.cpp&cgiScript=analyseCode.py&title=Blank+Slate+(C%2B%2B)+&intro=An+empty+page+in+which+to+write+your+own+C%2B%2B+code.&compilerOption=co-gcc.lnt+co-gnu3.lnt&includeOption=%7B%7BquotedIncludeOption%7D%7D" rel="nofollow noreferrer">PC-lint demo</a> page, meaning no purchase for you!</li>
<li>Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers.</li>
<li>Stop using arrays. Use a <a href="http://en.wikipedia.org/wiki/Vector_(STL)" rel="nofollow noreferrer">vector</a> instead.</li>
<li>Don't use raw pointers. Use a <a href="http://en.wikipedia.org/wiki/Smart_pointer" rel="nofollow noreferrer">smart pointer</a>. Don't use <code>auto_ptr</code>! That thing is... surprising; its semantics are very odd. Instead, choose one of the <a href="http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/smart_ptr.htm" rel="nofollow noreferrer">Boost smart pointers</a>, or something out of <a href="http://en.wikipedia.org/wiki/Loki_(C%2B%2B)" rel="nofollow noreferrer">the Loki library</a>.</li>
</ol>
|
<p>As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize/assign it that way. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context.</p>
<p>Question: Is exampleString a pointer to a string object created with new?</p>
| 2,906
|
<p>With Hibernate, can you create a composite ID where one of the columns you are mapping to the ID can have null values?</p>
<p>This is to deal with a legacy table that has a unique key which can have null values but no primary key.</p>
<p>I realise that I could just add a new primary key column to the table, but I'm wondering if there's any way to avoid doing this.</p>
|
<p>No. Primary keys can not be null.</p>
|
<p>Why would you want to do that? Your composite ID should map the primary key of your table, and it doesn't sound wise to put null values in a key, does it?</p>
<p><strong>EDIT:</strong> Hibernate does not allow to do so; you might put the property outside the key and tweak the DAO a little to take the field into account wherever necessary</p>
| 9,637
|
<p>Every now and then I'll have a problem with layer shift. Solving this is a separate issue, but it occurred to me: most of the time when this happens I notice right away because of the noise. What if there were an easy to to pause the print, re-home the X/Y axis (not Z), and then resume. I'd only have one layer that was a bit off. Sometimes that's enough to ruin the print but sometimes I could clean up with a razor knife later and just live with the small scarring and weakness.</p>
<p>Is there a way to do this during a print? I suspect it might require support within the printer (or print tool like OctoPrint), and might also depend on how the print is sliced in terms of knowing absolute vs relative coordinates at any given moment.</p>
|
<p>Have you tried this? It should just work, at least if you're using software like Octoprint to control the printer over serial interface rather than print-from-SD-card on the printer itself. In such a setup you're free to submit whatever commands (in particular, <code>G28 X Y</code>) you like while the print is paused. You'll need it setup to save and restore position across pause/resume, or the next command executed might start from the wrong starting position; this would be no problem if it's a travel command, but if it's an extrusion move it would make a mess.</p>
<p>If you're using the printer's builtin pause/resume functionality, I'm not sure whether it will work. It mainly depends on whether it <em>lets you</em> access the homing function while paused. If not this is more of a logic limitation than any fundamental incapability, and could be fixed in the firmware.</p>
|
<p>Repetier software has a Pause button and works very well. I use it to change filament color in mid-print. When pause is invoked manual moves and homing of all three axes are available.
In my case, after pausing I quickly home X and Y so the nozzle is not over the in-progress print in case of oozing during the filament change. I also move +10 mm on the Z axis to provide a little working space. When resuming, the print head moves to exactly where it was interrupted and goes on as before.
I can't see any reason a pause and home scheme wouldn't be an option after a minor layer shift.</p>
| 1,929
|
<p>The art in question is <a href="https://www.instagram.com/p/CIfsO2ZD7Rj/" rel="nofollow noreferrer">https://www.instagram.com/p/CIfsO2ZD7Rj/</a> . I Think the concept artist, Jean Giraud, is dead.</p>
|
<p>While better fitted to our friends at <a href="https://law.stackexchange.com/questions/tagged/copyright">law.SE</a>, the general gist is: <strong>No.</strong></p>
<p>Art is protected by copyright, and any adaption (<em>derivative work</em>) requires the OK from the right holders <em>per se</em>. Only 70-75 years after the death of the author (or publication for company works), a work enters the <em>public domain</em> and the copyright expires.</p>
<p>There are some exceptions (<em>fair use/fair dealing/</em>...), but <em>media transformation</em> is not one of them.</p>
<p>Giraud died in 2012, his estate or heirs - or whoever he/they sold the commercial rights to - own the right to ok derivative Works till around 2087.</p>
|
<p>This is something that might have a precedent, where the line is blurry, someone might have already tried, and in that case the judge's decision in that court case is the official interpretation of the law towards that specific scenario.</p>
<p>There might also be definitive laws regarding "derived works"...</p>
<p>Like the others, I would ask the Law SE for help.</p>
| 1,794
|
<p>I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there!</p>
<p>Suppose I have the following XML (using e4x):</p>
<pre><code>var xml:XML = <root><example>foo</example></root>
</code></pre>
<p>I can change the contents of the example node using the following code:</p>
<pre><code>xml.example = "bar";
</code></pre>
<p>However, if I have this:</p>
<pre><code>var xml:XML = <root>foo</root>
</code></pre>
<p>How do i change the contents of the root node?</p>
<pre><code>xml = "bar";
</code></pre>
<p>Obviously doesn't work as I'm attempting to assign a string to an XML object.</p>
|
<p>It seems you confuse variables for the values they contain. The assignment</p>
<pre><code>node = textInput.text;
</code></pre>
<p>changes the value the <em>variable</em> <code>node</code> points to, it doesn't change anything with the object that <code>node</code> currently points to. To do what you want to do you can use the <code>setChildren</code> method of the <code>XML</code> class:</p>
<pre><code>node.setChildren(textInput.text)
</code></pre>
|
<p>If you're trying to change the root element of a document, you don't really need to-- just throw out the existing document and replace it. Alternatively, just wrap your element in a more proper root element (you shouldn't be editing the root node anyway) and you'd be set.</p>
<p>Of course, that doesn't answer your question. There's an ugly JS hack that can do what you want, but bear in mind that it's likely far slower than doing the above. Anyway, here it is:</p>
<pre><code>var xml = <root>foo</root>; // </fix_syntax_highlighter>
var parser = new DOMParser();
var serializer = new XMLSerializer();
// Parse xml as DOM document
// Must inject "<root></root>" wrapper because
// E4X's toString() method doesn't give it to us
// Not sure if this is expected behaviour.. doesn't seem so to me.
var xmlDoc = parser.parseFromString("<root>" +
xml.toString() + "</root>", "text/xml");
// Make the change
xmlDoc.documentElement.firstChild.nodeValue = "CHANGED";
// Serialize back to string and then to E4X XML()
xml = new XML(serializer.serializeToString(xmlDoc));
</code></pre>
<p>You can ignore the fix_syntax_highlighter comment.</p>
| 8,744
|
<p>My OctPrint and Monoprice Maker Select IIIP (A Wanhao i3 Duplicator Plus clone) were working fine, but suddenly today the hot end won't heat up anymore. I tried disconnecting the OctoPrint USB and resetting the printer power, and it still couldn't heat up the extruder, such as through the filament menu.</p>
<p>But then it got weird.</p>
<p>I left it off for a few hours and turned it on to see if it was getting 12 V to the hot end, and it was heating up again! So I plugged in the OctopPrint and we're back to square one, the extruder has just been cooling down. I know the thermistor is working, because it's accurately following the temp, such as following the cooldown after the heating stopped working again.</p>
<p>Is it possibly I have a dead hot end and for some reason it temporarily started to work again? Maybe an intermittent short?</p>
<p>I guess the next step is to open up the base and look at the connector to the motherboard, and or measure for 12 V</p>
|
<p>This has nothing to do with OctoPrint itself, the cause is related to the printer itself, not the print server running the printer.</p>
<p>This is a pretty commonly seen issue (usually seen at heated beds), this is caused by faulty wires/cables or connectors. This usually happens after a vast period of usage. You should (periodically) check the cables and connectors. You could even test if the heater cartridge works by connecting it directly to the power supply.</p>
<p>Considering the limited amount of costs involved to replace the heater cartridge, it is preferred to replace the heater with a similar specification heater element (voltage and power).</p>
|
<p>Measure your heater resistance of the heater in the heater block. Approximate heater resistances are 4.8 Ω for 12 V 30 W and 3.6 Ω for 12 V 40 W. See <a href="https://3dprinting.stackexchange.com/questions/10695/proper-hotend-heater-for-reprap-x400-pro-v3">Proper hotend heater for Reprap x400 Pro V3</a></p>
<p>Note: you could have a heater measuring the correct resistance but have a poor connection in one of the connectors.</p>
| 2,023
|
<p>Typical way of creating a <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="noreferrer">CSV</a> string (pseudocode):</p>
<ol>
<li>Create a CSV container object (like a StringBuilder in C#).</li>
<li>Loop through the strings you want to add appending a comma after each one.</li>
<li>After the loop, remove that last superfluous comma.</li>
</ol>
<p>Code sample:</p>
<pre><code>public string ReturnAsCSV(ContactList contactList)
{
StringBuilder sb = new StringBuilder();
foreach (Contact c in contactList)
{
sb.Append(c.Name + ",");
}
sb.Remove(sb.Length - 1, 1);
//sb.Replace(",", "", sb.Length - 1, 1)
return sb.ToString();
}
</code></pre>
<p>I like the idea of adding the comma by checking if the container is empty, but doesn't that mean more processing as it needs to check the length of the string on each occurrence?</p>
<p>I feel that there should be an easier/cleaner/more efficient way of removing that last comma. Any ideas?</p>
|
<p>You could use <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query#LINQ_to_Objects" rel="noreferrer">LINQ to Objects</a>:</p>
<pre><code>string [] strings = contactList.Select(c => c.Name).ToArray();
string csv = string.Join(",", strings);
</code></pre>
<p>Obviously that could all be done in one line, but it's a bit clearer on two.</p>
|
<p>How about tracking whether you are on the first item, and only add a comma <em>before</em> the item if it is not the first one.</p>
<pre><code>public string ReturnAsCSV(ContactList contactList)
{
StringBuilder sb = new StringBuilder();
bool isFirst = true;
foreach (Contact c in contactList) {
if (!isFirst) {
// Only add comma before item if it is not the first item
sb.Append(",");
} else {
isFirst = false;
}
sb.Append(c.Name);
}
return sb.ToString();
}
</code></pre>
| 2,644
|
<p>Ok, so, my visual studio is broken. I say this NOT prematurely, as it was my first response to see where I had messed up in my code. When I add controls to the page I can't reference all of them in the code behind. Some of them I can, it seems that the first few I put on a page work, then it just stops. </p>
<p>I first thought it may be the type of control as initially I was trying to reference a repeater inside an update panel. I know I am correctly referencing the code behind in my aspx page. But just in case it was a screw up on my part I started to recreate the page from scratch and this time got a few more controls down before VS stopped recognizing my controls.</p>
<p>After creating my page twice and getting stuck I thought maybe it was still the type of controls. I created a new page and just threw some labels on it. No dice, build fails when referencing the control from the code behind. </p>
<p>In a possibly unrelated note when I switch to the dreaded "design" mode of the aspx pages VS 2008 errors out and restarts. </p>
<p>I have already put a trouble ticket in to Microsoft. I uninstalled all add-ins, I reinstalled visual studio. </p>
<p>Anyone that wants to see my code just ask, but I am using the straight WYSIWYG visual studio "new aspx page" nothing fancy.</p>
<p>I doubt anyone has run into this, but have you? </p>
<p>Has anyone had success trouble shooting these things with Microsoft? Any way to expedite this ticket without paying??? I have been talking to a rep from Microsoft for days with no luck yet and I am dead in the water. </p>
<hr>
<p><strong>Jon Limjap:</strong> I edited the title to both make it clear and descriptive <em>and</em> make sure that nobody sees it as offensive. "Foo-barred" doesn't exactly constitute a proper question title, although your question is clearly a valid one.</p>
|
<p>try clearing your local VS cache. find your project and delete the folder. the folder is created by VS for what reason I honestly don't understand. but I've had several occasions where clearing it and doing a re-build fixes things... hope this is all that you need as well.</p>
<p>here</p>
<pre><code>%Temp%\VWDWebCache
</code></pre>
<p>and possibly here</p>
<pre><code>%LocalAppData%\Microsoft\WebsiteCache
</code></pre>
|
<p>For me, deleting/renaming the files in the following location worked:</p>
<pre><code>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myvirtualwebsite\e331e0a9
</code></pre>
| 5,961
|
<p>Whenever I show a ModalPopupExtender on my Sharepoint site, the popup shown creates both horizontal and vertical scrollbars. If you scroll all the way to the end of the page, the scrollbar refreshes, and there is more page to scroll through. Basically, I think the popup is setting its bounds beyond the end of the page. Has anyone run into this? Searching Google, it seems this may be a known problem, but I haven't found a good solution that doesn't include recompiling AJAX, which my boss will not allow.</p>
|
<p>Hacky answer would be to grab the IE Developer Toolbar, find the tag that has the scrollbar, and alter your CSS file to add the overflow:hidden property to it.</p>
|
<p>Hacky answer would be to grab the IE Developer Toolbar, find the tag that has the scrollbar, and alter your CSS file to add the overflow:hidden property to it.</p>
| 4,753
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.