instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I'm going to build an API for a web app and I'm interested in what people can suggest as good practices.</p> <p>I'm already planning to make it versioned (version 1 can only control certain aspects of the system, version 2 could control more, but this may need a change in the way authentication is performed that would be incompatible with version 1), and the authentication will be distinct from the standard username/password people use to log in (if someone does use a malicious tool it won't open them up to full impersonation, just whatever the api allows).</p> <p>Does anyone have further ideas, or examples of sites with particularly good APIs you have used?</p>
<p>Read the <a href="http://www.crummy.com/writing/RESTful-Web-Services/" rel="noreferrer">RESTful Web Services</a> book, which give you a good overview of how to use REST in practice, and get to up to speed quickly enough to get started now, with some confidence. This is more useful than just looking at an existing API, because it also discusses design choices and trade-offs.</p>
<p>Use REST.</p> <p>Read up on standards for APIs, or copy the ideas from one of the popular ones.</p> <p>Be careful when authenticating users.</p> <p>Start very very simple.</p> <p>Build a site that uses your API (even if it's not useful) to check things work. Perhaps you could build a mobile version of the site or something that forces you to use the API in a lot of depth.</p>
5,380
<p>This is a problem I have seen other people besides myself having, and I haven't found a good explanation.</p> <p>Let's say you have a maintenance plan with a task to check the database, something like this:</p> <pre><code>USE [MyDb] GO DBCC CHECKDB with no_infomsgs, all_errormsgs </code></pre> <p>If you go look in your logs after the task executes, you might see something like this:</p> <pre><code>08/15/2008 06:00:22,spid55,Unknown,DBCC CHECKDB (mssqlsystemresource) executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds. 08/15/2008 06:00:21,spid55,Unknown,DBCC CHECKDB (master) executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds. </code></pre> <p>Instead of checking MyDb, it checked master and msssqlsystemresource.</p> <p>Why?</p> <p>My workaround is to create a Sql Server Agent Job with this:</p> <pre><code>dbcc checkdb ('MyDb') with no_infomsgs, all_errormsgs; </code></pre> <p>That always works fine.</p> <pre><code>08/15/2008 04:26:04,spid54,Unknown,DBCC CHECKDB (MyDb) WITH all_errormsgs&lt;c/&gt; no_infomsgs executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 26 minutes 3 seconds. </code></pre>
<p>For starters, always remember that <code>GO</code> is not a SQL keyword; it is merely a batch separator that is (generally) implemented/recognized by the client, not the server. So, depending on context and client, there really is no guarantee that the current database is preserved between batches.</p>
<p>You have a check datasbase integrity task and you double-clicked it choose MyDb and when the plan runs it only checks master?? weird. Are you sure you don't another plan running? </p>
3,335
<p>I'd like to add dvd burning functionality to my .Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft has created an IMAPI2 upgrade for Windows XP/2003 and there is an <a href="http://www.codeproject.com/KB/miscctrl/imapi2.aspx" rel="nofollow noreferrer">example project</a> at CodeProject but not having used it myself I can't say how easy/reliable it is to use.</p> <p>I'm not really worried about burning audio/video to DVD as this is for file backup purposes only.</p>
<p>I've used the code from the codeproject <a href="http://www.codeproject.com/KB/miscctrl/imapi2.aspx" rel="nofollow noreferrer">article</a> and it works pretty well. It's a nice wrapper around the IMAPI2, so as longs as IMAPI2 supports what you need to do, the .NET wrapper will do it.</p>
<p>Did your cdrecord methodology support dvd burning? And is there an easy way to redistribute/install cygwin with an application? StarBurn looks pretty good at first glance, although I'm a little hesitant to go with unproven libraries that have to handle something this complicated (especially with the number of types of media out there now) and the StarBurn portfolio page is a bit on the fluffy side.</p>
5,292
<p>How can I print an embossed image in a concaved shape?</p> <p>Like a big saucer. I will use this an a mold for a project.</p> <p>So far I've found lots of software with huge spread of features. It's sort of overwhelming. There is lots of ways to create images into 3D printable objects but to add the extra step and concaving that image is harder to find out.</p> <p>How would you do it? I'm open to suggestions.</p> <p>I'm new to 3D printing and would really appreciate the help.</p>
<p>What you describe, sounds like you want to create a lithophane; a pattern etched or engraved on a thin translucent base material (in your case a bowl) that can only be seen clearly when backlit with a light source behind it. Apparently you want to use it for another purpose.</p> <p>Special software and or scripts that transform the image to the base material exist. An example is e.g. <a href="https://www.thingiverse.com/thing:2770219" rel="nofollow noreferrer">this sphere which becomes a globe when lit from the inside</a>. Recommending a tool for creating such bowl is a little <a href="https://3dprinting.meta.stackexchange.com/questions/357/are-shopping-questions-on-topic-for-the-site">out of scope</a> as these types of questions become outdated very quickly as technology changes or tools cease to exist. With the provided information you should be able to find software that is able to provide what you want to do.</p>
<p>You may want to look up <a href="https://3dp.rocks/lithophane/" rel="nofollow noreferrer">https://3dp.rocks/lithophane/</a> it lets you do things like that</p>
1,349
<p>I need to create an ASP page (classic, not ASP.NET) which runs remote shell scripts on a UNIX server, then captures the output into variables in VBScript within the page itself.</p> <p>I have never done ASP or VBScipt before. I have tried to google this stuff, but all I find are references to remote server side scripting, nothing concrete. </p> <p>I could really use:</p> <ol> <li>An elementary example of how this could be done.</li> <li>Any other better alternatives to achieve this in a secure manner.</li> </ol> <hr> <p>Are there any freeware/open source alternatives to these libraries? Any examples?</p>
<p>You'll want Win32's GetComputerName:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms724295(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms724295(VS.85).aspx</a></p>
<p>I agree with Pascal on using winsock's gethostname() function. Here you go:</p> <pre><code>#include &lt;winsock2.h&gt; //of course this is the way to go on windows only #pragma comment(lib, "Ws2_32.lib") void GetHostName(std::string&amp; host_name) { WSAData wsa_data; int ret_code; char buf[MAX_PATH]; WSAStartup(MAKEWORD(1, 1), &amp;wsa_data); ret_code = gethostname(buf, MAX_PATH); if (ret_code == SOCKET_ERROR) host_name = "unknown"; else host_name = buf; WSACleanup(); } </code></pre>
3,231
<p>I recently started a new webforms project and decided to separate the business classes from any DBML references. My business layer classes instead access discrete Data layer methods and are returned collections of DTO's. So the data layer might project DTO's like the following:</p> <pre><code>(from c in dataContext.Customers where c.Active == true select new DTO.Customer { CustomerID = c.CustomerID, Name = c.CustomerName, ... }).ToList() </code></pre> <p>Although building the DTO objects adds work, this feels like a better approach to a tight binding between Business &amp; Data layers and means I can test the Business layer without a database being present.</p> <p>My question is, is this good practice?, Is there a way of generating the DTO's (maybe via SQLMetal), and what other problems might I strike as the project progresses.</p>
<p>I don't know if it's best practice but I have written similar code in the not so recent past because I too felt that I could improve the separation of concerns by using my own classes instead of the LINQ-designer-generated ones within my application.</p> <p>You may want to consider just returning an IQueryable&lt;Customer&gt; instead of an IList&lt;Customer&gt; from your data-access method. Since IQueryable&lt;T&gt; inherits from IEnumerable&lt;T&gt; the rest of your app should be able to deal with it quite well. You can also convert it to a List when you really need to.</p> <p>The advantage of this is that you can dynamically modify your query quite easily and minimze the amount of data returned from SQL Server.</p> <p>E.g. if your method signature is IQueryable&lt;Customer&gt; GetCustomers() you could get a single customer by calling GetCustomers().Where(c => c.CustomerID == 101).Single();</p> <p>In this example only one record would be returned from the database whereas I imagine currently your code would return either all customers or you'd be required to write separate methods (and thus very repetitive code) to cater for all the different things you may want to filter by.</p>
<p>In my opinion in most cases DTO objects are not needed when dealing with LINQ. Generated LINQ classes can be easily tested. LINQ gives you ability to query your data from different sources using identical queries. It gives you ability to test your queries against lists of objects instead of real db.</p>
7,413
<p>If you've ever used Eclipse, you've probably noticed the great keyboard shortcuts that let you hit a shortcut key combination, then just type the first few characters of a function, class, filename, etc. It's even smart enough to put open files first in the list.</p> <p><img src="https://i.stack.imgur.com/aLKhF.png" alt="alt text"></p> <p>I'm looking for a similar functionality for Visual Studio 2008. I know there's a findfiles plugin on codeproject, but that one is buggy and a little weird, and doesn't give me access to functions or classes.</p>
<p>Vs11 (maybe 2010 had it too) has the Navigate To... functionality which (on my machine) has the <kbd>Ctrl</kbd>+<kbd>,</kbd> shortcut.</p> <p>By the way it understands capitals as camelcase-shortucts (eclipse does so too). For instance type HH to get HtmlHelper.</p>
<p>I have been using biterScripting along with Visual Studio to do more flexible searching and manipulation.</p> <ol> <li><p>It can search the entire workspace.</p></li> <li><p>It can search within any project - EVEN IF THAT PROJECT IS NOT LOADED OR EVEN PART OF A WORKSPACE.</p></li> <li><p>It can find things using regular expressions.</p></li> <li><p>AND, ABOVE ALL, it can make bulk changes. For example, want to change the name of a class from CCustomer to CUser, I can do it in just a few command lines - Actually, I have written scripts for things like this I do often. I DON'T HAVE TO CLICK ON EACH INSTANCE AND MANUALLY DO THE CHANGE.</p></li> <li><p>And, it is inexpensive ($0). I downloaded it from <a href="http://www.biterscripting.com" rel="nofollow noreferrer">http://www.biterscripting.com</a> .</p></li> </ol>
2,523
<p>I've been asked to come up with a grant proposal for a new 3D printer. My question is:</p> <blockquote> <p>What supporting components and training would be most beneficial to support educational use in a K-8 school? In other words what things am I missing in my list below? </p> </blockquote> <p>Specific suggestions for things on my list that I may not have thought of are welcome too. A specific tool, etc.</p> <p>The suggestion was to include a base proposal with stretch goals that include everything needed. </p> <p>My current ideas are:</p> <ul> <li>3D Printer - option of a Prusa Mk3 or a Railcore 300ZLT. Possibly add another Prusa Mk3 kit as a stretch goal for students to assemble.</li> <li>Replacement and optional parts such as a hardened nozzle.</li> <li>Training and professional development</li> <li>Filament - a variety of kinds such as PLA, ABS, flexible, conductive, etc.</li> <li>Dry box or supplies to make one.</li> <li>HEPA filter.</li> <li>Enclosure - heated and/or soundproofed.</li> <li>Maintenance tools or supplies. Lubricant, etc.</li> </ul>
<p>Typically the black pigments in polymers are mineral based. If you are having true WiFi issues then it sounds like your filiment is using black iron oxide also called <a href="https://en.wikipedia.org/wiki/Magnetite" rel="nofollow noreferrer">magnetite</a> for the black pigment. This is the same material they use in radar absorbing paints which would make sense as to why you are having radio related issues.</p>
<p>Typically the black pigments in polymers are mineral based. If you are having true WiFi issues then it sounds like your filiment is using black iron oxide also called <a href="https://en.wikipedia.org/wiki/Magnetite" rel="nofollow noreferrer">magnetite</a> for the black pigment. This is the same material they use in radar absorbing paints which would make sense as to why you are having radio related issues.</p>
1,263
<p>Let's say I have a web page that currently accepts a single ID value via a url parameter:<br> <a href="http://example.com/mypage.aspx?ID=1234" rel="nofollow noreferrer">http://example.com/mypage.aspx?ID=1234</a></p> <p>I want to change it to accept a <em>list</em> of ids, like this:<br> <a href="http://example.com/mypage.aspx?IDs=1234,4321,6789" rel="nofollow noreferrer">http://example.com/mypage.aspx?IDs=1234,4321,6789</a></p> <p>So it's available to my code as a string via <em>context.Request.QueryString["IDs"].</em> What's the best way to turn that string value into a List&lt;int>?</p> <p><strong>Edit:</strong> I know how to do .split() on a comma to get a list of strings, but I ask because I don't know how to easily convert that string list to an int list. This is still in .Net 2.0, so no lambdas.</p>
<p>No offense to those who provided clear answers, but many people seem to be answering your question instead of addressing your problem. You want multiple IDs, so you think you could this this:</p> <p><a href="http://example.com/mypage.aspx?IDs=1234,4321,6789" rel="noreferrer">http://example.com/mypage.aspx?IDs=1234,4321,6789</a></p> <p>The problem is that this is a non-robust solution. In the future, if you want multiple values, what do you do if they have commas? A better solution (and this is perfectly valid in a query string), is to use multiple parameters with the same name:</p> <p><a href="http://example.com/mypage.aspx?ID=1234;ID=4321;ID=6789" rel="noreferrer">http://example.com/mypage.aspx?ID=1234;ID=4321;ID=6789</a></p> <p>Then, whatever query string parser you use should be able to return a list of IDs. If it can't handle this (and also handle semi-colons instead of ampersands), then it's broken.</p>
<p>You can use string.Split() to split the values once you have extracted them from the URL.</p> <pre><code>string[] splitIds = ids.split(','); </code></pre>
8,893
<p>I want to serve a lot of big files in a Plone site. By big files I mean around 5MB (music) and a lot of them. I've already do it straight to the ZODB, not a good idea. I'm running Plone 3.1.1 and Zope 2.10.6.</p>
<p>Zodb blob support is the best, most integrated way to deal with large files. Big files are stored transparently on the filesytem instead of in the zodb object database. "Transparently" in this case means that you won't notice it in your actual programming work after initial configuration.</p> <p>The blob functionality has been backported to current (halfway 2008) zope versions and can be used in plone 3. Use plone.app.blob in your project for this: <a href="http://plone.org/products/plone.app.blob" rel="noreferrer">http://plone.org/products/plone.app.blob</a>.</p>
<p>I have plone.app.blob installed on some low-traffic sites and installable (ready to roll, if you like) for my busier production sites in the same instance.</p> <p>There's the 4.0 milestone but I'll certainly review (and probably click the install button for plone.app.blob on my production sites) around 3.4 time. </p> <p>A couple of references: </p> <p><a href="http://n2.nabble.com/PLIPs-I%27d-love-to-see-for-Plone-3.3-tp1123218p1130015.html" rel="nofollow noreferrer">http://n2.nabble.com/PLIPs-I%27d-love-to-see-for-Plone-3.3-tp1123218p1130015.html</a></p> <p><a href="http://dev.plone.org/plone/ticket/8629#comment:2" rel="nofollow noreferrer">http://dev.plone.org/plone/ticket/8629#comment:2</a> highlight</p> <blockquote> <p>… 3.4, when we'll probably have blob filestorage specification support added to plone.recipe.zeoserver and zope2instance. That will give us a standard location for whatever owner/permission fixups the installers need to make.</p> </blockquote> <p>In context: I'm playing <em>roughly</em> with plone.app.blob and a very mixed bag of other add-on products with versions 3.1.7 and 3.2a1 of Plone based on standard and experimental installers. In these environments, <em>without</em> me treating things with kid gloves, Plone sies behave remarkably well and when (as expected) experiments lead to oddities, the support from the community is paced and proper.</p>
8,993
<p>When desinging UI for mobile apps in general which resolution could be considered safe as a general rule of thumb. My interest lies specifically in web based apps. The iPhone has a pretty high resolution for a hand held, and the Nokia E Series seem to oriented differently. Is <strong>240×320</strong> still considered safe?</p>
<p>Not enough information...</p> <p>You say you're targeting a "Mobile App" but the reality is that mobile could mean anything from a cell phone with 128x128 resolution to a MID with 800x600 resolution.</p> <p>There is no "safe" resolution for such a wide range, and if you're truly targeting all of them you need to design a custom interface for each major resolution. Add some scaling factors in and you might be able to cut it down to 5-8 different interface designs.</p> <p>Further, the UI means "User Interface" and includes a lot more than just the resolution - you can't count on a touchscreen, full keyboard, or even software keys.</p> <p>You need to either better define your target, or explain your target here so we can better help you.</p> <p>Keep in mind that there are millions of phone users that don't have PDA resolutions, and you can really only count on 128x128 or better to cover the majority of technically inclined cell phone users (those that know there's a web browser in their phone, nevermind those that use it).</p> <p>But if you're prepared to accept these losses, go ahead and hit for 320x240 and 240x320. That will give you most current PDA phones and up (older blackberries and palm devices had smaller square orientations). Plan on spending time later supporting lower resolution devices and above all...</p> <p><em>Do not tie your app to a particular resolution.</em></p> <p>Make sure your app is flexible enough that you can deploy new UI's without changing internal application logic - in other words separate the presentation from the core logic. You will find this very useful later - the mobile world changes daily. Once you gauge how your app is being used you can, for instance, easily deploy an iPhone specific version that is pixel perfect (and prettier than an upscaled 320x240) in order to engage more users. Being able to do this in a few hours (because you don't have to change the internals) is going to put you miles ahead of the competition if someone else makes a swipe at your market.</p> <p>-Adam</p>
<p>You mentioned Web based apps. Any particular framework you have in mind?</p> <p>In many cases, <a href="http://wurfl.sourceforge.net/index.php" rel="nofollow noreferrer">WALL</a> seems to help to large extent.</p> <p>Here's one Article, <a href="http://www.packtpub.com/article/adapting-user-devices-mobile-web-technology" rel="nofollow noreferrer">Adapting to User Devices Using Mobile Web Technology</a> exploiting WALL.</p>
4,762
<p>Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()):</p> <pre><code>Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Timer End Sub </code></pre> <p>I know it's not very useful code, but it demonstrates the ease with which control arrays can be used in VB6. What is the simplest equivalent in C# or VB.NET?</p>
<p>Make a generic list of textboxes:</p> <pre><code>var textBoxes = new List&lt;TextBox&gt;(); // Create 10 textboxes in the collection for (int i = 0; i &lt; 10; i++) { var textBox = new TextBox(); textBox.Text = "Textbox " + i; textBoxes.Add(textBox); } // Loop through and set new values on textboxes in collection for (int i = 0; i &lt; textBoxes.Count; i++) { textBoxes[i].Text = "New value " + i; // or like this var textBox = textBoxes[i]; textBox.Text = "New val " + i; } </code></pre>
<p>Make an array of controls.</p> <pre><code>TextBox[] textboxes = new TextBox[] { textBox1, textBox2, textBox3 }; </code></pre>
6,063
<p>What do <code>*args</code> and <code>**kwargs</code> mean?</p> <pre><code>def foo(x, y, *args): def bar(x, y, **kwargs): </code></pre>
<p>The <code>*args</code> and <code>**kwargs</code> is a common idiom to allow arbitrary number of arguments to functions as described in the section <a href="http://docs.python.org/3/tutorial/controlflow.html#more-on-defining-functions" rel="noreferrer">more on defining functions</a> in the Python documentation.</p> <p>The <code>*args</code> will give you all function parameters <a href="https://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists" rel="noreferrer">as a tuple</a>:</p> <pre><code>def foo(*args): for a in args: print(a) foo(1) # 1 foo(1,2,3) # 1 # 2 # 3 </code></pre> <p>The <code>**kwargs</code> will give you all <strong>keyword arguments</strong> except for those corresponding to a formal parameter as a dictionary.</p> <pre><code>def bar(**kwargs): for a in kwargs: print(a, kwargs[a]) bar(name='one', age=27) # name one # age 27 </code></pre> <p>Both idioms can be mixed with normal arguments to allow a set of fixed and some variable arguments:</p> <pre><code>def foo(kind, *args, **kwargs): pass </code></pre> <p>It is also possible to use this the other way around:</p> <pre><code>def foo(a, b, c): print(a, b, c) obj = {'b':10, 'c':'lee'} foo(100,**obj) # 100 10 lee </code></pre> <p>Another usage of the <code>*l</code> idiom is to <strong>unpack argument lists</strong> when calling a function.</p> <pre><code>def foo(bar, lee): print(bar, lee) l = [1,2] foo(*l) # 1 2 </code></pre> <p>In Python 3 it is possible to use <code>*l</code> on the left side of an assignment (<a href="http://www.python.org/dev/peps/pep-3132/" rel="noreferrer">Extended Iterable Unpacking</a>), though it gives a list instead of a tuple in this context:</p> <pre><code>first, *rest = [1,2,3,4] first, *l, last = [1,2,3,4] </code></pre> <p>Also Python 3 adds new semantic (refer <a href="https://www.python.org/dev/peps/pep-3102/" rel="noreferrer">PEP 3102</a>):</p> <pre><code>def func(arg1, arg2, arg3, *, kwarg1, kwarg2): pass </code></pre> <p>For example the following works in python 3 but not python 2:</p> <pre><code>&gt;&gt;&gt; x = [1, 2] &gt;&gt;&gt; [*x] [1, 2] &gt;&gt;&gt; [*x, 3, 4] [1, 2, 3, 4] &gt;&gt;&gt; x = {1:1, 2:2} &gt;&gt;&gt; x {1: 1, 2: 2} &gt;&gt;&gt; {**x, 3:3, 4:4} {1: 1, 2: 2, 3: 3, 4: 4} </code></pre> <p>Such function accepts only 3 positional arguments, and everything after <code>*</code> can only be passed as keyword arguments.</p> <h3>Note:</h3> <ul> <li>A Python <code>dict</code>, semantically used for keyword argument passing, are arbitrarily ordered. However, in Python 3.6, keyword arguments are guaranteed to remember insertion order.</li> <li>&quot;The order of elements in <code>**kwargs</code> now corresponds to the order in which keyword arguments were passed to the function.&quot; - <a href="https://docs.python.org/3/whatsnew/3.6.html" rel="noreferrer">What’s New In Python 3.6</a></li> <li>In fact, all dicts in CPython 3.6 will remember insertion order as an implementation detail, this becomes standard in Python 3.7.</li> </ul>
<ul> <li><code>def foo(param1, *param2):</code> is a method can accept arbitrary number of values for <code>*param2</code>,</li> <li><code>def bar(param1, **param2):</code> is a method can accept arbitrary number of values with keys for <code>*param2</code></li> <li><code>param1</code> is a simple parameter.</li> </ul> <p>For example, the syntax for implementing <strong>varargs</strong> in Java as follows:</p> <pre><code>accessModifier methodName(datatype… arg) { // method body } </code></pre>
5,751
<p>I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.</p> <p>I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609</p> <p><a href="https://stackoverflow.com/questions/59205/enhancing-stackoverflow-user-experience">This</a> is the full script that I'm trying to modify, changing:</p> <pre><code>window.addEventListener ("load", doStuff, false); </code></pre> <p>to</p> <pre><code>window.addEventListener ("DOMContentLoaded", doStuff, false); </code></pre>
<p>So I googled <a href="http://www.google.com/search?q=greasemonkey%20dom%20ready" rel="noreferrer">greasemonkey dom ready</a> and the <a href="http://www.sitepoint.com/article/beat-website-greasemonkey/" rel="noreferrer">first result</a> seemed to say that the greasemonkey script is actually running at "DOM ready" so you just need to remove the onload call and run the script straight away.</p> <p>I removed the <em><code>window.addEventListener ("load", function() {</code></em> and <em><code>}, false);</code></em> wrapping and it worked perfectly. It's <strong>much</strong> more responsive this way, the page appears straight away with your script applied to it and all the unseen questions highlighted, no flicker at all. And there was much rejoicing.... yea.</p>
<p>@Sam: yeah, I was trying the same:</p> <pre><code>// ==UserScript== // @name Stack Overflow highlight viewed questions // @namespace * // @include http://stackoverflow.com/questions // @include http://stackoverflow.com/questions?* // @include http://stackoverflow.com/questions // @include http://stackoverflow.com/questions?* // @version 0.55 (DOM-Ready instead of onload) // ==/UserScript== (function() { // Customizable items // var fav_tags = ["python", "database", "mysql"]; // Your favorite tags const UNSEEN_BACK_COLOR = "rgb(225,210,210)"; // Backcolor for the question already seen const FAV_TAG_BACK_COLOR = "rgb(210,210,225)"; // Backcolor for the favorite tags // Internal to the DOM // const QUESTION_URL = "http:\/\/stackoverflow.com\/questions\/([0-9]+)\/"; const QUESTION_URL = "http:\/\/stackoverflow.com\/questions\/([0-9]+)\/"; const TAG_PREFIX = "show questions tagged "; const SEEN_MARK = "x"; // var seen_q = []; var seen_q_str = ""; var seen_q_str = GM_getValue ("seen_q", ""); var seen_q = seen_q_str.split("|"); var fav_tags_str = GM_getValue ("fav_tags", "") var fav_tags = fav_tags_str.split(" ") var already_run = false; GM_registerMenuCommand ("Set favorite tags", askTags); // window.addEventListener ("DOMContentLoaded", doStuff, false); if (! doStuff()) { window.addEventListener ("load", doStuff, false); } function doStuff() { var elements = window.document.getElementsByTagName('A'); if (! elements || already_run) { return false; } else { already_run = true; } GM_log ("here"); for (elem = 0; elem &lt; elements.length; elem++) { if (elements[elem].href.match (QUESTION_URL)) { curr_q = RegExp.$1; // Already seen? if ((seen_q.length &lt; curr_q) || (seen_q [curr_q] != SEEN_MARK)) { elements[elem].style.backgroundColor = UNSEEN_BACK_COLOR; seen_q [curr_q] = SEEN_MARK; } // Is a favorite tag? node = elements[elem].parentNode.parentNode; for (tag = 0; tag &lt;= fav_tags.length; tag++) { if (node.innerHTML.match ("'" + fav_tags[tag] + "'")) { node.style.backgroundColor = FAV_TAG_BACK_COLOR; break; } } // return (0); } } seen_q_str = seen_q.join("|"); GM_setValue ("seen_q", seen_q_str); return true; } function askTags() { fav_tags_str = prompt("Favorite tags (separated by spaces)", fav_tags_str); GM_setValue ("fav_tags", fav_tags_str) } })(); </code></pre>
9,765
<p>My server already runs IIS on TCP ports 80 and 443. I want to make a centralized "push/pull" Git repository available to all my team members over the Internet.</p> <p>So I should use HTTP or HTTPS.</p> <p>But I cannot use Apache because of IIS already hooking up listening sockets on ports 80 and 443! Is there any way to publish a Git repository over <em>IIS</em>? Does Git use WebDAV?</p> <p><strong>Update.</strong> It seems that Git HTTP installation is read-only. That's sad. I intended to keep the stable branch on a build server and redeploy using a hook on push. Does anyone see a workaround besides using SVN for that branch?</p>
<p><strong>Bonobo Git Server</strong></p> <p><a href="https://bonobogitserver.com/" rel="noreferrer">https://bonobogitserver.com/</a></p> <hr> <p><strong>GitAspx</strong> - By Jeremy Skinner</p> <p><a href="https://github.com/JeremySkinner/git-dot-aspx/" rel="noreferrer">https://github.com/JeremySkinner/git-dot-aspx/</a></p> <p><a href="https://github.com/JeremySkinner/git-dot-aspx/downloads" rel="noreferrer">https://github.com/JeremySkinner/git-dot-aspx/downloads</a></p> <p><em>Install Instructions</em></p> <p><a href="https://www.jeremyskinner.co.uk/2010/10/19/gitaspx-0-3-available/" rel="noreferrer">https://www.jeremyskinner.co.uk/2010/10/19/gitaspx-0-3-available/</a></p> <hr> <p><strong>Git Web</strong></p> <p><a href="https://gitweb.codeplex.com/" rel="noreferrer">https://gitweb.codeplex.com/</a></p> <hr> <p><strong>WebGitNET</strong></p> <p><a href="https://github.com/otac0n/WebGitNet" rel="noreferrer">https://github.com/otac0n/WebGitNet</a></p> <hr> <p><strong><em>Alternatively ...</em></strong> (non-IIS, but highly recommend, free and open-source)</p> <p><strong>Gitea</strong> (fork of Gogs): <a href="https://gitea.io" rel="noreferrer">https://gitea.io</a></p> <p><strong>Gogs</strong>: <a href="https://gogs.io" rel="noreferrer">https://gogs.io</a></p> <p><strong>SCM Manager</strong> allows you to easily set up revision control endpoints for <strong>Git</strong>, <strong>Hg</strong>, and <strong>SVN</strong> under the same hosting process. HTTP/HTTPS is supported along with built-in user authentication.</p> <p><a href="https://www.scm-manager.org" rel="noreferrer">https://www.scm-manager.org</a><br> <a href="https://bitbucket.org/sdorra/scm-manager/" rel="noreferrer">https://bitbucket.org/sdorra/scm-manager/</a></p>
<p>Try this instruction that uses SCM-Manager and IIS: <a href="http://www.helicontech.com/articles/hosting-git-svn-and-hg-mercurial-repositories-on-windows-with-iis/" rel="nofollow">Hosting Git, SVN and Hg (Mercurial) repositories on Windows with IIS</a></p>
7,477
<p>I'm making a simple extra java app launcher for Eclipse 3.2 (JBuilder 2007-8) for internal use.</p> <p>So I looked up all the documentations related, including this one <a href="http://www.eclipse.org/articles/Article-Launch-Framework/launch.html" rel="nofollow noreferrer" title="The Launching Framework">The Launching Framework from eclipse.org</a> and have managed to make everything else working with the exception of the launch shortcut. </p> <p><img src="https://i.stack.imgur.com/8I8zw.jpg" alt="alt text"></p> <p>This is the part of my plugin.xml. </p> <pre><code> &lt;extension point="org.eclipse.debug.ui.launchShortcuts"&gt; &lt;shortcut category="mycompany.javalaunchext.launchConfig" class="mycompany.javalaunchext.LaunchShortcut" description="launchshortcutsdescription" icon="icons/k2mountain.png" id="mycompany.javalaunchext.launchShortcut" label="Java Application Ext." modes="run, debug"&gt; &lt;perspective id="org.eclipse.jdt.ui.JavaPerspective"&gt; &lt;/perspective&gt; &lt;perspective id="org.eclipse.jdt.ui.JavaHierarchyPerspective"&gt; &lt;/perspective&gt; &lt;perspective id="org.eclipse.jdt.ui.JavaBrowsingPerspective"&gt; &lt;/perspective&gt; &lt;perspective id="org.eclipse.debug.ui.DebugPerspective"&gt; &lt;/perspective&gt; &lt;/shortcut&gt; </code></pre> <p></p> <p>The configuration name in the category section is correct and the class in the class section, i believe, is correctly implemented. (basically copied from org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut)</p> <hr> <p>I'm really not sure if I'm supposed to write a follow-up here but let me clarify my question more. I've extended org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut. Plus, I've added my own logger to constructors and methods, but the class seems like it's never even instantiating.</p>
<p>I had to add <code>contextualLaunch</code> under <code>org.eclipse.debug.ui.launchShortcuts</code>.</p> <p>The old way seems like it's deprecated a long ago.</p> <p>For other people who are working on the same subject, you might want to extend <code>org.eclipse.ui.commands</code> and bindings, too.</p> <p>I cannot choose this answer but this is the answer that I (the questioner) was looking for.</p>
<p>You class should implement ILaunchShortcut. Check out the <a href="http://help.eclipse.org/help32/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/debug/ui/ILaunchShortcut.html" rel="nofollow noreferrer">Javadoc</a>. </p> <p>What exception are you getting? Check the error log.</p>
4,573
<p>My app has many controls on its surface, and more are added dynamically at runtime.</p> <p>Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc).</p> <p>What are your tips and tricks to improve WinForms app performance?</p>
<p>I know of two things you can do but they don't always apply to all situations.</p> <ol> <li><p>You're going to get better performance if you're using absolute positioning for each control (myNewlyCreatedButton.Location.X/Y) as opposed to using a flow layout panel or a table layout panel. WinForms has to do a lot less math trying to figure out where controls should be placed.</p></li> <li><p>If there is a single operation in which you're adding/removing/modifying a lot of controls, call "SuspendLayout()" on the container of the affected controls (whether it is a panel or the whole form), and when you're done with your work call "ResumeLayout()" on the same panel. If you don't, the form will have to do a layout pass each and every time you add/remove/modify a control, which cost a lot more time. see: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx</a></p></li> </ol> <p>Although, I'm not sure how these approaches could apply when resizing a window.</p>
<p>Are you making good use of <code>SuspendLayout()</code> and <code>ResumeLayout()</code>?</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx</a></p>
6,669
<p>The creation date of an executable linked in VS2005 is not set to the real creation-date of the <code>.exe</code> file. Only a complete re-build will set the current date, a re-link will not do it. Obviously the file is set to some date, which is taken from one of the project-files. </p> <p>So: is there a way to force the linker to set the creation-date to the real link-date? ­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Delete the executable as part of a pre-link event.</p> <p>Edit: Hah, I forgot about Explorer resetting the creation date if you name a file exactly the same as a file that was recently deleted.</p> <p>Why are you keying off the creation date anyway?</p>
<p>A complete rebuild will delete that file forcing the linker to create it, hence the reason it gets a new creation date. You could try disabling incremental linking under project properties (Linker | General). If that doesn't do it you could add a build event to delete the exe file and force it to create a new file each time. Both of these things could increase your build time.</p>
3,884
<p>How much do you rely on database transactions? </p> <p>Do you prefer small or large transaction scopes ? </p> <p>Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server side transactions or vice-versa? </p> <p>What about nested transactions? </p> <p>Do you have some tips&amp;tricks related to transactions ?</p> <p>Any gotchas you encountered working with transaction ?</p> <p>All sort of answers are welcome.</p>
<p>I always wrap a transaction in a using statement.</p> <pre><code>using(IDbTransaction transaction ) { // logic goes here. transaction.Commit(); } </code></pre> <p>Once the transaction moves out of scope, it is disposed. If the transaction is still active, it is rolled back. This behaviour fail-safes you from accidentally locking out the database. Even if an unhandled exception is thrown, the transaction will still rollback. </p> <p>In my code I actually omit explicit rollbacks and rely on the using statement to do the work for me. I only explicitly perform commits. </p> <p>I've found this pattern has drastically reduced record locking issues.</p>
<p>As Sara Chipps said, transaction is overkill for high traffic applications. So we should avoid it as much as possible. In other words, we use a <a href="http://queue.acm.org/detail.cfm?id=1394128" rel="nofollow noreferrer">BASE architecture</a> rather than ACID. Ebay is a typical case. Distributed transaction is not used at all in Ebay architecture. But for <a href="http://queue.acm.org/detail.cfm?id=1466448" rel="nofollow noreferrer">eventual consistency</a>, you have to do some sort of trick on your own.</p>
6,069
<p>I have inherited a large legacy ColdFusion app. There are hundreds of &lt;cfquery&gt;some sql here #variable#&lt;/cfquery&gt; statements that need to be parameterized along the lines of: &lt;cfquery&gt; some sql here &lt;cfqueryparam value="#variable#"/&gt; &lt;/cfquery&gt;</p> <p>How can I go about adding parameterization programmatically?</p> <p>I have thought about writing some regular expression or sed/awk'y sort of solution, but it seems like somebody somewhere has tackled such a problem. Bonus points awarded for inferring the sql type automatically.</p>
<p>There's a queryparam scanner that will find them for you on RIAForge: <a href="http://qpscanner.riaforge.org/" rel="nofollow noreferrer">http://qpscanner.riaforge.org/</a></p>
<p>I doubt that there is a solution that will fit your needs exactly. The only option I see is to write your own recursive search that builds a report for you or use one of the apps/scripts that people have listed above. Basically, you are going to have to edit each page or approve all of the automated changes.</p>
8,997
<p>I realize this issue (warping) has been repeatedly addressed on this site. I've just graduated to high-temp filaments (PC in particular). I don't know much of the physics of this. I'm wondering whether the degree to which the filament contracts is proportional to the amount that it cools. If the answer is yes, then wouldn't it suggest that a lower printing temperature might reduce warping-as the temperature interval over which the filament cools is smaller? Or perhaps the difference is negligible?</p> <p>Also, I see a lot of emphasis placed on good first layer adhesion. Is this still an issue if you are printing on a raft?</p>
<p>I can't address polycarbonate specifically, but can provide a general overview of the higher temperature filament considerations.</p> <p>Printing on a raft means that the adhesion temperature of the filament is accomplished. This temperature is the factor to be considered if you are thinking of dropping the printing temperature. If you drop below recommended minimums, you risk losing adhesion to the build plate and also inter-layer bonding. That alone means one should use caution when dropping printing temperatures. </p> <p>Printing with a raft usually means the model's individual parts have such a small footprint that they would not remain bonded to the build plate. Rafts are also used on printers with an uncertain planar surface or irregularities in the surface. That's not applicable to this question, generally speaking.</p> <p>Your question about contraction being proportional to the amount of cooling is perhaps misdirected. One could consider that the printing temperature is a manufacturer specified value and the cooled temperature would be generally considered room temperature. Room temperature would be addressed as a range, rather than a single value, but even as a range, there isn't going to be a big percentage of variation in the calculation involving the print temp/room temp.</p> <p>My experience with the higher temperatures is more related to the volume of material per cross section (in all three dimensions). A printed model of substantial height with a relatively small horizontal cross section (think cylinder) is likely to have much less distortion in the x/y plane and greater distortion along the z-axis. The mass of filament cooling in the z-direction generates greater force than the smaller mass on the x/y axes.</p> <p>Another factor in such thought processes is that layers are on the x/y axes and the strength of the extruded plastic is more homogeneous through the nozzle, while the z-direction creates inter-layer discontinuities, making warping and delamination easier.</p> <p>I've found that I can reduce (but not eliminate) warping and delamination if I am able to maintain chamber temperature for longer periods and reduce temperature slowly. Unfortunately, I have a semi-enclosed printer and the heat loss is dependent partly on the ambient air temperature. A fully enclosed heated printer with auxiliary heating under some form of control may give you the best results.</p>
<p>I can't address polycarbonate specifically, but can provide a general overview of the higher temperature filament considerations.</p> <p>Printing on a raft means that the adhesion temperature of the filament is accomplished. This temperature is the factor to be considered if you are thinking of dropping the printing temperature. If you drop below recommended minimums, you risk losing adhesion to the build plate and also inter-layer bonding. That alone means one should use caution when dropping printing temperatures. </p> <p>Printing with a raft usually means the model's individual parts have such a small footprint that they would not remain bonded to the build plate. Rafts are also used on printers with an uncertain planar surface or irregularities in the surface. That's not applicable to this question, generally speaking.</p> <p>Your question about contraction being proportional to the amount of cooling is perhaps misdirected. One could consider that the printing temperature is a manufacturer specified value and the cooled temperature would be generally considered room temperature. Room temperature would be addressed as a range, rather than a single value, but even as a range, there isn't going to be a big percentage of variation in the calculation involving the print temp/room temp.</p> <p>My experience with the higher temperatures is more related to the volume of material per cross section (in all three dimensions). A printed model of substantial height with a relatively small horizontal cross section (think cylinder) is likely to have much less distortion in the x/y plane and greater distortion along the z-axis. The mass of filament cooling in the z-direction generates greater force than the smaller mass on the x/y axes.</p> <p>Another factor in such thought processes is that layers are on the x/y axes and the strength of the extruded plastic is more homogeneous through the nozzle, while the z-direction creates inter-layer discontinuities, making warping and delamination easier.</p> <p>I've found that I can reduce (but not eliminate) warping and delamination if I am able to maintain chamber temperature for longer periods and reduce temperature slowly. Unfortunately, I have a semi-enclosed printer and the heat loss is dependent partly on the ambient air temperature. A fully enclosed heated printer with auxiliary heating under some form of control may give you the best results.</p>
817
<p>I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are <a href="http://www.appscanadian.ca/archives/cs-101-introduction-to-computer-science/" rel="noreferrer">here</a> if you're interested in helping out). </p> <p>My biggest stumbling block so far has been math - how can I learn about algorithms and asymptotic notation without it??</p> <p>What I'm looking for is some sort of "dependency tree" showing what I need to know. Is calculus required before discrete? What do I need to know before calculus (read: components to the general "pre-calculus" topic)? What can I cut out to fast track the project ("what can I go back for later")?</p> <p>Thank!</p>
<p>Here's how my school did it:</p> <pre><code>base: algebra trigonometry analytic geometry track 1 track 2 track 3 calc 1 linear algebra statistics calc 2 discrete math 1 calc 3 (multivariable) discrete math 2 differential equations </code></pre> <p>The base courses were a prerequisite for everything, the tracks were independent and taken in order.</p> <p>So to answer your specific question, only algebra is needed for discrete. If you want to fast track, do one of these:</p> <pre><code>algebra, discrete algebra, linear algebra, discrete (if you want to cover matrices first) </code></pre> <p>HTH... It about killed me when I returned to school and took these, but I'm a much better programmer for it. Good Luck!</p>
<p>Usually, an overview of each field is a good thing to have when looking at any topic, but it's rare to have a genuine dependence the way we'd think of it. Algebra is always needed. I can't think of a time I've needed any trigonometry. (except to expand it with new things from calculus) I'm even quite sure people wouldn't agree on what a dependency graph would look like, or even in which field each topic belongs.</p> <p>I think the right way to approach it is to just collect a wide range of topics from all of branches and read them in whatever order you feel like, recording dependencies between topics as you go. (respecting them, or not, as you please.) This should have the far more important property of <strong>keeping the student interested</strong>.</p> <p>It's also my experience that if something just has you stumped, just mark it and set it aside for later.</p> <p>As for my school, well, it was similar to Harrison's:</p> <ul> <li>cominatorics,</li> <li>linear algebra,</li> <li>calculus,</li> <li>numerical analysis (error analysis in particular.)</li> <li>logic,</li> <li>statistics, (with operations research / queueing therory.)</li> </ul>
4,192
<p>I'm struggling to find the name of a connector I just broke, so I can order a new one.</p> <p>It's a six pin nylon terminal, that plugs into a set of header pins on a stepper motor.</p> <p>What do I search for to find these?! Also, how would I go about finding something like this in the future? I seem to struggle to find connectors.</p> <p><a href="https://i.stack.imgur.com/ejbJR.jpg" rel="nofollow noreferrer" title="Connector"><img src="https://i.stack.imgur.com/ejbJR.jpg" alt="Connector" title="Connector" /></a></p>
<p>Short answer: It's probably 6 pin JST PH</p> <p>Long answer:</p> <p>Without seeing the socket, it's hard to say for sure, however most Nema 17 stepper motors use 6 pin JST PH connectors with 2.0mm pitch on the motor side. Many control boards use JST XH connectors with 2.5mm pitch on the board side. The two are not compatible with each other due to a difference in pitch and the locking mechanism.</p> <p>Looking at the sockets there is a clear visual difference: PH has a wide cutout while XH has two slots.</p> <p><a href="https://i.stack.imgur.com/Rrxs3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Rrxs3.png" alt="PH 6 pin socket" /></a> PH vs XH <a href="https://i.stack.imgur.com/szUJt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/szUJt.png" alt="XJ 6 pin socket" /></a></p> <p>The difference on the plug side is more subtle. XH has small hooks that grab onto the slots while PH has not.</p> <p>There's a good reference at <a href="http://www.mattmillman.com/info/crimpconnectors/common-jst-connector-types/" rel="noreferrer">mattmillan.com</a> which helps to identify different types of JST connectors.</p> <p>EDIT: Usually the easiest and the cheapest option is to buy a pre-made stepper motor cable that fits your control board. However if it's not available in a length you need or re-wiring is hard, you will need connectors and a crimp tool with jaws specifically made for these types of connectors. The cheapest option is probably to borrow one if you can, these can cost a pretty penny.</p> <p>Answering the second part of your question is tricky. Searching through parts catalogs is too time consuming. Using google image search or google lens to search with images taken from multiple angles is a good start to narrow it down but does not guarantee success.</p>
<p>In an attempt to salvage my (sadly) previously incorrect answer (at the bottom), <em>and</em> to add to <a href="https://3dprinting.stackexchange.com/a/18388/4762">anttix's superlative answer</a>, here is a quote from <a href="https://gulfcoast-robotics.com/pages/stepper-cable-for-mks-boards-pinout" rel="nofollow noreferrer">Stepper cable for MKS Boards pinout</a>, which clearly shows the difference - locking and non-locking, and pitch difference (note the thickness of the plastic between each individual pin socket) - in the two plugs:</p> <blockquote> <p>This pinout information will help you to use our 1 meter stepper cables correctly. Cable was made to be compatible with 6-pin JST connectors on NEMA 17 stepper on one side and 4-pin JST connector on other side. These cables are compatible with MKS BASE and MKS Gen boards that we sell in our store.</p> <p><a href="https://i.stack.imgur.com/BozTI.jpg" rel="nofollow noreferrer" title="Female JST connectors for the control board (4 pin XH) and stepper motors (6 pin PH)"><img src="https://i.stack.imgur.com/BozTI.jpg" alt="Female JST connectors for the control board (4 pin XH) and stepper motors (6 pin PH)" title="Female JST connectors for the control board (4 pin XH) and stepper motors (6 pin PH)" /></a></p> <p>For compatibility with Anet board you will need to swap 2 wires - RED and BLUE on the 4 pin board side connector.</p> <p><a href="https://i.stack.imgur.com/rF57Q.jpg" rel="nofollow noreferrer" title="Reconfiguration for Anet board"><img src="https://i.stack.imgur.com/rF57Q.jpg" alt="Reconfiguration for Anet board" title="Reconfiguration for Anet board" /></a></p> </blockquote> <p>Whilst they aren't labeled <em>PH</em> and <em>XH</em>, it is pretty safe to assume that:</p> <ul> <li>For the control board, the <em><strong>4 pin</strong> female connector</em> on the <strong>left</strong> is the <strong>XH</strong>, and;</li> <li>For the stepper motor, the <em><strong>6 pin</strong> female connector</em> on the <strong>right</strong> is <strong>PH</strong>.</li> </ul> <p>The <a href="http://www.mattmillman.com/info/crimpconnectors/common-jst-connector-types/" rel="nofollow noreferrer">mattmillan.com</a> link in anttix's answer, whilst informative, unfortunately doesn't show both sides of the 4 or 6 pin connector.</p> <hr /> <p>For the sake of completeness, but at the risk of going <em>off-topic</em>, the connector to the printer controller board is often a DuPont, and not a JST, <em>particularly in</em>, but not limited to, Arduino (Atmel/AVR based) boards.</p> <p>From the same website, this page <a href="https://gulfcoast-robotics.com/pages/stepper-cable-for-ramps-pinout" rel="nofollow noreferrer">Stepper cable for RAMPS pinout</a>, shows the DuPont connector to the control board and the JST-PH-6P connector to the stepper motor (I've not fixed the typos in the quoted text):</p> <blockquote> <p>This pinout information will help you to use our 1 meter stepper cables correctly. Cable was made to be compatible with 6-pin JST connectors on NEMA 17 stepper on one side and RAMPS board connector (also called dupont connector) on other side. Main feature of RAMPS stepper header and this cable is that you can reverse stepper direction by turning connector on RAMPS 180 degree.</p> <p>This cable is aslo compatible with CNC V3 shields for Arduino UNO and other electronic boards for 3D Printers and CNC control. Please observe the following piut diagram to make sure that your particular electronic board is compatible.</p> <p><a href="https://i.stack.imgur.com/HQsxu.jpg" rel="nofollow noreferrer" title="Female DuPont connectors for the control board (4 pin) and JST for the stepper motors (6 pin PH)"><img src="https://i.stack.imgur.com/HQsxu.jpg" alt="Female DuPont connectors for the control board (4 pin) and JST for the stepper motors (6 pin PH)" title="Female DuPont connectors for the control board (4 pin) and JST for the stepper motors (6 pin PH)" /></a></p> </blockquote> <p><strong>Note</strong>: I'm not promoting this particular website, it just so happens that they have the best comparison photos.</p> <hr /> <p><strike>Maybe</strike> It is most likely <em><strong>not</strong></em>... JST XH 2.54 6 pin female</p> <p><a href="https://i.stack.imgur.com/ECbqm.png" rel="nofollow noreferrer" title="JST XH 2.54 6 pin female"><img src="https://i.stack.imgur.com/ECbqm.png" alt="JST XH 2.54 6 pin female" title="JST XH 2.54 6 pin female" /></a></p> <p>and the reverse side, showing the locking, with the male PCB connector</p> <p><a href="https://i.stack.imgur.com/vSZYE.jpg" rel="nofollow noreferrer" title="JST XH 2.54 6 pin female - reverse side with locking mechanism"><img src="https://i.stack.imgur.com/vSZYE.jpg" alt="JST XH 2.54 6 pin female - reverse side with locking mechanism" title="JST XH 2.54 6 pin female - reverse side with locking mechanism" /></a></p>
2,051
<p>I'd like to gain better knowledge of operating system internals. Process management, memory management, and stuff like that. <br> I was thinking of learning by getting to know either linux or BSD kernel.<br> Which one kernel is better for learning purposes?<br> What's the best place to start?<br> Can you recommend any good books?<br></p>
<p>In college, I had an operating systems class where we used a <a href="https://rads.stackoverflow.com/amzn/click/com/0003458903" rel="noreferrer" rel="nofollow noreferrer">book by Tanenbaum</a>. In the class, we implemented a device driver in the <a href="http://minix1.woodhull.com/teaching/teach_ver.html" rel="noreferrer">Minix operating system</a>. It was a lot of fun, and we learned a lot.</p> <p>One thing to note though, if you pick Minix, it is designed for learning. It is a microkernel, while Linux and BSD are a monolithic kernel, so what you learn may not be 100% translatable to be able to work with Linux or BSD, but you can still gain a lot out of it, without having to process quite as much information.</p> <p>As a side note, if you've read <a href="https://rads.stackoverflow.com/amzn/click/com/0066620732" rel="noreferrer" rel="nofollow noreferrer">Just for Fun</a>, Linus actually was playing with Minix before he wrote Linux, but it just wasn't enough for his purposes.</p>
<p>When I was at uni I spent a semester studying operating systems, and as part of this had an assignment where we had to implement a RAM-based filesystem in Linux.</p> <p>It was a fantastic way to get to understand the internals of the Linux keurnel and to get a grasp on how everything fits together - And a heck of a lot of fun playing around with how it interacts with standard tools too.</p>
4,431
<p>I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.</p> <p>My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.</p> <p>So the code below, which I <em>think</em> is correct according to <a href="http://www.w3.org/TR/CSS2/generate.html#markers" rel="nofollow noreferrer">the spec</a>, is like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html { counter-reset: myCounter; } li { counter-increment: myCounter; } li:before { content: counter(myCounter)". "; display: marker; width: 5em; text-align: right; marker-offset: 1em; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ol&gt; &lt;li&gt;The&lt;li&gt; &lt;li&gt;quick&lt;/li&gt; &lt;li&gt;brown&lt;/li&gt; &lt;/ol&gt; &lt;ol&gt; &lt;li&gt;fox&lt;/li&gt; &lt;li&gt;jumped&lt;/li&gt; &lt;li&gt;over&lt;/li&gt; &lt;/ol&gt;</code></pre> </div> </div> </p> <p>But this doesn't seem to generate markers, in either FF3, Chrome, or IE8 beta 2, and if I recall correctly not Opera either (although I've since uninstalled Opera).</p> <p>So, does anyone know if markers are <em>supposed</em> to work? Quirksmode.org isn't being its usual helpful self in this regard :(.</p>
<p>Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support. I suppose that didn’t help its popularity …</p> <p>Source: <a href="http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display" rel="nofollow noreferrer">http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display</a> (German)</p>
<p>Oh ouch, did not know that :-|. That probably seals its case, then. Because mostly I was under the assumption that such a basic CSS2 property should definitely be supported in modern browsers, but if it didn't make it into CSS 2.1, then it makes a lot more sense that it isn't.</p> <p>For future reference, it doesn't show up <a href="http://developer.mozilla.org/en/CSS/display" rel="nofollow noreferrer">in the Mozilla Development Center</a>, so presumably Firefox doesn't support it at all.</p> <p>Also for future reference, I got my original example to work with <code>inline-block</code> instead:</p> <pre><code>li:before { content: counter(myCounter)". "; display: inline-block; width: 2em; padding-right: 0.3em; text-align: right; } </code></pre>
7,289
<p>I applied the MOSS infrastructure upgrade w/o applying the WSS one before it -- uh, help!</p>
<p>Quoting: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3811c371-0e83-47c8-976b-0b7f26a3b3c4&amp;displaylang=en" rel="nofollow noreferrer">Infrastructure Update for Microsoft Office Servers (KB951297)</a></p> <p><b>Other Relevant Updates</b> It is strongly recommended that you install the Infrastructure Update for Windows SharePoint Services 3.0 (KB951695) before installing this update on any of the Office Servers listed in the system requirements section above.</p> <p><br>Therefore not applying first <i>Infrastructure Update for WSS</i> seem to be <i>not recommended</i> but not <i>unsupported</i> </p>
<p>Sounds like time for a full restore. The MOSS upgrade steps did explicitly ask for a restore, didn't it?</p>
7,066
<p>We have been working with CVS for years, and frequently find it useful to "sticky" a single file here and there.</p> <p>Is there any way to do this in subversion, specifically from TortoiseSVN?</p>
<p>The XOR method fails if a and b point to the same address. The first XOR will clear all of the bits at the memory address pointed to by both variables, so once the function returns (*a == *b == 0), regardless of the initial value.</p> <p>More info on the Wiki page: <a href="http://en.wikipedia.org/wiki/XOR_swap_algorithm" rel="noreferrer">XOR swap algorithm</a></p> <p>Although it's not likely that this issue would come up, I'd always prefer to use the method that's guaranteed to work, not the clever method that fails at unexpected moments.</p>
<p>I just placed both swaps (as macros) in hand written quicksort I've been playing with. The XOR version was much faster (0.1sec) then the one with the temporary variable (0.6sec). The XOR did however corrupt the data in the array (probably the same address thing Ant mentioned).<p> As it was a fat pivot quicksort, the XOR version's speed is probably from making large portions of the array the same. I tried a third version of swap which was the easiest to understand and it had the same time as the single temporary version. <pre><code> acopy=a; bcopy=b; a=bcopy; b=acopy; </code></pre><p> [I just put an if statements around each swap, so it won't try to swap with itself, and the XOR now takes the same time as the others (0.6 sec)]</p>
5,753
<p>I have an Anet A8 printer for about 4 months, set up pretty well (or so I thought) and printing a number of models pretty well. I made a large 3" x 6" box with a sliding lid yesterday and when it was done there was a gap on one side when the lid was slid on. I checked the parts and it turns out they are not square - which means the X and Y axes are not square to each other.</p> <p>I'm wondering how to adjust this - I'm thinking that extending the distance between the back of the frame and the front by adjusting the threaded rods that separate them to a wider distance on the side where the angle is obtuse. Obviously one of the first things I'll check is that the distance between the front and back is the same (I can't imagine why I never checked that before, come to think of it).</p> <p>Does this sound like a sound plan?</p>
<p><strong>Quick, low-tech solution:</strong></p> <p>There might be several issues in your question, but in relation to bed adhesion, I'll share one of the most useful tips I wish someone had told me when I started out: <em>Spread some glue-stick over the area to be printed</em>.</p> <p>I used ordinary school/craft glue stick (which I stole from my daughter's school pencil case) - the kind for gluing paper. I use a purple one, so it's easy to see and easy to clean up. I apply a little glue then smear it around with a wet finger to make it a bit uniform.</p> <p>I have a heated bed (FlashForge Creator Pro) and have used this little trick with a range of filaments. In almost every case, it helps adhesion enormously. Parts and supports stick like mad! But they still come off easily enough the usual way. It is a weak glue, so it won't lock the part to the bed. Once the part is off, the purple glue is visible when wet, so it is dead easy to clean up the part and the bed in a minute or two.</p> <p>This trick is so easy that it is worth trying first for any adhesion issues, before digging deeper.</p>
<p>It is hard to determine the exact source of the problem as there are few possibilities (I am assuming that you have a single nozzle and only one filament in use):</p> <ol> <li><p>One of the hardest issues for me to get on my printer was fact that my auto-level sensor was mounted about 0.5mm too high - so please check that as this will give you a bit higher Z than expected.</p></li> <li><p>Printing speed matters - for some prints I was slowing my printer to 20% of nominal speed to get adhesion</p></li> <li><p>a hair-spray layer or a masking tape on the bed could help with getting the grip</p></li> <li><p>also you could play with nozzle temperature de/increasing by 5 degrees and see how it is going</p></li> </ol>
864
<p>I have a <code>Rakefile</code> with a Rake task that I would normally call from the command line:</p> <pre><code>rake blog:post Title </code></pre> <p>I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or <code>system</code>.</p> <p>What's the right way to do this?</p>
<p>from <a href="http://web.archive.org/web/20090412040557/http://timocracy.com:80/articles/2008/02/21/calling-invoking-rails-rake-tasks-from-within-ruby-for-testing-try-2" rel="nofollow noreferrer">timocracy.com</a>:</p> <pre><code>require 'rake' def capture_stdout s = StringIO.new oldstdout = $stdout $stdout = s yield s.string ensure $stdout = oldstdout end Rake.application.rake_require 'metric_fetcher', ['../../lib/tasks'] results = capture_stdout {Rake.application['metric_fetcher'].invoke} </code></pre>
<p>In a script with Rails loaded (e.g. <code>rails runner script.rb</code>)</p> <pre><code>def rake(*tasks) tasks.each do |task| Rake.application[task].tap(&amp;:invoke).tap(&amp;:reenable) end end rake('db:migrate', 'cache:clear', 'cache:warmup') </code></pre>
2,563
<p>I have <code>buy.php</code> with a <strong>form</strong> where you enter <em>items, quantity, shipping data, etc.</em> </p> <p>When you click the <strong>Submit button</strong>, it posts back to <code>buy.php</code> <code>($_SERVER['PHP_SELF'])</code> and does some data validation. </p> <p>If there are fields missing or errors, they are highlighted. If everything is correct, I save the <code>$_POST</code> data in <code>$_SESSION</code> variables, then do a <code>header('Location: check.php')</code>, where I display the data so the buyer can check the info one last time before actually buying.</p> <p>Now, if I'm in <code>check.php</code> and hit the Back button to <code>buy.php</code> so I can change stuff, the browser asks if I want to resend the POST data. I'm trying to avoid that. </p> <p><strong>Anyone have any good advice or good practices for PHP Multiform validation?</strong></p> <p><strong>Also, if I had n pages for the user to fill, <code>buy.php, buy2.php, ... buyn.php</code> before check.php would the same ideas still hold?</strong></p>
<p>You could do a redirect to buy.php after saving to the session object, which then does a server redirect to check.php, it would mean when the user clicks back, they're going back to the GET request not the POST request</p>
<p>Yes - I agree with above. I ALWAYS do a <code>redir</code> away from the last post, so clicking back bounces them back without that error OR re-submissions. it also avoids complications. u can always tag the <code>redir</code> link page with a <code>?m</code> or <code>&amp;m</code> (i.e.: <code>page.php?m</code>) and have this at top of page: (use <code>elseif</code> there after) </p> <pre><code>if (isset($_GET['m'])) { echo 'order placed.'; } else { //... } </code></pre> <p>You can have it all on one page too. Just name the submit buttons <code>submit1</code>, <code>submit2</code>, like: (bear in mind if you use an image for submits, it becomes <code>$_POST['submit1_x']</code> :)</p> <pre><code>if (isset($_POST[submit1]) { //validate + save session data from form1 //display form 2 } else if(isset($_POST[submit2])) { //validate + save session data from form2 //display form 3 } else { //display first form //&lt;input type="submit" name="submit1" value="Continue"&gt; } </code></pre>
7,962
<p>I have a problem with a sample routing with the preview 5 of asp.net mvc.</p> <p>In the AccountController I have 2 actions: </p> <pre><code>public ActionResult Delete() public ActionResult Delete(string username) </code></pre> <p>While trying to look for Account/Delete or Account/Delete?username=davide the ControllerActionInvoker throws a exception saying that Delete request is ambiguous between my tow actions methods.</p> <p>The default route in the global.asax hasn't been changed.</p> <p>Shouldn't the action invoker understand what's the method to call looking in the parameters list?</p> <p>Using the preview 4 I hadn't these kind of problem performing the same operation.</p> <p>Any idea?</p>
<p>Solution found!</p> <p>With the introduction of the ActionNameAttribute, it's now necessary to filter manually which method to call depending on the request. This is done by the ActionSelectionAttribute.</p> <p>Full explanation here: <a href="http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx" rel="nofollow noreferrer">http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx</a></p>
<p>I can't say for sure why this is happening. But you might want to consider only having the Delete(string username) action and removing the parameter-less overload.</p> <p>Because string is nullable my understanding is that simply calling Account/Delete will invoke the action with a null username parameter which you can then test for at the beginning of the action method.</p>
6,955
<p>I've noticed a lot of Microsoft sites have the *.MSPX extension. While I'm very familiar with ASP.NET, I've not seen this extension before.</p> <p>Does anyone know what this identifies?</p>
<p>A few internet searches led me to <a href="http://www.microsoft.com/backstage/bkst_column_46.mspx" rel="nofollow noreferrer">http://www.microsoft.com/backstage/bkst_column_46.mspx</a>, but it was a dead link. Fortunately, it was archived on the Wayback Machine and you can read it here:</p> <p><a href="http://web.archive.org/web/20040803120105/http://www.microsoft.com/backstage/bkst_column_46.mspx" rel="nofollow noreferrer">http://web.archive.org/web/20040803120105/http://www.microsoft.com/backstage/bkst_column_46.mspx</a></p> <p>The .MSPX extension is part of the &quot;Microsoft Network Project,&quot; which according to the article above, is designed to give Microsoft's sites a consistent look-and-feel worldwide, as well as keep the design of the site seperate from the content. Here's the gist of the article:</p> <blockquote> <p>The presentation framework includes a custom Web handler built in ASP.NET. Pages that use the presentation framework have the .mspx filename extension, which is registered in Microsoft Internet Information Services (IIS) on the Web servers. When one of the Microsoft.com Web servers receives a request for an .mspx page, this custom Web handler intercepts that call and passes it to the framework for processing.</p> <p>The framework first checks to see whether the result is cached. If it is, the page is rendered immediately. If the page is not cached, the handler looks up the URL for that page in the table of contents provided by the site owner (see below) to determine where the XML content for the page is stored. The framework then checks to see if the XML is cached, and either returns the cached content or retrieves the XML from the data store identified in the table of contents file.</p> <p>Within the file that holds the content for the page, XML tags identify the content template to be used. The framework retrieves the appropriate template and uses a series of XSLTs to assemble the page, including the masthead, the footer, and the primary navigational column, finally rendering the content within the content pane.</p> </blockquote>
<p>I love you guys, i was asking myself also many times, why MS uses .mspx and what it is at all?! :) </p> <p>That time i couldn´t find any informations quickly and assumed it would just be something on top of asp.net or maybe not even that, because you should be able to assign the same asp.net cgi dll to .mspx also easy too ;) </p> <p>But, surely, it can be anything.. also an "special" CGI itself (completely beside ASP.NET), which processes that request with much better / much more cache-use, easier editing and so on..</p> <p>The end of the story was, that i came accross the view, that maybe it´s not important to know, what .mspx exactly is :)</p>
6,945
<p>When printing the first layer, the infill overlaps on just one side of my print. Thereupon there's a rough, and a lot higher, surface on the first few millimeters after the wall. </p> <ul> <li>Printer: Arduino Materia 101</li> <li>Filament: Rec Pla</li> <li>Temp: 210 degrees</li> </ul> <p>I have tried to troubleshoot it, but I just found information about a problem when the infill isn't close enough to the wall everywhere.</p> <p>However, for me, the problem is the contrary and just on one side. </p> <p><a href="https://i.stack.imgur.com/SFYAqm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SFYAqm.jpg" alt="Photo of overlap"></a></p>
<p>This may be a result of an unlevel build plate (OP did not specify if calibration was done at time of writing).</p> <p>If the area that is overlapping is higher (closer to the nozzle), the filament will be pushed down and around the nozzle as it extrudes in that area. This will result in excess filament overlapping unto other strands on the layer.</p> <p>Please excuse my lack of artistic skills in paint, but the image below should illustrate what can happen when your build plate is unlevel:</p> <p><a href="https://i.stack.imgur.com/IHElo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IHElo.png" alt="enter image description here"></a></p> <p>Basically what it's trying to illustrate is that if the nozzle is closer than the expected layer height, the machine will continue to flow as if the nozzle is <em>layer height</em> away. This typically results in a larger <em>layer width</em> because <strong>the nozzle is essentially pushing material out of the way</strong>.</p> <p>You will notice that as you go further to the right in the drawing, that your layer may begin to "thin out" because if the nozzle more than a layer height away, the filament "stretches" until it settles on the build plate, resulting in a thinner layer width.</p> <p>Ideally, your nozzle will be parallel to your build plate at all points along the build space and the "<strong><em>Standoff Distance</em></strong>" will be equal to your layer height. So, you should see the top of your bead of filament at the same height as the bottom of your nozzle.</p>
<p>Yes. That happens. I personally prefer this to the alternative which is it does not go far enough and curls back. That said depending on your slicer you will have a line overlap tolerance. But what's really happening is you are smooching your first layer. Aka your hot end is too high in relation to your first layer multiplier. </p> <p>Failing that and if you see it later in the print. Again I don't think you really can fix it but you should recalibrate your printers firmware, steps per mm and your slicers filament size. </p> <p>Looking at it I again it is a bit much. Maybe the plate is not flat. Does it happen on any other sides? After that we have the unlikely case your hotend is too hot. Which the slow down of the printer could cause too much material to ooze out. But I'm going to say plate level as number one suspicion. </p> <p>3D printing is a lot like trying to spin 3-4 plates at once.. if you still have issues I can expand more on calibration steps you need to do. </p>
457
<p>We have two tags: <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> &amp; <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a> </p> <p>These two are essentially the same thing. Even the abbreviated tag-wikis are pretty much saying the same thing. IMHO, we should combine the two tags as they are superfluous. </p> <p>There was the Meta question: <a href="https://3dprinting.meta.stackexchange.com/q/168/11242">support-material / support-structures Tag unification?</a> which was about combining <a href="https://3dprinting.stackexchange.com/questions/tagged/support-material" class="post-tag" title="show questions tagged &#39;support-material&#39;" rel="tag">support-material</a> &amp; <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a> which was turned down, but this request is quite different.</p>
<p>The tags <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> &amp; <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a> are in fact referring to exactly the same thing!</p> <p>Furthermore, the meaning of support can be interpreted differently (i.e. helping out).</p> <p>I support renaming/merging the <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> labelled questions to <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a>. This implies that the <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> tag is removed and it could be reinstated at any time by new questions. Users with enough reputation can remove the <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> tag if it gets recreated and we could create a synonym later. </p> <p>In my humble opinion, the best solution may be to rename <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> to <a href="https://3dprinting.stackexchange.com/questions/tagged/supports" class="post-tag" title="show questions tagged &#39;supports&#39;" rel="tag">supports</a> and then make it a synonym for <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a>!</p>
<p>I've made a synonym - <strike>apparently it needs <a href="https://3dprinting.stackexchange.com/tags/support-structures/synonyms">some votes</a></strike>.</p>
57
<p>One of the main hacks for converting RAMPS 1.4 boards to use with 24 V, as stated in <a href="https://reprap.org/wiki/RAMPS_24v" rel="nofollow noreferrer">RAMPS 24V</a>, is replacing the polyfuses, principally <code>F2</code> (MF-R1100), with wire and using an inline (car blade or wire) fuse on the heatbed wire (or between PSU and RAMPS) instead<sup>1</sup>. However, that is for the RAMPS 1.4 boards.</p> <p>As <a href="https://reprap.org/wiki/RAMPS_1.5" rel="nofollow noreferrer">RAMPS 1.5</a> notes (as well as 0scar's answer to <a href="https://3dprinting.stackexchange.com/questions/5623/ramps-1-4-1-5-or-1-6">RAMPS 1.4, 1.5 or 1.6?</a>):</p> <blockquote> <p>The RAMPS 1.5 uses small surface-mounted fuses rather than the large yellow fuses prone to breakage on the RAMPS 1.4. The downside is that replacing the fuses becomes much more difficult.</p> </blockquote> <p>Are these SMD fuses rated the same voltages, or greater? Yes, this could be a bit like asking &quot;How long is a piece of string&quot; as it depends upon the manufacturer, but does anyone know what voltage <em>should</em> they be rated for?</p> <p>Ultimately, if they are both rated at greater than 24 V, then there should be no need to replace them.</p> <p>The <a href="https://discuss.toms3d.org/hardware-f6/ramps1-4-or-ramps1-5-or-ramps-1-6-t481.html#p2786" rel="nofollow noreferrer">answer</a> on this thread, <a href="https://discuss.toms3d.org/hardware-f6/ramps1-4-or-ramps1-5-or-ramps-1-6-t481.html" rel="nofollow noreferrer">Re: Ramps1.4 or Ramps1.5 or ramps 1.6???</a> states:</p> <blockquote> <p>OK the ramps 1.6 can only handle 12v OR 24V</p> </blockquote> <p>so, that would imply that the intention for 24 V support was there, although, unfortunately, the poster does not post their reference.</p> <p>However, the <a href="https://github.com/bigtreetech/ramps-1.6/blob/master/Ramps1.6/hardware/R6Schematic%20diagram.pdf" rel="nofollow noreferrer">PDF</a> of the RAMPS 1.6 schematic shows the same rated fuses as the RAMPS 1.4</p> <p><a href="https://i.stack.imgur.com/hbPML.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hbPML.png" alt="RAMPS 1.6 Power section" /></a></p> <p>Nevertheless, that seems like a straight forward copy and paste from the RAMPS 1.4 schematic as it clearly references the MF-R500 PTC, and obviously SMD fuses have been used instead - or are the part numbers the same for the SMD fuses..? I had a google but couldn't see MF-R500 SMD fuses (maybe I didn't look hard enough?).</p> <hr /> <h3>Footnote</h3> <p><sup>1</sup> This is because the 11 A fuse is only rated to 16 V. Note that <code>F1</code> (MF-R500) is rated for 5 A at 30 V, and as such is sufficient for 24 V operation.</p>
<p>Without knowing the exact part numbers used for F1 and F2 it is impossible to say whether the fuses need to be replaced or not. However, based on the manufacturer provided schematic and BOM we can make a pretty good guess.</p> <p>Looking at the PDF you linked, it states that F1 is rated for 16V. Looking at the <a href="https://github.com/bigtreetech/ramps-1.6/blob/master/Ramps1.6/BOM%20form/BQ105-A4%20%E3%80%90RAMPS%201.6%E3%80%91Interface%20board%20R6%20%20BOM%20form.xls" rel="nofollow noreferrer">BOM spreadsheet</a> it also says F1 is 16V and 30A.</p> <p>Based on the fact that the only two reference documents available say 16V, I would strongly recommend replacing this component for 24V operation.</p>
<p>I found that at least the following two RAMPS 1.6 derived boards are 24 V capable without modifications:</p> <ul> <li>Bigtreetech RAMPS 1.6 Plus (see the PCB layout picture in <a href="https://www.roboter-bausatz.de/3080/ramps-1.6-plus-3d-drucker-steuerung" rel="nofollow noreferrer">this offer</a>)</li> <li>King Print RAMPS 1.6 Plus</li> </ul> <p>This information is so far only from webshop offers, so might not be the most reliable (and I did not test it myself yet). If somebody can find a confirmation from the manufacturer's spec documents, please let me know.</p>
1,414
<p>I run a 3D printer farm and I have to replace my Bowden tubes on the printers after about a month or two of use(roughly 1000 hours of use). The Bowden tubes continually melt on the side of the tube very near to where it pushes against the nozzle. I am running Ender 3 Pros and I run at about 205&nbsp;&deg;C with PLA. The Bowden tubes I have are some I found on Amazon and they are not Capricorn tubes. </p> <p><a href="https://i.stack.imgur.com/xnhmZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xnhmZ.png" alt="Note how the hole is very near the base of the tube closest to the nozzle"></a></p> <p>EDIT1: I have added more pictures below of a new failure. This time you can see the marks of the teeth of the coupler a good inch below the failure point. <a href="https://i.stack.imgur.com/QPk6E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QPk6E.jpg" alt="New photo of tube 1"></a> <a href="https://i.stack.imgur.com/A3xXQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A3xXQ.jpg" alt="New photo of tube 2"></a> <a href="https://i.stack.imgur.com/P9l5a.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P9l5a.jpg" alt="New photo of tube 3"></a> <a href="https://i.stack.imgur.com/PB7Ox.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PB7Ox.jpg" alt="New potho of tube 4"></a></p>
<p>If the tube is PTFE, the tube is not likely to be melting unless your hotend temperature is out of control. You would probably notice the PLA cooking.</p> <p>So, perhaps they aren't PTFE, or perhaps it is wear.</p> <p>If it wasn't PTFE, you should be able to tell by the texture, slipperiness, and bending force.</p> <p>The four thinned faces look like they would correspond to four of the barbs in the connector. The thinned ring below the four thinned faces look like a wear line where the tube is pressing against the exit of the connector. It looks to me as if the tube is moving or flexing in the connector. The barbs act as little chisels cutting into the tube, which is how they restrain such a slippery material as PTFE.</p> <p>It might work better if the tube were a little longer. This might reduce the forces at the limits of movement which may be placing strain on the tubes. If you can, you might also fashion a strain relief for the tube so that it doesn't bend right as it exist from the connector. If you can cut down on the movement, you will help with the external wear.</p> <p>It is also possible that the tubes are being strained by a high filament pressure. All the drive to push filament into the hot end is matched by an equivalent reverse pressure from the tube onto the connector. If you can stand a higher print temperature, the life of the tube may be increased.</p> <p>@towe added a comment:</p> <blockquote> <p>I don't think those are marks from the teeth of the pneumatic coupler. The questions states "where it pushes against the nozzle", and the Ender 3 Pro seems to have a hot-end where the Bowden tube reaches all the way through the cold end and heat break to the nozzle.</p> </blockquote> <p>A mechanical drawing of what may be a MK-10 hot-end as used on the Ender 3 Pro also suggests that the Ender 3 Pro has a PTFE lined hot end. Lets accept that drawing as confirming that @towe is right. Never-the-less, the marks you show in the photo look like the types of cuts I have seen from a pneumatic coupler. How can we reconcile this contradiction?</p> <p>The most direct answer would be that the tube is not reaching through to the nozzle. In the photo you don't show enough of the blue tube to show the coupler scars which should be a little further up the tube. Suppose that, in fact, the tube is not pressing against the nozzle. This might not be the case if any of these are true:</p> <ol> <li>There is a separate piece of PTFE that is permanently in hot end. The Creality Ender 3 Pro looks as if it is not configured for a Bowden feed. A PTFE lined hot-end for a direct extruder would have a piece of PTFE cut to length in the hot-end. A simple mod to make that a Bowden would leave that sculpted PTFE tube in place.</li> <li>The pneumatic couplers have been replaced. Many couplers do not permit the tube to pass through them, although the hole in the end can be drilled to 4mm diameter. In fact, preventing the tube from passing through a pneumatic coupler is a feature in the intended application of coupling to air tubes in moderate pressure applications.</li> <li>There is a bump in the path that is catching the tube and preventing it from extending through to the cold end and onward.</li> </ol>
<p>After a lot of hard work and months of replacing and inspecting this issue I realized what's going on. The bowden tube gets soft as it gets hotter and hotter which allows the filament which is being extruded and retracted at a high speed to wear down the side of the tube. After some time the tube gets stretched out and it will eventually tear and that is seens as the hole in the pictures I provided. The solution to this problem is to upgrade to an all metal hotend, instate less aggressive retraction settings (which is what I did), or closely monitor your prints and replace your bowden tubing when it does eventually get damaged (which I also do).</p>
1,592
<p>I've seen different program managers write specs in different format. Almost every one has had his/her own style of writing a spec.</p> <p>On one hand are those wordy documents which given to a programmer are likely to cause him/her missing a few things. I personally dread the word documents spec...I think its because of my reading style...I am always speed reading things which I think will cause me to miss out on key points.</p> <p>On the other hand, I have seen this innovative specs written in Excel by one of our clients. The way he used to write the spec was kind of create a mock application in Excel and use some VBA to mock it. He would do things like on button click where should the form go or what action should it perform (in comments). </p> <p>On data form, he would display a form in cells and on each data entry cell he would comment on what valid values are, what validation should it perform etc. </p> <p>I think that using this technique, it was less likely to miss out on things that needed to be done. Also, it was much easier to unit test it for the developer. The tester too had a better understanding of the system as it 'performed' before actually being written.</p> <p>Visio is another tool to do screen design but I still think Excel has a better edge over it considering its VBA support and its functions.</p> <p>Do you think this should become a more popular way of writing spec? I know it involves a bit of extra work on part of project manager(or whoever is writing the spec) but the payoff is huge...I myself could see a lot of productivity gain from using it. And if there are any better formats of specs that would actually help programmer.</p>
<p><a href="http://www.joelonsoftware.com/articles/fog0000000036.html" rel="nofollow noreferrer">Joel on Software</a> is particularly good at these and has some good articles about the subject...</p> <p>A specific case: <a href="http://www.joelonsoftware.com/articles/AardvarkSpec.html" rel="nofollow noreferrer">the write-up</a> and <a href="http://web.archive.org/web/20051028171624/https://www.joelonsoftware.com/RandomStuff/copilot_spec.pdf" rel="nofollow noreferrer">the spec</a>.</p>
<p>One of the Microsoft Press books has excellent examples of various documents, including an SRS (which I think is what you are talking about). It might be one of the requirements books by Weigert (I think that's his name, I'm blanking on it right now). I've seen US government organizations use that as a template, and from my three work experiences with the government, they like to make their own whereever they can, so if they are reusing it, it must be good.</p> <p>Also - a spec should contain NO CODE, in my opinion. It should focus on what the system must do, should do, and can not do using text and diagrams.</p>
4,308
<p>I was wondering the other day why don't all three motors move at the same time? Don't normal paper printers move 2 motors at a time? they're 2D printers. It makes sense if a 3D printer really does print with <em>all</em> three motors moving. Won't it also be more efficient if they do 3D print in all axes?</p>
<blockquote> <p>I was wondering the other day why don't all three motors move at the same time?</p> </blockquote> <p>That is perfectly possible for most printers (with limitations, &quot;3D Printing&quot; with all steppers being used is called &quot;non-planar&quot; printing), but there are some major cons you need to deal with. First, there are not that many software suites that slice objects perfectly well like the &quot;normal&quot; per &quot;fixed/variable layer height&quot; slicing as the slicers are under developed. Second, it requires a specific tall and slender nozzle/print head, else the height of printing is very limited. Last, besides generally not being useful for rectangular prints (except for 90° overhanging structures<sup>1)</sup>), this method is only/best suitable for curved objects as the top layer will follow the contours of the object.</p> <blockquote> <p>It makes sense if a 3D printer really does print with all three motors moving.</p> </blockquote> <p>No, it does not make sense, the essentials of 3D printing it that it produces a 3D object, not that all stepper motors should be running simultaneously.</p> <blockquote> <p>Won't it also be more efficient if they do 3D print in all axes?</p> </blockquote> <p>Not necessarily, there are limitations to non-planar printing like geometry and print quality, but, you could (in some cases) print with less support material.</p> <hr /> <p><sup>1)</sup> : From <a href="https://xyzdims.com/2021/03/03/3d-printing-90-overhangs-without-support-structure-with-non-planar-slicing-on-3-axis-printer/" rel="nofollow noreferrer">Rene K. Mueller, published March 3, 2021, https://xyzdims.com</a>: <a href="https://i.stack.imgur.com/eaJm0.png" rel="nofollow noreferrer" title="Non-planar slicing for printing 90° overhangs are tilted sliced"><img src="https://i.stack.imgur.com/eaJm0.png" alt="Non-planar slicing for printing 90° overhangs are tilted sliced" title="Non-planar slicing for printing 90° overhangs are tilted sliced" /></a> <a href="https://i.stack.imgur.com/Liiiw.png" rel="nofollow noreferrer" title="Non-planar slicing for printing 90° overhangs are conically sliced"><img src="https://i.stack.imgur.com/Liiiw.png" alt="Non-planar slicing for printing 90° overhangs are conically sliced" title="Non-planar slicing for printing 90° overhangs are conically sliced" /></a></p> <p><em>Note that these are <strong>demonstration</strong> pieces, normally you would rotate the print for 90° and print it sliced normal (planar).</em></p>
<p>The Z axis moves between each layer so you are indeed printing in the 3rd dimension. There are some techniques that move all three axis at the same time.</p>
1,924
<p>Is there a way to export a simple HTML page to Word (.doc format, not .docx) without having Microsoft Word installed?</p>
<p>If you have only simple HTML pages as you said, it can be opened with Word.</p> <p>Otherwise, there are some libraries which can do this, but I don't have experience with them.</p> <p>My last idea is that if you are using ASP.NET, try to add <code>application/msword</code> to the header and you can save it as a Word document (it won't be a real Word doc, only an HTML renamed to <code>doc</code> to be able to open).</p>
<p>i believe <a href="http://www.openoffice.org/" rel="nofollow noreferrer">open office</a> can both open .html files and create .doc files</p>
5,209
<p>I'm working with <a href="http://webby.rubyforge.org" rel="nofollow noreferrer" title="Webby">Webby</a> and am looking for some clarification. Can I define attributes like <code>title</code> or <code>author</code> in my layout?</p>
<p>Not really. The layout has access to the page attributes rather than the other way.</p> <p>The easiest way to do what you want is to populate the SITE.page_defaults hash in your site's Rakefile (probably build.rake). Add something like the following:</p> <pre><code>SITE.page_defaults['title'] = "My awesome title" SITE.page_defaults['author'] = "Shazbug" SITE.page_defaults['is_mando_awesome'] = "very yes" </code></pre> <p>You can now access those hash members in your template:</p> <pre><code>Written by &lt;%= @page.author %&gt; </code></pre> <p>You can find more info about Webby's page default stuff on the Google Group, specifically here: </p> <p><a href="http://groups.google.com/group/webby-forum/browse_thread/thread/f3dc1f4187959634/c30d7883705f6218?lnk=gst&amp;q=SITE#c30d7883705f6218" rel="nofollow noreferrer">http://groups.google.com/group/webby-forum/browse_thread/thread/f3dc1f4187959634/c30d7883705f6218?lnk=gst&amp;q=SITE#c30d7883705f6218</a> </p>
<p><a href="http://webby.rubyforge.org/tutorial/" rel="nofollow noreferrer">I've never used it but the tutorial here:</a></p> <p>Makes it look like the answer to your question is "yes". Specifically I'm looking under the "Making Changes" header on that page.</p>
4,380
<p>I have a webapp that uses JNDI lookups to get a connection to the database.</p> <p>The connection works fine and returns the query no problems. The issue us that the connection does not close properly and is stuck in the 'sleep' mode (according to mysql administrator). This means that they become unusable nad then I run out of connections.</p> <p>Can someone give me a few pointers as to what I can do to make the connection return to the pool successfully.</p> <pre><code>public class DatabaseBean { private static final Logger logger = Logger.getLogger(DatabaseBean.class); private Connection conn; private PreparedStatement prepStmt; /** * Zero argument constructor * Setup generic databse connection in here to avoid redundancy * The connection details are in /META-INF/context.xml */ public DatabaseBean() { try { InitialContext initContext = new InitialContext(); DataSource ds = (DataSource) initContext.lookup("java:/comp/env/jdbc/mysite"); conn = ds.getConnection(); } catch (SQLException SQLEx) { logger.fatal("There was a problem with the database connection."); logger.fatal(SQLEx); logger.fatal(SQLEx.getCause()); } catch (NamingException nameEx) { logger.fatal("There was a naming exception"); logger.fatal(nameEx); logger.fatal(nameEx.getCause()); } } /** * Execute a query. Do not use for statements (update delete insert etc). * * @return A ResultSet of the execute query. A set of size zero if no results were returned. It is never null. * @see #executeUpdate() for running update, insert delete etc. */ public ResultSet executeQuery() { ResultSet result = null; try { result = prepStmt.executeQuery(); logger.debug(prepStmt.toString()); } catch (SQLException SQLEx) { logger.fatal("There was an error running a query"); logger.fatal(SQLEx); } return result; } </code></pre> <p><em>SNIP</em></p> <pre><code>public void close() { try { prepStmt.close(); prepStmt = null; conn.close(); conn = null; } catch (SQLException SQLEx) { logger.warn("There was an error closing the database connection."); } } } </code></pre> <p>This is inside a javabean that uses the database connection.</p> <pre><code>public LinkedList&lt;ImportantNoticeBean&gt; getImportantNotices() { DatabaseBean noticesDBBean = new DatabaseBean(); LinkedList&lt;ImportantNoticeBean&gt; listOfNotices = new LinkedList&lt;ImportantNoticeBean&gt;(); try { PreparedStatement preStmt = noticesDBBean.getConn().prepareStatement("SELECT pseudonym, message, date_to, date_from " + "FROM importantnotices, users " + "WHERE importantnotices.username = users.username " + "AND NOW() &gt;= date_from AND NOW() &lt;= date_to;"); noticesDBBean.setPrepStmt(preStmt); ResultSet result = noticesDBBean.executeQuery(); while (result.next()) { ImportantNoticeBean noticeBean = new ImportantNoticeBean(); noticeBean.setAuthor(result.getString("pseudonym")); noticeBean.setMessage(result.getString("message")); noticeBean.setDateTo(result.getDate("date_to")); noticeBean.setDateFrom(result.getDate("date_from")); listOfNotices.add(noticeBean); } result.close(); } catch (SQLException SQLEx) { logger.error("There was an error in ImportantNoticesBean.getImportantNotices()"); logger.error(SQLEx); } finally { noticesDBBean.close(); } return listOfNotices; } &lt;Context reloadable="true"&gt; &lt;Resource name="jdbc/mysite" auth="Container" type="javax.sql.DataSource" username="user" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mysite" maxActive="10" maxIdle="5" maxWait="6000" removeAbandoned="true" logAbandoned="false" removeAbandonedTimeout="20" /&gt; &lt;/Context&gt; </code></pre>
<p>You seem to be closing the connection properly - except for the case where prepStmt.close() throws a SQLException, I can't find a connection leak.</p> <p>What pool implementation are you using? When you close a connection, the pool need not close the underlying MySQL connection immediately - after all that is the point of a connection pool! So from MySQL side, the connections would look alive, although your app is not using any; they might simply be held by the TC connection pool.</p> <p>You might want to experiment with the settings of the connection pool.Ask it to shrink the pool when the system is idle. Or, ask it to refresh all connections periodically. Or, have a strict upper bound on the number of concurrent connections it ever gets from MySQL etc.</p> <p>One way to check if your code has a connection leak is to force the ds.getConnection() to always open a new physical connection and conn.close() to release the connection (if your connection pool has settings for those). Then if you watch the connections on MySQL side, you might be able to figure out if the code really has a connection leak or not.</p>
<p>One thing that @binil missed, you are not closing the result set in the case of an exception. Depending on the driver implementation this may cause the connection to stay open. Move the result.close() call to the finally block. </p>
7,655
<p>I am looking for some advice on what should I concentrate my efforts to get the needed skills to become a Java developer for Oracle applications. I'm bit confused as there are lot of technologies in the Java world. Where should I start? What to avoid? Is JDeveloper a good IDE for a beginner?</p>
<p>To become an Oracle Developer there is a bit more to learn than jdbc. You should take a look at the Oracle web site. It is kind of slow and not very intuitive but has a lot of good information. There are OUGs that have good info as well.</p> <p>If you just want to access Oracle via JAVA then you should use a framework such as Spring. Takes away the pain of jdbc. Lets you write sql and map it to objects.</p> <p>If you don't know PL/SQL it might be good to learn what it is. </p> <p>My two cents from working with Oracle for the past 7 yrs.</p>
<p>Your question is very simple so I have listed a few simple steps to start developing a Java application using Oracle technologies.</p> <ol> <li>Install Oracle XE Database.</li> <li>Install [JDeveloper]. Choose the install with Weblogic if you are developing a J2EE application.</li> <li>Build and run a jdbc application using the [sample code] or use the wizard in JDeveloper.</li> <li>Install SQL Developer for writing stored procedures.</li> </ol> <p>Steps 3. and 4. are optional. You now have everything you need to build either a proof of concept or an enterprise grade database application, using simple wizards and without re-inventing the wheel.</p> <p>You mentioned developing an Oracle Application. It's best to leave the development of Oracle's packaged Application to Oracle itself but if you want to integrate your custom java application with Oracle's packaged application then use Oracle's SOA Suite.</p> <p>Cheers</p> <p>KB</p>
6,594
<p>This is the day of weird behavior.</p> <p>We have a Win32 project made with Delphi 2007, which hosts the .NET runtime and calls into .NET to show new forms, as part of a transition period.</p> <p>Recently we've begun experiencing exceptions at seemingly random locations and points of our code: Arithmetic overflow or underflow.</p> <p>The stack trace of one of these looks like this:</p> <pre><code>at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at Gatsoft.Gat.UI.Windows.Forms.Remanaging.RemanageForm.DelphiOpenInNewMode(String employeeCode, String departmentCode, DateTime date) in C:\Dev\VS.NET\Gatsoft\Gatsoft.Gat.UI.Windows\Forms\Remanaging\RemanageForm.Delphi.cs:line 67 </code></pre> <p>In the Visual Studio solution, one of the outmost class libraries (ie. pulls in all the references it can), has set a specific debug program, targetted for the Delphi project output. This allows us to debug .NET code from Visual Studio, even though the main bulk of the program is written in Delphi.</p> <p>The problem only occurs when run from the debugger, not if we just run the exe file directly (either through explorer, shortcuts, or even <kbd>Ctrl</kbd>+<kbd>F5</kbd> inside Visual Studio).</p> <p>There's apparently no spyware on the machine (as hinted by <a href="http://bytes.com/forum/thread106203.html" rel="nofollow noreferrer">this</a>).</p> <p>Any other things we can check?</p> <hr /> <p><strong>Edit:</strong> It looks like the .NET debugger is enabling this SNaN flags, and the Delphi debugger does not. We'll have to investigate this further, but for now I'll accept <a href="https://stackoverflow.com/users/6550/lorenzo-boccaccia">@Lorenzo Boccaccia</a>'s answer.</p> <h2>Apparently Solved</h2> <p>Ok, it looks like we've finally nailed this problem. The problem started occuring without having the debugger attached as well, for our testers, so we had to prioritize the problem way up.</p> <p>Finally we found one common issue with the machines that had the problem, they are Dell Lattitude D620 laptops with an NVIDIA Quadro NVS 110M, with an old driver from a system image used to provision the laptops, from back in 2006.</p> <p>I found one post on the web, though I lost the url when I rebooted to update the display driver, that had a .NET service crashing, mostly when the machine was busy doing something on the screen. One way to reproduce his problem was to open a command prompt to C:\ and doing a <code>DIR /S</code> to just force a massive amount of screen updates, which would trigger the crash.</p> <p>He too had a NVIDIA video card.</p> <p>The problem on my machine occured roughly every 2-4 startups of our program, but after updating the video driver I've had 123 successfull startups without any problems. (BTW I can recommend <a href="http://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotKey</a> for such things).</p> <p>So it looks like we've found the culprit, an old/buggy NVIDIA driver.</p> <p>Updated this question so that perhaps someone in the future can save some time.</p> <p>Now, if you'll excuse me, I'm going to go cry in a corner.</p> <h2>Jinxed!</h2> <p>I must've jinxed it. No sooner had I posted the above update than a colleague laptop failed, after updating the video driver.</p> <p>Still, I'm positive it's a problem outside of our application now, so it just remains to figure out which specific things to update.</p> <hr /> <p><strong>Further updates</strong>: Ok, my machine is now apparently fixed, not so with my colleagues machine. So far we've updated the BIOS, Chipset drivers, and currently SP3 for XP is on its way in.</p> <p>A burn-in test will be done tonight, where the app will be left overnight starting up, as the problem cropped up either during startup, or at the first time some WinForms .NET code was executed. This app is mainly a Delphi Win32 app, but it hosts the .NET runtime, and the problem seems to be related to .NET code. When we &quot;boot&quot; the .NET runtime, the problem can appear, or when we fire the first .NET window from Win32 then it can also appear.</p> <hr /> <p>Statistically I'm ready to release this code now. Over the night the application has been started 3051 times without errors, whereas before I updated the video driver it crashed every 2-4 times.</p> <h2>Prodded and found(!/?)</h2> <p>This bug-fixing ordeal feels like going to the doctor, where the following conversation ensues:</p> <pre><code>Doc: Does this hurt? Me: No... Doc: What about now? </code></pre> <p>I've prodded and poked the application and finally I think I've found something we did that introduced this problem.</p> <p>In our app we host the .NET runtime, from a Delphi 2007 Win32 application, and in our glue-code we have the following line (now):</p> <pre><code> rc := CorBindToRuntimeEx('v2.0.50727', 'wks', STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN or STARTUP_CONCURRENT_GC, @clsid, @iid, UnkRuntimeEngine); </code></pre> <p>The two constants in the middle there was originally just a 0, meaning <em>pick the defaults</em>. This change was introduced a few months ago and the problem has been slowly creeping in on us after this. The change was introduced in order to encourage ANTS profiler to load our Win32 application + hosted .NET runtime in order to do performance profiling and the changes we introduced back then made that work. Additionally, the problem with arithmetic overflow/underflow has slowly been getting worse so I bet the problem didn't appear for a while after the change so it wasn't attributed to any of the changes we did.</p> <p>Also, since we only (originally) saw the problem when running through the debugger, we thought something was wrong with Visual Studio and/or Delphi.</p> <p>Anyway, statistically now, with a browser on one screen doing repeated scrolling up and down triggered by a javascript (apparently needed in order to trigger the bug), then I have been able to successfully start the application 726 times with a 0 in the call, and it crashes 5 out of 17 times with the two constants there.</p> <pre><code>Doc: Does this hurt? </code></pre> <p>And let's not get into who made that change in the first place. I'm sure the culprit wants to be left anonymous... <em>cough</em></p>
<p>Have you added all the WMI components? As far as I know, you need all the WMI components to access the counters!</p> <blockquote> <p>The Performance Counter Windows Management Instrumentation (WMI) Provider component provides a bridge between the performance registry interface and the WMI interface. This component allows WMI clients to access performance counters through WMI scripts, and allows management applications built using WMI to access performance counters. Without this component, applications must directly use the registry interface or the performance data helper interface to access performance counters. </p> </blockquote> <p>Thank you TimK for the link (<a href="http://msdn.microsoft.com/en-us/library/aa939695.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa939695.aspx</a>)</p>
<p>Have you added all the WMI components? As far as I know, you need all the WMI components to access the counters!</p> <blockquote> <p>The Performance Counter Windows Management Instrumentation (WMI) Provider component provides a bridge between the performance registry interface and the WMI interface. This component allows WMI clients to access performance counters through WMI scripts, and allows management applications built using WMI to access performance counters. Without this component, applications must directly use the registry interface or the performance data helper interface to access performance counters. </p> </blockquote> <p>Thank you TimK for the link (<a href="http://msdn.microsoft.com/en-us/library/aa939695.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa939695.aspx</a>)</p>
8,065
<p>I experience some lines on my prints. However, I would not really call them &quot;stringing&quot;.</p> <p>I have seen some stringing and it was rather like an undefined spider web.</p> <p>But the lines that you see in my photo are super straight and fine.</p> <p>Are they called &quot;stringing&quot; too? And how do I get rid of them?</p> <p>Specs:</p> <ul> <li>Printer: Kobra Max</li> <li>Nozzle: 200 °C</li> <li>Bed: 50 °C</li> <li>Filament: GiantArm PLA</li> </ul> <p><a href="https://i.stack.imgur.com/W0uJF.png" rel="nofollow noreferrer" title="Photo of print bed with faint filament lines that don't look like part of the printed model"><img src="https://i.stack.imgur.com/W0uJF.png" alt="Photo of print bed with faint filament lines that don't look like part of the printed model " title="Photo of print bed with faint filament lines that don't look like part of the printed model" /></a></p>
<p>They're caused by filament being pulled during travel so they qualify as stringing.</p> <p>You need to look at your retraction and heat, speed as well makes a difference. You can try combing and other things or just pull them off.</p>
<p>You should provide a better picture, i.e. a finished print.</p> <p>Stringing is generally something you don't worry about - adjust your retraction settings a tiny bit to retract more. I didn't see what software you used, that will help with where the settings are.</p> <p>Also the plate is very different from the rest of the layers, it could just be a leveling issue.</p>
2,216
<p>I want to open a file for reading, the C++ way. I need to be able to do it for:</p> <ul> <li><p>text files, which would involve some sort of read line function.</p></li> <li><p>binary files, which would provide a way to read raw data into a <code>char*</code> buffer.</p></li> </ul>
<p>There are three ways to do this, depending on your needs. You could use the old-school C way and call <code>fopen</code>/<code>fread</code>/<code>fclose</code>, or you could use the C++ fstream facilities (<code>ifstream</code>/<code>ofstream</code>), or if you're using MFC, use the <code>CFile</code> class, which provides functions to accomplish actual file operations.</p> <p>All of these are suitable for both text and binary, though none have a specific readline functionality. What you'd most likely do instead in that case is use the fstream classes (fstream.h) and use the stream operators (&lt;&lt; and &gt;&gt;) or the read function to read/write blocks of text:</p> <pre><code>int nsize = 10; std::vector&lt;char&gt; somedata(nsize); ifstream myfile; myfile.open(&quot;&lt;path to file&gt;&quot;); myfile.read(somedata.data(), nsize); myfile.close(); </code></pre> <p>Note that, if you're using Visual Studio 2005 or higher, traditional fstream may not be available (there's a new Microsoft implementation, which is slightly different, but accomplishes the same thing).</p>
<p>fstream are great but I will go a little deeper and tell you about <a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="nofollow noreferrer">RAII</a>.</p> <p>The problem with a classic example is that you are forced to close the file by yourself, meaning that you will have to bend your architecture to this need. RAII makes use of the automatic destructor call in C++ to close the file for you.</p> <p><strong>Update</strong>: seems that std::fstream already implements RAII so the code below is useless. I'll keep it here for posterity and as an example of RAII. </p> <pre><code>class FileOpener { public: FileOpener(std::fstream&amp; file, const char* fileName): m_file(file) { m_file.open(fileName); } ~FileOpeneer() { file.close(); } private: std::fstream&amp; m_file; }; </code></pre> <p>You can now use this class in your code like this:</p> <pre><code>int nsize = 10; char *somedata; ifstream myfile; FileOpener opener(myfile, "&lt;path to file&gt;"); myfile.read(somedata,nsize); // myfile is closed automatically when opener destructor is called </code></pre> <p>Learning how RAII works can save you some headaches and some major memory management bugs.</p>
2,943
<p>What are the most common problems that can be solved with both these data structures?</p> <p>It would be good for me to have also recommendations on books that:</p> <ul> <li>Implement the structures</li> <li>Implement and explain the reasoning of the algorithms that use them</li> </ul>
<p>The first thing I think about when I read this question is: <em>what types of things use graphs/trees?</em> and then I think backwards to how I could use them.</p> <p>For example, take two common uses of a tree:</p> <ul> <li>The DOM</li> <li>File systems</li> </ul> <p>The DOM, and XML for that matter, resemble tree structures. <br> <img src="https://i.stack.imgur.com/bk5RY.gif" alt="alt text"></p> <p>It makes sense, too. <strong>It makes sense because of how this data needs to be arranged</strong>. A file system, too. On a UNIX system there's a root node, and branching down below. When you mount a new device, you're attaching it onto the tree.</p> <p>You should also be asking yourself: does the data fall into this type of structure? Create data structures that make sense to the problem and the rest will follow.</p> <p>As far as being easier, I think thats relative. Are you good with recursive functions to traverse a tree/graph? What if you need to balance the tree?</p> <p>Think about a program that solves a word search puzzle. You could map out all the letters of the word search into a graph and check surrounding nodes to see if that string is matching any of the words. But couldn't you just do the same with with a single array? All you really need to do is move an index to check letters to the left and right, and by the width to check above and below letters. Solving this problem with a graph isn't difficult, but it can create a lot of extra work and difficulty if you're not comfortable with using them - of course that shouldn't discourage you from doing it, especially if you are learning about them.</p> <p>I hope that helps you think about these structures. As for a book recommendation, I'd have to go with <strong><a href="https://rads.stackoverflow.com/amzn/click/com/0262032937" rel="noreferrer" rel="nofollow noreferrer">Introduction to Algorithms</a></strong>. </p>
<p>There's a course for such things at my university: <a href="http://www.cs.washington.edu/education/courses/326/" rel="nofollow noreferrer">CSE 326</a>. I didn't think the book was too useful, but the projects are fun and teach you a fair bit about implementing some of the simpler structures. </p> <p>As for examples, one of the most common problems (by number of people using it) that's solved with trees is that of cell phone text entry. You can use trees, not necessarily binary, to represent the space of possible words that can come out of any given list of numbers that a user punches in very quickly. </p>
2,512
<p>I have a question that I may be over thinking at this point but here goes...</p> <p>I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups are private -- users will need authorization). </p> <p><strong>Would you recommend creating a class for the join table as well as the User and Groups table?</strong> Currently my classes look like this.</p> <pre><code>public class Groups { public Groups() { members = new List&lt;Person&gt;(); } ... public virtual IList&lt;Person&gt; members { get; set; } } public class User { public User() { groups = new Groups() } ... public virtual IList&lt;Groups&gt; groups{ get; set; } } </code></pre> <p>My mapping is like the following in both classes (I'm only showing the one in the users mapping but they are very similar):</p> <pre><code>HasManyToMany&lt;Groups&gt;(x =&gt; x.Groups) .WithTableName("GroupMembers") .WithParentKeyColumn("UserID") .WithChildKeyColumn("GroupID") .Cascade.SaveUpdate(); </code></pre> <p><strong>Should I write a class for the join table that looks like this?</strong></p> <pre><code>public class GroupMembers { public virtual string GroupID { get; set; } public virtual string PersonID { get; set; } public virtual bool WaitingForAccept { get; set; } } </code></pre> <p>I would really like to be able to adjust the group membership status and I guess I'm trying to think of the best way to go about this. </p>
<pre><code>&lt;style type="text/css"&gt; #watermark { color: #d0d0d0; font-size: 200pt; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); position: absolute; width: 100%; height: 100%; margin: 0; z-index: -1; left:-100px; top:-200px; } &lt;/style&gt; </code></pre> <p>This lets you use just text as the watermark - good for dev/test versions of a web page.</p> <pre><code>&lt;div id="watermark"&gt; &lt;p&gt;This is the test version.&lt;/p&gt; &lt;/div&gt; </code></pre>
<p>You could make an image with the watermark and then set the image as the background via css.</p> <p>For example:</p> <pre><code>&lt;style type="text/css"&gt; .watermark{background:url(urltoimage.png);} &lt;/style&gt; &lt;div class="watermark"&gt; &lt;p&gt;this is some text with the watermark as the background.&lt;/p&gt; &lt;/div&gt; </code></pre> <p>That should work.</p>
9,408
<p>I've been looking for this information for my commercial desktop product, with no avail.</p> <p>Specifically, what I'm look for, is deployment statistics of the .NET framework for end-users (both granny "I'm just browsing the internet" XP, and high-end users, if possible), and in the commercial/business sector.</p> <p>Edit: Other than the data points below, here's an interesting blog post about .NET <a href="http://www.nbdtech.com/blog/archive/2009/05/25/what-percentage-of-users-have-the-.net-framework-installed-and.aspx" rel="nofollow noreferrer">deployment rates</a>.</p>
<p>Some statistics from 2005 I found at <a href="http://blogs.msdn.com/scottwil/archive/2005/03/09/391199.aspx" rel="nofollow noreferrer">Scott Wiltamuth's blog</a> (you can be sure these numbers are much higher now):</p> <ul> <li>More than 120M copies of the .NET Framework have been downloaded and installed using either Microsoft downloads or Windows Update</li> <li>More than 85% of new consumer PCs sold in 2004 had the .NET Framework installed</li> <li>More than 58% of business PCs have the .NET Framework preinstalled or preloaded</li> <li>Every new HP consumer imaging device (printer/scanner/camera) will install the .NET Framework if it’s not already there – that’s 3M units per year</li> <li>Every new Microsoft IntelliPoint mouse software CD ships with the .NET Framework</li> </ul> <p>It is also worth pointing out that Vista and Windows Server 2008 both ship with the .NET Framework. XP gets it via Windows Update.</p>
<p>I don't have any hard numbers, but these days, it is pretty safe to assume most Windows XP and Vista users have at least .NET 2.0. I believe this was actually dropped via Windows Update for XP, and Vista came with at least 2.0 (apparently with 3.0 as pointed out in the comments to this answer).</p>
9,145
<p>I know that you need a special nozzle to extrude abrasive filament (carbon fibre, copper, ...). I do have such a nozzle (coated steel) and am printing carbon fibre and copper filament. Last time I used it to print carbon fibre PLA. It worked well, however when I removed the nozzle from the hotend I realized that I could no longer screw the non-abrasive nozzle in (the dirt cheap 0.1$ china nozzles that work well enough for most materials) and the thread of the hotend was completely loosened up.</p> <p>I had been working on a few other things with my printer, so I am not entirely sure what caused the thread to become loose, but I was wondering, are there some requirements to the hotend excluding the nozzle when printing abrasive filament?</p>
<p>Abrasive filaments require a stronger nozzle indeed. They also require an all-metal hotend. If your hotend wasn't all-metal, there's a good chance you've damaged it.</p> <p>The PEEK/PTFE in your hotend doesn't like going above 240 Celsius and tends to be irreparably damaged if used too long above 250 Celsius.</p>
<p>The hotend itself consists of basically 3 parts:</p> <ul> <li>The filament path, aka Coolend. It consists of the heartbreak, cooling solution and anything up from it.</li> <li>The heater block, that holds everything together</li> <li>The nozzle, in which the filament melts and is pushed out.</li> </ul> <p>The part of the hotend assembly that gets to be in the most contact with the particles that are inside the abrasive filament is the nozzle through which the molten polymer gets out. Unless you have heat creep and the filament melts in the heartbreak, it is the only part that ever will encounter the abrasive particles even.</p> <p>Since even the most abrasive filaments come as rather smooth filaments, only the nozzle needs to be special. Hardened Steel will hold some kilos, while people printing a lot of carbonfiber filled material swear on ruby nozzles.</p>
2,037
<p>Just recently started having issues with an SQL Server Agent Job that contains an SSIS package to extract production data and summarize it into a separate reporting database. </p> <p>I <em>think</em> that some of the Alerts/Notifications settings I tried playing with caused the problem as the job had been running to completion unattended for the previous two weeks.</p> <p>So... Where's a good place to start reading up on SQL Agent Alerts and Notifications? <br />I want to enable some sort of alert/notification so that I'm always informed: </p> <ol> <li>That the job completes successfully (as a check to ensure that it's always executed), or </li> <li>That the job ran into some sort of error, which should include enough info (such as error number) that I can diagnose the cause of the error</li> </ol> <p>As always, any help will be greatly appreciated!</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms130214(SQL.90).aspx" rel="nofollow noreferrer">Books Online</a> is probably a good place to start (or at least I like it and generally find it useful).</p> <p>SQLMenace and bofe made some good points. Here's my additional two cents:</p> <p>I'd recommend <a href="http://msdn.microsoft.com/en-us/library/ms188298(SQL.90).aspx" rel="nofollow noreferrer">configuring Database Mail</a> rather than SQL Mail (i.e. SMTP vs. MAPI, which I think is deprecated anyway). Once you get the mail profile configured, you'll have to also configure the SQL agent to use that mail profile (which is just a page of settings for the agent properties), or else your SSIS job notifications won't actually get sent, even though you can successfully send a test email from Management Studio.</p> <p>I don't use alerts as often as job notifications, so the only tricky thing I can recall about them is that if you're raising an error and you want the alert to email you when that happens, you have to make sure that the raised error gets written to the log. I think that just boils down to "RAISERROR ... WITH LOG"; here's the <a href="http://msdn.microsoft.com/en-us/library/ms178592.aspx" rel="nofollow noreferrer">BOL link</a> for the syntax details. </p>
<p>You'll want to have "When the job completes" marked in your notifications page on the job's properties.</p> <p>Just go to that dropdown and switch it to job completion instead of failure (which is on the screenshot).</p> <p><img src="https://i.stack.imgur.com/HGlQh.png" alt="Job_Properties_Notification"></p> <p>You'll also want to make sure that your server has e-mail configured. I think it's under SQL Surface Area Configuration for Features.</p>
4,227
<p>I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions.</p> <p>What's the best pattern/framework/library for communications between the UI and the domain? This boils down into:</p> <ul> <li>the UI being able to convert a user gesture into a domain action</li> <li>the domain being able to send state/result information back to the UI for display purposes</li> </ul> <p>I'm aware of MVC as a broad concept and have fiddled with the Observer pattern (whose Java implementation has some drawbacks if I understand correctly), but I'm wondering if there's an accepted best practise for this problem?</p>
<p>Definitely MVC - something like this <a href="http://www.leepoint.net/notes-java/GUI/structure/40mvc.html" rel="nofollow noreferrer">example</a> which clearly splits things out. The problem with the Swing examples is that they seem to show the MVC all working within the swing stuff, which does not seem right to me</p>
<p>I have used the Observer pattern (using AspectJ magic) in the past with <em>some</em> success, but found that unless you were careful it quickly became a cluster.. uhh.. flick?</p> <p>It quickly became hard to manage and most importantly extremely hard to debug.</p> <p><strong>Edit:</strong></p> <p>To expand slightly on my answer, we were using <a href="http://en.wikipedia.org/wiki/Standard_Widget_Toolkit" rel="nofollow noreferrer">SWT</a>, not Swing, so YMMV. We basically used AspectJ to hook up the transference of data from the UI components to the model objects. These model objects were dumb POJOs.</p> <p>Actual business logic was done by 'watching' the model objects with AspectJ and firing off the required event if they changed. So if you changed a value in a textbox AspectJ would fire and copy that value into a POJO. If that field in the POJO had an event on it for business logic that would <em>then</em> fire. If that logic modified any POJOs (and it could) AspectJ would notice and copy the value from the POJO into the UI component.</p>
9,535
<p>I'm missing something here:</p> <pre><code>$objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry $objSearcher.Filter = ("(objectclass=computer)") $computers = $objSearcher.findall() </code></pre> <p>So the question is why do the two following outputs differ?</p> <pre><code>$computers | %{ "Server name in quotes $_.properties.name" "Server name not in quotes " + $_.properties.name } PS&gt; $computers[0] | %{"$_.properties.name"; $_.properties.name} System.DirectoryServices.SearchResult.properties.name GORILLA </code></pre>
<p>When you included $_.properties.name in the string, it was returning the type name of the property. When a variable is included in a string and the string is evaluated, it calls the ToString method on that object referenced by the variable (not including the members specified after). </p> <p>In this case, the ToString method is returning the <strong>type name</strong>. You can force the evaluation of the variable and members similar to what EBGreen suggested, but by using </p> <pre><code>"Server name in quotes $($_.properties.name)" </code></pre> <p>In the other scenario <strong>PowerShell</strong> is evaluating the variable and members specified first and then adding it to the previous string.</p> <p>You are right that you are getting back a collection of properties. If you pipe <strong>$computer[0].properties</strong> to get-member, you can explore the object model right from the command line. </p> <p>The important part is below.</p> <blockquote> <p>TypeName: System.DirectoryServices.ResultPropertyCollection</p> <p>Name MemberType Definition</p> <hr> <p>Values Property System.Collections.ICollection Values {get;}</p> </blockquote>
<p>I believe it has to do with the way that PS interpolates information in the "". Try this:</p> <p>"Server name in quotes $($_.properties).name" </p> <p>Or you may even need one more set of $(). I'm not somewhere that I can test it at right now.</p>
3,469
<p>Are these vertical lines described as "banding"?</p> <p>Would the most likely culprit be the extruder?</p> <p>FWIW, this was printed in "vase mode".</p> <p><a href="https://i.stack.imgur.com/0ZCPF.jpg" rel="noreferrer" title="&quot;Vase mode, PLA"><img src="https://i.stack.imgur.com/0ZCPF.jpg" alt="Vase mode, PLA" title="&quot;Vase mode, PLA"></a></p>
<p>Banding usually refers to Z banding and manifests itself in a wavy/non-straight wall in Z direction: </p> <p><a href="https://i.stack.imgur.com/KYp55.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KYp55.jpg" alt="Z-banding"></a></p> <p>This sort of banding is related to mechanical or design issues of the printer (lead screw (nuts), belts, play, etc.)</p> <p>Your print, however, shows local thicker walls. It appears that these local thicker parts are related to the change in direction of the print head. A 3D printer does not print curved lines or arcs (although <a href="http://reprap.org/wiki/G-code#G2_.26_G3:_Controlled_Arc_Move" rel="noreferrer">G-codes do exist for arc movement</a>), all movements are straight lines. So the cylinder consists of straight lines. By rendering the cylinder with more triangels you could increase the amount of straight lines to form a better approximation of the cylinder circumference. You could also try to lower the printing speed, but since you did not post any printing parameters that will be a guess.</p>
<p>Banding usually refers to Z banding and manifests itself in a wavy/non-straight wall in Z direction: </p> <p><a href="https://i.stack.imgur.com/KYp55.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KYp55.jpg" alt="Z-banding"></a></p> <p>This sort of banding is related to mechanical or design issues of the printer (lead screw (nuts), belts, play, etc.)</p> <p>Your print, however, shows local thicker walls. It appears that these local thicker parts are related to the change in direction of the print head. A 3D printer does not print curved lines or arcs (although <a href="http://reprap.org/wiki/G-code#G2_.26_G3:_Controlled_Arc_Move" rel="noreferrer">G-codes do exist for arc movement</a>), all movements are straight lines. So the cylinder consists of straight lines. By rendering the cylinder with more triangels you could increase the amount of straight lines to form a better approximation of the cylinder circumference. You could also try to lower the printing speed, but since you did not post any printing parameters that will be a guess.</p>
878
<ul> <li>I have nUnit installed.</li> <li>I have VS2008 Team Edition installed.</li> <li>I have ASP.Net MVC Preview 4 (Codeplex) installed.</li> </ul> <p>How do I make Visual Studio show me nUnit as a testing framework when creating a new MVC project? At this point I still only have the Microsoft Testing Framework as a choice. </p> <p><strong>Update:</strong> I installed nUnit 2.5, but still with no success. From what I've found Googling, it would seem I need to <em>create</em> templates for the test projects in order for them to be displayed in the "Create Unit Test Project". I would have thought that templates be readily available for nUnit, xUnit, MBUnit, et. al. Also, it looks like I need to created registry entries. Anybody have any additional information?</p> <p><strong>Update:</strong> I determined the answer to this through research and it's posted below. </p>
<p>After a bunch of research and experimentation, I've found the answer. </p> <ul> <li>For the record, the current release of nUnit 2.5 Alpha <em>does not</em> seem to contain templates for test projects in Visual Studio 2008. </li> <li>I followed the directions <a href="http://vishaljoshi.blogspot.com/2008/02/aspnet-mvc-test-framework-integration.html" rel="noreferrer">here</a> which describe how to create your own project templates and then add appropriate registry entries that allow your templates to appear in the drop-down box in the <em>Create Unit Test Project</em> dialog box of an MVC project.</li> </ul> <p>From a high level, what you have to do is:</p> <ol> <li>Create a project</li> <li>Export it as a template (which results in a single ZIP archive)</li> <li>Copy it from the local user's template folder to the Visual Studio main template test folder</li> <li>Execute <strong>devenv.exe /setup</strong></li> <li>Run <strong>regedit</strong> and create a few registry entries. </li> </ol> <p>So much for the testing framework selection being easy! Although, to be fair MVC is not even beta yet. </p> <p>After all that, I did get the framework of choice (NUnit) to show up in the drop down box. However, there was still a bit left to be desired:</p> <ul> <li>Although the test project gets properly created, it did not automatically have a project reference to the main MVC project. When using <em>Visual Studio Unit Test</em> as the test project, it automatically does this.</li> <li>I tried to open the ZIP file produced and edit the MyTemplate.vssettings file as well as the .csproj project file in order to correct the aforementioned issue as well as tweak the names of things so they'd appear more user friendly. This for some reason does not work. The ZIP file produced can not be updated via WinZip or Win-Rar -- each indicates the archive is corrupt. Each can extract the contents, though. So, I tried updating the extracted files and then recreating the ZIP file. Visual Studio did not like it.</li> </ul> <p>So, I should probably read <a href="http://msdn2.microsoft.com/en-us/library/s365byhx.aspx" rel="noreferrer">this</a> as well which discusses making project templates for Visual Studio (also referenced in the blog post I linked to above.) I admit to being disappointed though; from all the talk about MVC playing well with other testing frameworks, etc, I thought that it'd be easier to register a 3rd party framework.</p>
<p>Do install <a href="http://testdriven.net" rel="nofollow noreferrer">Testdriven.net</a> to integrate NUnit with Visual Studio. MbUnit and later versions of NUnit also contain project templates for unit tests.</p> <p>You can use those project templates to create a test project and then reference to your ASP.NET MVC project and be able to test its code.</p>
4,143
<p>I need to transport my FDM 3D Printer because I am moving.</p> <p>What are the precautions that one should take?<br> Should I dismount the motors and axes?<br> I would definitively unplug the electronics as far as reasonable and fix the motors to the frame so they don't slide during transport.<br> Should I have a housing to avoid dust and other mechanical issues?</p>
<p>Yes, fix the motors and any other loose/movable parts. Remove the bowden tube if it's there, and any other parts that are sticking out. Put the whole thing in a a bag to protect from dust, and put the bag in a box to protect it from getting beat up. Remember to calibrate it when you're ready to set it up again.</p>
<p>You just need to take basic security actions. like fixing all movable parts simple as that </p>
309
<p>I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow. :P</p> <p>I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good friends! I don't have anyone close to chat about this! </p> <p>This is my <a href="http://pastebin.ca/1094382" rel="noreferrer">build.xml</a> so far. </p> <p><i>(*) I edited my question based in the <a href="https://stackoverflow.com/questions/4046/can-someone-give-me-a-working-example-of-a-buildxml-for-an-ear-that-deploys-in-#4298">suggestion</a> of to use pastebin.ca</i></p>
<p>My Environment: Fedora 8; WAS 6.1 (as installed with Rational Application Developer 7)</p> <p>The documentation is very poor in this area and there is a dearth of practical examples.</p> <p><strong>Using the WebSphere Application Server (WAS) Ant tasks</strong></p> <p>To run as described here, you need to run them from your server <strong>profile</strong> bin directory using the <strong>ws_ant.sh</strong> or <strong>ws_ant.bat</strong> commands.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="project" default="wasListApps" basedir="."&gt; &lt;description&gt; Script for listing installed apps. Example run from: /opt/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/bin &lt;/description&gt; &lt;property name="was_home" value="/opt/IBM/SDP70/runtimes/base_v61/"&gt; &lt;/property&gt; &lt;path id="was.runtime"&gt; &lt;fileset dir="${was_home}/lib"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;fileset dir="${was_home}/plugins"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;property name="was_cp" value="${toString:was.runtime}"&gt;&lt;/property&gt; &lt;property environment="env"&gt;&lt;/property&gt; &lt;target name="wasListApps"&gt; &lt;taskdef name="wsListApp" classname="com.ibm.websphere.ant.tasks.ListApplications" classpath="${was_cp}"&gt; &lt;/taskdef&gt; &lt;wsListApp wasHome="${was_home}" /&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Command:</p> <pre><code>./ws_ant.sh -buildfile ~/IBM/rationalsdp7.0/workspace/mywebappDeploy/applist.xml </code></pre> <p><strong>A Deployment Script</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="project" default="default" basedir="."&gt; &lt;description&gt; Build/Deploy an EAR to WebSphere Application Server 6.1 &lt;/description&gt; &lt;property name="was_home" value="/opt/IBM/SDP70/runtimes/base_v61/" /&gt; &lt;path id="was.runtime"&gt; &lt;fileset dir="${was_home}/lib"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;fileset dir="${was_home}/plugins"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;property name="was_cp" value="${toString:was.runtime}" /&gt; &lt;property environment="env" /&gt; &lt;property name="ear" value="${env.HOME}/IBM/rationalsdp7.0/workspace/mywebappDeploy/mywebappEAR.ear" /&gt; &lt;target name="default" depends="deployEar"&gt; &lt;/target&gt; &lt;target name="generateWar" depends="compileWarClasses"&gt; &lt;jar destfile="mywebapp.war"&gt; &lt;fileset dir="../mywebapp/WebContent"&gt; &lt;/fileset&gt; &lt;/jar&gt; &lt;/target&gt; &lt;target name="compileWarClasses"&gt; &lt;echo message="was_cp=${was_cp}" /&gt; &lt;javac srcdir="../mywebapp/src" destdir="../mywebapp/WebContent/WEB-INF/classes" classpath="${was_cp}"&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="generateEar" depends="generateWar"&gt; &lt;mkdir dir="./earbin/META-INF"/&gt; &lt;move file="mywebapp.war" todir="./earbin" /&gt; &lt;copy file="../mywebappEAR/META-INF/application.xml" todir="./earbin/META-INF" /&gt; &lt;jar destfile="${ear}"&gt; &lt;fileset dir="./earbin" /&gt; &lt;/jar&gt; &lt;/target&gt; &lt;!-- http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/ant/tasks/package-summary.html --&gt; &lt;target name="deployEar" depends="generateEar"&gt; &lt;taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${was_cp}"/&gt; &lt;wsInstallApp ear="${ear}" failonerror="true" debug="true" taskname="" washome="${was_home}" /&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Notes:</p> <ul> <li>You can only run this once! You cannot install if the app name is in use - see other tasks like <strong>wsUninstallApp</strong></li> <li>It probably won't start the app either</li> <li>You need to run this on the server and the script is quite fragile</li> </ul> <p><strong>Alternatives</strong></p> <p>I would probably use Java Management Extensions (JMX). You could write a file-upload servlet that accepts an EAR and uses the deployment MBeans to deploy the EAR on the server. You would just POST the file over HTTP. This would avoid any WAS API dependencies on your dev/build machine and could be independent of any one project.</p>
<p>If you just want to play around why not use the netbeans IDE to generate your ear files. If you create an enterprise project it will automatically generate the ant files for you. Good for prototyping and just getting started :-)</p> <p>There is even a was plugin which allows automated deployment however this seems very shakey!</p>
2,605
<p>I'm attempting to use Mono to load a bitmap and print it on Linux but I'm getting an exception. Does Mono support printing on Linux? The code/exception are below:</p> <p><strong>EDIT:</strong> No longer getting the exception, but I'm still curious what kind of support there is. Leaving the code for posterity or something.</p> <pre><code>private void btnPrintTest_Click(object sender, EventArgs e) { _printDocTest.DefaultPageSettings.Landscape = true; _printDocTest.DefaultPageSettings.Margins = new Margins(50,50,50,50); _printDocTest.Print(); } void _printDocTest_PrintPage(object sender, PrintPageEventArgs e) { var bmp = new Bitmap("test.bmp"); // Determine center of graph var xCenter = e.MarginBounds.X + (e.MarginBounds.Width - bmp.Width) / 2; var yCenter = e.MarginBounds.Y + (e.MarginBounds.Height - bmp.Height) / 2; e.Graphics.DrawImage(bmp, xCenter, yCenter); e.HasMorePages = false; } </code></pre>
<p>From the <a href="http://www.mono-project.com/FAQ:_General" rel="noreferrer">Mono docs</a>, I think yes:</p> <blockquote> <p>Managed.Windows.Forms (aka System.Windows.Forms): A complete and cross platform, System.Drawing based Winforms implementation.</p> </blockquote> <p>It also useful if you run the <a href="http://www.mono-project.com/Moma" rel="noreferrer">Mono Migration Analyzer</a> first.</p>
<p><a href="http://www.go-mono.com/archive/1.2/" rel="nofollow noreferrer">According to</a></p> <p>System.Drawing is now complete, and in addition to being the underlying rendering engine for Windows.Forms, it has also been tested for using third party controls that heavily depend on it.</p>
4,705
<p>I've recently purchased a Makerbot Replicator Dual clone made by CTC. I'm in the process of upgrading/adding a few parts to it, but noticed that I can't control or print via USB.</p> <p>The machine prints perfectly from an SD card and I can see information in the terminal from the printer via USB in RepG and through OctoPrint - Such as M105 - but can't send any .x3g files to print or upgrade firmware (I wanted to flash Sailfish 7.7 eventually).</p> <p>To clarify;</p> <p><strong>In Octoprint</strong></p> <ul> <li>Temperature auto-reporting is working</li> <li>Can send M105, M27, etc.. &amp; get response</li> <li>Can select .x3g files from the SD card to print &amp; the printer starts</li> <li>Can upload files (.stl, .x3G, .gco etc..) to Octopi, but even the .x3g files wont actually start on the printer.</li> <li>Tried sending <code>M140 T0 S200</code> &amp; <code>M106 T0 S100</code> which received OK response, but there was no change reported, or indeed actually happening with the tool</li> </ul> <p><em>Terminal Output from OctoPrint at connection:</em></p> <pre><code>Changing monitoring state from &quot;Offline&quot; to &quot;Opening serial port&quot; Connected to: &lt;octoprint_GPX.gpxprinter.GpxPrinter instance at 0x6c9a02d8&gt;, starting monitor Starting baud rate detection... Changing monitoring state from &quot;Opening serial port&quot; to &quot;Detecting baudrate&quot; Trying baudrate: 115200 Recv: start Send: N0 M110 N0*125 Changing monitoring state from &quot;Detecting baudrate&quot; to &quot;Operational&quot; Recv: Makerbot v7.4 Send: N0 M110 N0*125 Recv: echo: gcode to x3g translation by GPX Recv: SD card ok Recv: T:27 /0 B:21 /0 T0:27 /0 T1:26 /0 @:0 B@:0 Recv: T:27 /0 B:20 /0 T0:27 /0 T1:26 /0 @:0 B@:0 Recv: T:27 /0 B:21 /0 T0:27 /0 T1:26 /0 @:0 B@:0 Recv: ok Send: N1 M115*39 Recv: ok PROTOCOL_VERSION:0.1 FIRMWARE_NAME:Makerbot FIRMWARE_VERSION:7.4 FIRMWARE_URL:https://support.makerbot.com/learn/earlier-products/replicator-original/updating-firmware-for-the-makerbot-replicator-via-replicatorg_13302 MACHINE_TYPE:r1d EXTRUDER_COUNT:2 Send: M21 Recv: ok Recv: SD card ok Send: M20 Recv: ok Recv: Begin file list Recv: 2GB Recv: System Volume Information Recv: mesh_bed.stl Recv: xyzCalibration_cube.x3g Recv: CTCB_3DBenchy.x3g Recv: 3DBenchy.x3g Recv: ActiveCoolingDuct.x3g Recv: CTCB_ActiveDuctD4_UN.x3g Recv: UK_TROLLEY_TOKEN.x3g Recv: mesh_bed.x3g Recv: z-axis-support.x3g Recv: bed-screws.x3g Recv: spool_nut.x3g Recv: 2016_spool.x3g Recv: 2016_spool_no_raft.x3g Recv: ActiveDuctD4_UN.x3g Recv: Z_Axis_Support_Ends.x3g Recv: End file list Send: M105 Recv: ok T:27 /0 B:20 /0 T0:27 /0 T1:26 /0 @:0 B@:0 Send: M105 </code></pre> <p><strong>In ReplicatorG</strong></p> <ul> <li>The software connects to the board via USB and recognises that it is a Mightyboard running f/w 7.4</li> <li>Reports that it is an unvarified board</li> <li>Cannot use the GUI control tab to send commands to the printer</li> <li>Cannot send sliced .x3g files over USB, console shows a time out error instantly</li> <li>Saving .x3g to SD card does work</li> </ul> <p>Is my Mightyboard just a dud, or is there something I can do to try and fix it?</p> <p>The reason I want to try and solve this now, is that I'm planning on adding active cooling and LED lighting control so don't really want to do all that just to find out that I need to replace the board soon.</p> <hr /> <h3>Additional info</h3> <p>Some information meaning that the current firmware and board is reported, as well as current temperatures of the extruders and heat bed. I can print .x3g files from the SD card, but I can't send G-code commands or .x3g files through USB.</p> <p>I have just tried a few G-code commands through OctoPrint terminal with mixed results. <code>M105</code> works, <code>M140</code> &amp; <code>M106</code> don't.</p>
<p>Good morning, and welcome to 3D Printing SE.</p> <p>You said: "I can see information from the printer via USB in RepG and through OctoPrint, but can't send any prints, commands or upgrade firmware (I wanted to flash Sailfish 7.7 eventually)." This means that the USB communication is working fine. It isn't a question of drivers or the FTDI interface chip. That must be working fine or you wouldn't have any USB communication.</p> <p>I would look toward a problem with slight dialect differences in the firmware that is flashed compared with the expectations of the host software.</p> <p>I am not an expert regarding the differences in firmware G-code dialects, but there are at least: Marlin, Repetier, Mach3, LinuxCNC, Machinekit, Smoothie, Makerware, Sailfish. I got this list from the <a href="https://slic3r.org/about/" rel="nofollow noreferrer">"about"</a> page for Slic3r.</p> <p>I would start by trying to slice files with different dialects and seeing if one of the resulting G-code files prints. You may also find a description of the firmware you have flashed with references one of these names, which would save a lot of time.</p> <p>For flashing, you could try dropping back to the Arduino level and use those flashing tools.</p> <hr> <p>More answer in response to the information you have added to the question.</p> <p>X3G files are not G-code files. If you are using a control program that expects G-code, it will not be able to handle X3G code. Similarly, if the printer expects X3G, it may not understand G-code.</p> <p>Octoprint has an adapter layer that seems to interconvert between g-code and GPX. You are running this layer. At about line 11 of the log file you added to the question:</p> <blockquote> <p>Recv: echo: gcode to x3g translation by GPX</p> </blockquote> <p>The GPX add-in may be perfect, and it may cover all version of firmware and all functions. I don't use it and am unfamiliar with it.</p> <p>To flash your board, I would be reluctant to assume that Octoprint/GPX new how to run that protocol. I would use the host software supplied by the vendor. Flashing is an infrequent operation, and add-on software is less likely to have it 100% correct. If I were writing GPX, I would intentionally make flashing be out-of-scope, since the consequences of doing it wrong could easily be to brick the printer.</p> <p>Since Octoprint/GPX claims to be able to print to the printer, I would being all software up the respective current versions. Flash current Sailfish firmware using the supplied host tools. Update to the current/best version of Octoprint/GPX. Read the release notes of Octoprint/GPX for known issues.</p> <p>It seems that X3D files are fairly limited in their use, which will constrain your options to be within the scope of the community that uses X3D files. I tried to add the X3D tag to your question, but so far no one has created the X3D tag.</p> <p>Makerbot is part of Stratasys, and should be well supported. It may be well supported mostly within its ecosystem. You have a clone of a Makerbot machine, so, even though most or all of the printer parts are open source, you may not be able to use the genuine Makerbot host control software.</p> <p>Your question asked if your controller board was working. It almost certainly is. I think you have a software/firmware compatibility problem.</p>
<p>It is possible that your board has a cloned FT232R USB-to-serial bridge chip, and FTDI drivers supplied via the Windows update channel will not work with cloned chips. Try using the Windows setup executable from the following page:</p> <p><a href="https://www.ftdichip.com/Drivers/VCP.htm" rel="nofollow noreferrer">FTDI Chip: Virtual COM Port Drivers</a></p> <p>Note that there are no known problems with MacOS and Linux drivers.</p>
1,377
<p>I have a user interface in .net which needs to receive data from a server, on a request/reply/update model. The only constraint is to use Java only on the server box.</p> <p>What is the best approach to achieve this ? Is it by creating a Webservice in Java and then accessing it in .net, or should I create Java proxies and convert them in .net by using IKM ? Or do you have any better idea ? It can be HTTP based, used a direct socket connection, or any middleware.</p>
<p>I recommend the web service route. It offers a standard interface that can be consumed by other client platforms in the future.</p> <p>.NET clients interact with Java web services pretty well, though there are some gotchas. The best two technologies available for you for the .NET client are Microsoft Web Service Enhancements (WSE) and Windows Communication Foundation (WCF). WSE is an older technology that is no longer being updated by Microsoft, but still works great in Visual Studio 2005 and older. I find WSE to be a bit easier to get started with in terms of how you interface with basic services, but WCF has much more support for WS-* protocols (security, trust, etc.). If your needs are basic and you're still using Visual Studio 2005 (.NET framework 2 or older), then go with WSE. If you like the cutting edge, or you anticipate more advanced security needs (doesn't sound like you will), then go with WCF. Please note that WSE will not work easily in Visual Studio 2008 and newer, and WCF will not work in Visual Studio 2005 and older.</p> <p>Going the web service route will mean that you will design to an interface that can be reused and will result in a more loosely coupled system when you're done than most of the other routes. The downside is primarily performance: xml serialization will be slower than binary over the wire, and web services do not handle large amounts of data well.</p>
<p>Using a standard type of web service (e.g. SOAP or XML-RPC) is best because not only is it easy to produce/consume, it's easy in other languages as well.</p>
9,002
<p><a href="http://en.wikipedia.org/wiki/ICalendar" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/ICalendar</a></p> <p>I'm working to implement an export feature for events. The link above lists tons of clients that support the ICalendar standard, but the "three big ones" I can see are Apple's iCal, Microsoft's Outlook, and Google's Gmail.</p> <p>I'm starting to get the feeling that each of these client implement different parts of the "standard", and I'm unsure of what pieces of information we should be trying to export from the application so that someone can put it on their calendar (especially around recurrence).</p> <p>For example, from what I understand Outlook doesn't support hourly recurrence.</p> <p>Could any of you provide guidance of the "happy medium" here from a features implementation standpoint?</p> <p>Secondary question, if we decide to cut features from the export (such as hourly recurrence) because it isn't supported in Outlook, should we support it in the application as well? (it is a general purpose event scheduling application, with no business specific use in mind...so we really are looking for the happy medium).</p>
<p>I have to say that I don't use the hourly recurrence feature as really how many people have events that repeat in the same day? I could see if someone however was to schedule when they needed to take a particular medicine at recurring times throughout the day.</p> <p>I would say support full features in the application itself, but provide a warning when they go to export the calendar that all event details may not work as expected or find a way to export in a different manner for Outlook alone that does provide the hourly recurrence feature.</p>
<p>I use iCal in <a href="http://www.mozilla.org/projects/calendar/" rel="nofollow noreferrer">Lightning</a> (Thunderbird) and <a href="http://www.rainlendar.net/cms/index.php" rel="nofollow noreferrer">Rainlendar</a>.</p> <p>I have used Calendaring software for years (decades) and have never had a need for repeating events within the same day. It is simple to add additional daily repeating events in the same day if it is really needed.</p>
2,813
<p>As stated above, I am trying to solve a problem I've had for a long time. Unfortunately, this has recently intensified to the point where it causes layer splitting/detaching from each other. I have tried various ways to fix this and, while decreasing the temperature and extrusion multiplier improved the situation, the problem is still present. </p> <p>My settings: <li>Nozzle 235&nbsp;&deg;C Bed 100&nbsp;&deg;C <li>Cooling 25&nbsp;% <li>Extrusion multiplier 0.89 <li>Speed 150&nbsp;mm/s for everything, 50&nbsp;mm/s for small perimiters <li>Acceleration 1000&nbsp;mm/s<sup>2</sup>, (default) <li>Layer height 0.15-0.3mm <li>Line width - 0.6mm for everything, but 0.45 for first layer and 0.42 for top solid infill</p> <p>Is there a different solution than lowering print speed or buying an E3D silicon sock? I have lost my spare ones and the current one wore down. Obviously, I can simply pause the print when I see plastic bulding up on the nozzle, but I am sure that there is a more efficient solution.</p> <p>UPDATE: I found that the hotend was very dirty and full of burnt/molten plastic. I am almost sure that the hotend is leaking somewhere between the heat block and the heat break. This didn't happen before I replaced the nozzle. How can I fix this? Do I have to replace the heat break or some other part?</p>
<p>I saw PETG printed at 100 mm/s, but 150! That's a lot.</p> <p>One solution to avoid blobs may be to limit the maximum speed to a value you can actually achieve with reliable results.</p> <p>Simple test to find your machine limits (each combination filament brand + nozzle + temperature has a different value): extrude filament in the air at increasing speeds, see how the flow changes, and when you see more than 5% decrease, that's it.</p> <ol> <li>M83</li> <li>mark the filament as if you were calibrating the E steps</li> <li>calculate filament speed: speed = volum/s / filament surface * 60 = mm^3/s * 25 (this factor is valid for 1.75 mm filament)</li> <li>set extrusion speed for 2 mm^3/s: G1 F50</li> <li>extrude 50 mm: G1 E50</li> <li>measure actual length extruded</li> <li>repeat 2.-6. but increase the speed by 2 mm^3/s each time: 2, 4, 6, 8, 10, 12, ...</li> <li>at a certain speed you will see that the actual filament length starts to decrease. When you see that the underextrusion reaches 5-10% (depending how much underextrusion you accept), write down that volumetric speed (mm^3/s) somewhere, it's your limit for THAT filament + THAT nozzle + THAT temperature</li> <li>Either a) calculate the max print speed = volumetric speed / layer height / line width or b) set the maximum volumetric flow rate in the slicing software so that the speed will be automatically capped taking into account layer height and line width. <a href="https://help.prusa3d.com/en/article/max-volumetric-speed_127176/" rel="nofollow noreferrer">Prusaslicer</a> allows to set that in the "Print" or in "Filament" settings, I recommend it for "Filament" settings, since it's a filament-dependent parameter.</li> </ol> <p>Example data from <a href="https://www.cnckitchen.com/blog/flow-rate-benchmarking-of-a-hotend" rel="nofollow noreferrer">CNC Kitchen</a>:</p> <p><a href="https://i.stack.imgur.com/xXRYV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xXRYV.png" alt="enter image description here"></a></p> <p>You can increase the max print speed, at the price of a little loss of quality around edges, if you calibrate the E steps at a speed corresponding to 2-3% underextrusion (alternative: to the speed of outer perimeters).</p> <p>This way you know that when you print slower than that (uncommon... typically only sharp corners and small perimeters) you'll get up to 2-3% overextrusion, and you extend by 2-3% the maximum print speed, since your max speed is the one where you get 5-10% underextrusion compared to your E steps calibration speed.</p>
<p>Even not extruding anything but just performing travel moves over PETG at 100 mm/s or higher will <em>tear it up and drag material all over the place</em>. The result is blobs stuck to the nozzle, possibly even stringing, and choppy lines that the next layer will not properly adhere to. PETG simply cannot be printed at these kind of speeds regardless of how fast your hotend can melt it.</p> <p>Turn <strong>all</strong> speeds, print and travel, down to 40-50 mm/s, then experiment to see if you can increase them at all.</p> <p>Note that if your acceleration is only 1000 mm/s², you're basically never going to reach the desired 150 mm/s anyway, so this probably won't be as much of a slowdown as you expect. Jack the acceleration up as high as your machine can handle and it might still print as fast or faster, but without the blobs.</p>
1,673
<p>I know I can programatically make the taskbar item for a particular window start flashing when something changes, but is there any way I can stop it from flashing either programatically after a certain period of time or at least is there a keyboard shortcur I can give to my users to somehow stop the flashing?</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx" rel="noreferrer">FlashWindowEx</a> function which controls the flashing takes a <a href="http://msdn.microsoft.com/en-us/library/ms679348%28VS.85%29.aspx" rel="noreferrer">FLASHWINFO</a> struct which has a uCount field to control how many times it flashes. Also, a possible value for the dwFlags field is FLASHW_STOP to cause the flashing to stop.</p> <p>EDIT: Forgot was a C# tagged question ... so <a href="http://www.pinvoke.net/default.aspx/user32.FlashWindowEx" rel="noreferrer">P/Invoke goodness found here</a>.</p>
<p>@thomas -- Amazingly Microsoft's own <a href="http://msdn.microsoft.com/en-us/library/aa511446.aspx" rel="nofollow noreferrer">Windows Vista User Experience Guidelines</a> agree with you ...</p> <blockquote> <p>While having a background window flash its taskbar button is better than having it automatically come to the top and steal input focus, flashing taskbar buttons are still very intrusive. It is hard for users to concentrate when a taskbar button is flashing, so you should assume that users will immediately stop what they are doing to make the flashing stop. Consequently, reserve taskbar flashing only for situations where immediate attention is required.</p> </blockquote> <p>Of course who knows who actually follows those guidelines ... or who even reads them. :)</p>
4,910
<p>Does anyone have a regular expression for matching function calls in C programs ?</p>
<p>After a bit more searching I decided to let the compiler do the hard work.</p> <p>Get the compiler to produce a <a href="http://en.wikipedia.org/wiki/Register_Transfer_Language#RTL_in_GCC" rel="nofollow noreferrer">Register Transfer Language (RTL)</a> file using the -dr options of gcc.</p> <p>The produced RTL file has the suffix .rtl or .expand.</p> <p>This file is far easier to parse as the functions calls are already identified.</p>
<p>I doubt you can find a regex that matches all (and only) the function calls in some source code. But maybe you could use a tool like <a href="http://www.scitools.com/products/understand/" rel="nofollow noreferrer">Understand</a>, or your IDE, to browse your code.</p>
6,051
<p>I'm trying to decode the result of the Python os.wait() function. This returns, according to the Python docs:</p> <blockquote> <p>a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced.</p> </blockquote> <p>How do I decode the exit status indication (which is an integer) to obtain the high and low byte? To be specific, how do I implement the decode function used in the following code snippet:</p> <pre><code>(pid,status) = os.wait() (exitstatus, signum) = decode(status) </code></pre>
<p>This will do what you want:</p> <pre><code>signum = status &amp; 0xff exitstatus = (status &amp; 0xff00) &gt;&gt; 8 </code></pre>
<p>The folks before me've nailed it, but if you really want it on one line, you can do this:</p> <pre><code>(signum, exitstatus) = (status &amp; 0xFF, (status &gt;&gt; 8) &amp; 0xFF) </code></pre> <p>EDIT: Had it backwards.</p>
3,138
<p>I'm not quite sure if this is possible, or falls into the category of pivot tables, but I figured I'd go to the pros to see.</p> <p>I have three basic tables: Card, Property, and CardProperty. Since cards do not have the same properties, and often multiple values for the same property, I decided to use the union table approach to store data instead of having a really big column structure in my card table.</p> <p>The property table is a basic keyword/value type table. So you have the keyword ATK and the value assigned to it. There is another property called SpecialType which a card can have multiple values for, such as "Sycnro" and "DARK"</p> <p>What I'd like to do is create a view or stored procedure that gives me the Card Id, Card Name, and all the property keywords assigned to the card as columns and their values in the ResultSet for a card specified. So ideally I'd have a result set like:</p> <pre><code>ID NAME SPECIALTYPE 1 Red Dragon Archfiend Synchro 1 Red Dragon Archfiend DARK 1 Red Dragon Archfiend Effect </code></pre> <p>and I could tally my results that way.</p> <p>I guess even slicker would be to simply concatenate the properties together based on their keyword, so I could generate a ResultSet like:</p> <pre><code>1 Red Dragon Archfiend Synchro/DARK/Effect </code></pre> <p>..but I don't know if that's feasible.</p> <p>Help me stackoverflow Kenobi! You're my only hope.</p>
<p>Is this for SQL server?</p> <p>If yes then</p> <p><a href="http://wiki.lessthandot.com/index.php/Concatenate_Values_From_Multiple_Rows_Into_One_Column" rel="nofollow noreferrer">Concatenate Values From Multiple Rows Into One Column (2000)</a><br> <a href="http://wiki.lessthandot.com/index.php/Concatenate_Values_From_Multiple_Rows_Into_One_Column_Ordered" rel="nofollow noreferrer">Concatenate Values From Multiple Rows Into One Column Ordered (2005+)</a></p>
<p>Don't collapse by concatenation for storage of related records in your database. Its not exactly best practices. </p> <p>What you're describing is a pivot table. Pivot tables are <em>hard</em>. I'd suggest avoiding them if at all possible. </p> <p>Why not just read in your related rows and process them in memory? It doesn't sound like you're going to spend too many milliseconds doing this...</p>
3,881
<p>I cant post the code (proprietary issues) but does anyone know what types of things would cause the following error in C#. It is being thrown by a VOIP client that I wrote (using counterpath api) when the call is ended by the other client. The error is:</p> <pre><code>System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at CollabAnalysisSF.Edge.GUI.Forms.Program.Main() in d:\data\beyerss\Desktop\client\GUI\ARGui\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: </code></pre> <p><em>UPDATE:</em><br> Turns out one of the libraries we were using was sending off an event that we didnt know about, and the problem was in there somewhere. Fixed now.</p>
<p>List of some possibilities:</p> <ul> <li>An object is being used after it has been disposed. This can happen a lot if you are disposing managed object in a finalizer (you should not do that).</li> <li>An unmannaged implementation of one of the object you are using is bugged and it corrupted the process memory heap. Happens a lot with DirectX, GDI and others.</li> <li>Mashaling on managed-unmanaged boundary is flawed. Make sure you pin a managed pointer before you use it on an unmanaged part of code.</li> <li>You are using unsafe block and doing funny stuff with it.</li> </ul> <hr> <p>In you case it could be a problem with Windows Forms. But the problem is not that it is happening, but rather that it is not being reported correctly; you possibly still have done something wrong.</p> <p>Are you able to determine what control is causing the error using the HWND? Is it always the same? Is this control doing something funny just before the application crashes? Is the unmannaged part of the control a custom window or a standard control?</p>
<p>Here is a more detailed stacktrace. It looks to me like it has something to do with the System.Windows.Form.dll</p> <p>the TargetSite is listed as <code>{IntPtr DispatchMessageW(MSG ByRef)}</code><br> and under module it has System.windows.forms.dll</p>
3,855
<p>We provide a web application with a frontend completely developed in Adobe Flash. When we chose Flash 6 years ago, we did so for its large number of features for user interaction, like dragging stuff, opening and closing menus, tree navigation elements, popup dialogs etc.</p> <p>Today it's obvious that AJAX/JS offers roughly the same possibilities and because of the number of frameworks that are readily available, it's very feasible to implement them.</p> <p>Is there a technical reason one should choose either technology over the other? By "technical", I mean performance, security, portability/compatibility and the like. I don't mean aspects such as the very non-programmer way development is done in Flash or whether it makes sense to switch an app from one to the other.</p> <p>As I just explained <a href="https://stackoverflow.com/questions/52094/which-ria-technology-has-the-biggest-market-share">in another question</a>, it seems to me that JS is way ahead in terms of market share and I'm wondering whether we are missing some important point if we stick to Flash.</p>
<ul> <li>Correctly designed AJAX apps are more googleable than Flash</li> <li>Correctly designed AJAX apps are more easily deep linkable than Flash</li> <li>AJAX doesn't require a plugin (Flash is pretty ubiquitous, so it's not really a big deal)*</li> <li>AJAX isn't controlled by a single company the way Flash is</li> </ul> <p>Edited to add: * Except for the iPhone, as Abdu points out.</p>
<p>I think Flash should be limited to online games, videos and animation. Otherwise use html and Ajax. It's a web standard and supported by almost all devices. AFAIK, the iPhone doesn't support Flash. That's a fast growing segment you're blocking out already. Keep it simple and efficient. </p>
7,539
<p>Following this question:<br> <a href="https://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">Good crash reporting library in c#</a></p> <p>Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notify the developer about it?</p> <p>Edit: This seems to be a duplicate of <a href="https://stackoverflow.com/questions/18265/getting-stack-traces-on-unix-systems-automatically">this question</a></p>
<p>See <em><a href="https://stackoverflow.com/questions/18265/getting-stack-traces-on-unix-systems-automatically">Getting stack traces on Unix systems, automatically</a></em> on Stack Overflow.</p>
<p>Note: there are two interesting registers in an <code>x86</code> seg-fault crash.</p> <p>The first, <strong>EIP</strong>, specifies the code address at which the exception occurred. In RichQ's answer, he uses addr2line to show the source line that corresponds to the crash address. But EIP can be invalid; if you call a function pointer that is null, it can be <code>0x00000000</code>, and if you corrupt your call stack, the return can pop any random value into EIP.</p> <p>The second, <strong>CR2</strong>, specifies the data address which caused the segmentation fault. In RichQ's example, he is setting up i as a null pointer, then accessing it. In this case, CR2 would be <code>0x00000000</code>. But if you change:</p> <pre><code>int j = *i </code></pre> <p>to:</p> <pre><code>int j = i[2]; </code></pre> <p>Then you are trying to access address <code>0x00000008</code>, and that's what would be found in CR2. </p>
7,172
<p>I have some flexible PLA filament (<a href="https://rads.stackoverflow.com/amzn/click/com/B00VKSSA4E" rel="noreferrer" rel="nofollow noreferrer">https://www.amazon.com/dp/B00VKSSA4E/</a>, presumably a mix of PLA with some platicizer) that's supposed to be easy to print with settings similar to regular PLA. I've seen recommendations to disable retraction, and indeed I get huge failures to extrude at all for a while after retraction if it's enabled. But with retraction disabled, I get stringing all over the place, and since the material isn't brittle, it's really difficult to remove.</p> <p>I'm using a bed temp of 60 and print temp of 220, increased from 210 for normal PLA since I had trouble getting it to adhere at lower temp. Printer is Creality Ender 3. Using CuraEngine for slicing. The extruder is feeding the material fine; there's no kinking going on or anything.</p> <p>Where should I start trying to improve this? Might retraction work with a really really slow print speed or greatly reduced retraction distance? Or are there other ways to avoid stringing?</p>
<p>You could enable <code>combing</code> in the slicer. Combing not only prevents retracts, it also uses already laid down paths for movement from one to the other location and as such reduces the amount of stringing.</p>
<p>The right path seems to be enabling retraction, but tuning the retraction and print speed settings. I started out by dropping all speed settings to 30. With retraction disabled, this turned the stringing into solid walls between paths, with only a tiny gap at the very start of the wall, right after the extruder stopped:</p> <p><a href="https://i.stack.imgur.com/StzqN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/StzqN.jpg" alt="enter image description here"></a></p> <p>This suggested that the sudden drop in pressure at the nozzle is cutting off the string momentarily. Back to that thought in a bit.</p> <p>Independently of the pressure thought, I decided to turn retraction back on, but with <em>really</em> slow retraction speed. This helped a lot, but probably not the way I expected; I think what it did was give the nozzle time to ooze at the point where retraction happens, rather than in the travel path. I also turned off <code>infill_before_walls</code>, so that the retraction and potential oozing would happen in the infill region rather than walls, and increased the travel speed way up to 200 to take best advantage of the moment where oozing is interrupted.</p> <p>At this point, I'm getting almost-acceptable results with <code>retraction_retract_speed</code> set to 5 (vs default 25), default retraction amount, and <code>speed_travel</code> of 200:</p> <p><a href="https://i.stack.imgur.com/5MSpu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5MSpu.jpg" alt="enter image description here"></a></p> <p>Back to the pressure idea, I'm thinking that the right solution is probably to perform the retraction concurrently with the travel, keeping some negative pressure the whole time, and possibly jerking the extruder back further just before hitting the travel destination to prevent a string from forming there. Cura has no features to do anything like that, but it shouldn't be difficult as post-processing on the gcode. I might try prototyping it like that to see if it works.</p>
1,254
<p>Is there any library (or even better, web service) available which can convert from a latitude/longitude into a time zone?</p>
<p>I looked fairly deeply into this question for a project I am working on. GeoNames.org and EarthTools.com are both good options for many situations but with the following serious flaws:</p> <ul> <li>GeoNames.org finds the time zone by searching for the nearest point in their database that contains a time zone field. This often leads to the wrong result near borders. It is also painfully slow, leading to query times on the order of a couple seconds per request. It also doesn't return a valid time zone if there is no item in their database near the query point. GeoNames also restricts the number of queries that can be made per day, making bulk operations difficult.</li> <li>EarthTools.org uses a map and is able to return queries quickly, but it doesn't take into account daylight savings time for most locations, and it returns a raw offset rather than a time zone ID (i.e., they return "GMT-7" instead of "America/Chicago"). Also, I just looked at their page while preparing this post and Google Chrome warned about malware on their site. That is new to me and it may change, but is obviously a cause for concern.</li> </ul> <p>These flaws meant that these existing tools were not suitable for my needs so I rolled my own solution and have published it for general use. You can find it here:</p> <p><a href="http://www.askgeo.com/" rel="noreferrer">http://www.askgeo.com/</a></p> <p>AskGeo is based on a time zone map of the world, so it returns a valid time zone for every valid latitude and longitude. It returns the standard time zone ID (e.g., "America/Los_Angeles") used on Linux and most other operating systems and programming frameworks. It also returns the current offset, taking full account of daylight savings time.</p> <p>It is extremely easy to use and usage is documented on the main page of the site. The API supports batch queries, so if you need to do a lot of look-ups, please use the batch interface rather than bog down our servers with serial requests. The bulk queries are also much faster, so everybody wins.</p> <p>When we first launched this, we built it on Google App Engine (GAE) and made it free to all users. This was possible because GAE's prices were so low at that time. Since then, our server load has increased substantially and GAE's prices went way up. Both factors combined led us to switch to Amazon Web Services for hosting and to start charging for commercial use, while keeping the service free for non-profit, non-commercial open source projects, and researchers. For commercial users, we provide 1000 free queries to let potential customers evaluate the API to make sure it meets their needs. See the web site for pricing and terms.</p> <p>The underlying library was written in Java and due to popular demand, we also released the library under a commercial license. Full documentation of the library and pricing details are on the web site.</p> <p>I hope this is useful. It certainly was useful for the project I was working on.</p>
<p><a href="http://drtengine.com/pages/geo_get_timezone" rel="nofollow">DRT Engine</a> takes a latitude, longitude and local datetime and returns a timezone offset. This can be used to establish the timezone of a particular location at a <em>future</em> date.</p>
6,282
<p>I have a user that want to be able to select a textbox and have the current text selected so that he doesn't have to highlight it all in order to change the contents. </p> <p>The contents need to be handle when enter is pushed. That part I think I have figured out but any suggestions would be welcome. </p> <p>The part I need help with is that once enter has been pushed, any entry into the textbox should clear the contents again.</p> <p><strong>Edit:</strong> The textbox controls an piece of RF hardware. What the user wants to be able to do is enter a setting and press enter. The setting is sent to the hardware. Without doing anything else the user wants to be able to type in a new setting and press enter again.</p>
<p>Hook into the KeyPress event on the TextBox, and when it encounters the Enter key, run your hardware setting code, and then highlight the full text of the textbox again (see below) - Windows will take care of clearing the text with the next keystroke for you.</p> <pre><code>TextBox1.Select(0, TextBox1.Text.Length); </code></pre>
<p>OK, are you sure that is wise? I am picturing two scenarios here:</p> <ol> <li>There is a default button on the form, which is "clicked" when enter is pushed".</li> <li>There is no default button, and you want the user to have to press enter, regardless.</li> </ol> <p>Both of these raise the same questions:</p> <ul> <li>Is there any validation that is taking place on the text?</li> <li>Why not create a user control to encapsulate this logic?</li> <li>If you know the enter button is being pushed and consumed fine, how are you having problems with <em>TextBoxName.Text = string.Empty</em> ?</li> </ul> <p>Also, as a polite note, can you please try and break up your question a bit? One big block is a bit of a pain to read..</p>
3,683
<p>Is it possible to have a fixture change between test methods? If so, how can I do this? </p> <p>My syntax for this problem : </p> <p>In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to work in the same way that adding the "created" and "modified" fields will auto-populate these fields on save.</p> <p>To test this I <em>could</em> create dozens of fixtures/model combos to test the different setups, but it would be a hundred times better, faster and easier to just have the fixture change "shape" between test methods. </p> <blockquote> <p>If you are not familiar with the <a href="http://cakephp.org" rel="nofollow noreferrer">CakePHP framework</a>, you can maybe still help me as it uses <a href="http://simletest.org" rel="nofollow noreferrer">SimpleTest</a></p> </blockquote> <p><em>Edit: rephrased question to be more general</em></p>
<p>Last time I checked, you could use the <a href="http://developers.sugarcrm.com/tutorials/Customizing_Sugar/4/" rel="nofollow noreferrer">module builder</a> to extend the interface. From 5.0 (or maybe 4.x) on, Sugar added all those APIs, which should enable you to extend SugarCRM without hacking it in and losing it with the next upgrade.</p> <p>Hope that helps!</p>
<p>Basically, the Account name should be a related field in your new invoices module (base the module creation on something like QUOTES that has similar fields. Once you create the module (so simple you can almost guess your way through it in the ADMIN section) and the fields you like (using Studio) just add the RELATED field Account Name and the sub-panel will be established in your ACCOUNTS module and the invoice will magically populate, especially if you re-install them using the import feature from a CSV file (spreadsheet).</p>
5,857
<p>I'm evaluating and looking at using CherryPy for a project that's basically a JavaScript front-end from the client-side (browser) that talks to a Python web service on the back-end. So, I really need something fast and lightweight on the back-end that I can implement using Python that then speaks to the PostgreSQL DB via an ORM (JSON to the browser).</p> <p>I'm also looking at Django, which I like, since its ORM is built-in. However, I think Django might be a little more than I really need (i.e. more features than I really need == slower?).</p> <p>Anyone have any experience with different Python ORM solutions that can compare and contrast their features and functionality, speed, efficiency, etc.?</p>
<p>SQLAlchemy is more full-featured and powerful (uses the DataMapper pattern). Django ORM has a cleaner syntax and is easier to write for (ActiveRecord pattern). I don't know about performance differences.</p> <p>SQLAlchemy also has a <a href="http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/declarative/index.html" rel="noreferrer">declarative layer</a> that hides some complexity and gives it a ActiveRecord-style syntax more similar to the Django ORM.</p> <p>I wouldn't worry about Django being "too heavy." It's decoupled enough that you can use the ORM if you want <a href="https://stackoverflow.com/a/2180431/623735">without having to import the rest</a>.</p> <p>That said, if I were already using CherryPy for the web layer and just needed an ORM, I'd probably opt for SQLAlchemy.</p>
<p>I'd check out <a href="http://www.sqlalchemy.org/" rel="nofollow noreferrer">SQLAlchemy</a> </p> <p>It's really easy to use and the models you work with aren't bad at all. <strike>Django uses SQLAlchemy for it's ORM</strike> but using it by itself lets you use it's full power.</p> <p>Here's a small example on creating and selecting orm objects</p> <pre><code>&gt;&gt;&gt; ed_user = User('ed', 'Ed Jones', 'edspassword') &gt;&gt;&gt; session.add(ed_user) &gt;&gt;&gt; our_user = session.query(User).filter_by(name='ed').first() &gt;&gt;&gt; our_user &lt;User('ed','Ed Jones', 'edspassword')&gt; </code></pre>
7,687
<p>I have a .Net desktop application with a TreeView as one of the UI elements.</p> <p>I want to be able to multi-select that TreeView, only that isn't supported at all.</p> <p>So I'm adding check-boxes to the tree, My problem is that only some items are selectable, and those that aren't can't consistently cascade selections. </p> <p>Is there any way to disable or hide some check-boxes while displaying others?</p>
<p>The default behavior of TreeView is that when the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.checkboxes%28VS.80%29.aspx" rel="nofollow noreferrer">Checkboxes</a> property is set to true, that checkboxes will be shown for all TreeNodes.</p> <p>The behavior that you are looking for - to disable or hide some checkboxes - is a custom modification of the normal behavior. You can create a custom implementation of TreeView or TreeNode that overrides the default behavior. One other thing to try would be to use the TreeView.<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.stateimagelist%28VS.80%29.aspx" rel="nofollow noreferrer">StateImageList</a> property. Some sites to check out for more info:</p> <ul> <li>See <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3727125&amp;SiteID=1" rel="nofollow noreferrer">this post</a> to the MSDN forums that goes through an implementation similar to what you are attempting. </li> <li>CodeProject: <a href="http://www.codeproject.com/KB/tree/TriStateTreeViewSubmissio.aspx" rel="nofollow noreferrer">Tri-State TreeView</a></li> <li>CodeProject: <a href="http://www.codeproject.com/KB/tree/customstatetreeview.aspx?msg=1519062" rel="nofollow noreferrer">How to handle custom node state images in a TreeView (e.g. tristate checkboxes)</a></li> </ul>
<p><a href="http://www.codeproject.com/KB/tree/Multiselect_Treeview.aspx" rel="nofollow noreferrer">MultiSelectTreeView</a>:</p> <blockquote> <p>Why doesn't .NET have a multiselect treeview? There are so many uses for one and turning on checkboxes in the treeview is a pretty lousy alternative.</p> </blockquote>
6,020
<p>I'm working on a tool that will generate the source code for an interface and a couple classes implementing that interface. My output isn't particularly complicated, so it's not going to be hard to make the output conform to our normal code formatting standards.</p> <p>But this got me thinking: how human-readable does auto-generated code need to be? When should extra effort be expended to make sure the generated code is easily read and understood by a human?</p> <p>In my case, the classes I'm generating are essentially just containers for some data related to another part of the build with methods to get the data. No one should ever need to look at the code for the classes themselves, they just need to call the various getters the classes provide. So, it's probably not too important if the code is "clean", well formatted and easily read by a human.</p> <p>However, what happens if you're generating code that has more than a small amount of simple logic in it?</p>
<p>I think it's just as important for generated code to be readable and follow normal coding styles. At some point, someone is either going to need to debug the code or otherwise see what is happening "behind the scenes".</p>
<p>It's quite possible that somebody in the future will want to go through and see what your code does. So making it somewhat understandable is a good thing.</p> <p>You also might want to include at the top of each generated file a comment saying how and why this file was generated and what it's purpose is.</p>
8,878
<p>I have two applications written in Java that communicate with each other using XML messages over the network. I'm using a SAX parser at the receiving end to get the data back out of the messages. One of the requirements is to embed binary data in an XML message, but SAX doesn't like this. Does anyone know how to do this?</p> <p>UPDATE: I got this working with the <a href="http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html" rel="noreferrer">Base64</a> class from the <a href="http://commons.apache.org/codec/" rel="noreferrer">apache commons codec library</a>, in case anyone else is trying something similar.</p>
<p>You could encode the binary data using base64 and put it into a Base64 element; the below article is a pretty good one on the subject.</p> <p><a href="http://www.xml.com/pub/a/98/07/binary/binary.html" rel="noreferrer">Handling Binary Data in XML Documents</a></p>
<p>If you have control over the XML format, you should turn the problem inside out. Rather than attaching the binary XML you should think about how to enclose a document that has multiple parts, one of which contains XML.</p> <p>The traditional solution to this is an archive (e.g. tar). But if you want to keep your enclosing document in a text-based format or if you don't have access to an file archiving library, there is also a standardized scheme that is used heavily in email and HTTP which is <a href="https://www.rfc-editor.org/rfc/rfc2387" rel="nofollow noreferrer">multipart/* MIME</a> with <a href="https://www.rfc-editor.org/rfc/rfc3030" rel="nofollow noreferrer">Content-Transfer-Encoding: binary</a>.</p> <p>For example if your servers communicate through HTTP and you want to send a multipart document, the primary being an XML document which refers to a binary data, the HTTP communication might look something like this:</p> <pre><code>POST / HTTP/1.1 Content-Type: multipart/related; boundary=&quot;qd43hdi34udh34id344&quot; ... other headers elided ... --qd43hdi34udh34id344 Content-Type: application/xml &lt;myxml&gt; &lt;data href=&quot;cid:data.bin&quot;/&gt; &lt;/myxml&gt; --qd43hdi34udh34id344 Content-Id: &lt;data.bin&gt; Content-type: application/octet-stream Content-Transfer-Encoding: binary ... binary data ... --qd43hdi34udh34id344-- </code></pre> <p>As in above example, the XML refer to the binary data in the enclosing multipart by using a <code>cid</code> URI scheme which is an identifier to the Content-Id header. The overhead of this scheme would be just the MIME header. A similar scheme can also be used for HTTP response. Of course in HTTP protocol, you also have the option of sending a multipart document into separate request/response.</p> <p>If you want to avoid wrapping your data in a multipart is to use data URI:</p> <pre><code>&lt;myxml&gt; &lt;data href=&quot;data:application/something;charset=utf-8;base64,dGVzdGRhdGE=&quot;/&gt; &lt;/myxml&gt; </code></pre> <p>But this has the base64 overhead.</p>
4,026
<p>Let's say I have the following class:</p> <pre><code>public class Test&lt;E&gt; { public boolean sameClassAs(Object o) { // TODO help! } } </code></pre> <p>How would I check that <code>o</code> is the same class as <code>E</code>?</p> <pre><code>Test&lt;String&gt; test = new Test&lt;String&gt;(); test.sameClassAs("a string"); // returns true; test.sameClassAs(4); // returns false; </code></pre> <p>I can't change the method signature from <code>(Object o)</code> as I'm overridding a superclass and so don't get to choose my method signature.</p> <p>I would also rather not go down the road of attempting a cast and then catching the resulting exception if it fails.</p>
<p>An instance of <code>Test</code> has no information as to what <code>E</code> is at runtime. So, you need to pass a <code>Class&lt;E&gt;</code> to the constructor of Test.</p> <pre><code>public class Test&lt;E&gt; { private final Class&lt;E&gt; clazz; public Test(Class&lt;E&gt; clazz) { if (clazz == null) { throw new NullPointerException(); } this.clazz = clazz; } // To make things easier on clients: public static &lt;T&gt; Test&lt;T&gt; create(Class&lt;T&gt; clazz) { return new Test&lt;T&gt;(clazz); } public boolean sameClassAs(Object o) { return o != null &amp;&amp; o.getClass() == clazz; } } </code></pre> <p>If you want an "instanceof" relationship, use <code>Class.isAssignableFrom</code> instead of the <code>Class</code> comparison. Note, <code>E</code> will need to be a non-generic type, for the same reason <code>Test</code> needs the <code>Class</code> object.</p> <p>For examples in the Java API, see <code>java.util.Collections.checkedSet</code> and similar.</p>
<p>I was just trying to do the same thing, and one neat trick i just realized is that you can can try a cast, and if the cast fails, ClassCastException will be thrown. You can can catch that, and do whatever. </p> <p>so your sameClassAs method should look like:</p> <pre><code>public boolean sameClassAs(Object o) { boolean same = false; try { E t = (E)o; same = true; } catch (ClassCastException e) { // same is false, nothing else to do } finally { return same; } } </code></pre>
7,471
<p>Following the question I asked here: <a href="https://3dprinting.stackexchange.com/questions/8735/replace-x-axis-motor-with-different-model/8738?noredirect=1#comment14916_8738">Replace X axis motor with different model</a></p> <p>I have a problem with my new motor. My X-axis is now moved by a 17HS3401S motor, instead of a 42SHD0217-24B motor.</p> <p>On small segments, like when I need to print an arc with a lot of small straight lines, my printhead "vibrates" instead of having a smooth movement. It seems it stops for a very short amount of time before trying to move again. On longer travels there is no problem.</p> <p>Do you know if it's because of the motor, or because of something else? (Vref not set properly maybe?)</p>
<p>The overall torque, and thus the incremental torque is less with your new stepper, this may result in less smooth operation because of moving the weight of the carriage (e.g. when you have a direct extruder mounted on the X carriage). </p> <p>You could be facing skipping steps, resulting in less accurate prints. Maybe the Vref has not been adjusted correctly, or the stepper is just not working for your application.</p>
<p>One other possibility is that the printer is "gap-filling". When there is a space between walls that isn't enough for infill or a roof layer, the slicer can be told to fill the gap, and depending on gap size it often does this with a zig-zaggy motion of the extruder. This is normal; if you wish, you can turn it off, however be aware this can cause those gaps to be visible in top surfaces of your prints.</p>
1,288
<p>Recently building a new printer, I went with a Wambam PEX system. When I began printing ABS I found it did not stick very well and eventually purchased a new build plate and a PEI sheet since PEX isn't suited to ABS.</p> <p>Not altering some of the setting while trying to get ABS to stick to the PEX I started printing on PEX which is gripping extremely well...too well. Bed temp may be a few degrees too high, nozzle was giving a little too much squish. I now have several skirts and now the base layer of a ringing tower embedded in the sheet. What is the best way to remove these? I was using acetone on the PEX sheet but I'm told not to use that on PEI.</p> <p>Just looking for into to clean the PEI sheet, please do not respond on what I should have done, or how to use PEX with glue or whatnot.</p>
<p>Heat up your bed to the print temperature; maybe even as hot as 100 °C. This will soften the ABS and make it easier to scrape off. It will distort a print to remove it this way, but is good for cleaning.</p> <p><strong>Less preferred method</strong>: Acetone will dissolve ABS but may be rough on your PEI, even causing it to lose its bond. It also evaporates very quickly and is highly flammable. You don't want to breath the fumes. It is now considered a carcinogen.</p>
<p>Heating the bed didn't help much, but Someone suggested using the flush cutters which pryed it up just enough... to get the bigger chunk off.</p>
1,995
<p>I'm reading about wiring up the electronic components to my Prusa i3 using an Arduino Mega 2650 and Ramps 1.4.</p> <p>I have step sticks, a heated bed, and a <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI" rel="noreferrer">Switching Power Supply 12v Dc 30a 360w</a> (more details on that later when I can add which ones to the post).</p> <p>I've heard that if you wire it wrong and plug it in, you can do anything from starting a fire to burning out your boards.</p> <p>What are some tips of things to check before plugging it in? Are there any common mistakes that I can avoid?</p>
<ul> <li><p>Polarity matters, sometimes. Be especially mindful of the wires from your power supply to the board, as getting those the wrong way around will definitely cause damage. Heated beds and extruders are not polarity sensitive, and can go in either way. Fans are polarized, but will probably survive if you get them backwards - they just won't run. Stepper motors don't care about polarity, flipping the connector around just makes them run backwards.</p></li> <li><p>Take special care with endstops. The endstop connectors have 3 pins (VCC, 5V and signal), endstops with 2 pins are usually connect to GND and signal. Putting a 2-pin endstop across 5V and GND will destroy the 5V regulator.</p></li> <li><p>A common cause of damage is wires not being clamped in their respective terminals properly. The offending wire will arc, melting and destroying the connector. Tighten down screw terminals properly, use proper crimps if you have them. Soldering the ends of wires going into screw terminals is not encouraged, but if you do solder the ends then make sure to check after a while and tighten the screws again.</p></li> <li><p>Put the stepper drivers in the right way around.</p></li> <li><p>For things like the heated bed and wires going to your power supply, use sufficiently thick wires. Especially with the heated bed, a lot of current flows through the wires and flimsy wires will heat up and melt.</p></li> </ul>
<p>Adding to the other answers:</p> <ul> <li>ALWAYS power-off the printer completely and make sure it is not receiving any power from any source (could be receiving power from USB after you turned the power supply off).</li> <li>Avoid loose wires, and before powering the printer on make sure every wire is connected in the right place. Loose wires can cause damage even if not powered if they get under the PCBs, where they can cause shorts. I fried an Arduino Mega this way.</li> <li>Never mix between 12v and 5v supply/output wires. Connecting an output wire of the wrong voltage will usually cause damage only to the part receiving power, while connecting a supply wire of the wrong voltage can cause severe damage to many components at once.</li> <li>Keep all wires organised. That will help you understand which wire is connected to what quickly, and will help you do what is mentioned in #2 and #3.</li> </ul>
123
<p>The system I am currently working on requires some role-based security, which is well catered for in the Java EE stack. The system intends to be a framework for business domain experts to write their code on top of.</p> <p>However, there is also a requirement for data <code>security</code>. That is, what information is visible to an end user.</p> <p>This effectively means reducing visibility to rows (and perhaps even columns) in the database.</p> <p>We are using Hibernate for our persistence. However, we are using our own annotations so as not to expose our persistence choice to the business domain experts. </p> <p>For row based security this means we could add an annotation such as <code>@Secured</code> at the entity level, which would cause an extra column to be added to the underlying table to constrain our selects?</p> <p>For column based security, we could perhaps have <code>@Secured</code> to either assist in query generation, or perhaps use an aspect to filter the information returned?</p> <p>I'm curious to know how this might affect hibernate's caching mechanisms as well?</p> <p>I'm sure a lot of others will have had the same issue, and I was wondering how you approached this?</p> <p>Much appreciated...</p>
<p>Hibernate has a <a href="http://in.relation.to/Bloggers/Hibernate3Filters" rel="noreferrer">filter mechanism</a> that may work for you. The filters will rewrite the queries hibernate generates to include an additional clause to limit the rows returned. I'm not aware of anything in hibernate to mask/hide columns.</p> <p>Your database may also have support for this functionality. Oracle, for example, has the <a href="http://www.devshed.com/c/a/Oracle/RowLevel-Security-with-Virtual-Private-Database/" rel="noreferrer">Virtual Private Database</a> (VPD) which will rewrite your queries at the database level. This solution has the added benefit that any external program (e.g. reporting tools) that goes against your db will have your security restrictions enforced. VPD also has support to mask restricted columns with NULLs.</p> <p>Unfortunately, the above solutions have not been adequate to support the security requirements for the types projects I typically work on. There is usually some sort of context that cannot be easily expressed in the above solutions. For example, users can view data that they have created, or that have been been marked as public, or belong to a project which they manage.</p> <p>We typically create query/finder/DAO objects where we pass in the values required to enforce the security and then create the query accordingly.</p> <p>I hope this helps</p>
<p>When using Hibernate filters you need to be aware that the additional restrictions will not be applied to SQL statements generted by the <code>load()</code> or <code>get()</code> methods.</p>
5,495
<p>Updating an old ASP/Access site for a client - I need SQL to add a column to an existing table and set a default value. Doesn't work - any ideas?</p> <p>This works fine</p> <pre><code>ALTER TABLE documents ADD COLUMN membersOnly NUMBER </code></pre> <p>I want this to work:</p> <pre><code>ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0 </code></pre> <p>Have googled and seen instructions for default values work for other field types but I want to add number. Thanks!</p>
<p>Tools -&gt; Options -&gt; Tables/Queries -&gt; (At the bottom right:) Sql Server Compatible Syntax - turn option on for this database.</p> <p>then you can execute your query:</p> <pre><code>ALTER TABLE documents ADD COLUMN membersOnly NUMBER DEFAULT 0 </code></pre>
<p>Tools -> Options -> Tables/Queries -> (At the bottom right:) Sql Server Compatible Syntax - turn option on for this database.</p> <p>is not found on MS Access 2010</p>
6,981
<p>I've noticed that SQL Server 2005 x64 does not seem to lock pages into memory the same way SQL Server 2000 did. In 2000 I could easily see from task manager that SQL had locked 8GB of ram with AWE. I'm fairly certain I've got 2005 setup in an equivalent way.</p> <p>Is this a normal x64 difference or am I forgetting a crucial setup option?</p>
<p>SQL Server 2005 x64 certainly doesn't need, or use, AWE; AWE is only to allow it to use > 4GB on 32 bit systems.</p> <p>You <em>can</em> use the old lock-pages-in-memory trick, but as this KB shows (<a href="http://support.microsoft.com/kb/918483" rel="nofollow noreferrer">http://support.microsoft.com/kb/918483</a>): "Note For 64-bit editions of SQL Server 2005, only SQL Server 2005 Enterprise Edition can use the Lock pages in memory user right."</p>
<p>I've seen permissions problems crop up a lot too - if the account you're using for the SQL Server service doesn't have the right permissions, it can't lock pages in memory even if you're running Enterprise Edition. This blog entry by the PSS SQL Server Engineers is really helpful:</p> <p><a href="http://blogs.msdn.com/psssql/archive/2007/10/18/do-i-have-to-assign-the-lock-privilege-for-local-system.aspx" rel="nofollow noreferrer">PSS Engineers: Do I have to assign the Lock Pages in Memory privilege for Local System?</a></p>
7,542
<p>I've built one, but I'm convinced it's wrong.</p> <p>I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records).</p> <p>Is there a better way?</p> <p>I code in PHP with MySQL</p>
<p><a href="http://www.databaseanswers.org/data_models/hotels/hotel_reservations_popkin.htm" rel="nofollow noreferrer">Here you go</a></p> <p>I found it at this page: <a href="http://www.webmastersbydesign.com/2008/08/04/library-of-over-500-free-database-models/" rel="nofollow noreferrer">A list of free database models</a>.</p> <p><strong>WARNING</strong>: Currently (November '11), Google is reporting that site as containing malware: <a href="http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=Firefox&amp;hl=en-US&amp;site=http://www.databaseanswers.org/data_models/hotels/hotel_reservations_popkin.htm" rel="nofollow noreferrer">http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=Firefox&amp;hl=en-US&amp;site=http://www.databaseanswers.org/data_models/hotels/hotel_reservations_popkin.htm</a></p>
<p>What's wrong with that? logging each date that the customer is staying allows for what I'd imagine are fairly standard reports such as being able to display the number of booked rooms on any given day.</p>
9,297
<p>I have an <a href="http://www.sencha.com" rel="nofollow noreferrer">ExtJS</a> grid on a web page and I'd like to save some of its state information back to the server when the users leaves the page. Can I do this with an Ajax request onUnload? If not, what's a better solution?</p>
<p>You can use an Ajax request, but be sure to make it a synchronous request rather than an asychronous one. Alternatively, simply save state whenever the user makes a change, this also protects the data if the user's browser crashes.</p>
<p>You could also set a cookie using javascript on unload. I think the advantage ajax has over cookies is that you have the data available to you for reporting and the user (if logged in) can utilise the data across different machines.</p> <p>The disadvantage of using ajax is that it might slow down the actual closing of the browser window, which could be annoying if the server is slow to respond.</p>
9,902
<p>At what point does a MySQL database start to lose performance?</p> <ul> <li>Does physical database size matter?</li> <li>Do number of records matter?</li> <li>Is any performance degradation linear or exponential?</li> </ul> <p>I have what I believe to be a large database, with roughly 15M records which take up almost 2GB. Based on these numbers, is there any incentive for me to clean the data out, or am I safe to allow it to continue scaling for a few more years?</p>
<p>The physical database size doesn't matter. The number of records don't matter.</p> <p>In my experience the biggest problem that you are going to run in to is not size, but the number of queries you can handle at a time. Most likely you are going to have to move to a master/slave configuration so that the read queries can run against the slaves and the write queries run against the master. However if you are not ready for this yet, you can always tweak your indexes for the queries you are running to speed up the response times. Also there is a lot of tweaking you can do to the network stack and kernel in Linux that will help.</p> <p>I have had mine get up to 10GB, with only a moderate number of connections and it handled the requests just fine.</p> <p>I would focus first on your indexes, then have a server admin look at your OS, and if all that doesn't help it might be time to implement a master/slave configuration.</p>
<p>No it doesnt really matter. The MySQL speed is about 7 Million rows per second. So you can scale it quite a bit</p>
2,366
<p>This problem started technically just before a major move but I had hoped it was a &quot;one off&quot; issue... I started up my trusty Ender 3 today to find it may have actually gotten worse and I'm not entirely sure what the solution is. I was printing a replica of a weapon from a game and I noticed at one point through the print I had a rather extreme X layer shift now today after finally getting the printer setup I've come to find the problem may have actually gotten worse, additionally I'm having a strange gap issue on the top most layers of my prints and strange waving patterns. Now I should note my printer is printing within an enclosure and its temperatures have been adjusted for it but this is rather extreme.<a href="https://i.stack.imgur.com/SSGmx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSGmx.jpg" alt="major layer shift and waving" /></a></p> <p><a href="https://i.stack.imgur.com/8Ru7M.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Ru7M.jpg" alt="extreme gaps in print" /></a></p>
<p>Same G-code slice? The main cause of warping is temperature. If this is kept as a control variable and you have these results, it may be because of a different temperature the filament requires. Check the filament specs and adjust the bed/nozzle temperature to make the temperature difference smaller.</p> <p>Edit: Another reason it might be needing different temperatures is because of absorbing moisture.</p>
<p>Problem was displaced by a factory reset of the 3D printer FlashForge Adventurer 3.</p> <p><a href="https://i.stack.imgur.com/jxS9X.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jxS9X.jpg" alt="Photo of two versions" /></a></p> <p>Right: white PLA only, left: transparent PLA bottom layers plus white PLA above. View of the bottom sides. No difference of print bed adhesion now.</p> <p>The reason of the problem was not found, but print bed adhesion is good after the factory reset for both white and transparent PLA.</p>
2,048
<p>I have a stored procedure which takes as its parameter a <em>varchar</em> which needs to be cast as a <em>datetime</em> for later use:</p> <pre><code>SET @the_date = CAST(@date_string AS DATETIME) </code></pre> <p>I'm expecting the date string to be supplied in the format "DD-MON-YYYY", but in an effort to code defensively, if for some reason it can't be cast successfully, I want to default to the system date and continue. In PL/SQL I could use exception handling to achieve this and I could do this fairly easily with regular expressions too, but the limited pattern matching supported out of the box by Sybase doesn't let me do this and I can't rely on third party libraries or extensions. Is there a simple way of doing this in T-SQL?</p> <p><em>NB: using Sybase ASE 12.5.3, there is no ISDATE function</em></p>
<p>I'm having a similar issue. You might be able to do something like this:</p> <pre><code>SET arithabort arith_overflow off SET @the_date = CAST(@date_string AS DATETIME) IF @the_date is NULL set @the_date = getdate() SET arithabort arith_overflow on </code></pre> <p>However, this doesn't work well in a select. It will work well in a cursor (boo) or in logic before / after a SQL batch.</p>
<p>Found <a href="http://blog.sqlauthority.com/2007/07/12/sql-server-validate-field-for-date-datatype-using-function-isdate/" rel="nofollow noreferrer">this in the second result</a> in Google when searching for "validate date string sql".</p> <pre><code>----Invalid date SELECT ISDATE('30/2/2007') RETURNS : 0 (Zero) ----Valid date SELECT ISDATE('12/12/20007') RETURNS : 1 (ONE) ----Invalid DataType SELECT ISDATE('SQL') RETURNS : 0 (Zero) </code></pre>
3,049
<p>If I have an object implementing the <code>Map</code> interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map?</p> <p>Will the ordering of elements depend on the specific map implementation that I have for the interface?</p>
<pre class="lang-java prettyprint-override"><code>Map&lt;String, String&gt; map = ... for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + &quot;/&quot; + entry.getValue()); } </code></pre> <p>On Java 10+:</p> <pre class="lang-java prettyprint-override"><code>for (var entry : map.entrySet()) { System.out.println(entry.getKey() + &quot;/&quot; + entry.getValue()); } </code></pre>
<p>I copied the data of a map to another with this code:</p> <pre><code>HashMap product =(HashMap)shopping_truck.get(i); HashMap tmp = new HashMap(); for (Iterator it = product.entrySet().iterator(); it.hasNext();) { Map.Entry thisEntry = (Map.Entry) it.next(); tmp.put(thisEntry.getKey(), thisEntry.getValue()); } </code></pre>
6,906
<p>I'm looking for a wiki that I can use to track requirements for a project, but we would like to be able to export the wiki (with formatting) to Microsoft Word. Does anyone know of a wiki that does this?</p>
<p><a href="http://www.atlassian.com/software/confluence/" rel="nofollow noreferrer">Confluence</a> does this. Also exports to PDF.</p>
<p>If you're looking for a free solution, MediaWiki has some <a href="http://www.mediawiki.org/wiki/Alternative_parsers" rel="nofollow noreferrer">alternative parsers</a> that might be a good place to look. You might have to go through more than one phase to get it to Microsoft Word format though.</p>
9,371
<p>I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup.</p> <p>Any suggestions when taking this approach?</p> <hr> <p>when I implemented this technique and step into my app, just before the server returns my list it hits the get of each property that is supposed to be lazy loaded ... Thus eager loading. Could you explain this issue or suggest a resolution?</p> <p>Edit: It <a href="http://benders-blog.blogspot.com/2007/01/lazy-loading-in-soa-world.html" rel="nofollow noreferrer">appears</a> you can use the XMLIgnore attribute so it doesn’t get looked at during serialization .. still reading up on this though</p>
<p>As for any remoting architecture, you'll want to avoid loading a full object graph "down the wire" in an uncontrolled way (unless you have a trivially small number of objects).</p> <p>The <a href="http://en.wikipedia.org/wiki/Lazy_loading" rel="nofollow noreferrer">Wikipedia article</a> has the standard techniques pretty much summarised (and in C#. too!). I've used both ghosts and value holders and they work pretty well.</p> <p>To implement this kind of technique, make sure that you separate concerns strictly. On the server, your service contract implementation classes should be the only bits of the code that work with data contracts. On the client, the service access layer should be the only code that works with the proxies. </p> <p>Layering like this lets you adjust the way that the service is implemented relatively independently of the UI layers calling the service and the business tier that's being called. It also gives you half a chance of unit testing!</p>
<p>You could try to use something REST based (e.g. <a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" rel="nofollow noreferrer">ADO.NET Data Services</a>) and wrap it transpariently into your client code.</p>
5,611
<p>Is it true that the only way to handle default function arguments is through function overloading?</p> <p>For example, in PHP I can do this:</p> <pre><code>function foo($x, $y=0) { } </code></pre> <p>Would the best way to handle it in C# be this?</p> <pre><code>void foo(int x) { foo(x, 0); } void foo(int x, int y) { } </code></pre> <p><strong><em><a href="http://bytes.com/forum/thread224970.html" rel="noreferrer">Example lifted from here</a></em></strong></p> <p>Edit</p> <p><strong><em>Made the C# example into actual C# (Thanks Blair Conrad)</em></strong></p>
<p>Yes, that'd be best<s>, except you'd omit the <code>$</code>s on the parameter names</s>, as others have pointed out. For those interested in the rationale behind the lack of default parameter values, see @Giovanni Galbo's explanation.</p>
<p>Yes. </p> <p>Or currying. </p> <p>Or abstracting into a class and using default values there. </p>
6,128
<p>I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very much like <a href="http://www.nike.com/nikeskateboarding/v3/" rel="noreferrer">http://www.nike.com/nikeskateboarding/v3/</a>...)</p> <p>I did have a look at the stuff nike did but just wasn't able to pull it off. Any idea's?</p>
<p>The trick is to use some simple JavaScript to resize the Flash DOM node:</p> <pre><code>function resizeFlash( h ) { // "flash-node-id" is the ID of the embedded Flash movie document.getElementById("flash-node-id").style.height = h + "px"; } </code></pre> <p>Which you call from within the Flash movie like this:</p> <pre><code>ExternalInterface.call("resizeFlash", 400); </code></pre> <p>You don't actually need to have the JavaScript code externally, you can do it all from Flash if you want to:</p> <pre><code>ExternalInterface.call( "function( id, h ) { document.getElementById(id).style.height = h + 'px'; }", ExternalInterface.objectID, 400 ); </code></pre> <p>The anonymous function is just to be able to pass in the ID and height as parameters instead of concatenating them into the JavaScript string.</p> <p>I think that the JavaScript is fairly cross-platform. If you want to see a live example look at this site: <a href="http://www.talkoftheweather.com/" rel="noreferrer">talkoftheweather.com</a>. It may not look as though it does anything, but it automatically resizes the Flash movie size to accommodate all the news items (it does this just after loading the news, which is done so quickly that you don't notice it happening). The resize forces the browser to show a vertical scroll bar.</p>
<p>I halfway looked at swffit but the height (and width sometimes but mainly height) would be dynamic - swffit let's you declare a maxHeight but that number would be constantly changing...maybe I could figure out how to set it dynamically. A great place for me to start though - thanks!</p>
5,286
<p>Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?</p>
<p>FlashWindowEx is the way to go. See <a href="http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx" rel="noreferrer">here for MSDN documentation</a></p> <pre><code>[DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool FlashWindowEx(ref FLASHWINFO pwfi); [StructLayout(LayoutKind.Sequential)] public struct FLASHWINFO { public UInt32 cbSize; public IntPtr hwnd; public UInt32 dwFlags; public UInt32 uCount; public UInt32 dwTimeout; } public const UInt32 FLASHW_ALL = 3; </code></pre> <p>Calling the Function:</p> <pre><code>FLASHWINFO fInfo = new FLASHWINFO(); fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); fInfo.hwnd = hWnd; fInfo.dwFlags = FLASHW_ALL; fInfo.uCount = UInt32.MaxValue; fInfo.dwTimeout = 0; FlashWindowEx(ref fInfo); </code></pre> <p>This was shamelessly plugged from <a href="http://pinvoke.net/default.aspx/user32/FlashWindowEx.html" rel="noreferrer">Pinvoke.net</a></p>
<p>I believe you're looking for <a href="http://msdn.microsoft.com/en-us/library/ms633539.aspx" rel="nofollow noreferrer"><code>SetForegroundWindow</code></a>.</p>
9,885
<p>I have recently bought a spool of eSun PETG. So far I really like the filament. My only complaint is, I get lumps of charred filament deposited on my object. The slicer I used is Craft Ware and I have played with the Far Travel -> Elevation settings. I have noticed that this helps but then I have little to no adhesion to the print surface and my supports do not stick to the raft. Does any one know how to mitigated PETG from collecting on the extruder?</p>
<p>Different brands and blends of PET filaments seem to do this to different degrees. Esun's PETG is definitely one that tends to glob onto the nozzle. Basically, the nozzle plows through the top surface of the filament and lifts up some plastic, much like the bow of a ship lifting up some water at high speeds. PET's viscosity and stickiness seem to amplify this effect more than other filaments. </p> <p>Some things you can do to minimize the globbing:</p> <ul> <li>Calibrate extrusion volume on the low end of what you'd normally use for other filaments (how you do this depends on your slicer)</li> <li>Use your slicer's "Z-hop" or "avoid perimeters" feature so you don't do travel moves across printed surfaces</li> <li>Invest in an anti-stick coated nozzle, such as are sold by <a href="http://www.micro-swiss.com/#!3d-printing/c843" rel="noreferrer">Micro Swiss</a> or <a href="https://www.p3-d.com/collections/duraplat-3d-extruder-nozzles" rel="noreferrer">Performance 3-d</a> (these don't eliminate globbing, but they do reduce it and make the nozzle much easier to clean)</li> <li>Play with slicer settings such as extrusion width, layer height, and infill/perimeter overlap to reduce the amount of "excess material" that sticks above the print surface</li> </ul> <p>Again, this is a common problem with PET blend filaments. Anecdotally, some brands seem to glob more or less than others, so switching to a different vendor may be worth trying if you want to do a lot of PETG prints. </p>
<p>For me, none of the classic solutions to PETG zits worked; these include extra retraction, slower/faster retraction, lower extrusion width, lower extrusion multiplier, avoid perimeters etc. It was especially disappointing to see lower extrusion multiplier making no difference whatsoever in reducing the zits, but only resulting in a mechanically weaker and even spongy result. What made all the difference is to <strong>disable z lifting during retraction</strong> which my slicer profile has enabled by default. This setting alone eliminated nearly all zits and most stringing (i.e spiderwebs). </p> <p>Of course, the amount of zits and stringing will heavily depend on the particular filament you're using and the particular model you're printing.</p> <p><em>Additional note:</em> I was getting extra zits/overextrusion on a particular model I had that was exceptionally thin and tall when attempting to print with PETG. Lower extrusion multiplier made no improvement but weakened the part and resulted in spongy structure. I was successful in printing this part <strong>along with another part that was of similar height</strong>. I'm suspecting that printing the part alone but <strong>much more slowly</strong> to help with cooling would also succeed.</p>
216
<p>I am attempting to build a 3D printer using the <a href="https://github.com/gregsaun/prusa_i3_bear_upgrade" rel="nofollow noreferrer">Bear Upgrade</a> for guidance.</p> <p>However, I want to modify some of the parts. I am basing the modified parts on the original designs.</p> <p>I would like to understand the reason behind some design details presented on the original designs so that, if necessary, introduce them into the new designs. </p> <p><a href="https://i.stack.imgur.com/XTG3N.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XTG3N.jpg" alt="example of design with details I don&#39;t understand the reason behind"></a></p> <p>Item 1) The holes are not round. Why???</p> <p>Item 2 ) There are some little squares inside the piece which i don't know if they are there for some structural reason </p> <p>Please use <a href="https://github.com/gregsaun/prusa_i3_bear_upgrade/blob/master/full_upgrade/for_mk3/printed_parts/step/y_idler.step" rel="nofollow noreferrer">this link</a> to the piece depicted above. </p> <p>Here is a drawing of the full assembly, showing that this piece is the y axes linear rods holder:</p> <p><a href="https://i.stack.imgur.com/rOAzb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rOAzb.jpg" alt="enter image description here"></a></p>
<blockquote> <p>Item 1) The holes are not round. Why???</p> </blockquote> <p>Two things about this. First, the print is upside down. The holes are not round to accommodate the fact you cannot print a round hole unsupported. If you try to print the circle unsupported, when you get to the top portion, it will sag until the print catches up to it. By that time, the circle is flat at the top and you won't be able to fit whatever you were trying to fit into it (without some post processing). Printing the V-ish looking part at the top will ensure you'll be able fit things through it you meant to fit through (sorry if that's redundant). If you'd like to know more, take a look at the following Maker's Muse video:</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/j6508J94VsA?start=0"></iframe> </div></div> </p> <blockquote> <p>Item 2 ) There are some little squares inside the piece which i don't know if they are there for some structural reason</p> </blockquote> <p>To be very honest with you, I don't know why the little squares are there either, however, I believe you can answer this part for yourself.</p> <p>I think the answer lies in the part, meaning, if you can manipulate the 3d design in whatever you're using to design it, you can look into the part and see what's going on with it. It appears there are dashed lines in the center parts, which would make me believe these are <em>hidden lines</em>. There is a feature there which is <em>inside</em> of the part which you cannot see otherwise. By turning it, you should be able to decipher what these features are for and therefore should be able to discern what the small squares a for as well. If, after you've looked the part over completely you cannot discern a purpose for the squares, don't design them into your part. It may just be they are an artifact of the design itself and doesn't provide anything worth repeating in your own design. Bottom line, don't get hung up on the minute details which in the end don't mean a thing.</p>
<p>Teardrop shape ere is a feature there which is inside of the part which you cannot see otherwise. By turning it, you should be able to decipher what these features are for and therefore should be able to</p>
1,533
<p>I try to externalize all strings (and other constants) used in any application I write, for many reasons that are probably second-nature to most stack-overflowers, but one thing I would like to have is the ability to automate spell checking of any user-visible strings. This poses a couple problems:</p> <ul> <li>Not all strings are user-visible, and it's non-trivial to spearate them, and keep that separation in place (but it is <em>possible</em>)</li> <li>Most, if not all, string externalization methods I've used involve significant text that will not pass a spell checker such as aspell/ispell (eg: theStrName="some string." and comments)</li> <li>Many spellcheckers (once again, aspell/ispell) don't handle many words out of the box (generally technical terms, proper nouns, or just 'new' terminology, like metadata).</li> </ul> <p>How do you incorporate something like this into your build procedures/test suites? It is not feasible to have someone manually spell check all the strings in an application each time they are changed -- and there is <em>no chance</em> that they will all be spelled correctly the first time.</p>
<p>We do it manually, if errors aren't picked up during testing then they're picked up by the QA team, or during localization by the translators, or during localization QA. Then we lodge a bug.</p> <p>Most of our developers are not native English speakers, so it's not an uncommon problem for us. The number that slip through the cracks is so small that this is a satisfactory solution for us.</p> <p>Nothing over a few hundred lines is ever 100% bug-free (well... maybe the odd piece of embedded code), just think of spelling mistakes as bugs and don't waste too much time on it.</p> <p>As soon as your application matures, over 90% of strings won't change between releases and it would be a reasonably trivial exercise to compare two versions of your resources, figure out what'ts new (check them first), what's changed/updated (check next) and what hasn't changed (no need to check these)</p> <p>So think of it more like I need to check ALL of these manually the first time, and I'm only going to have to check 10% of them next time. Now ask yourself if you still really need to automate spell checking.</p>
<p>First point, <em>please</em> don't put it into you build process. I would be a vengeful coder if I (meaning my computer) had to spell check all the content on the site every time I tried to debug or build a new feature. I don't even think this kind of operation belongs as a unit test (you're testing a human interface, not a computerised one).</p> <p>Second point, don't write a script. You're going to have so many false positives fall through the cracks that people will stop reading the reports and you are no better off than when you started.</p> <p>Third point, this is probably most easily solved by having humans do it: QA team, copy writers, beta testers, translators, etc. All the big sites with internationalised content that I've built had the same process: we took the copy from the copy writers, sent it to the translating service/agency, put it into the persistence layer, and deployed it. Testers (QA, developers, PMs, designers, etc.) would find spelling or grammatical mistakes and lodge bug reports. There is just too much red tape and pairs of eyes for <em>that</em> many spelling/grammar errors to slip through.</p> <p>Fourth point, there will always be spelling and grammar mistakes on your page. Even major newspaper web sites haven't gotten around this and they have whole office buildings filled with editors.</p>
6,410
<p>So I'm working on some legacy code that's heavy on the manual database operations. I'm trying to maintain some semblance of quality here, so I'm going TDD as much as possible.</p> <p>The code I'm working on needs to populate, let's say a <code>List&lt;Foo&gt;</code> from a DataReader that returns all the fields required for a functioning Foo. However, if I want to verify that the code in fact returns one list item per one database row, I'm writing test code that looks something like this:</p> <pre><code>Expect.Call(reader.Read()).Return(true); Expect.Call(reader["foo_id"]).Return((long) 1); // .... Expect.Call(reader.Read()).Return(true); Expect.Call(reader["foo_id"]).Return((long) 2); // .... Expect.Call(reader.Read()).Return(false); </code></pre> <p>Which is rather tedious and rather easily broken, too. </p> <p>How should I be approaching this issue so that the result won't be a huge mess of brittle tests?</p> <p>Btw I'm currently using Rhino.Mocks for this, but I can change it if the result is convincing enough. Just as long as the alternative isn't TypeMock, because their EULA was a bit too scary for my tastes last I checked.</p> <p>Edit: I'm also currently limited to C# 2.</p>
<p>To make this less tedious, you will need to encapsulate/refactor the mapping between the DataReader and the Object you hold in the list. There is quite of few steps to encapsulate that logic out. If that is the road you want to take, I can post code for you. I am just not sure how practical it would be to post the code here on StackOverflow, but I can give it a shot to keep it concise and to the point. Otherwise, you are stuck with the tedious task of repeating each expectation on the index accessor for the reader. The encapsulation process will also get rid of the strings and make those strings more reusable through your tests.</p> <p>Also, I am not sure at this point how much you want to make the existing code more testable. Since this is legacy code that wasn't built with testing in mind.</p>
<p>You can put the Foo instances in a list and compare the objects with what you read: </p> <pre><code>var arrFoos = new Foos[]{...}; // what you expect var expectedFoos = new List&lt;Foo&gt;(arrFoos); // make a list from the hardcoded array of expected Foos var readerResult = ReadEntireList(reader); // read everything from reader and put in List&lt;Foo&gt; Expect.ContainSameFoos(expectedFoos, readerResult); // compare the two lists </code></pre>
4,980
<p>I'm working on a project with a friend that will utilize Hbase to store it's data. Are there any good query examples? I seem to be writing a ton of Java code to iterate through lists of RowResult's when, in SQL land, I could write a simple query. Am I missing something? Or is Hbase missing something?</p>
<p>I think you, like many of us, are making the mistake of treating bigtable and HBase like just another RDBMS when it's actually a column-oriented storage model meant for efficiently storing and retrieving large sets of sparse data. This means storing, ideally, many-to-one relationships within a single row, for example. Your queries should return very few rows but contain (potentially) many datapoints.</p> <p>Perhaps if you told us more about what you were trying to store, we could help you design your schema to match the bigtable/HBase way of doing things.</p> <p>For a good rundown of what HBase does differently than a "traditional" RDBMS, check out this awesome article: <a href="http://blog.csdn.net/arthurbryant/article/details/6643933" rel="nofollow noreferrer">Matching Impedance: When to use HBase</a> by Bryan Duxbury.</p>
<p>Thanks for the reply Sean, and sorry for my late response. I often make the mistake of treating HBase like a RDBMS. So often in fact that I've had to re-write code because of it! It's such a hard thing to unlearn.</p> <p>Right now we have only 4 tables. Which, in this case, is very few considering my background. I was just hoping to use <em>some</em> RDBMS functionality while mostly sticking to the column-oriented storage model.</p>
7,040
<p>I am new to FDM RP. I've done a lot of work on ZCorp and Connex. </p> <p>The question is can vectors curve drive an extrusion nozzle? Within a 3D volume I can generate curves that I want the print nozzle to follow. Is this possible or has it been done? If so, what software or is there a hack? </p> <p>Another question is, can you print a part with no sidewall or containment boundary?</p>
<p>Just for the fun of it and perhaps to contribute to this question, I opened my recent task in Simplify3d slicing software. Setting the perimeter walls and top/bottom surfaces to zero did not generate an error as I expected.</p> <p>The print preview, essentially a g-code viewer, presented the model as only the honeycomb infill for which it was configured. Having zero layer thickness for the top/bottom also prevented features from printing that were composed of only walls without infill. Small details that otherwise print well were lost completely.</p> <p>I can see that properly designed models printed with certain infill patterns and percentages would be quite artistic.</p> <p>With respect to the first question, one could create a program to accomplish the desired result if one were an experienced programmer. It would be a matter of converting a specific set of vectors into g-code for the printer. I'm familiar enough with g-code to know that a well defined curve is easy enough to create in g-code but only if the mechanicals support arcs. If not, it's not so easy. The conversion from a vector format file to g-code would require a talented programmer indeed.</p> <p>I suspect there are talented programmers "out there," but one must be suitably skilled and equally suitably motivated, yes?</p> <p><a href="https://i.stack.imgur.com/nH6uq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nH6uq.jpg" alt="Print prview, of object with walls and surfaces set to zero, showing honeycomb structure"></a></p>
<p>Vectors do not drive the extrusion nozzles in current software. There are methods to take vectors and create a solid model with them which can be used. The standard workflow is to take a solid model, save it in the STL format, and then import the STL file into the slicing software and outputs Gcode with contain coordinates for the extrusion nozzle to move to.</p> <p>I have not seen any software that will create just the infill geometry without any bounding surfaces. This would be such a specific use case that it is unlikely to appear in current software. That is not to say that it couldn't be done, but you would likely have to implement such a feature yourself.</p>
409