instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable</p> <p>IE:</p> <pre><code>public class CollectionBase : IEnumerable </code></pre> <p>and then would derive their Business Object collections from that.</p> <pre><code>public class BusinessObjectCollection : CollectionBase </code></pre> <p>Now with the generic list class, does anyone just use that instead? I've found that I use a compromise of the two techniques:</p> <pre><code>public class BusinessObjectCollection : List&lt;BusinessObject&gt; </code></pre> <p>I do this because I like to have strongly typed names instead of just passing Lists around.</p> <p>What is <strong>your</strong> approach?</p>
<p>I am generally in the camp of just using a List directly, unless for some reason I need to encapsulate the data structure and provide a limited subset of its functionality. This is mainly because if I don't have a specific need for encapsulation then doing it is just a waste of time.</p> <p>However, with the aggregate initializes feature in C# 3.0, there are some new situations where I would advocate using customized collection classes.</p> <p>Basically, C# 3.0 allows any class that implements <code>IEnumerable</code> and has an Add method to use the new aggregate initializer syntax. For example, because Dictionary defines a method Add(K key, V value) it is possible to initialize a dictionary using this syntax:</p> <pre><code>var d = new Dictionary&lt;string, int&gt; { {"hello", 0}, {"the answer to life the universe and everything is:", 42} }; </code></pre> <p>The great thing about the feature is that it works for add methods with any number of arguments. For example, given this collection:</p> <pre><code>class c1 : IEnumerable { void Add(int x1, int x2, int x3) { //... } //... } </code></pre> <p>it would be possible to initialize it like so:</p> <pre><code>var x = new c1 { {1,2,3}, {4,5,6} } </code></pre> <p>This can be really useful if you need to create static tables of complex objects. For example, if you were just using <code>List&lt;Customer&gt;</code> and you wanted to create a static list of customer objects you would have to create it like so:</p> <pre><code>var x = new List&lt;Customer&gt; { new Customer("Scott Wisniewski", "555-555-5555", "Seattle", "WA"), new Customer("John Doe", "555-555-1234", "Los Angeles", "CA"), new Customer("Michael Scott", "555-555-8769", "Scranton PA"), new Customer("Ali G", "", "Staines", "UK") } </code></pre> <p>However, if you use a customized collection, like this one:</p> <pre><code>class CustomerList : List&lt;Customer&gt; { public void Add(string name, string phoneNumber, string city, string stateOrCountry) { Add(new Customer(name, phoneNumber, city, stateOrCounter)); } } </code></pre> <p>You could then initialize the collection using this syntax:</p> <pre><code>var customers = new CustomerList { {"Scott Wisniewski", "555-555-5555", "Seattle", "WA"}, {"John Doe", "555-555-1234", "Los Angeles", "CA"}, {"Michael Scott", "555-555-8769", "Scranton PA"}, {"Ali G", "", "Staines", "UK"} } </code></pre> <p>This has the advantage of being both easier to type and easier to read because their is no need to retype the element type name for each element. The advantage can be particularly strong if the element type is long or complex. </p> <p>That being said, this is only useful if you need static collections of data defined in your app. Some types of apps, like compilers, use them all the time. Others, like typical database apps don't because they load all their data from a database.</p> <p>My advice would be that if you either need to define a static collection of objects, or need to encapsulate away the collection interface, then create a custom collection class. Otherwise I would just use <code>List&lt;T&gt;</code> directly.</p>
<p>this is the way:</p> <p>return arrays, accept <code>IEnumerable&lt;T&gt;</code></p> <p>=)</p>
4,183
<p>Can anyone give me some pointers on how to display the results of an XPath query in a textbox using code (C#)? My datascource <i>seems</i> to (re)bind correctly once the XPath query has been applied, but I cannot find how to get at the resulting data.<br /><br /> Any help would be greatly appreciated.</p>
<p>XMLDataSource is designed to be used with data-bound controls. ASP.NET's TextBox is not a data-bound control. So to accomplish what you want you either have to find a textbox control with data binding or display the result in some other way. </p> <p>For example, you could use a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx" rel="nofollow noreferrer">Repeater control</a> and create your own rendering template for it. </p> <pre><code>&lt;asp:Repeater id="Repeater1" runat="server" datasource="XMLds"&gt; &lt;ItemTemplate&gt; &lt;input type="text" value="&lt;%# XPath("&lt;path to display field&gt;")%&gt;" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
<p>Some more information would be nice to have to be able to give you a decent answer. Do you have any existing code snippets you could publish here?</p> <p>The general idea is to use the XmlDataSource.XPath property as a filter on the XmlDataSource.Data property. Did you try displaying the contents of the Data prop in your textbox?</p>
7,448
<p>I frequently have problems dealing with <code>DataRows</code> returned from <code>SqlDataAdapters</code>. When I try to fill in an object using code like this:</p> <pre><code>DataRow row = ds.Tables[0].Rows[0]; string value = (string)row; </code></pre> <p>What is the best way to deal with <code>DBNull's</code> in this type of situation.</p>
<p>Nullable types are good, but only for types that are not nullable to begin with.</p> <p>To make a type "nullable" append a question mark to the type, for example: </p> <pre><code>int? value = 5; </code></pre> <p>I would also recommend using the "<code>as</code>" keyword instead of casting. You can only use the "as" keyword on nullable types, so make sure you're casting things that are already nullable (like strings) or you use nullable types as mentioned above. The reasoning for this is </p> <ol> <li>If a type is nullable, the "<code>as</code>" keyword returns <code>null</code> if a value is <code>DBNull</code>.</li> <li>It's <a href="http://www.codeproject.com/Articles/8052/Type-casting-impact-over-execution-performance-in" rel="noreferrer">ever-so-slightly faster than casting</a> though <a href="https://stackoverflow.com/a/496167/392">only in certain cases</a>. This on its own is never a good enough reason to use <code>as</code>, but coupled with the reason above it's useful.</li> </ol> <p>I'd recommend doing something like this</p> <pre><code>DataRow row = ds.Tables[0].Rows[0]; string value = row as string; </code></pre> <p>In the case above, if <code>row</code> comes back as <code>DBNull</code>, then <code>value</code> will become <code>null</code> instead of throwing an exception. Be aware that if your DB query changes the columns/types being returned, <strong>using <code>as</code> will cause your code to silently fail</strong> and make values simple <code>null</code> instead of throwing the appropriate exception when incorrect data is returned so it is recommended that you have tests in place to validate your queries in other ways to ensure data integrity as your codebase evolves.</p>
<p>If you are concerned with getting DBNull when expecting strings, one option is to convert all the DBNull values in the DataTable into empty string.</p> <p>It is quite simple to do it but it would add some overhead especially if you are dealing with large DataTables. Check this <a href="http://www.ddejan.com/post/2008/10/24/Cleaning-DBNull-values-in-a-DataTable.aspx" rel="nofollow noreferrer">link</a> that shows how to do it if you are interested</p>
4,640
<p>Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, how?</p>
<p>There is no <strong>connection pooling</strong> in php.<br> <strong>mysql_pconnect</strong> and <strong>connection pooling</strong> are two different things. There are many problems connected with <code>mysql_pconnect</code> and first you should read the manual and carefully use it, but this is not connection pooling.</p> <p>Connection pooling is a technique where the application server manages the connections. When the application needs a connection it asks the application server for it and the application server returns one of the pooled connections if there is one free.</p> <p>We can do connection scaling in php for that please go through following link: <a href="http://www.oracle.com/technetwork/articles/dsl/white-php-part1-355135.html" rel="noreferrer">http://www.oracle.com/technetwork/articles/dsl/white-php-part1-355135.html</a></p> <p>So no connection pooling in php.</p> <p>As Julio said apache releases all resources when the request ends for the current reques. You can use mysql_pconnect but you are limited with that function and you must be very careful. Other choice is to use singleton pattern, but none of this is pooling.</p> <p>This is a good article: <a href="https://blogs.oracle.com/opal/highly-scalable-connection-pooling-in-php" rel="noreferrer">https://blogs.oracle.com/opal/highly-scalable-connection-pooling-in-php</a></p> <p>Also read this one <a href="http://www.apache2.es/2.2.2/mod/mod_dbd.html" rel="noreferrer">http://www.apache2.es/2.2.2/mod/mod_dbd.html</a></p>
<p>You cannot instantiate connection pools manually.</p> <p>But you can use the "built in" connection pooling with the <a href="http://de.php.net/manual/en/function.mysql-pconnect.php" rel="nofollow noreferrer">mysql_pconnect</a> function.</p>
6,090
<p>How much traffic can one web server handle? What's the best way to see if we're beyond that?</p> <p>I have an ASP.Net application that has a couple hundred users. Aspects of it are fairly processor intensive, but thus far we have done fine with only one server to run both SqlServer and the site. It's running Windows Server 2003, 3.4 GHz with 3.5 GB of RAM. </p> <p>But lately I've started to notice slows at various times, and I was wondering what's the best way to determine if the server is overloaded by the usage of the application or if I need to do something to fix the application (I don't really want to spend a lot of time hunting down little optimizations if I'm just expecting too much from the box).</p>
<p>What you need is some info on <a href="http://msdn.microsoft.com/en-us/library/ms979198.aspx" rel="noreferrer">Capacity Planning</a>..</p> <p>Capacity planning is the process of planning for growth and forecasting peak usage periods in order to meet system and application capacity requirements. It involves extensive performance testing to establish the application's resource utilization and transaction throughput under load. First, you measure the number of visitors the site currently receives and how much demand each user places on the server, and then you calculate the computing resources (CPU, RAM, disk space, and network bandwidth) that are necessary to support current and future usage levels. </p>
<p>On that hardware, a .NET application should be able to serve about 200-400 requests per second. If you have only a few hundred users, I doubt you are seeing even 2 requests per second, so I think you have a lot of capacity on that box, even with SQL server running.</p> <p>Without know all of the details, I would say <strong>no</strong>, you will not see any performance improvement by adding servers. </p> <p>By the way, if you're not using the <a href="http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx" rel="nofollow noreferrer">Output Cache</a>, I would start there.</p>
8,496
<p>I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers.</p> <p>I'm in the middle of designing an app that does something like portfolio management. The design I have so far is</p> <ul> <li>Problem: a problem that needs to be solved</li> <li>Solution: a proposed solution to one or more problems</li> <li>Relationship: a relationship among two problems, two solutions, or a problem and a solution. Further broken down into: <ul> <li>Parent-child - some sort of categorization / tree hierarchy</li> <li>Overlap - the degree to which two solutions or two problems really address the same concept</li> <li>Addresses - the degree to which a problem addresses a solution</li> </ul></li> </ul> <p>My question is about the temporal nature of these things. Problems crop up, then fade. Solutions have an expected resolution date, but that might be modified as they are developed. The degree of a relationship might change over time as problems and solutions evolve.</p> <p>So, the question: what is the best design for versioning of these things so I can get both a current and an historical perspective of my portfolio?</p> <p><em>Later: perhaps I should make this a more specific question, though @Eric Beard's answer is worth an up.</em></p> <p>I've considered three database designs. I'll enough of each to show their drawbacks. My question is: which to pick, or can you think of something better?</p> <h2>1: Problems (and separately, Solutions) are self-referential in versioning.</h2> <pre><code>table problems int id | string name | text description | datetime created_at | int previous_version_id foreign key previous_version_id -&gt; problems.id </code></pre> <p>This is problematic because every time I want a new version, I have to duplicate the entire row, including that long <code>description</code> column.</p> <h2>2: Create a new Relationship type: Version.</h2> <pre><code>table problems int id | string name | text description | datetime created_at </code></pre> <p>This simply moves the relationship from the Problems and Solutions tables into the Relationships table. Same duplication problem, but perhaps a little "cleaner" since I already have an abstract Relationship concept.</p> <h2>3: Use a more Subversion-like structure; move all Problem and Solution attributes into a separate table and version them.</h2> <pre><code>table problems int id table attributes int id | int thing_id | string thing_type | string name | string value | datetime created_at | int previous_version_id foreign key (thing_id, thing_type) -&gt; problems.id or solutions.id foreign key previous_version_id -&gt; attributes.id </code></pre> <p>This means that to load the current version of a Problem or Solution I have to fetch all versions of the attribute, sort them by date and then use the most current. That might not be terrible. What seems really bad to me is that I can't type-check these attributes in the database. That <code>value</code> column has to be free-text. I can make the <code>name</code> column a reference into a separate <code>attribute_names</code> table that has a <code>type</code> column, but that doesn't <em>force</em> the correct type in the <code>attributes</code> table.</p> <p><em>later still: response to @Eric Beard's comments about multi-table foreign keys:</em></p> <p>Alas, what I've described is simplistic: there are only two types of Things (Problems and Solutions). I actually have about 9 or 10 different types of Things, so I'd have 9 or 10 columns of foreign keys under your strategy. I wanted to use single-table inheritance, but the Things have so little in common that it would be <em>extremely</em> wasteful to do combine them into one table.</p>
<p>Hmm, sounds kind of like this site...</p> <p>As far as a database design would go, a versioning system kind of like SVN, where you never actually do any updates, just inserts (with a version number) when things change, might be what you need. This is called MVCC, Multi-Value Concurrency Control. A wiki is another good example of this.</p>
<p>I suppose there's</p> <h2>Option 4: the hybrid</h2> <p>Move the common Thing attributes into a single-inheritance table, then add an <code>custom_attributes</code> table. This makes foreign-keys simpler, reduces duplication, and allows flexibility. It doesn't solve the problems of type-safety for the additional attributes. It also adds a little complexity since there are two ways for a Thing to have an attribute now.</p> <p>If <code>description</code> and other large fields stay in the Things table, though, it also doesn't solve the duplication-space problem.</p> <pre><code>table things int id | int type | string name | text description | datetime created_at | other common fields... foreign key type -&gt; thing_types.id table custom_attributes int id | int thing_id | string name | string value foreign key thing_id -&gt; things.id </code></pre>
3,277
<p>I have a PLA 3D-printed object made of several rings with a diameter of 150 mm and a thickness of 6 mm. The height of each ring is about 30-35 mm but it does not matter so much.</p> <p>I'm looking for a way to keep the rings together (one on top of another). I cannot place anything inside the ring (like a thicker area to host a nut). Most of the rings may have a closed top or bottom, so I cannot access the inner part.</p> <p>I'm using three tabs (at different angles to force the correct alignment) that fit inside matching slots on the counterpart:</p> <p><a href="https://i.stack.imgur.com/VSajN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VSajN.png" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/IiPn8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IiPn8.png" alt="enter image description here" /></a></p> <p>They are a bit stronger than pins and holes due to the greater surface of the base layer, but of course are useful only for alignment.</p> <p>Due to the very small thickness of the ring I cannot place a screw inside them to keep in position, the inner wall cannot hold a screw!</p> <p>I was thinking about L-shaped tabs and slots to fix the rings rotating them a bit, but:</p> <ol> <li>it would not easy to clean the horizontal leg of the slots</li> <li>nothing would prevent to rotate the rings in the opposite way (even accidentally) so the disconnect</li> </ol> <p>For my use-case scenario, I don't need anything too strong. Just avoid to disconnect the rings when taking the object in hands. I tried with magnets but:</p> <ol> <li>to make an acceptable resistance I needed 7-8 per ring (due to their small size)</li> <li>the electronics inside uses Hall sensors so I cannot use magnets!</li> </ol> <p>Any idea?</p>
<h2>[Extruder] feed rate [modifier] is used synonymous to extrusion multiplier</h2> <p>The feed rate of the extruder is the rate at which filament is pushed (fed) into the hotend. An overwrite value that modifies that rate from the normal rate is in most slicers called &quot;extrusion multiplier&quot;.</p> <p>It is a <em>quickfix</em> to manipulate print behavior, especially addressing under extrusion due to various problems, such as mis-sized filament or to compensate for deformability of it compared to the filament the extruder is calibrated for.</p> <p>It is however not a permanent fix. See also <a href="https://3dprinting.stackexchange.com/questions/11074/why-and-how-am-i-supposed-to-change-the-extrusion-multiplier?noredirect=1&amp;lq=1">here</a>, <a href="https://3dprinting.stackexchange.com/questions/6968/slicer-line-width-vs-extrusion-multiplier-for-layer-adhesion?noredirect=1&amp;lq=1">here</a> and <a href="https://3dprinting.stackexchange.com/questions/8382/isnt-using-the-extrusion-multiplier-like-cheating/8384#8384">here.</a></p>
<p>In the context of the linked source (in German <em>&quot;Die Feeding Rate sollte mit 105 % eingestellt werden&quot;</em>), with <em>&quot;a feeding rate of 105 %&quot;</em> is meant the extrusion multiplier (there is no reference in the source to Cura). This is explained in <a href="https://3dprinting.stackexchange.com/a/20006">this answer</a>. The answer is correct for the translation, but should have warned for the incorrect wording. Technically, <em>feed rate</em> is <strong>not</strong> a synonym for <em>extrusion multiplier</em>.</p> <p>The source is wrongly using the term <em>&quot;feeding rate&quot;</em>, feeding rate is the rate at which all steppers are scaled, not solely the E (extruder) stepper.</p> <p>In G-code this is found to be the <code>F</code> parameter, e.g. in <code>G1 F1200 X76.468 Y148.947 E0.0264</code> the feed rate of 1200 mm/min is applied on all steppers, in this example X, Y and E. Changing the feed rate changes all speeds for all steppers simultaneously. This is found in G-code <a href="https://marlinfw.org/docs/gcode/M220.html" rel="nofollow noreferrer"><code>M220</code></a>.</p> <p>The extrusion multiplier (or known as <em>&quot;Flow Percentage&quot;</em>) only acts on the E stepper motor, this is not reflected in the G-code, but adjusted in the firmware planner. The G-code to adjust the flow percentage is <a href="https://marlinfw.org/docs/gcode/M221.html" rel="nofollow noreferrer"><code>M221</code></a></p>
2,212
<p>I have a generic method defined like this:</p> <pre><code>public void MyMethod&lt;T&gt;(T myArgument) </code></pre> <p>The first thing I want to do is check if the value of myArgument is the default value for that type, something like this:</p> <pre><code>if (myArgument == default(T)) </code></pre> <p>But this doesn't compile because I haven't guaranteed that T will implement the == operator. So I switched the code to this:</p> <pre><code>if (myArgument.Equals(default(T))) </code></pre> <p>Now this compiles, but will fail if myArgument is null, which is part of what I'm testing for. I can add an explicit null check like this:</p> <pre><code>if (myArgument == null || myArgument.Equals(default(T))) </code></pre> <p>Now this feels redundant to me. ReSharper is even suggesting that I change the myArgument == null part into myArgument == default(T) which is where I started. Is there a better way to solve this problem?</p> <p>I need to support <b>both</b> references types and value types.</p>
<p>To avoid boxing, the best way to compare generics for equality is with <code>EqualityComparer&lt;T&gt;.Default</code>. This respects <code>IEquatable&lt;T&gt;</code> (without boxing) as well as <code>object.Equals</code>, and handles all the <code>Nullable&lt;T&gt;</code> "lifted" nuances. Hence:</p> <pre><code>if(EqualityComparer&lt;T&gt;.Default.Equals(obj, default(T))) { return obj; } </code></pre> <p>This will match:</p> <ul> <li>null for classes</li> <li>null (empty) for <code>Nullable&lt;T&gt;</code></li> <li>zero/false/etc for other structs</li> </ul>
<p>Don't know if this works with your requirements or not, but you could constrain T to be a Type that implements an interface such as IComparable and then use the ComparesTo() method from that interface (which IIRC supports/handles nulls) like this:</p> <pre><code>public void MyMethod&lt;T&gt;(T myArgument) where T : IComparable ... if (0 == myArgument.ComparesTo(default(T))) </code></pre> <p>There are probably other interfaces that you could use as well IEquitable, etc.</p>
9,109
<p>I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any concrete information on accessing and modifying another spreadsheet (this spreadsheet is located on a different LAN share also... the user has access to both, though).</p> <p>Any help would be great. References on how to do this or something similar are just as good as concrete code samples.</p>
<p>In Excel, you would likely just write code to open the other worksheet, modify it and then save the data.</p> <p>See <a href="http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=302" rel="noreferrer">this tutorial</a> for more info.</p> <p>I'll have to edit my VBA later, so pretend this is pseudocode, but it should look something like:</p> <pre><code>Dim xl: Set xl = CreateObject("Excel.Application") xl.Open "\\the\share\file.xls" Dim ws: Set ws = xl.Worksheets(1) ws.Cells(0,1).Value = "New Value" ws.Save xl.Quit constSilent </code></pre>
<p>You can open a spreadsheet in a single line:</p> <pre><code>Workbooks.Open FileName:="\\the\share\file.xls" </code></pre> <p>and refer to it as the active workbook:</p> <pre><code>Range("A1").value = "New value" </code></pre>
7,398
<p>A Bowden tube extruder (like the stock one on an Ender 3) is known to have issues with printing the most flexible TPU, and with filaments that (either due to composition or condition) don't take well to too much retraction -- though the latter can be ameliorated somewhat with slicer settings. Direct drive extruders, on the other hand, by reducing the extruder to hot end distance to the practical minimum, greatly reduce the amount of retraction needed as well as the effect of filament compression and stretching.</p> <p>One potential down side I'm aware of is that putting the extruder stepper and drive on the X carriage adds mass that the X drive motor has to both accelerate and decelerate; this could in theory have an effect on print quality, increasing ringing and overrun on the X axis (though this isn't generally a problem with the steppers used on the Ender 3 and similar printers).</p> <p>What other reasons might there be to prefer a Bowden tube over direct drive?</p>
<p>There are really no reasons not to convert to direct drive, <em>provided you use a good one</em>. Many of the direct drive kits, especially the ones that reuse the existing giant NEMA-17 stepper, are not very good and have tradeoffs due to excessive mass on the toolhead, imbalanced mass, interference with frame reducing print volume, etc. The modern way to do direct drive is with a &quot;pancake&quot; stepper far smaller and lighter, and gearing between 3:1 and 6:1 reduction to get the needed torque - look at the Orbiter, Sherpa Mini, etc. - or even a remote direct drive.</p> <p>Teaching Tech recently posted a video on this very topic, titled <a href="https://youtu.be/ybTbuUBy2-s" rel="nofollow noreferrer">Why direct drive is not automatically better than bowden tube</a> but then pretty much concluding that all the old reasons not to go direct drive no longer apply.</p>
<p>Other than higher carriage mass as you already noted, the only other reason to not go with Direct Drive over Bowden is the higher level of maintenance required. In most cases Direct Drive will provide advantages such as increasing the maximum flow speed, enabling the use of Linear/Pressure Advance, shortening Retraction moves, and better resistance to obstructions in the filament path, and more reliable printing of flexibles as you have already noted. As well, A direct drive system would allow a less-powerful stepper motor to be used, which cuts down on the carriage mass problem.</p>
1,977
<p>I am interested in references to designs which use a customized support instead of the slicer's default normal/tree support.</p> <p>The background is this: I am making a hubcap with a 3D logo. I do not want to place the logo on the print bed because the logo will become very messy. So, I place the rim of the hubcap on the bed. This means that a lot of support is needed. With support = normal the print time taken is 36.5 hours using 290 g of filament. With support = tree the time taken is 29.5 hours using 200 g of filament. In comparison, with support = none the time taken is 14.5 hours using 115 g of filament, but of course is not practical. So, I decided to make my own support and I manually inserted it at a specified layer - just below the top disk and the logo above it. The design included some small brackets to hold the support. The time taken and amount of filament is the same as no support - about half the time &amp; amount for tree support! Here is what the support looks like:</p> <p><a href="https://i.stack.imgur.com/TfeLg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TfeLg.png" alt="enter image description here" /></a></p> <p>I intended to snip away the mesh, but it blends in quite well with the layer above it. (Perhaps a finer mesh is easier to remove.)</p> <p>I am interested to know of others who have designed customized supports.</p>
<p>Your question may be closed for being somewhat vague and outside the scope of the SE, but consider to view <a href="https://www.youtube.com/watch?v=RPijCjz9G1w" rel="nofollow noreferrer">Maker's Muse video</a> about creating alternatives to slicer-generated supports.</p> <p>The video suggests creating primitives in locations appropriate to the overall design. For example, an unsupported &quot;shelf&quot; or &quot;ledge&quot; could result in a massive number of supports if left to the slicer. The MM method suggests that a small rectangular prism on the edge of the ledge turns the object from an unsupported item to a bridging solution. If the gap is excessive, multiple primitives in strategic locations would reduce the slicer-generated support.</p> <p><a href="https://i.stack.imgur.com/qgY3N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qgY3N.png" alt="user generated support primitive" /></a> Image is screen shot from linked video.</p> <p>I've had to print a counterbore that I did not want to load with supports. The primitive was a simple cylinder with a diameter of 0.4 mm larger than the diameter of the hole. This created a peg attached to the edge of the counterbore, which the slicer saw as a bridging solution. Easily snapped clean after the print completed.</p>
<p>In this situation I probably wouldn't use supports at all.</p> <p>I'd put something round on the bed that fits the space instead.</p>
2,191
<p>I'm looking for a builder for <a href="http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html" rel="noreferrer">HQL</a> in Java. I want to get rid of things like:</p> <pre><code>StringBuilder builder = new StringBuilder() .append("select stock from ") .append( Stock.class.getName() ) .append( " as stock where stock.id = ") .append( id ); </code></pre> <p>I'd rather have something like:</p> <pre><code>HqlBuilder builder = new HqlBuilder() .select( "stock" ) .from( Stock.class.getName() ).as( "stock" ) .where( "stock.id" ).equals( id ); </code></pre> <p>I googled a bit, and I couldn't find one.</p> <p>I wrote a quick &amp; dumb <code>HqlBuilder</code> that suits my needs for now, but I'd love to find one that has more users and tests than me alone.</p> <p>Note: I'd like to be able to do things like this and more, which I failed to do with the Criteria API:</p> <pre><code>select stock from com.something.Stock as stock, com.something.Bonus as bonus where stock.someValue = bonus.id </code></pre> <p>ie. select all stocks whose property <code>someValue</code> points to <em>any</em> bonus from the Bonus table.</p> <p>Thanks!</p>
<p>@<a href="https://stackoverflow.com/questions/56843/looking-for-an-hql-builder-hibernate-query-language#57001">Sébastien Rocca-Serra</a><br> Now we're getting somewhere concrete. The sort of join you're trying to do isn't really possible through the Criteria API, but a sub-query should accomplish the same thing. First you create a <code>DetachedCriteria</code> for the bonus table, then use the <code>IN</code> operator for <code>someValue</code>.</p> <pre><code>DetachedCriteria bonuses = DetachedCriteria.forClass(Bonus.class); List stocks = session.createCriteria(Stock.class) .add(Property.forName("someValue").in(bonuses)).list(); </code></pre> <p>This is equivalent to</p> <pre><code>select stock from com.something.Stock as stock where stock.someValue in (select bonus.id from com.something.Bonus as bonus) </code></pre> <p>The only downside would be if you have references to different tables in <code>someValue</code> and your ID's are not unique across all tables. But your query would suffer from the same flaw.</p>
<p>Now are also available the standard <a href="http://www.ibm.com/developerworks/library/j-typesafejpa/" rel="nofollow">JPA Type Safe</a> query and an less standard but also good <a href="https://www.objectquery.org/" rel="nofollow">Object Query</a></p> <p>Examples:</p> <p>JPA Type Safe</p> <pre><code>EntityManager em = ... CriteriaBuilder qb = em.getCriteriaBuilder(); CriteriaQuery&lt;Stock&gt; c = qb.createQuery(Stock.class); Root&lt;Stock&gt; = c.from(Stock.class); Predicate condition = qb.eq(p.get(Stock_.id), id); c.where(condition); TypedQuery&lt;Stock&gt; q = em.createQuery(c); List&lt;Stock&gt; result = q.getResultList(); </code></pre> <p>Object Query</p> <pre><code>EntityManager em = ... ObjectQuery&lt;Stock&gt; query = new GenericObjectQuery&lt;Stock&gt;(Stock.class); Stock toSearch = query.target(); query.eq(toSearch.getId(),id); List&lt;Stock&gt; res = (List&lt;Stock&gt;)JPAObjectQuery.execute(query, em); </code></pre>
8,095
<p>In general, what kinds of design decisions help an application scale well?</p> <p>(Note: Having just learned about <a href="http://en.wikipedia.org/wiki/Big_O_notation" rel="nofollow noreferrer">Big O Notation</a>, I'm looking to gather more principles of programming here. I've attempted to explain Big O Notation by answering my own question below, but I want the community to improve both this question and the answers.)</p> <p><strong>Responses so far</strong><br> 1) Define scaling. Do you need to scale for lots of users, traffic, objects in a virtual environment?<br> 2) Look at your algorithms. Will the amount of work they do scale linearly with the actual amount of work - i.e. number of items to loop through, number of users, etc?<br> 3) Look at your hardware. Is your application designed such that you can run it on multiple machines if one can't keep up? </p> <p><strong>Secondary thoughts</strong><br> 1) Don't optimize too much too soon - test first. Maybe bottlenecks will happen in unforseen places.<br> 2) Maybe the need to scale will not outpace Moore's Law, and maybe upgrading hardware will be cheaper than refactoring.</p>
<p>The only thing I would say is write your application so that it can be deployed on a cluster from the very start. Anything above that is a premature optimisation. Your first job should be getting enough users to have a scaling problem. </p> <p>Build the code as simple as you can first, then profile the system second and optimise only when there is an obvious performance problem.</p> <p>Often the figures from profiling your code are counter-intuitive; the bottle-necks tend to reside in modules you didn't think would be slow. Data is king when it comes to optimisation. If you optimise the parts you think will be slow, you will often optimise the wrong things.</p>
<p>One good idea is to determine how much work each additional task creates. This can depend on how the algorithm is structured.</p> <p>For example, imagine you have some virtual cars in a city. At any moment, you want each car to have a map showing where all the cars are.</p> <p>One way to approach this would be:</p> <pre> for each car { determine my position; for each car { add my position to this car's map; } } </pre> <p>This seems straightforward: look at the first car's position, add it to the map of every other car. Then look at the second car's position, add it to the map of every other car. Etc.</p> <p>But there is a scalability problem. When there are 2 cars, this strategy takes 4 "add my position" steps; when there are 3 cars, it takes 9 steps. <b>For each "position update," you have to cycle through the whole list of cars - and every car needs its position updated.</b> </p> <p>Ignoring how many other things must be done to each car (for example, it may take a fixed number of steps to calculate the position of an individual car), <b>for N cars, it takes N<sup>2</sup> "visits to cars" to run this algorithm</b>. This is no problem when you've got 5 cars and 25 steps. But as you add cars, you will see the system bog down. 100 cars will take 10,000 steps, and 101 cars will take 10,201 steps!</p> <p>A better approach would be to undo the nesting of the for loops.</p> <pre> for each car { add my position to a list; } for each car { give me an updated copy of the master list; } </pre> <p>With this strategy, the number of steps is a multiple of N, not of N<sup>2</sup>. <b>So 100 cars will take 100 times the work of 1 car - NOT 10,000 times the work</b>.</p> <p>This concept is sometimes expressed in "big O notation" - the number of steps needed are "big O of N" or "big O of N<sup>2</sup>."</p> <p>Note that this concept is only concerned with scalability - not optimizing the number of steps for each car. Here we don't care if it takes 5 steps or 50 steps per car - the main thing is that N cars take (X * N) steps, not (X * N<sup>2</sup>).</p>
6,265
<p>When I adjust the probe offset to get the proper layer height and adhesion, one side is set right but the other doesn't work. If I decrease the probe offset (say -1.100 to -1.050) the right side seems to print better; if I increase the probe offset (-1.050 to -1.125) the left side will adhere to the plate properly.</p> <p>Before I added the BLTouch and upgraded the firmware to Marlin 1.1.9 I was able to print a perimeter square (with a little manual adjustment).</p> <p>My Printer is the Ender 3 and I am using a <a href="https://www.amazon.co.uk/Comgrow-Glass-Creality-Printer-Ender-3/dp/B07DSC9TJQ" rel="nofollow noreferrer">glass bed</a> and the model is this <a href="https://www.thingiverse.com/thing:2280529/" rel="nofollow noreferrer">centre crosshair</a></p> <p><a href="https://i.stack.imgur.com/xVVfi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xVVfi.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/pBFny.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pBFny.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/Y0usO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y0usO.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/JECOP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JECOP.jpg" alt="enter image description here"></a></p>
<p>I have had exactly the same experiences as you did with a inductive sensor on a Prusa i3 clone. It looks as though the bed leveling is not executed, or the level/mesh tilted. Please do note that automatic bed leveling is <strong><em>not magic</em></strong>, you still need to provide a <strong><em>build platform as level (and flat) as possible</em></strong>. A slate of glass is a good build platform surface as the glass production process ensures that the glass is very flat and easy to level.</p> <p>What I did to solve the problem is that I re-leveled the bed and send the <a href="https://reprap.org/wiki/G-code#M420:_Leveling_On.2FOff.2FFade_.28Marlin.29" rel="nofollow noreferrer"><code>M420 S1</code></a> command over USB to the printer to enable bed leveling as I was under the impression that it did not use the grid obtained with <code>G29</code>.</p> <p>On my CoreXY I also use a touch sensor (3DTouch, which is a BLTouch clone) like you do, even with that sensor I sometimes see that the automatic level is uneven (one side of the skirt has very thin/see through deposition, while the other side appears normal), this is most probably caused by the sensor accuracy (or an obstruction under the probe needle). There is a way to increase the probing accuracy by using double probing where the second probe is advancing slower to the build platform as can be seen in the Marlin Configuration.h file:</p> <pre><code>// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z // Feedrate (mm/m) for the "accurate" probe of each point #define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) </code></pre> <p>For double probing you require to set:</p> <pre><code>// The number of probes to perform at each point. // Set to 2 for a fast/slow probe, using the second probe result. // Set to 3 or more for slow probes, averaging the results. #define MULTIPLE_PROBING 2 </code></pre> <hr> <p><em>Side note:<br> From an earlier posting it appears that you are using the <code>#define Z_PROBE_OFFSET_FROM_EXTRUDER</code> in the configuration file to set the offset. It is much more convenient to set that through the <a href="http://marlinfw.org/docs/features/lcd_menu.html" rel="nofollow noreferrer">LCD menu</a> (<code>Bed Leveling</code> -> <code>Z Probe Offset: -–-</code>) or send the <code>M851 Zx.xx</code> directly over USB or load through a .gcode file from SD card to prevent numerous flashing the firmware with alternative parameters. Make sure that you enable:</em></p> <pre><code>#define EEPROM_SETTINGS // Enable for M500 and M501 commands </code></pre> <p><em>in the Configuration.h file and execute <code>M500</code> to store the new setting set by <code>M851</code>.</em></p>
<p>From the looks of your test print, this is unlikely all or only due to levelling unless the glass plate is abnormally uneven. You may have to check your extrusion (speed, temp, feed) parameters and/or adhesion (clean with aceton and/or prepare with hairspray or glue stck)</p>
1,088
<p>I'm trying to optimize several bottlenecks on an application which is supposed to run on a really wide range of CPUs and architectures (some of them very close to embeded devices).</p> <p>The results of my profiler, however, aren't really significant because of the speed of my CPU. Is there any way (preferably under Windows or Mac OS X) to limit the speed of my CPU for profiling purposes?</p> <p>I've thought about using a virtual machine, but haven't found any with such functionality.</p>
<p>This works well and supports multicore. <a href="http://www.cpukiller.com/" rel="nofollow noreferrer">http://www.cpukiller.com/</a></p>
<p>There was an app on Downloadsquad.com recently. I dont remember the name of it but it did some fun stiff woth processors and task manager. It may have only been to manage what apps are on what cpu but maybe it would give you this. I will try to look for it this afternoon, and respond back if I find it.</p>
7,843
<p>I work for a company that makes items from plastics.<br> Many or our current runs are between 500 and 5000 copies, but knowing the company, if we find a good method to do smaller runs, they are willing to see if it is a good commercial option.</p> <p>At the moment we do use several different methods but the technical people are not yet looking into 3D printing.</p> <p>While I am not sure printing is the right option just yet, I would be surprised if it will not be in the future.</p> <p>At this time I am interested in finding information to convince the tech people to look into the abilities of printers and what would impress them to look further would be printers that can produce in short times or at multiple stations so the overall run will be relatively short term.<br> Our current items are mostly simple in shape, (disks with relief print) and small in size (no bigger than a 2 pound coin).</p> <p>Do you know an online magazine where the tech people can look or can you suggest a (few) printer(s) to look at right now?<br> Links to online general information or names to search for will be great.</p> <p>Knowing our current bunch of tech people they will likely prefer commercial available printers but proven 'home build technology' might be useful as well.</p>
<p>From an electrical standpoint, a two-phase stepper motors (what most 3D printers use) works the same backwards and forwards, the phase just reverses. If you are stalling on only one direction, I would look to see if you have a mechanical bind in that direction. Generally a wiring issue will cause the motor to either not run at all or to run in the wrong direction.</p> <p>A few things you can check:</p> <ol> <li>Decouple the motors from their mechanical load and confirm that they all run correctly when they aren't driving a load. If you can't do that, disconnect them all then connect a spare motor to each cable one-at-a-time.</li> <li>Turn each of the axis with your hand and make sure it turns smoothly throughout the entire range in both directions. Note: Some times a binding issue is acceleration related - a loose frame or coupling can cause this.</li> <li>Monitor the supply voltage to make sure that one of the motors is not pulling the supply down causing all the others to stall.</li> </ol>
<p>Sounds like you are configured for NC switches but are using NO switches, causing them to invert their reported state. Issue a <strong>M119</strong> command and see if the endstop statuses are correct when none are triggered.</p>
774
<p>We have a number of users with Windows Mobile 6 and need to apply minor changes. eg. update a registry setting. One option is push and execute an executable file using our device management software.</p> <p>I'd like this to be a little more friendly for the admins who are familiar with scripting in VBScript/JScript etc. What are the options for scripting on Windows Mobile devices?</p>
<p>I work on windows mobile full time and have never really come across a good Windows Mobile scripting implementation unfortunately. For some reason MS has never seen the need for it. For example, even though you can actually get a command console on WM, it does not support running batch files, even though all the commands are still there and it would be relatively easy. There is definitely not a VBScript engine I've ever heard of nor JScript. There is <a href="http://pythonce.sourceforge.net/" rel="noreferrer">PythonCE</a> but the WM specific support is minimal and you don't get access to a lot of WM only things.</p> <p>Also, I've done a lot of work with a company called <a href="http://soti.net/" rel="noreferrer">SOTI</a> which has a product called MobiControl that does incorporate a basic scripting engine. Though most of the commands are specific to their system and actually have to be run from a desktop-side management console.</p> <p>Given all of the times I have tried to find a good scripting engine for WM myself you would think I would've just written one ;)</p> <p>So, sorry, but the basic answer is <em>no</em>, there is not a scripting engine available for VB in the context that you specified.</p>
<p>There is also a <a href="http://www.cebeans.com/" rel="nofollow noreferrer">Visual Basic Runtime</a> to run VBScript</p>
4,844
<p>I had a couple of recent nozzle/bed crashes, so I now frequently do a manual bed levelling. I do these while the bed is heated to allow for expansion.</p> <p>Today I found, after levelling, a subsequent print could vary from having too much clearance (paper moves very freely) to less than no clearance (which left deep grooves in the bed as per the photo).</p> <p><a href="https://i.stack.imgur.com/8sAZk.jpg" rel="nofollow noreferrer" title="Photo of bed"><img src="https://i.stack.imgur.com/8sAZk.jpg" alt="Photo of bed" title="Photo of bed" /></a></p> <p>What are the possible causes? Is it just a dodgy Z-limit switch or something else? What solutions are available and at what cost? Obviously an ABL seems essential now, but requires a lot of hardware and setup.</p> <p>It has just happened again so here are some more details.</p> <p>Printing PLA this time:</p> <ul> <li>Preheated bed.</li> <li>Levelled bed all over and got a very good raft.</li> <li>Print failed later so the print was aborted.</li> <li>Restarted the same print job.</li> <li>Nozzle gouged out a uniform depth trench around print perimeter.</li> </ul> <p>The uniform depth of the gouge indicates a problem related to Z-axis only as the bed remains flat and level, but the height is off. That is to say, the bed is flat and level before and after this occurs.</p> <p>Please note: I have done over 100 successful prints, prior to this issue, so I do have some knowledge about levelling the bed. I am interested in what could cause such a large variation. Initially I thought it was temperature as I switched to ABS at the time, but it now varies from one print to the next.</p> <p>The machine is a month old and rock solid. The Z-axis is the slowest moving axis, controlled by the limit switch only, hence my suspecting that is the cause.</p> <p>I purchased a couple of spare Ender 3's and will update various parts in turn to see what the cause is. The metal trigger on my Z-limit switch seems a little floppy sideways, but I am also starting to suspect the bed springs have lost their springiness.</p> <p>I have the removal bed version and also a borosilicate glass bed. The glass is perfectly flat and the standard removable is dipped ever so slightly in the middle, but the difference is huge when it goes wrong. As you can see from the photo the trench it digs is quite uniform depth. That's why I keep coming back to the Z-limit switch. I have a spare switch now so will try that next.</p>
<p>This was killing me on mine. My problem wasn't the z-axis, it was the x-axis arm. On the right side, opposite the extruder gear, it had a lot of give (wobble). I could level my bed four times before starting a print and would still have problems, especially with the nozzle making deep grooves in the magnetic bed. The way it messed up was inconsistent as well, making it hard to troubleshoot.</p> <p>I changed out the bedsprings, got a glass bed instead, changed out the extruder gear and Bowden tube; I was ready to give up.</p> <p>How to fix the wobble, if that's your problem, if there's a lot of give / vertical movement on the right side of the arm:</p> <p>You have to take the whole arm off. First, take the top bar off, remove the four screws. Second, disable steppers so you can take the x-axis off completely. I removed the cables once I had taken it off. Third, there's a plate with two holes to get to two screws - make sure these are tight! This is where the wobble was coming from. Four, reassemble and double-check. For me, the give was reduced drastically.</p> <p>A video tutorial for help. There are English subtitles. <div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/ncUHPScBcI4?start=0"></iframe> </div></div></p>
<p>I'm having the same issue with Ender 3 V2. Everything tightened, Z-axis coupler not &quot;slipping&quot;... I noticed, that the error is made by the Z-axis end switch itself. I am not sure how that is possible but try homing several times and you'll see that the loud click when the switch is triggered occurs in a span of +/- 3 mm, which then results in a collision of the hot end and the bed, or the hot end being too high.</p> <p>From what I noticed, the problem got worse after installing OctoPi. Strangely enough, I get very different results when homing &quot;manually&quot; (from the machine display menu), and when homing is done at the beginning of printing.</p> <p>I believe that the problem has three solutions:</p> <ol> <li>At least 3 skirt loops and adjust the bed on the fly. This is a very unfortunate solution, but that's what I have now.</li> <li>I suggest some sort of speed regulation when approaching the switch (Z -&gt; 0), thus making the switch always trigger at the same height. I'm a programmer, but not familiar with G-code, I'll make this solution publicly available when I get to it.</li> <li>Change the switch. The tin &quot;paw&quot; that can bend is unfortunate when you need 0,01 [mm] precision. The video is unrelated to the topic, but run 10-15 seconds and you'll see what I mean: <a href="https://youtu.be/g0PK4oXbJT8?t=266" rel="nofollow noreferrer">Z-axis switch replacement</a></li> </ol>
1,087
<p>I purchased a glass bed to use with my still-in-transit Ender 3. Since the bed came in before the printer, I pulled it out and used a flat edge ruler to see how flat the glass surface is. </p> <p>It appears the glass is slightly "dished" in the center from one side and "raised" in the center on the other side. I am wondering if this is a sign of a defective glass, or if it is likely that the glass may change shape slightly as it is heated?</p> <p>If it does change shape, should it be put with the dish side up or down? </p> <p>Logic would say that if it does change shape, the bottom would probably get hotter since it is against the heater while the top is slightly cooler, so in theory the bottom may expand more "pulling" the center down?</p> <p>I guess the bottom line is, should I send the glass back as defective or wait until the printer arrives and see what happens when I heat it up?</p>
<p>Glass will not change its shape you can watch this interesting video: <a href="https://www.youtube.com/watch?v=0j9fa86jiv0" rel="nofollow noreferrer">YouTube - Fix Your Bowed Glass Build Surface - CR-10 3D Printer </a>.</p> <p>Or simply change your glass. </p>
<p>Yes, glass will warp. Think about it this way: the edges cannot be as hot as the centre if you use uniform heating, because they lose heat more quickly.</p> <p>If the edges are colder, they are also shorter than the hotter centre, which expands more.</p> <p>If the centre is longer than the edges, it will bend to accommodate the extra length.</p> <p>You can solve it by placing extra heating along the edges. Once you heat the edges more than the centre, the edges will pull apart the centre, which will result in a flat centre. However, the edges will deform as well, you need just a bit of stretch of the centre, but not so much that it pulls the edges back.</p>
989
<p>For the following HTML:</p> <pre><code>&lt;form name=&quot;myForm&quot;&gt; &lt;label&gt;One&lt;input name=&quot;area&quot; type=&quot;radio&quot; value=&quot;S&quot; /&gt;&lt;/label&gt; &lt;label&gt;Two&lt;input name=&quot;area&quot; type=&quot;radio&quot; value=&quot;R&quot; /&gt;&lt;/label&gt; &lt;label&gt;Three&lt;input name=&quot;area&quot; type=&quot;radio&quot; value=&quot;O&quot; /&gt;&lt;/label&gt; &lt;label&gt;Four&lt;input name=&quot;area&quot; type=&quot;radio&quot; value=&quot;U&quot; /&gt;&lt;/label&gt; &lt;/form&gt; </code></pre> <p>Changing from the following JavaScript code:</p> <pre><code>$(function() { var myForm = document.myForm; var radios = myForm.area; // Loop through radio buttons for (var i=0; i&lt;radios.length; i++) { if (radios[i].value == &quot;S&quot;) { radios[i].checked = true; // Selected when form displays radioClicks(); // Execute the function, initial setup } radios[i].onclick = radioClicks; // Assign to run when clicked } }); </code></pre> <p>Thanks</p> <p>EDIT: The response I selected answers the question I asked, however I like the answer that uses <code>bind()</code> because it also shows how to distinguish the group of radio buttons</p>
<pre><code>$( function() { $("input:radio") .click(radioClicks) .filter("[value='S']") .attr("checked", "checked"); }); </code></pre>
<p>I think something like this should work (but it's untested):</p> <pre><code>$("input[@type='radio']").each(function(i) { if (this.val() == 'E') { radioClicks(); this.get().checked = true; } } $("input[@type='radio']").click(radioClicks); </code></pre>
6,888
<p>I keep hearing that Lisp is a really productive language, and I'm enjoying <a href="http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/" rel="noreferrer">SICP</a>. Still, I'm missing something useful that would let me replace PHP for server-side database interaction in web applications.</p> <p>Is there something like PHP's <a href="http://us2.php.net/manual/en/book.pdo.php" rel="noreferrer">PDO</a> library for Lisp or Arc or Scheme or one of the dialects?</p>
<p>newLisp has support for mysql5 and if you look at <a href="http://www.newlisp.org/code/modules/mysql5.lsp.html" rel="nofollow noreferrer">the mysql5 function calls</a>, you'll see that it's close to PDO.</p>
<p>We use SBCL, UCW, CL-SQL and MySQL as our back-end for <a href="http://paragent.com" rel="nofollow noreferrer">Paragent.com</a>. It has worked very well for us. We also have a number of clients using UCW/CL-SQL/MySQL for custom sites we have built them through our consulting arm <a href="http://bitfauna.com" rel="nofollow noreferrer">Bitfauna</a>.</p>
9,062
<p>I would like to make my web control more readable in design mode, basically I want the tag declaration to look like:</p> <pre><code>&lt;cc1:Ctrl ID="Value1" runat="server"&gt; &lt;Values&gt;string value 1&lt;/Value&gt; &lt;Values&gt;string value 2&lt;/Value&gt; &lt;/cc1:Ctrl&gt; </code></pre> <p>Lets say I have a private variable in the code behind:</p> <pre><code>List&lt;string&gt; values = new List&lt;string&gt;(); </code></pre> <p>So how can I make my user control fill out the private variable with the values that are declared in the markup?</p> <hr> <p>Sorry I should have been more explicit. Basically I like the functionality that the ITemplate provides (<a href="http://msdn.microsoft.com/en-us/library/aa719834.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa719834.aspx</a>)</p> <p>But in this case you need to know at runtime how many templates can be instansitated, i.e.</p> <pre><code>void Page_Init() { if (messageTemplate != null) { for (int i=0; i&lt;5; i++) { MessageContainer container = new MessageContainer(i); messageTemplate.InstantiateIn(container); msgholder.Controls.Add(container); } } </code></pre> <p>}</p> <p>In the given example the markup looks like:</p> <pre><code>&lt;acme:test runat=server&gt; &lt;MessageTemplate&gt; Hello #&lt;%# Container.Index %&gt;.&lt;br&gt; &lt;/MessageTemplate&gt; &lt;/acme:test&gt; </code></pre> <p>Which is nice and clean, it does not have any tag prefixes etc. I really want the nice clean tags.</p> <p>I'm probably being silly in wanting the markup to be clean, I'm just wondering if there is something simple that I'm missing.</p>
<p>I think what you are searching for is the attribute:</p> <pre><code>[PersistenceMode(PersistenceMode.InnerProperty)] </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.persistencemode.aspx" rel="nofollow noreferrer">Persistence Mode</a></p> <p>Remember that you have to register your namespace and prefix with:</p> <pre><code>&lt;%@ Register Namespace="MyNamespace" TagPrefix="Pref" %&gt; </code></pre>
<p>I see two options, but both depend on your web control implementing some sort of collection for your values. The first option is to just use the control's collection instead of your private variable. The other option is to copy the control's collection to your private variable at run-time (maybe in the Page_Load event handler, for example).</p> <p>Say you have web control that implements a collection of items, like a listbox. The tag looks like this in the source view:</p> <pre><code> &lt;asp:ListBox ID="ListBox1" runat="server"&gt; &lt;asp:ListItem&gt;String 1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;String 2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;String 3&lt;/asp:ListItem&gt; &lt;/asp:ListBox&gt;&lt;br /&gt; </code></pre> <p>Then you might use code like this to load your private variable:</p> <pre><code> List&lt;String&gt; values = new List&lt;String&gt;(); foreach (ListItem item in ListBox1.Items) { values.Add(item.Value.ToString()); } </code></pre> <p>If you do this in Page_Load you'll probably want to only execute on the initial load (i.e. not on postbacks). On the other hand, depending on how you use it, you could just use the ListBox1.Items collection instead of declaring and initializing the values variable.</p> <p>I can think of no way to do this declaratively (since your list won't be instantiated until run-time anyway).</p>
8,717
<p>Using <a href="http://en.wikipedia.org/wiki/JQuery" rel="noreferrer">jQuery</a>, how can I dynamically set the size attribute of a select box?</p> <p>I would like to include it in this code:</p> <pre><code>$("#mySelect").bind("click", function() { $("#myOtherSelect").children().remove(); var options = '' ; for (var i = 0; i &lt; myArray[this.value].length; i++) { options += '&lt;option value="' + myArray[this.value][i] + '"&gt;' + myArray[this.value][i] + '&lt;/option&gt;'; } $("#myOtherSelect").html(options).attr [... use myArray[this.value].length here ...]; }); }); </code></pre>
<p>Oops, it's</p> <pre><code>$('#mySelect').attr('size', value) </code></pre>
<pre><code>$("#mySelect").bind("click", function(){ $("#myOtherSelect").children().remove(); var myArray = [ "value1", "value2", "value3" ]; for (var i = 0; i &lt; myArray.length; i++) { $("#myOtherSelect").append( '&lt;option value="' + myArray[i] + '"&gt;' + myArray[i] + '&lt;/option&gt;' ); } $("#myOtherSelect").attr( "size", myArray.length ); }); </code></pre>
9,099
<p>I am running </p> <ul> <li>OS X 10.5, </li> <li>Ruby 1.8.6, </li> <li>Rails 2.1, </li> <li>sqlite3-ruby 1.2.2 </li> </ul> <p>and I get the following error when trying to rake <code>db:migrate</code> on an app that works find connected to MySQL.</p> <blockquote> <p>rake aborted! no such file to load -- sqlite3/database</p> </blockquote>
<p>You have to store in UTC - if you don't, your historic reporting and behaviour during things like Daylight Savings goes... funny. GMT is a local time, subject to Daylight Savings relative to UTC (which is not).</p> <p>Presentation to users in different time-zones can be a real bastard if you're storing local time. It's easy to adjust to local if your raw data is in UTC - just add your user's offset and you're done!</p> <p>Joel talked about this in one of the podcasts (in a round-about way) - he said to <a href="https://stackoverflow.fogbugz.com/default.asp?W12621" rel="noreferrer">store your data in the highest resolution possible</a> (search for 'fidelity'), because you can always munge it when it goes out again. That's why I say store it as UTC, as local time you need to adjust for anyone who's not in that timezone, and that's a lot of hard work. And you need to store whether, for example, daylight savings was in effect when you stored the time. Yuk.</p> <p>Often in databases in the past I've stored two - UTC for sorting, local time for display. That way neither the user nor the computer get confused.</p> <p>Now, as to display: Sure, you can do the "3 minutes ago" thing, but only if you store UTC - otherwise, data entered in different timezones is going to do things like display as "-4 hours ago", which will freak people out. If you're going to display an actual time, people love to have it in their local time - and if data's being entered in multiple timezones you can only do that with ease if you're storing UTC.</p>
<p>I like storing in GMT and showing only relative ("about 10 seconds ago", "5 months ago"). Users don't need to see actual timestamps for most use cases.</p> <p>There are certainly exceptions, and an individual application might have many of them, so it can't be a 'one-true-way' answer. Things that need strong audit-ability (e.g. voting), and systems where time is part of the domain of discourse (astronomy, scientific research) might demand true timestamps to be shown to the user.</p> <p>Most apps, though, are easier to understand with a simple relative time.</p>
3,310
<p>When I run prints on my Creality CR-10S Pro 3D printer (using Ultimaker Cura as slicer), I set the heated bed to around 70&nbsp;&deg;C for PETG. after the first few layers, the heated bed set point changes to 0&nbsp;&deg;C. </p> <p>Is it normal for a 3D printer to turn the heated bed off during a print, or is this a problem?</p> <p>I have had some parts warping, and wonder if this is a potential cause.</p>
<p><strong>No</strong>, this is not common behavior, and <strong>yes</strong> this can cause your prints to warp or detach from the build plate.</p> <p>The question is whether you instructed this (by accident) or not (e.g. it can be a result from slicing or some economy mode of the printer). This should be clear if you look into the G-code file that you print. The typical commands that concern bed heating are <a href="https://reprap.org/wiki/G-code#M140:_Set_Bed_Temperature_.28Fast.29" rel="nofollow noreferrer"><code>M140</code></a> and <a href="https://reprap.org/wiki/G-code#M190:_Wait_for_bed_temperature_to_reach_target_temp" rel="nofollow noreferrer"><code>M190</code></a>.</p> <p>Please note that this a generic answer to find bed heating operation in your G-code file. Other answers, e.g <a href="/a/8425/">this one</a> and <a href="/a/8285/">this one</a> hint to a specific ability of the printer that shuts off the heating of the bed when it is working in an economic mode. Note that this is printer specific.</p>
<p>That is not normal behavior for the heated beds. I don't have that exact model, but when I print the heated bed will stay to whatever temp was set in the slicer program. Unless you override it manually on the printer itself during the print. I would check slicer settings ensuring temp doesn't change after it's first layers. </p>
1,205
<p>I have the following arrays:</p> <pre><code>$artist = array("the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"); $count = array(5, 3, 9, 1, 1, 3); </code></pre> <p>I want to generate a tag cloud that will have artists with a higher number in <code>$count</code> enclosed in <code>h6</code> tags and the lowest enclosed <code>h1</code> tags.</p>
<p>You will want to add a logarithmic function to it too. (taken from tagadelic, my Drupal module to create tag clouds <a href="http://drupal.org/project/tagadelic" rel="noreferrer">http://drupal.org/project/tagadelic</a>):</p> <pre><code>db_query('SELECT COUNT(*) AS count, id, name FROM ... ORDER BY count DESC'); $steps = 6; $tags = array(); $min = 1e9; $max = -1e9; while ($tag = db_fetch_object($result)) { $tag-&gt;number_of_posts = $tag-&gt;count; #sets the amount of items a certain tag has attached to it $tag-&gt;count = log($tag-&gt;count); $min = min($min, $tag-&gt;count); $max = max($max, $tag-&gt;count); $tags[$tag-&gt;tid] = $tag; } // Note: we need to ensure the range is slightly too large to make sure even // the largest element is rounded down. $range = max(.01, $max - $min) * 1.0001; foreach ($tags as $key =&gt; $value) { $tags[$key]-&gt;weight = 1 + floor($steps * ($value-&gt;count - $min) / $range); } </code></pre> <p>Then in your view or template:</p> <pre><code>foreach ($tags as $tag) { $output .= "&lt;h$tag-&gt;weight&gt;$tag-&gt;name&lt;/h$tag-&gt;weight&gt;" } </code></pre>
<p>As a helper in Rails:</p> <pre><code>def tag_cloud (strings, counts) max = counts.max strings.map { |a| "&lt;span style='font-size:#{((counts[strings.index(a)] * 4.0)/max).ceil}em'&gt;#{a}&lt;/span&gt; " } end </code></pre> <p>Call this from the view:</p> <pre><code>&lt;%= tag_cloud($artists, $counts) %&gt; </code></pre> <p>This outputs <code>&lt;span style='font-size:_em'&gt;</code> elements in an array that will be converted to a string in the view to ultimately render like so:</p> <pre><code>&lt;span style='font-size:3em'&gt;the roots&lt;/span&gt; &lt;span style='font-size:2em'&gt;michael jackson&lt;/span&gt; &lt;span style='font-size:4em'&gt;billy idol&lt;/span&gt; &lt;span style='font-size:1em'&gt;more&lt;/span&gt; &lt;span style='font-size:1em'&gt;and more&lt;/span&gt; &lt;span style='font-size:2em'&gt;and_YET_MORE&lt;/span&gt; </code></pre> <p>It would be better to have a <code>class</code> attribute and reference the classes in a style sheet as mentioned by Brendan above. Much better than using <code>h1-h6</code> semantically and there's less style baggage with a <code>&lt;span&gt;</code>.</p>
2,271
<p>I am writing some G-code for my DIY 3D printer. From what I understand, <code>G4</code> is dwell and its expressed in milliseconds. So my extruder takes about 30 seconds to heat up. Do I just type </p> <pre><code>G04 30000 </code></pre>
<p>You are correct about needing to specify the dwell value in milliseconds. However, the RepRap Wiki indicates that you need to use the <code>Pn</code> argument, and not just an unadorned number as the argument to the command. To adapt the Wiki's own example, you will need to use:</p> <pre><code>G4 P30000 </code></pre> <p>This should cause the firmware to dwell (pause) for 30 seconds.</p> <p><a href="http://reprap.org/wiki/G-code#G4:_Dwell" rel="nofollow noreferrer">RepRap Wiki: G4: Dwell</a></p>
<p>Depending on your G-code flavor you may be able to use <a href="https://reprap.org/wiki/G-code#M109:_Set_Extruder_Temperature_and_Wait" rel="nofollow noreferrer"><code>M109</code></a> (heat and wait) instead. If supported M109 will wait until the target temperature is achieved.</p>
716
<p>I need to remotely install windows service on number of computers, so I use CreateService() and other service functions from winapi. I know admin password and user name for machines that I need access to. In order to gain access to remote machine I impersonate calling process with help of LogonUser like this: </p> <pre><code>//all variables are initialized correctly int status = 0; status = LogonUser(lpwUsername, lpwDomain, lpwPassword, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, &amp;hToken); if (status == 0) { //here comes a error } status = ImpersonateLoggedOnUser(hToken); if (status == 0) { //once again a error } //ok, now we are impersonated, do all service work there </code></pre> <p>So, I gain access to machine in a domain, but some of computers are out of domain. On machines that are out of domain this code doesn't work. Is there any way to access service manager on machine out of domain?</p>
<p>You can do it , the account needs to exist on the remote machine and you need to use the machine name for the domain name in the LogonUser call.</p>
<p>Rather than rolling your own, why not just use the SC built-in command?</p>
8,794
<p>a little new to the windows workflow stuff so go easy :)</p> <p>I wish to design a workflow host environment that has high availability - a minimum of 2 WF runtime hosts on separate hardware both pointing to the same persistance or tracking SQL database.</p> <p>I am looking for a pattern whereby I can asynchronously create new workflow instances based on some external event (i.e. some piece of data is updated in DB by a different application). For each event I need to create exactly one workflow instance and doesn't matter which host that instance is created on. There is also some flexibility regarding the duration of time between the event and when the workflow instance is actually created.</p> <p>One solution I am considering is having a WCF interface on the WF hosts and placing them behind some sort of load balancer. It would then be up to whatever part of the system that is firing the "event" to make the WCF call.</p> <p>I'm not really happy with this because if both\all WF hosts are down, or otherwise unavailable, the event could be "lost". Also, I won't be able manage load the way I would like to. I envisage a situation where there may be lots of events in a small period of time, but it's perfectly acceptable to handle those events some time later.</p> <p>So I reckon I need to persist the events somehow and decouple the event creation from the event handling.</p> <p>Is putting these events into MSMQ, or a simple event table in SQL Server, and having the WF host just poll the queue periodically a viable solution? Polling seems to be a such a dirty word though...</p> <p>Would NServiceBus and durable messaging be useful here?</p> <p>Any insights would be much appreciated.</p> <p><strong>Addendum</strong></p> <p>The database will be clustered with shared fiber channel storage. The network will also be redundant. In order for WF runtime instances to have fail-over they must point at a common persistence service, which in this case is a SQL backend. It's high availability, not Total Availabilty :)</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa663362.aspx#hostingwwf_topic4" rel="nofollow noreferrer">MSDN article on WF Reliability and High Availabilty</a></p> <p>Also, each instance of the WF runtime must be running exactly the same bits, so upgrading will require taking them all down at the same time. I like the idea of being able to do that, if required, without taking the whole system down.</p>
<p>If you use a WCF service with a netMsmqBinding, you can receive queued messages without having to poll. Messages will wait if there is no service running to pick them up. You would want to make sure to use a clustered queue for reliability in case the main queuing machine goes down. </p> <p>Also be aware when upgrading that you can't resuscitate instances from an old version of the service. So to upgrade long running workflows, you need to stop them from receiving new requests and wait until all instances are finished before changing the bits, or the old instances will be stuck in your persistence store forever.</p>
<p>I would go with MSMQ/event table. Polling is only dirty if you do it wrong.</p> <p>One thing to keep in mind: you say you want multiple WF servers for high availability, <em>but both of them use the same SQL backend</em>? High availability only works if you remove <em>all</em> single points of failure, not just some of them.</p>
3,234
<p>I tried printing something after 7 weeks of not using the printer (before it worked greatly) and I think it doesn't extrude properly (although I'm not sure about it).</p> <p>When I tell the printer to extrude filament it works just fine, but during the print there seems to be a problem with it (see image below). When manually pushing the filament with some force, it works for a bit, but stops working after 1 minute.</p> <p>I tried cleaning the gear, levelling and cleaning the bed with almost no success.</p> <p>I'm using a Creality Ender 3 with a (golden) PLA filament.</p> <p>This is how the print error looks like. The first layer should be completely filled.</p> <p><a href="https://i.stack.imgur.com/1RAIk.jpg" rel="nofollow noreferrer" title="Failed first layer"><img src="https://i.stack.imgur.com/1RAIk.jpg" alt="Failed first layer" title="Failed first layer" /></a></p> <p>Note: I didn't change anything (neither the filament nor the software) and before it was printing fine with 200 °C.</p>
<p>I would first check that your nozzle temperature is correct for the PLA you are using. If it is correct, try increasing it 5-10 °C. I experienced an identical issue and found that it was an incorrect nozzle temperature.</p>
<p>This has happened to me before. As suggested in another answer by @HandyHowie I would try to increase the nozzle temp. PLA usually requires around 190-210 °C however I have found this usually varies from PLA type. I would try using something like 230 °C as this seems to work for me.</p> <p>Another issue could be with your slicer. It could mean that the slicer isn't correctly slicing the model and this is a result of it. I would try using a different slicer as well.</p> <p>Finally, if this is a model developed by you or another person, there is a chance that it hasn't been exported correctly. If all else fails I would let the printer continue running.</p> <p>From your image, it appears that it has only just started putting down the first layer. Sometimes my printer does this but goes and fills the holes in later on in the print.</p>
2,102
<p>I have a set of multiple assemblies (one assembly is to be used as an API and it depends on other assemblies). I would like to merge all assemblies into one single assembly but prevent all assemblies except the API one to be visible from the outside.</p> <p>I will then obfuscate this assembly with Xenocode. From what I have seen, it is impossible to internalize assembly with Xenocode.</p> <p>I have seen ILMerge from Microsoft, but was unable to figure if it can do what I want. <a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="nofollow noreferrer">http://research.microsoft.com/~mbarnett/ILMerge.aspx</a></p>
<p>I know Xenocode can merge assemblies into one but I am not sure if it will internalize other non-primary assemblies.</p> <p>I have found the /internalize switch in ILMerge that "internalize" all assemblies except the primary one. Pretty useful!</p>
<p>I suggest you look at the <code>InternalsVisibleTo</code> attribute on <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="nofollow noreferrer" title="MSDN">MSDN</a>.</p> <p>You can mark everything in all the assemblies (except the API assembly) as <code>internal</code> instead of <code>public</code>, then reshow them to just your API assembly.</p> <p>Having done that, using ILMerge should give you a single assembly with just the API classes visible.</p>
4,627
<p>I have a <a href="https://www.monoprice.com/product?c_id=107&amp;cp_id=10724&amp;cs_id=1072403&amp;p_id=21711" rel="nofollow noreferrer">Monoprice Select Mini V2</a> and I’ve recently been having issues with little strings that are thick and sturdy sticking off of models:</p> <p><a href="https://i.stack.imgur.com/xUMyH.jpg" rel="nofollow noreferrer" title="Example of stringing"><img src="https://i.stack.imgur.com/xUMyH.jpg" alt="Example of stringing" title="Example of stringing"></a></p> <p>I used Ultimaker Cura v3.4.1 to slice this model: <a href="https://www.thingiverse.com/thing:2563909" rel="nofollow noreferrer">Basic Retraction test</a> using <a href="https://hatchbox3d.com/collections/pla/products/3d-pla-1kg1-75-blk" rel="nofollow noreferrer">Hatchbox Black PLA</a> filament</p> <p>And the following settings:</p> <ul> <li>Layer Height: 0.1313 mm</li> <li>Wall Thickness 1.05 mm</li> <li>Infill: 22%</li> <li>Extruder Temp: 200 °C</li> <li>Bed Temp: 55 °C</li> <li>Retraction Distance: 4 mm</li> <li>Retraction Speed: 40 mm/s</li> <li>Speed: 50 mm/s</li> <li>Z-Hop When Retracted: Off</li> <li>Supports: Off</li> <li>Adhesion: Brim</li> </ul> <p>I’d appreciate any advice on how to fix this problem.</p>
<p>The Monoprice Select Mini V2 uses a Bowden style extrusion system. Bowden extruders compress the filament in the tube where the gap between the filament and inner tube diameter allow for the filament to buckle slightly and compress causing a pressure build-up in the hotend. Without retraction this implies that the filament will start to ooze out of the hotend once you stop extruding.</p> <p>From your settings can be seen that you are using retraction. The question now arises whether you retract enough? Furthermore, this stringing can be reduced by setting the correct settings for e.g. print temperature, retraction, coasting, travel speed. It is up to you to find the correct settings; test print objects like calibration prints (like in the image you showed) help you with finding the correct settings. </p> <p>Apparently, the retraction you use still allows for some filament to ooze out of the hotend as shown in your image. This means that prior to the travel move there is still some pressure left in the hotend. A parameter that reduced the pressure prior to the travel movement is called "coasting"; basically you define to stop extruding while the head is still completing the printing moves prior to the travel move. It is advised to explore this setting. Other options to investigate further include lowering filament print temperature or increase travel movement.</p>
<p>The Monoprice Select Mini V2 uses a Bowden style extrusion system. Bowden extruders compress the filament in the tube where the gap between the filament and inner tube diameter allow for the filament to buckle slightly and compress causing a pressure build-up in the hotend. Without retraction this implies that the filament will start to ooze out of the hotend once you stop extruding.</p> <p>From your settings can be seen that you are using retraction. The question now arises whether you retract enough? Furthermore, this stringing can be reduced by setting the correct settings for e.g. print temperature, retraction, coasting, travel speed. It is up to you to find the correct settings; test print objects like calibration prints (like in the image you showed) help you with finding the correct settings. </p> <p>Apparently, the retraction you use still allows for some filament to ooze out of the hotend as shown in your image. This means that prior to the travel move there is still some pressure left in the hotend. A parameter that reduced the pressure prior to the travel movement is called "coasting"; basically you define to stop extruding while the head is still completing the printing moves prior to the travel move. It is advised to explore this setting. Other options to investigate further include lowering filament print temperature or increase travel movement.</p>
1,049
<p>When using <code>G1</code> command in G-code, what is the difference between <code>Z</code>- axis and <code>E</code>- axis?</p> <p>I see all <code>E</code>, <code>F</code> and <code>Z</code> in</p> <pre><code>G1 Z0.350 F7800.000 G1 E-2.00000 F2400.00000 G92 E0 G1 X96.753 Y95.367 F7800.000 G1 E2.00000 F2400.00000 </code></pre>
<p>G-CODE can be confusing as historically it was <a href="http://ws680.nist.gov/publication/get_pdf.cfm?pub_id=823374" rel="noreferrer">developed for machining tools</a> rather than FDM printers, and thus:</p> <ul> <li>not all available commands make sense for a 3D printer</li> <li>some of the command do slightly different things than those one may intuitively think they do.</li> </ul> <p>Typically, Cartesian printers use 4 "axis": <code>X</code>, <code>Y</code> and <code>Z</code> for moving the printhead in space and <code>E</code> for "extruder". The "extruder axis" is not in fact at all an axis in the geometrical sense of the word: it refers to the amount of filament to be moved into (extruded) or out of (retracted) the printing head. The reason why it is considered an "axis" is that it is used in conjunction with the codes <code>G0</code> and <code>G1</code> which are for movement.</p> <p>Confusingly, the letter <code>E</code> is <a href="https://en.wikipedia.org/wiki/G-code#Letter_addresses" rel="noreferrer">used for the precision feedrate of lathes</a> but in the 3D printing world we rather use <code>F</code> to that purpose. As a non-native English speaker, I was further confused, because for the longest time I thought "feedrate" was referring to the amount of filament <em>fed</em> to the printing head, while in fact it is the speed at which the printing head moves (in mm/minute).</p> <p>So to summarise, your example code "translated" would look like this:</p> <pre><code>G1 Z0.350 F7800.000 ; move up 350 microns at 7.8 m/min G1 E-2.00000 F2400.00000 ; retract 2mm of filament at 2.4 m/min G92 E0 ; reset the extruder position G1 X96.753 Y95.367 F7800.000 ; move to X,Y (without changing Z) at 7.8 m/min </code></pre> <p>Should you wish to dig deeper into the topic, the <a href="http://reprap.org/wiki/G-code" rel="noreferrer">RepRap wiki page on gcode</a> is rather comprehensive. Mind that several manufacturers add their own "special codes" to the common ones....</p>
<p>z-axis refers typically to vertical movement</p> <p>F references are feed rates/movement rates</p> <p>E references are for the extruder, referencing the amount and speed to eject filament, negative e-values are retraction commands</p>
816
<p>I have an Anet A8 and I currently try to improve the y-axis (with a tensioner and a frame to support the structure). Now after I dis- and reassembled the y-axis, I get a loud rattling noise when homing the y-axis (and also when moving it stepwise from within the firmware). After the rattling goes on for a second or two, the printer halts and asks to reset. During the rattling, the print bed moves much slower. It appears to only rattle at the end of the axis, close to the endstop, however the point at which it starts to rattle appears random.</p> <p>I tried a tighter and looser belt and aligning the frame. When moving the bed manually, it does require some force, but it does not appear to be tighter at the back side of the axis. Also nothing seems to block the path of movement.</p> <p>I noticed that with a tighter belt the rattling starts only closer to the end stop, however it appears like I have to overtighten it to work properly. I got it to hit the end stop this way without halting, however it still produced the rattling sound. Also the y-stepper motor made a high pitched humming noise after this operation.</p> <p>What else could I check or do about it?</p> <p>This is a video showing the print bed with the rattling sound: <a href="https://www.youtube.com/watch?v=H0Xhz2GtUYQ" rel="nofollow noreferrer">https://www.youtube.com/watch?v=H0Xhz2GtUYQ</a></p> <p>View from below: <a href="https://youtu.be/oTEuZUWD0ZM" rel="nofollow noreferrer">https://youtu.be/oTEuZUWD0ZM</a></p> <p>This is the motor mount: <a href="https://i.stack.imgur.com/7xmJM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7xmJM.jpg" alt="enter image description here"></a></p> <p>And this is the tensioner with the support frame: <a href="https://i.stack.imgur.com/5wz8u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5wz8u.jpg" alt="enter image description here"></a></p>
<p>From your video, it sounds to me as though the stepper motor is fighting against the bed movement. That would indicate to me the bed rails on the X-axis are not square to the bed movement, which would cause binding of the linear bearings on the bed.</p> <p>To see if this is the issue, loosen the threaded rods in all six places (three placed times two rods). Loosen the belt tensioner so it is not causing any issues. Then see how the bed moves. If the bed is freed up, tighten the nuts on the threaded rods two at a time on the same plane (each plate of the frame). At each tightening, ensure the bed continues to move freely. Measure the distance as accurately as possible to ensure the frame continues to stay square and are parallel to each other. Once you have tightened all of the nuts on the threaded rod, then re-tighten the belt tensioner.</p> <p>If none of this solves it, it could also be an issue with your linear bearings. If your Anet A8 is a Chinesium clone, the bearings are not what I'd call "top notch". I replaced mine with Igus Drylin bearings and have not regretted the $10 investment. There are other printed options you could go with as well, which you can find on <a href="https://www.thingiverse.com/search?q=linear+bearings&amp;dwh=965c1f9d491dd88" rel="nofollow noreferrer">thingiverse.com</a>.</p>
<p>With the second video and the photos I could identify, that the sound in part stems from the belt:</p> <ul> <li>It is too loose and swing <strong>sideways</strong> as it pulls.</li> </ul> <p>Tighten the belt till it sounds <em>at least</em> like a C<sub>3</sub> or D<sub>3</sub> (130/146 Hz) and possibly higher. My Ender3 is <em>tuned</em> to something like A<sub>3</sub> (220 Hz). It should be tight and show no sideways swinging on using the motor.</p> <p>It seems also, that the belt is not running parallel but skewed - that would induce sideways swing too. Make sure the axis of the motor and the pully are parallel and the mounting point of the carriage is not sideways of the belt path, as this will rub the belt against the gear.</p>
1,145
<p>I can't find an answer to this question on the "mother" meta website; hope this is not related to my choice of words in the search box. </p> <p>The statistics of the <a href="https://3dprinting.stackexchange.com/">3D Printing</a> on <a href="http://area51.stackexchange.com/proposals/82438/3d-printing">Area51</a> show that only few items (questions and visits per day) are not up to par and need work. Do those need to reach a level of let's say "okay" before the site can loose the Beta stage?</p> <p>I'm interested to know what would be the requirements to get out of the Beta stage.</p> <hr> <p>Update September 5, 2019:</p> <p>It appears that the <em>"visits per day"</em> is <em>"excellent"</em> with close to three thousand visits. The "questions per day" still lack behind with a 3.0 value (<em>"needs work"</em>) while more than 5 is considered "healthy". All further stats seem to be <em>"okay"</em> or <em>"excellent"</em>.</p>
<p>This post, <a href="https://3dprinting.meta.stackexchange.com/questions/197/3d-printing-se-beta-status">3D Printing SE Beta Status</a>, by tbm0115 highlights the <em>three main</em> sticking points (IMHO clearer than the Area 51 page):</p> <ul> <li>Questions per day</li> <li><strike>Users vs Reputation</strike></li> <li><strike>Visits per day</strike></li> </ul> <p>Once those reach the required levels then that should be it. So, there is quite a way to go...</p> <p>The stats can be seen here, <a href="http://area51.stackexchange.com/proposals/82438/3d-printing">3D Printing Area51 site</a>:</p> <h3>Stats progress</h3> <p>Note: Only <em>changes</em> are shown (no date information)</p> <ul> <li><em>Questions per day</em> <strike><strong>2.1</strong></strike> -&gt; <strike>1.9</strike> <strike>1.6</strike> <strike>2.1</strike> <strike>2.7</strike> <strike>2.1</strike> <strike>1.7</strike> <strike>2</strike> <strike>2.4</strike> <strike>3.0</strike> <strike>2.5</strike> <strike>3.9</strike> <strike>2.8</strike> <strike>3.3</strike> <strike>3</strike> <strike>2.7</strike> <strike>2</strike> <strike>1.9</strike> <strike>2.1</strike> <strike>2.2</strike> 2.4</li> <li><em>Answer rate</em> <strike><strong>96 %</strong></strike> -&gt; <strike>93 %</strike> <strike>95 %</strike> <strike>96 %</strike> <strike>97 %</strike> <strike>98 %</strike> <strike>96 %</strike> <strike>95 %</strike> <strike>94 %</strike> <strike>88 %</strike> 87 %</li> <li><em>Users</em> <ul> <li><em>200+ reputation</em> <strike><strong>56/150</strong></strike> -&gt; <strike>103/150</strike> <strike>113/150</strike> <strike>139/150</strike> <strike>144/150</strike> <strike>151/150</strike> <strike>161/150</strike> <strike>164/150</strike> <strike>179/150</strike> <strike>194/150</strike> <strike>282/150</strike><sup>*</sup> <strike>351/150</strike> <strike>358/150</strike> 359/150</li> <li><em>2,000+ reputation</em> <strike><strong>4/10</strong></strike> -&gt; <strike>8/10</strike> <strike>9/10</strike> <strike>10/10</strike> <strike>11/10</strike> <strike>12/10</strike> <strike>14/10</strike> <strike>17/10</strike> <strike>19/10</strike> <strike>22/10</strike><sup>*</sup> 27/10</li> <li><em>3,000+ reputation</em> <strike><strong>3/5</strong></strike> -&gt; <strike>4/5</strike> <strike>6/5</strike> <strike>7/5</strike> <strike>8/5</strike> <strike>9/5</strike> <strike>11/5</strike> <strike>12/5</strike><sup>*</sup> 14/5</li> </ul> </li> <li><em>Answers per question</em> ratio is <strike><strong>2.0</strong></strike> -&gt; 1.9</li> <li><em>Visits per day</em> <strike><strong>753</strong></strike> -&gt; <strike>4</strike> <strike>2324</strike> <strike>2648</strike> <strike>2675</strike> <strike>2774</strike> <strike>2844</strike> <strike>3041</strike> <strike>3707</strike> <strike>2934</strike> <strike>3290</strike> <strike>8756</strike> <strike>7146</strike> <strike>6773</strike> <strike>6718</strike> <strike>6682</strike> <strike>6627</strike> <strike>6582</strike> <strike>6247</strike> <strike>6207</strike> <strike>6081</strike> <strike>5929</strike> <strike>5541</strike> 5469</li> </ul> <p><sup>*</sup> This change in the number of users with <em>X</em> reputation is, in part, due to the move from +5 to +10 reputation for upvoted questions on <a href="https://stackoverflow.blog/2019/11/13/were-rewarding-the-question-askers/">13 Nov 2019</a> (see also <a href="https://meta.stackoverflow.com/q/391250/4424636">Upvotes on questions will now be worth the same as upvotes on answers</a>).</p> <hr /> <h3>Alternative Stats presentation</h3> <p>Latest statistic shown in bold -&gt; chronological history shown thereafter</p> <ul> <li><em>Questions per day</em> <strong>2.4</strong> -&gt; <strike>2.1</strike> <strike>1.9</strike> <strike>1.6</strike> <strike>2.1</strike> <strike>2.7</strike> <strike>2.1</strike> <strike>1.7</strike> <strike>2</strike> <strike>2.4</strike> <strike>3.0</strike> <strike>2.5</strike> <strike>3.9</strike> <strike>2.8</strike> <strike>3.3</strike> <strike>3</strike> <strike>2.7</strike> <strike>2</strike> <strike>1.9</strike> <strike>2.1</strike> <strike>2.2</strike></li> <li><em>Answer rate</em> <strong>87 %</strong> -&gt; <strike>96 %</strike> <strike>93 %</strike> <strike>95 %</strike> <strike>96 %</strike> <strike>97 %</strike> <strike>98 %</strike> <strike>96 %</strike> <strike>95 %</strike> <strike>94 %</strike> <strike>88 %</strike></li> <li><em>Users</em> <ul> <li><em>200+ reputation</em> <strong>359/150</strong> -&gt; <strike>56/150</strike> <strike>103/150</strike> <strike>113/150</strike> <strike>139/150</strike> <strike>144/150</strike> <strike>151/150</strike> <strike>161/150</strike> <strike>164/150</strike> <strike>179/150</strike> <strike>194/150</strike> <strike>282/150</strike><sup>*</sup> <strike>351/150</strike> <strike>358/150</strike></li> <li><em>2,000+ reputation</em> <strong>27/10</strong> -&gt; <strike>4/10</strike> <strike>8/10</strike> <strike>9/10</strike> <strike>10/10</strike> <strike>11/10</strike> <strike>12/10</strike> <strike>14/10</strike> <strike>17/10</strike> <strike>19/10</strike> <strike>22/10</strike><sup>*</sup></li> <li><em>3,000+ reputation</em> <strong>14/5</strong> -&gt; <strike>3/5</strike> <strike>4/5</strike> <strike>6/5</strike> <strike>7/5</strike> <strike>8/5</strike> <strike>9/5</strike> <strike>11/5</strike> <strike>12/5</strike><sup>*</sup></li> </ul> </li> <li><em>Answers per question</em> ratio is <strong>1.9</strong> -&gt; <strike>2.0</strike></li> <li><em>Visits per day</em> <strong>5469</strong> -&gt; <strike>753</strike> <strike>4</strike> <strike>2324</strike> <strike>2648</strike> <strike>2675</strike> <strike>2774</strike> <strike>2844</strike> <strike>3041</strike> <strike>3707</strike> <strike>2934</strike> <strike>3290</strike> <strike>8756</strike> <strike>7146</strike> <strike>6773</strike> <strike>6718</strike> <strike>6682</strike> <strike>6627</strike> <strike>6582</strike> <strike>6247</strike> <strike>6207</strike> <strike>6081</strike> <strike>5929</strike> <strike>5541</strike></li> </ul> <hr /> <h3>Additional points of note</h3> <p>The stats above aren't really the be all to end all... there are a few other considerations that I came across here, <a href="https://robotics.meta.stackexchange.com/questions/1354/graduation-of-this-community/1355#1355">in this answer</a>, to <a href="https://robotics.meta.stackexchange.com/questions/1354/graduation-of-this-community">“Graduation” of this Community</a>:</p> <ol> <li>A number of 10k+ users ( <em>n</em> &gt; 3 ) are required to access mod tools</li> <li>A number of 3k+ users ( <em>n</em> &gt; 10 ) are required to be able to fully vote</li> </ol> <h3>The final hurdle</h3> <p>The main sticking point, according to this meta post on Ethereum, <a href="https://ethereum.meta.stackexchange.com/questions/474/congratulations-ethereum-is-graduating">Congratulations! Ethereum is graduating!</a>, is 10 questions per day, which we are a long way from, and seems to be the last remaining issue. A link (<a href="https://meta.stackexchange.com/questions/257614/graduation-site-closure-and-a-clearer-outlook-on-the-health-of-se-sites">Graduation, site closure, and a clearer outlook on the health of SE sites</a>) from the Ethereum meta post to Meta.SE states:</p> <blockquote> <p>When a site starts to consistently receive 10 questions/day, we’ll consider it for graduation.</p> </blockquote> <h3>No graduation, but losing the Beta label...</h3> <p>Apart from graduation, SE management has recognised that small sites (with an active community) struggle to reach the 10 questions/day consistently. For sites that have been waiting to get out of Beta by graduation for 7-8 years, SE has decided to drop the Beta label. Please see <a href="https://meta.stackexchange.com/questions/331708/congratulations-to-our-29-oldest-beta-sites-theyre-now-no-longer-beta?cb=1">Congratulations to our 29 oldest beta sites - They're now no longer beta!</a>.</p> <hr /> <h3>CSV Format</h3> <ul> <li>Format: <code>heading,data,date,data,date,...,data,date</code></li> <li>Date format: <code>YYYYMMDD</code></li> </ul> <pre><code>*Questions per day*,2.1,20170317,1.9,20180525,1.6,20180705,2.1,20180707,2.7,20180815,2.1,20180903,1.7,20181015,2,20181106,2.4,20190327,3.0,20190905,2.5,20191119,3.9,20210121,2.8,20210411,3.3,20210423,3.3,20210424,3,20210425,3,20210426,2.7,20210427,2,20210506,2,20210508,1.9,20210511,2.1,20210514,2.2,20210525,2.4,20210526 *Answer rate*,96,20170317,93,20180525,95,20180705,96,20180707,96,20180815,97,20180903,98,20181015,98,20181106,96,20190327,95,20190905,94,20191119,88,20210121,88,20210411,88,20210423,88,20210424,88,20210425,88,20210426,88,20210427,88,20210506,88,20210508,87,20210511,87,20210514,87,20210525,87,20210526 *200+ reputation*,56,20170317,103,20180525,113,20180705,139,20180707,144,20180815,151,20180903,161,20181015,164,20181106,179,20190327,194,20190905,282,20191119,351,20210121,358,20210411,358,20210423,358,20210424,358,20210425,358,20210426,358,20210427,358,20210506,358,20210508,358,20210511,358,20210514,359,20210525,359,20210526 *2,000+ reputation*,4,20170317,8,20180525,9,20180705,10,20180707,11,20180815,12,20180903,14,20181015,14,20181106,17,20190327,19,20190905,22,20191119,27,20210121,27,20210411,27,20210423,27,20210424,27,20210425,27,20210426,27,20210427,27,20210506,27,20210508,27,20210511,27,20210514,27,20210525,27,20210526 *3,000+ reputation*,3,20170317,4,20180525,6,20180705,7,20180707,7,20180815,7,20180903,7,20181015,8,20181106,9,20190327,11,20190905,12,20191119,14,20210121,14,20210411,14,20210423,14,20210424,14,20210425,14,20210426,14,20210427,14,20210506,14,20210508,14,20210511,14,20210514,14,20210525,14,20210526 *Answers per question*,2.0,20170317,1.9,20180525,1.9,20180705,1.9,20180707,1.9,20180815,1.9,20180903,1.9,20181015,1.9,20181106,1.9,20190327,1.9,20190905,1.9,20191119,1.9,20210121,1.9,20210411,1.9,20210423,1.9,20210424,1.9,20210425,1.9,20210426,1.9,20210427,1.9,20210506,1.9,20210508,1.9,20210511,1.9,20210514,1.9,20210525,1.9,20210526 *Visits per day*,753,20170317,4,20180525,2324,20180705,2648,20180707,2675,20180815,2774,20180903,2844,20181015,3041,20181106,3707,20190327,2934,20190905,3290,20191119,8756,20210121,7146,20210411,6773,20210423,6718,20210424,6682,20210425,6627,20210426,6582,20210427,6247,20210506,6207,20210508,6081,20210511,5929,20210514,5541,20210525,5469,20210526 </code></pre> <p>Auto-generate markdown lists and CSV: <a href="https://gitlab.com/testkins/se3dp_plotterscraper" rel="nofollow noreferrer">GitLab: SE3DP_PlotterScraper</a>/<a href="https://gitlab.com/testkins/se3dp_plotterscraper/-/blob/master/Area51Scraper.py" rel="nofollow noreferrer">Area51Scraper.py</a></p> <hr /> <h3>Graphical representation</h3> <p><a href="https://i.stack.imgur.com/MYOoT.png" rel="nofollow noreferrer" title="Graph of stats"><img src="https://i.stack.imgur.com/MYOoT.png" alt="Graph of stats" title="Graph of stats" /></a></p> <p>Graph script: <a href="https://gitlab.com/testkins/se3dp_plotterscraper" rel="nofollow noreferrer">GitLab: SE3DP_PlotterScraper</a>/<a href="https://gitlab.com/testkins/se3dp_plotterscraper/-/blob/master/StackExchange3DP_6.py" rel="nofollow noreferrer">StackExchange3DP_6.py</a></p>
<p>One thing that I noticed about the stats for this site when I first came across it was how high the number of registered users and visits is, compared with the number of active users and questions.</p> <p>For some time, I felt the site had either picked up some bad stats, or was in the final stages of fading away. I think things are a little more normal now though.</p> <p>It seems that we still have a bit of a problem with becoming sticky for lots of users. We're at 151 200 rep users (out of 10k), and <a href="https://area51.stackexchange.com/proposals/94224/internet-of-things">IoT</a> is at 149 out of 7k, so it seems maybe we're not too far apart. The big difference seems to be the number of views. 1.2k per day on IoT, and 2.8k here (maybe expected since views depend on visibility of the site spreading over time).</p> <p>Are people really coming here and finding answers to their questions? Are they coming here and asking a single question? Are we on the wrong end of cheap printers with poor support, holding back the really interesting questions?</p>
47
<p>How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?</p>
<p>This guy seems to have your answer.</p> <blockquote> <p><a href="https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net" rel="noreferrer">https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net</a></p> </blockquote> <p>And in case the blog ever goes away or breaks the url, here's the github link:</p> <blockquote> <p><a href="https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs" rel="noreferrer">https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs</a></p> </blockquote> <hr> <p>Usage of the Crc32 class from the blog post:</p> <pre><code>Crc32 crc32 = new Crc32(); String hash = String.Empty; using (FileStream fs = File.Open("c:\\myfile.txt", FileMode.Open)) foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").ToLower(); Console.WriteLine("CRC-32 is {0}", hash); </code></pre>
<p>Using the logic from the previous answer, this was my take:</p> <pre><code>public class CRC32 { private readonly uint[] ChecksumTable; private readonly uint Polynomial = 0xEDB88320; public CRC32() { ChecksumTable = new uint[0x100]; for (uint index = 0; index &lt; 0x100; ++index) { uint item = index; for (int bit = 0; bit &lt; 8; ++bit) item = ((item &amp; 1) != 0) ? (Polynomial ^ (item &gt;&gt; 1)) : (item &gt;&gt; 1); ChecksumTable[index] = item; } } public byte[] ComputeHash(Stream stream) { uint result = 0xFFFFFFFF; int current; while ((current = stream.ReadByte()) != -1) result = ChecksumTable[(result &amp; 0xFF) ^ (byte)current] ^ (result &gt;&gt; 8); byte[] hash = BitConverter.GetBytes(~result); Array.Reverse(hash); return hash; } public byte[] ComputeHash(byte[] data) { using (MemoryStream stream = new MemoryStream(data)) return ComputeHash(stream); } } </code></pre>
2,960
<p>I've always been wondering about the actual accuracy of 3D printing devices. When looking for the perfect machine to buy, I looked at the speed, price, filaments supported etc, but also accuracy. I once asked somebody who could give me some advice on what to look at. </p> <p>One of the things I was told about was that many printers don't necessarily have that crazy precision of 0.05&nbsp;mm (50 micron). Another person told me something different - he said most of those printers actually were capable of putting out 50 micron layer height. How is it really? </p> <p>Another thing is that the official slicers for those machines also claim that this precision is real, for instance the PrusaSlicer v2.0. </p> <p>There are many high-end, very expensive machines and even they sometimes claim their resolution is worse than 50 microns.</p>
<p>There's not a simple answer to this question, or if there is, it's "no". However the situation is a lot more complicated. When printer specs cite accuracy like this, they're usually basing the claim on the nominal size of the smallest movements on each axis by one "microstep" of the stepper motors. There's a great article on Hackaday explaining the how this affects accuracy: <a href="https://hackaday.com/2016/08/29/how-accurate-is-microstepping-really/" rel="noreferrer">How Accurate is Microstepping Really</a>.</p> <p>At the mechanical positioning level - putting the print head where it needs to be to extrude the material with the desired accuracy - you have at least these factors limiting your accuracy:</p> <ul> <li><p>Microsteps are generally spaced roughly monotonically between whole steps, but do not necessarily divide the whole step into even portions. How well they do is a matter of the stepper drivers your printer's controller board uses. Generally, microsteps are 1/16 of a step (although there are drivers with 1/8, 1/32, or even 1/256, maybe others too), so if you see a rated accuracy of 0.05 mm, a whole step, which might be the minimum you can get reliable accuracy from, is likely 0.8 mm.</p></li> <li><p>Stepper motors are deflected slightly - up to 2 whole steps but less than one step is more likely if they're not overloaded - under load. So are belts. How much this affects you depends on the design of the printer and how much mass each axis is moving. Direct drive extruders are much worse in this regard. Delta printers are probably best in it.</p></li> </ul> <p>These can be mitigated somewhat, with tradeoffs, by using stepper motors with more steps per rotation, better stepper driver chips, reduction with gears, etc.</p> <p>On top of that, you also have extrusion and properties of the print material limiting your accuracy:</p> <ul> <li><p>The extruder motor is subject to the same accuracy issues as the positioning ones. If you extrude too much or too little material anywhere, you'll necessarily have accuracy issues. You can compute them based on the cross-sectional area of filament, size of extruder gear, extruder motor step and microstep size, etc.</p></li> <li><p>If the filament diameter is not perfectly consistent, you'll also extrude too much or too little material.</p></li> <li><p>If material is not cooled or kept warm appropriately as it's extruded (this varies by material), it will sag, warp, or curl, ending up in a different place from where you wanted it.</p></li> <li><p>The more you vary the ratio between nozzle/extrusion width and layer height from an ideal ratio, the more the shape of the extruded material paths will differ from the model you're trying to print. With thick layers especially they'll become rounded rather than near-flat along the walls.</p></li> </ul> <p>In theory, a lot of these issues probably could be mitigated a lot better than they are now just by better <em>slicing</em> - the logic that happens on a computer to convert the original 3D model into instructions for where to extrude material.</p> <p>With all that said, you can get pretty amazing accuracy still, especially with a good or well-tuned so-so printer. On my cheap Ender 3, after dealing with some issues now and then that made glaringly obvious problems, I can get dimensional accuracy within 0.1 mm in the X and Y directions, at least for some models. So I think it's very plausible that a better, or better-tuned, printer could get 0.05 mm accuracy.</p>
<p>Tom's answer is correct, most printers will operate properly with a layer height <em>resolution</em> of 50 micron, using a 0.4mm nozzle. The resulting surface finish will probably be better than at a coarser layer setting, and at finer layer heights the print quality is likely to deteriorate.</p> <p>Layer height is also likely to be fairly well defined (except for the first layers, overhangs, warping, etc), but this depends on the printer geometry.</p> <p>The detail which is not so well controlled (or measured) is the squish/stretch of the molten plastic as it is extruded. This can have a significant impact on the localised surface finish (as well as dimensions of things like internal diameters).</p> <p>Accuracy is maybe best assessed by the results of printing various types of test part than by a simple numeric parameter.</p>
1,374
<p>I come from a world that favors building your own rather than rely on libraries and frameworks built by others. After escaping this world I have found the joy, and ease, of using such tools as Typed DataSets within Visual Studio. So besides the loss of flexibility what else do you lose? Are there performance factors (disregarding the procs vs dynamic sql debate)? Limitations?</p>
<p>Typed datasets are by far an upgrade from the world of classic ADO disconnected recordsets. I have found that they are still nice to use in simple situations where you need to perform some sort task that's row oriented -- i.e. you still want to work in the context of a database paradigm of rows, columns, constraints and the like. If used wisely in that context, then you're OK.</p> <p>There are a few areas where their benefits diminish:</p> <ul> <li>I think the synchronization issues brought up here already are definitely a problem, especially if you've gone and customized them or used them as a base class.</li> <li>Depending on the number of data tables in the dataset, they can become quite <em>fat</em>. I mean this in the sense that multi-table datasets typically present a relational view of data. What comes along with that, besides the in-memory footprint, are definition of keys and potentially other constraints. Again, if that's what you need great, but if you need to traverse data quickly, one time, then an efficient loop with a data reader might be a better candidate.</li> <li>Because of their complex definition and potential size, using them in remoting situations is ill advised as well.</li> <li>Finally, when you start realizing you need to work with your data in objects that are relevant to your problem domain, their use becomes more of a hindrance than a benefit. You constantly find yourself moving fields in and out of rows tables in the set and concerning yourself with the state of the tables and rows. You begin to realize that they made OO languages to make it easier to represent real-world problem domain objects and that working with tables, rows and columns doesn't really fit into that way of thinking.</li> </ul> <p>Generally in my experience, I am finding that complex systems (e.g. many large enterprise systems) are better off moving away from the use of datasets and more towards a solid domain specific object model -- how you get your data in and out of those objects (using ORM's for example) is another topic of conversation altogether. However, in small projects where there's a form slapped in front of data that needs to basic maintenance and some other simple operations, great productivity can be acheived with the dataset paradigm -- especially when coupled with Visual Studio/.Net's powerful databinding features. </p>
<p>Datasets are nice for quickly slapping something together with visual studio, if all the issues mentioned previously are ignored. One problem I did not see mentioned is the visual scalability of datasets within the design surface of Visual Studio. As the system grows, the size of the datasets inevitably becomes unwieldy. The visual aspects of the designer simply don't scale. It is a real pain to scroll around trying to find a particular table or relation when the dataset has more than 20 or so tables.</p>
7,673
<p>I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#) for several months now. For the most part my IDE is set up fairly standard but I have been wondering what are some suggestions in terms of plugins/settings that you find to be the most useful?</p> <p><strong>Update</strong>: Thanks for all the great suggestions. It looks like a general consensus that I should look into 'Resharper' along with some eye-candy with themes and custom fonts.</p> <hr> <p><strong>Themes</strong></p> <ul> <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&amp;displaylang=en" rel="nofollow noreferrer">Consolas Font Pack for Visual Studio 2005/2008</a></li> <li><a href="http://www.hanselman.com/blog/VisualStudioProgrammerThemesGallery.aspx" rel="nofollow noreferrer">Scott Hanselman's Visual Studio Themes Gallery</a></li> <li><a href="http://frickinsweet.com/tools/Theme.mvc.aspx" rel="nofollow noreferrer">Visual Studio Theme Generator</a></li> </ul> <p><strong>Free Tools</strong></p> <ul> <li><a href="http://visualstudiogallery.msdn.microsoft.com/en-us/df3f0c30-3d37-4e06-9ef8-3bff3508be31" rel="nofollow noreferrer">PowerCommands for Visual Studio 2008</a></li> <li><a href="http://submain.com/products/ghostdoc.aspx" rel="nofollow noreferrer">GhostDoc</a></li> <li><a href="http://www.codeplex.com/hyperAddin" rel="nofollow noreferrer">HyperAddin</a></li> <li><a href="http://www.hanselman.com/blog/IntroducingRockScroll.aspx" rel="nofollow noreferrer">RockScroll</a></li> <li><a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/" rel="nofollow noreferrer">CodeRush XPress</a></li> <li><a href="http://www.red-gate.com/products/reflector/" rel="nofollow noreferrer">.NET Reflector</a> - (Not a plugin but still useful)</li> </ul> <p><strong>Paid Tools</strong></p> <ul> <li><a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a> - Free (Open Source), $49 (Academic), $199 (Personal), $349 (Commercial)</li> <li><a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/" rel="nofollow noreferrer">CodeRush with Refactor!™ Pro</a> - $249</li> </ul>
<p><strong><a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a></strong> is definitely a great tool. It has a moderate learning curve but is easy to pick up for some simple things and add mastery later. It is a good price for students and kinda expensive for the rest of us. Resharper is similar to CodeRush, but seems to have a larger following.</p> <p><strong><a href="http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionID=df3f0c30-3d37-4e06-9ef8-3bff3508be31" rel="nofollow noreferrer">PowerCommands</a></strong> is a great set of add-ons that comes free from Microsoft. Things like "Open in Windows Explorer", "Command Prompt Here", and Copy/Paste references. </p> <p>A discussion regarding <strong>add-ins</strong> is <a href="https://stackoverflow.com/questions/2767/do-you-have-any-recommended-add-onsplugins-for-microsoft-visual-studio">floating around here somewhere</a>.</p> <p>For straight-up customization, <strong>changing colors</strong> is fun, easy, and gives you a big bang for your buck. I prefer a slightly personalized version of <a href="http://blog.wekeroad.com/2007/10/17/textmate-theme-for-visual-studio-take-2/" rel="nofollow noreferrer">Rob Conery's TextMate theme for Visual Studio.</a> Once you get colors you like, you can just <a href="http://msdn.microsoft.com/en-us/library/zbhkx167(VS.80).aspx" rel="nofollow noreferrer">export the settings</a> and carry them with you wherever you go.</p> <p>Related to colors and themes, the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&amp;displaylang=en" rel="nofollow noreferrer"><strong>Consolas</strong> font pack</a> is pretty nifty and easy on the eye.</p> <p>And like John recommends, a <a href="https://stackoverflow.com/questions/20507/give-me-awesome-visual-studio-keyboard-short-cuts">mastery of <strong>keyboard shortcuts</strong></a> will pay big dividends.</p>
<p>I have Resharper and SQL Prompt, both are excellent.</p>
6,331
<p>How can one determine, in code, how long the machine is locked?</p> <p>Other ideas outside of C# are also welcome.</p> <hr> <p>I like the windows service idea (and have accepted it) for simplicity and cleanliness, but unfortunately I don't think it will work for me in this particular case. I wanted to run this on my workstation at work rather than home (or in addition to home, I suppose), but it's locked down pretty hard courtesy of the DoD. That's part of the reason I'm rolling my own, actually.</p> <p>I'll write it up anyway and see if it works. Thanks everyone!</p>
<p>I hadn't found this before, but from any application you can hookup a SessionSwitchEventHandler. Obviously your application will need to be running, but so long as it is:</p> <pre><code>Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch); void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLock) { //I left my desk } else if (e.Reason == SessionSwitchReason.SessionUnlock) { //I returned to my desk } } </code></pre>
<p>Below is the 100% working code to find if the PC is locked or not.</p> <p>Before using this use the namespace <code>System.Runtime.InteropServices</code>.</p> <pre><code>[DllImport("user32", EntryPoint = "OpenDesktopA", CharSet = CharSet.Ansi,SetLastError = true, ExactSpelling = true)] private static extern Int32 OpenDesktop(string lpszDesktop, Int32 dwFlags, bool fInherit, Int32 dwDesiredAccess); [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern Int32 CloseDesktop(Int32 hDesktop); [DllImport("user32", CharSet = CharSet.Ansi,SetLastError = true,ExactSpelling = true)] private static extern Int32 SwitchDesktop(Int32 hDesktop); public static bool IsWorkstationLocked() { const int DESKTOP_SWITCHDESKTOP = 256; int hwnd = -1; int rtn = -1; hwnd = OpenDesktop("Default", 0, false, DESKTOP_SWITCHDESKTOP); if (hwnd != 0) { rtn = SwitchDesktop(hwnd); if (rtn == 0) { // Locked CloseDesktop(hwnd); return true; } else { // Not locked CloseDesktop(hwnd); } } else { // Error: "Could not access the desktop..." } return false; } </code></pre>
6,677
<p>Can one be simulated by periodicly syncing with GPS and in the meen while working with the accelerometer? I know for example that the N95 accelerometer is invarient to rotation on the Y axis (while beeing face up/down).</p>
<p>The original iPhone and the iPhone 3G use GPS to calculate the heading, however the iPhone 3GS now has a 3-dimensional magnetometer compass in it.</p> <p>This can only be done taking two GPS coordinates (while moving) and determining the direction from point A to B.</p>
<p>Extra info: The IPHONE 1 did not have GPS or compass.</p>
6,431
<p>I'd like to script FlexBuilder so that I can run debug or profile without having to switch to FlexBuilder and manually clicking the button (or using the key combo). Is this possible without writing an extension?</p> <p>To be more specific, this is exactly what I want to do: I want to create a TextMate command that talks to FlexBuilder and makes it run the debug target for the currently selected project. TextMate already has support for interacting with Xcode in this way, and it would be great to be able to do the same with FlexBuilder.</p>
<p>When compiling I use Ant and have full control over that from TextMate, what I want is to be able to launch the <em>debugger</em> and the <em>profiler</em>. The command line debugger is unusable and there is no other profiler available than the one in FlexBuilder.</p>
<p>Since FlexBuilder essentially is an extended version of Eclipse, any tools/scripts for doing the same in Eclipse should work for FlexBuilder aswell. I couldn't find any tools like this googling it, have you considered doing away with FlexBuilder completely, there are plenty of guides for using the mxmlc (or fcsh) compilers directly from your editor.</p>
3,114
<p>I use my mobile phone for connection to the internet on my laptop, I also have a wired connection to a LAN which doesn't have internet conectivity, it just has our TFS server on it.</p> <p>The problem is that I can't use the internet (from the phone) with the LAN cable plugged in. Is there a way to set the default route to my phone?</p> <p>I'm running Windows XP.</p>
<p>There's many OS specific ways to force routing over specific interfaces. What OS are you using? XP? Vista? *nix?</p> <p>The simplest way is to configure your network card with a static IP and NO GATEWAY, the only gateway (ie. internet access) your laptop will find is then via the mobile.</p> <p>The disadvantage of this method is that you'll need to access your TFS server by IP address (or netbios name) as all DNS requests will be going out over the internet and not through your private LAN. </p> <p>EDIT: If you can't use the phone when the LAN is plugged in, that's because you've got it setup for DHCP and the DHCP server is advertising (incorrectly for you) that it will accept and route internet traffic. As previously mentioned, setup with a static IP and no gateway... if you insist on using DHCP you'll need to learn the ROUTE command in DOS, find the IP address of your phone (assuming it's acting as a router) set that as the default route, and remove whatever default route was assigned from the DHCP server.</p> <p>EDIT2: @dan - you can't use the internet from your phone directly (eg. mobile browser), or you can't make your laptop use your phone for internet when the cable is plugged in? (ie. routing issues) ... if it's the former, then your phone is probably configuring a PAN with your phone and trying to route internet back over the LAN</p> <p>EDIT @Jorge - IP routing is the responsibility of the network layer, not the application. Go review the <a href="http://en.wikipedia.org/wiki/OSI_model" rel="nofollow noreferrer">OSI model</a> ;)</p>
<p>You can actually configure what you want to be the default gateway globally using the "routes" command as described here: <a href="https://stackoverflow.com/questions/17785/default-internet-connection-on-dual-lan-workstation">Default Internet connection on Dual LAN Workstation</a></p> <p>I admit though, on windows it'd finicky at best as sometimes that setup will just disappear :(</p>
4,957
<p>If I add 3-400 databases to a single SQL Server instance will I encounter scaling issues introduced by the large number of databases?</p>
<p>This is one of those questions best answered by: Why are you trying to do this in the first place? What is the concurrency against those databases? Are you generating databases when you could have normalized tables to do the same functionality?</p> <p>That said, yes MSSQL 2005 will handle that level of database per installation. It will more or less be what you are doing with the databases which will seriously impede your performance (incoming connections, CPU usage, etc.)</p>
<p>I have never tried this in 2005. But a company I used to work for tried this on 7.0 and it failed miserably. With 2000 things got a lot better but querying across databases was still painfully slow and took too many system resources. I can only imagine things improved again in 2005.</p> <p>Are you querying across the databases or just hosting them on the same server? If you are querying across the databases, I think you need to take another look at your data architecture and find other ways to separate the data. If it's just a hosting issue, you can always try it out and move off databases to other servers as capacity is reached.</p> <p>Sorry, I don't have a definite answer here.</p>
9,334
<p>What are the basic necessities needed to build a 3d printing machine.</p> <ul> <li>Workforce</li> <li>Technology</li> <li>Money</li> <li>etc.</li> </ul> <p>I'm an undergrad and my friends and I would like to make a printer for a project. We wanted to get an idea of the prerequisites for this work. </p>
<p>Prints could end up on tray for couple of reasons. </p> <ul> <li>Vacuum force on early layers - Usually you should lose pieces on the center of platform <ul> <li>Put holes or channels on platform</li> <li>Very slow speed on early layers</li> <li>Use smaller platform</li> <li>Use tilt mechanism</li> <li>Use larger support structures</li> <li>Use stickier platform - Anodized aluminum is specially good </li> </ul></li> <li>Non-aligned platform - Pieces on side of platform end up on tray <ul> <li>Align platform / tray</li> </ul></li> <li>Low cure times - you could lose pieces around platform for DLP and whole platform for LCD ones</li> <li>Resin related issues <ul> <li>Resin designed for thinner layers - Decrease layer thickness</li> <li>Pigment settled down - Shake resin before use</li> </ul></li> </ul>
<p>I also had issues with the first layer sticking to the build plate and I did not want to sand the plate. As most people will mention you need to make sure that your plate is perfectly level and the z height is right (lots of friction on the paper). You also need the correct exposure times for your resin and the first few layers should get 60 seconds of exposure. <strong>PRO TIP to improve bed adhesion:</strong> apply a thin layer of resin to the build platform before you start to print. I have not any failed prints after I started coating the plate with resin. Also, I don't completely clean the plate between prints, I make sure it is still sticky. I hope this helps.</p>
647
<p>The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. </p> <p>Even though <code>imagesavealpha</code> is set, something isn't quite right.</p> <p>What's the best way to preserve the transparency in the resampled image?</p> <pre><code>$uploadTempFile = $myField[ 'tmp_name' ] list( $uploadWidth, $uploadHeight, $uploadType ) = getimagesize( $uploadTempFile ); $srcImage = imagecreatefrompng( $uploadTempFile ); imagesavealpha( $targetImage, true ); $targetImage = imagecreatetruecolor( 128, 128 ); imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, 128, 128, $uploadWidth, $uploadHeight ); imagepng( $targetImage, 'out.png', 9 ); </code></pre>
<pre><code>imagealphablending( $targetImage, false ); imagesavealpha( $targetImage, true ); </code></pre> <p>did it for me. Thanks ceejayoz.</p> <p>note, the target image needs the alpha settings, not the source image.</p> <p>Edit: full replacement code. See also answers below and their comments. This is not guaranteed to be be perfect in any way, but did achieve my needs at the time.</p> <pre><code>$uploadTempFile = $myField[ 'tmp_name' ] list( $uploadWidth, $uploadHeight, $uploadType ) = getimagesize( $uploadTempFile ); $srcImage = imagecreatefrompng( $uploadTempFile ); $targetImage = imagecreatetruecolor( 128, 128 ); imagealphablending( $targetImage, false ); imagesavealpha( $targetImage, true ); imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, 128, 128, $uploadWidth, $uploadHeight ); imagepng( $targetImage, 'out.png', 9 ); </code></pre>
<p>Here is my total test code. It works for me</p> <pre><code>$imageFileType = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION); $filename = 'test.' . $imageFileType; move_uploaded_file($_FILES["image"]["tmp_name"], $filename); $source_image = imagecreatefromjpeg($filename); $source_imagex = imagesx($source_image); $source_imagey = imagesy($source_image); $dest_imagex = 400; $dest_imagey = 600; $dest_image = imagecreatetruecolor($dest_imagex, $dest_imagey); imagecopyresampled($dest_image, $source_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $source_imagex, $source_imagey); imagesavealpha($dest_image, true); $trans_colour = imagecolorallocatealpha($dest_image, 0, 0, 0, 127); imagefill($dest_image, 0, 0, $trans_colour); imagepng($dest_image,"test1.png",1); </code></pre>
5,217
<p>Is there any software/methods to automatically splice objects into multiple pieces sort of like a jig saw puzzle so that I can combine them together and bypass the build plate size limit?</p> <p>As an example I have this 2D image that I want to print out but my printers size limit is roughly the size of the blue "squares." It's pretty tedious and time consuming to do this manually. Also, any tips on getting seamless lines or proper alignment when gluing these pieces together are appreciated. <a href="https://i.stack.imgur.com/uw7Kg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uw7Kg.png" alt="enter image description here"></a></p>
<p>From what I understand, you're trying to partition your object into smaller pieces with the hopes of putting them back together in a manner similar to a Jigsaw puzzle.</p> <p>There are two options that I know of to do this, which requires using OpenSCAD:</p> <ul> <li>The <a href="https://www.thingiverse.com/thing:35834" rel="nofollow noreferrer">PuzzleCut</a> library - This allows you to disassemble your object into a multiple pieces that can be assembled together in a jigsaw puzzle type manner</li> <li>The <a href="https://www.thingiverse.com/thing:310652" rel="nofollow noreferrer">PinCut</a> library - This allows you to disassemble your objects into multiple pieces that than be reassembled using the pins and corresponding holes on the pieces.</li> </ul>
<p>Sorry to put it that way, but does 3D printing the best "tool" for your case? </p> <p>it seems you want to generate a huge flat file when a CnC would be the best to generate a clean and solid part.</p> <p>Otherwise, as others suggets you are looking for a tooling tool.</p>
713
<p>On a Cartesian printer movements are really simple. If we assume the printer has 100 steps/mm on each axis, then a move of 10mm on a axis is just 1000 Steps on that axis.</p> <p>Movements that are not aligned with one axis are also simple. Moving from x,y = 0,0 to 10,10 would be 1000 steps on x and y.</p> <p>On deltas even for simple moves more than one motor has to move. And just calculating the amount of steps on each axis needed to reach the destination probably gives a curved move.</p> <p>So what is the algorithm to calculate the steps for a given move for a delta printer?</p>
<p>There are two main special steps to the technique used by most open-source 3d printer controllers:</p> <ol> <li>Divide each linear gcode segment into lots of very small subsegments ("Segmentation")</li> <li>Use some basic trigonometry or the pythagorean theorem to tie extruder position to carriage height for each of the three towers ("Inverse Kinematics") to find the target position for each small segment</li> </ol> <p>The inverse kinematics are surprisingly simple. A virtual 90 degree triangle is constructed from two known lengths to solve for the unknown third length: </p> <ul> <li>The fixed delta arm length is the hypotenuse of the triangle</li> <li>The horizontal distance between the column joints and end-effector joints is calculated from the XY coordinates of the nozzle and the fixed position of the column, to determine the length of the lower side of the triangle</li> <li>The length of the upper side of the triangle is calculated from the previous two via the pythagorean theorem</li> <li>The length of the upper side is added to the nozzle Z height to get the necessary carriage height</li> </ul> <p>I think the best open-source reference here is Steve Grave's Rostock Kinematics document, rev3 available for download here: <a href="https://groups.google.com/d/msg/deltabot/V6ATBdT43eU/jEORG_l3dTEJ" rel="noreferrer">https://groups.google.com/d/msg/deltabot/V6ATBdT43eU/jEORG_l3dTEJ</a> Some relevant pictures: <a href="https://i.stack.imgur.com/MxCMc.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/MxCMc.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/geOQI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/geOQI.jpg" alt="enter image description here"></a></p> <p>These inverse kinematics calculations are performed for each carriage to get a "carriage space" target position, and this is performed for every path sub-segment.</p> <p>The results from these steps can then be reinserted back into the standard linear path interpolation techniques for the printer, in which it fires steps in the necessary ratios and at the necessary rates to produce the desired straight-line motion and acceleration/velocity profile. (How THAT is done is a different question.)</p> <p>The net effect is that the printer will move through a series of small "linear" carriage movements (linear meaning constant* speed with respect to time) that collectively approximate the necessary curved (quadratic position with respect to time) carriage motions required to produce a straight-line end-effector move.</p> <p>*(<em>Constant speed before acceleration slowdowns are applied in order to obey dynamics constraints, anyway. Again, that's the subject of a different question.)</em></p> <p>Segmentation is very similar to the process of using a polygon to approximate a circle. If the facets are small enough, the polygon is a good approximation. Higher Segmentation rates produce less path-following error. The primary conceptual difference between drawing circle arcs and Delta motion paths is that the so-called "faceted arc" with Delta Segmentation is constructed in height-vs-time coordinates instead of the X-vs-Y coordinates you'd use to draw a circle on a computer screen. </p> <p>This system is used in large part because support for Delta style printers was originally bolted onto GRBL-based motion planners which were written exclusively for straight-line motion paths in Cartesian printers. It was a relatively minimal modification to the existing codebase compared to implementing full quadratic path interpolation.</p> <p>Techniques have evolved over the years. And alternate approaches are often used: for example, the dc42 fork of RepRapFirmware performs exact path-following without segmentation, by recalculating the proper time for the next step <em>after every step</em>. This is functionally equivalent to approximating a circle with a polygon facet count <em>so high that every pixel on the screen gets its own facet</em>. So it is exactly as accurate as the positioning resolution of the motors allows. The downside is that this segmentation-free technique is fairly processor-intensive, so it only works on relatively fast controllers, not the older 8bit Atmega AVR that powers most existing consumer/hobbyist printers today. </p> <p>Other techniques are possible. The academic parallel robotics control literature is a whole other world of mathematical techniques and complexity in order to produce generalized control algorithms that work for a wide range of robot mechanisms. The version we use in open-source 3d printers is quite simple and application-specific in comparison. </p>
<p>I am describing how this is done in the Marlin firmware.</p> <p>The first step is to split a linear movement from (x, y, z) to (x', y', z') into many discrete segments. To this end, the amount of time the move would take at a given speed is calculated, and the value <em>delta_segments_per_second</em> is used to calculate the number of segments used.</p> <p>This is done in the function <em>prepare_move_delta</em> in the file Marlin_main.cpp. The endpoints of each of these segments is then passed to the function <em>calculate_delta</em>:</p> <pre><code>void calculate_delta(float cartesian[3]) { //reverse kinematics. // Perform reversed kinematics, and place results in delta[3] // The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014 float SCARA_pos[2]; static float SCARA_C2, SCARA_S2, SCARA_K1, SCARA_K2, SCARA_theta, SCARA_psi; SCARA_pos[X_AXIS] = cartesian[X_AXIS] * axis_scaling[X_AXIS] - SCARA_offset_x; //Translate SCARA to standard X Y SCARA_pos[Y_AXIS] = cartesian[Y_AXIS] * axis_scaling[Y_AXIS] - SCARA_offset_y; // With scaling factor. #if (Linkage_1 == Linkage_2) SCARA_C2 = ((sq(SCARA_pos[X_AXIS]) + sq(SCARA_pos[Y_AXIS])) / (2 * (float)L1_2)) - 1; #else SCARA_C2 = (sq(SCARA_pos[X_AXIS]) + sq(SCARA_pos[Y_AXIS]) - (float)L1_2 - (float)L2_2) / 45000; #endif SCARA_S2 = sqrt(1 - sq(SCARA_C2)); SCARA_K1 = Linkage_1 + Linkage_2 * SCARA_C2; SCARA_K2 = Linkage_2 * SCARA_S2; SCARA_theta = (atan2(SCARA_pos[X_AXIS], SCARA_pos[Y_AXIS]) - atan2(SCARA_K1, SCARA_K2)) * -1; SCARA_psi = atan2(SCARA_S2, SCARA_C2); delta[X_AXIS] = SCARA_theta * SCARA_RAD2DEG; // Multiply by 180/Pi - theta is support arm angle delta[Y_AXIS] = (SCARA_theta + SCARA_psi) * SCARA_RAD2DEG; // - equal to sub arm angle (inverted motor) delta[Z_AXIS] = cartesian[Z_AXIS]; } </code></pre> <p>This function takes care of the delta geometry and calculations needed to convert the (x,y,z) coordinates of the segment endpoints to corresponding positions for the carriages. The translated coordinates are then passed to <em>plan_buffer_line</em>, which calculates the steps needed for each stepper motor and actually makes these steps happen.</p> <p>The exact kinematics used in this function are explained in much more detail at the <a href="https://github.com/MarlinFirmware/Marlin/wiki/Delta-kinematics" rel="nofollow">Marlin github</a>.</p> <p>What is important to note is that plan_buffer_line moves the carriages linearly, and the printhead thus describes an arc and not a straight line. A straight line move is thus approximated by many small arcs.</p>
199
<p>I just did a merge using something like:</p> <pre><code>svn merge -r 67212:67213 https://my.svn.repository/trunk . </code></pre> <p>I only had 2 files, one of which is a simple <code>ChangeLog</code>. Rather than just merging my <code>ChangeLog</code> changes, it actually pulled mine plus some previous ones that were not in the destination <code>ChangeLog</code>. I noticed there was a conflict when I executed --dry-run, so I updated <code>ChangeLog</code>, and there was still a conflict (and I saw the conflict when I did the actual merge).</p> <p>I then later diffed on the file I was merging from:</p> <pre><code>svn diff -r 67212:67213 ChangeLog </code></pre> <p>And I see just the changes I had made, so I know that extra changes didn't get in there somehow. </p> <p>This makes me worried that merge is not actually just taking what I changed, which is what I would have expected. Can anybody explain what happened?</p> <p>UPDATE: In response to NilObject:</p> <p>So, I have 2 files changed, only ChangeLog is relevant, the other merged fine. When I go to my regular trunk checkout, I do the diff command above and see:</p> <pre><code>Index: ChangeLog =================================================================== --- ChangeLog (revision 67212) +++ ChangeLog (revision 67213) @@ -1,3 +1,7 @@ +2008-08-06 Mike Stone &lt;myemail&gt; + + * changed_file: Details. + 2008-08-06 Someone Else &lt;their_email&gt; * theirChanges: Details. </code></pre> <p>After my merge of the previous changes, the diff of ChangeLog looks like this:</p> <pre><code>Index: ChangeLog =================================================================== --- ChangeLog (revision 67215) +++ ChangeLog (working copy) @@ -1,3 +1,14 @@ +&lt;&lt;&lt;&lt;&lt;&lt;&lt; .working +======= +2008-08-06 Mike Stone &lt;myemail&gt; + + * changed_file: Details. + +2008-08-06 Someone Else &lt;their_email&gt; + + * theirChanges: Details. + +&gt;&gt;&gt;&gt;&gt;&gt;&gt; .merge-right.r67213 2008-08-05 Someone Else2 &lt;their2_email&gt; * olderChange: Details. </code></pre> <p>Note that the entry that was incorrectly pulled in was not in the file I am merging it to, but yet it was not one of my changes and shouldn't have been merged anyways. It was easy to fix (remove the extra lines that weren't part of my changes), but it still makes me worry about merging automatically in <code>SVN</code>.</p>
<p>This only happens with conflicts - basically svn tried to merge the change in, but (roughly speaking) saw the change as:</p> <p>Add</p> <pre><code>2008-08-06 Mike Stone &lt;myemail&gt; * changed_file: Details. </code></pre> <p>before</p> <pre><code>2008-08-06 Someone Else &lt;their_email&gt; </code></pre> <p>And it couldn't find the Someone Else line while doing the merge, so chucked that bit in for context when putting in the conflict. If it was a non-conflicting merge only the changes you expected would have been applied.</p>
<p>There's not really enough information to go on here.</p> <pre><code>svn merge -r 67212:67213 https://my.svn.repository/trunk . </code></pre> <p>will merge any files changed in the revision 67212 in the folder /trunk on the repository and merge them into your current working directory. If you do:</p> <pre><code>svn log -r 67212 </code></pre> <p>What files does it show changed? Merge will only pull changes from the first argument, and apply them to the second. It does not upload back to the server in the first argument.</p> <p>If this doesn't answer your question, could you post more details as to what exactly is happening?</p>
2,609
<p>I want Windows Update to automatically download and install updates on my Vista machine, however I don't want to be bothered by the system tray reboot prompts (which can, at best, only be postponed by 4 hours).</p> <p>I have performed the registry hack described <a href="http://www.howtogeek.com/howto/windows-vista/prevent-windows-update-from-forcibly-rebooting-your-computer/" rel="noreferrer">here</a> to prevent Windows forcibly rebooting my machine, which is a good start. However, is there any way to get rid of the reboot prompts altogether, or decrease their frequency?</p>
<p>Not sure if it is the same for vista, but worth a try. </p> <p>On Windows XP, you can modify a group policy setting to change how frequently it re-prompts you. (start -> run type gpedit.msc)</p> <p>Look under Computer Configuration/Administrative Templates/Windows Components/Windows Update</p> <p>The setting you want is called Re-Prompt for restart with scheduled installations. The default is 10 minutes. </p> <p>You can also try modifying the No auto-restart for scheduled Automatic Updates installations setting found in the same location. </p>
<p>I will risk some down-votes here by saying: this seems a little bit schizophrenic, though a lot of people ask for it.</p> <p>If you want Windows to download and install the updates, but <strong>not</strong> complete the install process by rebooting - what's the point? Why not simply turn of AutoUpdates in the first place? if you don't even want the OS to tell you it would like to reboot, then how can you know that you need to, y'know, reboot?</p> <p>Patches which call for a reboot <strong>are not fully active until that reboot is complete</strong>; thus your system remains vulnerable to the unpatched behaviour. If you are a human who goes to the bathroom or eats meals, I just do not understand the mentality of wanting to patch but then postpone the reboot for days, weeks, months. Better to stay unpatched!</p>
8,072
<p>It would be helpful to me if I knew in advance how much the <strong><em>empty</em></strong> filament spool weighs. </p> <p>Not having emptied any spool yet, I can't contribute data points, but has anyone compiled a list of empty weights from various manufacturers and sizes?</p>
<p>Yes, there is a table on <a href="https://www.reddit.com/r/3Dprinting/comments/4hlwse/empty_spool_weights_for_estimating_remaining/" rel="nofollow noreferrer">Reddit - Empty spool weights for estimating remaining filament</a> which suggests that the norm (in 2015) was between 170 and 330 grams for a 1&nbsp;kg spool, superficially in a bimodal distribution clustered around the high and low points. Presumably these were for 3&nbsp;mm filament, this post dating to before the popularity of 1.75&nbsp;mm...</p> <p>Manufacturer's have an incentive to reduce the mass of their spools, or even ship without spools, since the shipping cost will eat into their profit margin.</p>
<p>Following on from <a href="https://3dprinting.stackexchange.com/questions/6558/is-there-a-table-or-list-of-tare-weights-of-empty-spools-of-various-manufacturer/6560#6560">Sean's excellent answer</a>, here is the (out of date) table in question: </p> <p><a href="https://i.stack.imgur.com/9Mdi0.png" rel="nofollow noreferrer" title="Empty spool weight table"><img src="https://i.stack.imgur.com/9Mdi0.png" alt="Empty spool weight table" title="Empty spool weight table"></a></p>
987
<p>In a silverlight application, I want to access the page the silverlight .xap file from an HTTP subdomain, but have the web services access a different subdomain for sensitive information over HTTPS.</p> <p>I set up clientaccesspolicy.xml at the root of the subdomain and it lets the silverlight app access its services over http, but not over https. It gives the cross domain access error that it would give normally without a clientaccesspolicy in place.</p> <p>I know that browsers themselves have a lot of restrictions about mixing http and https. Am I trying to do something that is not allowed? </p>
<p>Check out:<a href="http://silverlight.net/forums/t/12741.aspx" rel="nofollow noreferrer">http://silverlight.net/forums/t/12741.aspx</a></p> <blockquote> <p>You can either make https calls to the same domain or http cross-domain calls, but not https cross-domain calls.</p> <p>This is described in <a href="http://msdn2.microsoft.com/en-us/library/cc189008(VS.95).aspx" rel="nofollow noreferrer">http://msdn2.microsoft.com/en-us/library/cc189008(VS.95).aspx</a></p> <p>(see "If not HTTPS" in the matrix) By JohnSpurlock</p> </blockquote>
<p>The important thing to note here that is not in the above information clearly is you must have access to the "ROOT" level of the domain request, and the clientaccesspolicy.xml must reside at that level.</p> <p>If for example you have a production environment that your application is behind a load balancer that directs traffic as most large companies do to your application via the URI, you then have a little bit of a problem.</p> <p>Example: <a href="http://mydomain.com/MyApplication/" rel="nofollow noreferrer">http://mydomain.com/MyApplication/</a>* goes to your server, where your app resides. <a href="http://mydomain.com/clientaccesspolicy.xml" rel="nofollow noreferrer">http://mydomain.com/clientaccesspolicy.xml</a> is where the policy exists.</p>
9,922
<p>In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?</p>
<p>Gmail's SMTP-server requires a very specific configuration.</p> <p>From <a href="http://mail.google.com/support/bin/answer.py?answer=13287" rel="noreferrer">Gmail help</a>:</p> <pre><code>Outgoing Mail (SMTP) Server (requires TLS) - smtp.gmail.com - Use Authentication: Yes - Use STARTTLS: Yes (some clients call this SSL) - Port: 465 or 587 Account Name: your full email address (including @gmail.com) Email Address: your email address (username@gmail.com) Password: your Gmail password </code></pre> <p>You can probably set these settings up in <a href="http://pear.php.net/package/Mail" rel="noreferrer">Pear::Mail</a> or <a href="http://phpmailer.codeworxtech.com/" rel="noreferrer">PHPMailer</a>. Check out their documentation for more details.</p>
<p>You could use PEAR's mail function with Gmail's SMTP Server</p> <p>Note that when sending e-mail using Gmail's SMTP server, it will look like it came from your Gmail address, despite what you value is for $from.</p> <p>(following code taken from <a href="http://email.about.com/od/emailprogrammingtips/qt/et073006.htm" rel="nofollow noreferrer">About.com Programming Tips</a> )</p> <pre><code>&lt;?php require_once "Mail.php"; $from = "Sandra Sender &lt;sender@example.com&gt;"; $to = "Ramona Recipient &lt;recipient@example.com&gt;"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; // stick your GMAIL SMTP info here! ------------------------------ $host = "mail.example.com"; $username = "smtp_username"; $password = "smtp_password"; // -------------------------------------------------------------- $headers = array ('From' =&gt; $from, 'To' =&gt; $to, 'Subject' =&gt; $subject); $smtp = Mail::factory('smtp', array ('host' =&gt; $host, 'auth' =&gt; true, 'username' =&gt; $username, 'password' =&gt; $password)); $mail = $smtp-&gt;send($to, $headers, $body); if (PEAR::isError($mail)) { echo("&lt;p&gt;" . $mail-&gt;getMessage() . "&lt;/p&gt;"); } else { echo("&lt;p&gt;Message successfully sent!&lt;/p&gt;"); } ?&gt; </code></pre>
5,672
<p>What I am trying to do is change the background colour of a table cell &lt;td&gt; and then when a user goes to print the page, the changes are now showing.</p> <p>I am currently using an unobtrusive script to run the following command on a range of cells:</p> <pre><code>element.style.backgroundColor = "#f00" </code></pre> <p>This works on screen in IE and FF, however, when you go to Print Preview, the background colours are lost.</p> <p>Am I doing something wrong?</p>
<p>Is it not recommended to do this with stylesheets? You can change the media type in the LINK statement in your HTML, so when the page is printed, it will revert to the different style?</p>
<p>Have you tried hard-coding the values just to see if background-colors are showing on the print-preview at all? I think it is a setting in the Browser.</p>
4,973
<p>I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a <code>drand48()</code> which generates 48 random bits. I'd like a similar function/class for C++ or C# which can generate more than 32 bits of randomness and which low-order bits are equally as random as high-order bits.</p> <p>It doesn't have to be cryptographically secure but it must not use or be based on the C-language <code>rand()</code> or .NET <code>System.Random</code>.</p> <p>Any source code, links to source, etc. would be appreciated! Failing that, what TYPE of RNG should I be looking for?</p>
<p>For C++, <a href="http://www.boost.org/libs/random/" rel="noreferrer">Boost.Random</a> is probably what you're looking for. It has support for MT (among many other algorithms), and can collect entropy via the <code>nondet_random</code> class. Check it out! :-)</p>
<p><code>Boost.Random</code> is my first choice for RNG</p> <p><a href="http://www.boost.org/doc/libs/random" rel="nofollow">http://www.boost.org/doc/libs/random</a></p>
2,302
<p>I searched for this subject on Google and got some website about an experts exchange...so I figured I should just ask here instead.</p> <p>How do you embed a <code>JApplet</code> in HTML on a webpage?</p>
<p>Here is an example from <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html" rel="nofollow noreferrer">sun's website</a>:</p> <pre><code>&lt;applet code="TumbleItem.class" codebase="examples/" archive="tumbleClasses.jar, tumbleImages.jar" width="600" height="95"&gt; &lt;param name="maxwidth" value="120"&gt; &lt;param name="nimgs" value="17"&gt; &lt;param name="offset" value="-57"&gt; &lt;param name="img" value="images/tumble"&gt; Your browser is completely ignoring the &amp;lt;APPLET&amp;gt; tag! &lt;/applet&gt; </code></pre>
<p>Use the &lt;applet&gt; tag. For more info: <a href="http://java.sun.com/docs/books/tutorial/deployment/applet/html.html" rel="nofollow noreferrer">http://java.sun.com/docs/books/tutorial/deployment/applet/html.html</a></p>
6,356
<p>I am looking for a way to create an int\long representation of an arbitrary alpha-numeric String. Hash codes won't do it, because I can't afford hash collisions i.e. the representation must be unique and repeatable. </p> <p>The numeric representation will be used to perform efficient (hopefully) compares. The creation of the numeric key will take some time, but it only has to happen once, whereas I need to perform vast numbers of comparisons with it - which will hopefully be much faster than comparing the raw Strings.</p> <p>Any other idea's on faster String comparison will be most appreciated too...</p>
<p>Unless your string is limited in length, you can't avoid collisions. </p> <p>There are 4294967296 possible values for an integer (2^32). If you have a string of more than 4 ASCII characters, or more than two unicode characters, then there are more possible string values than possible integer values. You can't have a unique integer value for every possible 5 character string. Long values have more possible values, but they would only provide a unique value for every possible string of 8 ASCII characters.</p> <p>Hash codes are useful as a two step process: first see if the hash code matches, then check the whole string. For most strings that don't match, you only need to do the first step, and it's really fast.</p>
<p>How long are your strings? Unless you choose an int representation that's longer than the string, collisions will always be possible no matter what conversion you're using. So if you're using a 32 bit integer, you can only uniquely represent strings of up to 4 bytes.</p>
6,823
<p>Without local access to the server, is there any way to duplicate/clone a MySQL db (with content and without content) into another without using <code>mysqldump</code>?</p> <p>I am currently using MySQL 4.0.</p>
<p>I can see you said you didn't want to use <code>mysqldump</code>, but I reached this page while looking for a similar solution and others might find it as well. With that in mind, here is a simple way to duplicate a database from the command line of a windows server:</p> <ol> <li>Create the target database using MySQLAdmin or your preferred method. In this example, <code>db2</code> is the target database, where the source database <code>db1</code> will be copied.</li> <li>Execute the following statement on a command line:</li> </ol> <p><code>mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server] -u [user] -p[password] db2</code></p> <p>Note: There is NO space between <code>-p</code> and <code>[password]</code></p>
<p>Mysqldump isn't bad solution. Simplest way to duplicate database:</p> <p><code>mysqldump -uusername -ppass dbname1 | mysql -uusername -ppass dbname2</code></p> <p>Also, you can change storage engine by this way:</p> <p><code>mysqldump -uusername -ppass dbname1 | sed 's/InnoDB/RocksDB/' | mysql -uusername -ppass dbname2</code></p>
4,539
<p>I'm having a weird issue with Visual Studio 2008. Every time I fire it up, the solution explorer is about an inch wide. It's like it can't remember it's layout settings.</p> <p>Every un-docked window is in the position I place it. But if I dock a window, it's position is saved, but it's size will be reset to very-narrow (around an inch) when I load.</p> <p>I've never come across this before and it's pretty annoying. Any ideas?</p> <p>The things I've tried:</p> <ul> <li>Saving, then reloading settings via Import/Export.</li> <li>Resetting all environment settings via Import/Export.</li> <li>Window -> Reset Window layout.</li> <li>Comination of rebooting after changing the above.</li> <li>Installed SP1. No improvement</li> </ul> <p>none of which changed the behaviour of docked windows. (Also, definitely no other instances running..)</p> <p>I do run two monitors, but I've had this setup on three different workstations and this is the first time I've come across it.</p>
<p>I had the same problem. It turned out that if the VS window was non-maximized, it was really small. So after making the non-maximized wider, the problem disappeared.</p>
<p>Maybe you're closing Visual Studio while some other instance is still alive. The settings of the last instance that is closed is the one that will be applied.</p>
3,097
<p>I've read different things about PLA and heat-bed. Some say it is not needed, others recommend 60-70°C, but not for the first layers.</p> <p>For larger objects I often have the problem that the object does not stick to the blue-painters-tape-covered aluminium print plate. Instead the print "curls" up on one or more corners. To reduce this effect, I'm using a brim between 5 and 10mm. Depending on the size of the object the brim works quite well. Will heating the bed also improve the print quality by reducing the amount of heat warping / curling?</p>
<p>Heating the bed helps me, even with PLA. I print with a 60&nbsp;°C bed. The bed is 3/8" 6061 alloy aluminum, sanded with 600 grit sandpaper, coated with Elmer's purple glue stick, and dried.</p> <p>The brim will help. You might make the brim thicker than one layer (like 2-3 layers).</p> <p>If you look at the bottom of your print, are there large gaps where the PLA doesn't touch the bed? If so, you could zero the head closer to the bed, or increase the flow for the first layer.</p> <p>I haven't set up a cooling fan, although many praise the results. It is an experiment for a future day.</p>
<p>Heated bed definitely helps with PLA adhesion, it also helps depending the surface, for example PEI offers better adhesion than glass. Another option is to try to overextrude the first layer (125&nbsp;%) and make sure it is squeezed out, so basically you get a wavy effect on the first layer. This should help a bit even in the curly corners. Another thing I have noticed from experience is the PLA itself, not all PLAs are the same so you could try another manufacturer or try your PLA in a friend's printer to see if you get the same effect. Generally on PLA we do not expect any warping, but the reality is that some do have.</p>
455
<p>Name the design considerations in deciding between use of a <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="noreferrer">singleton</a> versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, every interviewer likes to see illustrative examples. :)</p>
<ul> <li>Singletons can implement interfaces and inherit from other classes.</li> <li>Singletons can be lazy loaded. Only when it is actually needed. That's very handy if the initialisation includes expensive resource loading or database connections.</li> <li>Singletons offer an actual object.</li> <li>Singletons can be extended into a factory. The object management behind the scenes is abstract so it's better maintainable and results in better code.</li> </ul>
<p>When the single class needs state. Singletons maintain a global state, static classes do not.</p> <p>For instance, making a helper around a registry class: If you have changable hive (HKey Current User vs. HKEY Local Machine) you could go:</p> <pre><code>RegistryEditor editor = RegistryEditor.GetInstance(); editor.Hive = LocalMachine </code></pre> <p>Now any further calls to that singleton will operate on the Local Machine hive. Otherwise, using a static class, you would have to specify that Local Machine hive everytiem, or have a method like <code>ReadSubkeyFromLocalMachine</code>.</p>
6,869
<p>I have a problem with some models like this (trim_tabs version) : <a href="https://www.thingiverse.com/thing:3401852" rel="nofollow noreferrer">https://www.thingiverse.com/thing:3401852</a></p> <p>When I import the model on simplify, the tabs are sticky to the model (see pic3.png) but when I slice it, on the preview, tabs are not sticky to the model (see pic1.png).</p> <p>I tried to do it on Cura and it works ; tabs stay stiky to the model (see pics2.png).</p> <p>What's wrong ? I attach my Simplify and Cura profile to help.</p> <p>To get pics and profiles : <a href="https://drive.google.com/open?id=1NkMBosI-xalRGjTSua1xDejZ2MKWZcV9" rel="nofollow noreferrer">https://drive.google.com/open?id=1NkMBosI-xalRGjTSua1xDejZ2MKWZcV9</a></p>
<p>I've tried that item as well. In fact, other than the heart, I built a <a href="https://www.thingiverse.com/thing:3825323" rel="nofollow noreferrer">remix</a> which works better but is still difficult to free up after printing. Those tabs you're concerned about will print better at a very low (thin) layer setting. </p> <p>I am pretty sure that the original design is faulty. All the "leaves" have gears which cause them to rotate when the threaded ring is turned. But the designer made all leaves identical! Each one needs its gear's null-position set differently so that it properly meshes with the thread positions of the outer ring at that leaf's placement. Some day I may remix to adjust those gear positions.... </p>
<p>It's not uncommon that different slicers have different effects on different models. The techniques used to slice the models differs. If the model you slice works fine in one and not in the other it's sometimes a setting but sometimes just the slicer. Just use the slicer that works :)</p>
1,574
<p>I am planning on creating a small website for my personal book collection. To automate the process a little bit, I would like to create the following functionality:</p> <p>The website will ask me for the ISBN number of the book and will then automatically fetch the title and add it to my database.</p> <p>Although I am mainly interested in doing this in php, I also have some Java implementation ideas for this. I believe it could also help if the answer was as much language-agnostic as possible.</p>
<p>This is the LibraryThing founder. We have nothing to offer here, so I hope my comments will not seem self-serving.</p> <p>First, the comment about Amazon, ASINs and ISBN numbers is wrong in a number of ways. In almost every circumstance where a book has an ISBN, the ASIN and the ISBN are the same. ISBNs are not now 13 digits. Rather, ISBNs can be either 10 or 13. Ten-digit ISBNs can be expressed as 13-digit ones starting with 978, which means every ISBN currently in existence has both a 10- and a 13-digit form. There are all sorts of libraries available for converting between ISBN10 and ISBN13. Basically, you add 978 to the front and recalculate the checksum digit at the end.</p> <p>ISBN13 was invented because publishers were running out of ISBNs. In the near future, when 979-based ISBN13s start being used, they will not have an ISBN10 equivalent. To my knowledge, there are no published books with 979-based ISBNs, but they are coming soon. Anyway, the long and short of it is that Amazon uses the ISBN10 form for all 978 ISBN10s. In any case, whether or not Amazon uses ten or thirteen-digit ASINs, you can search Amazon by either just fine.</p> <p>Personally, I wouldn't put ISBN DB at the top of your list. ISBN DB mines from a number of sources, but it's not as comprehensive as Amazon or Google. Rather, I'd look into Amazon—including the various international Amazons—and then the new Google Book Data API and, after that, the OpenLibrary API. For non-English books, there are other options, like Ozone for Russian books. </p> <p>If you care about the highest-quality data, or if you have any books published before about 1970, you will want to look into data from libraries, available by Z39.50 protocol and usually in MARC format, or, with a few libraries in Dublin Core, using the SRU/SRW protocol. MARC format is, to a modern programmer, pretty strange stuff. But, once you get it, it's also better data and includes useful fields like the LCCN, DDC, LCC, and LCSH.</p> <p>LibraryThing runs off a homemade Python library that queries some 680 libraries and converts the many flavors of MARC into Amazon-compatible XML, with extras. We are currently reluctant to release the code, but maybe releasing a service soon.</p>
<p>As an alternative to isbndb (which seems like the perfect answer) I had the impression that you could pass an ISBN into an Amazon product URL to go straight to the Amazon page for the book. While this doesn't programmatically return the book title, it might have been a useful extra feature in case you wanted to link to Amazon user reviews from your database.</p> <p>However, <a href="http://affiliate-blog.amazon.co.uk/2006/12/13digitisbn_how.html" rel="nofollow noreferrer" title="Amazon ISBN and ASIN faq">this link</a> appears to shows that I was wrong. Actually what Amazon uses is the ASIN number and while this used to be the same as 10-digit ISBN numbers, those are no longer the only kind - ISBNs now have 13 digits (though there is a straight conversion from the old 10-digit type).</p> <p>But more usefully, the same link does talk about the Amazon API which can convert from ISBN to ASIN and is likely to also let you look up titles and other information. It is primarily aimed at Amazon affiliates, but no doubt it could do the job if for some reason isbndb does not.</p> <p><strong>Edit:</strong> Tim Spalding above points out a few practical facts about ISBNs - I was slightly too pessimistic in assuming that ASINs would not correspond any more.</p>
6,277
<p>I am developing an <strong>Isolated Shell</strong> that caters to "<strong>designers/special content creators</strong>" performing specific tasks, using the Shell. As they operate on files, they need to be able to use TFS for source control. This is mainly due to the fact that Developers will also operate on the same files from TFS but using Visual studio 2008.</p> <p>After looking and searching I still could not find Team Explorer to be available to Shell. Asking on MSDN forums, lead me to the answer that "this is not supported yet in the Isolated Shell". Well, then the whole point of giving away a shell is not justified, if you want to use a source control system for your files. The idea is not to recreate everything and develop tool windows etc using the TFS provider API.</p> <p>The <a href="http://nayyeri.net/blog/professional-visual-studio-extensibility-finally-released/" rel="nofollow noreferrer">Visual Studio Extensibility book by Keyven Nayyeri</a> has an example, which only goes so far into this problem of adding a sc provider.</p> <p>Has anyone worked on developing <strong>Visual Studio 2008 Isolated Shell</strong> applications/environment? Please provide comments, questions - anything that you have to share apart from the following threads, which I've already participated in.</p> <p>Threads from MSDN forums:</p> <ul> <li><a href="http://forums.msdn.microsoft.com/en-US/vsx/thread/34347f72-853a-43cb-ba9e-9d6df718ca13/" rel="nofollow noreferrer">Team Explorer for Isolated Shell</a> </li> <li><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3382221&amp;SiteID=1" rel="nofollow noreferrer">Is it possible to use Team Explorer in VS Shell Isolated?</a></li> </ul> <hr> <p>Thanks for your answer. Yes you are right, we will acquire CALs for users without having to buy them Visual Studio, that's the direction we will be taking.</p> <p>But I am yet to figure out how to make Team Explorer available to such users, inside Shell. So I am looking to find out the technical details of how that can be done.</p> <p>I mean, I have a user, he installs my VS Shell application, he has no VStudio Team system on his machine. Now if I acquire CAL for TFS and install Team Explorer, do you think it will be automatically available in the VS Shell app?</p> <p>Any ideas? have you worked on making this happen?</p> <p>Thanks</p>
<p>It sounds like you are trying to allow the "special content creators" save files in TFS Source Control without having to buy them a license to a Visual Studio Team Edition -- correct me if I'm wrong.</p> <p>If that's the case, unfortunately I believe that you can't quite do that. Your users still need a Client Access License ("CAL") to access TFS.</p> <p>I think that you can acquire just CALs for your users without having to buy Visual Studio for them (I presume for less than a full blown Visual Studio would cost). At that point, you can just distribute to them the Team Explorer, which is a VS shell with nothing but TFS access components. That is available in your TFS server media.</p> <p>I found this via Google. You might want to review it to decide your best options:</p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ce194742-a6e8-4126-aa30-5c4e969af2a3&amp;DisplayLang=en" rel="nofollow noreferrer">Visual Studio Team System 2008 Licensing White Paper</a></p> <p>The only exception to the CAL rules I'm aware of is access to Work Items. Assuming properly licensed servers, anyone in your organization can create new Work Items or view and update existing ones <em>created by them</em>, using the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=faed8359-f54d-480e-8a86-f154d3dea07e&amp;displaylang=en" rel="nofollow noreferrer">Work Item Web Access</a> component.</p>
<p>It sounds like you are trying to allow the "special content creators" save files in TFS Source Control without having to buy them a license to a Visual Studio Team Edition -- correct me if I'm wrong.</p> <p>If that's the case, unfortunately I believe that you can't quite do that. Your users still need a Client Access License ("CAL") to access TFS.</p> <p>I think that you can acquire just CALs for your users without having to buy Visual Studio for them (I presume for less than a full blown Visual Studio would cost). At that point, you can just distribute to them the Team Explorer, which is a VS shell with nothing but TFS access components. That is available in your TFS server media.</p> <p>I found this via Google. You might want to review it to decide your best options:</p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ce194742-a6e8-4126-aa30-5c4e969af2a3&amp;DisplayLang=en" rel="nofollow noreferrer">Visual Studio Team System 2008 Licensing White Paper</a></p> <p>The only exception to the CAL rules I'm aware of is access to Work Items. Assuming properly licensed servers, anyone in your organization can create new Work Items or view and update existing ones <em>created by them</em>, using the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=faed8359-f54d-480e-8a86-f154d3dea07e&amp;displaylang=en" rel="nofollow noreferrer">Work Item Web Access</a> component.</p>
4,156
<p>I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb provider is not found. I researched and everything seems to point out that there is no solution. Any Help, please...</p>
<p>Have you tried changing the target CPU to <code>x86</code> instead of <code>"Any CPU"</code> in the advanced compiler options? I know that this solves some problems with other <code>OLEDB</code> providers by forcing the use of the 32-bit version.</p>
<p><code>Sybase Anywhere</code> has a <code>OLEDB provider</code> for <code>VFP</code> tables. It states in the page that the server supports <code>64 bit Windows</code>, don't know about the <code>OLEDB provider</code>:</p> <blockquote> <p>Support 64-bit Windows and Linux Servers</p> <p>In order to further enhance scalability, support for the x86_64 architecture was added to the Advantage Database Servers for Windows and Linux. On computers with an x86_64 processor and a 64 bit Operating System the Advantage Database Server will now be able to use memory in excess of 4GB. The extra memory will allow more users to access the server concurrently and increase the amount of information the server can cache when processing queries.</p> </blockquote> <p>I didn't try it by myself, but <a href="http://weblogs.foxite.com/andykramek/archive/2008/01/05/5530.aspx" rel="nofollow noreferrer">some people</a> of the VFP newsgroups reports that it works OK.<p> <a href="http://devzone.advantagedatabase.com/dz/webhelp/Advantage9.0/Advantage.htm" rel="nofollow noreferrer">Link to the Advantage Server / VFP Page</a></p>
2,314
<p>I see plans for various spool holders, either for PLA in the open, or for whatever filament in a dry box, that use 608 bearings. Elsewhere, I see warnings not to oil your filament to make it go through the extruder better, because problems going through mean something else is wrong, and it's better to fix the other thing. So, if I use the 608's, will oil leak on the filament, and is this bad?</p>
<p>Typically, oiling a filament would mean to use a vegetable based or non-petroleum type of lubricant, possibly even PTFE (teflon) or silicone. Those materials will not damage PLA filament. </p> <p>Oiling filament is not the haphazard application of lubricant, however. One drop on the filament sponge guide will last a rather long time and should be given sufficient time to distribute itself in the sponge, helping it along by alternately squeezing and releasing the sponge.</p> <p>Ball bearings of the type you've described will not have oil, unless otherwise modified by the user/owner. The bearings are packed with grease which will not leak out under normal circumstances. Running the bearings at high speed will cause the grease to thin a bit and perhaps drip or if hot enough will "sludge up." If your bearing grease turns to sludge, the bearing has already gotten hot enough to melt out of your plastic fitting.</p> <p>For spool holder applications, you can clean the grease from the bearing with a suitable solvent (denatured alcohol, acetone, soap and hot water in a pinch) and expect little impact on the drag. The spools rotate at such slow speeds and under such small load that the bearings alone will work nearly forever. This recommendation is void in dusty environments.</p> <p>With respect to oiling the filament, it's not a bad idea to have a sponge dust catcher that has no oil just as the filament enters the last open location. My bowden extruder system is nearly enclosed and the sponge sits at the very edge of the spool, while a direct extrusion system would have the sponge at the entry to the extruder gears.</p>
<p>Typically, oiling a filament would mean to use a vegetable based or non-petroleum type of lubricant, possibly even PTFE (teflon) or silicone. Those materials will not damage PLA filament. </p> <p>Oiling filament is not the haphazard application of lubricant, however. One drop on the filament sponge guide will last a rather long time and should be given sufficient time to distribute itself in the sponge, helping it along by alternately squeezing and releasing the sponge.</p> <p>Ball bearings of the type you've described will not have oil, unless otherwise modified by the user/owner. The bearings are packed with grease which will not leak out under normal circumstances. Running the bearings at high speed will cause the grease to thin a bit and perhaps drip or if hot enough will "sludge up." If your bearing grease turns to sludge, the bearing has already gotten hot enough to melt out of your plastic fitting.</p> <p>For spool holder applications, you can clean the grease from the bearing with a suitable solvent (denatured alcohol, acetone, soap and hot water in a pinch) and expect little impact on the drag. The spools rotate at such slow speeds and under such small load that the bearings alone will work nearly forever. This recommendation is void in dusty environments.</p> <p>With respect to oiling the filament, it's not a bad idea to have a sponge dust catcher that has no oil just as the filament enters the last open location. My bowden extruder system is nearly enclosed and the sponge sits at the very edge of the spool, while a direct extrusion system would have the sponge at the entry to the extruder gears.</p>
988
<p>I shudder to ask, but my client might offer no other SQL (or SQL-like) solution. I know Access has some SQL hooks; are they enough for basic ActiveRecord?</p> <p><em>Later:</em></p> <p>I appreciate all the suggestions to use other databases, but trust me: I've tried convincing them. There is an "approved" list, and no SQL databases are on it. Getting something onto the list could take more than a year, and this project will be done in three weeks.</p>
<p>It's a long shot but there's an <a href="http://odbc-rails.rubyforge.org/" rel="nofollow noreferrer">ODBC adapter for ActiveRecord</a> that might work.</p>
<p>You should really talk them into allowing SQLite. It is super-simple to setup, and operates like Access would (as a file sitting next to the app on the same server).</p>
4,039
<p>Which of these will heat a bed fastest?</p> <ul> <li><p>A. 12&nbsp;V, 10&nbsp;A power supply</p></li> <li><p>B. 24&nbsp;V, 5&nbsp;A power supply</p></li> <li><p>C. Both A and B will be the same (only total watts matter)</p></li> <li><p>D. Depends on the situation</p></li> </ul> <p>I originally thought Amperage was what mattered until I realized I needed a 24&nbsp;V power supply to even heat my Lulzbot mini bed by one degree.</p> <p>I know voltage is used to determine insulation thickness on wires. But thin wires with high current in them also get hot. Is insulation thickness on wires only to prevent you from accidentally cutting through them and shocking yourself, or is it for heat reasons?</p> <p>I'd like to power my heated bed with a 19.5&nbsp;V, 5&nbsp;A power supply. It's just an old laptop charger - I want to reduce strain on my circuit. It's a big bed and I have a few other laptop chargers lying around so I'd prefer to choose the best one.</p>
<p>It depends on whether you are re-using the bed or not, it is actually the resistance of the bed that determines this in conjunction with the voltage (the current you get for free).</p> <p>Let's say that the heatbed resistance is 1.2&nbsp;&ohm; (depending on the heated bed make and model the resistance is typically in between 0.9&nbsp;-&nbsp;1.5&nbsp;&ohm;), this means that the power can be calculated using: <span class="math-container">$$P = U \times I$$</span> <span class="math-container">$$U = I \times R$$</span> combining gives: <span class="math-container">$$ P = I^2\times R = \frac{U^2}{R} $$</span></p> <p>For 12&nbsp;V (assumed default printer voltage) this means that the heatbed power equals about 120&nbsp;Watt (at a current of 10&nbsp;A). Running that same bed at 24&nbsp;V means that the power is 480&nbsp;Watt (at a current of 20&nbsp;A). So yes, that will heat up fast, at the expense of an increased current, which is pretty high, and should not be attempted without extra resistance in the loop.</p> <p>If you're using the laptop charger, the current draw equals about 16&nbsp;A, which the adapter cannot deliver.</p> <p>This means that you need to acquire a new heatbed that is able to handle a higher voltage out of the box (more resistance), or you need to put additional resistors in the loop, but beware of the currents. Note that heated beds for 12&nbsp;V/24&nbsp;V exist, the wiring is different depending on the voltage. Note that such beds heat up faster, it all depends on the resistance and the voltage, but running the 24&nbsp;V circuit on 19.5&nbsp;V (160&nbsp;Watt bed) is definitely an improvement over the 120&nbsp;Watt bed at 12&nbsp;V but still requires about 8&nbsp;A (only applicable to heatbed that can run 12&nbsp;V/24&nbsp;V through extra resistance connections).</p> <p>Be careful with this and be sure what you are doing!</p>
<p>Bed heaters look like this <a href="https://i.stack.imgur.com/A9Gqn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A9Gqn.jpg" alt="enter image description here"></a></p> <p>They are rated for use with 12V or 24V supplies. 12V supply would take longer to warm it up, as P = V^2/R. Say it was a 2 ohm total resistance bed, then 12*12/2 = 72 watts, vs 24*24/2 = 288 watts. And 19V*19V/2 = 180W. Then you work backwards, P=IV or P/V = I to determine current draw: 72/12 = 6 amp, 288/24 = 12 amp, 180/19 = 9/5A.</p>
1,473
<p>We have an external service that is currently accessible via the http (port 80, non-SSL) and https (port 443, SSL) addresses.</p> <p>What is the best way to limit connections to only the https address? Is it something we can do via IIS or does it have to be done via code.</p> <p>Additional info: Regular ASP.NET web service (.asmx) running on IIS on Windows 2003 server. Service is built with C# on .NET 3.5.</p>
<ol> <li>Require SSL on the application</li> <li>In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way.</li> </ol> <p>Note: Keep port 80 open for this - or there won't be a server to listen for requests to redirect.</p>
<p>Is just not accepting any connections on port 80 an option? I'm a complete web server noob so I don't know if the server can operate without an unsecured listen port but if the server can operate only listen on port 443 that would seem to be simplest option.</p> <p>Another option would be a redirect from the unsecure port to the secure one</p>
5,082
<p>Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding content: </p> <ul> <li>Development team adding code. </li> <li>Business team adding simple web pages. </li> </ul> <p>For sanity and organization, we would like for the business team to add their web pages to a sub-folder in the project: </p> <blockquote> <p>Root: for pages of development team </p> <p>Content: for pages of business team </p> </blockquote> <p><strong>But</strong> </p> <p>We would like for users to be able to navigate to the business team content without having to append "Content" in their URLs, as described below:</p> <blockquote> <p><strong>Root</strong>: Default.aspx (<em>Available at: www.oursite.com/default.aspx</em>)</p> <p><strong>Content</strong>: Popcorn.aspx (<em>Available at: www.oursite.com/popcorn.aspx</em>)</p> </blockquote> <p>Is there a way we can accomplish for making a config entry in an ISAPI rewrite tool for every one of these pages?</p>
<p>Since the extensions will be ASPX, ASP.NET will pick up the request... you can write an HttpModule that checks for pages that yield a 404 and then check the subfolder also.</p> <p>If you know that all pages with a certain format will be coming from that folder, then you can just rewrite the URL in ASP.NET (either in Global.asax or an HttpModule).</p>
<p>Since the extensions will be ASPX, ASP.NET will pick up the request... you can write an HttpModule that checks for pages that yield a 404 and then check the subfolder also.</p> <p>If you know that all pages with a certain format will be coming from that folder, then you can just rewrite the URL in ASP.NET (either in Global.asax or an HttpModule).</p>
6,780
<p><a href="https://e3d-online.com/blogs/news/are-abrasives-killing-your-nozzle" rel="nofollow noreferrer">E3D-Online</a> and <a href="http://makezine.com/2015/09/11/carbon-fiber-filament-ruins-nozzles/" rel="nofollow noreferrer">Make Magazine</a> have written about the potential damage printing carbon fiber and glow in the dark filaments can do to your printer's nozzle.</p> <p>What I can't seem to find is what clues or warning signs to be on the look out for if your nozzle has taken a significant amount of wear. I've printed a few hundred grams of glow filament personally and have not noticed any change in print quality.</p> <p>E3D says you may have &quot;unpredictable erratic printing&quot; with a worn nozzle. Can anyone explain or provide examples of what this actually means and when a replacement is necessary?</p>
<p>I believe the little experiment made by E3D - the same link you provide - answers your question very well. Several points about wear can be found in this article. After printing only 250 grams of ColorFabb XT-CF20 (carbon fiber filament):</p> <ul> <li>The nozzle diameter had increased markedly</li> <li>The inner walls of the orifice (opening) showed deep sharp ridges and grooves</li> <li>The tip of the nozzle had become critically rounded, and shortened</li> </ul> <p>All of these symptoms were found repeatedly for standard brass nozzles.</p> <p>In particular, I believe the last of these symptoms may be the one most easily identifiable without accurate measuring equipment (and without observing print quality).</p> <p>With regards to reduction in print quality, these symptoms could be simulated by:</p> <ul> <li>Setting the nozzle diameter too big in your slicer</li> <li>Leveling your bed too high (the rounded tip will also reduce the length of the tip)</li> <li>Printing with a partial clog that interruptus normal filament flow (due to the grooves and ridges)</li> </ul> <p>Exactly what this will look like on your printed part is hard to predict, but I would assume you could see blobs, under-extrusion, poor layer adhesion, as well as an irregular surface finish of your top layers.</p>
<p>You can check for shortened nozzle length using a set of feeler gauges to measure the gap from bed to nozzle. <a href="https://en.wikipedia.org/wiki/Feeler_gauge" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Feeler_gauge</a></p>
163
<p>We can successfully consume a .NET 2.0 web service from a Flex/AS3 application. Aside from SSL, how else can we make the security more robust (i.e., authentication)?</p>
<p>You can leverage ASP.Net's built in session management by decorating your webmethods with </p> <blockquote> <p><code>&lt;EnableSession()&gt;</code></p> </blockquote> <p>Then, inside your method, you can check that the user still has a valid session.</p>
<p>If you're talking about <strong>securing the information</strong> going over the wire, you can use Web Service Extensions (WSE) to encrypt the body of the soap message so that you don't have to secure the channel. This way the message can get passed around from more than one endpoint (ie. it can get forwarded) and you don't need multiple https certs.</p> <p>If you're talking abut <strong>autentication</strong> then you could do forms auth with either a password in the body or in the soap headers (once again either encrypt the body or the channel). Or one of the easiest ways to secure a webservice (if it's an internal set of services) is have IIS do it, turn on NTLM and do authentication there. You can do authorization later on in the pipeline with an HTTPModule that checks peoples credential against the code they're trying to call.</p>
8,472
<p>I'm doing some PHP stuff on an Ubuntu server.</p> <p>The path I'm working in is <strong>/mnt/dev-windows-data/Staging/mbiek/test_list</strong> but the PHP call <code>getcwd()</code> is returning <strong>/mnt/dev-windows/Staging/mbiek/test_list</strong> (notice how it's dev-windows instead of dev-windows-data).</p> <p>There aren't any symbolic links anywhere. </p> <p>Are there any other causes for <code>getcwd()</code> returning a different path from a local <code>pwd</code> call?</p> <p><strong><em>Edit</em></strong> </p> <p>I figured it out. The <strong>DOCUMENT_ROOT</strong> in PHP is set to <strong>/mnt/dev-windows</strong> which throws everything off.</p>
<p>Which file are you calling the getcwd() in and is that file is included into the one you are running (e.g. running index.php, including startup.php which contains gwtcwd()).</p> <p>Is the file you are running in /dev-windows/ or /dev-windows-data/? It works on the file you are actually running.</p> <hr> <p>Here's an example of my current project:</p> <p><strong>index.php</strong></p> <pre><code>&lt;?php require_once('./includes/construct.php'); //snip ?&gt; </code></pre> <p><strong>includes/construct.php</strong></p> <pre><code>&lt;?php //snip (!defined('DIR')) ? define('DIR', getcwd()) : NULL; require_once(DIR . '/includes/functions.php'); //snip ?&gt; </code></pre>
<p><a href="https://stackoverflow.com/questions/30307/why-would-getcwd-return-a-different-directory-than-a-local-pwd#30313">@Ross</a></p> <p>I thought that getcwd() was returning a filesystem path rather than a relative url path.</p> <p>Either way, the fact remains that the path /mnt/dev-windows <strong>doesn't</strong> exist while /mnt/dev-windows-data does.</p>
5,020
<p>I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in <a href="http://www.codeproject.com/KB/IP/Pop3MimeClient.aspx?fid=341657" rel="noreferrer">CodeProject</a>. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in unicode.</p>
<p>I've successfully used <a href="http://sourceforge.net/projects/hpop/" rel="noreferrer">OpenPop.NET</a> to access emails via POP3. </p>
<p>call me old fashion but why use a 3rd party library for a simple protocol. I've implemented POP3 readers in web based ASP.NET application with System.Net.Sockets.TCPClient and System.Net.Security.SslStream for the encryption and authentication. As far as protocols go, once you open up communication with the POP3 server, there are only a handful of commands that you have to deal with. It is a very easy protocol to work with. </p>
6,614
<p>Here's the scenario. I'm using myopenid for, among other things, StackOverflow. When I initially set up my openid account with myopenid, I decided to try out Cardspace because they had support.</p> <p>I later wanted to access Stackoverflow from another machine so I chose to back up my card. I gave it a password and a filename and successfully created a backup file. I was also to able successfully import it to my laptop.</p> <p>Here is where the problem comes in - I am unable to use the card that I backed up from my laptop. The original card still works great on my desktop. Additional information is that my desktop is running Windows XP SP3 (x86) while my laptop is running Windows Vista (x64).</p> <p>Any ideas? Am I doing something wrong? I'm seriously considering dropping Cardspace on myopenid and moving to a password solution with them instead.</p> <p>Thanks!</p>
<p>It <em>should</em> work; however if you have 3.5SP1 on one machine and 3.5 or less on another there was an (unannounced) breaking change with the code to generate the unique ID from the card; which may explain why it doesn't work.</p> <p>I would try sending a test transaction to <a href="https://sharpsts.com/demos/informationCardToken.aspx" rel="nofollow noreferrer">the SharpSTS test page</a> with only the PPID as the claim, and examine the token sent back; if the PPIDs differ then that's your problem.</p>
<p>In Cardspace, the card is locked to the computer. You can move it around by exporting/importing. The next version "Geneva" will allow you to store your cards in a directory service which is useful for those running Active Directory.</p>
8,136
<p>How do you use the the org.springframework.ws.transport.jms.WebServiceMessageDrivenBean class from the Java Spring Framework - Spring-WS project?</p> <p>There is very little documentation or examples available on the web.</p>
<p>From what I gather from reading the <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/transport/jms/WebServiceMessageDrivenBean.html" rel="nofollow noreferrer">javadocs</a> it looks like this allows a Spring <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/transport/WebServiceMessageReceiver.html" rel="nofollow noreferrer">WebServiceMessageReceiver</a> to be invoked using a JMS client instead of a web services client. Hopefully that's right, because the rest of this is based on that assumption.</p> <p>The basics of is should match with how you create a regular Spring message driven bean. There is a little bit of documentation on how to do that in the <a href="http://static.springframework.org/spring/docs/2.5.x/reference/ejb.html#ejb-implementation" rel="nofollow noreferrer">Spring Reference Manual</a>. Also see the <a href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/ejb/support/AbstractEnterpriseBean.html?is-external=true" rel="nofollow noreferrer">AbstractEnterpriseBean Javadoc</a> for some additional information about how the Spring context is retrieved. </p> <p>The extra configuration required for a WebServiceMessageDrivenBean appear to be a <a href="http://java.sun.com/javaee/5/docs/api/javax/jms/ConnectionFactory.html?is-external=true" rel="nofollow noreferrer">ConnectionFactory</a>, a <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/WebServiceMessageFactory.html" rel="nofollow noreferrer">WebServiceMessageFactory</a>, and your <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/transport/WebServiceMessageReceiver.html" rel="nofollow noreferrer">WebServiceMessageReceiver</a>. These need to use the bean names specified in the Javadoc for the WebServiceMessageDrivenBean. The bean names are "connectionFactory", "messageFactory", and "messageReceiver" respectively. </p>
<p>Using the WebServiceMessageDrivenBean is very similar to the Spring support for Message Driven Beans (MDBS).</p> <p>First you create a MDB:</p> <pre><code>public class HelloWorldMessageDrivenBean extends WebServiceMessageDrivenBean { private static final long serialVersionUID = -2905491432314736668L; } </code></pre> <p>That is it as far as the MDB goes!</p> <p>Next you configure the MDB by adding the following following to the MDB definition in the ejb-jar.xml:</p> <pre><code>&lt;env-entry&gt; &lt;description&gt;&lt;/description&gt; &lt;env-entry-name&gt;ejb/BeanFactoryPath&lt;/env-entry-name&gt; &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt; &lt;env-entry-value&gt; application-context.xml &lt;/env-entry-value&gt; &lt;/env-entry&gt; </code></pre> <p>This tells the Spring MDB support classes where to pick up your Spring configuration file.</p> <p>You can now configure your endpoints either in the application-context.xml file or in addition using the annotation support.</p>
5,874
<p>I want to include a batch file rename functionality in my application. A user can type a destination filename pattern and (after replacing some wildcards in the pattern) I need to check if it's going to be a legal filename under Windows. I've tried to use regular expression like <code>[a-zA-Z0-9_]+</code> but it doesn't include many national-specific characters from various languages (e.g. umlauts and so on). What is the best way to do such a check?</p>
<p>You can get a list of invalid characters from <a href="http://msdn.microsoft.com/en-us/library/system.io.path.getinvalidpathchars.aspx" rel="noreferrer"><code>Path.GetInvalidPathChars</code></a> and <a href="http://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx" rel="noreferrer"><code>GetInvalidFileNameChars</code></a>.</p> <p><strong>UPD:</strong> See <a href="https://stackoverflow.com/questions/62771/how-check-if-given-string-is-legal-allowed-file-name-under-windows#62855">Steve Cooper's suggestion</a> on how to use these in a regular expression.</p> <p><strong>UPD2:</strong> Note that according to the Remarks section in MSDN "The array returned from this method is not guaranteed to contain the complete set of characters that are invalid in file and directory names." <a href="https://stackoverflow.com/questions/62771/how-check-if-given-string-is-legal-allowed-file-name-under-windows/62888#62888">The answer provided by sixlettervaliables</a> goes into more details.</p>
<p>One liner for verifying illigal chars in the string:</p> <pre><code>public static bool IsValidFilename(string testName) =&gt; !Regex.IsMatch(testName, "[" + Regex.Escape(new string(System.IO.Path.InvalidPathChars)) + "]"); </code></pre>
8,825
<p>I'm looking for real world best practices, how other people might have implemented solutions with complex domains.</p>
<p>Any time you consider using an <code>IEqualityComparer&lt;T&gt;</code>, pause to think if the class could be made to implement <code>IEquatable&lt;T&gt;</code> instead. If a <code>Product</code> should always be compared by ID, just define it to be equated as such so you can use the default comparer.</p> <p>That said, there are still a few of reasons you might want a custom comparer:</p> <ol> <li>If there are multiple ways instances of a class could be considered equal. The best example of this is a string, for which the framework provides six different comparers in <a href="http://msdn.microsoft.com/en-us/library/system.stringcomparer.aspx" rel="noreferrer"><code>StringComparer</code></a>.</li> <li>If the class is defined in such a way that you can't define it as <code>IEquatable&lt;T&gt;</code>. This would include classes defined by others and classes generated by the compiler (specifically anonymous types, which use a property-wise comparison by default).</li> </ol> <p>If you do decide you need a comparer, you can certainly use a generalized comparer (see DMenT's answer), but if you need to reuse that logic you should encapsulate it in a dedicated class. You could even declare it by inheriting from the generic base:</p> <pre><code>class ProductByIdComparer : GenericEqualityComparer&lt;ShopByProduct&gt; { public ProductByIdComparer() : base((x, y) =&gt; x.ProductId == y.ProductId, z =&gt; z.ProductId) { } } </code></pre> <p>As far as use, you should take advantage of comparers when possible. For example, rather than calling <code>ToLower()</code> on every string used as a dictionary key (logic for which will be strewn across your app), you should declare the dictionary to use a case-insensitive <code>StringComparer</code>. The same goes for the LINQ operators that accept a comparer. But again, always consider if the equatable behavior that should be intrinsic to the class rather than defined externally.</p>
<p>I would say that the best use would be when you need to plug in different equality rules for a certain algorithm. Much in the same way that a sorting algorithm might accept an <code>IComparer&lt;T&gt;</code>, a finding algorithm might accept an <code>IEqualityComparer&lt;T&gt;</code></p>
9,975
<p>Suppose you're developing a software product that has periodic releases. What are the best practices with regard to branching and merging? Slicing off periodic release branches to the public (or whomever your customer is) and then continuing development on the trunk, or considering the trunk the stable version, tagging it as a release periodically, and doing your experimental work in branches. What do folks think is the trunk considered "gold" or considered a "sand box"?</p>
<p>I have tried both methods with a large commercial application. </p> <p>The answer to which method is better is highly dependent on your exact situation, but I will write what my overall experience has shown so far. </p> <p><strong>The better method overall (in my experience): The trunk should be always stable.</strong></p> <p>Here are some guidelines and benefits of this method:</p> <ul> <li>Code each task (or related set of tasks) in its own branch, then you will have the flexibility of when you would like to merge these tasks and perform a release. </li> <li>QA should be done on each branch before it is merged to the trunk. </li> <li>By doing QA on each individual branch, you will know exactly what caused the bug easier.</li> <li>This solution scales to any number of developers. </li> <li>This method works since branching is an almost instant operation in SVN.</li> <li>Tag each release that you perform.</li> <li>You can develop features that you don't plan to release for a while and decide exactly when to merge them. </li> <li>For all work you do, you can have the benefit of committing your code. If you work out of the trunk only, you will probably keep your code uncommitted a lot, and hence unprotected and without automatic history. </li> </ul> <p>If you try to do the opposite and do all your development in the trunk you'll have the following issues:</p> <ul> <li>Constant build problems for daily builds</li> <li>Productivity loss when a a developer commits a problem for all other people on the project</li> <li>Longer release cycles, because you need to finally get a stable version</li> <li>Less stable releases</li> </ul> <p>You simply will not have the flexibility that you need if you try to keep a branch stable and the trunk as the development sandbox. The reason is that you can't pick and chose from the trunk what you want to put in that stable release. It would already be all mixed in together in the trunk.</p> <p>The one case in particular that I would say to do all development in the trunk, is when you are starting a new project. There may be other cases too depending on your situation.</p> <hr> <p>By the way distributed version control systems provide much more flexibility and I highly recommend switching to either hg or git.</p>
<p>There's no one-size-fits-all answer for the subversion convention question IMHO.</p> <p>It really depends on the dynamics of the project and company using it. In a very fast-paced environment, when a release might happen as often as every few days, if you try to religiously tag and branch, you'll end up with an unmanageable repository. In such an environment, the branch-when-needed approach would create a much more maintainable environment.</p> <p>Also - in my experience it is extremely easy, from a pure administrative standpoint, to switch between svn methodologies when you choose to.</p> <p>The two approaches I've known to work best are the branch-when-needed, and the branch-each-task. These are, of course, sort of the exact opposite of one another. Like I said - it's all about the project dynamics.</p>
5,619
<p>I am working on a web application, where I transfer data from the server to the browser in XML.</p> <p>Since I'm danish, I quickly run into problems with the characters <code>æøå</code>.</p> <p>I know that in html, I use the <code>"&amp;amp;aelig;&amp;amp;oslash;&amp;amp;aring;"</code> for <code>æøå</code>.</p> <p>however, as soon as the chars pass through JavaScript, I get black boxes with <code>"?"</code> in them when using <code>æøå</code>, and <code>"&amp;aelig;&amp;oslash;&amp;aring;"</code> is printed as is.</p> <p>I've made sure to set it to utf-8, but that isn't helping much.</p> <p>Ideally, I want it to work with any special characters (naturally).</p> <p>The example that isn't working is included below:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8"&gt; alert("&amp;aelig;&amp;oslash;&amp;aring;"); alert("æøå"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What am I doing wrong?</p> <hr> <p>Ok, thanks to Grapefrukts answer, I got it working.</p> <p>I actually needed it for data coming from an MySQL server. Since the saving of the files in UTF-8 encoding only solves the problem for static content, I figure I'd include the solution for strings from a MySQL server, pulled out using PHP:</p> <p><code>utf8_encode($MyStringHere)</code></p>
<p>Just specifying UTF-8 in the header is not enough. I'd bet you haven't saved your file as UTF-8. Any reasonably advanced text editor will have this option. Try that and I'm sure it'll work!</p>
<p>This works as expected for me:</p> <pre><code>alert("&amp;aelig;&amp;oslash;&amp;aring;"); </code></pre> <p>... creates an alert containing the string "&amp;aelig;&amp;oslash;&amp;aring;" whereas</p> <pre><code>alert("æøå"); </code></pre> <p>... creates an alert with the non-ascii characters.</p> <p>Javascript is pretty utf-8 clean and doesn't tend to put obstacles in your way.</p> <p>Maybe you're putting this on a web server that serves it as ISO-8859-1? If you use Apache, in your Apache config file (or in .httaccess, if you can override), you should have a line</p> <pre><code>AddCharset utf-8 .js </code></pre> <p>(Note: edited to escape the ampersands... otherwise it didn't make sense.)</p>
8,587
<p>I have a large, hi-def JavaScript-intensive image banner for a site I'm designing. What is everyone's opinion of using iframes so that you incur the load time only once? Is there a CSS alternative to the iframe?</p> <p>Feel free to <a href="http://csm.dev11.com" rel="nofollow noreferrer">preview the site</a>.</p> <p>It is very much a work in progress. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<blockquote> <p>I should also have mentioned that I would like the banner rotation to keep moving. When the visitor clicks on a link, the banner rotation starts over. It would be nice if the "animation" kept rotating, regardless of the page the user visits.Blockquote</p> </blockquote> <p>Well, in that case I would strongly recommend not doing that. The only real way of achieving that is to have the actual website content in the iframe, which means that you suddenly have lots of negative sides to the site: not being able to bookmark urls easily due to the address bar not changing; accessibility concerns; etc</p> <p>I think you'll find that most people won't care that it reloads again. Once a visitor lands on your website, they'll marvel at the wonderful banner immediately, and then will continue to ignore it while they browse your site - until an image they haven't seen appears and distracts them away from your content.</p> <p>Keep the rotation random enough, and with enough images, and people will stop to look at it from whatever page they're on.</p>
<p>I find the main challenge with iFrame headers is resizing. Since the font in your header is of static size, I don't see a problem with using an iFrame. Although I'm not sure if it's really intensive enough to be worth it.</p>
3,797
<blockquote> <p>Unit testing is, roughly speaking, testing bits of your code in isolation with test code. The immediate advantages that come to mind are:</p> <ul> <li>Running the tests becomes automate-able and repeatable</li> <li>You can test at a much more granular level than point-and-click testing via a GUI</li> </ul> <p><a href="https://stackoverflow.com/questions/1383/what-is-unit-testing">Rytmis</a></p> </blockquote> <p>My question is, what are the current &quot;best practices&quot; in terms of tools as well as when and where to use unit testing as part of your daily coding?</p> <p>Lets try to be somewhat language agnostic and cover all the bases.</p>
<p>Ok here's some best practices from some one who doesn't unit test as much as he should...cough.</p> <ol> <li>Make sure your tests test <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=35578" rel="noreferrer" title="one">one</a> thing and one thing only.</li> <li>Write unit tests as you go. Preferably <a href="http://en.wikipedia.org/wiki/Test-driven_development" rel="noreferrer" title="before">before</a> you write the code you are testing against.</li> <li>Do not unit test the GUI. </li> <li><a href="http://en.wikipedia.org/wiki/Separation_of_concerns" rel="noreferrer" title="Separate your concerns">Separate your concerns</a>. </li> <li>Minimise the dependencies of your tests.</li> <li>Mock behviour with <a href="http://en.wikipedia.org/wiki/Mock_object" rel="noreferrer" title="mocks">mocks</a>.</li> </ol>
<p>NUnit is a good tool for any of the .NET languages.</p> <p>Unit tests can be used in a number of ways: </p> <ol> <li>Test Logic</li> <li>Increase separation of code units. If you can't fully test a function or section of code, then the parts that make it up are too interdependant.</li> <li>Drive development, some people write tests <em>before</em> they write the code to be tested. This forces you to think about what you want the code to <em>do</em>, and then gives you a definite guideline on when you have acheived that.</li> </ol>
3,755
<p>MS CRM Dynamics 4.0 incorporates the MS WF engine. The built in designer allows the creation of sequential workflows whos activities have native access to CRM entities.</p> <p>Is it possible to:</p> <ul> <li>Create a state machine workflow outside of CRM (i.e. in visual studio) and import it into CRM? </li> <li>Have this workflow access the CRM entities?</li> </ul>
<ul> <li>It is NOT possible to create a state machine workflow for use in MSCRM.</li> <li>It is also not supported to create any workflow outside of MSCRM and import it.</li> <li>As a work around you could write either all the logic you need into a custom workflow activity and import that into MSCRM and have it called from a normal workflow.</li> <li>The other option is build a seperate application which runs a state machine workflow and interacts with MSCRM via the web services. You could (would need to?) combine this with a custom workflow activity to kick off processes.</li> </ul>
<p>I don't know the answer to your specific question, but hopefully this information will point you in the right direction.</p> <p>The "native" format for WF workflows is ".xoml" files. These are basically identical to XAML files, and both are nothing more than generic persistence formats for a .NET object tree. If you can access the saved data that is output by the Dynamics designer, it should be in the same format. If it is, you should be able to open it from the Visual Studio designer.</p> <p>The key here is that CRM undoubtedly defines its own set of custom activities that you'll need to be able to reference from within the alternate designer. With any luck, these will be in assemblies with obvious names and/or in the GAC.</p>
5,427
<p>Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?</p>
<p>I prefer the <a href="http://www.php.net/gd" rel="nofollow noreferrer">GD library</a> - check out <a href="http://www.php.net/manual/en/image.examples.php" rel="nofollow noreferrer">the Examples</a>, and this example:</p> <pre><code>&lt;?php header ("Content-type: image/png"); $im = @imagecreatetruecolor(120, 20) or die("Cannot Initialize new GD image stream"); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, "A Simple Text String", $text_color); imagepng($im); imagedestroy($im); ?&gt; </code></pre> <p>Outputs:</p> <p><a href="https://i.stack.imgur.com/kBN75.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kBN75.png" alt="imagecreatetrucolor example"></a><br> <sub>(source: <a href="http://uk2.php.net/manual/en/figures/image.imagecreatetruecolor.png" rel="nofollow noreferrer">php.net</a>)</sub> </p> <p>See <a href="http://www.php.net/manual/en/function.imagecreatetruecolor.php" rel="nofollow noreferrer">imagecreatetruecolor</a>.</p>
<p>MagickWand is pretty good for that as well, and pretty powerful.</p> <p><a href="http://www.bitweaver.org/doc/magickwand/index.html" rel="nofollow noreferrer">http://www.bitweaver.org/doc/magickwand/index.html</a></p> <p>This snippet will take an image, wrie the 'rose' in Vera, or whatever fonts are available, and flush the image to the browser.</p> <pre><code>$drawing_wand=NewDrawingWand(); DrawSetFont($drawing_wand,"/usr/share/fonts/bitstream-vera/Vera.ttf"); DrawSetFontSize($drawing_wand,20); DrawSetGravity($drawing_wand,MW_CenterGravity); $pixel_wand=NewPixelWand(); PixelSetColor($pixel_wand,"white"); DrawSetFillColor($drawing_wand,$pixel_wand); if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Rose") != 0) { header("Content-type: image/jpeg"); MagickEchoImageBlob( $magick_wand ); } else { echo MagickGetExceptionString($magick_wand); } </code></pre>
4,473
<p>To start with, as stated in the title, I am very new to 3D printing.</p> <p>We're a toy/boardgame shop and we're experimenting with 3D printing because it could open up a huge market for us. To this end, I'm asked to try to get this off the ground, but also for me it's a big experiment.</p> <h2>General Information</h2> <p><strong>Printer:</strong> Craftbot Plus<br /> <strong>Slicer:</strong> CraftwarePro (1.1.4.368)<br /> <strong>Filament:</strong> PLA - 1.75 mm<br /> <strong>Designed in:</strong> Tinkercad</p> <h2>Problem</h2> <p>I designed a puzzle box in Tinkercad. Here are some images of the design:</p> <p><a href="https://i.stack.imgur.com/VA4j3.png" rel="nofollow noreferrer" title="Screenshot of puzzle box designed in Tinkercad"><img src="https://i.stack.imgur.com/VA4j3.png" alt="Screenshot of puzzle box designed in Tinkercad" title="Screenshot of puzzle box designed in Tinkercad" /></a></p> <p>I've printed it twice, but both have some problems. I made some pictures, hopefully showing the flaws clearly.</p> <h4>Print 1</h4> <p>This print actually came out pretty ok, but not the quality I'm looking for.</p> <p><a href="https://i.stack.imgur.com/xeFkM.jpg" rel="nofollow noreferrer" title="Photo 1 of a printed model #1 with printing errors on bottom layer"><img src="https://i.stack.imgur.com/xeFkM.jpg" alt="Photo 1 of a printed model #1 with printing errors on bottom layer" title="Photo 1 of a printed model #1 with printing errors on bottom layer" /></a></p> <p><a href="https://i.stack.imgur.com/cOst8.jpg" rel="nofollow noreferrer" title="Photo 2 of a printed model #1 with printing errors on bottom layer"><img src="https://i.stack.imgur.com/cOst8.jpg" alt="Photo 2 of a printed model #1 with printing errors on bottom layer" title="Photo 2 of a printed model #1 with printing errors on bottom layer" /></a></p> <p><a href="https://i.stack.imgur.com/UxaPx.jpg" rel="nofollow noreferrer" title="Photo 3 of a printed model #1 with printing errors on bottom layer"><img src="https://i.stack.imgur.com/UxaPx.jpg" alt="Photo 3 of a printed model #1 with printing errors on bottom layer" title="Photo 3 of a printed model #1 with printing errors on bottom layer" /></a></p> <h4>Print 2</h4> <p>For some reason, this one came out way worse in my opinion. I didn't change any settings. The reason why I made this second print is that there are some design flaws in the first print.</p> <p><a href="https://i.stack.imgur.com/x35Wf.jpg" rel="nofollow noreferrer" title="Photo 1 of a printed model #2 with printing errors"><img src="https://i.stack.imgur.com/x35Wf.jpg" alt="Photo 1 of a printed model #2 with printing errors" title="Photo 1 of a printed model #2 with printing errors" /></a></p> <p><a href="https://i.stack.imgur.com/lq7Cx.jpg" rel="nofollow noreferrer" title="Photo 2 of a printed model #2 with printing errors"><img src="https://i.stack.imgur.com/lq7Cx.jpg" alt="Photo 2 of a printed model #2 with printing errors" title="Photo 2 of a printed model #2 with printing errors" /></a></p> <p>As you might be able to tell, this one has some more severe problems, like the prolapse on one of the corners of the lid and some threads that just seem to be broken off here and there.</p> <h2>Question</h2> <p>My question is basically, what is likely to be the problem, and how should I solve them. Are there some settings on the printer, or in the slicer that needs to be changed? Or could it be something with the design, for example, would it be better to have the lids laying down on the bed, instead of standing up as I have them in the design right now?</p> <p>Also, here and there seem to be threads of plastic where I think there should not be any.</p> <h2>What have I found myself</h2> <p>Since I'm very new to this, I wasn't really sure what to search/look for. I know it's expected to do some research yourself before posting any question, but I really didn't have a clue where to start.</p> <p>Though, while typing in the question, 2 suggestions showed up:</p> <h4>Suggestion 1</h4> <p><a href="https://3dprinting.stackexchange.com/questions/13433/i-have-bad-print-quality-what-should-i-do">I have bad print quality, what should I do?</a></p> <p>I'm not sure this looks like any of my problem areas, but somewhat similar.</p> <h3>Suggestion 2</h3> <p><a href="https://3dprinting.stackexchange.com/questions/13856/bad-quality-at-horizontal-faces">Bad quality at horizontal faces</a></p> <p>This looks very much similar to how some of my areas look. Is the problem described in this post indeed the same as mine, based on the pictures?</p> <h4>Conclusion</h4> <p>In both posts, <em>&quot;Under Extrusion&quot;</em> is mentioned this is probably something to look into?</p> <h2>Some personal observations</h2> <p>There are 2 things I noticed myself, maybe some conclusions can be made from this:</p> <ol> <li><p>Something else I'm noticing while heating up the extruder is that plastic already leaks out in a very thin thread before it actually starts printing.</p> </li> <li><p>When the print is done, I notice thin threads of plastic between the different objects (Like a spiderweb), this probably has something to do with point 1.</p> </li> <li><p>When the printer is starting, I notice that the very first threads of plastic are not a fluent string, but sometimes get interrupted, as if no plastic is coming out of the extruder for a short moment.</p> </li> </ol> <h2>Conclusion</h2> <p>Hopefully, I provided every information that is required to answer this question properly. I'm looking forward to any offered assistance.</p> <p>In case any additional information is required, I'm happy to give this next time I'm at the office.</p> <p><em>P.S. I had to remove 6 links (pictures) to get to my maximum of 8</em></p>
<p>There are several issue at hand here, first you have an adhesion problem.</p> <p><a href="https://i.stack.imgur.com/2CU9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2CU9L.png" alt="enter image description here" /></a></p> <p>This print shows that the print (as it is printed upright) has come loose during printing and lifted up. Such a print should have been printed as it is now laying on your table. You will then also get far better quality of printed holes. So, second is print orientation on the build plate.</p> <p><a href="https://i.stack.imgur.com/MvN6n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MvN6n.png" alt="enter image description here" /></a></p> <p>This shows another example of adhesion problems, but it also shows that you initial distance between the nozzle and the bed is slightly too large. The paper method usually works fine, but you can use feeler gauges. Alternatively use a specific 3D print adhesion spray (3DLAC, Magigoo, DimaFix) or alternatively some <a href="https://3dprinting.stackexchange.com/a/11183/">hairsprays</a> or <a href="https://3dprinting.stackexchange.com/a/15282/">glue sticks</a>.</p> <p>Third, design. Just a tip, I see that your design uses some sort of a pin:</p> <p><a href="https://i.stack.imgur.com/6UKxk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6UKxk.png" alt="enter image description here" /></a></p> <p>you should avoid thin pole/spike like prints. These are difficult to print and usually very weak. Think of an alternative, an embedded shaft or a bolt is usually a much better solution.</p> <p><a href="https://i.stack.imgur.com/HZ2Cq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HZ2Cq.png" alt="enter image description here" /></a></p> <p>Fourth, this shows that there was no filament printed, it could be that the spool had extra resistance or the filament was entangled. Check your filament spool.</p> <p><a href="https://i.stack.imgur.com/xQlzr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xQlzr.png" alt="enter image description here" /></a></p> <p>Fifth, this shows that you have a retraction problem, the filament pressure is still too large when the head moves to the next coordinates, it then oozes until the pressure has been released. Changing retraction speed or distance may help.</p>
<p><strong>Adhesion</strong></p> <p>Try raising your bed temperature a couple of degrees at a time. Presumably your filament has some &quot;suggested temperatures&quot; on the spool, but they sometimes only give a hotend's temp. For PLA some people get good results with a 50 degree C bed, I find nothing less than 60 degrees C. Esun's rec seems to be 60-80 for the bed.</p> <p>For the hotend my esun PLA+ suggests 205-225 and I print at 218.</p> <p>Depending on the environment, draughts can upset things and trigger lifting. If the printer is in a place where there are winds/breezes, or airconditioning that cycles on and off, the temperature fluctuations can start lifting. Try putting your printer somewhere that there is no wind and air conditions are static. I have a curtain around mine, and some people use enclosures made from popup laundry baskets or similar. Doesn't have to be fancy.</p> <p>You can try things with light layers of water-soluble gluestick on the bed, which works for me. Others have had success in laying blue painter's tape on the bed but I found the heat made the adhesive a hot mess.</p> <p><strong>Orientation</strong></p> <p>That pin will never work - 3D printing has layers and items are always weak along the layers. So that part is a poor candidate for 3D printing.</p> <p>Instead, buy a large assortment box of M3 nuts and bolts. These work much better than thin printed parts.</p> <p>Also, that large lid should be printed laying flat on its back. Even the action of the bed moving around could be creating enough breeze to cool that part quickly and cause shrinkage.</p> <p><strong>Design</strong></p> <p>That dovetail at the foot of the box, as printed it will have a layer line right across the base. Since that looks like the most economical way to print this part, you might consider making the dovetail a lot wider, and it may need a slight draught angle added to help the lid engage smoothly.</p> <p>The lid might spin around the pin and whack the dovetail clean off too - perhaps the two sidewalls should be raised so the lid only slides off in one direction?</p> <p><strong>Lack of filament</strong></p> <p>Holes in a printed part are a kind of under-extrusion, and mean there's not enough plastic at that time. If your roll of filament is under friction then the printer may not be able to pull it in fast enough.</p> <p>Also if the hotend isn't hot enough it may not be melting quick enough for your print speed, or there may be clogs in the nozzle from contaminations in the filament.</p> <p><strong>Suggestion</strong></p> <p>Start by levelling the bed, and then print one item in your set. Use a &quot;brim&quot; to improve adhesion, and it will be done first. As your printer starts the job, watch it closely and manually adjust the bed on the fly.</p> <p>Imagine these as side-views:</p> <p>____ <strong><sub>__</sub></strong> _____ Nozzle is way too low, you're scratching the bed<br> ____ <strong>__</strong> ____ Nozzle is too low, so drop the bed down a bit. The filament should have colour.<br> ____ <strong><sup>__</sup></strong> ____ This is about right. <br> ____ <strong>o</strong> _____ Nozzle is a bit too high<br> ____ <strong>O</strong> _____ Nozzle is a lot too high<br> ____ <strong><sup>O</sup></strong> _____ Filament is floating in the air which is sub-optimal<br></p> <p>Ideally you want to feel the printed filament line as a flattened line stuck to the bed, and not a round string lying on the print bed. It should almost feel like the edges of a sticker.</p> <p>Of course, the printer is moving all the time. Do not get in its way, and if you do block the motion in any direction then the print will likely be ruined.</p>
2,173
<p>I have a listening port on my server that I'm connecting to using a Java class and the <code>Socket</code> interface, i.e.</p> <pre><code>Socket mySocket = new Socket(host,port); </code></pre> <p>I then grab an <code>OutputStream</code>, decorate with a <code>PrintWriter</code> in autoflush mode and I'm laughing - except if the listening port closes. Then I get </p> <pre><code>tcp4 0 0 *.9999 *.* LISTEN tcp 0 0 127.0.0.1.45737 127.0.0.1.9999 CLOSE_WAIT </code></pre> <p>and I can't seem to detect the problem in the program - I've tried using the <code>isConnected()</code> method on the socket but it doesn't seem to know that the connection is closed.</p> <p>I want to be aware of the problem the next time I try and write to the Socket so that I can try and reconnect and report the issue.</p> <p>Any advice please?</p> <p>Thanks all</p>
<p>Set a short timeout?</p> <p>Does <code>isOutputShutdown()</code> not get you what you want?</p> <p>You could always build a <code>SocketWatcher</code> class that spins up in its own <code>Thread</code> and repeatedly tries to write empty strings to the <code>Socket</code> until that raises a <code>SocketClosedException</code>.</p>
<p>Set a different thread to reading from the socket. It will block until the socket is closed, and then an exception will be thrown. Catch that exception to detect the close immediately.</p>
4,276
<p>Being new to Objective-C (but a long term C/++) programmer I'm looking for advice/recommendations on naming conventions for variables.</p> <p>My personal preference would be to utilize a prefix for instance variables both for clarity within functions and to prevent shadowing of function parameters. However I'm a fan of properties which rules out prefixes (unless you also prefix your property names, which doesn't work too well and looks daft). Similarly I could use the "self.variable" convention, but only if I make EVERYTHING a property.</p> <p>So given the code below what's your preferred naming style for instance/function variables? And if you don't bother, how do you deal with shadowing on function params?</p> <pre><code>@interface GridItem : NSObject { CGRect _rect; ... } @end -(void) initFromRect:(CGRect)rect { _rect = rect; ... } </code></pre> <p>Cheers!</p>
<p>Most Cocoa projects use underbar as a non-<code>IBOutlet</code> instance variable prefix, and use no prefix for <code>IBOutlet</code> instance variables.</p> <p>The reason I don't use underbars for <code>IBOutlet</code> instance variables is that when a nib file is loaded, if you have a setter method for a connected outlet, that setter will be called. <em>However</em> this mechanism does <em>not</em> use Key-Value Coding, so an IBOutlet whose name is prefixed with an underbar (<em>e.g.</em> <code>_myField</code>) will <em>not</em> be set unless the setter is named exactly like the outlet (<em>e.g.</em> <code>set_myField:</code>), which is non-standard and gross.</p> <p>Also, be aware that using properties like <code>self.myProp</code> is <strong>not</strong> the same as accessing instance variables. You are <strong>sending a message</strong> when you use a property, just like if you used bracket notation like <code>[self myProp]</code>. All properties do is give you a concise syntax for specifying both the getter and setter in a single line, and allow you to synthesize their implementation; they do not actually short-circuit the message dispatch mechanism. If you want to access an instance variable directly but prefix it with <code>self</code> you need to treat <code>self</code> as a pointer, like <code>self-&gt;myProp</code> which really is a C-style field access.</p> <p>Finally, never use Hungarian notation when writing Cocoa code, and shy away from other prefixes like "f" and "m_" — that will mark the code as having been written by someone who doesn't "get it" and will cause it to be viewed by suspicion by other Cocoa developers.</p> <p>In general, follow the advice in the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html" rel="noreferrer" title="Coding Guidelines for Cocoa">Coding Guidelines for Cocoa</a> document at the <a href="http://developer.apple.com/" rel="noreferrer" title="Apple Developer Connection">Apple Developer Connection</a>, and other developers will be able to pick up and understand your code, and your code will work well with all of the Cocoa features that use runtime introspection.</p> <p>Here's what a window controller class might look like, using my conventions:</p> <pre><code>// EmployeeWindowController.h #import &lt;AppKit/NSWindowController.h&gt; @interface EmployeeWindowController : NSWindowController { @private // model object this window is presenting Employee *_employee; // outlets connected to views in the window IBOutlet NSTextField *nameField; IBOutlet NSTextField *titleField; } - (id)initWithEmployee:(Employee *)employee; @property(readwrite, retain) Employee *employee; @end // EmployeeWindowController.m #import "EmployeeWindowController.h" @implementation EmployeeWindowController @synthesize employee = _employee; - (id)initWithEmployee:(Employee *)employee { if (self = [super initWithWindowNibName:@"Employee"]) { _employee = [employee retain]; } return self; } - (void)dealloc { [_employee release]; [super dealloc]; } - (void)windowDidLoad { // populates the window's controls, not necessary if using bindings [nameField setStringValue:self.employee.name]; [titleField setStringValue:self.employee.title]; } @end </code></pre> <p>You'll see that I'm using the instance variable that references an <code>Employee</code> directly in my <code>-init</code> and <code>-dealloc</code> method, while I'm using the property in other methods. That's generally a good pattern with properties: Only ever touch the underlying instance variable for a property in initializers, in <code>-dealloc</code>, and in the getter and setter for the property.</p>
<p>I don't like using underscores as prefixes for any identifiers, because C and C++ both reserve certain underscore prefixes for use by the implementation.</p> <p>I think using "self.variable" is ugly.</p> <p>In general, I use unadorned identifiers (that is, no prefixes nor suffixes) for instance variables. If your class is so complicated that you can't remember the instance variables, you're in trouble. So for your example, I'd use "rect" as the name of the instance variable and "newRect" or "aRect" as the parameter name.</p>
3,155
<p>Can you specialize a template method within a template class without specializing the class template parameter?</p> <p>Please note that the specialization is on the <em>value</em> of the template parameter, not its type.</p> <p>This seems to compile under Visual Studio 2008 SP1 complier, but not GCC 4.2.4.</p> <pre><code>#include &lt;iostream&gt; using namespace std; template &lt;typename T&gt; class A { private: template &lt;bool b&gt; void testme(); template &lt;&gt; void testme&lt;true&gt;() { cout &lt;&lt; "true" &lt;&lt; endl; }; template &lt;&gt; void testme&lt;false&gt;() { cout &lt;&lt; "false" &lt;&lt; endl; }; public: void test(); }; template&lt;typename T&gt; struct select {}; template&lt;&gt; struct select&lt;int&gt; { static const bool value = true; }; template&lt;&gt; struct select&lt;double&gt; { static const bool value = false; }; template &lt;class T&gt; void A&lt;T&gt;::test() { testme&lt;select&lt;T&gt;::value&gt;(); } int main(int argc, const char* argv[]) { A&lt;int&gt; aInt; A&lt;double&gt; aDouble; aInt.test(); aDouble.test(); return 0; } </code></pre> <p>GCC tells me:"error: explicit specialization in non-namespace scope ‘class A’"</p> <p>If it is not supported in the standard, can anyone tell me why?</p>
<p>It is not supported in the standard (and it is apparently a known bug with Visual Studio that you <em>can</em> do it).</p> <p>The standard doesn't allow an inner template (member function <em>or</em> class) to be specialized without the outer template being specialized as well. One of the reasons for this is that you can normally just overload the function:</p> <pre><code>template&lt;typename ty&gt; class A { public: void foo(bool b); void foo(int i); }; </code></pre> <p>Is equivalent to:</p> <pre><code>template&lt;typename ty&gt; class A { public: template&lt;typename ty2&gt; void foo(ty2); template&lt;&gt; void foo(bool b); template&lt;&gt; void foo(int i); }; </code></pre>
<p>I've never heard of that being possible; it would make sense to me if it was <em>not</em> supported by all compilers. So here is an idea for a workaround:</p> <p>Implement a template function outside of your class which takes the same action as the method. Then you can specialize this function, and it call it from the method. Of course, you'll also have to pass in any member variables that it needs (and pointers thereto if you want to modify their values).</p> <p>You could also create another template class as a subclass, and specialize that one, although I've never done this myself and am not 100% sure it would work. (Please comment to augment this answer if you know whether or not this second approach would work!)</p>
9,005
<p>Should it be possible to directly send G-code to the printer serial connection using pipes under Linux?</p> <p>Example:</p> <pre><code>echo M106 &gt; /dev/ttyUSB0 </code></pre> <p>My controller runs at 250000 baud, I have tried setting the TTY baud rate to 250 kBd with: </p> <pre><code>stty -F /dev/ttyUSB0 250000 </code></pre> <p>But, unfortunately, this particular baud rate appears to be unsupported under Ubuntu, giving the error: </p> <pre><code>stty: invalid argument ‘250000’ </code></pre>
<p>For direct low-level printer control from a terminal, without specific software, I found the following solution with full credit thanks to user: <a href="http://stackexchange.com/users/6463673/meuh">http://stackexchange.com/users/6463673/meuh</a></p> <p>Sharing here as may be of use to other users in the 3d Printing community, and I was unable to source a "complete" solution to this elsewhere.</p> <hr> <p>Step 1) Create a custom python script that allows you to set arbitrary baud rates (make executable with <code>chmod u+x</code>).</p> <pre><code>#!/usr/bin/python # set nonstandard baudrate. Original Question: http://unix.stackexchange.com/a/327366/119298 import sys,array,fcntl # from /usr/lib/python2.7/site-packages/serial/serialposix.py # /usr/include/asm-generic/termbits.h for struct termios2 # [2]c_cflag [9]c_ispeed [10]c_ospeed def set_special_baudrate(fd, baudrate): TCGETS2 = 0x802C542A TCSETS2 = 0x402C542B BOTHER = 0o010000 CBAUD = 0o010017 buf = array.array('i', [0] * 64) # is 44 really fcntl.ioctl(fd, TCGETS2, buf) buf[2] &amp;= ~CBAUD buf[2] |= BOTHER buf[9] = buf[10] = baudrate assert(fcntl.ioctl(fd, TCSETS2, buf)==0) fcntl.ioctl(fd, TCGETS2, buf) if buf[9]!=baudrate or buf[10]!=baudrate: print("failed. speed is %d %d" % (buf[9],buf[10])) sys.exit(1) set_special_baudrate(0, int(sys.argv[1])) </code></pre> <hr> <p>Step 2) Run the script to set your baud rate.<br> <code>./set_custom_baud_rate.py &lt;&gt; /dev/ttyUSB0 250000</code></p> <hr> <p>Step 3) You can now monitor your printer output in a terminal window simply with:<br> <code>tail -f /dev/ttyUSB0</code></p> <hr> <p>Step 4) And finally, open up a new terminal window, and you can directly send M or Gcode to your printer; example:<br> <code>echo "M115" &gt;&gt; /dev/ttyUSB0</code></p>
<p>That's work solution: <div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/1kcvIRhXkCo?start=0"></iframe> </div></div> you need 2 terminal, one for in and another for out flows </p>
437
<p>So you have a String that is retrieved from an admin web UI (so it is definitely a String). How can you find out whether this string is an IP address or a hostname in Java?</p> <p>Update: I think I didn't make myself clear, I was more asking if there is anything in the Java SDK that I can use to distinguish between IPs and hostnames? Sorry for the confusion and thanks for everybody who took/will take the time to answer this.</p>
<p>You can use a regular expression with this pattern:</p> <pre><code>\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b </code></pre> <p>That will tell you if it's an IPv4 address.</p>
<p>Couldn't you just to a regexp match on it?</p>
9,251
<p>I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat. The tomcat instance is allowed a gigabyte of memory on the heap, but rarely exceeds 300 MB. Has anyone else run into this issue, and is there a solution for it?</p> <p>For clarification: I determined how much memory it is using via Task Manager and via Eclipse (I've also tried running it outside of Eclipse, but get the same problem eventually, though it takes a little longer). With Eclipse, I look at the memory allocated via its little (optional) memory pane and the amount allocated to javaw.exe via the task manager. I use the sysdeo? tomcat plugin for Eclipse.</p>
<p>For any jvm process, force a thread dump. In windows, this can be done with CTRL-BREAK, I believe, in the console window.</p> <p>In *nix, it is almost always "kill -3 jvm-pid".</p> <p>This may show if you have threads waiting on db connection pool/thread pool, etc.</p> <p>Another thing to check out is how many connections you have currently to the JVM -- either use NETSTAT or SysInternals utility such as tcpconn/tcpview (google it).</p> <p>Also, try to run with the verbose:gc JVM flag. For Sun's JVM, run like "java -verbose:gc". This will show your garbage collections. If it is collecting a lot (FULL COLLECTIONS, expecially) then you probably have a memory leak. The full collections are costly, especially on large heaps like that.</p> <p>How are you determining that only 300mb are being used?</p>
<p>It sounds like you're hitting a deadlock.</p> <p>If you can reproduce it in a dev environment then try attaching a debugger once it's happened. Take a look at your threads and see if you have any deadlocks.</p> <p>If you can't get a debugger to attach you should be able to generate a thread dump, as Dustin pointed out.</p>
9,176
<p>I am trying to find out if it's possible to build a complete IVR application by cobbling together parts from open source projects. Is anyone using a non-commercial VoiceXML implementation to build speech-enabled systems?</p>
<p>I've tried JVoiceXML in the past and had some luck with it.</p> <p><a href="http://jvoicexml.sourceforge.net/" rel="noreferrer">http://jvoicexml.sourceforge.net/</a></p> <p>It's java of course, but that wasn't a problem for my situation.</p>
<p>If you want to build an IVR and you're not married to VoiceXML, you might try <a href="http://www.twilio.com/" rel="nofollow noreferrer">Twilio</a>. They have a simple XML syntax, an awesome REST API, and small-project-friendly pay per minute pricing which lets you concentrate on building your app and not building/hosting telephony infrastructure. I built an <a href="http://thislineissecure.com/" rel="nofollow noreferrer">IVR app</a> using their system a few days and it was a pleasure.</p>
5,668
<p>Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. </p> <p>I've considered Eclipse, but it seems to bloated and unfriendly for quick programs.</p>
<p>Java editing tends to go one of two ways; people either stick with a simple editor and use a terminal to compile/run their programs, or they use a big IDE with a zillion features.</p> <p>I usually go the simple route and just use a plain text editor and terminal, but there's still a lot to be said for IDEs. This is especially true when learning the language, since hitting "spam." brings up a dropdown with all of the fields and methods of the spam object. And this is not just useful to a beginner; it remains useful later on when using unfamiliar libraries and third party modules.</p> <p>IDEs also have useful tools such as GUI builders which become invaluable when doing professional Java work. So although I typically prefer a simple editor/terminal combo, I highly recommend trying out an IDE such as Eclipse or Netbeans to see how you like it and so that you'll know how to use one later on.</p>
<p>I'm using NetBeans with success right now.</p>
9,380
<p>I am looking to others who have successfully printed in ABS using a Wanhao Duplicator i3. </p> <p>I have tried and get a lot of warping and delamination. I tried putting a large box over the printer which did help with the warping some but I am still getting some layer separation. I used 235&nbsp;°C for the extruder and 100&nbsp;°C for the bed. I am printing at 40&nbsp;mm/s and 0.2&nbsp;mm layer height. </p> <p>If someone has ABS and PETG settings for this printer, your help would be appreciated.</p>
<p>I am an official Wanhao Distributor</p> <p>By experience I can recommend you to print with this settings:</p> <ul> <li>Extruder 230 °C </li> <li>Heated Bed 65 °C</li> <li>Have a glass surface</li> <li>Use hairspray over the glass</li> <li>Continue to enclose the printer or at least put it where there is almost no wind</li> <li>Print at 45 mm/s</li> </ul> <p>Note that this settings vary a lot depending on humidity and other factors related to where you are printing, so it would be very useful to know where in the globe are you experimenting.</p> <p>Also note that humidity is very very bad for 3D Printing Filaments so keep them sealed while not using them.</p> <p>Please do comment if you have any more doubts.</p>
<p>I've had hit and miss success, but nothing I would consider great. I was using Hatchbox ABS with the extruder at 230&nbsp;°C and the bed at 65&nbsp;°C and a homemade enclosure. </p> <p>One thing that did help was making sure the HVAC vents near the printer were closed. </p>
277
<p>Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio)</p>
<p>Like others have mentioned, NetBeans' visual editor is pretty good, but it's based pretty heavily on the <a href="https://java.net/projects/appframework/" rel="nofollow noreferrer">Swing Application Framework</a>, so you'd need to get an understanding of how it works to properly use it (although you don't need to dig in to just test things).</p> <p>Other than that there are also:</p> <ul> <li>the <a href="http://www.jetbrains.com/idea/" rel="nofollow noreferrer">IntelliJ IDEA</a> visual editor (<a href="http://www.jetbrains.com/idea/features/gui_builder.html" rel="nofollow noreferrer">flash demo of the features</a>)</li> <li>and Eclipse's <a href="http://www.eclipse.org/vep/WebContent/main.php" rel="nofollow noreferrer">Visual Editor</a></li> </ul> <p>Personally I've used NetBeans' and IDEA's visual editors. Both are nice, but I thought NetBeans had a leg up, because it doesn't use any proprietary way of saving the GUI structure and instead does something similar to what Visual Studio does - auto-generating the code that you can then add to. IDEA stores the information in a separate file which means you have to use IDEA to edit the layout visually later.</p> <p>I have not used Eclipse's Visual Editor.</p> <p>My vote is for NetBeans' visual editor. I think it satisfies what most people are looking for in a visual editor and leaves it flexible enough to plug the holes manually through code without affecting the visual editor (so you can switch back and forth between code and design views without breaking either).</p>
<p><a href="https://developers.google.com/java-dev-tools/download" rel="nofollow">window builder pro</a> is good option and it is free also.</p>
4,602
<p>When using Subversion (svn) for source control with multiple projects I've noticed that the revision number increases across all of my projects' directories. To illustrate my svn layout (using fictitious project names): </p> <pre> /NinjaProg/branches /tags /trunk /StealthApp/branches /tags /trunk /SnailApp/branches /tags /trunk </pre> <p>When I perform a commit to the trunk of the Ninja Program, let's say I get that it has been updated to revision 7. The next day let's say that I make a small change to the Stealth Application and it comes back as revision 8.</p> <p>The question is this: <strong>Is it common accepted practice to, when maintaining multiple projects with one Subversion server, to have unrelated projects' revision number increase across all projects?</strong> Or am I doing it wrong and should be creating individual repositories for each project? Or is it something else entirely?</p> <p><strong>EDIT:</strong> I delayed in flagging an answer because it had become clear that there are reasons for both approaches, and even though this question came first, I'd like to point to some other questions that are ultimately asking the same question: </p> <p><a href="https://stackoverflow.com/questions/130447/should-i-store-all-projects-in-one-repository-or-mulitiple">Should I store all projects in one repository or mulitiple?</a></p> <p><a href="https://stackoverflow.com/questions/252459/one-svn-repository-or-many">One SVN Repository or many?</a> </p>
<p>I am surprised no has mentioned that this is discussed in Version Control with Subversion, which is available free online, <a href="http://svnbook.red-bean.com/en/1.5/svn.reposadmin.planning.html" rel="nofollow noreferrer">here</a>.</p> <p>I read up on the issue awhile back and it really seems like a matter of personal choice, there is a good blog post on the subject <a href="http://blogs.open.collab.net/svn/2007/04/single_reposito.html" rel="nofollow noreferrer">here</a>. EDIT: <em>Since the blog appears to be down, (<a href="http://replay.web.archive.org/20090228154135/http://blogs.open.collab.net/svn/2007/04/single_reposito.html" rel="nofollow noreferrer">archived version here</a>), here is some of what Mark Phippard had to say on the subject.</em></p> <blockquote> <p>These are some of the advantages of the single repository approach.</p> <ol> <li>Simplified administration. One set of hooks to deploy. One repository to backup. etc.</li> <li>Branch/tag flexibility. With the code all in one repository it makes it easier to create a branch or tag involving multiple projects.</li> <li>Move code easily. Perhaps you want to take a section of code from one project and use it in another, or turn it into a library for several projects. It is easy to move the code within the same repository and retain the history of the code in the process.</li> </ol> <p>Here are some of the drawbacks to the single repository approach, advantages to the multiple repository approach.</p> <ol> <li>Size. It might be easier to deal with many smaller repositories than one large one. For example, if you retire a project you can just archive the repository to media and remove it from the disk and free up the storage. Maybe you need to dump/load a repository for some reason, such as to take advantage of a new Subversion feature. This is easier to do and with less impact if it is a smaller repository. Even if you eventually want to do it to all of your repositories, it will have less impact to do them one at a time, assuming there is not a pressing need to do them all at once.</li> <li>Global revision number. Even though this should not be an issue, some people perceive it to be one and do not like to see the revision number advance on the repository and for inactive projects to have large gaps in their revision history.</li> <li>Access control. While Subversion's authz mechanism allows you to restrict access as needed to parts of the repository, it is still easier to do this at the repository level. If you have a project that only a select few individuals should access, this is easier to do with a single repository for that project.</li> <li>Administrative flexibility. If you have multiple repositories, then it is easier to implement different hook scripts based on the needs of the repository/projects. If you want uniform hook scripts, then a single repository might be better, but if each project wants its own commit email style then it is easier to have those projects in separate repositories</li> </ol> </blockquote> <p>When you really think about, the revision numbers in a multiple project repository are going to get high, but you are not going to run out. Keep in mind that you can view a history on a sub directory and quickly see all the revision numbers that pertain to a project.</p>
<p>One repository per project.</p> <p>Steven Murawski's comment about CC.NET is an interesting one. I would be interested to hear how it works if you need to specify several source control repositories.</p>
3,643
<p>What I have so far is </p> <pre><code>#!/bin/sh php_syntax_check() { retval=0 for i in $(git-diff-index --name-only --cached HEAD -- | grep -e '\.php$'); do if [ -f $i ]; then output=$(php -l $i) retval=$? if [ $retval -gt 0 ]; then echo "==============================================================================" echo "Unstaging $i for the commit due to the follow parse errors" echo "$output" git reset -q HEAD $i fi fi done if [ $retval -gt 0 ]; then exit $retval fi } php_syntax_check </code></pre>
<p>If the commit is a partial commit (not all the changes in the working tree are committed), then this make give incorrect results since it tests the working copy and not the staged copy.</p> <p>One way to do this could be:</p> <pre><code>git diff --cached --name-only --diff-filter=ACMR | xargs git checkout-index --prefix=$TMPDIR/ -- find $TMPDIR -name '*.php' -print | xargs -n 1 php -l </code></pre> <p>Which would make a copy of the staged images into a scratch space and then run the test command on them there. If any of the files include other files in the build then you may have to recreate the whole staged image in the test tree and then test the changed files there (See: <a href="https://stackoverflow.com/questions/2412450/git-pre-commit-hook-changed-added-files/3068990#3068990">Git pre-commit hook : changed/added files</a>).</p>
<p>If you've got the php5-cli installed you can write your pre-commit in PHP and use the syntax your more familiar with.</p> <p>Just do something more like.</p> <pre><code>#!/usr/bin/php &lt;?php /* Your pre-commit check. */ ?&gt; </code></pre>
6,499
<p>What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?</p> <p><strong>Following the two initial answers...</strong></p> <ul> <li><p>We definitely need to use the Web Service layer as we will be making these calls from remote client applications.</p></li> <li><p>The WebDAV method would work for us, but we would prefer to be consistent with the web service integration method.</p></li> </ul> <p><Blockquote> There is additionally a web service to upload files, painful but works all the time. </Blockquote></p> <p>Are you referring to the “Copy” service? We have been successful with this service’s <code>CopyIntoItems</code> method. Would this be the recommended way to upload a file to Document Libraries using only the WSS web service API?</p> <p>I have posted our code as a suggested answer.</p>
<p>Example of using the WSS "Copy" Web service to upload a document to a library...</p> <pre><code>public static void UploadFile2007(string destinationUrl, byte[] fileData) { // List of desination Urls, Just one in this example. string[] destinationUrls = { Uri.EscapeUriString(destinationUrl) }; // Empty Field Information. This can be populated but not for this example. SharePoint2007CopyService.FieldInformation information = new SharePoint2007CopyService.FieldInformation(); SharePoint2007CopyService.FieldInformation[] info = { information }; // To receive the result Xml. SharePoint2007CopyService.CopyResult[] result; // Create the Copy web service instance configured from the web.config file. SharePoint2007CopyService.CopySoapClient CopyService2007 = new CopySoapClient("CopySoap"); CopyService2007.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; CopyService2007.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation; CopyService2007.CopyIntoItems(destinationUrl, destinationUrls, info, fileData, out result); if (result[0].ErrorCode != SharePoint2007CopyService.CopyErrorCode.Success) { // ... } } </code></pre>
<p>From a colleage at work:</p> <blockquote> <p>Lazy way: your Windows WebDAV filesystem interface. It is bad as a programmatic solution because it relies on the WindowsClient service running on your OS, and also only works on websites running on port 80. Map a drive to the document library and get with the file copying.</p> <p>There is additionally a web service to upload files, painful but works all the time.</p> <p>I believe you are able to upload files via the FrontPage API but I don’t know of anyone who actually uses it.</p> </blockquote>
5,179
<p>Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.</p> <p>The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please?</p>
<p>First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables.</p> <p><strong>Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac)</strong></p> <p>Of course, there are many, but the most popular that I've seen in wild are:</p> <ul> <li><a href="http://wiki.python.org/moin/TkInter" rel="noreferrer">Tkinter</a> - based on <a href="http://www.tcl.tk/" rel="noreferrer">Tk GUI toolkit</a> (de-facto standard GUI library for python, free for commercial projects)</li> <li><a href="http://www.wxpython.org/" rel="noreferrer">WxPython</a> - based on <a href="http://www.wxwidgets.org/" rel="noreferrer">WxWidgets</a> (popular, free for commercial projects)</li> <li><a href="https://www.qt.io" rel="noreferrer">Qt</a> using the <a href="https://riverbankcomputing.com/software/pyqt/intro" rel="noreferrer">PyQt bindings</a> or <a href="https://www.qt.io/qt-for-python" rel="noreferrer">Qt for Python</a>. The former is not free for commercial projects. The latter is less mature, but can be used for free.</li> </ul> <p>Complete list is at <a href="http://wiki.python.org/moin/GuiProgramming" rel="noreferrer">http://wiki.python.org/moin/GuiProgramming</a></p> <p><strong>Single executable (all platforms)</strong></p> <ul> <li><a href="https://www.pyinstaller.org/" rel="noreferrer">PyInstaller</a> - the most active(Could also be used with <code>PyQt</code>)</li> <li><a href="https://build-system.fman.io" rel="noreferrer">fbs</a> - if you chose Qt above</li> </ul> <p><strong>Single executable (Windows)</strong></p> <ul> <li><a href="http://www.py2exe.org/" rel="noreferrer">py2exe</a> - used to be the most popular</li> </ul> <p><strong>Single executable (Linux)</strong></p> <ul> <li><a href="http://wiki.python.org/moin/Freeze" rel="noreferrer">Freeze</a> - works the same way like py2exe but targets Linux platform</li> </ul> <p><strong>Single executable (Mac)</strong></p> <ul> <li><a href="https://pythonhosted.org/py2app/" rel="noreferrer">py2app</a> - again, works like py2exe but targets Mac OS</li> </ul>
<p>You don't need to <em>compile</em> python for Mac/Windows/Linux. It is an interpreted language, so you simply need to have the Python interpreter installed on the system of your choice (it is available for all three platforms).</p> <p>As for a GUI library that works cross platform, Python's <a href="http://www.tcl.tk/" rel="nofollow noreferrer">Tk/Tcl</a> widget library works very well, and I believe is sufficiently cross platform.</p> <p><a href="http://docs.python.org/lib/module-Tkinter.html" rel="nofollow noreferrer">Tkinter</a> is the python interface to Tk/Tcl</p> <p>From the python project webpage: </p> <blockquote> <p>Tkinter is not the only GuiProgramming toolkit for Python. It is however the most commonly used one, and almost the only one that is portable between Unix, Mac and Windows</p> </blockquote>
2,508
<p>Has anyone managed to use <code>ItemizedOverlays</code> in Android Beta 0.9? I can't get it to work, but I'm not sure if I've done something wrong or if this functionality isn't yet available. </p> <p>I've been trying to use the <code>ItemizedOverlay</code> and <code>OverlayItem</code> classes. Their intended purpose is to simulate map markers (as seen in Google Maps Mashups) but I've had problems getting them to appear on the map.</p> <p>I can add my own custom overlays using a similar technique, it's just the <code>ItemizedOverlays</code> that don't work.</p> <p>Once I've implemented my own <code>ItemizedOverlay</code> (and overridden <code>createItem</code>), creating a new instance of my class seems to work (I can extract <code>OverlayItems</code> from it) but adding it to a map's <code>Overlay</code> list doesn't make it appear as it should.</p> <p>This is the code I use to add the <code>ItemizedOverlay</code> class as an <code>Overlay</code> on to my <code>MapView</code>.</p> <pre><code>// Add the ItemizedOverlay to the Map private void addItemizedOverlay() { Resources r = getResources(); MapView mapView = (MapView)findViewById(R.id.mymapview); List&lt;Overlay&gt; overlays = mapView.getOverlays(); MyItemizedOverlay markers = new MyItemizedOverlay(r.getDrawable(R.drawable.icon)); overlays.add(markers); OverlayItem oi = markers.getItem(0); markers.setFocus(oi); mapView.postInvalidate(); } </code></pre> <p>Where <code>MyItemizedOverlay</code> is defined as:</p> <pre><code>public class MyItemizedOverlay extends ItemizedOverlay&lt;OverlayItem&gt; { public MyItemizedOverlay(Drawable defaultMarker) { super(defaultMarker); populate(); } @Override protected OverlayItem createItem(int index) { Double lat = (index+37.422006)*1E6; Double lng = -122.084095*1E6; GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue()); OverlayItem oi = new OverlayItem(point, "Marker", "Marker Text"); return oi; } @Override public int size() { return 5; } } </code></pre>
<p>For the sake of completeness I'll repeat the discussion on Reto's post over at the <a href="http://groups.google.com/group/android-developers/browse_thread/thread/36fe0648dabfe745#" rel="noreferrer">Android Groups here</a>.</p> <p>It seems that if you set the bounds on your drawable it does the trick:</p> <pre><code>Drawable defaultMarker = r.getDrawable(R.drawable.icon); // You HAVE to specify the bounds! It seems like the markers are drawn // through Drawable.draw(Canvas) and therefore must have its bounds set // before drawing. defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(), defaultMarker.getIntrinsicHeight()); MyItemizedOverlay markers = new MyItemizedOverlay(defaultMarker); overlays.add(markers); </code></pre> <p>By the way, the above is shamelessly ripped from <a href="http://www.marcelp.info/2008/09/01/android-itemizedoverlay-demo/" rel="noreferrer">the demo at MarcelP.info</a>. Also, here is a <a href="http://androidguys.com/?p=1413" rel="noreferrer">good howto</a>.</p>
<p>try :</p> <pre><code>Drawable defaultMarker = r.getDrawable(R.drawable.icon); defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(), defaultMarker.getIntrinsicHeight()); MyItemizedOverlay markers = new MyItemizedOverlay(defaultMarker); overlays.add(markers); </code></pre>
4,592