instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>Can/Should I use a LIKE criteria as part of an INNER JOIN when building a stored procedure/query? I'm not sure I'm asking the right thing, so let me explain.</p>
<p>I'm creating a procedure that is going to take a list of keywords to be searched for in a column that contains text. If I was sitting at the console, I'd execute it as such:</p>
<pre><code>SELECT Id, Name, Description
FROM dbo.Card
WHERE Description LIKE '%warrior%'
OR
Description LIKE '%fiend%'
OR
Description LIKE '%damage%'
</code></pre>
<p>But a trick I picked up a little while go to do "strongly typed" list parsing in a stored procedure is to parse the list into a table variable/temporary table, converting it to the proper type and then doing an INNER JOIN against that table in my final result set. This works great when sending say a list of integer IDs to the procedure. I wind up having a final query that looks like this:</p>
<pre><code>SELECT Id, Name, Description
FROM dbo.Card
INNER JOIN @tblExclusiveCard ON dbo.Card.Id = @tblExclusiveCard.CardId
</code></pre>
<p>I want to use this trick with a list of strings. But since I'm looking for a particular keyword, I am going to use the LIKE clause. So ideally I'm thinking I'd have my final query look like this:</p>
<pre><code>SELECT Id, Name, Description
FROM dbo.Card
INNER JOIN @tblKeyword ON dbo.Card.Description LIKE '%' + @tblKeyword.Value + '%'
</code></pre>
<p>Is this possible/recommended?</p>
<p>Is there a better way to do something like this?</p>
<hr>
<p>The reason I'm putting wildcards on both ends of the clause is because there are "archfiend", "beast-warrior", "direct-damage" and "battle-damage" terms that are used in the card texts.</p>
<p>I'm getting the impression that depending on the performance, I can either use the query I specified or use a full-text keyword search to accomplish the same task? </p>
<p>Other than having the server do a text index on the fields I want to text search, is there anything else I need to do?</p>
|
<p>Your first query will work but will require a full table scan because any index on that column will be ignored. You will also have to do some dynamic SQL to generate all your LIKE clauses.</p>
<p>Try a full text search if your using SQL Server or check out one of the <a href="http://lucene.apache.org/java/docs/index.html" rel="noreferrer">Lucene</a> implementations. Joel talked about his success with it recently.</p>
|
<p>Performance will be depend on the actual server than you use, and on the schema of the data, and the amount of data. With current versions of MS SQL Server, that query should run just fine (MS SQL Server 7.0 had issues with that syntax, but <a href="http://support.microsoft.com/kb/225093" rel="nofollow noreferrer">it was addressed in SP2</a>).</p>
<p>Have you run that code through a profiler? If the performance is fast enough and the data has the appropriate indexes in place, you should be all set.</p>
| 4,085
|
<p>Is there any alternative image manipulation library for .net? I would prefer something that is managed and open source. </p>
<p>I ask this because of two reasons:</p>
<ol>
<li>I have encountered hard to debug GDI+ errors with System.Drawing in the past</li>
<li>I have read that using System.Drawing in asp.net web applications is not 100% supported.</li>
</ol>
<p>Thanks!</p>
<p>edit: clarification, I know that System.Drawing can work asp.net web apps - I have used it in the past. I really just wonder if there are any managed image manipulation libraries for .net :)</p>
|
<p>I don't know of any fully-managed 2D drawing libraries that are either free or open-source (there appears to be a few commercially available, but OSS is the way to go). However, you might look into <a href="http://www.go-mono.com/docs/index.aspx?tlink=0@N:Cairo" rel="nofollow noreferrer">the Mono bindings to Cairo</a>.</p>
<p>Cairo is a platform independent 2D drawing API. You can find more information about it at <a href="http://cairographics.org" rel="nofollow noreferrer">the Cairo homepage</a>. The <a href="http://en.wikipedia.org/wiki/Cairo_(graphics)" rel="nofollow noreferrer">Cairo Wikipedia page</a> also has some good info.</p>
<p>Cairo is also used fairly widely in the Open Source world, which to me says something about its robustness. Mozilla, Webkit, and Mono all use it, among others. Ironically, Mono actually uses it to back their System.Drawing implementation... go figure.</p>
<p>There might also be a way to use Mono's System.Drawing implementation as a drop-in replacement for the Microsoft implementation, though I'm not sure how or if that would even work. I would probably start by replacing the System.Drawing.dll reference with Mono's version, and then try to deal with any errors.</p>
|
<p>With respect to (1), most of the hard to debug errors are due to not closing open handles (Dispose() in managed-land). I'm curious where you heard (2).</p>
| 3,426
|
<p><strong>Problem:</strong> </p>
<p>I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B.</p>
<p><strong>Goal:</strong></p>
<p>A solution that would somehow link these two spreadsheets together (keep in mind that they exist on two separate LAN shares on the network) so that when A is updated, B is automatically updated for the corresponding record.</p>
<p>*Note that I understand fully that a database would probably be a better plan for tasks such as these but unfortunately I have no say in that matter.</p>
<p>**Note also that this needs to work for Office 2003 and Office 2007</p>
|
<p>So you mean that AD743 on spreadsheet B must be equal to AD743 on spreadsheet A? Try this:</p>
<ul>
<li>Open both spreadsheets on the same
machine.</li>
<li>Go to AD743 on spreadsheet B.</li>
<li>Type =.</li>
<li>Go to spreadsheed A and click on
AD743.</li>
<li>Press enter.</li>
</ul>
<p>You'll notice that the formula is something like '<em>[path-to-file+file-name].worksheet-name!AD743</em>'.</p>
<p>The value on spreadsheet B will be updated when you open it. In fact, it will ask you if you want to update. Of course, your connection must be up and running for it to update. Also, you can't change the name or the path of spreadsheet A.</p>
|
<p>I can't say if this is overkill without knowing the details of your usage case, but consider creating a spreadsheet C to hold all data held in common between the two. Links can become dizzyingly complex as spreadsheets age, and having a shared data source might help clear up the confusion.</p>
<p>Perhaps even more "enterprise-y" is the concept of just pasting in all data that otherwise would be shared. That is the official best practice in my company, because external links have caused so much trouble with maintainability. It may seem cumbersome at first, but I've found it may just be the best way to promote maintainability in addition to ease of use, assuming you don't mind the manual intervention.</p>
| 2,518
|
<p>I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception handler to catch any (heaven forbid) exceptions that may arise. I'd like the exception handler to be able to prompt the user to click a <kbd>Send Error Report</kbd> button, which would then cause the app to send an email to my FogBugz email address.</p>
<p>What's the best way to do this, and are there any "gotchas" to watch out for?</p>
|
<p>You'll want to use the SmtpClient class as outlined <strong><a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx" rel="nofollow noreferrer">here</a></strong>.<br>
There are no gotchas - sending email is about as easy as it gets.</p>
|
<blockquote>
<p>You'll want to use the SmtpClient class as outlined <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx" rel="nofollow noreferrer">here</a>.
There are no gotchas - sending email is about as easy as it gets.</p>
</blockquote>
<p>An extensive <a href="http://www.systemnetmail.com/default.aspx" rel="nofollow noreferrer" title="System.Net.Mail FAQ">System.Net.Mail FAQ</a> is located <a href="http://www.systemnetmail.com/default.aspx" rel="nofollow noreferrer" title="System.Net.Mail FAQ">here</a>.</p>
| 8,237
|
<p>I'm new to 3D printing and have bought an Ender 3. I have printed a few good prints but I'm noticing a worsening issue: </p>
<p>When I select "autohome" the axes head towards their limit switches, but the y axis in particular seems to slam into the limit switch, bending it away, meaning that the platform bounces off and doesn't activate the limit switch a second time</p>
<p>This causes the machine to slam against the back over and over until the limit switch is triggered or power is removed.</p>
<p>I've replaced the limit switch twice</p>
<p>I've tried supergluing the limit switch to its PCB but even with a needle and patience this caused the limit switch to be ruined</p>
<p>What can I do?</p>
<p>Edit: Here are some photos of the switch (2nd replacement). The OEM switch also did the same thing, but I don't have photos of that. The screws are loose in these photos, but this is just because my Allen key is lost - the previous two switches had the screws reasonably tightened with the correct Allen key, provided in the box<a href="https://i.stack.imgur.com/myOyr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/myOyr.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/LJ7vM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJ7vM.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/C3JHa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3JHa.jpg" alt="enter image description here"></a></p>
|
<p>Personally, I have found that if you bend the arm of the limit switch out, it gets triggered earlier and solves this issue for good, (broke a switch clean off at the bend on the pins, soldered old switch back onto the pins in the board) bent the arm to a greater angle, so the striker triggers 3-5 mm earlier, problem averted!</p>
|
<p>The solution seems to be simply triggering the switch earlier, and making sure that it is triggered. The thin arm can end up bent over the actual button of the switch, meaning that the arm can be touching the switch without actually "pressing" the switch. For some, bending the arm seems to have worked, but for me I had to wedge a small piece of plastic between the arm and the switch button, meaning that it is a lot more reliable when you press the switch. The piece isn't stuck in there in any way, simply held by friction. This isn't the best solution as you have to keep an eye on that piece with every homing, but until a better answer is available, I recommend this solution as it was more reliable than bending the arm out or into a different shape.</p>
| 1,620
|
<p>I am attempting to print a model that is too tall to print up-right and it has a large flat side that would be my first layer but ultimately would be the side of the object and I'd like it to look presentable. I'm using wood PLA, so I intend to sand and stain it.</p>
<p>I've had no issues with adhesion when using a raft. The slicer lays down a thick first layer that sticks beautifully. Here's the first layer of a raft - nice thick lines:</p>
<p><a href="https://i.stack.imgur.com/2I1of.jpg" rel="nofollow noreferrer" title="First layer of a raft"><img src="https://i.stack.imgur.com/2I1of.jpg" alt="First layer of a raft" title="First layer of a raft" /></a></p>
<p>But when I try printing without the raft (even when using a brim) that first layer is not only thin, but easily moves away. Also the lines meld together creating gaps in the layer. And that's no skirt around the outside, that's the side of the model that doesn't touch the fill. I have to imagine this would be awful rough and impossible to sand out if it finished.</p>
<p><a href="https://i.stack.imgur.com/tFiqL.jpg" rel="nofollow noreferrer" title="Printing without a raft"><img src="https://i.stack.imgur.com/tFiqL.jpg" alt="Printing without a raft" title="Printing without a raft" /></a></p>
<p>By the second layer, the friction is picking up the first layer and it catches the extruder and bam:</p>
<p><a href="https://i.stack.imgur.com/hCaCe.jpg" rel="nofollow noreferrer" title="Destroyed second layer"><img src="https://i.stack.imgur.com/hCaCe.jpg" alt="Destroyed second layer" title="Destroyed second layer" /></a></p>
<p>I've done some research suggesting higher temps, both of the extruder and the plate. I did see an improvement in the lines, but it still doesn't stick well. And what is considered a good temp? how do you know if you went too hot?</p>
<p>Any recommended settings in the slicer to make the bottom layer smoother?</p>
<p>The printer is a FlashForge Creator Pro.</p>
|
<p>The motor is mounted in a fixed position no matter if it's on top or bottom.
You can imagine the lead screw as a rod hanging down and supporting the bed in the Z direction only, because all of the XY rigidity comes from the Liner rails the bed is attached to it works just as well if the stiff rod is under compression instead of hanging from the rod.</p>
<p>Any forces that might "pull it straight" are the same forces that can cause Z wobble so you would not want to even try to use the misalignment to straighten a bent lead screw.</p>
<p>The only thing this that really changes with this orientation is if the lead screw is under tension or compression. Even a relatively thin lead screw can easy counter the forces of gravity and the forces is the same in both directions. Its easy and cheap to make a smooth rod or rail straight but not so easy to make a threaded one straight.</p>
|
<p>The motor is mounted in a fixed position no matter if it's on top or bottom.
You can imagine the lead screw as a rod hanging down and supporting the bed in the Z direction only, because all of the XY rigidity comes from the Liner rails the bed is attached to it works just as well if the stiff rod is under compression instead of hanging from the rod.</p>
<p>Any forces that might "pull it straight" are the same forces that can cause Z wobble so you would not want to even try to use the misalignment to straighten a bent lead screw.</p>
<p>The only thing this that really changes with this orientation is if the lead screw is under tension or compression. Even a relatively thin lead screw can easy counter the forces of gravity and the forces is the same in both directions. Its easy and cheap to make a smooth rod or rail straight but not so easy to make a threaded one straight.</p>
| 2,019
|
<p><strong>When using the Entity Framework, does ESQL perform better than Linq to Entities?</strong> </p>
<p>I'd prefer to use Linq to Entities (mainly because of the strong-type checking), but some of my other team members are citing performance as a reason to use ESQL. I would like to get a full idea of the pro's/con's of using either method.</p>
|
<p>The most obvious differences are:</p>
<p>Linq to Entities is strongly typed code including nice query comprehension syntax. The fact that the “from” comes before the “select” allows IntelliSense to help you.</p>
<p>Entity SQL uses traditional string based queries with a more familiar SQL like syntax where the SELECT statement comes before the FROM. Because eSQL is string based, dynamic queries may be composed in a traditional way at run time using string manipulation.</p>
<p>The less obvious key difference is:</p>
<p>Linq to Entities allows you to change the shape or "project" the results of your query into any shape you require with the “select new{... }” syntax. Anonymous types, new to C# 3.0, has allowed this.</p>
<p>Projection is not possible using Entity SQL as you must always return an ObjectQuery<T>. In some scenarios it is possible use ObjectQuery<object> however you must work around the fact that .Select always returns ObjectQuery<DbDataRecord>. See code below...</p>
<pre><code>ObjectQuery<DbDataRecord> query = DynamicQuery(context,
"Products",
"it.ProductName = 'Chai'",
"it.ProductName, it.QuantityPerUnit");
public static ObjectQuery<DbDataRecord> DynamicQuery(MyContext context, string root, string selection, string projection)
{
ObjectQuery<object> rootQuery = context.CreateQuery<object>(root);
ObjectQuery<object> filteredQuery = rootQuery.Where(selection);
ObjectQuery<DbDataRecord> result = filteredQuery.Select(projection);
return result;
}
</code></pre>
<p>There are other more subtle differences described by one of the team members in detail <a href="http://blogs.msdn.com/diego/archive/2007/12/20/some-differences-between-esql-and-linq-to-entities-capabilities.aspx" rel="noreferrer">here</a> and <a href="http://blogs.msdn.com/diego/archive/2007/11/11/choosing-an-entity-framework-api.aspx" rel="noreferrer">here</a>.</p>
|
<p>For direct queries I'm using linq to entities, for dynamic queries I'm using ESQL. Maybe the answer isn't either/or, but and/also.</p>
| 5,957
|
<p>Theres is a little problem I want to solve with Haskell:
let substitute a function that change all of the wildcards in a string for one concrete parameter. The function has de signature of:</p>
<pre><code>subs :: String -> String -> String -> String
-- example:
-- subs 'x' "x^3 + x + sin(x)" "6.2" will generate
-- "6.2^3 + 6.2 + sin(6.2)"
</code></pre>
|
<p>You could use the <a href="http://hackage.haskell.org/package/regex-compat-0.95.1" rel="nofollow noreferrer">Text.Regex</a> package.</p>
<p>Your example might look something like this:</p>
<pre><code>import Text.Regex(mkRegex, subRegex)
subs :: String -> String -> String -> String
subs wildcard input value = subRegex (mkRegex wildcard) input value
</code></pre>
|
<p>Use regular expressions (<code>Text.Regex.Posix</code>) and search-replace for <code>/\Wx\W/</code> (Perl notation). Simply replacing <code>x</code> to <code>6.2</code> will bring you trouble with <code>x + quux</code>.</p>
<p><a href="http://lukeplant.me.uk/blog.php?id=1107301690" rel="nofollow noreferrer">Haskell Regex Replace</a> for more information (I think this should be imported to SO.</p>
<p>For extra hard-core you could parse your expression as AST and do the replacement on that level. </p>
| 9,029
|
<p>When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database?</p>
|
<p>Transactions.</p>
<p>What the ruby on rails unit test framework does is this:</p>
<pre><code>Load all fixture data.
For each test:
BEGIN TRANSACTION
# Yield control to user code
ROLLBACK TRANSACTION
End for each
</code></pre>
<p>This means that</p>
<ol>
<li>Any changes your test makes to the database won't affect other threads while it's in-progress</li>
<li>The next test's data isn't polluted by prior tests</li>
<li>This is about a zillion times faster than manually reloading data for each test.</li>
</ol>
<p>I for one think this is pretty cool</p>
|
<p>I wanted to accept both Free Wildebeest's and Orion Edwards' answers but it would not let me. The reason I wanted to do this is that I'd come to the conclusion that these were the two main ways to do it, but which one to chose depends on the individual case (mostly the size of the database).</p>
| 8,700
|
<p>First off I understand that it is a horrible idea to run extremely large/long running reports. I am aware that Microsoft has a rule of thumb stating that a SSRS report should take no longer than 30 seconds to execute. However sometimes gargantuan reports are a preferred evil due to external forces such complying with state laws.</p>
<p>At my place of employment, we have an asp.net (2.0) app that we have migrated from Crystal Reports to SSRS. Due to the large user base and complex reporting UI requirements we have a set of screens that accepts user inputted parameters and creates schedules to be run over night. Since the application supports multiple reporting frameworks we do not use the scheduling/snapshot facilities of SSRS. All of the reports in the system are generated by a scheduled console app which takes user entered parameters and generates the reports with the corresponding reporting solutions the reports were created with. In the case of SSRS reports, the console app generates the SSRS reports and exports them as PDFs via the SSRS web service API. </p>
<p>So far SSRS has been much easier to deal with than Crystal with the exception of a certain 25,000 page report that we have recently converted from crystal reports to SSRS. The SSRS server is a 64bit 2003 server with 32 gigs of ram running SSRS 2005. All of our smaller reports work fantastically, but we are having trouble with our larger reports such as this one. Unfortunately, we can't seem to generate the aforemention report through the web service API. The following error occurs roughly 30-35 minutes into the generation/export:</p>
<p>Exception Message: The underlying connection was closed: An unexpected error occurred on a receive.</p>
<p>The web service call is something I'm sure you all have seen before: </p>
<pre><code>data = rs.Render(this.ReportPath, this.ExportFormat, null, deviceInfo,
selectedParameters, null, null, out encoding, out mimeType, out usedParameters,
out warnings, out streamIds);
</code></pre>
<p>The odd thing is that this report will run/render/export if the report is run directly on the reporting server using the report manager. The proc that produces the data for the report runs for about 5 minutes. The report renders in SSRS native format in the browser/viewer after about 12 minutes. Exporting to pdf through the browser/viewer in the report manager takes an additional 55 minutes. This works reliably and it produces a whopping 1.03gb pdf.</p>
<p>Here are some of the more obvious things I've tried to get the report working via the web service API: </p>
<ul>
<li>set the HttpRuntime ExecutionTimeout
value to 3 hours on the report
server</li>
<li>disabled http keep alives on the report server</li>
<li>increased the script timeout on the report server</li>
<li>set the report to never time out on the server</li>
<li>set the report timeout to several hours on the client call </li>
</ul>
<p>From the tweaks I have tried, I am fairly comfortable saying that any timeout issues have been eliminated. </p>
<p>Based off of my research of the error message, I believe that the web service API does not send chunked responses by default. This means that it tries to send all 1.3gb over the wire in one response. At a certain point, IIS throws in the towel. Unfortunately the API abstracts away web service configuration so I can't seem to find a way to enable response chunking. </p>
<ol>
<li>Does anyone know of anyway to reduce/optimize the PDF export phase and or the size of the PDF without lowering the total page count?</li>
<li>Is there a way to turn on response chunking for SSRS?</li>
<li>Does anyone else have any other theories as to why this runs on the server but not through the API?</li>
</ol>
<p>EDIT: After reading kcrumley's post I began to take a look at the average page size by taking file size / page count. Interestingly enough on smaller reports the math works out so that each page is roughly 5K. Interestingly, when the report gets larger this "average" increases. An 8000 page report for example is averaging over 40K/page. Very odd. I will also add that the number of records per page is set except for the last page in each grouping, so it's not a case where some pages have more records than another. </p>
|
<blockquote>
<ol>
<li>Does anyone know of anyway to
reduce/optimize the PDF export phase
and or the size of the PDF without
lowering the total page count?</li>
</ol>
</blockquote>
<p>I have a few ideas and questions:<br>
1. Is this a graphics-heavy report? If not, do you have tables that start out as text but are converted into a graphic by the SSRS PDF renderer (check if you can select the text in the PDF)? 41K per page might be more than it should be, or it might not, depending on how information-dense your report is. But we've had cases where we had minor issues with a report's layout, like having a table bleed into the page's margins, that resulted in the SSRS PDF renderer "throwing up its hands" and rendering the table as an image instead of as text. Obviously, the fewer graphics in your report, the smaller your file size will be.<br>
2. Is there a way that you could easily break the report into pieces? E.g., if it's a 10-location report, where Location 1 is followed by Location 2, etc., on your final report, could you run the Location 1 portion independent of the Location 2 portion, etc.? If so, you could join the 10 sub-reports into one final PDF using <a href="http://pdfsharp.com/" rel="nofollow noreferrer">PDFSharp</a> after you've received them all. This leads to some difficulties with page numbering, but nothing insurmountable.</p>
<blockquote>
<p>3. Does anyone else have any other
theories as to why this runs on the
server but not through the API?</p>
</blockquote>
<p>My guess would be the sheer size of the report. I don't remember everything about what's an IIS setting and what's SSRS-specific, but there might be some overall IIS settings (maybe in Metabase.xml) that you would have to be updated to even allow that much data to pass through. </p>
<p>You could isolate the question of whether the time is the problem by taking one of your working reports and building in a long wait time in your stored procedures with WAITFOR (assuming SQL Server for your DBMS).</p>
<p>Not solutions, per se, but ideas. Hope it helps.</p>
|
<blockquote>
<ol>
<li>Does anyone know of anyway to
reduce/optimize the PDF export phase
and or the size of the PDF without
lowering the total page count?</li>
</ol>
</blockquote>
<p>I have a few ideas and questions:<br>
1. Is this a graphics-heavy report? If not, do you have tables that start out as text but are converted into a graphic by the SSRS PDF renderer (check if you can select the text in the PDF)? 41K per page might be more than it should be, or it might not, depending on how information-dense your report is. But we've had cases where we had minor issues with a report's layout, like having a table bleed into the page's margins, that resulted in the SSRS PDF renderer "throwing up its hands" and rendering the table as an image instead of as text. Obviously, the fewer graphics in your report, the smaller your file size will be.<br>
2. Is there a way that you could easily break the report into pieces? E.g., if it's a 10-location report, where Location 1 is followed by Location 2, etc., on your final report, could you run the Location 1 portion independent of the Location 2 portion, etc.? If so, you could join the 10 sub-reports into one final PDF using <a href="http://pdfsharp.com/" rel="nofollow noreferrer">PDFSharp</a> after you've received them all. This leads to some difficulties with page numbering, but nothing insurmountable.</p>
<blockquote>
<p>3. Does anyone else have any other
theories as to why this runs on the
server but not through the API?</p>
</blockquote>
<p>My guess would be the sheer size of the report. I don't remember everything about what's an IIS setting and what's SSRS-specific, but there might be some overall IIS settings (maybe in Metabase.xml) that you would have to be updated to even allow that much data to pass through. </p>
<p>You could isolate the question of whether the time is the problem by taking one of your working reports and building in a long wait time in your stored procedures with WAITFOR (assuming SQL Server for your DBMS).</p>
<p>Not solutions, per se, but ideas. Hope it helps.</p>
| 3,612
|
<p>I play a <a href="https://en.m.wikipedia.org/wiki/Berimbau" rel="noreferrer">berimbau</a> for Capoeira. One of the most fragile (and most expensive) bits is the <em>cabaça</em>, a hollow gourd used as a resonator.</p>
<p><img src="https://i.stack.imgur.com/tRNcL.jpg" alt="cabaças"></p>
<p>I'm not very familiar with the qualities of the resin used for 3d printing. If I were to take this to our local Maker Lab and have them scan and print a copy, how likely is it that it would work? My fear is that the plastic would be too sound deadening.</p>
<p>If you want a less exotic parallel, imagine the body of a guitar. That's a resonating chamber.</p>
|
<p>I can't answer this from a technical 3D printing angle. But, from a musical angle:</p>
<p>Where the body of an instrument has the primary function of enclosing a vibrating air column, the material has often been demonstrated to perhaps make a difference, but only a subtle one. As an example, a recent range of plastic trombones, although not first-class instruments, have proved extremely playable (and have the great advantage of being virtually indestructable). </p>
<p>I suggest you try this. Play your instrument, dampening vibration of the cabaça with your hand or with a piece of cloth. Just damp the shell externally. Don't obstruct the hole or put anything inside. Now, fill the cabaça with cotton wool or similar. If the first makes little difference, you're probably good to go with a plastic cabaça. Of course, if the second makes little difference either, we might have to suspect that the cabaça is mainly decorative!</p>
<p>You could also experiment with alternative resonators of a similar size and capacity, available 'off the shelf', not worrying too much about a cosmetic match. They might sound even better!</p>
|
<p>I'll take a stab here, but my gut instinct is to say that a printed part will not sound the same as your original gourd resonator.</p>
<p>I believe the acoustics rely on the hardness, shape, and size of the material. In which case, a gourd is a hard and often thin material (after gutting it). Typical 3D printing materials will have a minimum thickness which may get in the way of achieving the same shape of the gourd resonator and plastics are typically going to be softer in hardness than your gourd.</p>
<p>So, in short, I think if your try to replicate the resonator with 3D printing it will not sound the same. That may not be a bad thing, depending on what you're looking for.</p>
<p>Also, who's to say the resonator has to be shaped like that? 3D printers allow us to manufacture parts that have historically been impossible to make and many instruments that we use today were designed hundreds of years ago with far less advanced tools available. I say its worth trying a replica of the gourd and then exploring other shapes to print that may affect the tonality of your instrument.</p>
| 661
|
<p>I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. </p>
<p>I'm using <code>SqlConnection</code> for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to be pretty verbose methods when I google.</p>
|
<pre><code>using (var conn = new SqlConnection(yourConnectionString))
{
var cmd = new SqlCommand("insert into Foo values (@bar)", conn);
cmd.Parameters.AddWithValue("@bar", 17);
conn.Open();
cmd.ExecuteNonQuery();
}
</code></pre>
|
<pre><code>using (SqlConnection myConnection new SqlConnection("Your connection string"))
{
SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ...", myConnection);
myConnection.Open();
myCommand.ExecuteNonQuery();
}
</code></pre>
| 5,192
|
<p>Has anyone looked at <a href="http://developer.yahoo.com/flash/" rel="nofollow noreferrer">Yahoo's ASTRA</a>? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the <code>myPieChart.dataTipFunction</code>. For data that looks like:</p>
<pre><code>myPieChart.dataProvider =
[ { category: "Groceries", cost: 50 },
{ category: "Transportation", cost: 175} ]
myPieChart.dataField = "cost";
myPieChart.categoryField = "category";
</code></pre>
<p>I wrote a function like this:</p>
<pre><code>import com.yahoo.astra.fl.charts.series.*
myPieChart.dataTipFunction =
function (obj:Object, index:int, series:ISeries):String {
return obj.category + "\n$" + obj.cost;
};
</code></pre>
<p>There's ceil(2.718281828459045) problems with this:</p>
<ol>
<li><p>I'm directly calling the category and cost properties of the data provider. The names are actually configurable when setting up the chart, I'd like to maintain that flexibility.</p>
</li>
<li><p>The default data tip would show the category, the cost (without a dollar sign), and the percentage it makes up in the pie chart. So here, I've lost the percentage. I just have no idea which property of what would hold that. It might be part of the series.</p>
</li>
<li><p>I probably only need to override the <code>dataItemRenderer</code> for the cost part of the series, but I don't know how to access it. The documentation is a little ... lacking there.</p>
</li>
</ol>
<p>Normally I would just look at the default implementation of the <code>dataTipFunction</code> but it's all inside a compiled shm that's part of the components distributed from yahoo.</p>
<p>Can anyone help me complete this overridden function with percentage information and the flexibility mentioned in point 1?</p>
|
<p>Okay... so no-one's tried Astra, or people just avoid Flash questions.</p>
<p>After a lot of guess work it turns out I needed to cast the series to a PieSeries and then work with those member functions, as the ISeries was useless on it's own.</p>
<pre><code>myPieChart.dataTipFunction =
function (item:Object, index:int, series:ISeries):String {
var oPieSeries:PieSeries = series as PieSeries;
return oPieSeries.itemToCategory(item,index) + "\n$" +
oPieSeries.itemToData(item) + "\n" +
Number(oPieSeries.itemToPercentage(item)).toFixed(2) + "%";
};
</code></pre>
|
<p>The Astra components are distributed with the complete source code. Flash CS3 components use compiled shims because otherwise you'd need to manually add the raw source files to your classpath. As a bonus, they also improve compile times because they're already built for you. Look in the "Source" folder in the Astra zip file, and you'll find all the ActionScript classes for the Astra components.</p>
| 5,367
|
<p>I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?</p>
<p>I looked at the answers to <a href="https://stackoverflow.com/questions/177/how-do-i-programmatically-create-a-pdf-in-my-net-application">this question</a>, but they mostly relate to .Net.</p>
|
<p><a href="https://github.com/libharu/libharu" rel="noreferrer">LibHaru</a></p>
<blockquote>
<p>Haru is a free, cross platform,
open-sourced software library for
generating PDF written in ANSI-C. It
can work as both a static-library (.a,
.lib) and a shared-library (.so,
.dll).</p>
</blockquote>
<p>Didn't try it myself, but maybe it can help you</p>
|
<p><a href="http://wxcode.sourceforge.net/docs/wxpdfdoc/" rel="nofollow">http://wxcode.sourceforge.net/docs/wxpdfdoc/</a></p>
<p>Works with the wxWidgets library.</p>
| 8,315
|
<p>I want to write a tool that helps me search pdf/chm/djvu files in linux. Any pointers on how to go about it? </p>
<p>The major problem is reading/importing data from all these files. Can this be done with C and shell scripting? </p>
|
<p><a href="https://wiki.ubuntu.com/Tracker" rel="nofollow noreferrer">Tracker</a> ships with Ubuntu 8.04 -- it was a significant switch from Beagle which users believed was too resource (CPU) intensive and didn't yield good enough results. It indexes both pdf and chm and according to <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=460260" rel="nofollow noreferrer">this bug report</a> it also indexes djvu.</p>
|
<p>How about a plugin for <a href="http://www.beagle-project.org/" rel="nofollow noreferrer">Beagle</a> ?</p>
<p>It already searches PDFs but you can add other file types.</p>
<p>Here is the relevant wikipedia page : <a href="http://en.wikipedia.org/wiki/Beagle_(software)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Beagle_(software)</a></p>
| 5,628
|
<p>Part of the web application I'm working on is an area displaying messages from management to 1...n users. I have a DataAccess project that contains the LINQ to SQL classes, and a website project that is the UI. My database looks like this:</p>
<p>User -> MessageDetail <- Message <- MessageCategory</p>
<p>MessageDetail is a join table that also contains an IsRead flag.</p>
<p>The list of messages is grouped by category. I have two nested ListView controls on the page -- One outputs the group name, while a second one nested inside that is bound to MessageDetails and outputs the messages themselves. In the code-behind for the page listing the messages I have the following code:</p>
<pre><code>protected void MessageListDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
var db = new DataContext();
// parse the input strings from the web form
int categoryIDFilter;
DateTime dateFilter;
string catFilterString = MessagesCategoryFilter.SelectedValue;
string dateFilterString = MessagesDateFilter.SelectedValue;
// TryParse will return default values if parsing is unsuccessful (i.e. if "all" is selected"):
// DateTime.MinValue for dates, 0 for int
DateTime.TryParse(dateFilterString, out dateFilter);
Int32.TryParse(catFilterString, out categoryIDFilter);
bool showRead = MessagesReadFilter.Checked;
var messages =
from detail in db.MessageDetails
where detail.UserID == (int)Session["UserID"]
where detail.Message.IsPublished
where detail.Message.MessageCategoryID == categoryIDFilter || (categoryIDFilter == 0)
where dateFilter == detail.Message.PublishDate.Value.Date || (dateFilter == DateTime.MinValue)
// is unread, showRead filter is on, or message was marked read today
where detail.IsRead == false || showRead || detail.ReadDate.Value.Date == DateTime.Today
orderby detail.Message.PublishDate descending
group detail by detail.Message.MessageCategory into categories
orderby categories.Key.Name
select new
{
MessageCategory = categories.Key,
MessageDetails = categories.Select(d => d)
};
e.Result = messages;
}
</code></pre>
<p>This code <em>works</em>, but sticking a huge LINQ statement like this in the code-behind for a LinqDataSource control just doesn't sit right with me. </p>
<p>It seems like I'm still coding queries into the user interface, only now it's LINQ instead of SQL. However, I feel that building another layer between the L2S classes and the UI would cut back on some of the flexibility of LINQ. Isn't the whole point to reduce the amount of code you write to fetch data?</p>
<p>Is there some possible middle ground I'm not seeing, or am I just misunderstanding the way LINQ to SQL is supposed to be used? Advice would be greatly appreciated.</p>
|
<p>All your LINQ querys should be in a <strong>business logic class</strong>, no change from older methodologies like ADO.</p>
<p>If you are a <strong>purist</strong> you should always return List(of T) from your methods in the business class, in fact, the datacontext should only be visible to the business classes.
Then you can manipulate the list in the user interface.</p>
<p>If you are a <strong>pragmatist</strong>, you can return a IQueryable object and make some manipulations in the user interface.</p>
|
<p>Regardless of LINQ, I think that mixing presentation code with database-relaed code is not a good idea. I would create a simple DB abstraction layer on top of LINQ queries. In my opinion LINQ is just a convenient tool, that doesn't have a serious impact on traditional application design.</p>
| 6,959
|
<p>Is there a way to view more than the last 300 lines in the terminal tab on OctoPrint? Or is there a txt file of a log? Or even a setting/plugin that does either?</p>
<p>I keep finding my prints pausing as if I said to change the filament even though that wasn't set in the slicer, but I catch it long after the 300<sup>th</sup> line in the terminal so I can't see what OctoPrint is trying to do.</p>
|
<p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow noreferrer">reference</a>).</p>
<blockquote>
<p>Disabling Autoscroll now completely disables cutting off the lines (so
you can have way more than 300 lines while that's disabled), filtering
has been improved too and doesn't cause scrolling anymore.</p>
</blockquote>
<p>Note that with disabled autoscrolling, you will be able to see more lines up to the point that the buffer is full. If you need even more lines to monitor, just enable the logging the data to file <code>serial.log</code>. If you open the options page (OctoPrint Settings), just tick the box for "Log communication to <code>serial.log</code>" under "Serial logging" of the "Serial connection" options.</p>
<p>This serial logging file is typically used for debug purposes, but as can be read from the options, it comes with a warning:</p>
<blockquote>
<p>While this can negatively impact performance, a <code>serial.log</code> can be
incredibly useful for debugging any issues observed in the
communication between OctoPrint and your printer.</p>
</blockquote>
<p>You can either access the log file through the OctoPrint options/setting through the "Logging" options tab, or direct download/copy from the logging directory:</p>
<blockquote>
<ul>
<li>on Linux: ~/.octoprint/logs</li>
<li>on Windows: %APPDATA%\OctoPrint\logs</li>
<li>on MacOSX: ~/Library/Application Support/OctoPrint/logs</li>
</ul>
</blockquote>
|
<p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow noreferrer">reference</a>).</p>
<blockquote>
<p>Disabling Autoscroll now completely disables cutting off the lines (so
you can have way more than 300 lines while that's disabled), filtering
has been improved too and doesn't cause scrolling anymore.</p>
</blockquote>
<p>Note that with disabled autoscrolling, you will be able to see more lines up to the point that the buffer is full. If you need even more lines to monitor, just enable the logging the data to file <code>serial.log</code>. If you open the options page (OctoPrint Settings), just tick the box for "Log communication to <code>serial.log</code>" under "Serial logging" of the "Serial connection" options.</p>
<p>This serial logging file is typically used for debug purposes, but as can be read from the options, it comes with a warning:</p>
<blockquote>
<p>While this can negatively impact performance, a <code>serial.log</code> can be
incredibly useful for debugging any issues observed in the
communication between OctoPrint and your printer.</p>
</blockquote>
<p>You can either access the log file through the OctoPrint options/setting through the "Logging" options tab, or direct download/copy from the logging directory:</p>
<blockquote>
<ul>
<li>on Linux: ~/.octoprint/logs</li>
<li>on Windows: %APPDATA%\OctoPrint\logs</li>
<li>on MacOSX: ~/Library/Application Support/OctoPrint/logs</li>
</ul>
</blockquote>
| 1,193
|
<p><a href="https://i.stack.imgur.com/Fpc5P.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Fpc5P.jpg" alt="enter image description here"></a></p>
<p>By what process does the Prusa i3 determine it's home position? </p>
<p>I have a feeling that it works like this, but I'm not entirely sure about it:</p>
<ol>
<li>If none of the end stops are activated; assume you are somewhere between Max-X, Max-Y, Max-Z and the point 0,0,0.</li>
<li>do
<ol>
<li>For axis in Axies
<ol>
<li>If axis endstop not signaling
<ol>
<li>subtract 100 steps from axis.</li>
</ol></li>
</ol></li>
</ol></li>
<li>while endstops are not signaling, or if point 0,0,0 not reached; </li>
</ol>
|
<p>It works like you describe, but it does not move all axes at the same time. It first moves the X-axis, subtracting steps while the X endstop is not pressed. When the X-axis is is homed (the X-endstop is gets pressed) it repeats the procedure for the Y-axis and finally the Z-axis.</p>
|
<p>You have the endstop which sends a on or off to the controller board.</p>
<p>The boards firmware knows if it is a close or open switch.</p>
<p>Lets assume pressed is on and unpressed is off.</p>
<p>When the axis is at home it will read as ON. The firmware then will not allow the axis to move in the direction you have designated is the Home direction. Now this is probably where you got confused. You in fact are the one to open a code file, and say what direction is home. When your turn it on the first time, chances are you have done it wrong on at least one. Then you will frantically go and manually press it yourself as your printers hotend crashes HARD into the bed.. All of us have been there !</p>
<p>Generally Prusas use ramps 1.4</p>
<p><a href="http://reprap.org/wiki/RAMPS_1.4" rel="nofollow">http://reprap.org/wiki/RAMPS_1.4</a></p>
<p>Your code is your firmware. Usually you just edit a header file (single file). These files are heavily documented, depending which you use. Your seller might provider you with a preconfigured header file.</p>
<p>Will note that yes, if the endstop slips or is not position right, the printer will crash into it self. Usually no damage, but it is a very unpleasant thing to happen. </p>
<p>Also worth noting that some firmware will force you to home before you move. Others will let you crash the printer on the opposite side. Just a motor, will do whatever you tell it to.</p>
<p>In short. You tell it how the endstops work and what direction is home on a printer.</p>
| 355
|
<p>I have a problem with some zombie-like processes on a certain server that need to be killed every now and then. How can I best identify the ones that have run for longer than an hour or so?</p>
|
<p>If they just need to be killed:</p>
<pre><code>if [[ "$(uname)" = "Linux" ]];then killall --older-than 1h someprocessname;fi
</code></pre>
<p>If you want to see what it's matching</p>
<pre><code>if [[ "$(uname)" = "Linux" ]];then killall -i --older-than 1h someprocessname;fi
</code></pre>
<p>The <code>-i</code> flag will prompt you with yes/no for each process match. </p>
|
<p>Using ps is the right way. I've already done something similar before but don't have the source handy.
Generally - ps has an option to tell it which fields to show and by which to sort. You can sort the output by running time, grep the process you want and then kill it.</p>
<p>HTH</p>
| 2,795
|
<p>I've been using Linq to SQL for some time now and I find it to be really helpful and easy to use. With other ORM tools I've used in the past, the entity object filled from the database normally has a property indicating the length of the underlying data column in the database. This is helpful in databinding situations where you can set the MaxLength property on a textbox, for example, to limit the length of input entered by the user.</p>
<p>I cannot find a way using Linq to SQL to obtain the length of an underlying data column. Does anyone know of a way to do this? Help please.</p>
|
<p>Using the LINQ ColumnAttribute to Get Field Lengths from your Database :</p>
<p><a href="http://www.codeproject.com/KB/cs/LinqColumnAttributeTricks.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/LinqColumnAttributeTricks.aspx</a></p>
|
<p>If you need to know the exact column length you can resort to the System.Data classes themselves. Something a bit like this:</p>
<pre><code>var context = new DataContextFromSomewhere();
var connection = context.Connection;
var command = connection.CreateCommand( "SELECT TOP 1 * FROM TableImInterestedIn" );
var reader = command.ExecuteReader();
var table = reader.GetSchemaTable();
foreach( var column in table.Columns )
{
Console.WriteLine( "Length: {0}", column.MaxLength );
}
</code></pre>
| 4,101
|
<p>varchar(255), varchar(256), nvarchar(255), nvarchar(256), nvarchar(max), etc?</p>
<p>256 seems like a nice, round, space-efficient number. But I've seen 255 used a lot. Why?</p>
<p>What's the difference between varchar and nvarchar?</p>
|
<p>VARCHAR(255). It won't use all 255 characters of storage, just the storage you need. It's 255 and not 256 because then you have space for 255 plus the null-terminator (or size byte).</p>
<p>The "N" is for Unicode. Use if you expect non-ASCII characters.</p>
|
<p>If you will be supporting languages other than English, you will want to use nvarchar.</p>
<p>HTML should be okay as long as it contains standard ASCII characters. I've used nvarchar mainly in databases that were multi-lingual support. </p>
| 7,812
|
<p>An app I'm writing always crashes on a clients computer, but I don't get an exception description, or a stack trace.<br>
The only thing I get is a crash report that windows wants to send to Microsoft.<br>
I would like to get that dump file and investigate it myself, but I cannot find it.</p>
<p>When I "View the contents of the error report" I can see the different memory dumps, but I cannot copy it or save it.</p>
|
<p>You can use the <a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" rel="noreferrer">Windows debugging tools</a> to view the crash dump. To get the most use out of it, you'll need an exact copy of the symbols for that application (i.e. same version).</p>
<p>Have a look at <a href="http://blogs.msdn.com/tess/" rel="noreferrer">Tess's blog</a> for tutorials on how to use the Windows debugging tools. I refer to her blog constantly whenever I'm in need of analysing crash dumps.</p>
|
<p>Tess' blog was a great resource. Eventually I managed to figure out how to do remote debugging which means I didn't have to look at the crash dump.</p>
<p>For the general community, here are some links I found useful:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/8x6by8d2.aspx" rel="noreferrer">Remote debugging</a>, how to set up and run it.</li>
<li><a href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx" rel="noreferrer">Crash dumps</a>, how to save and debug them.</li>
</ul>
| 4,739
|
<p>After upgrading a rails 1.2 website to 2.1, the <a href="http://agilewebdevelopment.com/plugins/exception_notifier" rel="noreferrer">ExceptionNotifier plugin</a> no longer works, complaining about this error:</p>
<blockquote>
<p>ActionView::TemplateFinder::InvalidViewPath: Unprocessed view path
found:
"/path/to/appname/vendor/plugins/exception_notification/lib/../views".
Set your view paths with #append_view_path, #prepend_view_path, or #view_paths=.</p>
</blockquote>
<p>What causes it and how do I fix it?</p>
|
<p>This was caused by a change in rails 2.1 which prevents rails from loading views from any arbitrary path for security reasons.</p>
<p>There is now an updated version of the plugin on github, so the solution is to use that.</p>
<hr>
<p>The old solution here for posterity</p>
<p>To work around it, edit <code>init.rb</code> under your <code>vendor/plugins/exception_notification</code> directory, and add the following code to the end</p>
<pre><code>ActionController::Base.class_eval do
append_view_path File.dirname(__FILE__) + '/lib/../views'
end
</code></pre>
<p>This adds the ExceptionNotifier plugins' views folder to the list, so it is allowed to load them.</p>
|
<p>You ought to upgrade to the newest Exception Notification plugin which is in <a href="http://github.com/rails/exception_notification/tree/master" rel="nofollow noreferrer">its new home at GitHub</a>.</p>
| 2,342
|
<p>I am in the process of beginning work on several ASP.NET custom controls. I was wondering if I could get some input on your guys/girls thoughts on how you apply styling to your controls.</p>
<p>I would rather push it so CSS, so for the few controls I have done in the past, I have simply stuck a string property which allows you so type in the string which in then slung in a "<em>style</em>" attribute when rendering. I know I could also use the "<strong>CSSClass</strong>" property and apply the "<em>class</em>" attribute.</p>
<p>I have not done much in the way of creating a "proper" <strong>Style</strong> property (in which you actually save the style object, and use the designer to specify its values). This to me seems like a lot of work, and TBH, I hate the Style editor UI and would much rather type in the CSS/class name to apply..</p>
<h2>What are your thoughts on this?</h2>
<hr />
<p><strong>Note:</strong> This is kind of subjective - so to be clear:</p>
<p><strong>The accepted answer will be the one that:</strong></p>
<ul>
<li>Offers the pro's and con's of the various approaches.</li>
<li>Opinions are welcome, but a good answer should be constructive.</li>
<li>Backs it up with some real-world knowledge/experience.</li>
</ul>
<p>There is <strong>nothing</strong> wrong <em>with</em> subjectivity. There <strong>is a problem</strong> with people <em>being</em> subjective and not thinking, being constructive or actually providing some insight and experience.</p>
<p><strong>>>DO NOT<<</strong> tag this as "subjective" - that tag is a waste of time. "subjective" is not a technology or a category that people will look for. Fix the question rather than brush it off.</p>
|
<p>It would depend on how the custom controls are being used - A commercial, re-distributable control should be compliant with the VS IDE, and behave the way users expect it to when they implement the control.</p>
<p>On the other hand there is no point in wasting a lot of time to get styling to work if you or your team are the only ones to use the control, so long as it's styling works in a sane way.</p>
<p>Most of the custom controls I have implemented use a property to define the controls look and feel or just expose the controls' members own CSSClass properties.</p>
<p>The argument comes down to consistency vs. time - any element should use consistent styling mechanisms, if strapped for time, use a string method if not, implement a more complex / IDE friendly mechanism.</p>
|
<p>I think you should consider your "target market" for the custom control, e.g., the people who will use it.</p>
<p>If it's an internal custom control, you can pretty much mandate the use of one or the other: if it's internal to the company you will have the ability to enforce its consistency.</p>
<p>If it's meant for commercial consumption, however, it is required that you give an option to provide a way to use either style or class. Case in point: the <a href="http://msdn.microsoft.com/en-us/library/e468hxky.aspx" rel="nofollow noreferrer">ASP.NET site navigation controls</a>, e.g., SiteMapPath, Menu, Treeview. They have a bunch of properties exposed to allow either styles, classes, or a combination of both to each aspect of the controls' appearance.</p>
| 9,571
|
<p>I have a web reference for our report server embedded in our application. The server that the reports live on could change though, and I'd like to be able to change it "on the fly" if necessary.</p>
<p>I know I've done this before, but can't seem to remember how. Thanks for your help.</p>
<p>I've manually driven around this for the time being. It's not a big deal to set the URL in the code, but I'd like to figure out what the "proper" way of doing this in VS 2008 is. Could anyone provide any further insights? Thanks!</p>
<hr>
<p>In <strong>VS2008</strong> when I change the URL Behavior property to Dynamic I get the following code auto-generated in the Reference class.</p>
<p>Can I override this setting (MySettings) in the web.config? I guess I don't know how the settings stuff works.</p>
<pre><code>Public Sub New()
MyBase.New
Me.Url = Global.My.MySettings.Default.Namespace_Reference_ServiceName
If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then
Me.UseDefaultCredentials = true
Me.useDefaultCredentialsSetExplicitly = false
Else
Me.useDefaultCredentialsSetExplicitly = true
End If
End Sub
</code></pre>
<p><em>EDIT</em></p>
<p>So this stuff has changed a bit since VS03 (which was probably the last VS version I used to do this).</p>
<p>According to: <a href="http://msdn.microsoft.com/en-us/library/a65txexh.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/a65txexh.aspx</a> it looks like I have a settings object on which I can set the property programatically, but that I would need to provide the logic to retrieve that URL from the web.config.</p>
<p>Is this the new standard way of doing this in VS2008, or am I missing something?</p>
<p><em>EDIT #2</em></p>
<p>Anyone have any ideas here? I drove around it in my application and just put the URL in my web.config myself and read it out. But I'm not happy with that because it still feels like I'm missing something.</p>
|
<p>In the properties window change the "behavior" to Dynamic.</p>
<p>See: <a href="http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx</a></p>
|
<p>If you mean a VS2005 "Web Reference", then the generated proxy classes have a URL property that is the SOAP endpoint url of that service. You can change this property and have your subsequent http communications be made to that new endpoint.</p>
<p>Edit: Ah, thanks bcaff86. I didn't know you could do that simply by changing a property.</p>
| 2,716
|
<p>Which Database table Schema is more efficient and why?</p>
<pre><code>"Users (UserID, UserName, CompamyId)"
"Companies (CompamyId, CompanyName)"
</code></pre>
<p>OR</p>
<pre><code>"Users (UserID, UserName)"
"Companies (CompamyId, CompanyName)"
"UserCompanies (UserID, CompamyId)"
</code></pre>
<p>Given the fact that user and company have one-to-one relation.</p>
|
<p>For sure, the earlier one is more efficient given that constraint. For getting the same information, you will have less number of joins in your queries.</p>
|
<p>I think you mean "many to one" when it comes to users and companies - unless you plan on having a unique company for each user.</p>
<p>To answer your question, go with the first approach. One less table to store reduces space and will make your queries use less JOIN commands. Also, and more importantly, it correctly matches your desired input. The database schema should describe the format for all valid data - if it fits the format it should be considered valid. Since a user can only have one company it's possible to have incorrect data in your database if you use the second schema.</p>
| 5,976
|
<p>I have built a 3D printer out of parts from my tip, a ramps board, arduino mega, and a hot end. However, after doing a test extrusion some plastic was spewed out and then the print jammed un-expectantly and my homemade extruder no longer had the strength to push the filament. </p>
<p>I took the filament out and what I found was that the filament going into the extruder had formed a cylinder at the end. Then after pushing the filament through by hand to eliminate the possibility of my weak extruder, I found that the filament was expanding coming out of the filament, and then cooling down unable to go through. I cut the filament, removing the bloated end, pushed it back into the extruder and then again after 30 seconds the same problem occurred.
After researching, I came to the conclusion that maybe there is a gap allowing filament to go out of the heating area, expand and then cool down, or even my wooden direct to bowden adapter is stopping the filament cooling causing it to clog. However I am not sure.</p>
<p>I am becoming frustrated as I am doing this for a school project, I only have two weeks left to finish and everything seems to be failing. Any help would be much appreciated. </p>
<p>For reference this is my hotend: <a href="https://www.amazon.co.uk/gp/product/B074DRLGW9/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1." rel="noreferrer">link to amazon</a>
I brought the cheapest one available on amazon, so it has no fan and no way to connect a bowden tube. I have created a basic adapter between the thread and a bowden tube holder, out of wood. It's not good but it does the job.</p>
<p>Here is a picture of my hot end and what the filament looks like after I removed it. There appears to be a spiral shape on some of them.</p>
<p><a href="https://i.stack.imgur.com/kNKgu.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/kNKgu.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/iXpBG.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/iXpBG.jpg" alt="enter image description here"></a></p>
|
<p>You are suffering from what is called "heat creep". Molten filament is creeping up the heat break and into the bowden tube, where it is causing a jam. You need to install a proper radiator block that is cooled by a fan, not just a lump of wood as a "cold end". The cold end is not just a connector, its primary purpose is to act as a cooler. A hot end on its own is not enough. You also need a cold end. Here is my extruder disassembled (fan omitted). The radiator block is the red item.</p>
<p><a href="https://i.stack.imgur.com/ngeW7.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ngeW7.jpg" alt="enter image description here"></a></p>
|
<p>Hello it's seems that your hotend's barrel get's too hot when your ar printing, have you try to make a heat sink on the barrell, with some washers and nuts? That worked for me, like this<a href="https://i.stack.imgur.com/bmfpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmfpm.png" alt="enter image description here"></a></p>
<p>I Took that idea from this video <a href="https://www.youtube.com/watch?v=UvICpdVONXM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=UvICpdVONXM</a> </p>
<p>Also make sure that the hotend's aluminum block is properly insulated, you could do this with some Kapton Tape.</p>
| 733
|
<p>Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform simple arithmetic operations on two of them (add/subtract/multiply/divide).</p>
<p>My target is dealing with 128-bit integers.</p>
<p>There's a couple of approaches I'm looking at, and problems I see with them. Any input or commentary on what you would choose and how you might go about it would be greatly appreciated.</p>
<p><strong>Approach #1:</strong> Create a 128-bit integer class that stores its integer internally as four 32-bit integers. The only problem with this approach is that I'm not sure how to go about handling overflow/underflow issues when manipulating individual chunks of the two operands.</p>
<p><strong>Approach #2:</strong> Use the bcmath extension, as this looks like something it was designed to tackle. My only worry in taking this approach is the scale setting of the bcmath extension, because there can't be any rounding errors in my 128-bit integers; they must be precise. I'm also worried about being able to eventually convert the result of the bcmath functions into a binary string (which I'll later need to shove into some mcrypt encryption functions).</p>
<p><strong>Approach #3:</strong> Store the numbers as binary strings (probably LSB first). Theoretically I should be able to store integers of any arbitrary size this way. All I would have to do is write the four basic arithmetic functions to perform add/sub/mult/div on two binary strings and produce a binary string result. This is exactly the format I need to hand over to mcrypt as well, so that's an added plus. This is the approach I think has the most promise at the moment, but the one sticking point I've got is that PHP doesn't offer me any way to manipulate the individual bits (that I know of). I believe I'd have to break it up into byte-sized chunks (no pun intended), at which point my questions about handling overflow/underflow from Approach #1 apply.</p>
|
<p>The <a href="http://us2.php.net/gmp" rel="nofollow noreferrer">PHP GMP extension</a> will be better for this. As an added bonus, you can use it to do your decimal-to-binary conversion, like so:</p>
<pre><code>gmp_strval(gmp_init($n, 10), 2);
</code></pre>
|
<p>I implemented the following <a href="https://github.com/alixaxel/phunction/blob/ac2bc87e0d6d6c944a46d9714ca79004b18319c0/phunction/Math.php#L74-L143" rel="nofollow">PEMDAS complaint BC evaluator</a> which may be useful to you.</p>
<pre><code>function BC($string, $precision = 32)
{
if (extension_loaded('bcmath') === true)
{
if (is_array($string) === true)
{
if ((count($string = array_slice($string, 1)) == 3) && (bcscale($precision) === true))
{
$callback = array('^' => 'pow', '*' => 'mul', '/' => 'div', '%' => 'mod', '+' => 'add', '-' => 'sub');
if (array_key_exists($operator = current(array_splice($string, 1, 1)), $callback) === true)
{
$x = 1;
$result = @call_user_func_array('bc' . $callback[$operator], $string);
if ((strcmp('^', $operator) === 0) && (($i = fmod(array_pop($string), 1)) > 0))
{
$y = BC(sprintf('((%1$s * %2$s ^ (1 - %3$s)) / %3$s) - (%2$s / %3$s) + %2$s', $string = array_shift($string), $x, $i = pow($i, -1)));
do
{
$x = $y;
$y = BC(sprintf('((%1$s * %2$s ^ (1 - %3$s)) / %3$s) - (%2$s / %3$s) + %2$s', $string, $x, $i));
}
while (BC(sprintf('%s > %s', $x, $y)));
}
if (strpos($result = bcmul($x, $result), '.') !== false)
{
$result = rtrim(rtrim($result, '0'), '.');
if (preg_match(sprintf('~[.][9]{%u}$~', $precision), $result) > 0)
{
$result = bcadd($result, (strncmp('-', $result, 1) === 0) ? -1 : 1, 0);
}
else if (preg_match(sprintf('~[.][0]{%u}[1]$~', $precision - 1), $result) > 0)
{
$result = bcmul($result, 1, 0);
}
}
return $result;
}
return intval(version_compare(call_user_func_array('bccomp', $string), 0, $operator));
}
$string = array_shift($string);
}
$string = str_replace(' ', '', str_ireplace('e', ' * 10 ^ ', $string));
while (preg_match('~[(]([^()]++)[)]~', $string) > 0)
{
$string = preg_replace_callback('~[(]([^()]++)[)]~', __FUNCTION__, $string);
}
foreach (array('\^', '[\*/%]', '[\+-]', '[<>]=?|={1,2}') as $operator)
{
while (preg_match(sprintf('~(?<![0-9])(%1$s)(%2$s)(%1$s)~', '[+-]?(?:[0-9]++(?:[.][0-9]*+)?|[.][0-9]++)', $operator), $string) > 0)
{
$string = preg_replace_callback(sprintf('~(?<![0-9])(%1$s)(%2$s)(%1$s)~', '[+-]?(?:[0-9]++(?:[.][0-9]*+)?|[.][0-9]++)', $operator), __FUNCTION__, $string, 1);
}
}
}
return (preg_match('~^[+-]?[0-9]++(?:[.][0-9]++)?$~', $string) > 0) ? $string : false;
}
</code></pre>
<p>It automatically deals with rounding errors, just set the precision to whatever digits you need.</p>
| 5,807
|
<p>Currently, I'm using a Creality printer to print PLA (that's what I have on hand) but I'm definitely interested in working with other materials that require higher temperatures (both much higher, and just enough higher that the stock hotend is very marginal) in the future. </p>
<p>I understand that all-metal hotends are less forgiving and that they particularly are not the best for printing PLA, and shouldn't be assumed to be an upgrade when only printing PLA. </p>
<p>What I don't understand is, <em>how bad are they?</em> Are they so bad that I should plan on changing back to a PTFE hotend whenever I print PLA or ABS? Or are they suitable for use on a printer that is sometimes used for printing PLA and ABS and sometimes printing high-temp filaments?</p>
|
<blockquote>
<p>All-metal hotends are less forgiving </p>
</blockquote>
<p>Yes </p>
<blockquote>
<p>not as good for PLA</p>
</blockquote>
<p>No</p>
<blockquote>
<p>but how bad?</p>
</blockquote>
<p>That is very subjective and totally depending on the skill of the 3D printer operator! So, that part of the question cannot be answered.</p>
<p>Fact is that all-metal hotends are sold as being upgrades to lined versions, this is simply not true. It is a different design that can handle higher temperatures. To operate such hotends you require a little more experience as these hotends are a little less forgiving if you do not have the right slicer settings. Key parameters are hotend temperature, cold end cooling and retraction speed and length and amount of retractions in the model.</p>
<p>Another fact is that e.g. the Ultimaker cores concept (we opened a 0.4 mm core to see that for ourselves) doesn't use a PTFE lining, nor do other brands. They can perfectly print PLA (even with a high retraction length). The only time if failed printing PETG (higher temp than PLA) was the result of a heat creep induced clog which was caused by a cooling fan failure (the cooling fan ingested something and seized up), so just one print of a few meters of the several kilometers 2.85 mm that got printed.</p>
|
<blockquote>
<p>Are they so bad I should plan on changing back to a PTFE hot end?</p>
</blockquote>
<p>No, all metal hot end are not that bad, and may even be beneficial when printing at higher temperatures. You mentioned that you want to print ABS and other such materials. At temperatures this high, my understanding is that the PTFE tube in the hot end may melt, or at least become so damaged that the hot end is blocked, leading to needing to replace the tube. My first 3D printer used a PTFE ho tend, which due to the printing temperatures I was using, and lack of knowledge of the many types of hot end, the tube got damaged after about 2/5 hours, leading to me needing to replace the tube. I eventually sent the printer back, got my money back and got a printer with an all metal hot end. That has never failed me in hundreds of hours of printing.</p>
<blockquote>
<p>Are not the best for printing PLA</p>
</blockquote>
<p>I have never had a problem printing PLA with an all metal hot end, however if you are printing just PLA, a PTFE hot end would be just fine, although not as versatile if you wanted to try different materials in the future.</p>
<p><strong>In Summary:</strong></p>
<p>Provided you print fast enough (I regularly print at 60 mm/s) to ensure that no filament cools down in the hot end you should be fine.</p>
| 1,668
|
<p>I am implementing exception handling for our BizTalk services, and have run into a fairly major stumbling block.</p>
<p>In order to make the exception processing as generic as possible, and therefore to allow us to use it for any BizTalk application, our XML error schema includes an xs:any node, into which we can place a variety of data, depending on the actual exception. The generated XML should then be presented to a user through an InfoPath 2003 form for manual intervention before being represented back to BizTalk.</p>
<p>The problem is that InfoPath 2003 doesn't like schemas with an xs:any node. What we'd really like to do is the show the content of the exception report in a form with all relevant parameters mapped , and the entire content of the xs:any node in a text box, since users who are able to see these messages will be conversant with XML. Unfortunately, I am unable to make InfoPath even load the schema at design time.</p>
<p>Does anyone have any recommendation for how to achieve what we need, please?</p>
|
<p>Does your xs:any element have a minOccurs > 0?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb251017.aspx#UnsupportedConstructs" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb251017.aspx#UnsupportedConstructs</a></p>
<p>I've also read that due to the way that InfoPath works, it can not handly more than one schema for each namespace. Hence, your xs:any (and the sequence that it defines) should have a unique namespace.</p>
|
<p>Does your xs:any element have a minOccurs > 0?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb251017.aspx#UnsupportedConstructs" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb251017.aspx#UnsupportedConstructs</a></p>
<p>I've also read that due to the way that InfoPath works, it can not handly more than one schema for each namespace. Hence, your xs:any (and the sequence that it defines) should have a unique namespace.</p>
| 5,834
|
<p>What I mean by autolinking is the process by which wiki links inlined in page content are generated into either a hyperlink to the page (if it does exist) or a create link (if the page doesn't exist).</p>
<p>With the parser I am using, this is a two step process - first, the page content is parsed and all of the links to wiki pages from the source markup are extracted. Then, I feed an array of the existing pages back to the parser, before the final HTML markup is generated.</p>
<p>What is the best way to handle this process? It seems as if I need to keep a cached list of every single page on the site, rather than having to extract the index of page titles each time. Or is it better to check each link separately to see if it exists? This might result in a lot of database lookups if the list wasn't cached. Would this still be viable for a larger wiki site with thousands of pages?</p>
|
<p>In my own wiki I check all the links (without caching), but my wiki is only used by a few people internally. You should benchmark stuff like this.</p>
|
<p>My idea would be to query the titles like <code>SELECT title FROM articles</code> and simply check if each wikilink is in that array of strings. If it is you link to the page, if not, you link to the create page.</p>
| 3,536
|
<p>I was wondering if anyone could give me tips for designing a 3d printable structure that can "pinch" down onto a hockey puck shaped piece and hold it tightly. </p>
<p>I'd like for the structure to normally want to "pinch" two edges together, but I can pry/force them open when I shove the hockey puck into it. Once I let go, the two ends are now holding the puck fairly tightly.</p>
<p>My first thought was something like a potato chip bag clip, but that would require a couple pieces and a spring.</p>
<p>Is there a way to do something like this with one solid piece?</p>
|
<p>Here are first 3 the most simplified and generalized options you have:</p>
<p><a href="https://i.stack.imgur.com/XmHnf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XmHnf.png" alt="enter image description here"></a></p>
<p>All you need now is to give use more details about your needs. If you reveal more details we could help you to apply (and modify) one of these options.</p>
<p>Each of above has its own pros and cons of course. You said you don't want to have spring... so maybe a rubber ;)
But in fact whole-red is one-piece-clip in which the force comes from material elesticity or stiffness.</p>
<p>Please tell me what is the application of such clip.</p>
|
<p>If you are looking for a solid piece, the red one darth pixel showed is the best. An important consideration for something like this is making sure that it is able to flex outwards around the puck without fracturing. In order to keep the stress low in the arms, you can reduce the stiffness by either:</p>
<ul>
<li>Increasing the length of the arm</li>
<li>Decreasing the thickness of the arm in the direction it deflects</li>
</ul>
<p>This might be helpful in designing it to be printed. If your part breaks when inserting the puck, make the arms longer or thinner. If you aren't getting enough force, the in-plane thickness (coming out of your computer screen) can be thickened to your heart's content without changing the stress.</p>
| 376
|
<p>I intend to use <strong>RADIX / MTRIE</strong> as my preferred data-structure for a routing implementation. </p>
<p>Is there a decent open source implementation available (apart from freebsd-net) which I can use for my purpose, or do I need to write one myself?</p>
|
<p>There is a radix-tree implementation available under the GNU General Public License version 2, or (at your option) any later version: </p>
<p><a href="http://www.gelato.unsw.edu.au/lxr/source/lib/radix-tree.c" rel="nofollow noreferrer">http://www.gelato.unsw.edu.au/lxr/source/lib/radix-tree.c</a></p>
|
<p>If you cant find anything else, you can always port this <a href="http://code.google.com/p/radixtree/" rel="nofollow noreferrer"><strong>java version from Google Code</strong>.</a> </p>
| 9,619
|
<p>When you print from Google Docs (using the "print" link, not File/Print) you end up printing a nicely formated PDF file instead of relying on the print engine of the browser. Same is true for some of the reports in Google Analytics . . . the printed reports as PDF's are beautiful. How do they do that? I can't imagine they use something like Adobe Acrobat to facilitate it but maybe they do. I've seen some expensive HTML to PDF converters online from time to time but have never tired it. Any thoughts?</p>
|
<p>If you are specifically looking at how Google does it. If you look at the <a href="http://docs.google.com/Doc?id=dd8xj6nh_2q9zprkd6" rel="noreferrer" title="I've embedded the image in a document here">PDF Properties</a> page, they use Prince 6.0 (see <a href="http://www.princexml.com/" rel="noreferrer">princexml.com</a>)</p>
<p>There are lots of other PDF generators out there. I've had great success with <a href="http://www.pdflib.com/" rel="noreferrer">PDFlib</a> for tricky jobs.</p>
<p><img src="https://i.stack.imgur.com/NGksE.jpg" alt="alt text"></p>
|
<p>Rendering a PDF is hard, complex problem. However generating them, is not. Simply make up some entities, and generate. It's about same problem domain as generating HTML for webpage vs. displaying (rendering) it.</p>
| 6,998
|
<p>Is there any way, in any language, to hook my program when a user renames a file?</p>
<p>For example:
A user renames a file and presses enter (or clicks away) to confirm the rename action. BEFORE the file is actually renamed, my program "listens" to this event and pops up a message saying "Are you sure you want to rename C:\test\file.txt to C:\test\test.txt?".</p>
<p>I'm thinking/hoping this is possible with C++, C# or .NET.. But I don't have any clue where to look for.</p>
|
<p>You can probably solve this by using the <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="noreferrer">FileSystemWatcher class</a> in .NET framework.</p>
<p>From the class remarks:</p>
<blockquote>
<p>You can watch for renaming, deletion,
or creation of files or directories.
For example, to watch for renaming of
text files, set the Filter property to
"*.txt" and call the WaitForChanged
method with a Renamed specified for
its parameter.</p>
</blockquote>
|
<p>My guess is that this is <em>not</em> possible, I did find <a href="http://msdn.microsoft.com/en-us/library/bb776794(VS.85).aspx" rel="nofollow noreferrer">this</a> which is for monitoring operations (including rename) on a folder, but there does not appear to be a similar method for files.</p>
<p>@Richard, FileSystemWatcher is good if you only need to monitor changes, but he needs to interrupt them which it cannot do.</p>
| 4,430
|
<p>I re-read my question and realized I made a confusing one, so I am rewording a LOT.</p>
<p>So the software I use is Craftware. When it comes to the first layer I have it set to .25mm, with the following layers being whatever I specify otherwise. And because of this there shouldn't be a difference with the first layer even though I choose different layer heights based on the project. But for some reason it is not the case. </p>
<p>When printing .2mm layer height everything works great. The print adheres amazing, the nozzle is at a really good height. Everything simply works. </p>
<p>When printing .1mm the first layer does not stick. A lot less plastic is coming out the nozzle. And it is a disaster. Have tried increasing the amount of flow a bit, but didn't help (I might need to raise it a lot more)</p>
<p>So I don't understand what is going wrong. The first layer is supposed to be set at .25mm no matter what the layer height is otherwise. What do I need to do or look at? </p>
|
<p>You likely need to re-calibrate the Z-height of your nozzle. The reason that a lot less plastic is coming out of the nozzle at 0.1mm is that the actual gap is likely smaller than 0.1mm. This makes the print bed act essentially like a partial "lid" on the nozzle which occludes the outflow of molten plastic. </p>
<p>Simplify3D has information on their website regarding the issue which can be found here: <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#not-extruding-at-start-of-print" rel="nofollow noreferrer">https://www.simplify3d.com/support/print-quality-troubleshooting/#not-extruding-at-start-of-print</a>. Hope this helps!</p>
|
<p>You have asked several questions here. </p>
<p>"why is first layer set to 0.25" -- check the gcode file, opening it in a text editor, to see what layer values are specified. </p>
<p>"looks like under-extrude" -- please show a picture. If it's purely that the print failing to adhere, you may need to adjust the Z-zero point slightly. Or perhaps When you printed at 0.2mm, for whatever reason the transverse stress on the base layer is less than when printing at 0.1 mm (e.g., linear speed adjustments needed).<br>
Is the second layer somehow not adhering to the first layer? It is possible that the linear speed setting for the first layer is too high and that should be adjusted. Or perhaps the z-height for the second layer is inconsistent with a 0.1mm layer setting, so check the gcode there too. </p>
<p>In general, adherence problems can be dealt with by adding a raft or brim. See if that suffices.</p>
| 852
|
<p>I'm looking to hear others experiences with SVG + Javascript Frameworks. </p>
<p>Things that I'd like the framework to handle - DOM creation, event handling and minimal size.</p>
<p>Jquery SVG plugin - <a href="http://keith-wood.name/svg.html" rel="noreferrer">http://keith-wood.name/svg.html</a> seems to be the only one I can find. </p>
|
<p><a href="http://dmitrybaranovskiy.github.io/raphael/" rel="nofollow noreferrer">Raphael</a> is a javascript framework for manipulating vector graphics, either with SVG or VML, depending on what the browser supports.</p>
|
<p>I haven't used it yet, but i bookmarked <a href="http://www.liquidx.net/plotkit/" rel="nofollow noreferrer">PlotKit</a> some time ago because it's a javascript framework that generates svg</p>
| 8,861
|
<p>I have recently started printing with Polymaker's PolyMax PETG on my Ender 3 v2. I have not been able to get the layer adhesion anywhere near as strong as it should be. I would guess it is around 20-25 % of the strength in the XY direction. The parts snap easily along the layer lines under loads that PLA and nylon hold up to just fine.</p>
<p>Print settings:</p>
<ul>
<li>0.15 mm layers @ 35-20 mm/s</li>
<li>Hotend temp 245 °C</li>
<li>4 mm retraction @ 40 mm/s</li>
<li>combing on</li>
<li>jerk control on</li>
<li>no cooling</li>
</ul>
<p>I made sure to use a nickel-plated brass 0.4 mm nozzle. I have calibrated my E-steps and tried printing in an enclosure, but nothing seems to help with layer adhesion. I have made sure there is no debris getting on the filament as it comes out of the drybox and even tried taping around the heater block so there is absolutely no part cooling.</p>
<p>Any ideas as to what I could be doing wrong?</p>
|
<p>I had this problem with my Ender 3 until I changed to a different extruder and now PETG never has adhesion problems. Even 100 % fan is fine at 245 °C. I think the stock hobbed gear just slips on PETG really badly, giving underextrusion. Go slow, increase the flow to compensate, and possibly increase temperature slightly more. Or buy a decent extruder.</p>
|
<p>The layer adhesion with Polymax PETG at 260 °C was great so I didn't go any higher.</p>
| 1,961
|
<p>The only <em>nice</em> way I've found is:</p>
<pre><code>import sys
import os
try:
os.kill(int(sys.argv[1]), 0)
print "Running"
except:
print "Not running"
</code></pre>
<p>(<a href="http://www.unix.com/unix-advanced-expert-users/79267-trick-bash-scripters-check-if-process-running.html" rel="noreferrer">Source</a>)<br>
But is this reliable? Does it work with every process and every distribution?</p>
|
<p>Mark's answer is the way to go, after all, that's why the /proc file system is there. For something a little more copy/pasteable:</p>
<pre><code> >>> import os.path
>>> os.path.exists("/proc/0")
False
>>> os.path.exists("/proc/12")
True
</code></pre>
|
<p>Sligtly modified version of ShaChris23 script. Checks if proc_name value is found within process args string (for example Python script executed with python ):</p>
<pre><code>def process_exists(proc_name):
ps = subprocess.Popen("ps ax -o pid= -o args= ", shell=True, stdout=subprocess.PIPE)
ps_pid = ps.pid
output = ps.stdout.read()
ps.stdout.close()
ps.wait()
for line in output.split("\n"):
res = re.findall("(\d+) (.*)", line)
if res:
pid = int(res[0][0])
if proc_name in res[0][1] and pid != os.getpid() and pid != ps_pid:
return True
return False
</code></pre>
| 5,898
|
<p>Is anyone working on or know if there exists a SQL 2k8 Dialect for NHibernate? </p>
|
<p>I am assuming the plugin here is the NPAPI plugin (e.g. Flash). Under X11, QtWebKit search several common directories for the plugin. For the complete list, see <a href="http://doc.qt.digia.com/4.5/qtwebkit.html#netscape-plugin-support" rel="nofollow noreferrer">the documentation on Netscape plugin support</a>.</p>
<p>In addition to that, you must enable plugin support via QWebSettings::. See the documentation for <a href="http://doc.qt.digia.com/4.5/qwebsettings.html#WebAttribute-enum" rel="nofollow noreferrer">WebAttribute::::PluginsEnabled</a>, either globally or for your particular QWebView only.</p>
|
<p>Have you tried putting in the <em>standard library directories</em>? It should be picked up by the <strong>linker</strong> if it's in one of those directories.</p>
<p>For example:</p>
<pre><code>/lib/
/usr/lib/
/usr/share/lib/
/usr/local/lib/
</code></pre>
| 3,940
|
<p>I have a piece of server-ish software written in Java to run on Windows and OS X. (It is not running on a server, but just a normal user's PC - something like a torrent client.) I would like the software to signal to the OS to keep the machine awake (prevent it from going into sleep mode) while it is active.</p>
<p>Of course I don't expect there to be a cross platform solution, but I would love to have some very minimal C programs/scripts that my app can spawn to inform the OS to stay awake.</p>
<p>Any ideas?</p>
|
<p>I use this code to keep my workstation from locking. It's currently only set to move the mouse once every minute, you could easily adjust it though.</p>
<p>It's a hack, not an elegant solution.</p>
<pre><code>import java.awt.*;
import java.util.*;
public class Hal{
public static void main(String[] args) throws Exception{
Robot hal = new Robot();
Random random = new Random();
while(true){
hal.delay(1000 * 60);
int x = random.nextInt() % 640;
int y = random.nextInt() % 480;
hal.mouseMove(x,y);
}
}
}
</code></pre>
|
<p>One simple way which i use to avoid "Windows desktop Auto lock" is "Switch On/Off NumLock" every 6 seconds.</p>
<p>Here a Java Program to Switch ON/OFF NumLock.</p>
<pre><code>import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class NumLock extends Thread {
public void run() {
try {
boolean flag = true;
do {
flag = !flag;
Thread.sleep(6000);
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent. VK_NUM_LOCK, flag);
}
while(true);
}
catch(Exception e) {}
}
public static void main(String[] args) throws Exception {
new NumLock().start();
}
}
</code></pre>
<p>Run this Java program in a separate command prompt; :-)</p>
| 7,621
|
<p>I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure.</p>
<p>I want to add them in that format to a different directory in an ASP.NET web application I am working on; while retaining the same structure. So, I copied the folder into the target location of my project and I tried to “add existing item” only to lose the previous folder hierarchy.</p>
<p>Usually I have re-created the directories by hand, copied across on a one-to-one basis, and then added existing items. There are simply too many directories/items in this case.</p>
<p>So how do you add existing directories and files in Visual Studio 2008?</p>
|
<p>Drag the files / folders from Windows Explorer into the Solution Explorer. It will add them all. Note this doesn't work if Visual Studio is in Administrator Mode, because Windows Explorer is a User Mode process.</p>
|
<p>It's annoying that Visual Studio doesn't support this natively, but CMake could generate the Visual Studio project as a work around.</p>
<p>Other than that, just use Qt Creator. It can then export a Visual Studio project.</p>
| 8,218
|
<p>It's been mentioned to me that I'll be the sole developer behind a large new system. Among other things I'll be designing a UI and database schema.</p>
<p>I'm sure I'll receive some guidance, but I'd like to be able to knock their socks off. What can I do in the meantime to prepare, and what will I need to keep in mind when I sit down at my computer with the spec?</p>
<p>A few things to keep in mind: I'm a college student at my first real programming job. I'll be using Java. We already have SCM set up with automated testing, etc...so tools are not an issue.</p>
|
<p>Do you know much about OOP? If so, look into Spring and Hibernate to keep your implementation clean and <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/01/08/Orthogonal-Code.aspx" rel="noreferrer">orthogonal</a>. If you get that, you should find TDD a good way to keep your design compact and lean, especially since you have "automated testing" up and running.</p>
<p>UPDATE:
Looking at the first slew of answers, I couldn't disagree more. Particularly in the Java space, you should find plenty of mentors/resources on working out your application with Objects, <strong>not a database-centric approach</strong>. Database design is typically the first step for Microsoft folks (which I do daily, but am in a recovery program, er, Alt.Net). If you keep the focus on what you need to deliver to a customer and let your ORM figure out how to persist your objects, your design should be better.</p>
|
<p>Split the big system to smaller pieces.
And don't think that it's so complex, because it usually isn't. By thinking too complex it just ruins your thoughts and eventually the design. Some point you just realize that you could do the same thing easier, and then you redesign it.</p>
<p>Atleast this has been my major mistake in designing.</p>
<p>Keep it simple!</p>
| 3,647
|
<p>Is it possible to re-use ABS or PLA filament material from printed parts?</p>
<p>If so, what is the techniques to reform it?</p>
|
<p>There are a few options.</p>
<ol>
<li>Machines are available which grind the used plastic into fine pieces, melt it down, and extrude it as filament to be reused. <a href="http://www.filabot.com/">Filabot</a> is perhaps the most well known.</li>
<li>Depending on where you live the local recycling programs may accept PLA or ABS. They will then shred it and melt it down for reuse.</li>
<li>PLA is bio-degradable so you can put it in the compost.</li>
<li>I put scrap ABS in acetone which results in a slurry which can be used as a glue to attach ABS parts, fix cracks, and hold parts to the bed.</li>
</ol>
|
<p>If you're more interested in the recycling and reuse aspect than the re-print aspect, you could melt all the scrap filament onto a cookie sheet or into a bar (like in a bread ban). You could then manually work the material, or use a CNC machine to carve out your next thing.</p>
<p>This <a href="https://www.youtube.com/watch?v=kUR6_bQLU-E" rel="nofollow noreferrer">Youtube video</a> refers to HDPE, but the same concept will apply to other thermoplastics:</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/kUR6_bQLU-E?start=0"></iframe>
</div></div></p>
<p>This <a href="https://www.youtube.com/watch?v=G-HWrDMr0ks" rel="nofollow noreferrer">Youtube video</a> uses a cookie sheet and failed prints:</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/G-HWrDMr0ks?start=0"></iframe>
</div></div></p>
| 101
|
<p>I need to validate an XML string (and not a file)
against a DTD description file. </p>
<p>How can that be done in <code>python</code>?</p>
|
<p>Another good option is <a href="http://lxml.de/validation.html" rel="noreferrer">lxml's validation</a> which I find quite pleasant to use.</p>
<p>A simple example taken from the lxml site:</p>
<pre><code>from StringIO import StringIO
from lxml import etree
dtd = etree.DTD(StringIO("""<!ELEMENT foo EMPTY>"""))
root = etree.XML("<foo/>")
print(dtd.validate(root))
# True
root = etree.XML("<foo>bar</foo>")
print(dtd.validate(root))
# False
print(dtd.error_log.filter_from_errors())
# <string>:1:0:ERROR:VALID:DTD_NOT_EMPTY: Element foo was declared EMPTY this one has content
</code></pre>
|
<p>from the examples directory in the libxml2 python bindings:</p>
<pre><code>#!/usr/bin/python -u
import libxml2
import sys
# Memory debug specific
libxml2.debugMemory(1)
dtd="""<!ELEMENT foo EMPTY>"""
instance="""<?xml version="1.0"?>
<foo></foo>"""
dtd = libxml2.parseDTD(None, 'test.dtd')
ctxt = libxml2.newValidCtxt()
doc = libxml2.parseDoc(instance)
ret = doc.validateDtd(ctxt, dtd)
if ret != 1:
print "error doing DTD validation"
sys.exit(1)
doc.freeDoc()
dtd.freeDtd()
del dtd
del ctxt
</code></pre>
| 3,661
|
<p>I need to index up to 500,000 entries for fastest read. The index needs to be rebuilt periodically , on disk. I am trying to decide between a simple file like a hash on disk or a single table in an embedded database. I have no need for an RDBMS engine. </p>
|
<p>I'm assuming you're referring to indexing tables on a relational DBMS (like mySql, Oracle, or Postgres).</p>
<p>Indexes are secondary data stores that keep a record of a subset of fields for a table in a specific order.</p>
<p>If you create an index, any query that includes the subset of fields that are indexed in its WHERE clause will perform faster.</p>
<p>However, adding indexes will reduce INSERT performance.</p>
<p>In general, indexes don't need to be rebuilt unless they become corrupted. They should be maintained on the fly by your DBMS.</p>
|
<p>This is what <a href="http://en.wikipedia.org/wiki/MapReduce" rel="nofollow noreferrer">MapReduce</a> was invented for. <a href="http://hadoop.apache.org/" rel="nofollow noreferrer">Hadoop</a> is a cool java implementation. </p>
| 9,370
|
<p>I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather large (25 projects in the solution), I'd like to try VS 2008, since its theoretically faster with larger projects. </p>
<p>Before doing such thing, i'd like to know if what I've read is true: can I use VS2008 in ".net 2.0" mode? I don't want my customers to install .net 3.0 or .3.5, I just want to install VS2008, open my solution and start working from there. </p>
<p>Is this possible?</p>
<p>P.D.: the solution is a c# Window Forms project.</p>
|
<p>yes, vs2008 can "<a href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx" rel="nofollow noreferrer">target</a>" a framework, but i think by default, if converting from vs2005 - vs2008 it just keeps it at framework 2.0</p>
|
<p>Yes, the feature that enables this is Visual Studio 2008 is called multi-targeting. See <a href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx" rel="nofollow noreferrer">this link</a> for more information. To use it you simply open the Properties for your Project, and select the Target Framework you want from the drop-down list on that page.</p>
| 5,033
|
<p>I was working on a model today and I need to make the black surface into a normal surface so that the ship's cockpit is solid. I am unable to select the black surface. I tried using the flip normals feature, but I was still unable to select it. Any advice on how to make it into a solid is greatly appreciated. Thanks. :)</p>
<p>Edit: Here's the link to the file
<a href="https://drive.google.com/file/d/1mbTdeeZqhNJx-WlXNqF8mD8QYDSI3Vh_/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1mbTdeeZqhNJx-WlXNqF8mD8QYDSI3Vh_/view?usp=sharing</a></p>
<p><a href="https://i.stack.imgur.com/bInCO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bInCO.png" alt="The weired surface in meshmixer"></a></p>
|
<p>The foundation of any 3D printer is the controller and the firmware. Many devices are based on Arduino type controllers, with stepper motor driver boards either integrated or added as a plug-in component.</p>
<p>Some manufacturers will use in-house or outside resources and develop their own boards and firmware.</p>
<p>You can search for 3D printer controllers and get a pretty comprehensive list of the various devices available for purchase. Smoothieboard is one device, Raspberry Pi and Arduino as noted above, and others.</p>
<p>There can be found varying "flavors" of firmware to load onto these controllers as well.</p>
<p>The field is exhaustive.</p>
<p>To address your focus regarding the printing aspect, that's one stepper motor per print head/nozzle (usually) and involves calibrating the amount of filament dispensed from the nozzle per unit steps, or more easily understood, amount of steps per unit of filament movement. My stepper motor for the extruder has a planetary gear and moves 100 mm of filament for about 5000 steps.</p>
<p>All of the parameters you've noted are integrated with the firmware. Motor calibration requires movement per step or steps per millimeter to be entered, unless you purchase a turnkey system with the values loaded.</p>
<p>You can adjust many of the parameters from the slicing software, but it's more practical to determine the calibration settings, enter that information into your slicer and proceed with model management.</p>
<p>Look into instructables for others' build projects to see what they've accomplished and the steps involved in such a build. This can give you a starting point for your efforts.</p>
|
<p>this is an extension to fred_dot_u answer.
As I am in the process of building my own printer, I decided to use RAMPS Arduino shield for electronics and Marlin firmware + Arduino mega2560 as a logic controller. </p>
<p>As above are battle-tested, I don't need to discover wheel again, but rather focus on the mechanics.
The RAMPS mainboard will provide you with the ability to connect 5 steppers and 3 PWM regulated devices (that can be heat-bed, nozzle and fan or combination) and there is still possibility to connect more as a bunch of IO pins are ready to alocate. </p>
<p>MarlinFirmware is avalible on github, so you can download it and then provide all mechanical parameters that are needed to properly drive your printer -so that is:</p>
<ol>
<li>Mainboard type</li>
<li>type coreXY, XZ ....</li>
<li>bed size (x,y)</li>
<li>gantry size (z)</li>
<li>steps / mm for steppers</li>
<li>thermal protection parameters </li>
<li>LCD display (if in use)</li>
</ol>
<p>The main benefit of using Marlin for me is that printer configuration is extremely customizable.</p>
| 886
|
<p>I'm newbie at this stackexchange and I have a "FlashForge Finder"; lately there are many problems with the horizontal surfaces quality (Bottom and Top at the same time).</p>
<p>As some issue guides suggests, I changed: number of solid layers, % of filling and extrusion multiplier; I use "Flashprint", so some concepts must be translated from Cura in the options menu.</p>
<p>P.S: All filaments are PLA.</p>
<p>Without any change:
<a href="https://i.stack.imgur.com/kN9K4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kN9K4.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/XWw31.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWw31.jpg" alt="enter image description here"></a></p>
<p>After all changes (the "best")
<a href="https://i.stack.imgur.com/nbE13.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nbE13.jpg" alt="enter image description here"></a></p>
<p>My settings for last black disk:
<a href="https://i.stack.imgur.com/G2nkp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G2nkp.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/2GzNN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2GzNN.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/Qw0yc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qw0yc.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/psACU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/psACU.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/F7UOy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F7UOy.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/PcdnR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PcdnR.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/XbN1e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XbN1e.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/9pSYX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9pSYX.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/EyYqp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EyYqp.png" alt="enter image description here"></a></p>
|
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the nozzle. You should do this for all 4 corners. Be careful though, you dont want the bed too far away from the nozzle, or problems maybe arise with the print not sticking to the bed.</p>
<p>Hope this helps, Luke.</p>
|
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the nozzle. You should do this for all 4 corners. Be careful though, you dont want the bed too far away from the nozzle, or problems maybe arise with the print not sticking to the bed.</p>
<p>Hope this helps, Luke.</p>
| 1,683
|
<p>So apparently the wiring in my home is... questionable. Very rarely, plugging or unplugging things will cause a power dip. This is almost always the result of turning on a fan or something, is only for a moment before coming back, but its long enough to cause my printer to reset. I want to add a backup battery supply using either the 12v cell pulled out of an old apc ups (before the suggestion of just plugging it into that... I did, somethings fried in it and it will ALSO power cycle everything connected to it every few hours) or an old car battery. Is there any reason I shouldn't use this circuit, which was originally intended for amateur radio equipment? <a href="https://i.stack.imgur.com/Jd7Sp.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jd7Sp.gif" alt="battery backup circuit"></a></p>
<p>Also is there anything else i should be considering?</p>
|
<p>There are a couple of points to consider with this question. First, you will need to make sure the PSU is correctly adjusted to the float charge voltage of the 12V battery. SLA should be safe to float charge, but over voltage will damage it over time.</p>
<p>One alternative solution (since powering the heaters will limit your run time) is to detect power failure, cut the heaters immediately, and save state to EEPROM in the firmware. This is the approach taken in the latest Prusa printers, and is a bit more complex, but might turn out to be more reliable.</p>
<p>If the problem you are solving really is brown-outs, then a simpler solution might be to isolate the high current and control sides of the circuit. The MCU will be run from a regulated 5V or 3V3, so a large capacitor (with diode isolation) on that regulator's input would do the trick.</p>
|
<p>This circuit is correct as it does the job (provides a charge and switch-over when needed). </p>
<p>The only drawback could be that you need to ensure that the battery is sealed as during the charging process the electlorit will slowly evaporate and decrease battery capacity.</p>
<p>I am personally using a UPC as that gives me more options to power-up more stuff including 240V heater and it has a self-test built-in (it is APC1500VA).</p>
| 1,008
|
<p>What’s the best way to capitalize the first letter of each word in a string in SQL Server.</p>
|
<p>From <a href="http://www.sql-server-helper.com/functions/initcap.aspx" rel="noreferrer">http://www.sql-server-helper.com/functions/initcap.aspx</a></p>
<pre><code>CREATE FUNCTION [dbo].[InitCap] ( @InputString varchar(4000) )
RETURNS VARCHAR(4000)
AS
BEGIN
DECLARE @Index INT
DECLARE @Char CHAR(1)
DECLARE @PrevChar CHAR(1)
DECLARE @OutputString VARCHAR(255)
SET @OutputString = LOWER(@InputString)
SET @Index = 1
WHILE @Index <= LEN(@InputString)
BEGIN
SET @Char = SUBSTRING(@InputString, @Index, 1)
SET @PrevChar = CASE WHEN @Index = 1 THEN ' '
ELSE SUBSTRING(@InputString, @Index - 1, 1)
END
IF @PrevChar IN (' ', ';', ':', '!', '?', ',', '.', '_', '-', '/', '&', '''', '(')
BEGIN
IF @PrevChar != '''' OR UPPER(@Char) != 'S'
SET @OutputString = STUFF(@OutputString, @Index, 1, UPPER(@Char))
END
SET @Index = @Index + 1
END
RETURN @OutputString
END
GO
</code></pre>
<p>There is a simpler/smaller one here (but doesn't work if any row doesn't have spaces, "Invalid length parameter passed to the RIGHT function."): </p>
<p><a href="http://www.devx.com/tips/Tip/17608" rel="noreferrer">http://www.devx.com/tips/Tip/17608</a></p>
|
<pre><code>IF OBJECT_ID ('dbo.fnCapitalizeFirstLetterAndChangeDelimiter') IS NOT NULL
DROP FUNCTION dbo.fnCapitalizeFirstLetterAndChangeDelimiter
GO
CREATE FUNCTION [dbo].[fnCapitalizeFirstLetterAndChangeDelimiter] (@string NVARCHAR(MAX), @delimiter NCHAR(1), @new_delimeter NCHAR(1))
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @result NVARCHAR(MAX)
SELECT @result = '';
IF (LEN(@string) > 0)
DECLARE @curr INT
DECLARE @next INT
BEGIN
SELECT @curr = 1
SELECT @next = CHARINDEX(@delimiter, @string)
WHILE (LEN(@string) > 0)
BEGIN
SELECT @result =
@result +
CASE WHEN LEN(@result) > 0 THEN @new_delimeter ELSE '' END +
UPPER(SUBSTRING(@string, @curr, 1)) +
CASE
WHEN @next <> 0
THEN LOWER(SUBSTRING(@string, @curr+1, @next-2))
ELSE LOWER(SUBSTRING(@string, @curr+1, LEN(@string)-@curr))
END
IF (@next > 0)
BEGIN
SELECT @string = SUBSTRING(@string, @next+1, LEN(@string)-@next)
SELECT @next = CHARINDEX(@delimiter, @string)
END
ELSE
SELECT @string = ''
END
END
RETURN @result
END
GO
</code></pre>
| 7,875
|
<p>I'm trying to consume a SharePoint webservice from ColdFusion via cfinvoke ('cause I don't want to deal with (read: parse) the SOAP response itself).</p>
<p>The SOAP response includes a byte-order-mark character (BOM), which produces the following exception in CF:</p>
<pre><code>"Cannot perform web service invocation GetList.
The fault returned when invoking the web service operation is:
'AxisFault
faultCode: {http://www.w3.org/2003/05/soap-envelope}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Content is not allowed in prolog."
</code></pre>
<p>The standard for UTF-8 encoding optionally includes the BOM character (<a href="http://unicode.org/faq/utf_bom.html#29" rel="nofollow noreferrer">http://unicode.org/faq/utf_bom.html#29</a>). Microsoft almost universally includes the BOM character with UTF-8 encoded streams . From what I can tell there’s no way to change that in IIS. The XML parser that JRun (ColdFusion) uses by default doesn’t handle the BOM character for UTF-8 encoded XML streams. So, it appears that the way to fix this is to change the XML parser used by JRun (<a href="http://www.bpurcell.org/blog/index.cfm?mode=entry&entry=942" rel="nofollow noreferrer">http://www.bpurcell.org/blog/index.cfm?mode=entry&entry=942</a>).</p>
<p>Adobe says that it doesn't handle the BOM character (see comments from anoynomous and halL on May 2nd and 5th).<br />
<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_g-h_09.html#comments" rel="nofollow noreferrer">http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_g-h_09.html#comments</a></p>
|
<p>I'm going to say that the answer to your question (is it possible?) is no. I don't know that definitively, but the poster who commented just above halL (<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html#comments" rel="nofollow noreferrer">in the comments on this page</a>) gave a work-around for the problem -- so I assume it is possible to deal with when parsing manually.</p>
<p>You say that you're using CFInvoke because you don't want to deal with the soap response yourself. It looks like you don't have any choice.</p>
|
<p>It sounds like ColdFusion is using Apache Axis under the covers.</p>
<p>This doesn't apply exactly to your solution, but I've had to deal with this issue once before when consuming a .NET web service with Apache Axis/Java. The only solution I was able to find (since the owner of the web service was unwilling to change anything on his end) was to write a Handler class that Axis would plug into the pipeline which would delete the BOM from the message if it existed. </p>
<p>So perhaps it's possible to configure Axis through ColdFusion? If so <a href="http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration" rel="nofollow noreferrer">you can add additional Handlers to the message handling flow</a>.</p>
| 8,092
|
<p>So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches, I might get results numbering in the thousands.</p>
<p>Requirements:</p>
<ol>
<li>I want to display between 10-20 pictures but I want to randomize the photos each time. </li>
<li>I don't want to hit Flickr every time a page request is made. </li>
<li>Not every Flickr photo with the same tags as my item will be relevant.</li>
</ol>
<p>How should I store that number of results and how would I determine which ones are relevant?</p>
|
<p>Not Exactly a sexy piece of code but their doesn't seem to be an automated way to find the row without just looping the table.</p>
<pre><code> DataRowView newRowView = null;
foreach (DataRowView tempRowView in myDataTable.DefaultView)
{
if (tempRowView.Row == rowToMatch)
newRowView = tempRowView;
}
if (newRow != null)
UseNewRowView(newRowView);
else
HandleRowNotFound();
</code></pre>
|
<pre><code>row.Table.DefaultView[row.Table.Rows.IndexOf(row)]
</code></pre>
<p>This is an okay answer. But if you find yourself in this situation, you should consider learning more about DataViews and how they are used, then refactor your code to be view-centric rather than table-centric.</p>
| 5,241
|
<p>Given the key for some registry value (e.g. HKEY_LOCAL_MACHINE\blah\blah\blah\foo) how can I:</p>
<ol>
<li>Safely determine that such a key exists.</li>
<li>Programmatically (i.e. with code) get its value.</li>
</ol>
<p>I have absolutely no intention of writing anything back to the registry (for the duration of my career if I can help it). So we can skip the lecture about every molecule in my body exploding at the speed of light if I write to the registry incorrectly. </p>
<p>Prefer answers in C++, but mostly just need to know what the special Windows API incantation to get at the value is.</p>
|
<p><strong>Here is some pseudo-code to retrieve the following:</strong></p>
<ol>
<li>If a registry key exists</li>
<li>What the default value is for that registry key</li>
<li>What a string value is</li>
<li>What a DWORD value is</li>
</ol>
<p><strong>Example code:</strong></p>
<p>Include the library dependency: Advapi32.lib</p>
<pre><code>HKEY hKey;
LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Perl", 0, KEY_READ, &hKey);
bool bExistsAndSuccess (lRes == ERROR_SUCCESS);
bool bDoesNotExistsSpecifically (lRes == ERROR_FILE_NOT_FOUND);
std::wstring strValueOfBinDir;
std::wstring strKeyDefaultValue;
GetStringRegKey(hKey, L"BinDir", strValueOfBinDir, L"bad");
GetStringRegKey(hKey, L"", strKeyDefaultValue, L"bad");
LONG GetDWORDRegKey(HKEY hKey, const std::wstring &strValueName, DWORD &nValue, DWORD nDefaultValue)
{
nValue = nDefaultValue;
DWORD dwBufferSize(sizeof(DWORD));
DWORD nResult(0);
LONG nError = ::RegQueryValueExW(hKey,
strValueName.c_str(),
0,
NULL,
reinterpret_cast<LPBYTE>(&nResult),
&dwBufferSize);
if (ERROR_SUCCESS == nError)
{
nValue = nResult;
}
return nError;
}
LONG GetBoolRegKey(HKEY hKey, const std::wstring &strValueName, bool &bValue, bool bDefaultValue)
{
DWORD nDefValue((bDefaultValue) ? 1 : 0);
DWORD nResult(nDefValue);
LONG nError = GetDWORDRegKey(hKey, strValueName.c_str(), nResult, nDefValue);
if (ERROR_SUCCESS == nError)
{
bValue = (nResult != 0) ? true : false;
}
return nError;
}
LONG GetStringRegKey(HKEY hKey, const std::wstring &strValueName, std::wstring &strValue, const std::wstring &strDefaultValue)
{
strValue = strDefaultValue;
WCHAR szBuffer[512];
DWORD dwBufferSize = sizeof(szBuffer);
ULONG nError;
nError = RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, (LPBYTE)szBuffer, &dwBufferSize);
if (ERROR_SUCCESS == nError)
{
strValue = szBuffer;
}
return nError;
}
</code></pre>
|
<pre><code>#include <windows.h>
#include <map>
#include <string>
#include <stdio.h>
#include <string.h>
#include <tr1/stdint.h>
using namespace std;
void printerr(DWORD dwerror) {
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwerror,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
if (isOut) {
fprintf(fout, "%s\n", lpMsgBuf);
} else {
printf("%s\n", lpMsgBuf);
}
// Free the buffer.
LocalFree(lpMsgBuf);
}
bool regreadSZ(string& hkey, string& subkey, string& value, string& returnvalue, string& regValueType) {
char s[128000];
map<string,HKEY> keys;
keys["HKEY_CLASSES_ROOT"]=HKEY_CLASSES_ROOT;
keys["HKEY_CURRENT_CONFIG"]=HKEY_CURRENT_CONFIG; //DID NOT SURVIVE?
keys["HKEY_CURRENT_USER"]=HKEY_CURRENT_USER;
keys["HKEY_LOCAL_MACHINE"]=HKEY_LOCAL_MACHINE;
keys["HKEY_USERS"]=HKEY_USERS;
HKEY mykey;
map<string,DWORD> valuetypes;
valuetypes["REG_SZ"]=REG_SZ;
valuetypes["REG_EXPAND_SZ"]=REG_EXPAND_SZ;
valuetypes["REG_MULTI_SZ"]=REG_MULTI_SZ; //probably can't use this.
LONG retval=RegOpenKeyEx(
keys[hkey], // handle to open key
subkey.c_str(), // subkey name
0, // reserved
KEY_READ, // security access mask
&mykey // handle to open key
);
if (ERROR_SUCCESS != retval) {printerr(retval); return false;}
DWORD slen=128000;
DWORD valuetype = valuetypes[regValueType];
retval=RegQueryValueEx(
mykey, // handle to key
value.c_str(), // value name
NULL, // reserved
(LPDWORD) &valuetype, // type buffer
(LPBYTE)s, // data buffer
(LPDWORD) &slen // size of data buffer
);
switch(retval) {
case ERROR_SUCCESS:
//if (isOut) {
// fprintf(fout,"RegQueryValueEx():ERROR_SUCCESS:succeeded.\n");
//} else {
// printf("RegQueryValueEx():ERROR_SUCCESS:succeeded.\n");
//}
break;
case ERROR_MORE_DATA:
//what do I do now? data buffer is too small.
if (isOut) {
fprintf(fout,"RegQueryValueEx():ERROR_MORE_DATA: need bigger buffer.\n");
} else {
printf("RegQueryValueEx():ERROR_MORE_DATA: need bigger buffer.\n");
}
return false;
case ERROR_FILE_NOT_FOUND:
if (isOut) {
fprintf(fout,"RegQueryValueEx():ERROR_FILE_NOT_FOUND: registry value does not exist.\n");
} else {
printf("RegQueryValueEx():ERROR_FILE_NOT_FOUND: registry value does not exist.\n");
}
return false;
default:
if (isOut) {
fprintf(fout,"RegQueryValueEx():unknown error type 0x%lx.\n", retval);
} else {
printf("RegQueryValueEx():unknown error type 0x%lx.\n", retval);
}
return false;
}
retval=RegCloseKey(mykey);
if (ERROR_SUCCESS != retval) {printerr(retval); return false;}
returnvalue = s;
return true;
}
</code></pre>
| 5,422
|
<p>Apparantly when users right-click in our WPF application, and they use the Windows Classic theme, the default ContextMenu of the TextBox (which contains Copy, Cut and Paste) has a black background.</p>
<p>I know this works well:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox ContextMenu="{x:Null}"/>
</Page>
</code></pre>
<p>But this doesn't work:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
<Setter Property="ContextMenu" Value="{x:Null}"/>
</Style>
</Page.Resources>
<TextBox/>
</Page>
</code></pre>
<p>Does anyone know how to style or disable the default ContextMenu for all TextBoxes in WPF?</p>
|
<p>To style ContextMenu's for all TextBoxes, I would do something like the following:</p>
<p>First, in the resources section, add a ContextMenu which you plan to use as your standard ContextMenu in a textbox.<br /> e.g.</p>
<pre><code><ContextMenu x:Key="TextBoxContextMenu" Background="White">
<MenuItem Command="ApplicationCommands.Copy" />
<MenuItem Command="ApplicationCommands.Cut" />
<MenuItem Command="ApplicationCommands.Paste" />
</ContextMenu>
</code></pre>
<p>Secondly, create a style for your TextBoxes, which uses the context menu resource:</p>
<pre><code><Style TargetType="{x:Type TextBox}">
<Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
</Style>
</code></pre>
<p>Finally, use your text box as normal:</p>
<pre><code><TextBox />
</code></pre>
<p>If instead you want to apply this context menu to only some of your textboxes, do not create the style above, and add the following to your TextBox markup:</p>
<pre><code><TextBox ContextMenu="{StaticResource TextBoxContextMenu}" />
</code></pre>
<p>Hope this helps!</p>
|
<p>Try removing the x:Key attribute from the Style resource, leaving TargetType. I know, you're supposed to have that x:Key for a resource, but if you have it along with your TargetType the Key prevails. </p>
<p>Here's a sample style that I use in a project to skin all tooltips in one of my apps (this is in App.Resources--notice, no Key) </p>
<pre><code> <Style
TargetType="{x:Type ToolTip}">
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type ToolTip}">
<Grid
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}">
<Rectangle
RadiusX="9"
RadiusY="9"
Stroke="LightGray"
StrokeThickness="2">
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop />
<GradientStop
Color="FloralWhite"
Offset="0" />
<GradientStop
Color="Cornsilk"
Offset="2" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<ContentPresenter
Margin="6 4 6 4" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</code></pre>
| 3,102
|
<p>I need to join two binary files with a <code>*.bat</code> script on Windows.</p>
<p>How can I achieve that?</p>
|
<p>Windows <code>type</code> command works similarly to UNIX <code>cat</code>.</p>
<p><strong>Example 1:</strong></p>
<pre><code>type file1 file2 > file3
</code></pre>
<p>is equivalent of:</p>
<pre><code>cat file1 file2 > file3
</code></pre>
<p><strong>Example 2:</strong></p>
<pre><code>type *.vcf > all_in_one.vcf
</code></pre>
<p>This command will merge all the vcards into one.</p>
|
<p>If you have to use a batch script and have python installed here is a <a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29" rel="nofollow noreferrer">polyglot</a> answer in batch and python:</p>
<pre><code>1>2# : ^
'''
@echo off
python "%~nx0" " %~nx1" "%~nx2" "%~nx3"
exit /b
rem ^
'''
import sys
import os
sys.argv = [argv.strip() for argv in sys.argv]
if len(sys.argv) != 4:
sys.exit(1)
_, file_one, file_two, out_file = sys.argv
for file_name in [file_one, file_two]:
if not os.path.isfile(file_name):
print "Can't find: {0}".format(file_name)
sys.exit(1)
if os.path.isfile(out_file):
print "Output file exists and will be overwritten"
with open(out_file, "wb") as out:
with open(file_one, "rb") as f1:
out.write(f1.read())
with open(file_two, "rb") as f2:
out.write(f2.read())
</code></pre>
<p>If saved as join.bat usage would be:</p>
<pre><code>join.bat file_one.bin file_two.bin out_file.bin
</code></pre>
<p>Thanks too <a href="https://stackoverflow.com/a/17468811/1663352">this answer</a> for the inspiration.</p>
| 8,507
|
<p>No, this is not a question about generics.</p>
<p>I have a Factory pattern with several classes with internal constructors (I don't want them being instantiated if not through the factory).</p>
<p>My problem is that <code>CreateInstance</code> fails with a "No parameterless constructor defined for this object" error unless I pass "true" on the non-public parameter.</p>
<p>Example</p>
<pre><code>// Fails
Activator.CreateInstance(type);
// Works
Activator.CreateInstance(type, true);
</code></pre>
<p>I wanted to make the factory generic to make it a little simpler, like this:</p>
<pre><code>public class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return Activator.CreateInstance<T>();
}
}
</code></pre>
<p>However, I was unable to find how to pass that "true" parameter for it to accept non-public constructors (internal).</p>
<p>Did I miss something or it isn't possible?</p>
|
<p>To get around this, couldnt you just alter your usage as such:</p>
<pre><code>public class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return Activator.CreateInstance(typeof(T), true);
}
}
</code></pre>
<p>Your factory method will still be generic, but the call to the activator will not use the generic overload. But you should still achieve the same results.</p>
|
<p>besides Activator.CreateInstance(typeof(T), true) to work, T should have default constructor</p>
| 8,166
|
<p>A question to those who have a 3D printer. Have you ever needed a spare throat or a heater block? Do they ever break? </p>
<p>I just bought some spare parts: heaters, thermistors, nozzles... However, I am not sure if buying throats and heater blocks make any sense.</p>
|
<h1>Short answer</h1>
<p>Yes</p>
<h1>Long answer</h1>
<h2>Heater bocks</h2>
<p>A heater block is destroyed if one of the following happens</p>
<ul>
<li>Threads stripped</li>
<li>Bent or otherwise deformed</li>
<li>stripped grub screw</li>
</ul>
<p>All of these can happen by handling the block with too much force when securing nozzles, thermosensors or heater cartridges.</p>
<h2>Throats</h2>
<p>Throats can be destroyed, especially e3D v6 throats with their neck down on the center can be simply turned and broken in two. Lined throats can be heated too much and the liner destroyed, which not always can be replaced, mandating a spare part. And you can strip the threads.</p>
<p>Another chance to damage the throat is by using very hard material nozzles - stainless steel comes to mind. Such a nozzle would not deform itself like brass when tightened against the throat and might lead to damage to the end of the throat if exchanged several times.</p>
<h2>Conclusion</h2>
<p>If you run several printers or change nozzles regularly for whatever reason, it is a very good idea to have at least a complete set of spare parts on hand to fix problems that might occur during work on the printer. I have a fully assembled spare hotend waiting for its day to shine in case my current one breaks...</p>
|
<p>Parts don't have to break or bent, they may become unusable by other issues as well!</p>
<p>In addition to <a href="/a/12115">the answer of @Trish</a>, if you clog your hotend, or the hotend/heater block/nozzle gets buried deep into solidified filament (see image below), it might be much easier just to replace the parts rather than salvaging the parts (or you can salvage the parts later, in the meantime you'll be up and running).</p>
<p>E.g. recover from <a href="/q/8252">this</a>:</p>
<p><a href="https://i.stack.imgur.com/HYYcU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HYYcU.jpg" alt="enter image description here"></a></p>
| 1,604
|
<p>Is there a Ruby equivalent for Python's "is"? It tests whether two objects are identical (i.e. have the same memory location).</p>
|
<p>Use <code>a.equal? b</code></p>
<p><a href="http://www.ruby-doc.org/core/classes/Object.html" rel="noreferrer">http://www.ruby-doc.org/core/classes/Object.html</a></p>
<blockquote>
<p>Unlike ==, the equal? method should never be overridden by subclasses: it is used to determine object identity (that is, a.equal?(b) iff a is the same object as b). </p>
</blockquote>
|
<p>You could also use <code>__id__</code>. This gives you the objects internal ID number, which is always unique. To check if to objects are the same, try</p>
<blockquote>
<p><code>a.__id__ = b.__id__</code></p>
</blockquote>
<p>This is how Ruby's standard library does it as far as I can tell (see <code>group_by</code> and others).</p>
| 5,617
|
<p>I do not want TortoiseSVN to alert me with sounds - e.g. when it fails to update.</p>
<p>How do I turn off sounds in TortoiseSVN?</p>
|
<p>Right click > TortoiseSVN > Settings > System Sounds..</p>
<p>Scroll down to the bottom.</p>
|
<p>You can do this from the Sounds panel in Control Panel.</p>
| 5,502
|
<p>the <a href="https://www.thingiverse.com/thing:763622" rel="noreferrer">3D Benchy</a> is everywhere. It is one of <strong>the</strong> top test prints if you look away from a simple cube.</p>
<p>But what makes the Benchy a good test print at all? It does have almost no critical dimensions that would be measurable to see if the printer is calibrated correctly!</p>
|
<h2>the 3D Benchy isn't a specific calibration test</h2>
<p>With the Benchy you don't see if your printer is calibrated in any axis, but it is a general use-case test for a model that can show you many of the issues you might face in a normal print. For all intents and purposes, it is more a general Benchmark item than a specific calibration test like a cube, stringing test, or temperature tower, where you go through iterations of a profile to dial in settings and printer properties.</p>
<h2>the 3D Benchy is a Benchmark for printer and settings</h2>
<p>Most of the printing issues that can be seen on a Benchy are related to the print settings, though some are also related to the physical properties.</p>
<h3>Overhangs</h3>
<p>The bow of the Benchy has a shape that is very conducive to seeing how much the printer can handle overhangs due to proper cooling and settings.</p>
<p>The arches in the sides of the cabin, as well as the back window, have a rather challenging overhang pattern (the extension needs to be larger and larger), and the front of the Benchy has a short bridge, which shows if cooling is happening properly.</p>
<p>The upper edge of the hull also is a little overhang, which shows how well small oversteps can be printed.</p>
<h3>Small Diameter</h3>
<p>The funnel of the Benchy is of sufficient small crossection, that with bad settings it can result in printing layers upon one another too fast, which can result in bulging, misinformation, or totally blobing that area.</p>
<h3>Sharp corners</h3>
<p>The front and back corners are rather sharp and can show the effects of ringing on the area next to them due to bad acceleration settings</p>
|
<p>Benchy is cute. That goes a long way in attracting attention.</p>
<p>The benchy is one of the earlier STLs that was freely available to download, dating from April 2015, and was released under the Creative Commons Sharealike licence, which clearly states the requirements and limitations/requirements.</p>
<p>Curiously, a printed Benchy can float in still water, provided no print problems crop up. It will also sit nicely on a shelf, with no risk of rolling off and makes a nice ornament.</p>
<p>Links:<br> <a href="https://en.wikipedia.org/wiki/3DBenchy" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/3DBenchy</a> and one of the earliest download sites <a href="https://www.thingiverse.com/thing:763622" rel="nofollow noreferrer">https://www.thingiverse.com/thing:763622</a></p>
<hr />
<p>I've had my printer for a year now, and have never printed a benchy.</p>
| 2,078
|
<p>I would like to print parts (e.g. jewellery) for use which I don't want to look or feel like a plastic, but metal-like, so briefly people won't see much difference.</p>
<p>Are there any specific type of home-printers that can achieve that? Or it's rather kind of filament that you should use?</p>
|
<p>If you'd like to print on RepRap like <a href="https://en.wikipedia.org/wiki/Fused_deposition_modeling" rel="nofollow noreferrer">FDM printers</a>, you cannot print from metal, but you can use some filament that tries to look like metal. I have good experience with <a href="http://colorfabb.com/bronzefill" rel="nofollow noreferrer">Bronzefill</a>, but there are plenty of others, just Google for <em>metal filament 3d printing</em>. Note that sometimes the parts need to be post-processed with a <em>rock tumbler</em>. There are <a href="https://www.thingiverse.com/tag:rock_tumbler" rel="nofollow noreferrer">several open source DIY tumblers</a> you can build and use.</p>
<p>If you actually want to print from metal, you would need SLS (<a href="https://en.wikipedia.org/wiki/Selective_laser_sintering" rel="nofollow noreferrer">Selective laser sintering</a>) printer, which is much more expensive.</p>
|
<p>There's also an interesting discussion of printing with specially-designed solder alloys, at <a href="http://blog.reprap.org/2011/06/new-approach-to-printing-metals.html" rel="nofollow noreferrer">RepRap: Blog - A new approach to printing metals</a>. </p>
<p>The author settled on 57.5%Sn, 41.3%Bi, 1.2% In, which begins to melt at 130 °C and finishes by about 170 °C. This has much better viscosity after melting, so it doesn't just drip away or bead up, and whose melting point is low enough that it can be applied directly on top of PLA or ABS. </p>
<p>Brass nozzles corrode quickly, however, so another material is needed (anodized Al was an improvement). It sounds difficult but feasible.</p>
| 91
|
<p>I'm tired of adding ten link libraries into my project, or requiring eight of them to use my own. I'd like to take existing libraries like libpng.a, libz.a, libjpeg.a, and combine them into one single .a library. Is that possible? How about combining .lib libraries?</p>
|
<p>You could extract the object files from each library with</p>
<pre class="lang-none prettyprint-override"><code>ar x <library name>
</code></pre>
<p>and then merge them all into a new library with</p>
<pre class="lang-none prettyprint-override"><code>ar cs <new library name> <list each extracted object file>
</code></pre>
|
<p>Combining several third-party libraries into one could create more problems for you—for instance, if two of those libraries define a common symbol which your program doesn't use. Now you've got to extract all (or all-but-one) of the instances of the common symbol before you combine the libraries.</p>
| 3,414
|
<p>When using an aggregate control in some reports you would prefer to see a blank field instead of 0. There does not appear to be a way to do this automatically. Does anyone have a way that this can be done. Note, you want to maintain the '0' value for the field in cases when you export, but you want to show a blank when rendering to PDF or HTML.</p>
|
<p>There are a number of ways to solve this. The two primary are to use either visibility rules or highlights to create conditional formatting. The visibility is particularly attractive since it is easy to only apply the format rules to particular types of output (e.g. HTML).</p>
<p>For this particular case, there are two problems with these approaches. First, I want a general solutions where I don't have to specify the text color. In other words, when the condition is true (value of 0) then I want my text color to match the background color. In that way if someone changes the backgroundColor for the control, the code still works.</p>
<p>The other issue is that in this case I am using dynamic column binding which does not support value lookup.</p>
<p>The solution that I created was to add a JavaScript function called hideMe as shown below. </p>
<pre><code>function hideText (dataControl){
if (dataControl.getValue() == 0) {
var color = dataControl.getStyle().getBackgroundColor();
var parentItem = dataControl.getParent();
do {
if (color == null && parentItem != null) {
color = parentItem.getStyle().getBackgroundColor();
parentItem = parentItem.getParent();
} else {
break;
}
} while (color == null);
dataControl.getStyle().color = color;
}
}
</code></pre>
<p>Once this function has been added to the report (in my case an included javascript file) I just call it from the OnCreate method of the control.</p>
<pre><code>hideText(this);
</code></pre>
<p>This can also be done using Java Event Handlers but this method seems to be easier.</p>
|
<p>Just an FYI, after working with this for a while longer, I have found that it is just easier to use Visibility rules. The one big advantage is that you can easily configure different visibility for different output formats. So for PDF it may be best to use blanks, but for Excel you may want the 0 values.</p>
| 8,079
|
<p>I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some feedback first. Should I go with a Linux box if I use MemCache or a win32 port of MemCache.</p>
|
<p>What about checking out <a href="http://code.msdn.microsoft.com/velocity" rel="nofollow noreferrer">Microsoft Velocity</a>?
Another option if you don't want to start using Microsoft CTP-ware is to check out <a href="http://www.alachisoft.com/ncache/" rel="nofollow noreferrer">Nache</a> which allows distributed cache/session state management</p>
|
<p>Another open source choice other than memcached probably worth looking into is Shared Cache. I haven't played with it. But it says to have c# native implementation.</p>
| 2,614
|
<p>I have somewhat interesting development situation. The client and deployment server are inside a firewall without access to the Subversion server. But the developers are outside the firewall and are able to use the Subversion server. Right now the solution I have worked out is to update my local copy of the code and then pull out the most recently updated files using UnleashIT. </p>
<p>The question is how to get just the updated files out of Subversion so that they can be physically transported through the firewall and put on the deployment server.</p>
<p>I'm not worried about trying to change the firewall setup or trying to figure out an easier way to get to the Subversion server from inside the firewall. I'm just interested in a way to get a partial export from the repository of the most recently changed files.</p>
<p>Are there any other suggestions?</p>
<p>Answer found: In addition to the answer I marked as Answer, I've also found the following here to be able to do this from TortoiseSVN:</p>
<p>from <a href="http://svn.haxx.se/tsvn/archive-2006-08/0051.shtml" rel="nofollow noreferrer">http://svn.haxx.se/tsvn/archive-2006-08/0051.shtml</a></p>
<pre><code>* select the two revisions
* right-click, "compare revisions"
* select all files in the list
* right-click, choose "export to..."
</code></pre>
|
<p>I've found <a href="http://samba.anu.edu.au/rsync/" rel="nofollow noreferrer">rsync</a> extremely useful for synchronizing directory trees across multiple systems. If you have shell access to your server from a development workstation, you can regularly check out code locally and run rsync, which will transfer only the files that have changed to the server.</p>
<p>(This assumes a Unix-like environment on your development workstations. Cygwin will work fine.)</p>
<pre><code>cd deploy
svn update
rsync -a . server:webdir/
</code></pre>
<p>Your question sounds like you don't actually have any direct network access from your development workstations to your server, and what you're really looking for is a way to get Subversion to tell you which files have changed. <strong>svn export</strong> supports an argument to let you check out only the files that changed between particular revisions. From the svn help:</p>
<pre><code> -r [--revision] arg : ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
'{' DATE '}' revision at start of the date
'HEAD' latest in repository
'BASE' base rev of item's working copy
'COMMITTED' last commit at or before BASE
'PREV' revision just before COMMITTED
</code></pre>
<p>You'll need to keep track of what the latest revision you copied to the server. Assuming it's SVN revision xxxx:</p>
<pre><code>svn export -r xxxx:HEAD http://svn/
</code></pre>
<p>Then simply copy the contents of the <em>deploy</em> directory to your server on top of the existing files.</p>
<p>This won't handle deleted files, which may prove problematic in some environments.</p>
|
<p>You don't provide information on what is allowed through the firewall. I'm not familiar with UnleashIT.</p>
<p>I guess you could have a script that exports from SVN to a folder on the SVN server. The script then zips the exported files. You can then transport the ZIP file however you want and extract to the deployment server. </p>
<p>TortoiseSVN supports proxy servers so you could use one of those from the client's side?</p>
| 6,367
|
<p>Using Django's built in models, how would one create a triple-join between three models.</p>
<p>For example:</p>
<ul>
<li>Users, Roles, and Events are the models.</li>
<li>Users have many Roles, and Roles many Users. (ManyToMany)</li>
<li>Events have many Users, and Users many Events. (ManyToMany)</li>
<li>But for any given Event, any User may have only one Role.</li>
</ul>
<p>How can this be represented in the model?</p>
|
<p><strong>zacherates</strong> writes:</p>
<blockquote>
<p>I'd model Role as an association class between Users and Roles (...)</p>
</blockquote>
<p>I'd also reccomed this solution, but you can also make use of some syntactical sugar provided by Django: <a href="http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships" rel="noreferrer">ManyToMany relation with extra fields</a>.</p>
<p>Example:</p>
<pre><code>class User(models.Model):
name = models.CharField(max_length=128)
class Event(models.Model):
name = models.CharField(max_length=128)
members = models.ManyToManyField(User, through='Role')
def __unicode__(self):
return self.name
class Role(models.Model):
person = models.ForeignKey(User)
group = models.ForeignKey(Event)
date_joined = models.DateField()
invite_reason = models.CharField(max_length=64)
</code></pre>
|
<p>I'd model Role as an association class between Users and Roles, thus,</p>
<pre><code>class User(models.Model):
...
class Event(models.Model):
...
class Role(models.Model):
user = models.ForeignKey(User)
event = models.ForeignKey(Event)
</code></pre>
<p>And enforce the one role per user per event in either a manager or SQL constraints.</p>
| 9,856
|
<p><em>(see <a href="https://stackoverflow.com/questions/53316/hibernate-crops-clob-values-oddly">here</a> for the problem I'm trying to solve)</em></p>
<p>How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc.</p>
<p>I have the following in my log4j config:</p>
<pre><code>log4j.logger.net.sf.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.net.sf.hibernate.type=DEBUG
log4j.logger.org.hibernate.type=DEBUG
</code></pre>
<p>Which produces output such as:</p>
<pre><code>(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2
</code></pre>
<p>However you'll note that it never displays <code>parameter: 3</code> which is our clob.</p>
<p>What I would really want is something like:</p>
<pre><code>(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.type.ClobType) binding 'something' to parameter: 3
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2
(org.hibernate.type.ClobType) binding 'something else' to parameter: 3
</code></pre>
<p>How do I get it to show this in the log?</p>
|
<p>Try using:</p>
<pre><code>log4j.logger.net.sf.hibernate=DEBUG
log4j.logger.org.hibernate=DEBUG
</code></pre>
<p>That's the finest level you'll get. If it does not show the information you want, then it's not possible.</p>
|
<p>Try to set log4j.logger.org.hibernate.type=TRACE and see if that helps.</p>
| 7,678
|
<p>I've asked this question to the forums on the Mootools website and one person said that my class selection was corrupted before an admin came along and changed my post status to invalid. Needless to say this did not help much. I then posted to a google group for Mootools with no response. My question is why doesn't the 'enter', 'leave', 'drop' events fire for my '.drop' elements? The events for the .drag elements are working.</p>
<pre><code><title>Untitled Page</title>
<script type="text/javascript" src="/SDI/includes/mootools-1.2.js"></script>
<script type="text/javascript" src="/SDI/includes/mootools-1.2-more.js"></script>
<script type="text/javascript" charset="utf-8">
window.addEvent('domready', function() {
var fx = [];
$$('#draggables div').each(function(drag){
new Drag.Move(drag, {
droppables: $$('#droppables div'),
onDrop: function(element, droppable){
if(!droppable) {
}
else {
element.setStyle('background-color', '#1d1d20');
}
element.dispose();
},
onEnter: function(element, droppable){
element.setStyle('background-color', '#ffffff');
},
onLeave: function(element, droppable){
element.setStyle('background-color', '#000000');
}
});
});
$$('#droppables div').each(function(drop, index){
drop.addEvents({
'enter': function(el, obj){
drop.setStyle('background-color', '#78ba91');
},
'leave': function(el, obj){
drop.setStyle('background-color', '#1d1d20');
},
'drop': function(el, obj){
el.remove();
}
});
});
});
</script>
<form id="form1" runat="server">
<div>
<div id="draggables">
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
</div>
<div id="droppables">
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
</div>
</div>
</form>
</code></pre>
|
<p>Ok, it looks like there are a couple of issues here. As far as I can tell, there is no such thing as a "droppable" in mootools. This means your events like 'enter', 'leave' and 'drop' won't work. (These are events on the drag object)</p>
<p>If you change those names to events that elements in mootools have (as in, DOM events) your code works perfectly. For instance, if you change 'enter' and 'leave' to 'mouseover' and 'mouseout', your events fire with no problem. (Opera 9.51 on Windows Vista)</p>
<p>This appears to be the revelant line in the documentation for this, which stats to use DOM events.</p>
<p><a href="http://docs.mootools.net/Element/Element.Event#Element:addEvents" rel="nofollow noreferrer">http://docs.mootools.net/Element/Element.Event#Element:addEvents</a></p>
<p>Also, on that page, is a link to the events that regular elements can have</p>
<p><a href="http://www.w3schools.com/html/html_eventattributes.asp" rel="nofollow noreferrer">http://www.w3schools.com/html/html_eventattributes.asp</a></p>
<p>However, <a href="http://mootools-users.660466.n2.nabble.com/Drag-and-drop-problem-I-m-having-td686391.html" rel="nofollow noreferrer">the advice "TG in SD" gave you in the nabble forums</a> is probably best. If you can, don't bother using these events. Put whatever it is you need to do in the draggable object, and save yourself all this hassle.</p>
|
<p>According to <a href="http://mootools.net/docs/more/Drag/Drag.Move" rel="nofollow">Mootools Docs</a>, "<code>droppables</code>" is one of the options expected by the <code>Drag.Move</code> class. In fact, this is the array of elements that interact with the element when it fires the "<code>drop</code>," "<code>enter</code>," and "<code>leave</code>" event.</p>
| 3,117
|
<p>More and more mobile devices are consuming content on my eCommerce sites. IPhones, Blackberries, PSPs, Windows Mobile, etc and I need some ideas how to handle repurposing my data using CSS templates for these devices. Any ideas would be great. </p>
|
<p>I recommend you look at what Delta Airlines does with CSS at <a href="http://mobile.delta.com" rel="nofollow noreferrer">http://mobile.delta.com</a>. They get help from a company called MShift who does a bunch of mobile banking (which, obviously, has to work on many different devices).</p>
<p>You can get some inspiration from the stylesheet used by the Delta site with <a href="https://my.mshift.com/deltacss.css" rel="nofollow noreferrer">https://my.mshift.com/deltacss.css</a>.</p>
<p>Finally, there are a long list of demo mobile sites from MShift at <a href="http://www.mshift.com/demo.html" rel="nofollow noreferrer">http://www.mshift.com/demo.html</a>.</p>
<p>FWIW, I don't have any association with either Delta or MShift, I have just admired their mobile UI.</p>
|
<p>I would say keep it as simple as possible. Internet on phones can be 3g/wifi or as slow as you can possibly imagine. I would keep the test large so it's easier to read, and links easy to click if you are targeting a touch device. I would also say no to images unless they are 1kb or less.</p>
| 9,381
|
<p>I liked the discussion at <a href="https://stackoverflow.com/questions/31693/differences-in-generics">Differences in Generics</a>, and was wondering whether there were any languages that used this feature particularly well.</p>
<p>I really dislike Java's <code>List<? extends Foo></code> for a <code>List</code> of things that are Liskov-substitutable for <code>Foo</code>. Why can't <code>List<Foo></code> cover that?</p>
<p>And honestly, <code>Comparable<? super Bar></code>?</p>
<p>I also can't remember for the life of my why you should never return an Array of generics:</p>
<pre><code>public T[] getAll<T>() { ... }
</code></pre>
<p>I never liked templates in C++, but that was mostly because none of the compilers could ever spit out a remotely meaningful error message for them. One time I actually did a <code>make realclean && make</code> 17 times to get something to compile; I never did figure out why the 17th time was the charm.</p>
<p>So, who actually <em>likes</em> using generics in their pet language?</p>
|
<p>Haskell implements type-constructor parameterisation (generics, or parametric polymorphism) quite well. So does Scala (although it needs a bit of hand-holding sometimes).</p>
<p>Both of these languages have higher-kinded types (a.k.a. abstract type constructors, or type-constructor polymorphism, or higher-order polymorphism).</p>
<p>See here: <a href="http://lambda-the-ultimate.org/node/2579" rel="nofollow noreferrer">Generics of a Higher Kind</a></p>
|
<p>I think that C# and VB.NET do a good job with generics.</p>
| 7,378
|
<p>On a PLA print where stringing has occurred, what is the best way to remove it during post processing?</p>
<p>Should I simply cut it with a hobby knife and sand the surface or are the better techniques to use?</p>
|
<p>Use a hobby knife with a chisel blade (straight edge perpendicular to handle, beveled on one side only).</p>
<p>Apply with beveled edge against workpiece. Raise the handle in small increments while stroking over the flaw until it is entirely removed. This provides pretty good control to prevent gouging.</p>
<p>Avoid sanding.</p>
<p>This method also works well for removing "ribs" caused by gaps in painter tape applied to print bed.</p>
|
<p>I pull them off by hand and then a few quick passes with a cigarette lighter works for me.</p>
| 2,107
|
<p>This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object?</p>
<p>And the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface:</p>
<pre><code>private IWebBase FindWebBase()
{
if (HttpContext.Current as IWebBase != null)
{
return (IWebBase)HttpContext.Current.;
}
throw new NotImplementedException("Crawling for IWebBase not implemented yet");
}
</code></pre>
<p>The general context is that some controls need to know whether they are executing as a SharePoint webpart, or as part of an Asp.Net framework.</p>
<p>I have solved the problem by requiring the control to pass a reference to itself, and checking the Page property of the control, but I'm still curious why the above does not work.</p>
<p>The compiler error is:
Cannot convert System.Web.HttpContext to ...IWebBase via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion or null type conversion.</p>
|
<p>No, from MSDN on HttpContext.Current: "Gets or sets the HttpContext object for the current HTTP request." </p>
<p>In other words it is an HttpContext object, not a Page.</p>
<p>You can get to the Page object via HttpContext using:</p>
<pre><code>Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
// Use page instance.
}
</code></pre>
|
<p>Please see my answer : <br/>
<a href="https://stackoverflow.com/questions/1054123/why-httpcontext-current-handler-is-null">Why HttpContext.Current.Handler is null?</a>
<br/><br/>
Maybe resolved your problem.<br/></p>
| 8,254
|
<p>Does anyone know how the developers of Marlin decided to name it that?</p>
|
<p>As far as I know Erik van der Zalm started Marlin. He is from the Netherlands and Zalm translates to "salmon". One of the design goals of Marlin was to make it faster than the other firmware available at that time. And a marlin is a very fast swimming fish.</p>
<p>Some firmwares developed after Marlin also joined this fish theme: Sailfish, Minnow, ...</p>
|
<p>Yes, it probably is totally off-topic, but fun too, so I'll try to get an answer in, before the question gets closed.</p>
<p>The best place to ask would be the <a href="https://reprap.org/forum/list.php?415" rel="nofollow noreferrer">Firmware - Marlin forum</a>, on RepRap.org.</p>
<p>The question is there now, <a href="https://reprap.org/forum/read.php?415,852947" rel="nofollow noreferrer">Why was it named Marlin?</a> and I'll update this answer, if/when I get a response...</p>
| 1,311
|
<p>Is there a good way to exclude certain pages from using a HTTP module?</p>
<p>I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config:</p>
<pre><code><system.web>
<!-- ... -->
<httpModules>
<add name="SessionValidationModule"
type="SessionValidationModule, SomeNamespace" />
</httpModules>
</system.web>
</code></pre>
<p>To exclude the module from the page, I tried doing this (without success):</p>
<pre><code><location path="ToBeExcluded">
<system.web>
<!-- ... -->
<httpModules>
<remove name="SessionValidationModule" />
</httpModules>
</system.web>
</location>
</code></pre>
<p>Any thoughts?</p>
|
<p>You could use an HTTPHandler instead of an HTTPModule. Handlers let you specify a path when you declare them in Web.Config. </p>
<pre><code><add verb="*" path="/validate/*.aspx" type="Handler,Assembly"/>
</code></pre>
<p>If you must use an HTTPModule, you could just check the path of the request and if it's one to be excluded, bypass the validation. </p>
|
<p>Here is some simple example how to filter requests by extension... the example below exclude from the processing files with the specific extensions. Filtering by file name will look almost the same with some small changes...</p>
<pre><code>public class AuthenticationModule : IHttpModule
{
private static readonly List<string> extensionsToSkip = AuthenticationConfig.ExtensionsToSkip.Split('|').ToList();
// In the Init function, register for HttpApplication
// events by adding your handlers.
public void Init(HttpApplication application)
{
application.BeginRequest += new EventHandler(this.Application_BeginRequest);
application.EndRequest += new EventHandler(this.Application_EndRequest);
}
private void Application_BeginRequest(Object source, EventArgs e)
{
// we don't have to process all requests...
if (extensionsToSkip.Contains(Path.GetExtension(HttpContext.Current.Request.Url.LocalPath)))
return;
Trace.WriteLine("Application_BeginRequest: " + HttpContext.Current.Request.Url.AbsoluteUri);
}
private void Application_EndRequest(Object source, EventArgs e)
{
// we don't have to process all requests...
if (extensionsToSkip.Contains(Path.GetExtension(HttpContext.Current.Request.Url.LocalPath)))
return;
Trace.WriteLine("Application_BeginRequest: " + HttpContext.Current.Request.Url.AbsoluteUri);
}
}
</code></pre>
<p>General idea is to specify in config file what exactly should be processed (or excluded from the processing) and use that config parameter in the module.</p>
| 9,639
|
<p>I'm just getting dirty in WinForms, and I've discovered, through a lovely tutorial, the magic of dragging a database table onto the design view of my main form. So, all is lovely, I've got my DataGridView with all of the columns represented beautifully.</p>
<p>BUT...</p>
<p>When I run my application against this brand new, empty .sdf (empty save for the two tables I've created, which are themselves empty), I get a -1 in the column corresponding to my primary key/identity column whenever I try to create that first record.</p>
<p>Any idea why this might be happening? If it helps, the column is an <code>int</code>.</p>
|
<p>Since it is an Identity column and you haven't saved it to the database yet it is -1. I am assuming here that this is before you save the table back to the database, correct? You need to perform the insert before that value will be set correctly.</p>
|
<p>Since it is an Identity column and you haven't saved it to the database yet it is -1. I am assuming here that this is before you save the table back to the database, correct? You need to perform the insert before that value will be set correctly.</p>
| 5,942
|
<p>I want to implement an "automatic update" system for a windows application.
Right now I'm semi-manually creating an <a href="http://connectedflow.com/appcasting/" rel="noreferrer">"appcast"</a> which my program checks, and notifies the user that a new version is available. (I'm using
<a href="http://nsis.sourceforge.net/Main_Page" rel="noreferrer">NSIS</a> for my installers).</p>
<p>Is there software that I can use that will handle the "automatic" part of the updates, perhaps similar to <a href="http://sparkle.andymatuschak.org/" rel="noreferrer">Sparkle</a> on the mac? Any issues/pitfalls that I should be aware of?</p>
|
<p>There is no solution quite as smooth as Sparkle (that I know of).</p>
<p>If you need an easy means of deployment and updating applications, <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="noreferrer">ClickOnce</a> is an option. Unfortunately, it's inflexible (e.g., no per-machine installation instead of per-user), opaque (you have very little influence and clarity and control over how its deployment actually works) and non-standard (the paths it stores the installed app in are unlike anything else on Windows).</p>
<p>Much closer to what you're asking would be <a href="http://wix.sourceforge.net/clickthrough.html" rel="noreferrer">ClickThrough</a>, a side project of <a href="http://wix.sourceforge.net/" rel="noreferrer">WiX</a>, but I'm not sure it's still in development (if it is, they should be clearer about that…) — and it would use MSI in any case, not NSIS.</p>
<p>You're likely best off rolling something on your own. I'd love to see a Sparkle-like project for Windows, but nobody seems to have given it a shot thus far.</p>
|
<p>Just came here from an answer to my own question on the same subject - I mention one other <a href="http://windowsclient.net/articles/appupdater.aspx" rel="nofollow noreferrer">updating solution</a> in my <a href="https://stackoverflow.com/questions/49747/autoupdating-net-applications">question</a>. It uses a stub loader, and an xml file to point to the latest executable.</p>
| 5,766
|
<p>I'm a 1-2 man band at work, and so far I've been using VSS for two reasons 1) the company was using that when I started a few months ago, and 2) it is friendly with Visual Studio.</p>
<p>Needless to say, I would very much like to upgrade to a not-so-archaic source control system. However, I don't want to give up the friendliness with Visual Studio, and I'd like to be able to migrate the existing codebase over to a better source control system.</p>
<p>I can't imagine I'm the only person in this situation. Does anyone have a success story they wouldn't mind sharing? </p>
|
<p>If you can pay for it, <a href="http://www.sourcegear.com/" rel="nofollow noreferrer">Source Gear Vault</a> is designed to be a drop-in replacement.</p>
<p>If you can't pay, Subversion with AnkhSVN works well but is a bit different.</p>
|
<p>For one or two users, <a href="http://www.perforce.com" rel="nofollow noreferrer">perforce</a> is free as well. Once you need more that two users though, you have to start paying for it. They have a SCC plugin as well to allow integration into Visual Studio (and any other program that supports that interface).</p>
| 9,288
|
<p>This is probably a really simple jQuery question, but I couldn't answer it after 10 minutes in the documentation so...</p>
<p>I have a list of checkboxes, and I can get them with the selector <code>'input[type=checkbox]'</code>. I want the user to be able to shift-click and select a range of checkboxes. To accomplish this, I need to get the index of a checkbox in the list, so I can pass that index to <code>.slice(start, end)</code>. How do I get the index when the user clicks a box?</p>
|
<p>The following selector should also work in jQuery: <code>input:checkbox</code>.</p>
<p>You can then string the <code>:gt(index)</code> and <code>:lt(index)</code> filters together, so if you want the 5th to 7th checkboxes, you'd use <code>input:checkbox:gt(4):lt(2)</code>.</p>
<p>To get the index of the currently clicked checkbox, just use <code>$("input:checkbox").index($(this))</code>.</p>
|
<p>Thanks for the answer, samjudson.</p>
<p>After further experimentation, I found that you can even use just <code>$(':checkbox')</code> to select them. It's interesting that you can use the <code>.slice()</code> function to get the range, but you also have the option of doing it in the selector with <code>:gt</code> and <code>:lt</code>. I do find the syntax of <code>.slice()</code> to be cleaner than using the selector filters, though.</p>
<p>I'm going to have to say that I don't like Ryan Duffield's solution as much, because it requires changes to the markup, and involves repeating code.</p>
| 6,542
|
<p>I'd like to ask a question then follow it up with my own answer, but also see what answers other people have.</p>
<p>We have two large files which we'd like to read from two separate threads concurrently. One thread will sequentially read fileA while the other thread will sequentially read fileB. There is no locking or communication between the threads, both are sequentially reading as fast as they can, and both are immediately discarding the data they read.</p>
<p>Our experience with this setup on Windows is very poor. The combined throughput of the two threads is in the order of 2-3 MiB/sec. The drive seems to be spending most of its time seeking backwards and forwards between the two files, presumably reading very little after each seek.</p>
<p>If we disable one of the threads and temporarily look at the performance of a single thread then we get much better bandwidth (~45 MiB/sec for this machine). So clearly the bad two-thread performance is an artefact of the OS disk scheduler.</p>
<p><strong>Is there anything we can do to improve the concurrent thread read performance?</strong> Perhaps by using different APIs or by tweaking the OS disk scheduler parameters in some way.</p>
<p>Some details:</p>
<p>The files are in the order of 2 GiB each on a machine with 2GiB of RAM. For the purpose of this question we consider them not to be cached and perfectly defragmented. We have used defrag tools and rebooted to ensure this is the case.</p>
<p>We are using no special APIs to read these files. The behaviour is repeatable across various bog-standard APIs such as Win32's CreateFile, C's fopen, C++'s std::ifstream, Java's FileInputStream, etc.</p>
<p>Each thread spins in a loop making calls to the read function. We have varied the number of bytes requested from the API each iteration from values between 1KiB up to 128MiB. Varying this has had no effect, so clearly the amount the OS is physically reading after each disk seek is not dictated by this number. This is exactly what should be expected.</p>
<p>The dramatic difference between one-thread and two-thread performance is repeatable across Windows 2000, Windows XP (32-bit and 64-bit), Windows Server 2003, and also with and without hardware RAID5.</p>
|
<p>The problem seems to be in Windows I/O scheduling policy. According to what I found <a href="http://engr.smu.edu/~kocan/7343/fall05/slides/chapter11.ppt" rel="noreferrer" title="I/O management and disk scheduling">here</a> there are many ways for an O.S. to schedule disk requests. While Linux and others can choose between different policies, before Vista Windows was locked in a single policy: a FIFO queue, where all requests where splitted in 64 KB blocks. I believe that this policy is the cause for the problem you are experiencing: the scheduler will mix requests from the two threads, causing continuous seek between different areas of the disk.<br>
Now, the good news is that according to <a href="http://technet.microsoft.com/en-us/magazine/cc162494.aspx" rel="noreferrer" title="Inside Windows Vista Kernel">here</a> and <a href="http://widefox.pbwiki.com/IO" rel="noreferrer" title="Kernel Comparison: Linux (2.6.22) versus Windows (Vista)">here</a>, Vista introduced a smarter disk scheduler, where you can set the priority of your requests and also allocate a minimum badwidth for your process.<br>
The bad news is that I found no way to change disk policy or buffers size in previous versions of Windows. Also, even if raising disk I/O priority of your process will boost the performance against the other processes, you still have the problems of your threads competing against each other.<br>
What I can suggest is to modify your software by introducing a self-made disk access policy.<br>
For example, you could use a policy like this in your thread B (similar for Thread A): </p>
<pre><code>if THREAD A is reading from disk then wait for THREAD A to stop reading or wait for X ms
Read for X ms (or Y MB)
Stop reading and check status of thread A again
</code></pre>
<p>You could use semaphores for status checking or you could use perfmon counters to get the status of the actual disk queue.
The values of X and/or Y could also be auto-tuned by checking the actual trasfer rates and slowly modify them, thus maximizing the throughtput when the application runs on different machines and/or O.S. You could find that cache, memory or RAID levels affect them in a way or the other, but with auto-tuning you will always get the best performance in every scenario.</p>
|
<p>I would create some kind of in memory thread safe lock. Each thread could wait on the lock until it was free. When the lock becomes free, take the lock and read the file for a defined length of time or a defined amount of data, then release the lock for any other waiting threads.</p>
| 3,061
|
<p>I've learned in College that you always have to free your unused Objects but not how you actually do it. For example structuring your code right and so on.
Are there any general rules on how to handle pointers in C++? </p>
<p>I'm currently not allowed to use boost. I have to stick to pure c++ because the framework I'm using forbids any use of generics.</p>
|
<p>I have worked with the embedded Symbian OS, which had an excellent system in place for this, based entirely on developer conventions.</p>
<ol>
<li>Only one object will ever own a pointer. By default this is the creator.</li>
<li>Ownership can be passed on. To indicate passing of ownership, the object is passed as a pointer in the method signature (e.g. void Foo(Bar *zonk);).</li>
<li>The owner will decide when to delete the object.</li>
<li>To pass an object to a method just for use, the object is passed as a reference in the method signature (e.g. void Foo(Bat &zonk);).</li>
<li>Non-owner classes may store references (never pointers) to objects they are given only when they can be certain that the owner will not destroy it during use.</li>
</ol>
<p>Basically, if a class simply uses something, it uses a reference. If a class owns something, it uses a pointer.</p>
<p>This worked beautifully and was a pleasure to use. Memory issues were very rare.</p>
|
<ul>
<li>When you have to use manage memory
manually, make sure you call delete
in the same
scope/function/class/module, which
ever applies first, e.g.:</li>
<li>Let the caller of a function allocate the memory that is filled by it,
do not return new'ed pointers.</li>
<li>Always call delete in the same exe/dll as you called new in, because otherwise you may have problems with heap corruptions (different incompatible runtime libraries).</li>
</ul>
| 4,709
|
<p>What built-in PHP functions are useful for web scraping? What are some good resources (web or print) for getting up to speed on web scraping with PHP?</p>
|
<p>Scraping generally encompasses 3 steps: </p>
<ul>
<li>first you GET or POST your request
to a specified URL </li>
<li>next you receive
the html that is returned as the
response</li>
<li>finally you parse out of
that html the text you'd like to
scrape.</li>
</ul>
<p>To accomplish steps 1 and 2, below is a simple php class which uses Curl to fetch webpages using either GET or POST. After you get the HTML back, you just use Regular Expressions to accomplish step 3 by parsing out the text you'd like to scrape.</p>
<p>For regular expressions, my favorite tutorial site is the following:
<a href="http://www.regular-expressions.info/" rel="nofollow noreferrer">Regular Expressions Tutorial</a></p>
<p>My Favorite program for working with RegExs is <a href="http://www.regexbuddy.com/" rel="nofollow noreferrer">Regex Buddy</a>. I would advise you to try the demo of that product even if you have no intention of buying it. It is an invaluable tool and will even generate code for your regexs you make in your language of choice (including php).</p>
<p>Usage:
<pre><code></p>
<p>$curl = new Curl();
$html = $curl->get("<a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a>");</p>
<p>// now, do your regex work against $html
</pre></code></p>
<p>PHP Class:</p>
<pre><code>
<?php
class Curl
{
public $cookieJar = "";
public function __construct($cookieJarFile = 'cookies.txt') {
$this->cookieJar = $cookieJarFile;
}
function setup()
{
$header = array();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; // browsers keep this blank.
curl_setopt($this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');
curl_setopt($this->curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($this->curl,CURLOPT_COOKIEJAR, $this->cookieJar);
curl_setopt($this->curl,CURLOPT_COOKIEFILE, $this->cookieJar);
curl_setopt($this->curl,CURLOPT_AUTOREFERER, true);
curl_setopt($this->curl,CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl,CURLOPT_RETURNTRANSFER, true);
}
function get($url)
{
$this->curl = curl_init($url);
$this->setup();
return $this->request();
}
function getAll($reg,$str)
{
preg_match_all($reg,$str,$matches);
return $matches[1];
}
function postForm($url, $fields, $referer='')
{
$this->curl = curl_init($url);
$this->setup();
curl_setopt($this->curl, CURLOPT_URL, $url);
curl_setopt($this->curl, CURLOPT_POST, 1);
curl_setopt($this->curl, CURLOPT_REFERER, $referer);
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $fields);
return $this->request();
}
function getInfo($info)
{
$info = ($info == 'lasturl') ? curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL) : curl_getinfo($this->curl, $info);
return $info;
}
function request()
{
return curl_exec($this->curl);
}
}
?>
</code>
</pre>
|
<p>The curl library allows you to download web pages. You should look into regular expressions for doing the scraping.</p>
| 4,660
|
<p>How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. </p>
<p>I can't use the TreeViews' <code>SelectedNode</code> property because the node is only been right-clicked and not selected.</p>
|
<p>You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs.</p>
<pre><code>void treeView1MouseUp(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
// Select the clicked node
treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y);
if(treeView1.SelectedNode != null)
{
myContextMenuStrip.Show(treeView1, e.Location);
}
}
}
</code></pre>
|
<p>If you want the context menu to be dependent on the selected item you're best move I think is to use Jonesinator's code to select the clicked item. Your context menu content can then be dependent on the selected item.</p>
<p>Selecting the item first as opposed to just using it for the context menu gives a few advantages. The first is that the user has a visual indication as to which he clicked and thus which item the menu is associated with. The second is that this way it's a hell of a lot easier to keep compatible with other methods of invoking the context menu (e.g. keyboard shortcuts).</p>
| 2,465
|
<p>I've always preferred to use long integers as primary keys in databases, for simplicity and (assumed) speed. But when using a <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" rel="noreferrer">REST</a> or Rails-like URL scheme for object instances, I'd then end up with URLs like this:</p>
<pre><code>http://example.com/user/783
</code></pre>
<p>And then the assumption is that there are also users with IDs of 782, 781, ..., 2, and 1. Assuming that the web app in question is secure enough to prevent people entering other numbers to view other users without authorization, a simple sequentially-assigned surrogate key also "leaks" the total number of instances (older than this one), in this case users, which might be privileged information. (For instance, I am user #726 in stackoverflow.)</p>
<p>Would a <a href="http://en.wikipedia.org/wiki/Uuid" rel="noreferrer">UUID</a>/GUID be a better solution? Then I could set up URLs like this:</p>
<pre><code>http://example.com/user/035a46e0-6550-11dd-ad8b-0800200c9a66
</code></pre>
<p>Not exactly succinct, but there's less implied information about users on display. Sure, it smacks of "security through obscurity" which is no substitute for proper security, but it seems at least a little more secure.</p>
<p>Is that benefit worth the cost and complexity of implementing UUIDs for web-addressable object instances? I think that I'd still want to use integer columns as database PKs just to speed up joins.</p>
<p>There's also the question of in-database representation of UUIDs. I know MySQL stores them as 36-character strings. Postgres seems to have a more efficient internal representation (128 bits?) but I haven't tried it myself. Anyone have any experience with this?</p>
<hr>
<p>Update: for those who asked about just using the user name in the URL (e.g., <a href="http://example.com/user/yukondude" rel="noreferrer">http://example.com/user/yukondude</a>), that works fine for object instances with names that are unique, but what about the zillions of web app objects that can really only be identified by number? Orders, transactions, invoices, duplicate image names, stackoverflow questions, ...</p>
|
<p>I can't say about the web side of your question. But uuids are great for n-tier applications. PK generation can be decentralized: each client generates it's own pk without risk of collision.
And the speed difference is generally small.</p>
<p>Make sure your database supports an efficient storage datatype (16 bytes, 128 bits).
At the very least you can encode the uuid string in base64 and use char(22).</p>
<p>I've used them extensively with Firebird and do recommend.</p>
|
<p>As long as you use a DB system with efficient storage, HDD is cheap these days anyway...</p>
<p>I know GUID's can be a b*tch to work with some times and come with some query overhead however from a security perspective they are a savior. </p>
<p>Thinking security by obscurity they fit well when forming obscure URI's and building normalised DB's with Table, Record and Column defined security you cant go wrong with GUID's, try doing that with integer based id's.</p>
| 2,782
|
<p>There was a contest to develop 3D printable files for the International Space Station's 3D printer. The winner got a 3D printer ... runners up got Fluke DVOM's and all entrants got a t-shirt.</p>
<p>ISS 3D Print Contest</p>
<p>They offer 3 materials: ABS, HDPE, and PEI+PC ... I'm not familiar with the last one. Anyone know?</p>
<p>If found this material on Matweb: <a href="http://www.matweb.com/search/DataSheet.aspx?MatGUID=949ca0fa6b1742bea8e8d26ea2fd3d48t" rel="nofollow noreferrer">PEI+PC Alloy</a></p>
<p>These links are thought to last a very long time. I hope many of you decide to upload a project into contest site and compete for the grand prize ... A sweet John Fluke DVOM. If nothing else a free awesome T-shirt.</p>
|
<p>Ultem 9085, the most common ultem resin used for AM, is a blend of PEI-PC, as seen here <a href="https://www.sabic-ip.com/gepapp/Plastics/servlet/ProductsAndServices/Product/series?sltPrdline=ULTEM&sltPrdseries=Aerospace%20and%20Transportation&search=Search#searchresults" rel="nofollow">https://www.sabic-ip.com/gepapp/Plastics/servlet/ProductsAndServices/Product/series?sltPrdline=ULTEM&sltPrdseries=Aerospace%20and%20Transportation&search=Search#searchresults</a>.</p>
<p>Ultem is a trade name for PEI alloys made by Sabic and 9085, used in filaments made by both Stratasys and 3dXtech as the two most visible suppliers are both made with this same alloy. It is used for high temperature resistance and strength and needs to be printed at upwards of 300C in a contained environment.</p>
<p>Source-Intern at Made in Space.</p>
|
<p>PEI - polyethermide is a "common" coating for heated print beds. PC is so many different things, but in this context, it's likely to mean polycarbonate plastic. From what I've read, it's challenging to print with and especially challenging to get a good bond on the build plate. One reference suggests to use a PEI coated bed with a slurry of ABS applied prior to printing. As with so many things 3d printer related, many people have many different methods. The above one appears to be well received as a successful method.</p>
| 350
|
<p>I am using a BAUDrate of 115200 since I cannot make a connection to my printer with the advised 250000 rate. Are there any downsides or limits I reach earlier given by the lower BAUDrate?</p>
|
<p><a href="https://learn.sparkfun.com/tutorials/serial-communication/rules-of-serial" rel="nofollow noreferrer">Baud rate</a> is the rate at which information is transferred in a communication channel, given as a number of bits per second (bps). So a baud rate of 250000 is capable of transferring a <em>maximum</em> of 250000 bits per second (31250 bytes/s). When working with serial ports, both ends of the communication line will have to "talk" with the <a href="https://www.quora.com/How-do-we-connect-two-devices-with-different-baud-rates" rel="nofollow noreferrer">same speed</a> - the same baud rate - to understand each other.</p>
<p>So when using a baud rate of 11520 you will theoretically be limited to transfer data with about half the speed of 25000. If you are transferring large amounts of data, this might be a limiting factor for your application, but if you are not pushing the limits of your serial port, it probably won't matter at all.</p>
|
<p>If your printer doesn't have an SD card then the whole communication between computer and arduino is performed "live". There is kinda buffer of data which arduino can swallow. Then it needs to process it (and then can send some reports to your app) and then arduino is ready to get new "set" of instructions to work on.</p>
<p>Now. If a baudrate is to low then there could be a situation when arduino finishes its job and has to wait for new bite of data. In such a situation you can see the printer pauses printing as it waits for signals from arduino as it waits for data from computer. That's more or less a downside of a low baudrate.</p>
<p>If you have a SD card then the data is sucked from it but reports are still send by port to show results on screen. In such situation you can see sligtly late screen update.</p>
<p>A screen means just a fun of live preview but breaking printing process (caused by late data send) means your hot nozzle stays over the same position which can destruct a surface or even fry up a plastic a bit. It also oozes and therefore creates lasting artifacts.</p>
<p>Resuming - low baudrate is evil ;)</p>
| 342
|
<p>This came up in one of my groups today. That we could not color bend, or mix 3d printing filaments. I have researched but I am not finding anything talking about Plastic mixing in an extruder.</p>
<p>Why is it that we cannot take say a Diamond hotend, or a hotend with 5+ inputs, and mix any color we want? (assuming all the same type, ABSm, PLA). I think it would be interesting to at the least get a gradient effect on prints.</p>
<p>The best I have seen is natural plastic and a marker system. Or a powder / advanced / out of hobbyist price range process that sprays ink. The only Color Bending I know of is with Recycled plastic that uses multi color. Not quite what I am looking for.</p>
<p>Thanks!</p>
|
<p>I just started with google and phrase "3d printing color mixing" and on the first place (in fact first two were valueless adverts) I got this <a href="http://www.instructables.com/id/Full-Color-Mixing-3D-Printer/?ALLSTEPS" rel="nofollow noreferrer">Instructables - DIY Full Color Mixing 3D Printer</a>.</p>
<p><strong>How it works?</strong></p>
<p>It uses magenta / cyan / yellow filaments and mixes it while printing with Diamond hotend.</p>
<p>It definitely does what you are asking for and it's exactly the same idea you come up with ;)</p>
<p><strong>Overview</strong></p>
<blockquote>
<ol>
<li><p>Getting the controller board ready for three extruders... I hacked
a RAMBo board to drive three extruders, however, you can use any board
you want... (most people use a RUMBA due to it having all the
pins/components needed for 3 extruders native on the board) </p></li>
<li><p>Rewriting Repetier firmware to get color mixing working on your
machine.</p></li>
<li><p>How to install, configure, and use the diamond hotend - tips /
tricks / lessons learned / etc...</p></li>
<li><p>My original Bowden extruder design and various ways to mount the
three extruders for your set-up</p></li>
<li><p>My universal magnetic effector plate and accompanying hotend mounts
for quickly swapping various hotends. (delta specific)</p></li>
<li><p>How to design multi-color models and making STLs that can be
exported and used as a individual STLs or combining them into an AMF
file for slicing...</p></li>
<li><p>Configuring color mixing in Repetier and Slic3r to print above
mentioned multi-color models.</p></li>
<li><p>Anything else I can think of later that I can't think of now.</p></li>
<li><p>Comprehensive overview of Quantum Mechanical Entanglement as it
pertains to multi-color printing (just kidding, I don't understand
that... But I will cover multi-color printing throughly)</p></li>
</ol>
</blockquote>
|
<p>If you clearly observe the geometry of the print it has printed in different colours .the part is designed in such a way that it has the small height gap between the each colour but we cannot seen this gap in one projection plane..
We can print only in direct drive extrusion .by changing the filament of different colours without pausing the print by immediately changing the material . It is printed in single nozzle. The above image clears your doubt.it is designed with different heights.<a href="https://i.stack.imgur.com/faCw2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/faCw2.jpg" alt="enter image description here"></a></p>
| 367
|
<p>Can anyone help me find/confirm the information needed to setup the CR-10 in the Cura Software</p>
<p>I have following settings from research:</p>
<p><strong>Printer Settings</strong></p>
<ul>
<li>x = 300 mm</li>
<li>y = 300 mm</li>
<li>z = 400 mm</li>
<li>Build Plate = Rectangular</li>
<li>Machine Center is Zero = Checked</li>
<li>Heated Bed = Checked</li>
<li>G-code Flavor = RepRap (Marlin/Sprinter) <strong>-- Uncertain - please help confirm this</strong></li>
</ul>
<p><strong>Print Head Settings</strong></p>
<ul>
<li>X min = <strong>Unclear where this comes from</strong></li>
<li>Y min = <strong>Unclear where this comes from</strong></li>
<li>X max = <strong>Unclear where this comes from</strong></li>
<li>Y max = <strong>Unclear where this comes from</strong></li>
<li>Gantry Height = <strong>Unclear where this is measured from</strong></li>
<li>Number of Extruders = 1</li>
<li>Material Diameter - 1.75 mm</li>
<li>Nozzle size = 0.4 mm</li>
</ul>
|
<p><strong>GCode flavor</strong>: the firmware your machine uses. Google tells me CR-10 uses Marlin, so you should select that. Volumetric Marlin is not very common.</p>
<p>Print Head Settings
<strong>X/Y min/max</strong> define the bounding box of the area your print head takes up. Measure the distance from the centre of the nozzle to the left-most point of the print head and do the same for the right-most, front-most and back-most.</p>
<p><strong>Gantry Height</strong> is the distance from the tip of the nozzle to the lowest point of the gantry, which is the axle on which the print head is mounted.</p>
<p>These print head settings are only used for one-at-a-time printing.</p>
|
<p>In addition to <a href="/a/4438">this answer</a>, the "Machine Center is Zero", should <strong>not</strong> be checked. It will begin the print in the current location of the Printing Head.</p>
| 653
|
<p>I have a query where I wish to retrieve the oldest X records. At present my query is something like the following:</p>
<pre><code>SELECT Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate DESC
</code></pre>
<p>I know that normally I would remove the 'DESC' keyword to switch the order of the records, however in this instance I still want to get records ordered with the newest item first.</p>
<p>So I want to know if there is any means of performing this query such that I get the oldest X items sorted such that the newest item is first. I should also add that my database exists on SQL Server 2005.</p>
|
<p>Why not just use a subquery?</p>
<pre><code>SELECT T1.*
FROM
(SELECT TOP X Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate) T1
ORDER BY CreatedDate DESC
</code></pre>
|
<p>Embed the query. You take the top x when sorted in ascending order (i.e. the oldest) and then re-sort those in descending order ... </p>
<pre><code>select *
from
(
SELECT top X Id, Title, Comments, CreatedDate
FROM MyTable
WHERE CreatedDate > @OlderThanDate
ORDER BY CreatedDate
) a
order by createddate desc
</code></pre>
| 8,593
|
<p>For those of you familiar with <a href="http://www.gallio.org" rel="noreferrer">Gallio</a>, what Advantages and Disadvantages have you experienced using this tool, a so-called Test Automation Platform?</p>
|
<p>We're using Gallio/MbUnit for a year now. We're quite happy with it, the Gallio guys keep introducing cool new features and the development is active. If you decide to use it, here are some hints/notes:</p>
<ol>
<li>Buy yourself a TestDriven.NET license - I think it is a must for Gallio unit tests, since Resharper test runner doesn't know how to run certain tests + Gallio has one of its test runners targeted for TD.NET.</li>
<li>We use Gallio.Echo command line runner for CI scripts/builds. Gallio Icarus - the GUI runner (at least the current version) is pretty unstable and not very user friendly.</li>
<li>If you want to use the latest Gallio features (like parallel tests etc), be prepared to have to use the latest daily builds of Gallio. If this is an issue, keep to "official" builds, but we haven't had any real problems with daily build versions.</li>
<li>I recommend adding the basic Gallio .DLLs and .EXEs to your source control. And actually reference <strong>these</strong> in your projects, not ones from GAC. This way you'll avoid any "works on my machine" problems if someone in your team has a different version of Gallio installed on his/her machine.</li>
</ol>
|
<p>On the advantages front, integration with everything is quite nice :) Seriously, I'm a huge fan of the experimental integration with Visual Studio Team System (screenshots <a href="http://blog.bits-in-motion.com/2008/05/announcing-gallio-v30-alpha-3.html" rel="nofollow noreferrer">here</a>). I think that really lowers the bar for those new to unit testing.</p>
<p>The only disadvantage from my perspective <em>so far</em> is the fact that it isn't released yet.</p>
| 8,177
|
<p>I have a VB6.0 project and I want to convert it in VB.Net.</p>
<p>In my VB6.0 application some of the MDI Child form’s height is 17000 and width is 13000. Now I want to set the same form size in VB.Net forms, but it allows maximum form width = 1036, height = 780 for resolution 1024x768.</p>
<p>How can I increase form size with same resolution?</p>
<p>Also I want to print this from so, I can not use auto scroll property of vb.net forms.</p>
<p>Thaks</p>
|
<p>Your classic VB units are in what are called "twips". You will most likely be able to divide those numbers by 12 or 15 (depending on if you are using large or small fonts) and you will get a certain number of pixels.</p>
|
<p>I think the VB6 units are not the same with the VB.Net one. So you have to do a conversion.</p>
| 5,643
|
<p><strong>Here is the context</strong><br/>
I've got an old car for which I have a small plastic piece who is broken. As it's an old car and a very specific piece, I can't find it anymore. So I was thinking about 3D printing it.</p>
<p>My problem is this piece is on the carburetor, so close to the engine. This means, it can heat a lot, close to 90-100 °C.</p>
<p><strong>My question</strong><br/>
Do the pieces created with the common 3D printing techniques melt at 100 °C? If yes, what kind of other 3D printing technique can I use?</p>
<p>Here is the piece I want to recreate (sorry for the bad quality), the scale is in cm.
<a href="https://i.stack.imgur.com/XBZ6Q.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/XBZ6Q.jpg" alt="The piece"></a></p>
|
<p>The number you're looking for is the <a href="https://en.wikipedia.org/wiki/Glass_transition" rel="noreferrer">glass transition temperature</a> (the lowest temperature at which the material can flow or warp), not the melting point. This depends on what material you're using; approximate temperatures for common printable materials are:</p>
<ul>
<li>PLA: 60˚C</li>
<li>PETG, high-temperature PLA: 95 ˚C</li>
<li>ABS: 105˚C</li>
<li>Nylon: typically 70˚C or above ("Nylon" is a large family of similar polymers)</li>
<li>Polycarbonate: 145˚C</li>
</ul>
<p>Any plastic under your hood is probably either nylon (for its durability, impact resistance, and chemical resistance) or ABS (for its strength and heat resistance). These are both difficult materials to print: ABS emits toxic fumes while printing, and tends to warp if you're not using a heated enclosure, while nylon readily absorbs water from the air, causing the filament to bubble as it's printed. Further, many printers can't handle the high temperatures needed to work with these materials.</p>
<p>If you're going to print this yourself, I recommend using PETG and inspecting the part after a few days of use to see if it's warping. PETG is reasonably easy to print and comes close to your target heat resistance.</p>
<p>If you're going to get someone else to print it, I recommend using ABS. It's probably what the original part was made of, and anyone willing to print ABS for you will have the heated enclosure and ventilation system to deal with printing it.</p>
<p>I'd avoid polycarbonate unless you know the original part was made of it. Although PC is strong and heat resistant, it's also somewhat brittle and vulnerable to scratching.</p>
<p>High-temperature PLA is also brittle, and requires a heat-treating step that will change the dimensions of the part. It will likely take several tries to get something that comes out the right size, and even then, you risk having the part break when your car hits a bump.</p>
|
<p>Nylon is probably your best bet.
It is resistant to some chemicals as well.
Figure on printing it at around 250 °C.</p>
<p>It might do the job.</p>
| 1,530
|
<p>I know this might be a no-brainer, but please read on.</p>
<p>I also know it's generally not considered a good idea, maybe the worst, to let a browser run and interact with local apps, even in an intranet context.</p>
<p>We use Citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion. These folks are not particularly tech savvy; I don't even consider thinking that they could understand the difference between remote delivered applications and local ones.</p>
<p>So, I've been asked if it's possible. Of course, it is, with IE's good ol' ActiveX controls. And I even made a working prototype (that's where it hurts).</p>
<p>But now, I doubt. Isn't it madness to allow such 'dangerous' ActiveX controls, even in the '<em>local intranet</em>' zone? People will use the same browser to surf the web, can I fully trust IE? Isn't there a risk that Microsoft would just disable those controls in future updates/versions? What if a website, or any kind of malware, just put another site on the trust list? With that extent of control, you could as well uninstall every protection and just run amok 'till you got hanged by the IT dept.</p>
<p>I'm about to confront my superiors with the fact that, even if they saw it is doable, it would be a very bad thing. So I'm desperately in need of good and strong arguments, because "<em>let's don't</em>" won't do it.</p>
<p>Of course, if there is nothing to be scared of, that'll be nice too. But I strongly doubt that.</p>
|
<blockquote>
<p><i>We use Citrix for home-office, and people really like it. Now, they would like the same kind of environment at work, a nice page where every important application/document/folder is nicely arranged and classified in an orderly fashion</i></p>
</blockquote>
<p>I haven't used Citrix very many times, but what's it got to do with executing local applications? I don't see how "People like Citrix" and "browser executing local applications" relate at all?</p>
<p>If the people are accessing your Citrix server from home, and want the same experience in the office, then buy a cheap PC, and run the exact same Citrix software they run on their home computers. Put this computer in the corner and tell them to go use it. They'll be overjoyed.</p>
<blockquote>
<p><i>Isn't it madness to allow such 'dangerous' ActiveX controls, even in the 'local intranet' zone ? People will use the same browser to surf the web, can I fully trust IE ?</i></p>
</blockquote>
<p>Put it this way. IE has built-in support for AX controls. It uses it's security mechanisms to prevent them from running unless in a trusted site. By default, no sites are trusted at all.</p>
<p>If you use IE <em>at all</em> then you're putting yourself at the mercy of these security mechanisms. Whether or not you tell it to trust the local intranet is beside the point, and isn't going to affect the operation of any other zones. </p>
<p>The good old security holes that require you to reboot your computer every few weeks when MS issues a patch will continue to exist and cause problems, regardless of whether you allow ActiveX in your local intranet.</p>
<blockquote>
<p><i>Isn't there a risk that Microsoft would just disable those controls in future updates / versions ?</i></p>
</blockquote>
<p>Since XP-SP2, Microsoft has been making it increasingly difficult to use ActiveX controls. I don't know how many scary looking warning messages and "This might destroy your computer" dialogs you have to click through these days to get them to run, but it's quite a few. This will only get worse over time.</p>
|
<blockquote>
<p><i>The standard citrix homepage (or how we use it) is a simple web page with program icons. Click on it, and the application get's delivered to you. People want the same thing, at work, with their applications/folders/documents. And because I'm a web developer, and they asked me, I do it with a web page... Perhaps I should pass the whole thing over to the VB guy..</i></p>
</blockquote>
<p>Ahh... I know of 2 ways to accomplish this:</p>
<p>You can embed internet explorer into an application, and hook into it and intercept certain kinds of URL's and so on</p>
<p>I saw this done a few years ago - a telephony application embedded internet explorer in itself, and loaded some specially formatted webpages.</p>
<p>In the webpage there was this:</p>
<pre><code><a href="dial#1800-234-567">Call John Smith</a>
</code></pre>
<p>Normally this would be a broken URL, but when the user clicked on this link, the application containing the embedded IE got notified, and proceeded to execute it's own custom code to dial the number from the URL.</p>
<p>You could get your VB guy to write an application which basically just wraps IE, and has handlers for executing applications. You could then code normal webpages with links to just open applications, and the VB app would launch them. This allows you to write your own security stuff (like, only launch applications in a preset list, or so on) into the VB app, and because VB is launching them, not IE, none of the IE security issues will be involved.</p>
<p>The second way is with browser plug-ins.</p>
<p>For example, skype comes with a Firefox plug-in, which looks for phone-numbers in web-pages, and attaches special links to them. When you click on these links it invokes skype - you could conceivably do something similar for launching your citrix apps.</p>
<p>You'd then be tied to firefox though. Writing plugins for IE is <em>much</em> harder than for FF, I wouldn't go down that path unless forced to.</p>
| 5,177
|
<p>I need to run a JavaScript function onLoad(), but only do it if the page loaded the first time (i.e. is not the result of a postback).</p>
<p>Basically, I need to check for IsPostBack in JavaScript.</p>
<p>Thank you.</p>
|
<p>Server-side, write:</p>
<pre><code>if(IsPostBack)
{
// NOTE: the following uses an overload of RegisterClientScriptBlock()
// that will surround our string with the needed script tags
ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack", "var isPostBack = true;", true);
}
</code></pre>
<p>Then, in your script which runs for the onLoad, check for the existence of that variable:</p>
<pre><code>if(isPostBack) {
// do your thing
}
</code></pre>
<hr>
<p>You don't really need to set the variable otherwise, like Jonathan's solution. The client-side if statement will work fine because the "isPostBack" variable will be undefined, which evaluates as false in that if statement.</p>
|
<p>You can create a hidden textbox with a value of 0. Put the onLoad() code in a if block that checks to make sure the hidden text box value is 0. if it is execute the code and set the textbox value to 1.</p>
| 8,439
|
<p>Materials used in space need to not outgas significantly </p>
<p>An answer to this question: <a href="https://3dprinting.stackexchange.com/questions/91/would-3d-printed-objects-outgas-in-vacuum?newreg=63cb72665132436c92ff1a842afac664">Would 3d-printed objects outgas in vacuum?</a></p>
<p>referred to the NASA outgassing database which showed that ABS, PET, and PLA filaments are all fairly low outgassing and suitable for space application.</p>
<p>What I'm wondering is whether there are any 3D-printable plastics that are both suitable for space and also self-lubricating. Nylon is the obvious printable self-lubricating material, but I believe that it outgasses too much (I don't think NASA has tested nylon filament, at least I can't find it in the database). </p>
<p>My primary interest is in hobbyist-grade, FDM printers but if there are materials that can be commercially 3D printed, that is also of interest.</p>
<p>Any ideas?</p>
|
<p>If you have a makerspace in your area, you'll likely find individuals with reasonable mechanical skills suitable for simple kit assembly. Most kits are engineered to be reasonable assembly, not rocket surgery. Makers are by nature capable of construction, often from raw materials, and kits are typically not particularly challenging comparatively speaking.</p>
<p>Resin 3D printers are also simple in construction, as the component count is less than that of an FDM printer, or quite close in count. SLA designs involve laser modules, mirrors and alignment, while DLP designs involve light projection and light masking. Both designs involve vats and movement mechanics.</p>
<p>Even if you do not have a makerspace local to you, consider to contact one that might be nearer than farther away, as those spaces may have leads for you to locate a suitable victim/candidate.</p>
<p>Our local library makerspace often farms out contacts to me or other makers with the necessary skills to meet a patron's requirements.</p>
|
<p>I agree that a local makerspace is a good option, but I will say this...</p>
<p>Buying a kit and building it yourself, even with some frustration and learning curves, will help immensely with your ability to calibrate and troubleshoot issues later. If someone else builds it for you, chances are if something goes wrong, you'll need to seek out that person for help fixing things.</p>
<p>I just recently bought my first 3D printer (FDM) as a kit. Building it was a slight learning curve - I'm a technophile and have built things with Arduino before, but never a printer and the specifics that come along with it. Getting it to actually print reliably took me about two weeks. However, I'm MUCH more confident now to take care of issues as they arise, and keep it running smoothly. The value of this experience can not be overstated.</p>
| 720
|
<p>I want to put a spiral lid on top of a container. When the lid opens, then the spiral mechanism will rotate into the container. Is there a name for this mechanism? If not, would something like this be possible?</p>
|
<p>It sounds like you're talking about an <a href="https://en.wikipedia.org/wiki/Diaphragm_(optics)" rel="nofollow noreferrer">iris diaphragm</a>. This has many parts that slide against each other, and would best be printed as separate parts, then assembled.</p>
|
<p>No spiral lids that I know of. I'm not sure how they would work, anyway. There are plenty of designs with hemispherical lids -- so-called "Venus" boxes. Check Yeggi:</p>
<p><a href="https://www.yeggi.com/q/venus+box/" rel="nofollow noreferrer">Yeggi : Venus box</a></p>
| 1,599
|
<p>I hope I can explain this clearly enough, but if not let me know and I'll try to clarify.</p>
<p>I'm currently developing a site using ColdFusion and have a mod_rewrite rule in place to make it look like the site is using PHP. Any requests for index.php get processed by index.cfm (the rule maps *.php to *.cfm).</p>
<p>This works great - so far, so good. The problem is that I want to return a 404 status code if index.cfm (or any ColdFusion page) is requested directly.</p>
<p>If I try to block access to *.cfm files using mod_rewrite it also returns a 404 for requests to *.php.</p>
<p>I figure I might have to change my Apache config rather than use .htaccess</p>
|
<p>You can use the <code>S</code> flag to skip the <code>404</code> rule, like this:</p>
<pre><code>RewriteEngine on
# Do not separate these two rules so long as the first has S=1
RewriteRule (.*)\.php$ $1.cfm [S=1]
RewriteRule \.cfm$ - [R=404]
</code></pre>
<p>If you are also using the <code>Alias</code> option then you should also add the <code>PT</code> flag. See the <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" rel="nofollow noreferrer">mod_rewrite documentation</a> for details.</p>
|
<p>Post the rules you already have as a starting point so people don't have to recreate it to help you.</p>
<p>I would suggest testing [L] on the rule that maps .php to .cfm files as the first thing to try.</p>
| 3,032
|
<p>Given a string of JSON data, how can I safely turn that string into a JavaScript object?</p>
<p>Obviously I can do this unsafely with something like:</p>
<pre><code>var obj = eval("(" + json + ')');
</code></pre>
<p>but that leaves me vulnerable to the JSON string containing other code, which it seems very dangerous to simply eval.</p>
|
<p><a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" rel="noreferrer"><code>JSON.parse(jsonString)</code></a> is a pure JavaScript approach so long as you can guarantee a reasonably modern browser.</p>
|
<p>Try this. This one is written in typescript.</p>
<pre><code>export function safeJsonParse(str: string) {
try {
return JSON.parse(str);
} catch (e) {
return str;
}
}
</code></pre>
| 6,681
|
<p>I would like to get data from from different webpages such as addresses of restaurants or dates of different events for a given location and so on. What is the best library I can use for extracting this data from a given set of sites? </p>
|
<p>If using python, take a good look at Beautiful Soup (<a href="http://crummy.com/software/BeautifulSoup" rel="noreferrer">http://crummy.com/software/BeautifulSoup</a>).</p>
<p>An extremely capable library, makes scraping a breeze.</p>
|
<p>What language do you want to use?</p>
<p>curl with awk might be all you need.</p>
| 9,263
|
<p>Probably the question sounds a little strange; however, I am looking for a filament which is breakable and not so steady and reliable as PLA. I want to print parts similar to the following gears for instance (They are from Lego, a children's toy). <a href="https://i.stack.imgur.com/dsvt3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dsvt3.png" alt="enter image description here"></a></p>
<p>They should break after some time or in any way become unusable after an accidental period (1 minute to several days) of use. Yes, you read right: I want to print parts that are frangible and probably will break! I plan to use Ultimaker 3 as 3D printer. So I'm looking for a suitable filament. Maybe I can merge two types of filament?</p>
<p>Could Ultimaker's TPU filament (<a href="https://ultimaker.com/en/products/materials/tpu-95a" rel="nofollow noreferrer">https://ultimaker.com/en/products/materials/tpu-95a</a>) be useful for my purpose? Or can anybody recommend me another filament that can be useful for my intended use? The primary purpose is that the printed part is not stable enough to serve its original purpose for longer than a foreseeable time (1 minute to several days). I appreciate your advice and ideas.</p>
<hr>
<p>Note: I don't want to sell them; I want to use them for my <strong>private</strong> project. So please no legal issues. They are not helpful for my question. I don't ask for legal advice.</p>
|
<h2>deliberate/planned obsolescence is the term you look for</h2>
<p>If you design parts that break after some time, you plan their obsolescence. That you do by a deliberate choice of material and working conditions. Designing a part that will break after a certain time can be done by choosing the correct stresses that will make your chosen material break.</p>
<p>In a gear that is meant to break at certain stress, one can weaken the teeth or the sprues, so that normal operation stresses will very likely break the safety margin and destroy the gear.</p>
<h2>is it a material choice?</h2>
<p>Any material is suitable to make a planned break, as long as <em>the design</em> is suitable. Performing a stress analysis of your part will tell you where to weaken it to enforce it will break - if the part was solid. As printed parts in FDM aren't solid, take the result with salt - it will tell <em>where</em> but not <em>when</em> it fails. Do the experiment for actual numbers.</p>
<h2>is it a print setting thing?</h2>
<p>Besides deliberately under-engineering some part of the gear, a usually perfectly fine gear would lose a lot of strength by deliberately reducing how massive it is: the stability of a print is affected by the form and amount of the infill just as much as the number of shells. Some random setting examples:</p>
<ul>
<li>1-shelled, 1-bottom/top-layer, 5% infill piece is very likely so fragile you might not get it off the build plate</li>
<li>these parameters at 2-5-10% results in a somewhat durable piece.</li>
<li>2-5-20% is more than twice as strong as 2-5-10%.</li>
</ul>
<p>To find the exact breaking point of a setup, one might need to toy with the parameters and experiment. It might be interesting to use no top- or bottom-layers and thus turn to create all the <em>spokes</em> of the gear in the shape of infill and outer shell. Also, some infills are better at withstanding forces than others - for example, Gyroid or Hex infill is rather stable on pressure while spaghetti is quite weak.</p>
<p>Other parameters also can change the infill stability: speeding up the print of the infill compared to the shell and using a thinner line considerably weakens the infill, thus reducing the needed load to break it. This is a somewhat easy parameter to tweak if you want to go for breaking the spokes (see below).</p>
<h2>planned obsolescence and how to under-engineer safely</h2>
<p>Sometimes, planned destruction is good for safety: a safety valve is supposed to break under overpressure to release the pressure in a safe way.</p>
<p>But planned obsolescence can also be a safety risk: If a toy breaks under normal use, it is a safety hazard for the broken off parts can be swallowed by children. Another factor to look at is where broken off parts end up in the machinery - they might jam other pieces that are not meant to self-destruct and destroy them.</p>
<ul>
<li>Design the pieces to break in a safe way - the larger the chunks, the better you prevent them from going into places they should not.</li>
<li>Design the teeth to deform or melt rather than shearing off</li>
<li>Design the axles to sheer free by losing their keying</li>
<li>Design the spokes of the gears to break, separating gear rim from axle & hub, either of which goes nowhere due to the other gears and the mounting</li>
<li>Encase the self-destruct gears in some sort of gearbox to prevent the pieces from going flying</li>
</ul>
<p>Industrial machinery design usually goes the melting way: Let's take a hand mixer. It contains a gearset that has one drive gear connected to a second gear, so that both mixers spin opposite. Under normal use, these spin pretty fast, creating heat from the friction. In a good design, these two gears are made from metal or a high heat tolerant polymer. But if one plans for having them break, these gears are made from a material that will heat under the friction in such a way, that after a set time (around 5 minutes), the teeth will be sufficiently weakened to deform and grind away, destroying them in the process.</p>
<h2>Preferred Material</h2>
<p>I would actually deliberately under-design the gears for the expected loads and then go for a solid material printed in SLA or SLS from either a resin (which will break with pieces and bits going flying, so a gearbox is mandatory!) or a polyamide (nylon). These parts would match the stress analysis fully.</p>
<p>If FDM is the only option, the material choice depends on the failure mode you opted for:</p>
<ul>
<li>In case you opt for destruction from heat on the teeth or axle, a low melting material like PLA is perfectly fine, but make sure to engineer the chance of breaking teeth low. ABS can perform a little better but needs more heat (and thus more RPM) to self destruct.</li>
<li>In case of designing for a breaking failure of spokes or keying, PLA is an excellent choice, as it is sufficiently brittle.</li>
<li>PETG is a good compromise between ABS deformability and PLA's printing ease.</li>
</ul>
<hr />
<h3>Footnotes</h3>
<p>Gear Design<br><sup>When designing your gears, keep in mind that gears are rather complicated. I actually advise to take a look on the gross oversimplification of <a href="https://www.youtube.com/watch?v=Q-XOM4E4RZQ" rel="nofollow noreferrer">This Old Tony</a> because it allows you to see where you can make teeth break very easily by design!</sup></p>
<p>planned obsolescence and consumer rights<br><sup>While planned obsolescence can be an important safety factor, planning obsolescence in consumer products for sale to break them after a calculated time is unethical and can be a <a href="https://www.twobirds.com/en/news/articles/2018/global/planned-obsolescence-and-consumers-rights" rel="nofollow noreferrer">consumer rights violation.</a> Remember, that legally demanded warranty and a right to repair exist in <a href="https://equiterre.org/en/news/legislation-against-obsolescence" rel="nofollow noreferrer">a lot of countries.</a></sup></p>
<p>LEGO is Copyrighted, Patented and Trademarked<br><sup>Copying Lego designs would be a Trademark Violation, Patent infringement <strong>and</strong> a <a href="https://www.copyright.gov/circs/circ15a.pdf" rel="nofollow noreferrer">copyright</a> violation by using their designs. They <a href="https://www.beemlaw.com/billion-dollar-lego-patent/" rel="nofollow noreferrer">protect</a> them.</sup></p>
|
<p>This metod will be difficult with gears but doable. Print cold and slightly under extruded. This will cause part to fail in layers. You may need to print the part on side to ensure a non functioning gear. Use PLA or PETG. Breaking TPU is next to impossible.</p>
| 1,197
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.