instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>Some filaments suggest "reducing cross-sectional area" of the print. Is this referring to the vertical plane or horizontal plane? In other words, if I were to print a rectangular prism, would I want the long side of it printed in the vertical direction or parallel to the print bed?</p>
<p>One resource you can use is called the <a href="https://rigid.ink/blogs/news/how-to-use-3d-printer-cleaning-filament" rel="nofollow noreferrer">nylon cleaning method</a>. It works by setting nylon filament temperatures, pushing nylon filament into the nozzle until only nylon is extruding, then cooling the hot end to a specific temperature. The page linked suggests a hard yank, but I disagree. Brutality is not a recommended action for 3D printers, in my opinion. When I use the NCM and the hot end reaches the correct cooler temperature, I use pliers and lever them against a suitable surface. The lever action is slower, yet the mechanical advantage is increased, making removal easier.</p> <p>Some 3D printer users disagree with the expense of nylon, which is, on the surface, excessive. I've found that I am able to see light through the hot-end after using this method, however, so I find the expense justified by a completely clean filament path.</p> <p>The above linked page also includes the modification of this method for use with the same type of filament to be cleaned, in your case PLA.</p> <p>Consider that you should be able to use ABS to pull PLA from the nozzle. Heat the nozzle to the lower end of your ABS filament temperature and push or extrude until you get the ABS color. Allow the hot end to cool to the low end of PLA temperatures and reverse the extruder/pull out the filament.</p> <p>If you use contrasting color filament (for example, white PLA, black ABS) you should be able to see the ABS collecting the other color as you remove it. Eventually, you would have no contrasting color, indicating that the previous filament has been removed.</p>
<p>In line w/ Fred.U's answer, I've been pretty comfortable with the following sequence. Assume a cold start with a filament in the feeder (and cold gunk in the hotend).<br> 1) bring the hotend up to 5 degreesC over your usual extrusion temp for the filament currently in place.<br> 2) If the filament doesn't pull out easily (possible clump at the end), push the filament down and hold it there so the end fully softens/melts. Then remove the filament.<br> 3) Load the new filament desired and push it down until the new material flows freely out of the nozzle. </p>
814
<p>I need to update a <code>combobox</code> with a new value so it changes the reflected text in it. The cleanest way to do this is after the <code>combobox</code>has been initialised and with a message.</p> <p>So I am trying to craft a <code>postmessage</code> to the hwnd that contains the <code>combobox</code>.</p> <p>So if I want to send a message to it, changing the currently selected item to the nth item, what would the <code>postmessage</code> look like?</p> <p>I am guessing that it would involve <code>ON_CBN_SELCHANGE</code>, but I can't get it to work right.</p>
<p>You want <a href="http://msdn.microsoft.com/en-us/library/bb856484(VS.85).aspx" rel="nofollow noreferrer">ComboBox_SetCurSel</a>:</p> <pre><code>ComboBox_SetCurSel(hWndCombo, n); </code></pre> <p>or if it's an MFC CComboBox control you can probably do:</p> <pre><code>m_combo.SetCurSel(2); </code></pre> <p>I would imagine if you're doing it manually you would also want SendMessage rather than PostMessage. CBN_SELCHANGE is the notification that the control sends <em>back to you</em> when the selection is changed.</p> <p>Finally, you might want to add the c++ tag to this question.</p>
<p>if you fx want to change the title - which is the line shown when combobox is closed, then you can do following:</p> <p>m_ComboBox.DeleteString(0); // first delete previous if any, 0 = visual string m_ComboBox.AddString(_T("Hello there"));</p> <p>put this in fx. in OnCloseupCombo - when event close a dropdownbox fires </p> <pre><code>ON_CBN_CLOSEUP(IDC_COMBO1, OnCloseupCombo) </code></pre> <p>This change is a new string not a selection of already assigned combobox elements</p>
8,382
<p>It is obviously possible to hide individual data points in an Excel line chart.</p> <ul> <li>Select a data point. </li> <li>Right click -> Format Data Point... </li> <li>Select Patterns</li> <li>Tab Set Line to None</li> </ul> <p>How do you accomplish the same thing in VBA? Intuition tells me there should be a property on the <a href="http://msdn.microsoft.com/en-us/library/aa174283(office.11).aspx" rel="nofollow noreferrer">Point object</a> <code>Chart.SeriesCollection(&lt;index&gt;).Points(&lt;index&gt;</code> which deals with this...</p>
<p>"Describe it to the teddy bear" works almost every time...</p> <p>You have to go to the Border child object of the Point object and set its LineStyle to xlNone.</p>
<p>I tried "#N/A" with quotes in Excel 207 and as a result the data point is shown like a zero in the graph. It Works without the quotes.</p>
7,726
<p>Lately I've been having problems with overhangs not adhering when curvature is outward (stringing across instead) that look like what you'd see at insufficient temperature, and that go away with temperature jacked up a bit (PLA at 220 °C, which is a bit extreme) or fan disabled. Is it possible that the hotend thermistor has drifted and is no longer accurate, making the actual temperature lower than nominal? Or do these things fail hard when they fail?</p>
<p>I don't think it is the thermistor degrading. To answer your question directly, all my thermistors have failed because the tiny wire has broken off, and generally the fail is “hard” not soft.</p> <p>It is more likely you’re experiencing absorbed humidity in the filament from it being out on the spool too long. this makes you have to increase the temperature.</p> <p>I’m sure if you dehydrated the spool in the oven for a bit you’d get better prints and a slightly lower print temp.</p> <p>Additionally, keep in mind that a lot of PLA on the market nowadays runs at higher temps because it’s laced with something (“PLA+”?). Check the item description for indicators of a new or improved formula.</p> <p>You could try ordering a thermistor of the same make and testing the temperature of it. You can get a half dozen for about \$10. The Marlin firmware your printer probably uses should have a section for thermistors and what kind you’re using. It’s probably type “1” which is the cheap kind.</p> <p>You can try using one of those distant head thermometers to measure the temperature wirelessly at the hot end. These are probably over \$100 right now because of COVID. I think that is how a well-resourced person would handle this (i'm not one personally).</p> <p>Maybe start with the oven and while it’s cooking, research the thermistors and what goes in to replacing one. It’s a good learning experience because one day your hotend may be irreparably clogged and you’ll want to know some of the steps to disassemble it.</p>
<p>It is indeed possible that the thermistor is broken (yet not sure). I am aware of two types of issues with thermistors:</p> <ol> <li><p>The contact (soldering) is broken, usually due to the temperature extreme variations. The thermistor will indicate the maximum temperature in case of PTC or minimum temperature in case of NTC. In some cases, due to vibrations or other factor, the contact will eventually touch, showing improbable jumps of temperature.</p> </li> <li><p>The thermistor is broken internally. In that case it will just indicate a wrong temperature. I can't say if constant temperature or constant delta.</p> </li> </ol> <p>For how to troubleshot the component, however, EE.SE seems more convenient.</p>
1,726
<p>I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer?</p>
<p>From the <a href="http://peak.telecommunity.com/DevCenter/PythonEggs" rel="noreferrer">Python Enterprise Application Kit community</a>:</p> <blockquote> <p><em>"Eggs are to Pythons as Jars are to Java..."</em></p> <p>Python eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects. There are several binary formats that embody eggs, but the most common is '.egg' zipfile format, because it's a convenient one for distributing projects. All of the formats support including package-specific data, project-wide metadata, C extensions, and Python code.</p> <p>The primary benefits of Python Eggs are:</p> <ul> <li><p>They enable tools like the "Easy Install" Python package manager</p></li> <li><p>.egg files are a "zero installation" format for a Python package; no build or install step is required, just put them on PYTHONPATH or sys.path and use them (may require the runtime installed if C extensions or data files are used)</p></li> <li><p>They can include package metadata, such as the other eggs they depend on</p></li> <li><p>They allow "namespace packages" (packages that just contain other packages) to be split into separate distributions (e.g. zope.<em>, twisted.</em>, peak.* packages can be distributed as separate eggs, unlike normal packages which must always be placed under the same parent directory. This allows what are now huge monolithic packages to be distributed as separate components.)</p></li> <li><p>They allow applications or libraries to specify the needed version of a library, so that you can e.g. require("Twisted-Internet>=2.0") before doing an import twisted.internet.</p></li> <li><p>They're a great format for distributing extensions or plugins to extensible applications and frameworks (such as Trac, which uses eggs for plugins as of 0.9b1), because the egg runtime provides simple APIs to locate eggs and find their advertised entry points (similar to Eclipse's "extension point" concept).</p></li> <li><p>There are also other benefits that may come from having a standardized format, similar to the benefits of Java's "jar" format.</p></li> </ul> </blockquote> <p>-Adam</p>
<p>Whatever you do, do not stop distributing your application, also, as a tarball, as that is the easiest packagable format for operating systems with a package sysetem.</p>
7,029
<p>I'm really confused by the various configuration options for .Net configuration of dll's, ASP.net websites etc in .Net v2 - especially when considering the impact of a config file at the UI / end-user end of the chain.</p> <p>So, for example, some of the applications I work with use settings which we access with:</p> <pre><code>string blah = AppLib.Properties.Settings.Default.TemplatePath; </code></pre> <p>Now, this option seems cool because the members are stongly typed, and I won't be able to type in a property name that doesn't exist in the Visual Studio 2005 IDE. We end up with lines like this in the App.Config of a command-line executable project:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="AppConnectionString" connectionString="XXXX" /&gt; &lt;add name="AppLib.Properties.Settings.AppConnectionString" connectionString="XXXX" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>(If we don't have the second setting, someone releasing a debug dll to the live box could have built with the debug connection string embedded in it - eek)</p> <p>We also have settings accessed like this:</p> <pre><code>string blah = System.Configuration.ConfigurationManager.AppSettings["TemplatePath_PDF"]; </code></pre> <p>Now, these seem cool because we can access the setting from the dll code, or the exe / aspx code, and all we need in the Web or App.config is:</p> <pre><code>&lt;appSettings&gt; &lt;add key="TemplatePath_PDF" value="xxx"/&gt; &lt;/appSettings&gt; </code></pre> <p>However, the value of course may not be set in the config files, or the string name may be mistyped, and so we have a different set of problems.</p> <p>So... if my understanding is correct, the former methods give strong typing but bad sharing of values between the dll and other projects. The latter provides better sharing, but weaker typing.</p> <p>I feel like I must be missing something. For the moment, I'm not even concerned with the application being able to write-back values to the configuration files, encryption or anything like that. Also, I had decided that the best way to store any non-connection strings was in the DB... and then the very next thing that I have to do is store phone numbers to text people in case of DB connection issues, so they must be stored outside the DB!</p>
<p>Nij, our difference in thinking comes from our different perspectives. I'm thinking about developing enterprise apps that predominantly use WinForms clients. In this instance the business logic is contained on an application server. Each client would need to know the phone number to dial, but placing it in the App.config of each client poses a problem if that phone number changes. In that case it seems obvious to store application configuration information (or application wide settings) in a database and have each client read the settings from there. </p> <p>The other, .NET way, (I make the distinction because we have, in the pre .NET days, stored application settings in DB tables) is to store application settings in the app.config file and access via way of the generated Settings class.</p> <p>I digress. Your situation sounds different. If all different apps are on the same server, you could place the settings in a web.config at a higher level. However if they are not, you could also have a seperate "configuration service" that all three applications talk to get their shared settings. At least in this solution you're not replicating the code in three places, raising the potential of maintenance problems when adding settings. Sounds a bit over engineered though.</p> <p>My personal preference is to use strong typed settings. I actually generate my own strongly typed settings class based on what it's my settings table in the database. That way I can have the best of both worlds. Intellisense to my settings and settings stored in the db (note: that's in the case where there's no app server).</p> <p>I'm interested in learning other peoples strategies for this too :)</p>
<p>I think your confusion comes from the fact that it looks like your first example is a home-brewed library, not part of .NET. The configurationmanager example is an example of built-in functionality.</p>
8,240
<p>I've been using some basic AOP style solutions for cross-cutting concerns like security, logging, validation, etc. My solution has revolved around <a href="http://www.castleproject.org/container/index.html" rel="nofollow noreferrer">Castle Windsor</a> and DynamicProxy because I can apply everything using a Boo based DSL and keep my code clean of Attributes. I was told at the weekend to have a look at <a href="http://www.postsharp.org/" rel="nofollow noreferrer">PostSharp</a> as it's supposed to be a "better" solution. I've had a quick look at PostSharp, but I've been put off by the Attribute usage.</p> <p>Has anyone tried both solutions and would care to share their experiences?</p>
<p>I only looked at castle-windsor for a short time (yet) so I can't comment on that but I did use postsharp.</p> <p>Postsharp works by weaving at compile time. It ads a post-compile step to your build where it modifies your code. The code is compiled as if you just programmed the cross cutting concerns into you code. This is a bit more performant than runtime weaving and because of the use of attributes Postsharp is very easy to use. I think using attributes for AOP isn't as problematic as using it for DI. But that's just my personal taste.</p> <p>But...</p> <p>If you already use castle for dependency injection I don't see a good reason why you shouldn't also use it for AOP stuff. I think though the AOP at runtime is a bit slower than at compile time it's also more powerful. AOP and DI are in my opinion related concepts so I think it's a good idea to use one framework for both. So I'll probably look at the castle stuff again next project I need AOP.</p>
<p>I only looked at castle-windsor for a short time (yet) so I can't comment on that but I did use postsharp.</p> <p>Postsharp works by weaving at compile time. It ads a post-compile step to your build where it modifies your code. The code is compiled as if you just programmed the cross cutting concerns into you code. This is a bit more performant than runtime weaving and because of the use of attributes Postsharp is very easy to use. I think using attributes for AOP isn't as problematic as using it for DI. But that's just my personal taste.</p> <p>But...</p> <p>If you already use castle for dependency injection I don't see a good reason why you shouldn't also use it for AOP stuff. I think though the AOP at runtime is a bit slower than at compile time it's also more powerful. AOP and DI are in my opinion related concepts so I think it's a good idea to use one framework for both. So I'll probably look at the castle stuff again next project I need AOP.</p>
8,828
<p>Are there any advantages compiling for .NET Framework 3.5 instead of 2.0?</p> <p>For example less memory consumption, faster startup, better performance...</p> <p>Personally I don't think so however, I may have missed something.</p> <h2>Edits</h2> <ol> <li><p>Of course there are more features in the 3.5 framework, but these are not the focus of this question.</p> </li> <li><p>There seem to be no advantages.</p> </li> <li><p>Yes I meant targeting the Framework. I have installed the latest 3.5 SP1 and VS 2008 so what's the difference between compiling with and targeting a framework? I can target the framework in the project options but how do I 'compile with' a specific framework version? I did not know that there is a difference.</p> </li> <li><p>So for now we agree that there are no advantages.</p> </li> </ol>
<p>There's a difference between compiling and targeting.</p> <p>Compiling the code with the (for example) C# 3.0 compiler will probably give you a boost on performance (very little one anyway) as some optimization for the generated IL code migh have been included. It also allows you to use some of the new features like automatic properties or lambda expressions.</p> <p>Targeting for a given framework will ensure your assembly works for that framework (and posteriors) and will fail if you target for 2.0 and are using a 3.5 library. No performance improvements will be directly related to that unless your substituting a class from one framework with another "fastest" class. For example, targeting .NET 1.1 won't allow you to use generics and therefore you'll have to use the ArrayList which is considerably slower than List (due to boxing and unboxing).</p>
<p>3.5 has classes that 2.0 doesn't. Func&lt;...> for instance. If you aim for 2.0, you can't use them. </p>
9,229
<p>Does anyone have links to documentation or guides on making the decision between REST vs. SOAP? I understand both of these but am looking for some references on the key decision points, eg, security, which may make you lean towards one or the other.</p>
<p><a href="http://www.prescod.net/rest/rest_vs_soap_overview/" rel="noreferrer">Google first hit</a> seems pretty comprehensive.</p> <p>I think the problem here is there are too many advocates of one or the other, may be better of googling and getting more of a handle of the pro's/con's yourself and making your own decision.</p> <p>I know that sounds kinda lame, but ultimately these sort of design decisions fall down to the developer/architect working on it, and <strong>99% of the time, the problem domain will be the deciding factor</strong> (or at least it should be), not a guide on the net.</p>
<p>I Think both REST and SOAP can be used to implement similar functionality, but in general SOAP should be used when a particular feature of SOAP is needed, and the advantages of REST make it generally the best option otherwise. However, both REST and SOAP are often termed &quot;Web services,&quot; and one is often used in place of the other, but they are totally different approaches. REST is an architectural style for building client-server applications. SOAP is a protocol specification for exchanging data between two endpoints.</p> <p>I am very much agree with +Rob Cooper in his post. Yes, there are so many advocates. I have listed the <a href="http://www.csharptutorial.in/?p=296" rel="nofollow noreferrer">difference between soap and rest</a>.</p>
4,861
<p>I am planning to give a Technical presentation for a product we are building. Intended audience is Technical developers. So, most of the time, I will be debugging trough the code in Visual Studio, performance analysis, some architecture review etc.</p> <p>I have read couple of <a href="http://www.hanselman.com/blog/11TopTipsForASuccessfulTechnicalPresentation.aspx" rel="nofollow noreferrer">blogs</a> on font sizes to use, templates to use on Visual Studio, <a href="http://weblogs.asp.net/jgalloway/archive/2006/12/05/tips-for-a-technical-presentation.aspx" rel="nofollow noreferrer">presentation tools</a>, <a href="http://focs.wordpress.com/2007/09/12/9-tips-how-to-give-a-technical-presentation/" rel="nofollow noreferrer">among other</a> very <a href="http://blogs.msdn.com/kaevans/archive/2005/03/12/394527.aspx" rel="nofollow noreferrer">useful tips</a>.</p> <p>What I am looking specifically for is how to keep the session interesting without making it a dry code walkthrough? How to avoid making people fall asleep? Would be great to hear some stories..</p> <p><strong>Update1</strong>: Nice youtube clip on zoomit. <a href="http://www.youtube.com/watch?v=4jMLAF-9ACk" rel="nofollow noreferrer">Glue Audience To Your Presentation With Zoomit.</a></p> <p><strong>Update2</strong>: New post from Scott Hanselman after his <a href="http://channel9.msdn.com/pdc2008/TL49/" rel="nofollow noreferrer">PDC talk</a> - <a href="http://www.hanselman.com/blog/TipsForPreparingForATechnicalPresentation.aspx" rel="nofollow noreferrer">Tips for Preparing for a Technical Presentation</a> </p>
<p>Put interesting comments in the code.</p> <p>// This better not fail during my next presentation, stupid @#$@#%$ code.</p> <p>Don't talk about them, let them be found by the audience.</p> <p>-Adam</p>
<p>If you use slides at all, follow <a href="http://blog.guykawasaki.com/2005/12/the_102030_rule.html" rel="nofollow noreferrer">Guy Kawasaki's 10/20/30 rule</a>:</p> <ul> <li>No more than 10 slides</li> <li>No more than 20 minutes spent on slides</li> <li>No less than 30 point type on slides</li> </ul> <p>-Adam</p>
8,450
<p>At work, we have a dedicated SEO Analyst who's job is to pour over lots of data (KeyNote/Compete etc) and generate up fancy reports for the executives so they can see how we are doing against our competitors in organic search ranking. He also leads initiatives to improve the SEO rankings on our sites by optimizing things as best we can.</p> <p>We also have a longstanding mission to decrease our page load time, which right now is pretty shoddy on some pages.</p> <p>The SEO guy mentioned that semantic, valid HTML gets more points by crawlers than jumbled messy HTML. I've been working on a real time HTML compressor that will decrease our page sizes my a pretty good chunk. Will compressing the HTML hurt us in site rankings?</p>
<p>I would suggest using compression at the transport layer, and eliminating whitespace from the HTML, but not sacrificing the semantics of your markup in the interest of speed. In fact, the better you "compress" your markup, the less effective the transport layer compression will be. Or, to put it a better way, let the gzip transfer-coding slim your HTML for you, and pour your energy into writing clean markup that renders quickly once it hits the browser.</p>
<p>Using compression does not hurt your page ranking. Matt Cutts talks about this in his article on <a href="http://www.mattcutts.com/blog/crawl-caching-proxy/" rel="nofollow noreferrer">Crawl Caching Proxy</a></p> <p>Your page load time can also be greatly improved by <a href="http://bdwebster.com/2008/04/16/resizing-images/" rel="nofollow noreferrer">resizing your images</a>. While you can use the height and width attributes in the img tag, this does not change the size of the images that is downloaded to the browser. Resizing the images before putting them on your pages can reduce the load time by 50% or more, depending on the number and type of images that you're using.</p> <p>Other things that can improve your page load time are:</p> <ul> <li>Use web standards/CSS for layout instead of tables</li> <li>If you copy/paste content from MS Word, strip out the extra tags that Word generates</li> <li>Put CSS and javascript in external files, rather then embedded in the page. Helps when users visit more than one page on your site because browsers typically cache these files</li> </ul> <p>This <a href="http://www.websiteoptimization.com/services/analyze/" rel="nofollow noreferrer">Web Page Analyzer</a> will give you a speed reports that shows how long different elements of your page take to download.</p>
7,009
<p>Has anyone run into this error message before when using a timer on an ASP.NET page to update a <code>DataGrid</code> every x seconds? </p> <p>Searching google yielded this <a href="http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx" rel="nofollow noreferrer">blog entry</a> and many more but nothing that seems to apply to me yet. </p> <p>The full text of the error message below:</p> <blockquote> <p>Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.</p> </blockquote>
<p>The RoleProvider sets a cookie to cache role information in a cookie. When the cookie resets during an asynch post back from AJAX, you will get this error. The solution is to either set the cookieTimeout in the roleManager section of your web.config to a very large number of minutes, or set the cacheRolesInCookie=false.</p> <p>This was a known bug in AJAX 1.0 Extensions. I'm not sure if it was fixed in future releases, and I should have mentioned that I was using AJAX 1.0 extensions in VS2008 targeting the 2.0 framework.</p> <p>Happy programming!</p>
<p>Regarding the formatting of your post: If you use the quote-button instead of code-button, people do not have to scroll to see the complete error message.</p>
4,713
<p>Is it currently possible with pre release of ironruby to run rubygems? It seems as if I have to set an environment variable to find them? </p>
<p>You've been able to run rubygems under IronRuby for quite a while now. Simply download and install the latest <a href="http://www.codeplex.com/Wikipage?ProjectName=ironruby" rel="noreferrer">IronRuby from codeplex</a>, and run <code>igem</code> on the command line</p> <hr /> <blockquote> <p><strong>Original Answer:</strong></p> <p>I'm on that mailing list - to save you the digging, someone asked this a few weeks ago, and <a href="http://rubyforge.org/pipermail/ironruby-core/2008-August/002688.html" rel="noreferrer">this was the answer</a></p> <p>The answer (at this point) is no, you can't, but it doesn't seem like it'll be too far away.</p> <p>PS: listen to curt. He's on the core team for ironruby. &lt;3</p> </blockquote>
<p>if you set ENV['GEM_PATH'] correctly before using rubygems, then gems will work <em>sometimes</em> under IronRuby. I'm actually looking at fixing this right now.</p> <p>Also, this kind of question is probably better suited for the <a href="http://rubyforge.org/mail/?group_id=4359" rel="nofollow noreferrer">IronRuby mailing list</a> than it is for StackOverflow.</p>
6,676
<p>How do you set up IIS so that you can call python scripts from asp pages?</p> <p>Ok, so I found the answer to that question here: <a href="http://support.microsoft.com/kb/276494" rel="nofollow noreferrer"><a href="http://support.microsoft.com/kb/276494" rel="nofollow noreferrer">http://support.microsoft.com/kb/276494</a></a></p> <p>So on to my next question: How do you call a cgi script from within classic asp (vb) code? Particularly one which is not in the web root directory.</p>
<p>You could also do it <a href="https://web.archive.org/web/20211020121638/https://www.4guysfromrolla.com/webtech/082201-1.shtml" rel="nofollow noreferrer">this way</a>.</p>
<p>You could also do it <a href="https://web.archive.org/web/20211020121638/https://www.4guysfromrolla.com/webtech/082201-1.shtml" rel="nofollow noreferrer">this way</a>.</p>
8,709
<p>I have an Epax X1, I have just purchased the 2nd and 3rd bottle of resin, but I don't know what are the best settings.</p> <p>What is the best way to find the best settings for a new resin?</p> <p>Is it possible to print a calibration object that starts with some settings and changes as it goes? For example starts with 12 seconds and decreases half second every 5 mm?</p> <p><strong>EDIT</strong></p> <p>The 2 resins I am dealing with right now are <a href="https://rads.stackoverflow.com/amzn/click/com/B0794RQPJ5" rel="nofollow noreferrer" rel="nofollow noreferrer">Nova3D</a> and <a href="https://rads.stackoverflow.com/amzn/click/com/B07FCMM2S7" rel="nofollow noreferrer" rel="nofollow noreferrer">Elegoo</a>. Any help with those two resins would help right now, but I would love to have a more generic answer that would allow me to explore and troubleshoot any resin without asking every time.</p>
<p>It ended up I had like super cheap endstops that were actually shorting VCC to GND, as suspected by r_ahlskog. Just bought other ones and now it's working fine.</p>
<p>It ended up I had like super cheap endstops that were actually shorting VCC to GND, as suspected by r_ahlskog. Just bought other ones and now it's working fine.</p>
1,493
<p>Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.</p> <pre><code>Msg 10314, Level 16, State 11, Line 1 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileLoadException: Could not load file or assembly 'orders, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) System.IO.FileLoadException: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) </code></pre>
<p>Ran the SQL commands below and the issue appears to be resolved.</p> <pre><code>USE database_name GO EXEC sp_changedbowner 'sa' ALTER DATABASE database_name SET TRUSTWORTHY ON </code></pre>
<pre><code>ALTER AUTHORIZATION ON DATABASE::mydb TO sa; ALTER DATABASE [myDB] SET TRUSTWORTHY ON GO </code></pre>
9,792
<p>Okay, I've looked all over the internet for a good solution to get PHP and MySQL working on IIS7.0. It's nearly impossible, I've tried it so many times and given up in vain. Please please help by linking some great step-by-step tutorial to adding PHP and MySQL on IIS7.0 from scratch. PHP and MySQL are essential for installing any CMS.</p>
<p>Have you taken a look at this:</p> <p><a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/" rel="nofollow noreferrer">http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/</a></p> <p>MySQL should be pretty straight forward.</p> <p>Let us know what problems you're encountering...</p>
<p>It's supposed to work via FastCGI. But I haven't had great success (using Vista). I can get PHP to run, but it crashes after a page loads (FastCGI does). So I'm modding you up. I'd like to see a reliable answer myself.</p>
3,303
<p>In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a few items to a cart and checkout).</p> <p>Just hitting the homepage hard with a handful of developers would almost always locate a major problem. More scalability problems would surface at the second stage, and even more - after the launch.</p> <p>The URL of the tools I used were Microsoft Homer (aka <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e2c0585a-062a-439e-a67d-75a89aa36495&amp;displaylang=en" rel="noreferrer">Microsoft Web Application Stress Tool</a>) and <a href="https://code.google.com/archive/p/pylt/" rel="noreferrer">Pylot</a>.</p> <p>The reports generated by these tools never made much sense to me, and I would spend many hours trying to figure out what kind of concurrent load the site would be able to support. It was always worth it because the stupidest bugs and bottlenecks would always come up (for instance, web server misconfigurations).</p> <p>What have you done, what tools have you used, and what success have you had with your approach? The part that is most interesting to me is coming up with some kind of a meaningful formula for calculating the number of concurrent users an app can support from the numbers reported by the stress test application.</p>
<p>Here's another vote for <a href="http://jakarta.apache.org/jmeter/" rel="noreferrer"><strong>JMeter</strong></a>.</p> <p>JMeter is an open-source load testing tool, written in Java. It's capable of testing a number of different server types (for example, web, web services, database, just about anything that uses requests basically).</p> <p>It does however have a steep learning curve once you start getting to complicated tests, but it's well worth it. You can get up and running very quickly, and depending on what sort of stress-testing you want to do, that might be fine.</p> <p>Pros: </p> <ul> <li>Open-Source/Free tool from the Apache project (helps with buy-in)</li> <li>Easy to get started with, and easy to use once you grasp the core concepts. (Ie, how to create a request, how to create an assertion, how to work with variables etc).</li> <li>Very scalable. I've run tests with 11 machines generating load on the server to the tune of almost a million hits/hour. It was <em>much</em> easier to setup than I was expecting.</li> <li>Has an active community and good resources to help you get up and running. Read the tutorials first and play with it for a while. </li> </ul> <p>Cons:</p> <ul> <li>The UI is written in Swing. (ugh!)</li> <li>JMeter works by parsing the response text returned by the server. So if you're looking to validate any sort of javascript behaviours, you're out of luck.</li> <li>Learning curve is steep for non-programmers. If you're familiar with regular expressions, you're already ahead of the game.</li> <li>There are large numbers of (<em>insert expletive</em>) idiots in the support forum asking stupid questions that could be easily solved if they'd give the documentation even a cursory glance. ('How do I use JMeter to stress-test my Windows GUI' shows up quite frequently).</li> <li>Reporting 'out of the box' leaves much to be desired, particularly for larger tests. In the test I mentioned above, I ended up having to write a quick console app to do some of the 'xml-logfile' to 'html' conversions. That was a few years ago though, so it's probable that this would no longer be required.</li> </ul>
<p>One more note, for our web application, I found that we had huge performance issues due to contention between threads over locks... so the moral was to think over the locking scheme very carefully. We ended up having worker threads to throttle too many requests using an asynchronous http handler, otherwise the application would just get overwhelmed and crash and burn. It meant a huge backlog could pile up, but at least the site would stay up.</p>
2,903
<p>I'm looking for a quick-and-dirty solution to this, I have to set up a Subversion server really quickly, like by the end of the day tomorrow. My initial thought was to just download a virtual appliance that we could load onto our host machine. The problem I am having however is that all the appliances I have found so far are stuck in svn version 1.4 or lower.</p> <p>Does anybody know of an appliance that has svn 1.5 running? I don't need any of the other bits like issue tracking, WebSVN or any of that stuff.</p> <p>Thanks, Wally</p> <p><strong><em>EDIT: To answer some of the questions, I would prefer for the host OS to be some flavour of Linux so that I can avoid having to purchase an additional Windows license.</em></strong></p>
<p>You should consider this, it is really ZIRRO friction and it integrates well in various scenarios. <br />Not to mention it is free of charge.</p> <p><a href="http://www.visualsvn.com/server/" rel="noreferrer" title="VisualSVN Server">http://www.visualsvn.com/server/</a></p> <p>Cheers, <br />Dragos</p>
<p>I would agree with <a href="https://stackoverflow.com/users/1862/kibbee">Kibbee</a>. I wanted to jump in with SVN so I installed the daemon and had everything up and running in no time. It took me longer to get all the commands down for adding and committing files than the installation.</p>
4,838
<p>I want to develop some educational content, which I want to distribute to children using Adobe AIR. The content will contain videos. Now, from what I see, AIR will put the content onto the local file system, for anyone to see. I want to prevent this. Is there a way out?</p>
<p>One solution is to use DRM in conjunction with Flash Media Server (as mentioned by Stu).</p> <p>Another option would be to stream the content at runtime, and not cache to the file system. </p> <p>Finally, it might also be possible to store the bits for the FLV in the encrypted local data store or SQLite database (which adds encryption support in AIR 1.5), however, this probably wouldnt work well for large videos (performance issues), and you may still need to write it out to the file system first before playing (although temporarily).</p> <p>mike chambers</p>
<p>Possibly, but you must embrace The Dark Side -- aka DRM (Digital Rights Management). Go read up <a href="http://www.flashcomguru.com/index.cfm/2007/10/23/Flash-Video-DRM-Roundup" rel="nofollow noreferrer">Flash Video DRM</a>. It is awfully painful stuff to do correctly, and users tend to hate it. Ask yourself if your content is <em>really</em> so valuable and hot that you need to go down this route.</p>
9,677
<p>What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP</p> <pre><code>&lt;?php $class_name = 'SomeClassName'; $object = new $class_name; ?&gt; </code></pre> <p>This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement.</p> <p>Problems that come immediately to mind are </p> <ol> <li><s>You lose the ability to pass arguments into a constructor</s> (LIES. Thanks Jeremy)</li> <li>Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?)</li> </ol> <p>What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?</p>
<p>One of the issues with the resolving at run time is that you make it really hard for the opcode caches (like APC). Still, for now, doing something like you describe in your question is a valid way if you need a certain amount of indirection when instanciating stuff.</p> <p>As long as you don't do something like</p> <pre><code>$classname = 'SomeClassName'; for ($x = 0; $x &lt; 100000; $x++){ $object = new $classname; } </code></pre> <p>you are probably fine :-)</p> <p>(my point being: Dynamically looking up a class here and then doesn't hurt. If you do it often, it will).</p> <p>Also, be sure that $classname can never be set from the outside - you'd want to have some control over what exact class you will be instantiating.</p>
<p>I use dynamic instantiation in my custom framework. My application controller needs to instantiate a sub-controller based on the request, and it would be simply ridiculous to use a gigantic, ever-changing switch statement to manage the loading of those controllers. As a result, I can add controller after controller to my application without having to modify the app controller to call them. As long as my URIs adhere to the conventions of my framework, the app controller can use them without having to know anything until runtime.</p> <p>I'm using this framework in a production shopping cart application right now, and the performance is quite favorable, too. That being said, I'm only using the dynamic class selection in one or two spots in the whole app. I wonder in what circumstances you would need to use it frequently, and whether or not those situations are ones that are suffering from a programmer's desire to over-abstract the application (I've been guilty of this before).</p>
7,037
<p>I'm asking with regards to c#, but I assume its the same in most other languages.</p> <p>Does anyone have a good definition of <em>expressions</em> and <em>statements</em> and what the differences are?</p>
<p><strong>Expression:</strong> Something which evaluates to a value. Example: <em>1+2/x</em><br> <strong>Statement:</strong> A line of code which does something. Example: <em>GOTO 100</em></p> <p>In the earliest general-purpose programming languages, like FORTRAN, the distinction was crystal-clear. In FORTRAN, a statement was one unit of execution, a thing that you did. The only reason it wasn't called a "line" was because sometimes it spanned multiple lines. An expression on its own couldn't do anything... you had to assign it to a variable.</p> <pre><code>1 + 2 / X </code></pre> <p>is an error in FORTRAN, because it doesn't do anything. You had to do something with that expression:</p> <pre><code>X = 1 + 2 / X </code></pre> <p>FORTRAN didn't have a grammar as we know it today&mdash;that idea was invented, along with Backus-Naur Form (BNF), as part of the definition of Algol-60. At that point the <em>semantic</em> distinction ("have a value" versus "do something") was enshrined in <em>syntax</em>: one kind of phrase was an expression, and another was a statement, and the parser could tell them apart.</p> <p>Designers of later languages blurred the distinction: they allowed syntactic expressions to do things, and they allowed syntactic statements that had values. The earliest popular language example that still survives is C. The designers of C realized that no harm was done if you were allowed to evaluate an expression and throw away the result. In C, every syntactic expression can be a made into a statement just by tacking a semicolon along the end:</p> <pre><code>1 + 2 / x; </code></pre> <p>is a totally legit statement even though absolutely nothing will happen. Similarly, in C, an expression can have <em>side-effects</em>&mdash;it can change something.</p> <pre><code>1 + 2 / callfunc(12); </code></pre> <p>because <code>callfunc</code> might just do something useful.</p> <p>Once you allow any expression to be a statement, you might as well allow the assignment operator (=) inside expressions. That's why C lets you do things like</p> <pre><code>callfunc(x = 2); </code></pre> <p>This evaluates the expression x = 2 (assigning the value of 2 to x) and then passes that (the 2) to the function <code>callfunc</code>.</p> <p>This blurring of expressions and statements occurs in all the C-derivatives (C, C++, C#, and Java), which still have some statements (like <code>while</code>) but which allow almost any expression to be used as a statement (in C# only assignment, call, increment, and decrement expressions may be used as statements; see <a href="https://stackoverflow.com/a/20771/8554766">Scott Wisniewski's answer</a>).</p> <p>Having two "syntactic categories" (which is the technical name for the sort of thing statements and expressions are) can lead to duplication of effort. For example, C has two forms of conditional, the statement form</p> <pre><code>if (E) S1; else S2; </code></pre> <p>and the expression form</p> <pre><code>E ? E1 : E2 </code></pre> <p>And sometimes people <em>want</em> duplication that isn't there: in standard C, for example, only a statement can declare a new local variable&mdash;but this ability is useful enough that the GNU C compiler provides a GNU extension that enables an expression to declare a local variable as well.</p> <p>Designers of other languages didn't like this kind of duplication, and they saw early on that if expressions can have side effects as well as values, then the <em>syntactic</em> distinction between statements and expressions is not all that useful&mdash;so they got rid of it. Haskell, Icon, Lisp, and ML are all languages that don't have syntactic statements&mdash;they only have expressions. Even the class structured looping and conditional forms are considered expressions, and they have values&mdash;but not very interesting ones.</p>
<p>Most precisely, a statement must have a <strong>&quot;side-effect&quot;</strong> (i.e. <a href="https://stackoverflow.com/questions/602444/what-is-functional-declarative-and-imperative-programming/8357604#8357604">be imperative</a>) and an expression must <em>have</em> a <strong>value</strong> type (i.e. not the bottom type).</p> <p>The <a href="http://james-iry.blogspot.com/2009/08/getting-to-bottom-of-nothing-at-all.html" rel="nofollow noreferrer">type of a statement</a> is the unit type, but due to Halting theorem unit is fiction so lets say the <a href="https://stackoverflow.com/a/8450076/615784">bottom type</a>.</p> <hr /> <p><code>Void</code> is not precisely the bottom type (it isn't the subtype of all possible types). It exists in languages that <a href="http://james-iry.blogspot.com/2009/08/getting-to-bottom-of-nothing-at-all.html" rel="nofollow noreferrer">don't have a completely sound type system</a>. That may sound like a snobbish statement, but completeness <a href="https://stackoverflow.com/a/8438947/615784">such as variance annotations</a> are critical to writing extensible software.</p> <p>Let's see what Wikipedia has to say on this matter.</p> <p><a href="https://en.wikipedia.org/wiki/Statement_(computer_science)" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Statement_(computer_science)</a></p> <blockquote> <p>In computer programming a statement is the smallest standalone element of an <strong>imperative</strong> programming language that expresses <strong>some action</strong> to be carried out.</p> <p>Many languages (e.g. C) make a distinction between statements and definitions, with a statement only containing executable code and a definition declaring an identifier, while an expression evaluates to a value only.</p> </blockquote>
3,962
<p>Are you working on a (probably commercial) product which uses RDF/OWL/SPARQL technologies? If so, can you please describe your product?</p>
<p>O'Reilly's Practical RDF has a chatper titled <a href="http://safari.oreilly.com/0596002637/pracrdf-CHP-15-SECT-1" rel="noreferrer">Commercial Uses of RDF/XML</a>. The table at the left lists the subsections: <a href="http://chandlerproject.org/" rel="noreferrer">Chandler</a>, <a href="http://www.intellidimension.com/" rel="noreferrer">RDF Gateway</a>, <a href="http://siderean.com/" rel="noreferrer">Seamark</a>, and Adobe's <a href="http://www.adobe.com/products/xmp/" rel="noreferrer">XMP</a> stuff.</p>
<p><a href="http://www.microsoft.com/imm" rel="nofollow noreferrer">Microsoft Interactive Media Manager</a> is a metadata management system developed on the Microsoft SharePoint platform that heavily leverages RDF, OWL, and SPARQL. It has some big customers in the broadcast space and is an excellent example of enterprise use of these technologies.</p>
5,862
<p>I have used IPC in Win32 code a while ago - critical sections, events, and semaphores.</p> <p>How is the scene in the .NET environment? Are there any tutorial explaining all available options and when to use and why?</p>
<p>Most recent Microsoft's stuff in IPC is <a href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation" rel="noreferrer">Windows Communication Foundation</a>. Actually there is nothing new in the lower level (tcp, upd, named pipes etc) But WCF simplifies IPC development greatly.</p> <p>Useful resource:</p> <ul> <li><a href="http://www.ddj.com/windows/196802111" rel="noreferrer">Interprocess Communication with WCF</a> on Dr. Dobb's portal</li> <li><a href="http://www.infoq.com/news/2008/01/wcf-comm-options" rel="noreferrer">WCF Communication Options in the .NET Framework 3.5</a></li> </ul> <p>and of course <a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx" rel="noreferrer">MSDN on WCF</a></p>
<p>There is also .NET Remoting, which I found quite cool, but I guess they are obsoleting it now that they have WCF.</p>
8,003
<p>Is there an existing solution to create a regular expressions dynamically out of a given date-time format pattern? The supported date-time format pattern does not matter (Joda <code>DateTimeFormat</code>, <code>java.text.SimpleDateTimeFormat</code> or others).</p> <p>As a specific example, for a given date-time format like <code>dd/MM/yyyy hh:mm</code>, it should generate the corresponding regular expression to match the date-times within the specified formats.</p>
<p>I guess you have a limited alphabet that your time formats can be constructed of. That means, <code>"HH"</code> would always be "hours" on the 24-hour clock, <code>"dd"</code> always the day with leading zero, and so on.</p> <p>Because of the sequential nature of a time format, you could try to tokenize a format string of <code>"dd/mm/yyyy HH:nn"</code> into an array <code>["dd", "/", "mm", "/", "yyyy", " ", "HH", ":", "nn"]</code>. Then go ahead and form a pattern string from that array by replacing <code>"HH"</code> with <code>"([01][0-9]|2[0-3])"</code> and so on. Preconstruct these pattern atoms into a lookup table/array. All parts of your array that are not in the lookup table are literals. Escape them to according regex rules and append them to you pattern string.</p> <hr> <p>EDIT: As a side effect for a regex based solution, when you put all regex "atoms" of your lookup table into parens and keep track of their order in a given format string, you would be able to use sub-matches to extract the required components from a match and feed them into a CreateDate function, thus skipping the ParseDate part altogether.</p>
<p><code>SimpleDateFormat</code> already does this with the <code>parse()</code> method.</p> <p>If you need to parse multiple dates from a single string, start with a regex (even if it matches too leniently), and use <code>parse()</code> on all the potential matches found by the regex.</p>
7,528
<p>Choosing the correct lifecycle and methodology isn't as easy as it was before when there weren't so many methodologies, this days a new one emerges every day.</p> <p>I've found that most projects require a certain level of evolution and that each project is different from the rest. That way, extreme programming works with for a project for a given company with 15 employees but doesn't quite work with a 100 employee company or doesn't work for a given project type (for example real time application, scientific application, etc).</p> <p>I'd like to have a list of experiences, mostly stating the project type, the project size (number of people working on it), the project time (real or planned), the project lifecycle and methodology and if the project succeded or failed. Any other data will be appreciated, I think we might find some patterns if there's enough data. Of course, comments are welcomed.</p> <ul> <li>PS: Very large, PT: Very long, LC: Incremental-CMMI, PR: Success</li> <li>PS: Very large, PT: Very long, LC: Waterfall-CMMI, PR: Success</li> </ul> <p><strong>Edit:</strong> I'll be constructing a "summary" with the stats of all answers.</p>
<p>Depending on what you're doing, you might want to move the audit out of the data layer into the data access layer. It give you more control.</p> <p>I asked a similar question wrt NHibernate and SqlServer <a href="https://stackoverflow.com/questions/15917/data-auditing-in-nhibernate-and-sqlserver">here</a>.</p>
<p>Here is the implementation I use to audit tables: <a href="http://www.simple-talk.com/sql/database-administration/pop-rivetts-sql-server-faq-no.5-pop-on-the-audit-trail/" rel="nofollow noreferrer">Pop Rivett's SQL Server FAQ No.5: Pop on the Audit Trail</a></p>
8,602
<p>I'm learning objective-c and keep bumping into the @ symbol. It is used in different scenarios, for example at the start of a string or to synthesise accessor methods. </p> <p>What's does the @ symbol mean in objective-c?</p>
<p>The <code>@</code> character isn't used in C or C++ identifiers, so it's used to introduce Objective-C language keywords in a way that won't conflict with the other languages' keywords. This enables the "Objective" part of the language to freely intermix with the C or C++ part.</p> <p>Thus with very few exceptions, any time you see <code>@</code> in some Objective-C code, you're looking at Objective-C constructs rather than C or C++ constructs.</p> <p>The major exceptions are <code>id</code>, <code>Class</code>, <code>nil</code>, and <code>Nil</code>, which are generally treated as language keywords even though they may also have a <code>typedef</code> or <code>#define</code> behind them. For example, the compiler actually does treat <code>id</code> specially in terms of the pointer type conversion rules it applies to declarations, as well as to the decision of whether to generate GC write barriers.</p> <p>Other exceptions are <code>in</code>, <code>out</code>, <code>inout</code>, <code>oneway</code>, <code>byref</code>, and <code>bycopy</code>; these are used as storage class annotations on method parameter and return types to make Distributed Objects more efficient. (They become part of the method signature available from the runtime, which DO can look at to determine how to best serialize a transaction.) There are also the attributes within <code>@property</code> declarations, <code>copy</code>, <code>retain</code>, <code>assign</code>, <code>readonly</code>, <code>readwrite</code>, <code>nonatomic</code>, <code>getter</code>, and <code>setter</code>; those are only valid within the attribute section of a <code>@property</code> declaration.</p>
<p>As other answers have noted, the <code>@</code> symbol was convenient for adding Objective-C's superset of functionality to C because <code>@</code> is not used syntactically by C.</p> <p>As to what it represents, that depends on the context in which it is used. The uses fall roughly into two categories (keywords and literals), and I've summarized the uses I could find below.</p> <p>I wrote most of this before finding <a href="https://nshipster.com/at-compiler-directives/" rel="nofollow noreferrer">NSHipster's great summary</a>. Here's another less thorough <a href="https://kapeli.com/cheat_sheets/Objective-C_@Compiler_Directives.docset/Contents/Resources/Documents/index" rel="nofollow noreferrer">cheat sheet</a>. (Both of those sources call things prefixed with <code>@</code> &quot;compiler directives&quot;, but I thought compiler directives were things like <code>#define</code>, <code>#ifdef</code>, etc. If someone could weigh in on the correct terminology, I'd appreciate it.)</p> <h1>Objective-C Keywords</h1> <p><code>@</code> prefixes many Objective-C keywords:</p> <ul> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/DefiningClasses/DefiningClasses.html#//apple_ref/doc/uid/TP40011210-CH3-SW5" rel="nofollow noreferrer"><code>@interface</code></a>: declares the methods and properties associated with a class</li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/DefiningClasses/DefiningClasses.html#//apple_ref/doc/uid/TP40011210-CH3-SW14" rel="nofollow noreferrer"><code>@implementation</code></a>: implements a class's declarations from <code>@interface</code></li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithProtocols/WorkingwithProtocols.html" rel="nofollow noreferrer"><code>@protocol</code>/<code>@optional</code>/<code>@required</code></a>: declares methods and properties that are independent of any specific class.</li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocDefiningClasses.html#//apple_ref/doc/uid/TP30001163-CH12-TPXREF124" rel="nofollow noreferrer"><code>@class</code></a>: forward declaration of a class</li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW4" rel="nofollow noreferrer"><code>@property</code>/<code>@synthesize</code>/<code>@dynamic</code></a>: declare properties in an <code>@interface</code></li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/ErrorHandling/ErrorHandling.html#//apple_ref/doc/uid/TP40011210-CH9-SW1" rel="nofollow noreferrer"><code>@try</code>/<code>@throw</code>/<code>@catch</code>/<code>@finally</code></a>: exception handling</li> <li><code>@end</code>: closes <code>@interface</code>, <code>@implementation</code>, and <code>@protocol</code>.</li> <li><code>@encode</code>: returns a C string that encodes the internal representation of a given type</li> <li><code>@synchronized</code>: ensures parallel execution exclusivity</li> <li><code>@selector</code>/<code>@protocol</code>: return <code>SEL</code> or protocol pointers with a specified name</li> <li><code>@defs</code>: I'm not really sure; it appears to import Objective-C class properties into a <code>struct</code>. NSHipster's page says it does not exist in modern Objective-C.</li> <li><code>@public</code>/<code>@package</code>/<code>@protected</code>/<code>@private</code>: access modifiers</li> <li><code>@available</code>: checks <a href="https://developer.apple.com/documentation/swift/marking-api-availability-in-objective-c" rel="nofollow noreferrer">API availability</a>.</li> <li><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html" rel="nofollow noreferrer"><code>@autoreleasepool</code></a>: creates a new autorelease scope. Any objects that received an <code>autorelease</code> in the block will receive a <code>release</code> after exiting the block (and not before.)</li> </ul> <h1>Objective-C Literals</h1> <p><code>@</code> creates <a href="https://clang.llvm.org/docs/ObjectiveCLiterals.html" rel="nofollow noreferrer">Objective-C literals</a>:</p> <ul> <li><p><code>@...</code>: <a href="https://clang.llvm.org/docs/ObjectiveCLiterals.html#nsnumber-literals" rel="nofollow noreferrer">NSNumber literal</a></p> <pre><code>NSNumber *fortyTwo = @42; // equivalent to [NSNumber numberWithInt:42] NSNumber *yesNumber = @YES; // equivalent to [NSNumber numberWithBool:YES] </code></pre> </li> <li><p><code>@(...)</code>: <a href="https://clang.llvm.org/docs/ObjectiveCLiterals.html#boxed-expressions" rel="nofollow noreferrer">Boxed expressions</a></p> <pre><code>// numbers. NSNumber *piOverTwo = @(M_PI / 2); // [NSNumber numberWithDouble:(M_PI / 2)] // strings. NSString *path = @(getenv(&quot;PATH&quot;)); // [NSString stringWithUTF8String:(getenv(&quot;PATH&quot;))] // structs. NSValue *center = @(view.center); // Point p = view.center; // [NSValue valueWithBytes:&amp;p objCType:@encode(Point)]; </code></pre> </li> <li><p><code>@&quot;...&quot;</code>: <a href="https://clang.llvm.org/docs/ObjectiveCLiterals.html#boxed-c-strings" rel="nofollow noreferrer">Boxed C strings</a></p> </li> <li><p><code>@[]</code>/<code>@{}</code>: <a href="https://clang.llvm.org/docs/ObjectiveCLiterals.html#boxed-c-strings" rel="nofollow noreferrer">Container literals</a></p> <pre><code>NSArray *array = @[ @&quot;Hello&quot;, NSApp, [NSNumber numberWithInt:42] ]; NSDictionary *dictionary = @{ @&quot;name&quot; : NSUserName(), @&quot;date&quot; : [NSDate date], @&quot;processInfo&quot; : [NSProcessInfo processInfo] }; </code></pre> </li> </ul>
4,533
<p>Something to take an XML schema and let you add/edit data but not change the XML structure, preferably installed on a server. basically a UI to edit xml documents as a web app. Someone has got to have done this already right?</p>
<p><a href="http://xopus.com" rel="nofollow noreferrer">Xopus</a> is a commercial XML editor designed specifically to be used by non-technical people. Xopus is browser based and can be installed on any webserver. Xopus keeps the XML document 100% valid at all times using XML Schema and has a WYSIWYG view using XSLT. </p> <p>You could use the <a href="http://xopus.com/documentation/developer-guide/reference/xopus-api.html" rel="nofollow noreferrer">DOM API</a> to configure it so that only the text can be changed, not the structure.</p> <p>Direct <a href="http://xopus.com/files/demo/xopus/xopus.html#/files/demo/examples/Recipe/start.html" rel="nofollow noreferrer">link</a> to a demo.</p>
<p>Check out microsoft for an <a href="http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628&amp;displaylang=en" rel="nofollow noreferrer">XML Notepad 2007</a>. I'm not to fond of it, since it really treats xml as a tree as opposed to plain text, but that is what you want, right?</p>
9,179
<p>I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference.</p>
<p>They are actually two very different things. "Delegate" is actually the name for a variable that holds a reference to a method or a lambda, and a lambda is a method without a permanent name.</p> <p>Lambdas are very much like other methods, except for a couple subtle differences.</p> <ol> <li>A normal method is defined in a <a href="http://en.wikipedia.org/wiki/Statement_(programming)" rel="noreferrer">"statement"</a> and tied to a permanent name, whereas a lambda is defined "on the fly" in an <a href="http://en.wikipedia.org/wiki/Expression_(programming)" rel="noreferrer">"expression"</a> and has no permanent name.</li> <li>Some lambdas can be used with .NET expression trees, whereas methods cannot.</li> </ol> <p>A delegate is defined like this:</p> <pre><code>delegate Int32 BinaryIntOp(Int32 x, Int32 y); </code></pre> <p>A variable of type BinaryIntOp can have either a method or a labmda assigned to it, as long as the signature is the same: two Int32 arguments, and an Int32 return.</p> <p>A lambda might be defined like this:</p> <pre><code>BinaryIntOp sumOfSquares = (a, b) =&gt; a*a + b*b; </code></pre> <p>Another thing to note is that although the generic Func and Action types are often considered "lambda types", they are just like any other delegates. The nice thing about them is that they essentially define a name for any type of delegate you might need (up to 4 parameters, though you can certainly add more of your own). So if you are using a wide variety of delegate types, but none more than once, you can avoid cluttering your code with delegate declarations by using Func and Action.</p> <p>Here is an illustration of how Func and Action are "not just for lambdas":</p> <pre><code>Int32 DiffOfSquares(Int32 x, Int32 y) { return x*x - y*y; } Func&lt;Int32, Int32, Int32&gt; funcPtr = DiffOfSquares; </code></pre> <p>Another useful thing to know is that delegate types (not methods themselves) with the same signature but different names will not be implicitly casted to each other. This includes the Func and Action delegates. However if the signature is identical, you can explicitly cast between them.</p> <p>Going the extra mile.... In C# functions are flexible, with the use of lambdas and delegates. But C# does not have "first-class functions". You can use a function's name assigned to a delegate variable to essentially create an object representing that function. But it's really a compiler trick. If you start a statement by writing the function name followed by a dot (i.e. try to do member access on the function itself) you'll find there are no members there to reference. Not even the ones from Object. This prevents the programmer from doing useful (and potentially dangerous of course) things such as adding extension methods that can be called on any function. The best you can do is extend the Delegate class itself, which is surely also useful, but not quite as much.</p> <p>Update: Also see <a href="https://stackoverflow.com/questions/73227/what-is-the-difference-between-lambdas-and-delegates-in-the-net-framework#73448">Karg's answer</a> illustrating the difference between anonymous delegates vs. methods &amp; lambdas.</p> <p>Update 2: <a href="https://stackoverflow.com/questions/73227/what-is-the-difference-between-lambdas-and-delegates-in-the-net-framework#74414">James Hart</a> makes an important, though very technical, note that lambdas and delegates are not .NET entities (i.e. the CLR has no concept of a delegate or lambda), but rather they are framework and language constructs.</p>
<p>Well, the really oversimplified version is that a lambda is just shorthand for an anonymous function. A delegate can do a lot more than just anonymous functions: things like events, asynchronous calls, and multiple method chains.</p>
9,891
<p>When trying to connect to an <code>ORACLE</code> user via TOAD (Quest Software) or any other means (<code>Oracle Enterprise Manager</code>) I get this error:</p> <blockquote> <p><code>ORA-011033: ORACLE initialization or shutdown in progress</code></p> </blockquote>
<p>After some googling, I found the advice to do the following, and it worked:</p> <pre><code>SQL&gt; startup mount ORACLE Instance started SQL&gt; recover database Media recovery complete SQL&gt; alter database open; Database altered </code></pre>
<p>I faced the same problem. I restarted the oracle service for that DB instance and the error is gone.</p>
7,722
<p>If starting a new project what would you use for your ORM NHibernate or LINQ and why. What are the pros and cons of each.</p> <p>edit: LINQ to SQL not just LINQ (thanks @Jon Limjap)</p>
<p>I have asked myself a very similar question except that instead of NHibernate I was thinking about WilsonORM which I have consider pretty nice.</p> <p>It seems to me that there are many important differences.</p> <p>LINQ:</p> <ul> <li>is not a complete ORM tool (you can get there with some additional libraries like the latest Entity framework - I personally consider the architecture of this latest technology from MS to be about 10 years old when compared with other ORM frameworks)</li> <li>is primarily querying "language" supporting intellisense (compiler will check the syntax of your query)</li> <li>is primarily used with Microsoft SQL Server</li> <li>is closed source</li> </ul> <p>NHibernate:</p> <ul> <li>is ORM tool </li> <li>has pretty limited querying language without intellisense</li> <li>can be used with almost any DBMS for which you have a DB provider</li> <li>is open source</li> </ul> <p>It really depends. If you develop a Rich (Windows) desktop application where you need to construct objects, work with them and at the end persist their changes, then I would recommend ORM framework like NHibernate.</p> <p>If you develop a Web application that usually just query data and only occasionally writes some data back to the DB then I would recommend good querying language like Linq.</p> <p>So as always, it depends. :-)</p>
<p>I don't use (or even know) NHibernate, I just want to give my testimony: I use LINQ to SQL since about 2 years with MySQL and PostgreSQL databases (using <a href="http://code.google.com/p/dblinq2007/" rel="nofollow">DbLinq</a> on Windows, using <a href="http://www.mono-project.com/" rel="nofollow">Mono</a> on Linux and Mac OS X).</p> <p>So LINQ to SQL is NOT limited to Microsoft products.</p> <p>I can confirm that LINQ to SQL is very well suited for small and medium projects, or large projects where you have the absolute control of the database structure. As the reviews indicate, LINQ to SQL has some limitations that make it an inappropriate tool when there is no direct mapping between the database tables and the entity classes.</p> <p>Note : LINQ to SQL doesn't support many-to-many relationships (but this can be easily achieved with a few code lines).</p>
7,685
<p>What is the best way to keep a PHP script running as a daemon, and what's the best way to check if needs restarting.</p> <p>I have some scripts that need to run 24/7 and for the most part I can run them using <a href="http://en.wikipedia.org/wiki/Nohup" rel="noreferrer">nohup</a>. But if they go down, what's the best way to monitor it so it can be automatically restarted?</p>
<p>If you can't use the (proper) init structure to do this (you're on shared hosting, etc.), use cron to run a script (it can be written in whatever language you like) every few minutes that checks to see if they're running, and restarts them if necessary.</p>
<p>TBH, PHP probably isn't the best tool for this, really not what it was designed for. I've heard of memory leaks and other bad things happening when you try this. Also bear in mind PHP only has a finite amount of resource ids (for file handles, db connections ect) per execution of a script.</p> <p>Be better of using something else, maybe python or perl, though I don't have any real experience writing these sorts of apps, but I do know PHP isn't right for what your trying to do.</p>
5,948
<p>If I run the following query in SQL Server 2000 Query Analyzer:</p> <pre><code>BULK INSERT OurTable FROM 'c:\OurTable.txt' WITH (CODEPAGE = 'RAW', DATAFILETYPE = 'char', FIELDTERMINATOR = '\t', ROWS_PER_BATCH = 10000, TABLOCK) </code></pre> <p>On a text file that conforms to OurTable's schema for 40 lines, but then changes format for the last 20 lines (lets say the last 20 lines have fewer fields), I receive an error. However, the first 40 lines are committed to the table. Is there something about the way I'm calling Bulk Insert that makes it not be transactional, or do I need to do something explicit to force it to rollback on failure?</p>
<p><code>BULK INSERT</code> acts as a series of individual <code>INSERT</code> statements and thus, if the job fails, it doesn't roll back all of the committed inserts.</p> <p>It can, however, be placed within a transaction so you could do something like this:</p> <pre><code>BEGIN TRANSACTION BEGIN TRY BULK INSERT OurTable FROM 'c:\OurTable.txt' WITH (CODEPAGE = 'RAW', DATAFILETYPE = 'char', FIELDTERMINATOR = '\t', ROWS_PER_BATCH = 10000, TABLOCK) COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH </code></pre>
<p>Try to put it inside user-defined transaction and see what happens. Actually it should roll-back as you described it.</p>
6,327
<p>I just noticed the other day that my Ender 3 is printing stuff a lot slower than it can, and realized when I was slicing a part that it's because the default &quot;Wall Print Speed&quot; is half the &quot;Print Speed&quot; even though &quot;Infill Speed&quot; is full speed. I can enter higher speeds, of course, but then Cura puts up a little notification that &quot;this value is normally calculated, but it has been entered instead&quot; and offers to put it back to the calculated default -- which is half the &quot;Print Speed.&quot;</p> <p>I presume there are good reasons (print quality, underextrusion, etc.) for this -- what are they?</p> <p>I guess it's relevant to note that I have a 4.2.2 mainboard and currently run Creality's version of 2.0.4-1.0.1 Marlin, the newest they offer for this board version without BLTouch.</p>
<p>Cura has a lot of bad defaults, but also a lot of defaults that are chosen to let you get acceptable prints out of a really bad printer, a miscalibrated printer, or a printer with bad firmware.</p> <p>Printing at anything above very low speeds requires compensation for the differing pressure needed to move material through the nozzle at different flows. The printer firmware feature to do this compensation is known as &quot;pressure advance&quot; or &quot;linear advance&quot;, and is absent in stock firmware on most commercially produced printers, especially older ones. Without it, you'll get bulging corners and underextruded middles of your walls. This matters most on the <em>outer wall</em>, which determines the dimensional accuracy and visual quality of your print; errors on the inner walls or infill will mostly be hidden and tend to even out, especially if the inner walls are printed after the outer ones so that the extrusion is constrained against the already-existing outer wall (but here's where Cura's wrong defaults come in: it defaults to printing outer wall last, which replicates the inner wall errors onto the outer wall!).</p> <p>On a printer without pressure advance compensation, you can use either very low speeds (30 mm/s or preferably even lower) to get a decent outer wall, or you can use high acceleration and cornering velocity (but: most stock firmware doesn't handler cornering velocity correctly either) so that the corners aren't printed significantly slower than the rest of the wall, but at high acceleration/fast cornering you'll get ringing (ghosting) artifacts. These can also be eliminated with better tuning of your printer/firmware, but the point of Cura's defaults is giving decent output on a printer where that work hasn't been done.</p> <p>If your printer has a version of Marlin (at least 2.0) with linear advance and junction deviation, or if you upgrade to that, or if you switch to Klipper, and then you tune these to match your printer, there's no reason to keep the outer wall speed low. With Klipper you can take the acceleration way up too (using input shaper to eliminate the ringing). This can give you prints many times faster than Cura's defaults. Even if you don't, you can still turn the speed and acceleration way up, but you'll get ugly and possibly structurally weak prints as a result.</p>
<p>Perimeters, especially External Perimeters, are particularly sensitive to small deflections of the printhead, as well as extrusion issues from too fast of a print speed. You may be able to increase this speed for regular perimeters, however, higher speeds may introduce more ghosting issues.</p>
1,981
<p>What is the best way to iterate through a strongly-typed generic List in C#.NET and VB.NET?</p>
<p>For C#:</p> <pre><code>foreach(ObjectType objectItem in objectTypeList) { // ...do some stuff } </code></pre> <p>Answer for VB.NET from <strong>Purple Ant</strong>:</p> <pre><code>For Each objectItem as ObjectType in objectTypeList 'Do some stuff ' Next </code></pre>
<p>I may be missing something, but iterating through a generic list should be fairly simple if you use my examples below. The List&lt;> class implements the IList and IEnumerable interfaces so that you can easily iterate through them basically any way you want.</p> <p>The most efficient way would be to use a for loop: </p> <pre><code>for(int i = 0; i &lt; genericList.Count; ++i) { // Loop body } </code></pre> <p>You may also choose to use a foreach loop:</p> <pre><code>foreach(&lt;insertTypeHere&gt; o in genericList) { // Loop body } </code></pre>
3,600
<p>For the Anycubic Kossel Linear Plus I have to upload data to the 3D printer from a software called Arduino and then close it. Then I open Pronterface and put in the right port and baud rate that is in the Arduino files and then click "connect". Afterwards it says </p> <pre><code>connecting... </code></pre> <p>and that is all it does and doesn't fully connect to the printer. I've tried changing the baud rate and port in Pronterface, Arduino and the bit rate in the Device Manager but nothing works. </p> <p>Any suggestions on how to fix this?</p>
<p>I know this is coming very late, but I'll post anyway in hopes that it may help somebody else experiencing the same frustration.</p> <p>I received all of the same suggestions again and again on the forums -- about baud rate, COM ports, and a lot else which failed to get Pronterface to connect.</p> <p>At last I posted to the Anycubic User Group on FB, and quickly received what was in my case the solution -- and so ridiculously simple.</p> <p>I was told to hit RESET two or three times on Pronterface after hitting CONNECT. Yup, that did it! </p> <p>Good luck!! :D</p>
<p>I know this may be a little late, but I bought the same printer and found that I had problems also. To fix this connection issue I first made sure I had no arduino programs open that were trying the connect to the printer. These would not allow Pronterface to connect to my printer. Then if I still had issues I opened up task manager on my computer just to make sure I had no other programs trying to communicate with the printer. Then if it still can't connect I closed Pronterface and reloaded it a couple of times.</p>
586
<p>Char's are great because they are fixed size and thus make for a faster table. They are however limited to 255 characters. I want to hold 500 characters but a blob is variable length and that's not what I want.</p> <p>Is there some way to have a fixed length field of 500 characters in MySQL or am I going to have to use 2 char fields?</p>
<p>I would suggest using a varchar(500). Even though varchar isn't a fixed length, the database should reserve the correct amount of space. You shouldn't notice any performance difference using varchar(500) over 2xchar(255).</p> <p>You're also probably going to cause extra overhead by joining two char fields together.</p>
<p>You're worrying too much about internal implementation details. Don't pre-optimize. </p> <p>Go with <code>VARCHAR(500)</code></p>
2,705
<p>You can use more than one css class in an HTML tag in current web browsers, e.g.:</p> <pre><code>&lt;div class="style1 style2 style3"&gt;foo bar&lt;/div&gt; </code></pre> <p>This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature?</p>
<p>@Wayne Kao - IE6 has no problem reading more than one class name on an element, and applying styles that belong to each class. What the article is referring to is creating new styles based on the combination of class names.</p> <pre><code>&lt;div class="bold italic"&gt;content&lt;/div&gt; .bold { font-weight: 800; } .italic { font-style: italic; { </code></pre> <p>IE6 would apply both bold and italic styles to the div. However, say we wanted all elements that have bold and italic classes to also be purple. In Firefox (or possibly IE7, not sure), we could write something like this:</p> <pre><code>.bold.italic { color: purple; } </code></pre> <p>That would not work in IE6. </p>
<p>Apparently IE 6 doesn't handle these correctly if you have CSS selectors that contain multiple class names: <a href="http://www.ryanbrill.com/archives/multiple-classes-in-ie/" rel="nofollow noreferrer">http://www.ryanbrill.com/archives/multiple-classes-in-ie/</a></p>
8,614
<p>What's the best way to handle a user going back to a page that had cached items in an asp.net app? Is there a good way to capture the back button (event?) and handle the cache that way?</p>
<p>You can try using the <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.cache.aspx" rel="noreferrer">HttpResponse.Cache property</a> if that would help:</p> <pre><code>Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(false); Response.Cache.VaryByParams["Category"] = true; if (Response.Cache.VaryByParams["Category"]) { //... } </code></pre> <p>Or could could block caching of the page altogether with <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.cachecontrol.aspx" rel="noreferrer">HttpResponse.CacheControl</a>, but its been deprecated in favor of the Cache property above:</p> <pre><code>Response.CacheControl = "No-Cache"; </code></pre> <p>Edit: OR you could really <a href="http://forums.asp.net/t/1013531.aspx" rel="noreferrer">go nuts</a> and do it all by hand:</p> <pre><code>Response.ClearHeaders(); Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1 Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1 Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1 Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.1 Response.AppendHeader("Keep-Alive", "timeout=3, max=993"); // HTTP 1.1 Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // HTTP 1.1 </code></pre>
<p>The best way to deal with it is to probably put a no-cache directive in your ASP.NET pages (or a master page if you're using one). I don't think there's a way to deal with this directly in your ASP.NET code (since the cache decision is happening on the client).</p> <p>As for MVC, don't know how you would accomplish that (assuming it's different from Web Forms-based ASP.NET); I haven't used it.</p>
4,309
<p>I want to access messages in Gmail from a Java application using <a href="http://www.ing.iac.es/~docs/external/java/javamail/javadocs/index.html" rel="nofollow noreferrer">JavaMail</a> and <a href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol" rel="nofollow noreferrer">IMAP</a>. Why am I getting a <em><a href="https://docs.oracle.com/javase/7/docs/api/java/net/SocketTimeoutException.html" rel="nofollow noreferrer">SocketTimeoutException</a></em> ?</p> <p>Here is my code:</p> <pre><code>Properties props = System.getProperties(); props.setProperty("mail.imap.host", "imap.gmail.com"); props.setProperty("mail.imap.port", "993"); props.setProperty("mail.imap.connectiontimeout", "5000"); props.setProperty("mail.imap.timeout", "5000"); try { Session session = Session.getDefaultInstance(props, new MyAuthenticator()); URLName urlName = new URLName("imap://MYUSERNAME@gmail.com:MYPASSWORD@imap.gmail.com"); Store store = session.getStore(urlName); if (!store.isConnected()) { store.connect(); } } catch (NoSuchProviderException e) { e.printStackTrace(); System.exit(1); } catch (MessagingException e) { e.printStackTrace(); System.exit(2); } </code></pre> <p>I have set the timeout values so that it wouldn't take "forever" to timeout. Also, <em>MyAuthenticator</em> also has the username and password, which seems redundant with the URL. Is there another way to specify the protocol? (I didn't see it in the JavaDoc for <a href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol" rel="nofollow noreferrer">IMAP</a>.)</p>
<p>Using imaps was a great suggestion. Neither of the answers provided just worked for me, so I googled some more and found something that worked. Here's how my code looks now.</p> <pre><code>Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.gmail.com", "&lt;username&gt;@gmail.com", "&lt;password&gt;"); ... } catch (NoSuchProviderException e) { e.printStackTrace(); System.exit(1); } catch (MessagingException e) { e.printStackTrace(); System.exit(2); } </code></pre> <p>This is nice because it takes the redundant Authenticator out of the picture. I'm glad this worked because the SSLNOTES.txt make my head spin.</p>
<pre><code>URLName server = new URLName("imaps://&lt;gmail-user-name&gt;:&lt;gmail-pass&gt;@imap.gmail.com/INBOX"); </code></pre>
8,630
<p>The IT lady just gave me a laptop to keep! </p> <p>I've always wanted to have Linux install to play with so the first thing I did is search stackoverflow for Linux Distro suggestions and found it <a href="https://stackoverflow.com/questions/659/what-is-your-preferred-linux-distribution#6730">here</a>. However they also mention that you should search around to see if anyone's had any problems with your drivers and that distro. Now all I know is that this is a Toshiba Tecra A5 - I havent' even booted it up yet but when I do how should I go about researching whether the drivers are compatible with Ubuntu or whatever I choose to use? Should I just be googling Ubunto+DriverName or are there better resources?</p>
<p>Many distros, Ubuntu included, have a "live" mode. You download the .iso image, burn the CD, and then boot from the CD. The OS will run directly off the CD without installing anything. It will run slowly, because it's reading from the CD, but it should give you the opportunity to test your hardware.</p>
<p>I would look in (at least) these two places:</p> <p><a href="http://www.linuxcompatible.org/compatibility.html" rel="nofollow noreferrer">http://www.linuxcompatible.org/compatibility.html</a></p> <p><a href="http://www.linux-drivers.org/" rel="nofollow noreferrer">http://www.linux-drivers.org/</a></p>
8,424
<p>I have a Tronxy X5S and I am having issues calibrating my X and Y axis. When I print a 20 mm<sup>3</sup> cube it comes out 19.9 mm x 20.4 mm x 20 mm. I have already made the belt tensions as even as I can get them but it did not change the calibration cube size.</p> <p>I have added <a href="https://www.thingiverse.com/thing:2815168" rel="nofollow noreferrer">this</a> upgrade to my printer for the idlers and motor mounts:</p> <p><a href="https://i.stack.imgur.com/QG60X.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QG60X.jpg" alt="idlers and motor mounts"></a></p> <p>I have also upgraded the hotend to a V6 clone, after this change is when I noticed the discrepancy in the calibration print.</p> <p><strong>What else can cause the X and Y axis to be uneven in a CoreXY printer besides uneven tension in the belts?</strong></p> <p>UPDATE:</p> <p>Its seems Oscar was correct in his <a href="https://3dprinting.stackexchange.com/questions/7002/corexy-calibration-issue#7003">assessment</a> that my printer is not printing square. I printed <a href="https://www.thingiverse.com/thing:2563185" rel="nofollow noreferrer">this</a> calibration square to measure the diagonals and I got: <span class="math-container">$ \overline{AC} = 141.82 $</span>, <span class="math-container">$ \overline{BD} = 141.35 $</span>. I believe the correct value for these diagonals should be <span class="math-container">$ \sqrt{2} \times 100 \approx 141.42 $</span>. </p> <p><a href="https://cdn.thingiverse.com/renders/16/e6/d8/c1/f0/9bb6e035af9cc431b0bb4fa60281c967_preview_featured.jpg" rel="nofollow noreferrer"><img src="https://cdn.thingiverse.com/renders/16/e6/d8/c1/f0/9bb6e035af9cc431b0bb4fa60281c967_preview_featured.jpg" alt="calibration square"></a></p> <p>Oscar also mentioned that I can adjust my firmware to correct this but I would rather fix the problem than apply a band-aid. Does this indicate that I did not assemble the printer frame correctly?</p>
<p>Indeed, <strong>even belt tension is important</strong>, what helped me enormously to set the same tension in the belts on my self build CoreXY is a tool like <a href="https://www.thingiverse.com/thing:2589577" rel="nofollow noreferrer">this</a>:</p> <p><a href="https://i.stack.imgur.com/vmQKB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vmQKB.jpg" alt="Belt tension measurement tool"></a></p> <p>Furthermore, be sure that you <strong>do not have any binding on the Y carriages</strong> over the whole range. This causes inaccurate printing, e.g. outer walls not adhering to the inner walls (as I encountered myself in the beginning when tuning the printer), and thus inaccurate dimensions.</p> <p>Also make sure that the <strong>print is not skew</strong>, i.e. are you sure that the printer prints squares? This can be easily checked by printing a large square and measure the diagonals; I used <a href="https://www.thingiverse.com/thing:2280529" rel="nofollow noreferrer">this</a> as it will also help you find the center of the bed and the level of the bed all at once:</p> <p><a href="https://i.stack.imgur.com/rcl8Bm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rcl8Bm.jpg" alt="Calibration square"></a></p> <p>but many calibration prints can be found on the internet, e.g. <a href="https://www.thingiverse.com/thing:2563185" rel="nofollow noreferrer">this one</a> but this requires way more filament to print). Schematically this results in something like depicted below:</p> <p><a href="https://i.stack.imgur.com/c3CRQm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c3CRQm.jpg" alt="Schematic overview of a skew print"></a></p> <p>If it is not square, you can adjust this by using a different firmware like e.g. Marlin Firmware which has options for skewness compensation that can be addressed in the <a href="http://marlinfw.org/" rel="nofollow noreferrer">Marlin</a> <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration.h" rel="nofollow noreferrer">Configuration.h</a> file. A "cube" that is printed by stacking parallelograms also shows different dimensions is X and Y (one being smaller, the other being larger).</p> <p><strong><em>Edit</em></strong><br> You mention that you changed the hotend; it is recommended to <a href="https://3dprinting.stackexchange.com/a/6484/5740">calibrate the extruder</a> after changing. Note that a few tenths of a mm are very common, usually X and Y should be in the range of 20.1 mm &plusmn; 0.1 mm for such a calibration cube.</p>
<p>Indeed, <strong>even belt tension is important</strong>, what helped me enormously to set the same tension in the belts on my self build CoreXY is a tool like <a href="https://www.thingiverse.com/thing:2589577" rel="nofollow noreferrer">this</a>:</p> <p><a href="https://i.stack.imgur.com/vmQKB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vmQKB.jpg" alt="Belt tension measurement tool"></a></p> <p>Furthermore, be sure that you <strong>do not have any binding on the Y carriages</strong> over the whole range. This causes inaccurate printing, e.g. outer walls not adhering to the inner walls (as I encountered myself in the beginning when tuning the printer), and thus inaccurate dimensions.</p> <p>Also make sure that the <strong>print is not skew</strong>, i.e. are you sure that the printer prints squares? This can be easily checked by printing a large square and measure the diagonals; I used <a href="https://www.thingiverse.com/thing:2280529" rel="nofollow noreferrer">this</a> as it will also help you find the center of the bed and the level of the bed all at once:</p> <p><a href="https://i.stack.imgur.com/rcl8Bm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rcl8Bm.jpg" alt="Calibration square"></a></p> <p>but many calibration prints can be found on the internet, e.g. <a href="https://www.thingiverse.com/thing:2563185" rel="nofollow noreferrer">this one</a> but this requires way more filament to print). Schematically this results in something like depicted below:</p> <p><a href="https://i.stack.imgur.com/c3CRQm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c3CRQm.jpg" alt="Schematic overview of a skew print"></a></p> <p>If it is not square, you can adjust this by using a different firmware like e.g. Marlin Firmware which has options for skewness compensation that can be addressed in the <a href="http://marlinfw.org/" rel="nofollow noreferrer">Marlin</a> <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration.h" rel="nofollow noreferrer">Configuration.h</a> file. A "cube" that is printed by stacking parallelograms also shows different dimensions is X and Y (one being smaller, the other being larger).</p> <p><strong><em>Edit</em></strong><br> You mention that you changed the hotend; it is recommended to <a href="https://3dprinting.stackexchange.com/a/6484/5740">calibrate the extruder</a> after changing. Note that a few tenths of a mm are very common, usually X and Y should be in the range of 20.1 mm &plusmn; 0.1 mm for such a calibration cube.</p>
1,048
<p>I am forced to use VSS at work, but use SVN for a personal repository. What is the best way to sync between VSS and sync?</p>
<p>To get rid of the manual merge step, I could use a separate svn branch (svn://branches/VSS) as follows:</p> <ol> <li>Create a working copy of svn://branches/VSS</li> <li>Do a VSS Get Latest on this working copy</li> <li>svn commit</li> <li>svn merge from svn://trunk</li> <li>svn commit</li> <li>Do a VSS diff and checkout all files (without overwriting) with differences</li> <li>Check in those files</li> <li>reintegrate svn://branches/VSS into svn://trunk</li> </ol>
<p>What I have done in the past is as follows:</p> <ol> <li>Make sure all my changes are committed to svn://trunk</li> <li>Do a get latest from VSS into my working copy.</li> <li>Manually merge the changes in my working copy.</li> <li>Commit the merged code into the svn://trunk</li> <li>Do a VSS diff and checkout any files with differences (without overwriting files)</li> <li>Check in those files.</li> </ol>
8,156
<p>Here's my scenario - I have an SSIS job that depends on another prior SSIS job to run. I need to be able to check the first job's status before I kick off the second one. It's not feasible to add the 2nd job into the workflow of the first one, as it is already way too complex. I want to be able to check the first job's status (Failed, Successful, Currently Executing) from the second one's, and use this as a condition to decide whether the second one should run, or wait for a retry. I know this can be done by querying the MSDB database on the SQL Server running the job. I'm wondering of there is an easier way, such as possibly using the WMI Data Reader Task? Anyone had this experience?</p>
<p>You may want to create a third package the runs packageA and then packageB. The third package would only contain two execute package tasks.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms137609.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms137609.aspx</a></p> <p>@Craig A status table is an option but you will have to keep monitoring it.</p> <p>Here is an article about events in SSIS for you original question.<br> <a href="http://www.databasejournal.com/features/mssql/article.php/3558006" rel="nofollow noreferrer">http://www.databasejournal.com/features/mssql/article.php/3558006</a></p>
<p>Why not use a table? Just have the first job update the table with it's status. The second job can use the table to check the status. That should do the trick if I am reading the question correctly. The table would (should) only have one row so it won't kill performance and shouldn't cause any deadlocking (of course, now that I write it, it will happen) :)</p> <p>@Jason: Yeah, you could monitor it or you could have a trigger start the second job when the end status is recieved. :)</p>
6,095
<p>I'm writing an interpreter for an experimental language. Three of the main constructs of the language are definitions, statements, and expressions. Definitions can contain statements and expressions, statements can contain definitions and expressions, and one kind of expression can contain statements. I represent all of these using union types so I can easily use pattern matching on them. Ideally, I would like to put the code for these in different files, but OMake complains about circular dependency issues. As far as I know, circular type definitions across modules are not allowed.</p> <p>The only way I know of to solve this is to define all three types at once:</p> <pre><code>type defn = ... and stmt = ... and expr = ... </code></pre> <p>It seems like this requires all the code for types to be in the same file. Is there any way around this? How do you deal with circular definitions in your code?</p>
<p>Recursive definitions need to appear in the same file. If you want to separate definitions, statements, and expressions into separate modules, you can do so using <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc100" rel="noreferrer">recursive modules</a>, but they will still need to appear in the same file. DAG-ifying inter-file dependencies is one of the annoyances of OCaml.</p>
<p>Another solution often used is to abstract the types in the interfaces. Since the types are abstract in the interfaces, these interfaces are not recursively dependent. In the implementations, you can specify the types, and since the implementations depend only on the interfaces, they are not recursive either.</p> <p>The only problem is that, with this solution, you cannot anymore pattern-matching on these types outside of their implementation.</p> <p>Personally, but it is probably a matter of taste, I like to have all the types of my program defined in one module (I think it helps in the readability of the program). So, this restriction of OCaml is not really a problem for me.</p>
5,691
<p>When viewing someone else's webpage containing an applet, how can I force Internet Explorer 6.0 to use a a particular JRE when I have several installed?</p>
<p>First, disable the currently installed version of Java. To do this, go to <strong>Control Panel > Java > Advanced > Default Java for Browsers</strong> and uncheck <strong>Microsoft Internet Explorer</strong>.</p> <p>Next, enable the version of Java you want to use instead. To do this, go to (for example) <strong>C:\Program Files\Java\<i>jre1.5.0_15</i>\bin</strong> (where <strong>jre1.5.0_15</strong> is the version of Java you want to use), and run <strong>javacpl.exe</strong>. Go to <strong>Advanced > Default Java for Browsers</strong> and check <strong>Microsoft Internet Explorer</strong>.</p> <p>To get your old version of Java back you need to reverse these steps.</p> <p>Note that in older versions of Java, <strong>Default Java for Browsers</strong> is called <strong>&lt;APPLET&gt; Tag Support</strong> (but the effect is the same).</p> <p>The good thing about this method is that it doesn't affect other browsers, and doesn't affect the default system JRE.</p>
<p>If you mean when you are not the person writing the web page, then you could disable the add ons you do not wish to use with the <a href="http://windowsxp.mvps.org/addons.htm" rel="nofollow noreferrer">Manage Add-Ons</a> IE Options screen added in Win XP SP2</p>
9,673
<p>Is there a way to send a file using POST from a Python script?</p>
<p>From: <a href="https://requests.readthedocs.io/en/latest/user/quickstart/#post-a-multipart-encoded-file" rel="noreferrer">https://requests.readthedocs.io/en/latest/user/quickstart/#post-a-multipart-encoded-file</a></p> <p>Requests makes it very simple to upload Multipart-encoded files:</p> <pre><code>with open('report.xls', 'rb') as f: r = requests.post('http://httpbin.org/post', files={'report.xls': f}) </code></pre> <p>That's it. I'm not joking - this is one line of code. The file was sent. Let's check:</p> <pre><code>&gt;&gt;&gt; r.text { "origin": "179.13.100.4", "files": { "report.xls": "&lt;censored...binary...data&gt;" }, "form": {}, "url": "http://httpbin.org/post", "args": {}, "headers": { "Content-Length": "3196", "Accept-Encoding": "identity, deflate, compress, gzip", "Accept": "*/*", "User-Agent": "python-requests/0.8.0", "Host": "httpbin.org:80", "Content-Type": "multipart/form-data; boundary=127.0.0.1.502.21746.1321131593.786.1" }, "data": "" } </code></pre>
<p>You may also want to have a look at <a href="http://code.google.com/p/httplib2/" rel="nofollow noreferrer">httplib2</a>, with <a href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#examples" rel="nofollow noreferrer">examples</a>. I find using httplib2 is more concise than using the built-in HTTP modules.</p>
9,396
<p>Has anyone worked out how to get PowerShell to use <code>app.config</code> files? I have a couple of .NET DLL's I'd like to use in one of my scripts but they expect their own config sections to be present in <code>app.config</code>/<code>web.config</code>.</p>
<p>Cross-referencing with this thread, which helped me with the same question: <a href="https://stackoverflow.com/questions/2789920/subsonic-access-to-app-config-connection-strings-from-referenced-dll-in-powershel">Subsonic Access To App.Config Connection Strings From Referenced DLL in Powershell Script</a></p> <p>I added the following to my script, before invoking the DLL that needs config settings, where $configpath is the location of the file I want to load:</p> <pre><code>[appdomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $configpath) Add-Type -AssemblyName System.Configuration </code></pre> <p>See <a href="https://stackoverflow.com/questions/6150644/change-default-app-config-at-runtime/6151688#6151688">this</a> post to ensure the configuration file specified is applied to the running context. </p>
<p><em>Attempting a new answer to an old question.</em></p> <p>I think the modern answer would be: don't do that. PowerShell is a shell. The normal way of passing information between parts of the shell are shell variables. For powershell that would look like:</p> <pre><code>$global:MyComponent_MySetting = '12' # i.e. $PSDefaultParameterValues $ErrorActionPreference </code></pre> <p>If settings is expected to be inherited across processes boundaries the convention is to use environment variables. I extend this to settings that cross C# / PowerShell boundary. A couple of examples:</p> <pre><code>$env:PATH $env:PSModulePath </code></pre> <p>If you think this is an anti-pattern for .NET you might want to reconsider. This is the norm for PAAS hosted apps, and is going to be the new default for ASP.NET running on server-optimized CLR (ASP.NET v5). </p> <p>See <a href="https://github.com/JabbR/JabbRv2/blob/dev/src/JabbR/Startup.cs#L21" rel="nofollow">https://github.com/JabbR/JabbRv2/blob/dev/src/JabbR/Startup.cs#L21</a> <br> Note: at time of writing I'm linking to <code>.AddEnvironmentVariables()</code></p> <p>I've revisited this question a few times, including asking it myself. I wanted to put a stake in the ground to say PowerShell stuff doesn't work well with <code>&lt;appSettings&gt;</code>. IMO it is much better to embrace the shell aspect of PS over the .NET aspect in this regards. </p> <p>If you need complex configuration take a JSON string. POSH v3+ has <a href="https://technet.microsoft.com/en-us/library/hh849898.aspx" rel="nofollow">ConvertFrom-JSON</a> built-in. If everything in your process uses the same complex configuration put it in a .json file and point to that file from an environment variable. </p> <p>If a single file doesn't suffice there are well established solutions like the <code>PATH</code> pattern, <strong>GIT .gitignore</strong> resolution, or <strong>ASP.NET web.config</strong> resolution (which I won't repeat here).</p>
3,858
<p>I can make Firefox not display the ugly dotted focus outlines on <b>links</b> with this:</p> <pre class="lang-css prettyprint-override"><code>a:focus { outline: none; } </code></pre> <p>But how can I do this for <code>&lt;button&gt;</code> tags as well? When I do this:</p> <pre class="lang-css prettyprint-override"><code>button:focus { outline: none; } </code></pre> <p>the buttons still have the dotted focus outline when I click on them.</p> <p>(and yes, I know this is a usability issue, but I would like to provide my own focus hints which are appropriate to the design instead of ugly grey dots)</p>
<pre class="lang-css prettyprint-override"><code>button::-moz-focus-inner { border: 0; } </code></pre>
<p>You can try <code>button::-moz-focus-inner {border: 0px solid transparent;}</code> in your CSS.</p>
9,651
<p>I was looking for a tree or graph data structure in C#, but I guess there isn't one provided. <a href="http://msdn.microsoft.com/en-us/library/ms379574.aspx" rel="noreferrer">An Extensive Examination of Data Structures Using C# 2.0</a> a bit about why. Is there a convenient library which is commonly used to provide this functionality? Perhaps through a <a href="https://en.wikipedia.org/wiki/Strategy_pattern" rel="noreferrer">strategy pattern</a> to solve the issues presented in the article.</p> <p>I feel a bit silly implementing my own tree, just as I would implementing my own ArrayList.</p> <p>I just want a generic tree which can be unbalanced. Think of a directory tree. <a href="https://itu.dk/research/c5/" rel="noreferrer">C5</a> looks nifty, but their tree structures seem to be implemented as balanced red-black trees better suited to search than representing a hierarchy of nodes.</p>
<p>My best advice would be that there is no standard tree data structure because there are so many ways you could implement it that it would be impossible to cover all bases with one solution. The more specific a solution, the less likely it is applicable to any given problem. I even get annoyed with LinkedList - what if I want a circular linked list?</p> <p>The basic structure you'll need to implement will be a collection of nodes, and here are some options to get you started. Let's assume that the class Node is the base class of the entire solution.</p> <p>If you need to only navigate down the tree, then a Node class needs a List of children.</p> <p>If you need to navigate up the tree, then the Node class needs a link to its parent node.</p> <p>Build an AddChild method that takes care of all the minutia of these two points and any other business logic that must be implemented (child limits, sorting the children, etc.)</p>
<p>In case you need a rooted tree data structure implementation that uses less memory, you can write your Node class as follows (C++ implementation):</p> <pre><code>class Node { Node* parent; int item; // depending on your needs Node* firstChild; //pointer to left most child of node Node* nextSibling; //pointer to the sibling to the right } </code></pre>
9,245
<p>I'm trying to build a DIY 3D printer for myself. I've been exploring many different styles of printers and found this type of printer that has a fixed bed that stays fixed in one place and the whole gantry moves which includes all axes.</p> <ul> <li>Why is this so rare?</li> <li>Are there flaws in this design?</li> <li>Will print quality be affected by using this approach?</li> </ul> <p>Check out this video for reference and skip to 10:50: <div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/XeX7QthGKpA?start=1"></iframe> </div></div></p>
<blockquote> <p>Why is this so rare?</p> </blockquote> <p>Such kind of printers usually harder to assembles, calibrate, and maintain because 3 axes machine is a bit more complex than 2 axes. For instance, it's can be tricky to move an entire extruder among all 3 axis and some of such printer's designs may require even dedicated exruder's design like Bowden Extruders.</p> <blockquote> <p>Are there flaws in this design?</p> </blockquote> <p>The key disadvantage of such kind designs is complexity with moving of an extruder among all 3 axes. Moving platform by at least one axis simplifies that.</p> <blockquote> <p>Will print quality be affected by using this approach?</p> </blockquote> <p>It depends on the exact printer's design, so, potentially you can have issues with ease of assembling and maintenance due to more complicated construction and as a consequence higher risk of low printing quality due design, assembly or configuration mistakes.</p> <p>On the other hand, if you already have some device with precise enough 3 axis machine, like CNC milling machine, you can upgrade it to 3D printer by installing an extruder, however, it would also require update of software and, probably, electronics.</p>
<blockquote> <p>Why is this so rare?</p> </blockquote> <p>This is rare because machine designers basically copy the designs that work, without trying to innovate too much. As a result of this, <a href="https://en.wikipedia.org/wiki/Adrian_Bowyer" rel="nofollow noreferrer">Adrian Bowyer</a>'s original <a href="https://reprap.org/wiki/RepRap" rel="nofollow noreferrer">RepRap</a> design (a travelling type) is currently the most prominent desktop 3D printer design around.</p> <blockquote> <p>Are there flaws in this design?</p> </blockquote> <p>There aren't any flaws in the concept for a static bed, after all, it is just a design concept; there are advantages and disadvantages for each type (static, floating and travelling).</p> <blockquote> <p>Will print quality be affected by using this approach?</p> </blockquote> <p>The individual implementations will have varying levels of success. Certain designs provide more quality than most due to the rigidity of the frame that is required (e.g. CoreXY) which in turn provides better print quality. Any printer design can produce a good print quality when the machine is well designed and well maintained.</p>
1,767
<p>I am trying to block Google Reader:</p> <p>reader.google.com </p> <p><strong>www.google.com/reader</strong></p> <p><strong>The hard part is blocking the reader directory</strong></p> <p>I blocked reader.google.com by changing my /etc/hosts file (this is for a Mac)</p> <p>Is there any way to block www.google.com/reader without buying software? Note this is for Safari so Greasemonkey won't work, and Leopard's Parental Controls throttle the CPU when they are turned on.</p> <p>Also I've tried OpenDNS, which is awesome, but doesn't work for this...</p> <p>Any thoughts?</p> <p><strong>Update:</strong> This is for a laptop that travels a lot. So a router or a home proxy server won't work. Firefox would work, but I don't think I can uninstall Safari from a mac.</p>
<p>You can use <a href="http://www.privoxy.org/" rel="nofollow noreferrer">Privoxy</a> to filter about anything.</p>
<p>What about at the router level? My router as an URL blocker built in.</p>
8,867
<p>Every time I turn on my company-owned development machine, I have to kill 10+ processes using the Task Manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a .bat file or script of some kind with which I can kill the processes in question. </p> <p>Does anybody know how to do this?</p>
<p>You can do this with '<strong>taskkill</strong>'. With the /IM parameter, you can specify image names. </p> <p>Example:</p> <pre><code>taskkill /im somecorporateprocess.exe </code></pre> <p>You can also do this to '<strong>force</strong>' kill:</p> <p>Example:</p> <pre><code>taskkill /f /im somecorporateprocess.exe </code></pre> <p>Just add one line per process you want to kill, save it as a .bat file, and add in your startup directory. Problem solved!</p> <p>If this is a legacy system, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx" rel="noreferrer">PsKill</a> will do the same.</p>
<p>Use Powershell! Built in cmdlets for managing processes. <a href="http://blogs.msdn.com/powershell/archive/2007/01/16/managing-processes-in-powershell.aspx" rel="nofollow noreferrer">Examples here</a> (hard way), <a href="http://www.computerperformance.co.uk/powershell/powershell_process.htm" rel="nofollow noreferrer">here</a>(built in) and <a href="http://www.computerperformance.co.uk/powershell/powershell_process_stop.htm" rel="nofollow noreferrer">here</a> (more).</p>
5,392
<p>My printer has an auto-leveling feature that works by touching the build plate with the tip of the nozzle.</p> <p>I started using a BuildTak surface and BuildTak is damaged when you push a hot nozzle into it.</p> <p>So I edited the start G-code to run the auto-leveling before heating up the hotend</p> <p>But ABS doesn't stick to the build surface unless I pre-heat the hotend and wait about a minute.</p> <p>So now I'm looking for a G-code command to put at the end of the start G-code that will make the printer wait a minute before printing</p> <p>The sequence I'm looking for is:</p> <ul> <li>Heat up the bed</li> <li>Auto level</li> <li>Raise the hotend a little bit so it doesn't touch the build plate</li> <li>Heat up the hotend</li> <li><em>Wait a minute (that's the only part that is missing, everything else works)</em></li> <li>Start printing</li> </ul> <p>Any way to insert a delay into the G-code?</p> <p>I'm using Cura to slice/print, my printer is Robo3D R1+</p>
<p>The G-code to delay is <code>G4</code>.</p> <p><code>G4 P60000</code> will wait for one minute. The <code>P</code> is in milliseconds. Some firmware also accept a <code>S</code> Parameter that has the seconds. So, if supported, <code>G4 S60</code> would do the same thing.</p> <p>The details for this and all other G-codes are documented <a href="http://reprap.org/wiki/G-code" rel="noreferrer">here</a>.</p>
<p>I´m using this code for my prints.</p> <pre><code> G29 ; Autonivel M190 S35 ; set bed temperature G1 Z4 F240 ; lift nozzle M109 S195 ; wait for temperature to be reached G21 ; set units to millimeters G90 ; use absolute coordinates M82 ; use absolute distances for extrusion M104 S210 ; set temperature G92 E0 G1 E-1.5000 F1800 G1 Z0.225 F240 </code></pre> <p>On M190 S35, the nozzle is still on the low position (1.2mm), then goes to 4mm then waits for the extruder temperature Ex. 195°C; when the extruder reach the 195°C for 10 seconds then the printers starts to print going the nozzle to 0.22mm while the nozzle reach the second temperature of 210°C. On This time its allow me to clean the nozzle and normalize the temperatures for a good prints.</p> <p><strong>Note:</strong> To avoid the nozzle stays many time on low position (1.2mm) normally I preheat the bed at 35°C. some times to heat the bed takes a longer time than heating the nozzle. This is the main reason that I prefer to preheat the printer.</p>
190
<p>I have a very eccentric, weird, unusual and strange idea. I need some advice and serious professional help.</p> <p>I'm interested in 3D printing in PLA a hollow complex structure with 0.2 thickness walls (Yes! That thin!). Fill it with very fine copper powder with a little borax powder thoroughly mixed. Use superglue to join halves or other shell pieces together, making sure the powder is very well compacted. Then in a separate container I want to make some thin plaster of Paris (calcium sulfate with a lot of water). Mix in it, some of my trimmed hair (about 5mm in length). No joke. Seriously. Please, I'm begging you with all my heart, hear me out! There's a very good useful reason for doing it. I then place the object (3D printed flimsy crappy shell filled with copper powder) in a DIY drywall box and pour in the plaster over the 3D printed shell object until the box is filled and object completely covered. Leave it to dry and completely solidify for a day. Then I bake the entire thing in a furnace making sure I'm over the copper melting temperature and voila! 3D printing in copper very complex intricate models with ease. Can it be that easy? Or am I deluding myself? The hair purpose, after it will burn inside the plaster while in the furnace, is to create very thin tubules or air holes for water and gases to escape and to prevent cracking of the plaster under intense heat. I don't want to use hay because the straws are too thick. I have to use very thin organic straws. I just can't think of anything more accessible than my hair. Do you know of something even thinner and more accessible than human hair? Please let me know. I know it sounds and looks very odd, weird and strange. I'm opened to alternatives or other suggestions, otherwise I wouldn't be here making a fool of myself with such an insane ridiculous idea.</p> <p>I was thinking to add some form of additional volume above the object, which is connected to the model by some thin hollow tube. All this volume (like an empty cube (shell) ) will also be filled with very fine copper powder providing additional melted copper to the model, in the case if the powder was not very well compacted inside the shell model.</p> <p>Could this absurd ridiculous insane crazy idea work? I have never heard of anything like this. This is so bizarre and strange. It seems to be some form of odd mix of multiple techniques. But besides all this, will it work in the end? Will the plaster hold while some of it(depends on the model) will be inside molten copper? Or do I have to mix in the plaster, not just hair, but also some individual singular fine strands of steel wool?</p> <p>I don't know who and where to ask such a thing. Am I in the right place? I don't know what this idea is, I don't know how to name it, I don't know how to ask or formulate this idea, I don't know how to google it or search it. I don't know anything. I really need some guidance, help and advice.</p>
<p><strong>I think this is just an overcomplicated lost-PLA (investment) casting.</strong></p> <p>What you're asking for is to create an object, create a mold around it, and then burn out the object and replace it with metal. Traditionally this is done with wax, <a href="https://en.wikipedia.org/wiki/Lost-wax_casting" rel="nofollow noreferrer">and called lost-wax casting</a>, but the same can be done with anything that melts/burns away, including PLA.</p> <p>Rather than worrying about burning hairs and pressure and compaction of metal powder, print a model, and use the correct kind of plaster (a search for &quot;investment casting plaster&quot; will get you going down the right path) to make your mold. Heat the metal powder in a crucible, instead of the mold itself, and pour it through the expansion/extra material tube you were talking about.</p>
<p>I don't see why it wouldn't work. It doesn't seem to be the optimal way but I haven't tried it.</p> <p>Only thing that might be an issue is that PLA doesn't burn away clean (not for me anyway) which can leave defects in the product. But there are filaments specifically made for casting which apparently burn away with no residue.</p> <p>This is assuming you can actually successfully print a complex object with walls that thin.</p>
2,134
<p>Why does the order in which libraries are linked sometimes cause errors in GCC?</p>
<p><sub>(See the history on this answer to get the more elaborate text, but I now think it's easier for the reader to see real command lines).</sub></p> <hr /> <p>Common files shared by all below commands</p> <pre><code>// a depends on b, b depends on d $ cat a.cpp extern int a; int main() { return a; } $ cat b.cpp extern int b; int a = b; $ cat d.cpp int b; </code></pre> <h1>Linking to static libraries</h1> <pre><code>$ g++ -c b.cpp -o b.o $ ar cr libb.a b.o $ g++ -c d.cpp -o d.o $ ar cr libd.a d.o $ g++ -L. -ld -lb a.cpp # wrong order $ g++ -L. -lb -ld a.cpp # wrong order $ g++ a.cpp -L. -ld -lb # wrong order $ g++ a.cpp -L. -lb -ld # right order </code></pre> <p>The linker searches from left to right, and notes unresolved symbols as it goes. If a library resolves the symbol, it takes the object files of that library to resolve the symbol (b.o out of libb.a in this case).</p> <p>Dependencies of static libraries against each other work the same - the library that needs symbols must be first, then the library that resolves the symbol.</p> <p>If a static library depends on another library, but the other library again depends on the former library, there is a cycle. You can resolve this by enclosing the cyclically dependent libraries by <code>-(</code> and <code>-)</code>, such as <code>-( -la -lb -)</code> (you may need to escape the parens, such as <code>-\(</code> and <code>-\)</code>). The linker then searches those enclosed lib multiple times to ensure cycling dependencies are resolved. Alternatively, you can specify the libraries multiple times, so each is before one another: <code>-la -lb -la</code>.</p> <h1>Linking to dynamic libraries</h1> <pre><code>$ export LD_LIBRARY_PATH=. # not needed if libs go to /usr/lib etc $ g++ -fpic -shared d.cpp -o libd.so $ g++ -fpic -shared b.cpp -L. -ld -o libb.so # specifies its dependency! $ g++ -L. -lb a.cpp # wrong order (works on some distributions) $ g++ -Wl,--as-needed -L. -lb a.cpp # wrong order $ g++ -Wl,--as-needed a.cpp -L. -lb # right order </code></pre> <p>It's the same here - the libraries must follow the object files of the program. The difference here compared with static libraries is that you need not care about the dependencies of the libraries against each other, because <em>dynamic libraries sort out their dependencies themselves</em>.</p> <p>Some recent distributions apparently default to using the <code>--as-needed</code> linker flag, which enforces that the program's object files come before the dynamic libraries. If that flag is passed, the linker will not link to libraries that are not actually needed by the executable (and it detects this from left to right). My recent archlinux distribution doesn't use this flag by default, so it didn't give an error for not following the correct order.</p> <p>It is not correct to omit the dependency of <code>b.so</code> against <code>d.so</code> when creating the former. You will be required to specify the library when linking <code>a</code> then, but <code>a</code> doesn't really need the integer <code>b</code> itself, so it should not be made to care about <code>b</code>'s own dependencies.</p> <p>Here is an example of the implications if you miss specifying the dependencies for <code>libb.so</code></p> <pre><code>$ export LD_LIBRARY_PATH=. # not needed if libs go to /usr/lib etc $ g++ -fpic -shared d.cpp -o libd.so $ g++ -fpic -shared b.cpp -o libb.so # wrong (but links) $ g++ -L. -lb a.cpp # wrong, as above $ g++ -Wl,--as-needed -L. -lb a.cpp # wrong, as above $ g++ a.cpp -L. -lb # wrong, missing libd.so $ g++ a.cpp -L. -ld -lb # wrong order (works on some distributions) $ g++ -Wl,--as-needed a.cpp -L. -ld -lb # wrong order (like static libs) $ g++ -Wl,--as-needed a.cpp -L. -lb -ld # &quot;right&quot; </code></pre> <p>If you now look into what dependencies the binary has, you note the binary itself depends also on <code>libd</code>, not just <code>libb</code> as it should. The binary will need to be relinked if <code>libb</code> later depends on another library, if you do it this way. And if someone else loads <code>libb</code> using <code>dlopen</code> at runtime (think of loading plugins dynamically), the call will fail as well. So the <code>&quot;right&quot;</code> really should be a <code>wrong</code> as well.</p>
<p>I have seen this a lot, some of our modules link in excess of a 100 libraries of our code plus system &amp; 3rd party libs. </p> <p>Depending on different linkers HP/Intel/GCC/SUN/SGI/IBM/etc you can get unresolved functions/variables etc, on some platforms you have to list libraries twice. </p> <p>For the most part we use structured hierarchy of libraries, core, platform, different layers of abstraction, but for some systems you still have to play with the order in the link command.</p> <p>Once you hit upon a solution document it so the next developer does not have to work it out again.</p> <p>My old lecturer used to say, "<em>high cohesion &amp; low coupling</em>", it’s still true today.</p>
6,694
<p>I´m currently working on a custom delta printer running Marlin 1.0.2 firmware. To control it I´m using the Repetier Host software with the onboard Cura software to slice my objects. The printing works fine but it takes the nozzle nearly 5 minutes to move from the homing position at 250&nbsp;mm to the starting position of the print near z=0. </p> <p>I already tried to increase the travel speed but nothing changed. Can you guys please tell me how to increase the speed of my nozzle to move down to my starting point of the print?</p>
<p>I had the same problem, and I solved it by changing the <em>Z-Axis Feed Rate</em> to a much higher value (1000 mm/min.) in Repetier Host via <em>Config -> Printer Settings -> Printer</em>.</p>
<p>Try changing the travel speed in you r slicer, if that doesn't work , try changing out the motors for newer ones.</p>
588
<p>How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter)</p>
<p>You have to use JavaScript for this:</p> <pre><code>&lt;script type="text/javascript"&gt; window.name = "MyWindow"; &lt;/script&gt; </code></pre> <p>Of course you could easily package this up into a Rails helper method. For example, in <code>app/helpers/application_helper.rb</code> add a new method:</p> <pre><code>def window_name(name) content_for(:window_name) do "&lt;script type=\"text/javascript\"&gt;window.name = \"#{name}\";&lt;/script&gt;" end end </code></pre> <p>Next, in your layout file, add this line somewhere within the HTML <code>&lt;head&gt;</code> element:</p> <pre><code>&lt;%= yield :window_name %&gt; </code></pre> <p>Finally, in your view templates, simply add a line like this (can be anywhere you want) to output the correct JavaScript:</p> <pre><code>&lt;% window_name 'MyWindow' %&gt; </code></pre>
<p>You could try below:</p> <pre><code>var x=window.open("", "myWindow"); var y="&lt;head&gt;&lt;title&gt;my window&lt;/title&gt;&lt;/head&gt;&lt;body&gt;my window&lt;/body&gt;"; x.document.write(y); </code></pre>
5,675
<p>A GUI driven application needs to host some prebuilt WinForms based components. These components provide high performance interactive views using a mixture of GDI+ and DirectX. The views handle control input and display custom graphical renderings. The components are tested in a WinForms harness by the supplier.</p> <p>Can a commericial application use WPF for its GUI and rely on <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx" rel="noreferrer" title="WindowsFormsHost">WindowsFormsHost</a> to host the WinForms components or have you experience of technical glitches e.g. input lags, update issues that would make you cautious?</p>
<p>We're currently using WindowsFormsHost in our software to host the WinForms DataGridView control, and we've not had any real problems with it. A few things to watch out for though:</p> <p>The first is the <a href="http://msdn.microsoft.com/en-us/library/aa970688.aspx" rel="noreferrer">air-space restrictions</a>. Practically speaking, this means that WinForms content always appears on top of WPF content. So if you are using WPF adorners they will appear to be "trimmed" if they hit up against a WinForms region in your app.</p> <p>The second is that, because they use Windows resources, you have to manage the lifetimes of WinForms components more carefully. Unlike WPF components, WinForms controls expect to be Disposed when they're finished with. This makes it tricky to include them in a pure XAML view.</p> <p>The last thing is that WinForms controls don't seem to resize as smoothly as the rest of the WPF display: they tend to snap to their new size once you've finished making an adjustment.</p>
<p>I hosted WPF controls in WinForms and vice versa without problems. Though, I would test such scenarios extensively 'cause it's hard to predict how complex control will behave.</p>
7,733
<p>Am I right in thinking the full name of the LSP is the Liskoff Substitution Principle? I'm having trouble finding an [online] source to cite for any information on this... it seems to be a cornerstone of OOP, and yet I'm having trouble finding definitions.</p>
<p>Yes, you are right. It's spelled Liskov which is probably why you can't find a citation. Here's the <a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" rel="nofollow noreferrer">link.</a> One of the better resources regarding this is Robert C. Martin's Agile Software Development Principles Patterns and practices book.</p>
<p>You got the name right. </p> <p><a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Liskov_substitution_principle</a></p> <p>It was developed by Barbra Liskov, a professor at MIT.</p>
5,953
<p>After printing successfully for a while I received an error saying:</p> <p>Tool 0 Failure!<br> Temp limit reached <br> Shutdown or restart.<br></p> <p>The front panel is not responsive and doesn't allow the printer to print at all. If I quickly go to monitor mode it shows tool 0 temperature in the ~700°C range; which made me think it was the thermocouple.On the motherboard I unplugged the thermocouple and the same error occurred, I then swapped the other thermocouple and put it in its place and got the same error except the tool 1 temperature showed "NC". </p> <p>I had recently taken apart the extruders to change out the nozzles and thought I had possibly smashed the wires when putting it together but now I don't think that's the case. </p> <p>I'm on the phone with FlashForge's tech support but wanted to see if someone else has had the same experience for cross reference.</p> <p>What's the underlying issue? Is there a quick solution to this that can get me printing right away (I'm under a deadline)? What's the end solution?</p>
<p>It sounds like a failed TC amp chip. But we need to rule out some other stuff. </p> <p>Some important facts about the Creator Pro temp sensor:</p> <ul> <li>If you smash and short the two thermocouple wires together, the printer will simply read room temp.</li> <li>If you cut or disconnect the thermocouple wires, the printer will report NC for "not connected."</li> <li>The thermocouple lookup table in the firmware only goes up to 300C. </li> </ul> <p>Seeing a number over 300C means either a bad thermocouple amp chip, or excess voltage on the TC wires due to a short to something else in the hot block. (However, such a short will usually fry the entire controller board to smithereens.)</p> <p>To rule out stray voltage entering the TC wires, completely detach both thermocouples from the hot blocks and lay them out not touching anything metal. Do you still get an unusually high reading on tool 0? </p> <p>To rule out an issue with the specific thermocouple, swap thermocouples between tool 0 and tool 1 and see if the problem moves with the TCs.</p> <p>If the TC is not touching anything, and the problem stays with the tool when you swap wires, and you STILL get >300C reads, the thermocouple amp chip has failed. It is possible to replace the chip if you have (or your friend has) a hot air rework station and some experience soldering. Or you can get a new mainboard from FlashForge. </p> <p>The next question is why this problem happened. You don't want to fix the symptoms with new parts but have an underlying issue cause the same failure to re-occur after you swap out parts. With the printer on but the heaters off, use a multimeter to check for voltage between the hot block and the printer's ground. Certain types of heater cartridge failure can short the hot block to +24v. This is highly dangerous and needs to be fixed before you continue using the printer. So make sure you check it before trying to repair anything else. </p>
<p>Oh yeah my printer had that. Specifically 2 Flash Forge Creator Pros, Replace the thermal couple. Done. Really fragile thermal couples they use.</p> <p>Edit I see you tried shorting the TC. Wouldn't shorting the TC, produce the same error?</p>
286
<p>I have an M3D Micro 3D printer that printed fine for a couple of weeks and then was plagued with issues afterward. I've done the fixes from the forum to get proper heating and cooling of the nozzle (I've added aluminum foil around the nozzle to make sure the hotend is fit snug against the nozzle and I've added an external fan, powered externally, to compensate for heat creep).</p> <p>This works very well for short prints and it usually finishes successfully. When I do a longer print it always stops midway and usually at the same exact point. </p> <p>I tried printing at 200&nbsp;°C with black PLA and then again at 215&nbsp;°C with the same filament and it stops at the same exact point. I also tried M3D brand white filament. I am using CURA slicer with Octoprint GCODE sender and M3D Fio.</p> <p>I know it is not clogged because if I stop the print and press extrude without letting it cool down, it extrudes fine. </p> <p>What is causing my printer to stop printing?</p>
<p>I'm not sure how similar the two systems are, but I use a Stratasys uPrint SE Plus and I've run into a similar problem. </p> <p>There are two rollers in the head that pull the filament through to the extruder nozzle, and in one instance they appeared to have heated up, melted the filament enough to create two "indentions" on either side of the filament, making it such that the rollers had no purchase on the filament itself. There was never any clog, no material feed error, but it was still failing to print. Wound up having to replace the head altogether.</p> <p>Again, not sure how similar the extrusion mechanics are in the M3D, but suggest checking the components that actually advance the filament, and the filament itself.</p>
<p>Placing this suggestion as an answer, because all information appears to point to the slicer software and/or the operating system. Consider to use alternative methods of slicing and sending the model, such as the previously mentioned <a href="https://craftunique.com/craftware" rel="nofollow noreferrer">Craftware</a> or other free slicers, such as <a href="http://slic3r.org/download" rel="nofollow noreferrer">Slic3r</a> - both of which have Linux versions. If, as you suggest, your firmware is so tied down that it won't run alternate versions without re-flashing, that would be your next step. Unfetter yourself from the limitations of the current suspect software.</p> <p>If you are able to use other slicers and discover that the problem remains, the re-flashing of the firmware is likely the only solution.</p>
383
<p>Let's say that we have an ARGB color:</p> <pre><code>Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. </code></pre> <p>When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is <code>Color.FromARGB(255, 162, 133, 255);</code></p> <p>The solution should work like this:</p> <pre><code>Color blend = Color.White; Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. Color rgb = ToRGB(argb, blend); //Same as Color.FromARGB(255, 162, 133, 255); </code></pre> <p>What is <code>ToRGB</code>'s implementation? </p>
<p>It's called <a href="http://en.wikipedia.org/wiki/Alpha_compositing" rel="noreferrer">alpha blending</a>.</p> <p>In psuedocode, assuming the background color (blend) always has 255 alpha. Also assumes alpha is 0-255.</p> <pre><code>alpha=argb.alpha() r = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r() g = (alpha/255)*argb.g() + (1 - alpha/255)*blend.g() b = (alpha/255)*argb.b() + (1 - alpha/255)*blend.b() </code></pre> <p><em>note: you probably need to be a bit (more) careful about floating-point/int math and rounding issues, depending on language. Cast intermediates accordingly</em></p> <p><strong>Edited to add:</strong></p> <p>If you don't have a background color with an alpha of 255, the algebra gets alot more complicated. I've done it before and it's a fun exercise left to the reader (if you really need to know, ask another question :). </p> <p>In other words, what color C blends into some background the same as blending A, then blending B. This is sort of like calculating A+B (which isn't the same as B+A).</p>
<p>if you don't need to know this pre-render, you could always use the win32 method of getpixel, I believe. </p> <p>Note: typing on iPhone in the middle of Missouri with no inet access. Will look up real win32 example and see if there is a .net equivalent.</p> <p>In case anyone cares, and doesn't want to use the (excellent) answer posted above, you can get the color value of a pixel in .Net via this link <a href="http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.getpixel.aspx" rel="nofollow noreferrer">MSDN example</a></p>
2,490
<p>Is there a good way for displaying unicode text in opengl under Windows? For example, when you have to deal with different languages. The most common approach like</p> <pre><code>#define FONTLISTRANGE 128 GLuint list; list = glGenLists(FONTLISTRANGE); wglUseFontBitmapsW(hDC, 0, FONTLISTRANGE, list); </code></pre> <p>just won't do because you can't create enough lists for all unicode characters.</p>
<p>You should also check out the <a href="http://sourceforge.net/projects/ftgl/" rel="noreferrer">FTGL library</a>. </p> <blockquote> <p>FTGL is a free cross-platform Open Source C++ library that uses Freetype2 to simplify rendering fonts in OpenGL applications. FTGL supports bitmaps, pixmaps, texture maps, outlines, polygon mesh, and extruded polygon rendering modes.</p> </blockquote> <p>This project was dormant for awhile, but is recently back under development. I haven't updated my project to use the latest version, but you should check it out.</p> <p>It allows for using any True Type Font via the <a href="http://freetype.sourceforge.net/index2.html" rel="noreferrer">FreeType</a> font library.</p>
<p>Unicode is supported in the title bar. I have just tried this on a Mac, and it ought to work elsewhere too. If you have (say) some imported data including text labels, and some of the labels just might contain unicode, you could add a tool that echoes the label in the title bar.</p> <p>It's not a great solution, but it is very easy to do.</p>
2,935
<p>In my second year of University we were "taught" Haskell, I know almost nothing about it and even less about functional programming.</p> <p>What is functional programming, why and/xor where would I want to use it instead of non-functional programming and am I correct in thinking that C is a non-functional programming language?</p>
<p>One key feature in a functional language is the concept of first-class functions. The idea is that you can pass functions as parameters to other functions and return them as values.</p> <p>Functional programming involves writing code that does not change state. The primary reason for doing so is so that successive calls to a function will yield the same result. You can write functional code in any language that supports first-class functions, but there are some languages, like Haskell, which do not allow you to change state. In fact, you're not supposed to make any side effects (like printing out text) at all - which sounds like it could be completely useless.</p> <p>Haskell instead employs a different approach to IO: monads. These are objects that contain the desired IO operation to be executed by your interpreter's toplevel. At any other level they are simply objects in the system.</p> <p>What advantages does functional programming provide? Functional programming allows coding with fewer potentials for bugs because each component is completely isolated. Also, using recursion and first-class functions allows for simple proofs of correctness which typically mirror the structure of the code.</p>
<p>I find <a href="http://blog.jenkster.com/2015/12/what-is-functional-programming.html" rel="nofollow">What Is Functional Programming?</a> to be useful</p> <blockquote> <p>Functional programming is about writing pure functions, about removing hidden inputs and outputs as far as we can, so that as much of our code as possible just describes a relationship between inputs and outputs.</p> </blockquote> <p>Prefer explicit <code>when</code> param</p> <pre><code>public Program getProgramAt(TVGuide guide, int channel, Date when) { Schedule schedule = guide.getSchedule(channel); Program program = schedule.programAt(when); return program; } </code></pre> <p>over</p> <pre><code>public Program getCurrentProgram(TVGuide guide, int channel) { Schedule schedule = guide.getSchedule(channel); Program current = schedule.programAt(new Date()); return current; } </code></pre> <blockquote> <p>A functional language is actively hostile to side-effects. Side-effects are complexity and complexity is bugs and bugs are the devil. A functional language will help you be hostile to side-effects too.</p> </blockquote>
4,401
<p>Reusing values in CSS (particularly colors) has always been a problem for me when it comes to maintaining that CSS. What are the best tools for creating variables, or generally improving maintainability with CSS?</p>
<p>See the answers to the following questions </p> <ul> <li><a href="https://stackoverflow.com/questions/47487/create-a-variable-in-css-file-for-use-within-that-css-file">Create a variable in .CSS file for use within that .CSS file</a></li> <li><a href="https://stackoverflow.com/questions/30170/avoiding-repeated-constants-in-css">Avoiding repeated constants in CSS</a></li> </ul>
<p>I haven't had the chance to use it on a project yet, but if you happen to be using PHP for your backend, <a href="http://turbine.peterkroener.de/" rel="nofollow">Turbine</a> looks promising.</p>
7,364
<p>I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you).</p> <p>What's a good fit for this? Writing an AudioUnit that just passes the sound through and incidentally hands it off somewhere for analysis? Writing a JACK-aware app and figuring out how to get it to play with the JACK server? Ecasound?</p> <p>This is a cheesy proof-of-concept hobby project, so simplicity of API is the driving factor (followed by reasonable choice of programming language).</p>
<p>I think <a href="http://www.portaudio.com/" rel="noreferrer">portaudio</a> is what you need. Reading from the mike from a console app is a 10 line C file (see patests in the portaudio distrib).</p>
<p>Apple provides sample code for <a href="https://developer.apple.com/library/content/navigation/index.html#topic=Sample+Code&amp;section=Resource+Types" rel="nofollow noreferrer">reading and writing audio data</a>. Additionally there is a lot of good information in the <a href="http://developer.apple.com/audio/" rel="nofollow noreferrer">Audio section of the Apple Developer site</a>.</p>
5,825
<p>What is the best method for comparing IEEE floats and doubles for equality? I have heard of several methods, but I wanted to see what the community thought.</p>
<p>The best approach I think is to compare <a href="http://en.wikipedia.org/wiki/Unit_in_the_last_place" rel="noreferrer">ULPs</a>.</p> <pre><code>bool is_nan(float f) { return (*reinterpret_cast&lt;unsigned __int32*&gt;(&amp;f) &amp; 0x7f800000) == 0x7f800000 &amp;&amp; (*reinterpret_cast&lt;unsigned __int32*&gt;(&amp;f) &amp; 0x007fffff) != 0; } bool is_finite(float f) { return (*reinterpret_cast&lt;unsigned __int32*&gt;(&amp;f) &amp; 0x7f800000) != 0x7f800000; } // if this symbol is defined, NaNs are never equal to anything (as is normal in IEEE floating point) // if this symbol is not defined, NaNs are hugely different from regular numbers, but might be equal to each other #define UNEQUAL_NANS 1 // if this symbol is defined, infinites are never equal to finite numbers (as they're unimaginably greater) // if this symbol is not defined, infinities are 1 ULP away from +/- FLT_MAX #define INFINITE_INFINITIES 1 // test whether two IEEE floats are within a specified number of representable values of each other // This depends on the fact that IEEE floats are properly ordered when treated as signed magnitude integers bool equal_float(float lhs, float rhs, unsigned __int32 max_ulp_difference) { #ifdef UNEQUAL_NANS if(is_nan(lhs) || is_nan(rhs)) { return false; } #endif #ifdef INFINITE_INFINITIES if((is_finite(lhs) &amp;&amp; !is_finite(rhs)) || (!is_finite(lhs) &amp;&amp; is_finite(rhs))) { return false; } #endif signed __int32 left(*reinterpret_cast&lt;signed __int32*&gt;(&amp;lhs)); // transform signed magnitude ints into 2s complement signed ints if(left &lt; 0) { left = 0x80000000 - left; } signed __int32 right(*reinterpret_cast&lt;signed __int32*&gt;(&amp;rhs)); // transform signed magnitude ints into 2s complement signed ints if(right &lt; 0) { right = 0x80000000 - right; } if(static_cast&lt;unsigned __int32&gt;(std::abs(left - right)) &lt;= max_ulp_difference) { return true; } return false; } </code></pre> <p>A similar technique can be used for doubles. The trick is to convert the floats so that they're ordered (as if integers) and then just see how different they are.</p> <p>I have no idea why this damn thing is screwing up my underscores. Edit: Oh, perhaps that is just an artefact of the preview. That's OK then.</p>
<p>Oh dear lord please don't interpret the float bits as ints unless you're running on a P6 or earlier.</p>
4,149
<p>Here's a coding problem for those that like this kind of thing. Let's see your implementations (in your language of choice, of course) of a function which returns a human readable String representation of a specified Integer. For example:</p> <ul> <li>humanReadable(1) returns "one". <li>humanReadable(53) returns "fifty-three". <li>humanReadable(723603) returns "seven hundred and twenty-three thousand, six hundred and three". <li>humanReadable(1456376562) returns "one billion, four hundred and fifty-six million, three hundred and seventy-six thousand, five hundred and sixty-two". </ul> <p>Bonus points for particularly clever/elegant solutions!</p> <p>It might seem like a pointless exercise, but there are number of real world applications for this kind of algorithm (although supporting numbers as high as a billion may be overkill :-)</p>
<p>There was already a question about this: <a href="https://stackoverflow.com/questions/3213/c-convert-integers-into-written-numbers">Convert integers to written numbers</a></p> <p>The answer is for C#, but I think you can figure it out.</p>
<p>There's one huge problem about this function implementation. It is it's future localization. That function, written by english native speaker, most probably wouldn't work right for any other language than english. It is nearly impossible to write general easy localizable function for any human language dialect in a world, unless you really need to keep it general. Actually in real world you do not need to operate with huge integer numbers, so you can just keep all the numbers in a big (or even not so big) string array. </p>
3,253
<p>Is it possible to use gcov for coverage testing of multi-threaded applications? </p> <p>I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible oprofile), ideally with some good documentation on getting started.</p>
<p>We've certainly used gcov to get coverage information on our multi-threaded application.</p> <p>You want to compile with gcc 4.3 which can do coverage on dynamic code.</p> <p>You compile with the <code>-fprofile-arcs -ftest-coverage</code> options, and the code will generate .gcda files which gcov can then process.</p> <p>We do a separate build of our product, and collect coverage on that, running unit tests and regression tests.</p> <p>Finally we use lcov to generate HTML results pages.</p>
<p>I have not used gcov for multi-threaded coverage work. However, on MacOS the Shark tool from Apple handles multiple threads. It's primarily a profiler, but can do coverage info too.</p> <p><a href="http://developer.apple.com/tools/sharkoptimize.html" rel="nofollow noreferrer">http://developer.apple.com/tools/sharkoptimize.html</a></p>
5,859
<p>Say I have a <code>Textbox</code> nested within a <code>TabControl</code>. </p> <p>When the form loads, I would like to focus on that <code>Textbox</code> (by default the focus is set to the <code>TabControl</code>).</p> <p>Simply calling <code>textbox1.focus()</code> in the <code>Load</code> event of the form does not appear to work. </p> <p>I have been able to focus it by doing the following:</p> <pre><code> private void frmMainLoad(object sender, EventArgs e) { foreach (TabPage tab in this.tabControl1.TabPages) { this.tabControl1.SelectedTab = tab; } } </code></pre> <p><strong>My question is:</strong></p> <p>Is there a more elegant way to do this?</p>
<p>The following is the solution:</p> <pre><code>private void frmMainLoad(object sender, EventArgs e) { ActiveControl = textBox1; } </code></pre> <p>The better question would however be why... I'm not entirely sure what the answer to that one is.</p> <p>Edit: I suspect it is something to do with the fact that both the form, and the TabControl are containers, but I'm not sure.</p>
<pre><code> private void ChildForm1_Load(object sender, EventArgs e) { ActiveControl = txt_fname; } </code></pre> <p>i use this code it works fine on win tab control or dotnetbar supertab contrl</p>
7,116
<p>For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows...it might work) how do you change what shows up in the Designer Properties window for one of the Control's public Properties. For example:</p> <pre><code>private Color blah = Color.Black; public Color Blah { get { return this.blah; } set { this.blah = value; } } </code></pre> <p>This shows up for the control, but it's in the "Misc" category and has no description or default value. I've tried using the settings in System.ComponentModel like "DesignerCategory", such as:</p> <pre><code>[DesignerCategory("Custom")] </code></pre> <p>But says this is only valid for class declarations... could've sworn it was the System.ComponentModel items I used before...</p> <h3>Update:</h3> <p>@John said:</p> <blockquote> <p>DesignerCatogy is used to say if the class is a form, component etc.</p> <p>Try this:</p> <p>[Category("Custom")]</p> </blockquote> <p>Is there a particular namespace I need to use in order to get those? I've tried those exactly and the compiler doesn't recognize them.</p> <p>In .NETCF all I seem to have available from System.ComponentModel is:</p> <pre><code>DataObject, DataObjectMethod, DefaultValue, DesignerCategory, DesignTimeVisible, EditorBrowsable </code></pre> <p>The only one it doesn't scream at is EditorBrowsable</p>
<p><code>DesignerCategory</code> is used to say if the class is a form, component etc.</p> <p>For full windows the attribute you want is:</p> <pre><code>[System.ComponentModel.Category("Custom")] </code></pre> <p>and for the description you can use <code>[System.ComponentModel.Description("This is the description")]</code></p> <p>To use both together:</p> <pre><code>[System.ComponentModel.Category("Custom"),System.ComponentModel.Description("This is the description")] </code></pre> <p>However this is part of <code>system.dll</code> which may be different for windows mobile.</p>
<p>The article does not suggest that anyone is designing ON the device. However, when you create a Compact Framework project, the compact framework (for your desktop PC) is used to handle design time rendering. If you think about it that is what you expect. The same framework (or nearly so) is used to do the rendering both on your PC at design time and later on the device at runtime. The issue is that the design time attributes were not added to the compact framework (I assume to reduce the size).</p>
3,017
<p>I'm teaching (or trying to teach) computer programming to a grad-student. Her previous experience amounts to little more than writing spreadsheet formulae. Which IDE or text editor should I recommend?</p> <p>Please bear in mind that:</p> <ul> <li>I only meet my student about once a week.</li> <li>She uses Windows and I use Linux.</li> <li>She doesn't have a community of users on hand.</li> <li>She doesn't have much money to spend.</li> </ul> <hr> <p><strong>Edit:</strong> The languages she's learning at the moment are <em>Perl</em> and <em>R</em>. (Sorry ... for forgetting to mention them earlier.)</p> <hr> <p><strong>Edit:</strong> Thanks for all your answers!</p> <p>The most highly recommended editors are <em>jEdit</em> and <em>Notepad++</em>.</p> <p>If I can find a way to give my student adequate support for <em>Notepad++</em> (e.g. by running it under <em>Wine</em>) or if I think that she can manage without support from me, then I'll recommend that. If not, I'll go for <em>jEdit</em>.</p> <p>Apologies, once again, to those who saw the question before I got around to listing the languages that I'm teaching.</p>
<p>The <a href="http://www.microsoft.com/Express/" rel="nofollow noreferrer">Visual Studio Express</a> products are all free. Unless the fact that you're using Linux changes things :)</p>
<p>My suggestion is <a href="http://www.textpad.com/" rel="nofollow noreferrer">Textpad</a>. You can teach her javascript, all the basic, and some advanced concepts are there. It's fun for the student see the output in a browser, and you can even teach a little HTML if the mood strikes.</p>
9,733
<p>Quick thing: Please tell me if I misuse any of the terminology</p> <p>On a replicator+, I have been printing successfully for a while, when suddenly the raft started to warp. I was doing a bunch of models that covered the whole tray, so I shrunk to just a small area, but It still warped I read up on how to fix, but most covered how to fix warping in the model itself, not the rafting. Some said to lower the temp, would that work? smart extruder at default settings, 215 C. The printer does not have a heated base, nor have I treated it with anything, and I am using it with the stock program (makerbot print). Otherwise, I am using it as it came out of the box.</p> <p><a href="https://i.stack.imgur.com/1k0PE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1k0PE.jpg" alt="bad"></a></p>
<p>I'm not sure I am reading your post correctly, but if you are doing a batch of small prints, I would recommend to <strong>space them enough so as each of them has its own mini-raft, rather than all of them sharing the same large one</strong>.</p> <p>If you are using cura, you can tweak how much the raft goes past the footprint of the part. Unless you are printing <em>very</em> small parts, you don't need that to be a lot.</p> <p>In general, <strong>you should think to a raft as a print in and by itself: the larger it is, the more prone to warping,</strong> although the way filament is layered with gaps makes the raft bend and warp a lot less than a regular print of the same size.</p>
<p>Lowering the raft temp to 200 degrees C should help. You should also apply hairspray and purple gluestick to your entire printed to help with raft adhesion to the bed.</p>
821
<p>Other than <code>self.class.send :method, args...</code>, of course. I'd like to make a rather complex method available at both the class and instance level without duplicating the code.</p> <hr> <p><strong>UPDATE:</strong> </p> <p>@Jonathan Branam: that was my assumption, but I wanted to make sure nobody else had found a way around. Visibility in Ruby is very different from that in Java. You're also quite right that <code>private</code> doesn't work on class methods, though this will declare a private class method:</p> <pre><code>class Foo class &lt;&lt;self private def bar puts 'bar' end end end Foo.bar # =&gt; NoMethodError: private method 'bar' called for Foo:Class </code></pre>
<p>Here is a code snippet to go along with the question. Using "private" in a class definition does not apply to class methods. You need to use "private_class_method" as in the following example.</p> <pre><code>class Foo def self.private_bar # Complex logic goes here puts "hi" end private_class_method :private_bar class &lt;&lt;self private def another_private_bar puts "bar" end end public def instance_bar self.class.private_bar end def instance_bar2 self.class.another_private_bar end end f=Foo.new f=instance_bar # NoMethodError: private method `private_bar' called for Foo:Class f=instance_bar2 # NoMethodError: private method `another_private_bar' called for Foo:Class </code></pre> <p>I don't see a way to get around this. The documentation says that you cannot specify the receive of a private method. Also you can only access a private method from the same instance. The class Foo is a different object than a given instance of Foo.</p> <p>Don't take my answer as final. I'm certainly not an expert, but I wanted to provide a code snippet so that others who attempt to answer will have properly private class methods.</p>
<p>Unless I'm misunderstanding, don't you just need something like this:</p> <pre><code>class Foo private def Foo.bar # Complex logic goes here puts "hi" end public def bar Foo.bar end end </code></pre> <p>Of course you could change the second definition to use your self.class.send approach if you wanted to avoid hardcoding the class name... </p>
4,099
<p>Here's what it looks like <a href="https://i.stack.imgur.com/XjFer.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjFer.jpg" alt="enter image description here"></a></p> <p>This is the model <a href="https://www.thingiverse.com/thing:2991851" rel="nofollow noreferrer">thingiverse linky</a></p> <p>It looks like it couldn't print the edge, but this happened many many hours after printing the brim.</p> <p>This did not happen with my 1st attempt at this print. The last print lost adhesion and I had to scrap it. This time, adhesion looks good so not sure why this happened.</p> <p>Printing with Monoprice Select V2 with ABS, sliced with Cura. 100C bed / 250C extruder. 15mm/s initial layer speed. 60 mm/s print speed.</p> <p><strong>Update</strong> It looks like the printer is starting to smooth it out like so. Still not sure if this will lead to an ok print or will fail because of this layer. And it seems the stringing area does not have a brim underneath it. Did Cura just not calculate the brim size correctly? <a href="https://i.stack.imgur.com/kKMYw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kKMYw.jpg" alt="enter image description here"></a></p> <p><strong>Update2</strong> Here's a few screenshots from Cura to show that the model is lying completely flat. <a href="https://i.stack.imgur.com/iywA2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iywA2.png" alt="cura1"></a> <a href="https://i.stack.imgur.com/DvtBr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DvtBr.png" alt="cura2"></a> <a href="https://i.stack.imgur.com/kc7Xh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kc7Xh.png" alt="cura3"></a> I let the print go on overnight and here's where I stopped it <a href="https://i.stack.imgur.com/HPNrX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HPNrX.jpg" alt="top view"></a> <a href="https://i.stack.imgur.com/6XRvv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6XRvv.jpg" alt="side view"></a> It almost seems like the print shifted completely after printing the initial layer. Have you ever seen anything like this or is there anything in my Cura model that would make it do this?</p>
<p>No, <strong><em>your problem is not related to slicing</em></strong>, <strong><em>this is a hardware problem</em></strong>. Your complete print has shifted, this is called <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#layer-shifting-or-misalignment" rel="nofollow noreferrer">layer shift</a>. </p> <p>This could happen when the nozzle hits an obstruction while printing while the Y stepper continues. This could lead to skipping teeth on the belts, slipping of the pulley or missing steps. This results in printing over air as the print progresses. This manifests itself as stringing, but in fact is unsupported printing (in the air). In this case it is unrecoverable as the printer has lost the reference frame, it just continues to print with the new reference frame caused by the layer shift. </p> <p>A Prusa MK3, or any printerboard using trinamic stepper drivers would be able to recover (if the belt and pulley are correctly attached, and steps are missed) as the skipping of steps is detected, in case of a Prusa MK3 the machine will re-home when it detects skipped steps and continue printing. See also <a href="https://3dprinting.stackexchange.com/a/6880/5740">this answer</a> for more details.</p> <p>Possible solutions are increasing the belt tension, increase the stepper torque by increasing the current through the stepper drivers or re-tighten the pulley on the stepper of the Y belt.</p>
<p>There are many problems caused with this. It could be a faulty motors, an unlevel bed, a dirty nozzle, or even something as simple as using the wrong filament settings. It would be best to go through a checklist of things that might be wrong with your printer. It could also just be caused by the wear and tear of a really old printer. </p>
1,163
<p>I'm getting some strange, intermittent, data aborts (&lt; 5% of the time) in some of my code, when calling <code>memset()</code>. The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act.</p> <p>I'm using the following code:</p> <pre><code>char *msg = (char*)malloc(sizeof(char)*2048); char *temp = (char*)malloc(sizeof(char)*1024); memset(msg, 0, 2048); memset(temp, 0, 1024); char *tempstr = (char*)malloc(sizeof(char)*128); sprintf(temp, "%s %s/%s %s%s", EZMPPOST, EZMPTAG, EZMPVER, TYPETXT, EOL); strcat(msg, temp); //Add Data memset(tempstr, '\0', 128); wcstombs(tempstr, gdevID, wcslen(gdevID)); sprintf(temp, "%s: %s%s", "DeviceID", tempstr, EOL); strcat(msg, temp); </code></pre> <p>As you can see, I'm not trying to use memset with a size larger that what's originally allocated with <code>malloc()</code></p> <p>Anyone see what might be wrong with this?</p>
<p><code>malloc</code> can return <code>NULL</code> if no memory is available. You're not checking for that.</p>
<p>Have you tried using Valgrind? That is usually the fastest and easiest way to debug these sorts of errors. If you are reading or writing outside the bounds of allocated memory, it will flag it for you.</p>
4,247
<p>I want to introduce some tracing to a C# application I am writing. Sadly, I can never really remember how it works and would like a tutorial with reference qualities to check up on every now and then. It should include:</p> <ul> <li>App.config / Web.config stuff to add for registering TraceListeners</li> <li>how to set it up in the calling application</li> </ul> <p>Do you know the über tutorial that we should link to?</p> <hr/> <p>Glenn Slaven pointed me in the right direction. Add this to your App.config/Web.config inside <code>&lt;configuration/&gt;</code>:</p> <pre><code>&lt;system.diagnostics&gt; &lt;trace autoflush=&quot;true&quot;&gt; &lt;listeners&gt; &lt;add type=&quot;System.Diagnostics.TextWriterTraceListener&quot; name=&quot;TextWriter&quot; initializeData=&quot;trace.log&quot; /&gt; &lt;/listeners&gt; &lt;/trace&gt; &lt;/system.diagnostics&gt; </code></pre> <p>This will add a <code>TextWriterTraceListener</code> that will catch everything you send to with <code>Trace.WriteLine</code>, etc.</p> <p>@DanEsparza pointed out that you should use <code>Trace.TraceInformation</code>, <code>Trace.TraceWarning</code> and <code>Trace.TraceError</code> instead of <code>Trace.WriteLine</code>, as they allow you to format messages the same way as <code>string.Format</code>.</p> <p><strong>Tip:</strong> If you don't add any listeners, then you can still see the trace output with the Sysinternals program <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/debugview" rel="nofollow noreferrer">DebugView</a> (<code>Dbgview.exe</code>):</p>
<p>I followed around five different answers as well as all the blog posts in the previous answers and still had problems. I was trying to add a listener to some existing code that was tracing using the <code>TraceSource.TraceEvent(TraceEventType, Int32, String)</code> method where the <code>TraceSource</code> object was initialised with a string making it a 'named source'.</p> <p>For me the issue was not creating a valid combination of source and switch elements to target this source. Here is an example that will log to a file called <code>tracelog.txt</code>. For the following code:</p> <pre><code>TraceSource source = new TraceSource(&quot;sourceName&quot;); source.TraceEvent(TraceEventType.Verbose, 1, &quot;Trace message&quot;); </code></pre> <p>I successfully managed to log with the following diagnostics configuration:</p> <pre class="lang-html prettyprint-override"><code>&lt;system.diagnostics&gt; &lt;sources&gt; &lt;source name=&quot;sourceName&quot; switchName=&quot;switchName&quot;&gt; &lt;listeners&gt; &lt;add name=&quot;textWriterTraceListener&quot; type=&quot;System.Diagnostics.TextWriterTraceListener&quot; initializeData=&quot;tracelog.txt&quot; /&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;/sources&gt; &lt;switches&gt; &lt;add name=&quot;switchName&quot; value=&quot;Verbose&quot; /&gt; &lt;/switches&gt; &lt;/system.diagnostics&gt; </code></pre>
<p>DotNetCoders has a starter article on it: <a href="http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=50" rel="nofollow noreferrer">http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=50</a>. They talk about how to set up the switches in the configuration file and how to write the code, but it is pretty old (2002).</p> <p>There's another article on CodeProject: <em><a href="http://www.codeproject.com/KB/trace/debugtreatise.aspx" rel="nofollow noreferrer">A Treatise on Using Debug and Trace classes, including Exception Handling</a></em>, but it's the same age.</p> <p>CodeGuru has another article on custom TraceListeners: <em><a href="https://www.codeguru.com/vb/gen/vb_misc/debuggingandtracing/article.php/c5611/Implementing-a-Custom-TraceListener.htm" rel="nofollow noreferrer">Implementing a Custom TraceListener</a></em></p>
4,725
<p>Using the Python Documentation I found the <a href="http://docs.python.org/lib/module-HTMLParser.html" rel="noreferrer">HTML parser</a> but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page).</p>
<p>Try:</p> <pre><code>import HTMLParser </code></pre> <p>In Python 3.0, the HTMLParser module has been renamed to html.parser you can check about this <a href="http://docs.python.org/library/htmlparser.html" rel="noreferrer">here</a></p> <p>Python 3.0</p> <pre><code>import html.parser </code></pre> <p>Python 2.2 and above</p> <pre><code>import HTMLParser </code></pre>
<p>There's a link to an example on the bottom of (<a href="http://docs.python.org/2/library/htmlparser.html" rel="nofollow noreferrer">http://docs.python.org/2/library/htmlparser.html</a>) , it just doesn't work with the original python or python3. It has to be python2 as it says on the top.</p>
9,660
<p>I have just acquired my first 3D printer, a BIQU B1. Overall I'm quite pleased with the printing results but I'm having minor defects on the Benchy test. I'm not sure what the problem is, but I guess it's related to the overhang and maybe vibrations.</p> <p>My print settings are:</p> <ul> <li>Software: Ultimaker Cura</li> <li>Temp: 205 °C</li> <li>Heatbed temp: 60 °C</li> <li>Height: 0.2 mm</li> <li>Print speed: 60 mm/s</li> <li>Travel speed: 150 mm/s</li> <li>Flow: 94 %</li> </ul> <p><a href="https://i.stack.imgur.com/PAFSA.jpg" rel="nofollow noreferrer" title="Imperfections in Benchy - front"><img src="https://i.stack.imgur.com/PAFSA.jpg" alt="Imperfections in Benchy - front" title="Imperfections in Benchy - front" /></a></p> <p><a href="https://i.stack.imgur.com/ob3Za.jpg" rel="nofollow noreferrer" title="Imperfections in Benchy - rear"><img src="https://i.stack.imgur.com/ob3Za.jpg" alt="Imperfections in Benchy - rear" title="Imperfections in Benchy - rear" /></a></p> <p><a href="https://i.stack.imgur.com/7tYI7.jpg" rel="nofollow noreferrer" title="Imperfections in Benchy - side"><img src="https://i.stack.imgur.com/7tYI7.jpg" alt="Imperfections in Benchy - side" title="Imperfections in Benchy - side" /></a></p>
<p>After two weeks of working on different settings in different slicers, I finally have a profile which has improved the quality of my printings. It still has some overhangs, which I'm sure will improve by increasing the cooling flow like 0scar already mentioned.</p> <p>Here is the profile bundle (for Prusa Slicer): <a href="https://drive.google.com/file/d/1nvSK950zlEQtIUIpFnCav5-t5cN3E4HE/view?usp=sharing" rel="nofollow noreferrer">Link</a> or see <a href="https://3dprinting.stackexchange.com/a/16297/4762">this answer</a> below.</p>
<p>I agree with <a href="/a/15995">this answer</a>. There might be an obstruction in the cooling. I also have a B1, have you checked the included printed part that redirects the blower fans towards the part and made sure it's clear? Mine came with some warping that I had to file off.</p>
1,903
<p>I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not:</p> <pre><code>try { ... // some code } catch (Exception ex) { ... // Do something throw new CustomException(ex); } </code></pre> <p>Basically, what the coder is doing is that they are encompassing the exception in a custom exception and throwing that again.</p> <p>How does this differ in Performance from the following two:</p> <pre><code>try { ... // some code } catch (Exception ex) { .. // Do something throw ex; } </code></pre> <p>or </p> <pre><code>try { ... // some code } catch (Exception ex) { .. // Do something throw; } </code></pre> <p>Putting aside any functional or coding best practice arguments, is there any performance difference between the 3 approaches?</p>
<p>@Brad Tutterow</p> <p>The exception is not being lost in the first case, it is being passed in to the constructor. I will agree with you on the rest though, the second approach is a very bad idea because of the loss of stack trace. When I worked with .NET, I ran into many cases where other programmers did just that, and it frustrated me to no end when I needed to see the true cause of an exception, only to find it being rethrown from a huge try block where I now have no idea where the problem originated.</p> <p>I also second Brad's comment that you shouldn't worry about the performance. This kind of micro optimization is a HORRIBLE idea. Unless you are talking about throwing an exception in every iteration of a for loop that is running for a long time, you will more than likely not run into performance issues by the way of your exception usage.</p> <p>Always optimize performance when you have metrics that indicate you NEED to optimize performance, and then hit the spots that are proven to be the culprit.</p> <p>It is much better to have readable code with easy debugging capabilities (IE not hiding the stack trace) rather than make something run a nanosecond faster.</p> <p>A final note about wrapping exceptions into a custom exception... this can be a very useful construct, especially when dealing with UIs. You can wrap every known and reasonable exceptional case into some base custom exception (or one that extends from said base exception), and then the UI can just catch this base exception. When caught, the exception will need to provide means of displaying information to the user, say a ReadableMessage property, or something along those lines. Thus, any time the UI misses an exception, it is because of a bug you need to fix, and anytime it catches an exception, it is a known error condition that can and should be handled properly by the UI.</p>
<p>The throw in your first example has the overhead of the creation of a new CustomException object.</p> <p>The re-throw in your second example will throw an exception of type Exception.</p> <p>The re-throw in your third example will throw an exception of the same type that was thrown by your "some code".</p> <p>So the second and third examples use less resources.</p>
2,857
<p>What is the best way to use PyGame (SDL) within a PyGTK application?</p> <p>I'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.</p>
<p>I've never attempted it myself, but hearing plenty about other people who've tried, it's not a road you want to go down.</p> <p>There is the alternative of putting the gui in pygame itself. There are plenty of gui toolkits built specifically for pygame that you could use. Most of them are rather unfinished, but there are 2 big, actively maintained ones: <a href="http://www.pygame.org/project/108/" rel="nofollow noreferrer">PGU</a> and <a href="http://www.pygame.org/project/125/" rel="nofollow noreferrer">OcempGUI</a>. The full list on the pygame site is <a href="http://www.pygame.org/tags/gui" rel="nofollow noreferrer">here</a>.</p>
<p>I tried doing this myself a while ago, and I never got it to work perfectly. Actually I never got it to work at all under Windows, as it kept crashing the entire OS and I ran out of patience. I continued to use it though as it was only important it ran on Linux, and was only a small project. I'd strongly recommend you investigate alternatives. It always felt like a nasty hack, and made me feel dirty.</p>
4,527
<p>My 3D printer makes weird sounds. When it's at >75% printing speed the extruder motor makes a "tac tac" sound and it goes backwards, pushing the filament back, for a small interval of time. I have tried changing the nozzle temperature and I'm unable to work this out alone. </p> <p>Has someone had the same problem?</p> <p>This is the 3D printer: <a href="http://www.dx.com/es/p/geeetech-high-quality-wood-geeetech-prusa-i3-pro-w-3d-printer-kit-469707?tc=EUR" rel="noreferrer">Geeetech High Quality Wood Geeetech Prusa I3 Pro W 3D Printer Kit</a>.</p>
<p>@Ecnerwal is right: that noise you hear is the extruder not being able to push the filament, and the stepper can't push any harder. When the extruder tries to push harder than it can, it gives up, and the "spring" tension it created in the filament forces it to go backwards a tiny bit. Then it tries again.</p> <p>Possible causes/fixes:</p> <ul> <li><p>Temperature too low -- this makes the filament not liquid enough to push through the nozzle easily. For ABS, you should be in the 230-240 range.</p></li> <li><p>Clogged nozzle -- take the nozzle off (while hot) and try heating it with a torch to burn out anything that might be in there.</p></li> <li><p>Bad filament -- If the filament has contamination in it, or is too large to fit through the hot end in places (I.E. it gets up to 1.9mm instead of 1.75mm)</p></li> <li><p>Stepper current too low -- I'm not sure if you can adjust the current that is sent to your stepper motors, but if it is too low, the stepper can not provide enough torque to push the filament through. I don't see the stepper drivers on the site, so I don't know if you can adjust them or not.</p></li> </ul>
<p>It could be a result of filament building up around the drive gear.</p> <ul> <li>disassemble your extruder to expose the drive gear (the gear that drives the filament down to the heat element). </li> <li>clean any filament build-up out of the the teeth.</li> </ul> <p>Filament can sometimes build up around the gear over time when the extruder temp is not high enough to efficiently melt the filament. This occurs more commonly with ABS I've noticed, probably partly due to its higher heat resistance. However, this affect is ultimately an issue of poor quality filament (aka cheap).</p>
636
<p>When making changes using <code>SubmitChanges()</code>, LINQ sometimes dies with a <code>ChangeConflictException</code> exception with the error message <code>Row not found or changed</code>, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another user has changed some data in that row.</p> <p>Is there any way to determine which row has a conflict and which fields they occur in, and also is there a way of getting LINQ to ignore the issue and simply commit the data regardless?</p> <p>Additionally, does anybody know whether this exception occurs when <em>any</em> data in the row has changed, or only when data has been changed in a field that LINQ is attempting to alter?</p>
<p>Here's a way to see where the conflicts are (this is an MSDN example, so you'll need to heavily customize):</p> <pre><code>try { db.SubmitChanges(ConflictMode.ContinueOnConflict); } catch (ChangeConflictException e) { Console.WriteLine("Optimistic concurrency error."); Console.WriteLine(e.Message); Console.ReadLine(); foreach (ObjectChangeConflict occ in db.ChangeConflicts) { MetaTable metatable = db.Mapping.GetTable(occ.Object.GetType()); Customer entityInConflict = (Customer)occ.Object; Console.WriteLine("Table name: {0}", metatable.TableName); Console.Write("Customer ID: "); Console.WriteLine(entityInConflict.CustomerID); foreach (MemberChangeConflict mcc in occ.MemberConflicts) { object currVal = mcc.CurrentValue; object origVal = mcc.OriginalValue; object databaseVal = mcc.DatabaseValue; MemberInfo mi = mcc.Member; Console.WriteLine("Member: {0}", mi.Name); Console.WriteLine("current value: {0}", currVal); Console.WriteLine("original value: {0}", origVal); Console.WriteLine("database value: {0}", databaseVal); } } } </code></pre> <p>To make it ignore the problem and commit anyway:</p> <pre><code>db.SubmitChanges(ConflictMode.ContinueOnConflict); </code></pre>
<p>"and also is there a way of getting LINQ to ignore the issue and simply commit the data regardless?"</p> <p>You can set the 'Update Check' property on your entity to 'Never' to stop that field being used for optimistic concurrency checking.</p> <p>You can also use:</p> <pre><code>db.SubmitChanges(ConflictMode.ContinueOnConflict) </code></pre>
5,264
<p>I have used PLA and PLA+ so far and I know that it can use ABS and PETG but I'm curious what other materials could I in theory use with my Ender 3?</p> <p>It is a stock configuration, for the time being at least until after Christmas, and my grandfather and I have designed an enclosure to build together.</p>
<p>A (pre-2019) stock ender3 can't print tpu because of a 3mm gap between the driver in the extruder and the bowden tube. But there are multiple adapter plates on thingiverse that close this gap, and then tpu works fine (with some tuning).</p> <p>I got tpu to work for small parts even without the adapter plate.</p>
<p>Consider <strong>Wood PLA</strong>. It is similar to PLA but more abrasive, and with different happy-temperatures.</p> <p>Especially useful if you want to paint your output, or if you have woodworking skills/tools then prints can be (somewhat) worked and incorporated into larger projects.</p> <p>Imagine printing detailed <strong>scallions</strong> or <strong>crenellations</strong> or <strong>gargoyles</strong> for a spooky dollhouse - the main walls would use an inordinate amount of filament whereas sheet-wood is cheaper.</p>
2,029
<p>I'm familiar with TDD and use it in both my workplace and my home-brewed web applications. However, every time I have used TDD in a web application, I have had the luxury of having full access to the web server. That means that I can update the server then run my unit tests directly from the server. My question is, if you are using a third party web host, how do you run your unit tests on them?</p> <p>You could argue that if your app is designed well and your build process is sound and automated, that running unit tests on your production server isn't necessary, but personally I like the peace of mind in knowing that everything is still "green" after a major update.</p> <hr> <p>For everyone who has responded with "just test before you deploy" and "don't you have a staging server?", I understand where you're coming from. I do have a staging server and a CI process set up. My unit tests do run and I make sure they all pass before an an update to production. </p> <p>I realize that in a perfect world I wouldn't be concerned with this. But I've seen it happen before. If a file is left out of the update or a SQL script isn't run, the effects are immediately apparent when running your unit tests but can go unnoticed for quite some time without them.</p> <p>What I'm asking here is if there is any way, if only to satisfy my own compulsive desires, to run a unit test on a server that I cannot install applications on or remote into (e.g. one which I will only have FTP access to in order to update files)?</p>
<p>I think I probably would have to argue that running unit tests on your production server isn't really part of TDD because by the time you deploy to your production environment technically speaking, you're past "development".</p> <p>I'm quite a stickler for TDD, and when I'm preaching the benefits to clients I often find myself saying "you can't half adopt TDD, it's all or nothing" </p> <p>What you probably should have is some form of automated testing that you perform "after" deployment but these are not part of TDD.</p> <p>Maybe you should look at your process again. </p>
<p>I've written test tools for sites using python and httplib/urllib2 generally it would have been overkill but it was suitable in these cases. Not sure it's going to be of general use though.</p>
4,087
<p>I recently tried cleaning my CR-10S Pro heat bed with acetone and it made this white stain on it.</p> <p>Anyone have any solutions to this?</p>
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based cleaner or DI/distilled water. (IPA dissolves acetone and water dissolves IPA. Once the film dries the next step may not work.)</p> <p>You can't clean off a frosted surface. The black surface of the hot bed in images of the CR-10S Pro appears to indicate that the steel bed has a build surface with a plastic material such as PEI. Reviews of the build surface being difficult to remove prints also implies a plastic build surface on the steel. Thus, it appears that the white film after cleaning with acetone is actually a frosted surface.</p> <p>If you use an Elmer's washable glue stick or one with PWP, it will form a barrier between your print and the build surface, that not only will protect your build surface, but will make it easier to clean your build surface with IPA or water based cleaners.</p>
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based cleaner or DI/distilled water. (IPA dissolves acetone and water dissolves IPA. Once the film dries the next step may not work.)</p> <p>You can't clean off a frosted surface. The black surface of the hot bed in images of the CR-10S Pro appears to indicate that the steel bed has a build surface with a plastic material such as PEI. Reviews of the build surface being difficult to remove prints also implies a plastic build surface on the steel. Thus, it appears that the white film after cleaning with acetone is actually a frosted surface.</p> <p>If you use an Elmer's washable glue stick or one with PWP, it will form a barrier between your print and the build surface, that not only will protect your build surface, but will make it easier to clean your build surface with IPA or water based cleaners.</p>
1,869
<p>Using C# .NET 3.5 and WCF, I'm trying to write out some of the WCF configuration in a client application (the name of the server the client is connecting to).</p> <p>The obvious way is to use <code>ConfigurationManager</code> to load the configuration section and write out the data I need.</p> <pre><code>var serviceModelSection = ConfigurationManager.GetSection("system.serviceModel"); </code></pre> <p>Appears to always return null.</p> <pre><code>var serviceModelSection = ConfigurationManager.GetSection("appSettings"); </code></pre> <p>Works perfectly.</p> <p>The configuration section is present in the App.config but for some reason <code>ConfigurationManager</code> refuses to load the <code>system.ServiceModel</code> section.</p> <p>I want to avoid manually loading the xxx.exe.config file and using XPath but if I have to resort to that I will. Just seems like a bit of a hack.</p> <p>Any suggestions?</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/ms731354%28v=vs.90%29.aspx" rel="noreferrer"><code>&lt;system.serviceModel&gt;</code></a> element is for a configuration section <strong>group</strong>, not a section. You'll need to use <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.configuration.servicemodelsectiongroup.getsectiongroup%28v=vs.90%29.aspx" rel="noreferrer"><code>System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()</code></a> to get the whole group.</p>
<p>GetSectionGroup() does not support no parameters (under framework 3.5).</p> <p>Instead use:</p> <pre><code>Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ServiceModelSectionGroup group = System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup(config); </code></pre>
4,002
<p>I've been seeing feedback from people in other 3DP communities that they think this stack exchange site is driving away new users by holding newbie questions to an excessively high standard for quality. On one hand, we all know SE works best with clear and logical questions that lead to clear and logical answers. But the majority of people seeking help with 3d printers don't seem to have enough of a technical foundation to know how to ask good questions. There's a large potential userbase (perhaps MOST potential users) that will need handholding for their first few questions. </p> <p>How do you guys want to handle this?</p>
<p>I think you highlighted one of the more important points, in that "<em>SE works best with clear and logical questions that lead to clear and logical answers</em>". From what I've noticed (and I just went back through my own voting history), there have been a number of "primarily opinion based" and "too broad" questions. I believe it's important to maintain quality questions/answers especially in this early stage of release. Please regard <a href="https://3dprinting.meta.stackexchange.com/questions/6/what-should-our-documentation-contain?rq=1">this other meta post</a> asking what the guidelines are for proper 3D Printing community questions.</p> <p>I, for one, feel that I learned the most SE etiquette by reading a large number of questions on SO as opposed to the SE documentation. It seems that a few of the questions we've gotten lately have been from completely new users to the Stack Exchange network. I don't like scaring people away from the site, so it is best to try and coach these new users.</p> <p>I retract the following suggestion as I agree with <a href="https://3dprinting.meta.stackexchange.com/questions/111/closing-locking-too-many-questions/112#114">Mark Booth's answer</a> given his explanation.</p> <p><s>I would suggest an informal guideline for closing questions:</p> <ul> <li>First, notify the OP to the condition of their question. Perhaps even suggest a means to fix the errant condition(s).</li> <li>If, after at least 24 hours of the comment, the OP has not either responded reasonably (within SE etiquette) nor updated the question, then begin the process of closing.</s></li> </ul> <p>I'll leave this open to the community for amendments below:</p>
<p>I think you highlighted one of the more important points, in that "<em>SE works best with clear and logical questions that lead to clear and logical answers</em>". From what I've noticed (and I just went back through my own voting history), there have been a number of "primarily opinion based" and "too broad" questions. I believe it's important to maintain quality questions/answers especially in this early stage of release. Please regard <a href="https://3dprinting.meta.stackexchange.com/questions/6/what-should-our-documentation-contain?rq=1">this other meta post</a> asking what the guidelines are for proper 3D Printing community questions.</p> <p>I, for one, feel that I learned the most SE etiquette by reading a large number of questions on SO as opposed to the SE documentation. It seems that a few of the questions we've gotten lately have been from completely new users to the Stack Exchange network. I don't like scaring people away from the site, so it is best to try and coach these new users.</p> <p>I retract the following suggestion as I agree with <a href="https://3dprinting.meta.stackexchange.com/questions/111/closing-locking-too-many-questions/112#114">Mark Booth's answer</a> given his explanation.</p> <p><s>I would suggest an informal guideline for closing questions:</p> <ul> <li>First, notify the OP to the condition of their question. Perhaps even suggest a means to fix the errant condition(s).</li> <li>If, after at least 24 hours of the comment, the OP has not either responded reasonably (within SE etiquette) nor updated the question, then begin the process of closing.</s></li> </ul> <p>I'll leave this open to the community for amendments below:</p>
21
<p>Does filling out HTML meta description/keyword tags matter for SEO?</p>
<p><a href="http://searchengineland.com/070905-194221.php" rel="nofollow noreferrer">This article</a> has some info on it.</p> <p>A quick summary for keywords is:</p> <p>Google and Microsoft: No</p> <p>Yahoo and Ask: Yes</p> <p>Edit: As noted below, the meta description is used by Google to describe your site to potential visitors (although may not be used for ranking).</p>
<p>Those are two of the things that are used by search engines. The exact weight of each changes frequently, they are generally regarded; however, as being fairly important.</p> <p>One thing to note, care should be taken when entering values. The more relevant the keywords and description are to the textual content of the site, the more weight may be given to them. Of course there are no guarantees as nobody outside of the search engine companies really <strong>know</strong> what algorithms are being used.</p> <p><a href="https://stackoverflow.com/questions/5373/do-comment-permalinks-with-anchors-hurt-you-for-seo#5381">This post</a> talks a bit more about some aspects.</p>
7,650
<p>I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux).</p> <p>Is there a way to leverage the database-related tools in Visual Studio with other database providers?</p>
<p>Here is instructions on how to connect to your MySQL database from Visual Studio:</p> <blockquote> <p>To make the connection in server explorer you need to do the following:</p> <ul> <li><p>first of all you need to install the MyODBC connector 3.51 (or latest) on the development machine (NB. you can find this at <a href="http://www.mysql.com/products/connector/odbc/" rel="noreferrer">http://www.mysql.com/products/connector/odbc/</a> )</p></li> <li><p>Create a datasource in Control Panel/Administrative Tools with a connection to your database. This data source is going to be used purely for Server Manager and you dont need to worry about creating the same data source on your clients PC when you have made your VS.NET application (Unless you want to) - I dont want to cover this in this answer, too long. For the purpose of this explanation I will pretend that you created a MyODBC data source called 'AADSN' to database 'noddy' on mysqlserver 'SERVER01' and have a root password of 'fred'. The server can be either the Computer Name (found in Control Panel/System/Computer Name), or alternatively it can be the IP Address. NB. Make sure that you test this connection before continuing with this explanation.</p></li> <li><p>open your VS.NET project</p></li> <li><p>go to server explorer</p></li> <li><p>right-click on 'Data Connections'</p></li> <li><p>select 'Add Connection'</p></li> <li><p>In DataLink Properties, go to the provider tab and select "Microsoft OLE DB Provider For ODBC drivers"</p></li> <li><p>Click Next</p></li> <li><p>If you previously created an ODBC data source then you could just select that. The disadvantage of this is that when you install your project application on the client machine, the same data source needs to be there. I prefer to use a connection string. This should look something like:</p></li> </ul> <p>DSN=AADSN;DESC=MySQL ODBC 3.51 Driver DSN;DATABASE=noddy;SERVER=SERVER01;UID=root;PASSWORD=fred;PORT=3306;SOCKET=;OPTION=11;STMT=;</p> <p>If you omit the password from the connection string then you must make sure that the datasource you created (AADSN) contains a password. I am not going to describe what these mean, you can look in the documentation for myodbc for that, just ensure that you get a "Connection Succeeded" message when you test the datasource.</p> </blockquote>
<p>The Server Explorer should support any database system that provides an ODBC driver. In the case of Oracle there is a built in driver with Visual Studio.</p> <p>In the Add Connection Dialog click the change button on the data source you should then get a list of the providers you have drivers for.</p>
5,184
<p>Generally the database server is the biggest, most expensive box we have to buy as scaling vertically is the only option. Are there any databases that scale well horizontally (i.e. across multiple commodity machines) and what are the limitations in this approach?</p>
<p><strong>Oracle RAC -- Real Application Cluster</strong></p> <p>This works nicely, you just add boxes to your cluster. You can fail over from one box to the other. It's not replication, all the boxes are part of the same logical unit.</p> <p>It's pretty spendy, of course.</p>
<p>Oracle Real Application Clusters. If you want the best then take a look at it.</p>
6,421
<p>I'd love to learn Cocoa, it seems like the best systems language for Mac OS X.</p> <p>Can you recommend any useful ways to learn the language? Books, websites, example projects or even classes to take?</p>
<p>Andy Matuschak has a great <a href="http://andymatuschak.org/articles/2007/09/09/getting-started-with-cocoa-a-friendlier-approach/" rel="noreferrer">blog post</a> that leads you through several good Cocoa tutorials, explaining why you are reading each one.</p> <p><a href="http://www.cocoadevcentral.com/" rel="noreferrer">Cocoa Dev Central</a> has loads of tutorials.</p> <p>For books, I echo Dave and Phillip Bowden with <a href="https://rads.stackoverflow.com/amzn/click/com/0321503619" rel="noreferrer" rel="nofollow noreferrer">Cocoa Programming for Mac OS X by Aaron Hillegass</a>.</p>
<p>Buy a book, open XCode, and <em>write</em>. Seriously, writing is <em>the best way</em> to learn Cocoa. In addition, I recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0321213149" rel="nofollow noreferrer" rel="nofollow noreferrer">Cocoa Programming for Mac OS X</a>!</p>
9,342
<p>Lately I'm having some issues with white PLA.</p> <p>It sticks nicely to the print bed, but the very last layer of the print comes out really ugly.</p> <p>I'm not a native english speaker, I don't know what is the proper term to describe what I see, so I'm attaching two pictures instead:</p> <p><a href="https://i.stack.imgur.com/4A8Gn.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/4A8Gn.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/76KNF.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/76KNF.jpg" alt="enter image description here"></a></p> <p>As you can see, the surface has wrinkles. If you touch it, it feels like a <a href="https://i.stack.imgur.com/ab7vc.jpg" rel="noreferrer">jaggled surface</a>. What is causing this? I've never had this kind of issue before with the same PLA roll, what can be the issue?</p> <p>I have a prusa-style printer, 45°C printbed, 225°C hotend, 10% hexagonal infill, 30mm/s print speed. The object stays on the surface without warping, I can tell for sure that it isn't detaching from the bed and coming up towards the extruder.</p> <p>It happens only for infill, perimeters are just perfect.</p> <p>What can be the issue here?</p>
<p>This appears to be the result of your hot end (nozzle) temperature being slightly too high. </p> <p>I'd recommend lowering your nozzle temperature by a few degrees and retrying the print. If the quality improves you're good. If it doesn't improve significantly try lowering a few degrees more. </p> <p>If you lower the nozzle temperature to the point that you start having other adverse effects, try going back to the lowest temperature that works and check your infill and shell settings. The top shell of your part may be too thin given the span (top surface, maximum travel length). i.e. the strands being printed on the top of your part are sagging between your infil hex's, by thickening this part in the slicer settings the next layer on the roof won't sag as much as the previous.</p> <p>By increasing your number of shells or shell thickness (or roof thickness, i'm not sure on the exact terminology) you could effectively hide the effect you're seeing by thickening this section of your part. </p> <p>Best guess though is nozzle is a bit too hot.</p>
<p>This looks like the air trapped inside the print is expanding, causing wavy surfaces. This can be solved by lowering nozzle temperatures, and turning on the fan.</p>
559
<p>My goals are focused on software application development, and maybe web application development, but most likely desktop applications. I'm embarking on a path to becoming more familiar with C/C++, but should I go much lower than that, into assembly? Or would I not have a benefit for my long-term goals?</p>
<p>I am really surprised to see so many "no" answers to this question. I think you <em>should</em> learn assembly.</p> <p>I do not expect that you would ever <em>use</em> assembly directly as part of your job. But it does not follow from that that you should not learn it.</p> <p>Learning assembly will teach you about what is going on inside the computer. It will help you to understand what the software is actually doing.</p> <p>It's really about professionalism. Are you going to be a professional software engineer? Or are you going to be a copy-and-paste hack? Sure, the latter may pay the bills, but being a professional is so much more satisfying.</p> <p>To hear someone say, "Nah, don't bother learning assembly," sounds to my ears like "Here's the cookbook for building bridges. You don't need to learn about physics or engineering to build a bridge. Just follow these recipes." No, thank you.</p>
<p>I would not suggest to learn a "modern assembler language". </p> <p>However knowing a little about <a href="http://en.wikipedia.org/wiki/MOS_Technology_6510" rel="nofollow noreferrer">MOS 6510</a> Assembler and browsing through the disassembled <a href="http://en.wikipedia.org/wiki/C64" rel="nofollow noreferrer">C64</a> Kernel, a.k.a. it's OS and BASIC Interpreter, helped me a lot to understand what's going on inside a computer - stuff like interrupts and memory pages.</p> <p>This could possibly help you to give you hints how to write optimized code in other languages. A lot of that - however - is already done by modern compilers, so I'd only suggest that if you're interested in what's going on inside of that black box.</p>
4,761
<p>Is there an open-source alternative to MATLAB's <a href="https://www.mathworks.com/help/optim/index.html;jsessionid=95cd06964ab253598de29e7d0a80" rel="nofollow noreferrer"><code>fmincon</code></a> function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / <a href="https://numpy.org/" rel="nofollow noreferrer">NumPy</a> / <a href="https://scipy.org/" rel="nofollow noreferrer">SciPy</a> and this is the only function I haven't found an equivalent to. A NumPy-based solution would be ideal, but any language will do.</p>
<p>Is your problem convex? Linear? Non-linear? I agree that SciPy.optimize will probably do the job, but fmincon is a sort of bazooka for solving optimization problems, and you'll be better off if you can confine it to one of the categories below (in increasing level of difficulty to solve efficiently)</p> <ul> <li>Linear Program (LP)</li> <li>Quadratic Program (QP)</li> <li>Convex Quadratically-Constrained Quadratic Program (QCQP)</li> <li>Second Order Cone Program (SOCP)</li> <li>Semidefinite Program (SDP)</li> <li>Non-Linear Convex Problem</li> <li>Non-Convex Problem</li> </ul> <p>There are also combinatoric problems such as Mixed-Integer Linear Programs (MILP), but you didn't mention any sort of integrality constraints, suffice to say that they fall into a different class of problems.</p> <p>The CVXOpt package will be of great use to you if your problem is convex.</p> <p>If your problem is not convex, you need to choose between finding a local solution or the global solution. Many convex solvers 'sort of' work in a non-convex domain. Finding a good approximation to the global solution would require some form Simulated Annealing or Genetic Algorithm. Finding the global solution will require an enumeration of all local solutions or a combinatorial strategy such as Branch and Bound.</p>
<p>Scilab has an implementation of fmincon (using IPOpt) which is now regularly updated:</p> <p><a href="https://atoms.scilab.org/toolboxes/fmincon" rel="nofollow noreferrer">https://atoms.scilab.org/toolboxes/fmincon</a></p> <p>For large-scale optimization it outperforms Matlab's fmincon.</p>
7,254
<p>I have some website which requires a logon and shows sensitive information.</p> <p>The person goes to the page, is prompted to log in, then gets to see the information.</p> <p>The person logs out of the site, and is redirected back to the login page.</p> <p>The person then can hit "back" and go right back to the page where the sensitive information is contained. Since the browser just thinks of it as rendered HTML, it shows it to them no problem.</p> <p>Is there a way to prevent that information from being displayed when the person hits the "back" button from the logged out screen? I'm not trying to disable the back button itself, I'm just trying to keep the sensitive information from being displayed again because the person is not logged into the site anymore.</p> <p>For the sake of argument, the above site/scenario is in ASP.NET with Forms Authentication (so when the user goes to the first page, which is the page they want, they're redirected to the logon page - in case that makes a difference).</p>
<p>The short answer is that it cannot be done securely.</p> <p>There are, however, a lot of tricks that can be implemented to make it difficult for users to hit back and get sensitive data displayed.</p> <pre><code>Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.AppendHeader("Pragma", "no-cache"); </code></pre> <p>This will disable caching on client side, however this is <strong>not supported by all browsers</strong>.</p> <p>If you have the option of using AJAX then sensitive data can be retrieved using a updatepanel that is updated from client code and therefore it will not be displayed when hitting back unless client is still logged in.</p>
<p>You are looking for a no-cache directive:</p> <pre><code>&lt;META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"&gt; </code></pre> <p>If you've got a master page design going, this may be a little bit of a juggle, but I believe you can put this directive on a single page, without affecting the rest of your site (assuming that's what you want).</p> <p>If you've got this directive set, the browser will dutifully head back to the server looking for a brand new copy of the page, which will cause your server to see that the user is not authenticated and bump him to the login page.</p>
8,957
<p>For whatever reason, our company has a coding guideline that states:</p> <p><code>Each class shall have it's own header and implementation file.</code></p> <p>So if we wrote a class called <code>MyString</code> we would need an associated <strong>MyStringh.h</strong> and <strong>MyString.cxx</strong>.</p> <p>Does anyone else do this? Has anyone seen any compiling performance repercussions as a result? Does 5000 classes in 10000 files compile just as quickly as 5000 classes in 2500 files? If not, is the difference noticeable?</p> <p>[We code C++ and use GCC 3.4.4 as our everyday compiler]</p>
<p>The term here is <strong>translation unit</strong> and you really want to (if possible) have one class per translation unit ie, one class implementation per .cpp file, with a corresponding .h file of the same name.</p> <p>It's usually more efficient (from a compile/link) standpoint to do things this way, especially if you're doing things like incremental link and so forth. The idea being, translation units are isolated such that, when one translation unit changes, you don't have to rebuild a lot of stuff, as you would have to if you started lumping many abstractions into a single translation unit.</p> <p>Also you'll find many errors/diagnostics are reported via file name ("Error in Myclass.cpp, line 22") and it helps if there's a one-to-one correspondence between files and classes. (Or I suppose you could call it a 2 to 1 correspondence).</p>
<p>I'm surprised that almost everyone is in favor of having one file per class. The problem with that is that in the age of 'refactoring' one may have a hard time keeping the file and class names in synch. Everytime you change a class name, you then have to change the file name too, which means that you have to also make a change everywhere the file is included. </p> <p>I personally group related classes into a single files and then give such a file a meaningful name that won't have to change even if a class name changes. Having fewer files also makes scrolling through a file tree easier. I use Visual Studio on Windows and Eclipse CDT on Linux, and both have shortcut keys that take you straight to a class declaration, so finding a class declaration is easy and quick. </p> <p>Having said that, I think once a project is completed, or its structure has 'solidified', and name changes become rare, it may make sense to have one class per file. I wish there was a tool that could extract classes and place them in distinct .h and .cpp files. But I don't see this as essential.</p> <p>The choice also depends on the type of project one works on. In my opinion the issue doesn't deserve a black and white answer since either choice has pros and cons. </p>
4,780
<p>Yesterday i replaced the z axis of my diy printer. Now i have some strange waves on the side of my prints. Are the threaded rods bent or could that be a vibration issue? Or is the coupler too stiff?</p> <p><a href="https://i.stack.imgur.com/IbumF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IbumF.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/Qo32X.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qo32X.jpg" alt="enter image description here"></a></p>
<p>This looks as if there is a side-to-side force being generated as Z is changed. Ideally, the X or Y position is determined by the smooth rods, which should bear any force, not the threaded rod. The threaded rod should cause no motion except upward and downward.</p> <p>If the rod is bent, but the rod is lightly constrained, then the top, being the free end, will draw a circle. The bottom is constrained by the motor. The middle is constrained by the nut, so the top would wander. If the threaded rod is perfectly straight, and the stepper motor axis and the nut are perfectly aligned, the top would spin without movement.</p> <p>If the rod is bent and the nut is very tight, there may be a twisting force exerted by the nut, which could cause movement.</p> <p>Everything is a tradeoff between tightness and looseness, between precision components and the reality of alignment errors.</p> <p>You asked if the shaft coupling is too tight. Maybe. Try removing everything except the motor, coupling, and the threaded rod. Does the rod fall exactly where the nut would be? If not, it isn't aligned correctly. Incorrect alignment can be mitigated by a flexible coupling. It looks like you are using a Lovejoy coupling with a plaster spider. Depending on how tightly the spider fits, a Lovejoy coupling can be tight or loose. I see a lot of machines with the one-piece coupling and a spiral-cut joining region. THis might be a good alternative, but they tend to take up more space than a lovejoy coupling.</p> <p>Because Z-axis motion is pretty slow, it is unlikely to be a z-axis vibration issue. You may have changed the resonant frequencies enough to cause some other problem, but I don't think it is related to the problem in the photograph.</p>
<p>It is possible that your selected layer height isn't compatible with the pitch of your leadscrew. I believe the reprap website has a layer height calculator based on the pitch of your lead screw. Just another option.</p>
642
<p>Currently, if I want to output a SQL script for a table in my database, in Management Studio, I can right click and output a create script. </p> <p>Is there an equivalent to output an SQL script for a database's maintenance plan?#</p> <p>Edit</p> <p>The company I work for has 4 servers, 3 servers and no sign of integration, each one running about 500,000 transactions a day. The original maintenance plans were undocumented and trying to create a default template maintenance plan. </p>
<p>You can't export them as scripts, but if your intention is to migrate them between server instances then you can import and export them as follows:</p> <p>Connect to Integration Services and expand Stored Packages>MSDB>Maintenance Plans. You can then right click on the plan and select import or export</p>
<p>I don't think you can do that with Maintenance Plans, because those are DTS packages, well now they are called SSIS (SQL Server Integration Services). </p> <p>There was a stored procedure from which you could add maintenance plans, but I think that it may be deprecated. (sp_add_maintenance_plan). I don't have a SQL 2005 to test here. </p> <p>The question is, why would you want to export the complete mp? :) If it's for importing in other server, then a ssis package could be useful. I suggest you take a look in that direction, because those you can export/import among servers.</p>
5,267