instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>I'm working in VS 2008 and have three projects in one solution. I'm debugging by attaching to a .net process invoked by a third party app (SalesLogix, a CRM app). </p>
<p>Once it has attached to the process and I attempt to set a breakpoint in one of the projects, it doesn't set a breakpoint in that file. It actually switches the current tab to another file in another project and sets a breakpoint in that document. If the file isn't open, it even goes so far as to open it for me. I can't explain this. I've got no clue. Anyone seen such odd behavior? I wouldn't believe it if I wasn't seeing it myself.</p>
<p>A little more info: if I set a breakpoint before attaching, it shows the "red dot" and says no symbols loaded...no problem...I expect that. When I attach and invoke my .net code from SalesLogix and switch back to VS, my breakpoint is completely gone (not even a warning that the source doesn't match the debug file). When I attempt to manually load the debug file, then I get a message that the symbol file does not match the module. The .pdb and the .dll are timestamped the same, so I'm stumped.</p>
<p>Anyone have any ideas?</p>
<p>Thx,</p>
<p>Jeff</p>
|
<p>I saw this functionality in older versions of VS.Net (2003 I think). It may still exist in current versions, but I haven't encountered it. Seems that files with the same name, even in different directories confuse VS.Net, and it ends up setting a break point in a file with the same name. May only happen if the classes in the file both have the same name also. So much for namespaces I guess. </p>
<p>You also may want to check your build configuration to make sure that all the projects are in fact building in debug mode. I know I've been caught a couple times when the configuration got changed somehow for the solution, and some projects weren't compiling in debug mode.</p>
|
<p>Kibbee, you were right! It was two files with the same name in different folders. I was setting the breakpoint in the correct file on line 58 - it was putting the breakpoint on the other file at line 58. I was finally able to set a breakpoint by using the "Debug-->New Breakpoint-->Break at Function Name" menu option and entering my function name. It stopped exactly like it should have then. </p>
<p>I agree - so much for namespaces, right? Damn thing cost me a couple of hours. Oh, well...at least it's solved and I know why.</p>
<p>Thx for the answer and thx to Matt for his reply, too!</p>
| 5,134
|
<p>I'm customizing a SugarCRM 5, and in my <strong>SugarCRM database</strong> I have all invoices which were imported from our ERP. Now, I would like to know if it is possible to create a new sub-panel in the Accounts Panel <strong>without editing the original SugarCRM files</strong>, so that my client invoices index are visible in that interface.</p>
|
<p>Last time I checked, you could use the <a href="http://developers.sugarcrm.com/tutorials/Customizing_Sugar/4/" rel="nofollow noreferrer">module builder</a> to extend the interface. From 5.0 (or maybe 4.x) on, Sugar added all those APIs, which should enable you to extend SugarCRM without hacking it in and losing it with the next upgrade.</p>
<p>Hope that helps!</p>
|
<p>Basically, the Account name should be a related field in your new invoices module (base the module creation on something like QUOTES that has similar fields. Once you create the module (so simple you can almost guess your way through it in the ADMIN section) and the fields you like (using Studio) just add the RELATED field Account Name and the sub-panel will be established in your ACCOUNTS module and the invoice will magically populate, especially if you re-install them using the import feature from a CSV file (spreadsheet).</p>
| 5,855
|
<p>How can you get the version information from a <code>.dll</code> or <code>.exe</code> file in PowerShell?</p>
<p>I am specifically interested in <code>File Version</code>, though other version information (that is, <code>Company</code>, <code>Language</code>, <code>Product Name</code>, etc.) would be helpful as well.</p>
|
<p>Since PowerShell can call <a href="https://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> classes, you could do the following:</p>
<pre><code>[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion
</code></pre>
<p>Or as <a href="https://web.archive.org/web/20081004113553/https://kamhungsoh.com/blog/2008/01/powershell-file-version-information.html" rel="noreferrer">noted here</a> on a list of files:</p>
<pre><code>get-childitem * -include *.dll,*.exe | foreach-object { "{0}`t{1}" -f $_.Name, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }
</code></pre>
<p>Or even nicer as a script: <a href="https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/" rel="noreferrer">https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/</a></p>
|
<p>Here an alternative method. It uses Get-WmiObject CIM_DATAFILE to select the version.</p>
<pre><code>(Get-WmiObject -Class CIM_DataFile -Filter "Name='C:\\Windows\\explorer.exe'" | Select-Object Version).Version
</code></pre>
| 5,055
|
<p>Is there any commonly printed plastic which I can buy that might be transparent to UV light? </p>
<p>I wish to print a mould, then pour in my plastic which requires a UV light to activate the curing process. </p>
|
<p>Have you tried printing with Form labs clear resin ? </p>
<p>( This is assuming you have access to a desktop SLA like the Form2+ or Form 1 )</p>
<p>The printed part itself gets hardened after exposure to uv light and actually can increase the life time of your mould .</p>
<p>I have been using the Form labs Form 2+ a lot recently for small moulds and casting them with Polyurethane . They work amazing and the precision of the mould is high due to 0.05mm layer resolution that is achievable .</p>
<p>Once hardened the UV light easily passes through it and does not degrade the part at all . </p>
<p>Here is the material data sheet
<a href="https://formlabs.com/media/upload/Clear-DataSheet.pdf" rel="noreferrer">https://formlabs.com/media/upload/Clear-DataSheet.pdf</a></p>
<p>You can easily get a clear resin print done through a local 3D printing service bureau that you can find using 3D hubs . </p>
<p>Prices for printing on a formlabs are comparable to FDM 3D printing , it really just depends on your supplier .</p>
<p><strong>If the above doesn't cut it then ,</strong></p>
<p>Use DSM Somos® WaterClear Ultra 10122 , please check below link and corresponding data sheet for technical specifications .</p>
<p><a href="https://www.dsm.com/products/somos/en_US/products/offerings-somos-water-clear.html" rel="noreferrer">https://www.dsm.com/products/somos/en_US/products/offerings-somos-water-clear.html</a></p>
<p>This can only be printed on a 3Ds systems viper , Envision tech preform series or other industrial 3D printers . </p>
<p>Again you can head to 3D hubs or call up the closest industrial 3D printing service bureau and ask them for the above material . They should be able to hook you up easily .</p>
|
<p>This is more of a Chemistry question, but seeing as we love 3D printing with exotics, here are a few.</p>
<p><a href="https://topas.com/uv-transmission?gclid=Cj0KCQjwy9LVBRDOARIsAGqoVnuAAAiwiHetZN76JqaRFnq7KKy6br9e6MLDQA4Zlrt01Ceh8GfQrzIaAu7xEALw_wcB" rel="nofollow noreferrer">Topas</a> olefin copolymer</p>
<p>From the mfr description page,</p>
<blockquote>
<p>TOPAS cyclic olefin copolymer, or COC, is an incredibly pure polymer -
in fact, it's purer than most grades of medical glass. Unlike glass,
it has a non-ionic, inert surface to minimize reactivity,
denaturation, agglomeration, delamination and other traditional glass
concerns. And when it comes to maintaining purity, TOPAS medical grade
plastics can be sterilized via all common methods. Leachables and
extractables are extremely low. Reduce risk and increase performance
by maintaining the benign, protective environment that TOPAS COC-based
devices provide.</p>
<p>Medical grades of TOPAS COC are extremely clear, and are optically
suitable for replacing glass in many applications.</p>
</blockquote>
<p>I'm not sure of its melting point, or of the speed of solidification (which affects extruder rate, motion etc).</p>
<p>Recommended at <a href="https://chemistry.stackexchange.com/questions/63912/uv-transparent-plastic">this Chem.SE question</a>, PMMA and others</p>
<h2>edit</h2>
<p>Because answers there have links of their own, I"m not repeating the various technical leads available there.</p>
<p>Now you will have to investigate their melting points and flow rates, etc. to see if these can be coerced to function in an extrusion printer.</p>
| 856
|
<p>Java has <a href="http://www.scala-lang.org/" rel="noreferrer">Scala</a> and .NET has <a href="http://research.microsoft.com/fsharp/" rel="noreferrer">F#</a>. Both of these languages are very highly integrated into the respective Java and .NET platforms. Classes can be written in Scala then extended in Java for example.</p>
<p>Does there exist an equivalent functional language that interoperates highly with C++?</p>
|
<p>C++ doesn't have an ecosystem in the sense of Java or .NET. There's no virtual machine, no runtime environment even, there's only a highly specialized standard library that by design doesn't operate well in a purely functional environment. C++ doesn't even have an <a href="http://en.wikipedia.org/wiki/Application_binary_interface" rel="noreferrer">ABI</a> standard.</p>
<p>All things considered, I'm not sure what you mean/expect.</p>
|
<p>C++ may not be a pure functional language, but parts of STL are certainly functional.</p>
<p>See <a href="http://www.research.att.com/~bs/bs_faq.html" rel="nofollow noreferrer">Bjarne Stroustrup FAQ</a> (the inventor of the c++)</p>
| 4,465
|
<p>I'm looking at Rails development as a backend to a Flex application and am trying to figure out the communication layer between the Rails app and the Flash Player. All of the things I am finding suggest using SOAP web services to communicate.</p>
<p>However, Flash supports AMF which is nice and fast (and native). Is there any way of communicating over AMF from a Rails app, whilst supporting all the "nice" things about AMF (automatic type conversion, data push etc).</p>
|
<p>There is <a href="http://www.themidnightcoders.com/weborb/rubyonrails/" rel="nofollow noreferrer">WebORB</a> or <a href="http://code.google.com/p/rubyamf/" rel="nofollow noreferrer">RubyAMF</a> which you can use to respond in AMF from Rails, the approaches are a bit different for each one so it depends on your needs. RubyAMF is discussed in the closing chapters of the <a href="http://www.flexiblerails.com/" rel="nofollow noreferrer">Flexible Rails</a> eBook which is a good resource on using Rails with Flex.</p>
|
<p>There's a Rails plugin called <a href="http://www.themidnightcoders.com/weborb/rubyonrails/index.htm" rel="nofollow noreferrer">WebORB for Ruby on Rails</a> which uses remoting with AMF. </p>
| 9,593
|
<p>I have had many problems with my heat shrink for the thermostat on my Anet A8 melting from the heat block. </p>
<p>Is there a way I can insulate my wires from heat but still have enough room to put the thermistor into the block?</p>
|
<p>For an illustration of how to employ the Kapton tape, that is mentioned in the answers from Harvey Lim and Howler, watch <a href="https://www.youtube.com/watch?v=0EIFIAWiPdU&t=1290" rel="nofollow noreferrer">How to build a RepRap Prusa i3 (Assembly 7)</a> at 21:30:</p>
<p><a href="https://i.stack.imgur.com/IEr3y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IEr3y.png" alt="Kapton tape on hotend"></a></p>
<p>From <a href="https://www.youtube.com/watch?v=0EIFIAWiPdU&t=910" rel="nofollow noreferrer">15:10</a> the heater and thermistor is connected up, you may find this also useful. Note that, at <a href="https://www.youtube.com/watch?v=0EIFIAWiPdU&t=1245" rel="nofollow noreferrer">20:45</a>, the heatshrink is only used over the soldered connection, and <em>not</em> all the way up to the heatblock:</p>
<p><a href="https://i.stack.imgur.com/i2k2W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i2k2W.png" alt="Heatshrink on thermistor"></a> </p>
<p>Also, more pertinent to your printer, from <a href="https://pevly.com/anet-a8-3d-printer-review/" rel="nofollow noreferrer">Anet A8 Review – Best cheap 3D Printer?</a>, see that the thermistor wires are also wrapped in Kapton tape in this photo:</p>
<p><a href="https://i.stack.imgur.com/mjVNQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mjVNQ.jpg" alt="Thermistor wires are also wrapped in Kapton tape"></a></p>
<p>Note that the Kapton tape is wrapped around the wires, almost right up to the thermistor, and will be touching the heating block, when the thermistor is inserted into the hole - there is no problem of it melting, due to its high melting point.</p>
|
<p>You could use Kapton tape to tape the thermistor. It is usually the best option for sticking something onto the hotend or on the heat block. You will also have less trouble since it is very thin.</p>
<p>Note that if you use Kapton tape, you should use several layers of it for added insulation.</p>
| 593
|
<p>When writing production-quality VC++ code, is the use of recursion acceptable? Why or why not?</p>
|
<blockquote>
<p>Is there a way to determine at what point I would encounter a stack overflow?</p>
</blockquote>
<p>Not really. A stack overflow happens when you exhaust the stack space - however...</p>
<ul>
<li>The initial stack size can be changed programatically and may default to different amounts depending on your OS/compiler/etc</li>
<li>How much of it is already used up depends on what your app (and the libraries your app uses) has previously done - this is often impossible to predict</li>
<li>How much of the stack each call requires depends on what you do in your function. If you only allocate say 1 integer on the stack, you may be able to recurse an enourmous amount of times, but if you are allocating a 200k buffer on the stack, not so much.</li>
</ul>
<p>The only times I've ever hit one is in an infinite loop, or using the aforementioned 200k buffer. </p>
<p>I find it far more prefereable for my app to just crash, than for it to loop forever using 100% CPU and have to be forcefully killed (this is a right PITA on a remote server over a bad connection as windows lacks SSH)</p>
<p>A rough guideline: Do you think your recursive function is likely to call itself more than say 10,000 times consecutively? Or are you doing something dumb like allocating 200k buffers on the stack?</p>
<p>If yes, worry about it.<br>
If no, carry on with more important things.</p>
|
<p>Sure - e.g. if you want to traverse a tree structure what else would you use ? </p>
<p>Maybe you would like to have something like a maximum depth to be sure you're not writing an infinite loop. (if this makes sense in your example)</p>
| 5,822
|
<p>I have a Monoprice Maker Select V2.1 (rebadged Wanhao Di3) with a microswiss all metal hot-end and machined lever and extruder plate. It had been printing very consistently for months with this set up - through 5 or 6 kg of filament - until a couple of weeks ago when it has started to under-extrude and then stop partway into a print, after about 30-40 minutes. It seems to clog and grind the filament, skipping steps. I first assumed this was heat-creep, and so disassembled the extruder, cleaned the heatsink and applied new thermal paste before reassembling, but to no luck. I also tried new fans on the cold-end but this didn't help either.</p>
<p>Other things I have tried:</p>
<ul>
<li>various models - point at which the extruding stops seems based on length of time printing, not z position, suggesting to me that it is not an wires/electronics issue or an issue with the file.</li>
<li>various layer heights</li>
<li>various temperatures</li>
<li>dust filter</li>
<li>various filaments (changing reels of similar filament, different colours and brands, although all PLA)</li>
<li>cleaned, and subsequently replaced extruder gear to rule out wear to that</li>
<li>inserted washer under lever spring to add tension</li>
<li>clearing the nozzle (cleaning filament, atomic pulls and drill-bit)</li>
</ul>
<p>I've now run out of ideas of what could be causing the issue and what to try. What other issues could cause the above symptoms or, if it is heat-creep, how else could I solve the issue?</p>
|
<p>Time to check things that usually don't need checking. At this point I would check the power split. </p>
<p>Check the power supply voltage (+12V or maybe +24V, I don't know the printer) at the controller before and after the extrusion stops or sputters. Assure that the voltage stays the same. If it drops you have a culprit. While there, also check the +5V. If the power is inconsistent, check the connections for loose screws. If the power is also bad at the supply, replace it. </p>
<p>If the extruder starts clicking, it could be under voltage or under temperature. You have already checked for heat creep, and not found it. Either supply voltage can mess with actual temperature.</p>
<p>You have ruled out Z-height, so many possibilities are unlikely. </p>
|
<p>Have you checked your computers power saving settings, the USB port setting in particular, to see if your computer is turning off the USB port, the hard drive, or some other hardware vital to printing?</p>
| 1,345
|
<p>While printing a simple model, my printer starts to layer-shift the build in a direction suddenly. I used the default setting for ultimaker Cura 3.4.1. It has done this same thing for multiple different prints. I would guess it is the software. </p>
<p>How do I fix the issue?
<a href="https://i.stack.imgur.com/xVXO2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xVXO2.jpg" alt="ultimaker cura image"></a>
<a href="https://i.stack.imgur.com/pDCZm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pDCZm.jpg" alt="3D printed object"></a></p>
|
<p>You have a case of layer shift. Layer shifts happened to me in 3 ways:</p>
<ol>
<li>The movement of the axis is hindered. Check if all cables run freely and without any chance to catch! improper cable chains can cause binding and stop the printhead or bed in movement and thus induce a shift.</li>
<li>The acceleration might be too fast. Shift the acceleration of the printer movements down a notch. Don't print faster than ~60 to keep the acceleration in check, as the printer will try to reach the top speed as fast as possible, thus limiting top speed also limits acceleration.</li>
<li>The model might be broken. Re-slice the model <em>just in case</em>.</li>
</ol>
|
<p>You have a case of layer shift. Layer shifts happened to me in 3 ways:</p>
<ol>
<li>The movement of the axis is hindered. Check if all cables run freely and without any chance to catch! improper cable chains can cause binding and stop the printhead or bed in movement and thus induce a shift.</li>
<li>The acceleration might be too fast. Shift the acceleration of the printer movements down a notch. Don't print faster than ~60 to keep the acceleration in check, as the printer will try to reach the top speed as fast as possible, thus limiting top speed also limits acceleration.</li>
<li>The model might be broken. Re-slice the model <em>just in case</em>.</li>
</ol>
| 1,135
|
<h3>Background:</h3>
<p>Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of crashes. It worked reasonably well.</p>
<p>Now, The Powers That Be want solid numbers on the <em>cost</em> of each type of crash being worked on. Or at least, numbers that <em>look</em> solid. I suppose I could use the aggregate lost time, multiplied by some plausible figure, but it seems dodgy.</p>
<h3>Question:</h3>
<p>Are there any established methods of calculating the real-world cost of application crashes? Or failing that, published studies speculating on such costs?</p>
<hr />
<h3>Consensus</h3>
<p>Accuracy is impossible, but an estimate based on uptime should suffice if it is applied consistently and its limitations clearly documented. Thanks, Matt, Orion, for taking time to answer this.</p>
|
<p>I've not seen any studies, but a reasonable heuristic would be something like :</p>
<p>( Time since last application save when crash occurred + Time to restart application ) * Average hourly rate of application operator.</p>
<p>The estimation gets more complex if the crashes have some impact on external customers such, or might delay other things (i.e. create a bottle neck such that another person winds up sitting around waiting because some else's application crashed).</p>
<p>That said, your 'powers that be' may well be happy with a very rough estimate so long as it's applied consistently and they can see how it is changing over time.</p>
|
<p>It depends...</p>
<p>In terms of cost, the <em>only</em> thing that matters is the <strong>business impact</strong> of the crash, so it rather depends on the type of application.</p>
<p>For may applications, it may not be possible to determine business impact. For others, there may be meaninful measures.</p>
<p>Demand-based measures may be meaningful - if sales are steady then down-time for a sales app may be useful. If sales fluctuate unpredictable, then such measures are less useful.</p>
<p>Cost of repair may also be useful.</p>
| 7,933
|
<p>I'm using <code>ColdFusion</code> to return a result set from a SQL database and turn it into a list.</p>
<p>I need some way to generate an alphabetical navigation bar for that list. I have ColdFusion and the jQuery library available.</p>
<p>I'm looking to generate something like this:</p>
<pre><code>A | B | C | ...
- A
- A
- B
- B
- B
- C
- D
</code></pre>
<p>Where clicking on one of the letters drops you down the page to the first item for that letter. Not all 26 letters of the alphabet are necessarily in use.</p>
|
<p>To generate the navigation bar, you could do something like this:</p>
<pre><code><cfoutput>
<cfloop from="#asc('A')#" to="#asc('Z')#" index="i">
<a href="###chr(i)#">#chr(i)#</a>
<cfif asc('Z') neq i>|</cfif>
</cfloop>
</cfoutput>
</code></pre>
<p>(CFLOOP doesn't work on characters, so you have to convert to ascii codes and back.)</p>
<hr>
<p>To display the items in your query you could do something like this.</p>
<pre><code><cfset currentLetter = "">
<cfoutput query="data">
<cfif currentLetter neq left(data.name, 1)>
<h3><a name="#ucase(left(data.name, 1))#">#ucase(left(data.name, 1))#</a></h3>
</cfif>
<cfset currentLetter = left(data.name, 1)>
#name#<br>
</cfoutput>
</code></pre>
|
<p>This question was posted quite a long time ago, but there is now an open source vanilla JavaScript plugin available that will alphabetically filter any HTML list with alphabetical navigation</p>
<p>It's called <a href="https://elliottprogrammer.github.io/alphaListNav.js/" rel="nofollow noreferrer">AlphaListNav.js</a></p>
<p>Just output your HTML list (in your case, your list generated with <code>Coldfusion</code>:</p>
<pre><code><ul id="myList">
<li>Eggplant</li>
<li>Apples</li>
<li>Carrots</li>
<li>Blueberries</li>
</ul>
</code></pre>
<p>Add the CSS in the <code><head></code> of your page:</p>
<pre><code><link rel="stylesheet" href="alphaListNav.css">
<!-- note: you can edit/overide the css to customize how you want it to look -->
</code></pre>
<p>Add the JavaScript file just before the closing <code></body></code> tag:</p>
<pre><code><script src="alphaListNav.js"></script>
</code></pre>
<p>And then Initialize the AlphaListNav library on your list by passing it the id of your list. Like so:</p>
<pre><code><script>
new AlphaListNav('myList');
</script>
</code></pre>
<p>It has all kinds of different options for customizing the behavior you may want:</p>
<p>For example:</p>
<pre><code><script>
new AlphaListNav('myList', {
initLetter: 'A',
includeAll: false,
includeNums: false,
removeDisabled: true,
//and many other options available..
});
</script>
</code></pre>
<p>The GitHub project is <a href="https://github.com/elliottprogrammer/alphaListNav.js" rel="nofollow noreferrer">here</a></p>
<p>And a CodePen example is <a href="https://codepen.io/melliatto/pen/vwWjjj" rel="nofollow noreferrer">here</a> </p>
<p>The AlphaListNav.js website & documentation is <a href="https://elliottprogrammer.github.io/alphaListNav.js/" rel="nofollow noreferrer">here</a></p>
| 3,718
|
<p>I'm trying out ASP.NET MVC routing and have of course stumbled across a problem. I have a section, /Admin/Pages/, and this is also accessible through /Pages/, which it shouldn't. What could I be missing?</p>
<p>The routing code in global.asax:</p>
<pre><code>public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Pages", // Route name
"Admin/Pages/{action}/{id}", // URL with parameters
// Parameter defaults
new { controller = "Pages", action = "Index", id = "" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
// Parameter defaults
new { controller = "Home", action = "Index", id = "" }
);
}
</code></pre>
<p>Thanks!</p>
|
<p>I'd suggest adding an explicit route for /Pages/ at the beginning.</p>
<p>The problem is that it's being handled by the Default route and deriving:</p>
<p>controller = "Pages"
action = "Index"
id = ""</p>
<p>which are exactly the same as the parameters for your Admin route.</p>
|
<p>You have in you first route {action} token/parameter which gets in conflict with setting of default action. Try changing parameter name in your route, or remove default action name.</p>
| 9,573
|
<p>The questions so far are pretty strongly geared towards hobbyist/consumer FFF machines. That's not necessarily bad, since that's where most legit questions will come from. (Not much reason to ask questions about a plug-and-play industrial machine.) But it's a pretty important scope distinction. So far, askers are not really providing enough technology/make/model info to tell what kind of equipment they're running. An experienced expert can tell by context what the intention is, but that's not really scalable.</p>
<p>Sub-questions:</p>
<ol>
<li>Will other AM technologies like SLA/DLP be included? If so, a pretty
rigorous clarification and tagging effort will be required to
separate out these other technologies.</li>
<li>Are industrial machines in scope? </li>
</ol>
|
<p>I think all additive manufacturing techniques should be in scope. Given their popularity with consumers, most questions will naturally be regarding FDM printers. I don't see why that should rule out other techniques though: SLA machines are becoming increasingly accessible, and I think there's a $5000 SLS machine on the horizon.</p>
<p>I don't see any reason to rule out industrial machines either. With the current user base those questions might go unanswered but there's no reason this site couldn't attract industry experts when it goes public.</p>
<p>I do agree that questions should specify the make/model of 3D printer the question relates to if it's not obvious from the context.</p>
|
<p>On the question/answer trajectory we're currently following, the group would be best titled "Consumer/Hobbyist FFF 3D Printing" and not just a generic "3D Printing" group. I think some pretty aggressive moderation / self-policing will be required to make people add the necessary tags to clarify this. </p>
<p>Edit: to be clear, I'm not saying we should only include hobbyist FDM printers, I'm saying we need to require clear labeling if we intend to serve more than one type of users. </p>
| 14
|
<p><em>First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.</em></p>
<p>I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.</p>
<p>Currently there are a few options I'm looking at, the <strong>most</strong> insane of which is some kind of samba share indexer that would generate a list of things shared on the various samba servers I tell it about and upload them to a website which could then be searched and browsed.</p>
<p>It's a cheap solution, OK?</p>
<p>Ignoring the fact that the idea is obviously a couple of methods short of a class, do you chaps know of any way to link to samba file shares in html in a cross-browser way? In windows one does \\computer\share, in linux one does smb://computer/share, neither of which work afaik from browsers that aren't also used as file managers (e.g. any browser that isn't Internet Explorer).</p>
<p><strong>Some Clarifications</strong> </p>
<ul>
<li>The computers used to access this website are a mixture of WIndows (XP) and Linux (Ubuntu) with a mixture of browsers (Opera and Firefox).</li>
<li>In linux entering smb://computer/share only seems to work in Nautilus (and presumably Konqueror / Dolphin for you KDE3.5/4 people). It doesn't work in Firefox or Opera (Firefox does nothing, Opera complains the URL is invalid).</li>
<li>I don't have a Windows box handy atm so I'm unsure if \\computer\share works in anything apart from IE (e.g. Firefox / Opera).</li>
<li>If you have a better idea for consolidating a bunch of random samba shares (it certainly can't get much worse than mine ;-)) it's worth knowing that there is no guarantee that any of the servers I would be wanting to index / consolidate would be up at any particular moment. Moreover, I wouldn't want the knowledge of what they have shared lost or hidden just because they weren't available. I would want to know that they share 'foo' but they are currently down.</li>
</ul>
|
<p>Hmm, protocol handlers look interesting.</p>
<p>As <a href="https://stackoverflow.com/questions/37804/link-to-samba-shares-in-html#38258">Mark</a> said, in Windows protocol handlers can be dealt with at the OS level</p>
<p>Protocol handlers can also be done at the browser level (which is preferred, as it is cross platform and doesn't involve installing anything).</p>
<p><a href="http://kb.mozillazine.org/Register_protocol" rel="nofollow noreferrer">Summary of how it works in Firefox</a><br>
<a href="http://www.opera.com/support/search/view/535/" rel="nofollow noreferrer">Summary of how it works in Opera</a></p>
|
<p>To make the links work cross platform you could look at the User Agent either in a CGI script or in JavaScript and update your URLs appropriately.</p>
<p>Alternatively, if you want to consolidate SMB shares you could try using <a href="http://en.wikipedia.org/wiki/Distributed_File_System_(Microsoft)" rel="nofollow noreferrer">Microsoft DFS</a> (which also works with Samba).</p>
<p>You set up a DFS root and tell it about all the other SMB/Samba shares you have in your environment. Clients then connect to the root and see all the shares as if they were hosted on that single root machine; the root silently redirects clients to the correct system when they open a share.</p>
<p>Think of it as like symbolic links or a virtual file system for SMB.</p>
<p>It would solve your browsing problem. I'm not sure if it would solve your searching one.</p>
| 5,860
|
<p>When should I choose one or the other? What are the implications regarding space and (full-text) indexing?</p>
<p>BTW: I'm currently using SQL Server 2005 planing to upgrade to 2008 in the following months.</p>
<p>Thanks</p>
|
<p>The new (max) fields make it a lot easier to deal with the data from .NET code. With <code>varbinary(max)</code>, you simply set the value of a <code>SqlParameter</code> to a byte array and you are done. WIth the image field, you need to write a few hundred lines of code to stream the data into and out of the field.</p>
<p>Also, the image/text fields are deprecated in favor of <code>varbinary(max)</code> and <code>varchar(max)</code>, and future versions of Sql Server will discontinue support for them.</p>
|
<p>Once you put it in the blob, it's going to be difficult to be used for normal SQL comparison. See <a href="http://msdn.microsoft.com/en-us/library/ms178158.aspx" rel="nofollow noreferrer">Using Large-Value Data Types</a>.</p>
| 6,939
|
<p>I know I must be missing something, but in a <code>while</code> statement how does the variable hold the data, when it finishes the first pass and goes into the second pass?</p>
<hr>
<p>{</p>
<pre><code>int num1 = 0 ;
int num2 = 0;
int num3 = 0;
while (num1 < 10)
{cout << "enter your first number: ";
cin >> num1;
cout << "Enter your second number: ";
cin >> num2;
num1 = num1 + num2 ;
cout << "Number 1 is now: " << num1 <<endl;
cout << "Enter Number 3: " ;
cin >> num3;
num1 = num1 + num3;
cout << "Number 1 is now: " << num1 << endl;
num1++;
};
</code></pre>
<p>In this code. The Variable doesn't hold the data. I'm not sure what I'm doing wrong!</p>
|
<p>Is num1 the variable you're having trouble with? This line:</p>
<pre><code>cin >> num1;
</code></pre>
<p>is setting num1 to the value input by the user. So the value calculated for it in the previous run through the loop is being overwritten each time by the new input.</p>
|
<p>I'm not sure I understand your question. In C any data that's not overwritten is carried over into the next iteration of the loop, and imagine that C++ works much the same way.</p>
| 5,679
|
<p>Navision is also known as Microsoft Dynamics NAV.</p>
|
<p>Navision's application logic is written using a proprietary language called C/AL, which is loosely based on Pascal. It currently offers both a native database option as well as MS SQL Server.</p>
<p>The next version (NAV 2009) will use .NET assemblies served via IIS. C/AL logic will be translated to C# code and deployed to the server.</p>
|
<p>NAV 2009 is indeed using generated .Net assemblies, but it is WCF based. It is not required to use IIS. NAV 2009 does not support interfaces into their server code apart from the (web) services.</p>
<p>NAV 2009 includes both the new Role-Tailored Client, which uses the Service Tier and the old Classic Client, which directly accesses the NAV Database Server.</p>
| 8,708
|
<p>A very niche problem:</p>
<p>I sometimes (30% of the time) get an 'undefined handler' javascript error on line 3877 of the prototype.js library (version 1.6.0.2 from google: <a href="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js" rel="nofollow noreferrer">http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js</a>).</p>
<p>Now on this page I have a Google Map and I use the Prototype Window library.</p>
<p>The problem occurs in IE7 and FF3.</p>
<p>This is the info FireBug gives:</p>
<pre><code>handler is undefined
? in prototype.js@3871()prototype.js (line 3877)
handler.call(element, event);
</code></pre>
<p>I switched to a local version of prototypejs and added some debugging in the offending method (createWraper) but the debugging never appears before the error...</p>
<p>I googled around and found 1 other mention of the error on the same line, but no answer so I'm posting it here where maybe, some day someone will have an answer :).</p>
|
<p>I just found out this error also occurs if you accidentally leave on the parenthesis on your observer call:</p>
<pre><code>Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp());
</code></pre>
<p>instead of</p>
<pre><code>Event.observe(document, 'myapp:application_ready', myapp.MyClass.initApp);
</code></pre>
|
<blockquote>
<p>I switched to a local version of prototypejs and added some debugging
in the offending method (createWraper) but the debugging never appears
before the error...</p>
</blockquote>
<p>Actually the offending function being called when the error occurs is "wrapper" which is created inside createWrapper (but not called there). Basically what is happening is that you've attached a function as the event handler for an element, and the function doesn't actually exist. </p>
<p>If you're trying to put any debug information in to try and pinpoint which function "doesn't exist" then add your alert messages or firebug console output inside the wrapper function between lines 3871 and 3878.</p>
| 6,519
|
<p>If I create a class <code>A</code> as follows:</p>
<pre><code>class A:
def __init__(self):
self.name = 'A'
</code></pre>
<p>Inspecting the <code>__dict__</code> member looks like <code>{'name': 'A'}</code></p>
<p>If however I create a class <code>B</code>:</p>
<pre><code>class B:
name = 'B'
</code></pre>
<p><code>__dict__</code> is empty.</p>
<p>What is the difference between the two, and why doesn't <code>name</code> show up in <code>B</code>'s <code>__dict__</code>?</p>
|
<p><code>B.name</code> is a class attribute, not an instance attribute. It shows up in <code>B.__dict__</code>, but not in <code>b = B(); b.__dict__</code>.</p>
<p>The distinction is obscured somewhat because when you access an attribute on an instance, the class dict is a fallback. So in the above example, <code>b.name</code> will give you the value of <code>B.name</code>.</p>
|
<pre><code>class A:
def _ _init_ _(self):
self.name = 'A'
a = A()
</code></pre>
<p>Creates an attribute on the object instance a of type A and it can therefore be found in: <code>a.__dict__</code></p>
<pre><code>class B:
name = 'B'
b = B()
</code></pre>
<p>Creates an attribute on the class B and the attribute can be found in <code>B.__dict__</code> alternatively if you have an instance b of type B you can see the class level attributes in <code>b.__class__.__dict__</code></p>
| 5,638
|
<p>My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a <code>UIDatePicker</code> to limit date choices to a certain subset or should I just use a <code>UIPickerView</code>?</p>
|
<p>You cannot limit which dates are selectable in a <code>UIDatePicker</code>. You could change the date when the value changed event is sent, but since the user cannot tell which dates are "good" and which are not, it's a bad UI choice to do so.</p>
<p>Use a <code>UIPickerView</code> of your own making instead.</p>
|
<p><code>UIDatePicker</code> has <code>minimumDate</code> and <code>maximumDate</code> properties for this purpose. No need to use <code>UIPickerView</code> just for this reason.</p>
| 8,096
|
<p>This might be a bit on the silly side of things but I need to send the contents of a DataTable (unknown columns, unknown contents) via a text e-mail. Basic idea is to loop over rows and columns and output all cell contents into a StringBuilder using .ToString(). </p>
<p>Formatting is a big issue though. Any tips/ideas on how to make this look "readable" in a text format ? </p>
<p>I'm thinking on "padding" each cell with empty spaces, but I also need to split some cells into multiple lines, and this makes the StringBuilder approach a bit messy ( because the second line of text from the first column comes after the first line of text in the last column,etc.)</p>
|
<p>Would converting the datatable to a HTML-table and sending HTML-mail be an alternative? That would make it much nicer on the receiving end if their client supports it.</p>
|
<p>You can do smth like this (if VB):</p>
<pre><code>Dim Str As String = ""
'Create File if doesn't exist
Dim FILE_NAME As String = "C:\temp\Custom.txt"
If System.IO.File.Exists(FILE_NAME) = False Then
System.IO.File.Create(FILE_NAME)
End If
Dim objWriter As System.IO.StreamWriter
Try
objWriter = New System.IO.StreamWriter(FILE_NAME)
Catch ex As System.IO.IOException
MsgBox("Please close the file: (C:\temp\Custom.txt) before proceeding" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Exclamation)
objWriter = Nothing
Err = True
End Try
'I assume you know how to write to text file.
'Say my datagridview is named "dgrid"
Dim x,y as integer
For x = 0 to dgrid.rows.count -1
For y = 0 to dgrid.columns.count - 1
Str = dgrid.Rows(x).Cells(y).Values & " "
Next y
Next x
objWriter.Close()
</code></pre>
<p><a href="http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23041873.html" rel="nofollow noreferrer">Resource</a>.</p>
<p>Or you can even generate an <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="nofollow noreferrer">CSV</a> file from your DataTable.</p>
| 7,719
|
<p>Has anyone used both FogBugz and Axosoft's OnTime and care to offer an opinion? AxoSoft has a big <a href="http://web.archive.org/web/20090522134148/http://www.axosoft.com:80/products/ontime_competition.aspx" rel="nofollow noreferrer">feature comparison chart</a> but I'm also interested in more subjective thoughts on things like ease of use and stability.</p>
|
<p>I actually encouraged the company I work for to begin tracking bugs with software (specifically FogBugz) and have been very pleased with FogBugz. </p>
<p>We blindly let our customers send bug requests into FogBugz through email, which has it's advantages and disadvantages. But we really haven't had any problems integrating FogBugz into a team that was totally unfamiliar with any bug tracking software. Overall, I'd rate FogBugz about a 9 on ease of use and stability. </p>
|
<p>I haven't worked with FogBugz, although I recently recommended our company goes with that.
OnTime is what the company decided to use and I personally don't like OnTime because of slowness and badly organized GUI. We opted to host it ourselves, but I don't think the machine is slow. The web app doesn't really look like a web app, more like it copies a windows app, just as Brian Scott said in his answer. And don't try using the windows app over Internet (over VPN). It's awfully slow. I suppose it could be due to our Internet connection latency.</p>
<p>Of course, my experience might be different than other people's, I could be having network issues. Someone else will have to confirm my claims of slowness. :)</p>
| 3,059
|
<p>I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the tables a clustered primary key.</p>
<p>I'm wondering what the performance implications are for this approach. I've seen some people suggest that tables should have an auto-incrementing ("identity") int as a clustered primary key even if it doesn't have any meaning, as it means that the database engine itself can use that value to quickly look up a row instead of having to use a bookmark.</p>
<p>My database is merge-replicated across a bunch of servers, so I've shied away from identity int columns as they're a bit hairy to get right in replication.</p>
<p>What are your thoughts? Should tables have primary keys? Or is it ok to not have any clustered indexes if there are no sensible columns to index that way?</p>
|
<p>When dealing with indexes, you have to determine what your table is going to be used for. If you are primarily inserting 1000 rows a second and not doing any querying, then a clustered index is a hit to performance. If you are doing 1000 queries a second, then not having an index will lead to very bad performance. The best thing to do when trying to tune queries/indexes is to use the Query Plan Analyzer and SQL Profiler in SQL Server. This will show you where you are running into costly table scans or other performance blockers.</p>
<p>As for the GUID vs ID argument, you can find people online that swear by both. I have always been taught to use GUIDs unless I have a really good reason not to. Jeff has a good post that talks about the reasons for using GUIDs: <a href="https://blog.codinghorror.com/primary-keys-ids-versus-guids/" rel="noreferrer">https://blog.codinghorror.com/primary-keys-ids-versus-guids/</a>.</p>
<p>As with most anything development related, if you are looking to improve performance there is not one, single right answer. It really depends on what you are trying to accomplish and how you are implementing the solution. The only true answer is to test, test, and test again against performance metrics to ensure that you are meeting your goals.</p>
<p>[Edit]
@Matt, after doing some more research on the GUID/ID debate I came across this post. Like I mentioned before, there is not a true right or wrong answer. It depends on your specific implementation needs. But these are some pretty valid reasons to use GUIDs as the primary key:</p>
<blockquote>
<p>For example, there is an issue known as a "hotspot", where certain pages of data in a table are under relatively high currency contention. Basically, what happens is most of the traffic on a table (and hence page-level locks) occurs on a small area of the table, towards the end. New records will always go to this hotspot, because IDENTITY is a sequential number generator. These inserts are troublesome because they require Exlusive page lock on the page they are added to (the hotspot). This effectively serializes all inserts to a table thanks to the page locking mechanism. NewID() on the other hand does not suffer from hotspots. Values generated using the NewID() function are only sequential for short bursts of inserts (where the function is being called very quickly, such as during a multi-row insert), which causes the inserted rows to spread randomly throughout the table's data pages instead of all at the end - thus eliminating a hotspot from inserts.</p>
<p>Also, because the inserts are randomly distributed, the chance of page splits is greatly reduced. While a page split here and there isnt too bad, the effects do add up quickly. With IDENTITY, page Fill Factor is pretty useless as a tuning mechanism and might as well be set to 100% - rows will never be inserted in any page but the last one. With NewID(), you can actually make use of Fill Factor as a performance-enabling tool. You can set Fill Factor to a level that approximates estimated volume growth between index rebuilds, and then schedule the rebuilds during off-peak hours using dbcc reindex. This effectively delays the performance hits of page splits until off-peak times.</p>
<p>If you even <em>think</em> you might need to enable replication for the table in question - then you might as well make the PK a uniqueidentifier and flag the guid field as ROWGUIDCOL. Replication will require a uniquely valued guid field with this attribute, and it will add one if none exists. If a suitable field exists, then it will just use the one thats there.</p>
<p>Yet another huge benefit for using GUIDs for PKs is the fact that the value is indeed guaranteed unique - not just among all values generated by <em>this</em> server, but all values generated by <em>all</em> computers - whether it be your db server, web server, app server, or client machine. Pretty much every modern language has the capability of generating a valid guid now - in .NET you can use System.Guid.NewGuid. This is VERY handy when dealing with cached master-detail datasets in particular. You dont have to employ crazy temporary keying schemes just to relate your records together before they are committed. You just fetch a perfectly valid new Guid from the operating system for each new record's permanent key value at the time the record is created.</p>
<p><a href="http://forums.asp.net/t/264350.aspx" rel="noreferrer">http://forums.asp.net/t/264350.aspx</a></p>
</blockquote>
|
<p>I too have always heard having an auto-incrementing int is good for performance even if you don't actually use it.</p>
| 2,746
|
<p>From my understanding of FFF 3D printing, the glass state is usually used to heat the bed for better first layer adhesion. Other than that, does the extruder keep ex:PLA in a glass state for any reason?</p>
<p>Is the transition of the filament straight from solid to liquid for extrusion without any real regard for the glass state?</p>
|
<p><em>Note that the extruder feeds filament it doesn't heat anything, you don't want heat in the extruder. The hot end is the part that adds heat well over the glass temperature.</em></p>
<p>The <a href="https://en.m.wikipedia.org/wiki/Glass_transition" rel="nofollow noreferrer">glass transition temperature</a>, the temperature where the material transitions from a brittle "glassy" state into a viscous or rubbery state, is always lower than the melting temperature. This temperature is of importance for adhesion to the bed; in a rubbery state the stresses are much lower than in a brittle state.</p>
<blockquote>
<p>Is a thermoplastic's glass state relevant for 3D printing extrusion?</p>
</blockquote>
<ul>
<li><p>No, the glass transition temperature is not directly important for the extrusion, the extrusion temperature (where the filament is fluid enough for deposition and adhesion) is much higher than the glass temperature.</p>
</li>
<li><p>Yes, the glass transition temperature may play a role in the hot end in case of heat creeping up the cold end (usually some kind of radiator or heat dissipating element; usually connected through the heat-break), but not necessarily in melting the filament for extrusion. Heat creeping up with excessive retraction may cause filament to (partially or fully) clog and as such influence the extrusion.</p>
</li>
</ul>
|
<p>The transition from solid to liquid is the important part.</p>
<p>The bed is heated for adhesion and kept heated for the same reason, but the extruder is a lot hotter and just performs the task of solid to liquid, the fans and ambient temperature cool it to solid.</p>
<p>Once a layer is solid it will heat up again when the next layer goes on it both from heat radiating from the nozzle and the liquid plastic going on it. This should give better layer adhesion.</p>
| 2,220
|
<p>I work in a teaching hospital and we have a research project we're interested in pursuing. We'd like to 3D Print tubes we'd implant into rats to help with nerve regeneration. We're interested in the shape of the tubes right now, more so than what material it is or whether it's biocompatible etc.. </p>
<p>So this question isn't necessarily about what type of plastic or whatever we should print in. My question is more so:</p>
<blockquote>
<p>We'd like to print a tube that's 1 mm in diameter, about 1 cm
long and has as many micro "tubes" crammed through it as possible,
something like this:</p>
<p><a href="https://i.stack.imgur.com/ry5X1.png" rel="nofollow noreferrer" title="Tube containing micro tubes"><img src="https://i.stack.imgur.com/ry5X1.png" alt="Tube containing micro tubes" title="Tube containing micro tubes"></a></p>
</blockquote>
<p>I currently have a Stratasys j750 in my lab, a UPrint Se and a Prusa i3 Mk3s. They all work well but for the detail I'm looking for, come up a bit short. They have advertised accuracies of 14 microns (well, the j750) but thats just in the z direction, x and y are more like 200. If I went to get PRECISE, what technology should I look into?</p>
|
<p>This is an interesting question. A good thing to note when we start talking about SLA and other jewelry grade 3d printing, that you will have to factor in the materials toxicity when we start talking about medical applications. You can also look into DLP 3d printers but they will not have as good quality. </p>
<p>What can help you right now is these SLA printers I see that <a href="https://formlabs.com/3d-printers/form-3/tech-specs/" rel="nofollow noreferrer">form 3</a> has 25 microns, with a laser dot of 85. Well within your tolerances. Just make sure to get dental grade or medical grade resin. </p>
<p>Note that if there are bends, then you will have issues with SLA printing, depending how steep the angles are.</p>
<p>There are other technologies, such as metal 3d printing or <a href="https://en.wikipedia.org/wiki/Selective_laser_sintering" rel="nofollow noreferrer">SLS printing</a>, that will likely be <a href="https://www.allthat3d.com/metal-3d-printer/" rel="nofollow noreferrer">out of your price range</a> such as the HP Metal Jet that can do 21 -xy by 50 -z microns. Or binder based 3d printing which will have the best internal geometry, as powder will act as support, and is easily removed. </p>
<p>There are many specifically in the bio printing area that might be what you are looking for as well, this is more an alternative. You can look into what the researchers at Penn has been doing, where they have been using <a href="https://penntoday.upenn.edu/news/penn-researchers-improve-living-tissues-3d-printed-vascular-networks-made-sugar" rel="nofollow noreferrer">Sugar to create vascular networks</a>. As far as I know they do not sell it as a product at this time. Here is more information about <a href="https://medium.com/wolfram-events/3d-printed-blood-vessels-the-tech-just-became-scalable-696252e2572c" rel="nofollow noreferrer">scaling vascular networks</a> </p>
<p>See <a href="https://all3dp.com/1/types-of-3d-printers-3d-printing-technology/" rel="nofollow noreferrer">here</a> for more information about other printing technologies</p>
|
<p>FDM/FF printers can#t achieve those resolutions due to several constraints. The biggest problems are wall thickness and resolution:</p>
<p>The print needs to be made from walls that are at least one nozzle wide. Commonly available nozzles go down to the 0.15 to 0.2 mm area, so the thinnest wall has to be at least this wide or be ignored.</p>
<p>The resolution is probably an even bigger problem: common consumer grade and industrial machines can get dialed in to have errors down to the 0.1 mm. Which would be, with the aforementioned smallest nozzles, up to half a wall width shift! Shifting the print by that would destroy the functionality of the print surely.</p>
<h2>But, is there a solution?!</h2>
<p>The only solution that comes to my mind is using a resin based printer like SLA or DLP. <a href="https://all3dp.com/3d-printer-resolution/" rel="nofollow noreferrer">SLA printers</a> can get down to 0.025 mm layer height, usually demand a minimum of 0.14 mm wall thickness, but newer machines can cut that almost by two.</p>
<p>The error on the SLA Form 2 machines is, compared to its minimum wall width, pretty much nonexistent for features of about 10% larger than its spot size (0.144 mm), so for <a href="https://formlabs.com/blog/3d-printer-resolution-meaning/" rel="nofollow noreferrer">0.15 mm and up</a> it prints pretty much spot on. Extrapolating this means that you'll need a SLS machine such as the <a href="https://formlabs.com/3d-printers/form-3/tech-specs/" rel="nofollow noreferrer">Form 3</a>, for minimum reliable wall lines of roundabout 0.09 mm. However, one wall thickness is usually bad, but it might achieve walls of 2 perimeters, coming down to about 0.16 mm.</p>
| 1,284
|
<p>I'm using Marlin 1.1.0RC8 to control an MPCNC, using a RAMPS1.4. We've just added a touch-plate to do Z-probing, which works nicely for a single probe (I just want calibrated height for variant bit-lengths, not bed-leveling, but I think it amounts to the same thing). I've set it up in Marlin as <em>FIX_MOUNTED_PROBE</em>, which seems closest. </p>
<p>I can make it do a <code>G38.2 Z-50</code>, <code>G92 Z12.6</code> (which sets Z to the height of the touch-plate, 12.6mm), which is ok to be going on with, but it seems I'm having to hard-code the Z offset, which I'm sure should really be set by eg <code>Z_PROBE_OFFSET_FROM_EXTRUDER</code> or <code>M851</code>.</p>
<p>My feeling was that I should be able to invoke a G-code <code>G30</code>, and it would do a nice fast-slow double tap, do the equivalent of a <code>G92 Z+zzz</code> to set that height and then withdraw to a safe height. And after a bit of config, it does exactly that...</p>
<p>... except it doesn't do anything with the height that it measured! Seems odd. The <code>G30</code> code seems to be an elaborate way to move the head up by the clearance amount, via a touch-plate (with the added excitement of being able to crash the bed if anything goes wrong)! What's the point?</p>
<p>Have I misunderstood what <code>G30</code> is meant to do? I've read <a href="http://marlinfw.org/docs/gcode/G030.html" rel="noreferrer">the docs here</a>, and traced through <code>Marlin_main.cpp</code> and there really is no "outcome". Unless I've missed something?</p>
|
<p>I believe <code>G30</code> is a carry-over from CNC (G-code originated for CNC not printers)
I believe it is for going to a secondary reference (home) position and includes an optional by-way-of address that can be included in the command.</p>
<p>Looking at Marlin 1.1.0-1 (latest release), it seems to do what you said:</p>
<ol>
<li>Move to the requested position (if selected in command, else N/C)</li>
<li>Deploy probe</li>
<li>Go home</li>
<li>Stowe probe</li>
<li>Report the requested position and probed Z position</li>
<li>Report the current position (home?)</li>
</ol>
<p>It appears that for Marlin, there is only one reference address (home); so, it would seem a <code>G30</code> would be the same as a <code>G28</code> (go to primary reference); but, not so.</p>
<p>It looks like <code>G28</code> is a home of a different color. It looks like it homes the axis one-at-a-time and does not support a by-way-of location. Note that you can select which axis to home by adding the letters 'X' 'Y' and/or 'Z' to the command.</p>
<p>I am not sure what benefit this command has for a 3D Printer other than allowing you to alter the printer's path to home.</p>
<p>Note: Unfortunately I do not have Marlin code up and running on my printer now so I cannot confirm what I am seeing in the code.</p>
|
<p>I’ve recently had a need to use Z-probe touch
plate on my MPCNC + Ramps 1.4 + Marlin 1.1.5 setup.</p>
<p>Thought I’d share what ended up working for me.</p>
<p>In Marlin <code>Configuration.h</code>, I made the changes to enable Z-probe:</p>
<pre><code>#define USE_ZMIN_PLUG
#define Z_MIN_ENDSTOP_INVERTING true
#define Z_MIN_PROBE_ENDSTOP_INVERTING true
#define FIX_MOUNTED_PROBE
#define PROBE_DOUBLE_TOUCH
#define Z_MIN_POS -100
</code></pre>
<p>However, the following might be the key to your issue.<br>
<code>G30</code> did not do anything for me as well, until I changed
these values to 0. The <code>G30</code> now lowers Z until the Z probe
is triggered. I needed to send a <code>G92</code> to set the new Z value.<br>
Works like a champ!</p>
<pre><code>#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0
</code></pre>
<p>In case you’re interested, in ultralcd.cpp under
lcd_prepare_menu(), I added the a menu item to perform
the probe. This way I don’t need a computer to setup
the machine and launch a gcode file from the sd card. </p>
<pre><code> #if HAS_BED_PROBE
MENU_ITEM(gcode, MSG_PROBE_Z, PSTR("G30\nG92 Z19.05"));
#endif
</code></pre>
<p>Hope this is helpful for you, even after a couple years late.</p>
| 590
|
<p>I have this in a page :</p>
<pre><code><textarea id="taEditableContent" runat="server" rows="5"></textarea>
<ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent"
ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePath="/Content.asmx"
ServiceMethod="EditContent" ContextKey='<%=ContextKey %>' />
</code></pre>
<p>Basically, a DynamicPopulateExtender that fills the contents of a textarea from a webservice. Problem is, no matter how I return the line breaks, the text in the text area will have no line feeds.</p>
<p>If I return the newlines as "br/" the entire text area remains empty. If I return new lines as "/r/n" , I get all the text as one continous line. The webservice returns the string correctly:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://rprealm.com/">First line
Third line
Fourth line</string>
</code></pre>
<p>But what I get in the text area is :</p>
<pre><code>First line Third line Fourth line
</code></pre>
|
<p>The problem is that the white space is ignored by default when the XML is processed. Try to add the <code>xml:space="preserve"</code> attribute to the string element. You'll also need to define the xml prefix as <code>xmlns:xml="http://www.w3.org/XML/1998/namespace"</code>.</p>
|
<p>Try to add the following style on textarea: <strong>style="white-space: pre"</strong></p>
| 8,533
|
<p>Anyone have any idea how much power it takes to run a Creality Ender 3 3D printer every day for several hours at a time? Like what does it eat up per hour? A rough estimate of power use per hour would be nice, then I can figure out how much it costs me. Can anyone help me?</p>
|
<p>If it is really important to you to know how much you are spending per any given print, your best bet is not to guess, <em>but to know</em> how much power you're using. To that end, you could purchase a power meter which monitors your power usage. Given the right one, it can even calculate the cost of the power usage all in one little package. This link, <a href="https://wiki.ezvid.com/best-electricity-usage-monitors" rel="nofollow noreferrer">The 10 Best Electricity Usage Monitors</a>, should provide you some ideas as to what you might find, but I'm sure there are plenty more out there (NOTE: I have no affiliation to the link provided ... it was just a random one I found through a Google search ... Go Go Google-Fu!). </p>
<p>As 0scar pointed out in his comment, there are just too many variables to try and guess what the power consumption <em>might be</em>. If you are looking for a real answer, I believe something along the lines as I've linked above is going to be your best solution to getting a real answer. Anything else is more or less just a guess.</p>
|
<p>Other answers include good estimates, and show that for one printer the electricity costs are not very significant. If you are using many printers and want a concrete answer, then it would be wise to purchase a power monitor (for continuous monitoring) or multimeter with clamp.</p>
<p>With a clamp-on multimeter, you can clamp the meter on to the 3D printer's plug and read the Amps being drawn. Assuming a 120 VAC single phase supply (typical for North America), the power consumption is 120 VAC multiplied by the Amps drawn by the 3D printer (P=VI), which you can read from the multimeter.</p>
<p>The amps drawn by the 3D printer will vary throughout your print, but for a longer print, you should be able to get a good average amps read during a middle print layer. Total energy cost of printing per day would then be:</p>
<pre><code> C = (V*I/1000)*t*E*n
C, Total printer energy costs per day (<span class="math-container">$/day)
V, AC Voltage (V)
I, Average current draw during print (Amps)
t, time printers are running per day (Hours/day)
E, Energy cost from utility ($</span>/kWh)
n, number of printers
</code></pre>
| 1,268
|
<p>I have a WCF service that I have to reference from a .net 2.0 project.</p>
<p>I have tried to reference it using the "<strong>add web reference</strong>" method but it messes up the params. </p>
<p>For example, I have a method in the service that expects a <code>char[]</code> to be passed in, but when I add the web reference, the method expects an <code>int[]</code>.</p>
<p>So then I tried to setup <strong>svcutil</strong> and it worked... kind of.<br>
I could only get the service class to compile by adding a bunch of <em>.net 3.0</em> references to my <em>.net 2.0</em> project. This didn't sit well with the architect so I've had to can it (and probably for the best too).</p>
<p>So I was wondering if anyone has any pointers or resources on how I can setup a <em>.net 2.0</em> project to reference a <strong>WCF service</strong>.</p>
|
<p>One of those instances that you need to edit the WSDL. For a start a useful tool</p>
<p><a href="http://codeplex.com/storm" rel="nofollow noreferrer">http://codeplex.com/storm</a></p>
|
<p>Thanks for the resource. It certainly helped me test out the webservice, but it didn't much help with using the WCF service in my .net 2.0 application.</p>
<p>What I eventually ended up doing was going back to the architects and explaining that the 3.0 dll's that I needed to reference got compiled back to run on the 2.0 CLR. We don't necessarily like the solution, but we're going to go with it for now as there doesn't seem to be too many viable alternatives</p>
| 3,088
|
<p>When a template is added using the add-template stsadm command, it becomes available to everyone when creating a subsite. Is there any way to make it only available when a site collection is being created?</p>
|
<p>go to site actions -> Site Settings -> view all site settings -> site templates and page layouts and remove the site template from the list of allowed items.</p>
<p>Gary Lapointe may also have made an stsadm extenstion for it; check <a href="http://stsadm.blogspot.com" rel="nofollow noreferrer">stsadm.blogspot.com</a></p>
<p>Mauro Masucci
<a href="http://www.brantas.co.uk" rel="nofollow noreferrer">http://www.brantas.co.uk</a></p>
|
<p>The url to the blog post mentioned above, for hiding the stp templates using the stsadm extention, is <a href="http://stsadm.blogspot.com/2007/08/set-available-site-templates.html" rel="nofollow noreferrer">http://stsadm.blogspot.com/2007/08/set-available-site-templates.html</a></p>
<blockquote>
<p>Here’s an example of how to remove a template from the list of available templates for a site collection:</p>
<blockquote>
<p>stsadm –o gl-removeavailablesitetemplate –url "<a href="http://intranet/" rel="nofollow noreferrer">http://intranet/</a>" -template "WIKI#0" -lcid 1033 -resetallsubsites</p>
</blockquote>
</blockquote>
| 7,418
|
<p>Suddenly, my printer has started producing prints that have a very pronounced layering. Normally, the alignment between layers is very good, and the prints look very smooth. Suddenly, the prints have become much worse and the layers are misaligned with respect to each other.</p>
<p><a href="https://i.stack.imgur.com/MgWVx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MgWVx.png" alt="enter image description here"></a></p>
<p>The part on the left is my "normal" quality, while the part on the right show the deterioration. Here is another picture (in which the good part is on the right):</p>
<p><a href="https://i.stack.imgur.com/c1I5Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c1I5Q.png" alt="enter image description here"></a></p>
<p>The parts are both printed with 0.1mm layer height, and identical slicer settings/filament. I am printing on a custom-built FDM printer; the mechanism is roughly similar to that of an Ultimaker.</p>
|
<p>It appears the heatbreak of my E3D nozzle had worked itself loose from the heatsink, allowing the nozzle to wobble around a bit. Because the nozzle was still tight against the heatbreak I didn't experience any issues with my hotend, but because the heatbreak was slightly loose the nozzle wasn't properly constrained and moving around a bit.</p>
<p>A quick turn to tighten the heatsink back into the heatbreak was enough to fully resolve the issue. My prints are as smooth as ever now.</p>
|
<p>Have you recently leveled your print bed? By placing the nozzle too close to the bed on the first layer the first layer will seem over extruded. If there are no infill layers after the first layer, these layers will seem over extruded as well since the extra filament will have nowhere to go. </p>
<p>A typical sign of too close bed leveling is that the bottom layers seem over extruded, while layers after regions of infill appear normally extruded. </p>
| 115
|
<p>I don't like the AutoSize property of the Label control. I have a custom Label that draws a fancy rounded border among other things. I'm placing a <code>AutoSize = false</code> in my constructor, however, when I place it in design mode, the property always is True. </p>
<p>I have overridden other properties with success but this one is happily ignoring me. Does anybody has a clue if this is "by MS design"?</p>
<p>Here's the full source code of my Label in case anyone is interested.</p>
<pre><code>using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Dentactil.UI.WinControls
{
[DefaultProperty("TextString")]
[DefaultEvent("TextClick")]
public partial class RoundedLabel : UserControl
{
private static readonly Color DEFAULT_BORDER_COLOR = Color.FromArgb( 132, 100, 161 );
private const float DEFAULT_BORDER_WIDTH = 2.0F;
private const int DEFAULT_ROUNDED_WIDTH = 16;
private const int DEFAULT_ROUNDED_HEIGHT = 12;
private Color mBorderColor = DEFAULT_BORDER_COLOR;
private float mBorderWidth = DEFAULT_BORDER_WIDTH;
private int mRoundedWidth = DEFAULT_ROUNDED_WIDTH;
private int mRoundedHeight = DEFAULT_ROUNDED_HEIGHT;
public event EventHandler TextClick;
private Padding mPadding = new Padding(8);
public RoundedLabel()
{
InitializeComponent();
}
public Cursor TextCursor
{
get { return lblText.Cursor; }
set { lblText.Cursor = value; }
}
public Padding TextPadding
{
get { return mPadding; }
set
{
mPadding = value;
UpdateInternalBounds();
}
}
public ContentAlignment TextAlign
{
get { return lblText.TextAlign; }
set { lblText.TextAlign = value; }
}
public string TextString
{
get { return lblText.Text; }
set { lblText.Text = value; }
}
public override Font Font
{
get { return base.Font; }
set
{
base.Font = value;
lblText.Font = value;
}
}
public override Color ForeColor
{
get { return base.ForeColor; }
set
{
base.ForeColor = value;
lblText.ForeColor = value;
}
}
public Color BorderColor
{
get { return mBorderColor; }
set
{
mBorderColor = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_BORDER_WIDTH)]
public float BorderWidth
{
get { return mBorderWidth; }
set
{
mBorderWidth = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_ROUNDED_WIDTH)]
public int RoundedWidth
{
get { return mRoundedWidth; }
set
{
mRoundedWidth = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_ROUNDED_HEIGHT)]
public int RoundedHeight
{
get { return mRoundedHeight; }
set
{
mRoundedHeight = value;
Invalidate();
}
}
private void UpdateInternalBounds()
{
lblText.Left = mPadding.Left;
lblText.Top = mPadding.Top;
int width = Width - mPadding.Right - mPadding.Left;
lblText.Width = width > 0 ? width : 0;
int heigth = Height - mPadding.Bottom - mPadding.Top;
lblText.Height = heigth > 0 ? heigth : 0;
}
protected override void OnLoad(EventArgs e)
{
UpdateInternalBounds();
base.OnLoad(e);
}
protected override void OnPaint(PaintEventArgs e)
{
SmoothingMode smoothingMode = e.Graphics.SmoothingMode;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
int roundedWidth = RoundedWidth > (Width - 1)/2 ? (Width - 1)/2 : RoundedWidth;
int roundedHeight = RoundedHeight > (Height - 1)/2 ? (Height - 1)/2 : RoundedHeight;
GraphicsPath path = new GraphicsPath();
path.AddLine(0, roundedHeight, 0, Height - 1 - roundedHeight);
path.AddArc(new RectangleF(0, Height - 1 - 2*roundedHeight, 2*roundedWidth, 2*roundedHeight), 180, -90);
path.AddLine(roundedWidth, Height - 1, Width - 1 - 2*roundedWidth, Height - 1);
path.AddArc(new RectangleF(Width - 1 - 2*roundedWidth, Height - 1 - 2*roundedHeight, 2*roundedWidth, 2*roundedHeight), 90, -90);
path.AddLine(Width - 1, Height - 1 - roundedHeight, Width - 1, roundedHeight);
path.AddArc(new RectangleF(Width - 1 - 2*roundedWidth, 0, 2*roundedWidth, 2*roundedHeight), 0, -90);
path.AddLine(Width - 1 - roundedWidth, 0, roundedWidth, 0);
path.AddArc(new RectangleF(0, 0, 2*roundedWidth, 2*roundedHeight), -90, -90);
e.Graphics.DrawPath(new Pen(new SolidBrush(BorderColor), BorderWidth), path);
e.Graphics.SmoothingMode = smoothingMode;
base.OnPaint(e);
}
protected override void OnResize(EventArgs e)
{
UpdateInternalBounds();
base.OnResize(e);
}
private void lblText_Click(object sender, EventArgs e)
{
if (TextClick != null)
{
TextClick(this, e);
}
}
}
}
</code></pre>
<p>(there are some issues with Stack Overflow's markup and the Underscore, but it's easy to follow the code).</p>
<hr>
<p>I have actually removed that override some time ago when I saw that it wasn't working. I'll add it again now and test. Basically I want to replace the Label with some new label called: IWillNotAutoSizeLabel ;)</p>
<p>I basically hate the autosize property "on by default".</p>
|
<p>I've seen similar behaviour when setting certain properties of controls in the constructor of the form itself. They seem to revert back to their design-time defaults.</p>
<p>I notice you're already overriding the OnLoad method. Have you tried setting AutoSize = false there? Or are you mainly concerned with providing a <em>default</em> value of false?</p>
|
<p>I don't see <code>this.AutoSize = false</code> in your constructor. Your class is marked as partial -- perhaps you have a constructor in another file with that line. The visual studio designer will call that parameterless constructor you've got there.</p>
| 4,483
|
<p>Background: I have a little video playing app with a UI inspired by the venerable Sasami2k, just updated to use VMR9 (i.e. Direct3D9 with DirectShow) and be less unstable. Currently, it's a C++ app using raw Win32, through necessity: none of the various toolkits are worth a damn. WPF, in particular, was not possible, due to its airspace restrictions.</p>
<p>OK, so, now that D3DImage exists it might be viable to mix and match D3D/VMR9/DirectShow and WPF. Given past frustrations with Win32's inextensibility, this seems like a good thing.</p>
<p>But y'know, I'm falling at the first hurdle here.</p>
<p>With Win32 I have created (very easily) a borderless window that's resizable, resizes proportionately, snaps to the screen edges, and takes up the whole screen (including taskbar area) when maximized. It's a video app, so these are all pretty desirable properties.</p>
<p>OK, so, how to do the same with WPF?</p>
<p>In Win32, I use:
WM_GETMINMAXINFO to control the maximize behaviour
WM_NCHITTEST to control the resize borders
WM_MOVING to control the snap-to-screen-edges
WM_SIZING to control the resize aspect ratio</p>
<p>However, looking at WPF it seems that the various events arrive too late, unless I'm misunderstanding the documentation?</p>
<p>For example, I don't know when I'm mid-move, as LocationChanged says it fires only once the window has moved (which is too late).
Similarly, it appears that StateChanged only fires once the window has been restored/maximized (when I need the information prior to the maximize, to tell the system the correct maximize size).</p>
<p>And I seem to be completely overlooking where the system tells me about resizes. Likewise the hit testing.</p>
<p>So, uh, am I missing something here, or do I have no choice but to drop back to hooking the wndproc of this thing anyway? Can I do what I want without hooking the WndProc?</p>
<p>If I have to use the WndProc I might as well stick with my existing codebase; I want to have simpler, cleaner UI code, and moving away from the WndProc is fundamental to this.</p>
<p>If I do have to hook the WndProc, I have to wonder--<em>why</em>? Win32 has got the sizing/sized, moving/moved, poschanging/poschanged window messages, and they're all useful. Why wouldn't WPF replicate the same set of events? It seems like an unnecessary gap in functionality.</p>
<p>Plus, it means that WPF is tied to a specific USER32-dependent implementation. This means that MS can't (in Windows 7 or 8, say) invert the display layer to make WPF "native" and emulate HWNDs and WndProcs for legacy apps--even though this is precisely what MS should be doing.</p>
|
<blockquote>
<p>And I seem to be completely overlooking where the system tells me about resizes. Likewise the hit testing.</p>
</blockquote>
<p>For the resizing you're indeed missing the <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.sizechanged.aspx" rel="nofollow noreferrer">SizeChanged</a> event.
AFAIK there is sadly no OnSizeChanging, OnLocationChanging and OnStateChanging event on a <a href="http://msdn.microsoft.com/en-us/library/system.windows.window_events.aspx" rel="nofollow noreferrer">Window</a> in .NET</p>
<hr>
<blockquote>
<p>I saw that one, but as far as I can tell it only fires after the size has changed, whereas I need the event to fire during the resize. Unless I'm misreading the docs and it
actually fires continuously?</p>
</blockquote>
<p>It does not fire continuously but you can probably use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.resizebegin.aspx" rel="nofollow noreferrer">ResizeBegin</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.resizeend.aspx" rel="nofollow noreferrer">ResizeEnd</a> events and be able to do that.</p>
<hr>
<blockquote>
<p>Aren't they WinForms events?</p>
</blockquote>
<p>Hmm, you're right.</p>
|
<p>Can you perhaps override the ArrangeOverride and/or MeasureOverride to make up for those missing resize events? Measure is the first pass, and occurs when a layout needs to adjust for a new size, so it's kind of like a size changing event.</p>
| 4,738
|
<p>I'm drawing old school (unthemed - themed radios are a whole other problem) radio buttons myself using DrawFrameControl:</p>
<pre><code>DrawFrameControl(dc, &rectRadio, DFC_BUTTON, isChecked() ? DFCS_BUTTONRADIO | DFCS_CHECKED : DFCS_BUTTONRADIO);
</code></pre>
<p>I've never been able to figure out a sure fire way to figure out what to pass for the RECT. I've been using a 12x12 rectangle but I'de like Windows to tell me the size of a radio button.</p>
<p>DrawFrameControl seems to scale the radio button to fit the rect I pass so I have to be close to the "right" size of the radio looks off from other (non-owner drawn) radios on the screen.</p>
<p>Anyone know how to do this? </p>
|
<p>It has been a while since I worked on this, so what I am describing is what I did, and not necessarily a direct answer to the question.</p>
<p>I happen to use bit maps 13 x 13 rather than 12 x 12. The bitmap part of the check box seems to be passed in the WM_DRAWITEM. However, I had also set up WM_MEASUREITEM and fed it the same values, so my answer may well be "Begging the question" in the correct philosophical sense.</p>
<pre>
case WM_MEASUREITEM:
lpmis = (LPMEASUREITEMSTRUCT) lParam;
lpmis->itemHeight = 13;
lpmis->itemWidth = 13;
break;
case WM_DRAWITEM:
lpdis = (LPDRAWITEMSTRUCT) lParam;
hdcMem = CreateCompatibleDC(lpdis->hDC);
if (lpdis->itemState & ODS_CHECKED) // if selected
{
SelectObject(hdcMem, hbmChecked);
}
else
{
if (lpdis->itemState & ODS_GRAYED)
{
SelectObject(hdcMem, hbmDefault);
}
else
{
SelectObject(hdcMem, hbmUnChecked);
}
}
StretchBlt(
lpdis->hDC, // destination DC
lpdis->rcItem.left, // x upper left
lpdis->rcItem.top, // y upper left
// The next two lines specify the width and
// height.
lpdis->rcItem.right - lpdis->rcItem.left,
lpdis->rcItem.bottom - lpdis->rcItem.top,
hdcMem, // source device context
0, 0, // x and y upper left
13, // source bitmap width
13, // source bitmap height
SRCCOPY); // raster operation
DeleteDC(hdcMem);
return TRUE;
</pre>
<p>This seems to work well for both Win2000 and XP, though I have nbo idea what Vista might do.</p>
<p>It might be worth an experiment to see what leaving out WM_MEASUREITEM does, though I usually discover with old code that I usually had perfectly good reason for doing something that looks redundant.</p>
|
<p>It has been a while since I worked on this, so what I am describing is what I did, and not necessarily a direct answer to the question.</p>
<p>I happen to use bit maps 13 x 13 rather than 12 x 12. The bitmap part of the check box seems to be passed in the WM_DRAWITEM. However, I had also set up WM_MEASUREITEM and fed it the same values, so my answer may well be "Begging the question" in the correct philosophical sense.</p>
<pre>
case WM_MEASUREITEM:
lpmis = (LPMEASUREITEMSTRUCT) lParam;
lpmis->itemHeight = 13;
lpmis->itemWidth = 13;
break;
case WM_DRAWITEM:
lpdis = (LPDRAWITEMSTRUCT) lParam;
hdcMem = CreateCompatibleDC(lpdis->hDC);
if (lpdis->itemState & ODS_CHECKED) // if selected
{
SelectObject(hdcMem, hbmChecked);
}
else
{
if (lpdis->itemState & ODS_GRAYED)
{
SelectObject(hdcMem, hbmDefault);
}
else
{
SelectObject(hdcMem, hbmUnChecked);
}
}
StretchBlt(
lpdis->hDC, // destination DC
lpdis->rcItem.left, // x upper left
lpdis->rcItem.top, // y upper left
// The next two lines specify the width and
// height.
lpdis->rcItem.right - lpdis->rcItem.left,
lpdis->rcItem.bottom - lpdis->rcItem.top,
hdcMem, // source device context
0, 0, // x and y upper left
13, // source bitmap width
13, // source bitmap height
SRCCOPY); // raster operation
DeleteDC(hdcMem);
return TRUE;
</pre>
<p>This seems to work well for both Win2000 and XP, though I have nbo idea what Vista might do.</p>
<p>It might be worth an experiment to see what leaving out WM_MEASUREITEM does, though I usually discover with old code that I usually had perfectly good reason for doing something that looks redundant.</p>
| 8,703
|
<p>I am printing Benchies at high speed, I successfully printed one at 300 mm/s. If I set the speed to 400 mm/s, the Y axis begins shifting around. This is usually accompanied by a banging sound.</p>
<p>In addition, the extruder motor occasionally clicks. When it clicks, the filament shoots back out a little bit.</p>
<p>Print settings:</p>
<ul>
<li>Infill: 100 %</li>
<li>Hotend: 200 °C</li>
<li>Bed: 60 °C</li>
<li>Material: PLA</li>
<li>Infill: Lines</li>
<li>Walls: 2</li>
<li>Top/bottom layers: 2</li>
<li>Speed: 400 mm/s</li>
<li>Jerk: 400 mm/s</li>
<li>Acceleration: 1000000</li>
</ul>
<p>I am running custom Marlin-based firmware on the stock mainboard.</p>
<p>The printer shakes my desk when printing like this.</p>
|
<p>TL;DR: Don't do that.</p>
<p>Detailed answer: You need motion limit parameters that actually make physical sense, and firmware capable of executing a motion plan according to them. Your jerk and acceleration settings absolutely don't. Marlin's whole implementation of jerk is wacky (note: modern Marlin versions don't even use it but an alternative they call "junction deviation" instead) and likely to cause problems above very low values; I never was able to take it above 25 or so on Marlin without layer shifts. Acceleration is dependent on the stepper motor torque and the mass you'll be accelerating. For the Y axis, that's the bed, and it has enough mass you won't accelerate it above 12000 mm/s² or so, much less the requested 1 km/s² plus near-infinite acceleration from the extreme near-instantaneous 400 mm/s velocity change ("jerk").</p>
<p>The speed of 400 mm/s is achievable if you don't do it instantaneously. Stepper motors begin to rapidly lose torque beyond a certain speed due to limits on how fast the magnetic field can build up and be reversed, which has to happen for each step. <a href="https://www.daycounter.com/Calculators/Stepper-Motor-Calculator.phtml" rel="noreferrer">This calculator</a> can compute the limits if you know the properties of your motor. For the Ender 3 Y axis motor, the limit is around 425 mm/s or so if I'm remembering right.</p>
<p>For actual print speed, though, the hotend and extruder cannot keep up with anything nearly that high. 150 mm/s is about the limit with that hotend, and it might even be lower with a stock extruder. Fortunately, Benchy is mostly acceleration-bound, not top-speed-bound, so if you can get your acceleration profile right, you can still print quite fast.</p>
<p>Now the next limit you'll hit is Marlin. Marlin is... not good at high speeds and accelerations. Often the layer shifts you hit with Marlin aren't even physical limits but Marlin bugs. If you want to go fast, you need Klipper, not only because it lacks these step timing bugs, but because you need its Input Shaper feature to keep the high acceleration from tearing your printer apart (literally, vibrating all the screws out!).</p>
|
<p>Ok, so you are having multiple problems, lets break it down:</p>
<p>At the speed you are pushing, it would not be weird to have the Y belt slipping around. Also inertia comes into play, so please, dont do that.</p>
<p>What you are mentioning about the filament going out a bit, also makes sense. You are exceeding the max volumetric flowrate for the ender 3. I would recommend going for a higher flow nozzle/Hotend combo.</p>
| 2,028
|
<p>I've got a problem here with an MSI deployment that I'm working on (using <a href="http://en.wikipedia.org/wiki/InstallShield" rel="nofollow noreferrer">InstallShield</a>). We have a program running in the background that needs to run per-user, and it needs to start automatically without user intervention.</p>
<p>The problem is with <a href="http://en.wikipedia.org/wiki/Group_Policy#Operation" rel="nofollow noreferrer">Group Policy Object</a>/<a href="http://en.wikipedia.org/wiki/Active_Directory" rel="nofollow noreferrer">Active Directory</a> (GPO/AD) deployment the application is started in the SYSTEM context before anyone is logged in rather than as the user who is about to log in. The application can only run once per user, and it seems that the SYSTEM process prevents the USER process from starting. This means the PCs need to be rebooted twice before the software can be deployed to the users. How do we to stop this?</p>
<p>Basically the current workflow is: </p>
<ol>
<li>Installation/upgrade runs... kill background application</li>
<li>Install new files</li>
<li>Startup background application</li>
</ol>
<p>This works for published applications and interactive <a href="http://en.wikipedia.org/wiki/Windows_Installer" rel="nofollow noreferrer">MSI</a> installations - it's only 'assigned' applications that seem to have the problem. As step 3 happens in the SYSTEM context rather than the user context :(</p>
<p>Ideally, I'd have the development team patch the EXE file to prevent launching in the SYSTEM context, but that's a release cycle away, and I'm looking for an installer-based solution for the interim.</p>
<p>(I don't know Installscript... So I'm guessing <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a> is probably the way to go if there's no native InstallShield stuff I can use.)</p>
|
<p>You can use the <a href="http://msdn.microsoft.com/en-us/library/aa369780(VS.85).aspx" rel="noreferrer">LogonUser</a> property of Windows Installer as a condition to the action launching the EXE.</p>
|
<p>AHA! I knew there had to be a cleaner solution... the code I was working on was starting to look something like this:</p>
<pre class="lang-vb prettyprint-override"><code>On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'BackgroundProcess.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If strNameOfUser = "SYSTEM" Then
objProcess.Terminate()
End If
Next
</code></pre>
| 4,953
|
<p>Although somewhat related to <a href="https://stackoverflow.com/questions/4409/is-the-desktop-app-dead">this question</a>, I have what I think is a different take on it.</p>
<p>Is a desktop app that has no connections to the "cloud" dead? I believe that some things are going to continue to be on the machine (operating systems obviously, browsers, some light-weight applications), but more and more things are moving to network-based applications (see Google Docs for office suites, GMail and other web-email clients for email, flickr for photo management, and more).</p>
<p>So other than the lightweight applications, is there anything that, in 5 to 10 years, will continue to be (either out of necessity or just demand) remain on the desktop and off the cloud?</p>
|
<p>10 years or more ago this would have been, "Are non-internet applications dead?"</p>
<p>There's things the cloud does better than desktop applications, and in those places I'm sure non-cloud applications will become increasingly rare. But there's plenty of applications where you might not want to use the cloud, the benefits don't outweigh the costs, or the complexity just isn't worth it.</p>
<p>It's a new tool, and it's a better tool than desktop applications for many things. However, you don't throw away a hammer when you buy a screwdriver, you simply reserve it for when a nail needs to be driven.</p>
|
<p>I personally will never leave my stuff on the web under someone else's control. All of my photos and e-mails I keep on local hard drives that I control. </p>
<p>I prefer to make my own stuff available to me through the web on my own hardware. The only way to have reasonable performance and be productive when offline is to use local apps. </p>
<p>To me the future will be local, but remotely accessible and synchronized. At least for the next 20 years or so.</p>
<p>Not only do I think it's not dead, I think it's the way everyone will want to go once we have a few disastrous failures (ie, websites disappearing with users content that isn't backed up anywhere or severe privacy breeches as some large company loses control of access to the data they are protecting).</p>
| 7,576
|
<p>I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this:</p>
<p>DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell());</p>
<p>You see that I need a CheckBox cell template.</p>
<p>The problem I face is that this column is constantly readonly/disabled, as if it would be of TextBox type. It doesn't show a checkbox at all.</p>
<p>Any thoughts on how to work with editable checkbox columns for DataGridView?</p>
<p>Update: For windows forms, please.</p>
<p>Thanks.</p>
|
<p>Well, after more than 4 hours of debugging, I have found that the DataGridView row height was too small for the checkbox to be painted, so it was not displayed at all. I have found this after an accidental row height resizing.</p>
<p>As a solution, you can set the AutoSizeRowsMode to AllCells.</p>
<p><code>richDataGrid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;</code></p>
|
<p>Create a TemplateField and bound the id to it, something like this:</p>
<pre><code><asp:TemplateField HeaderText="Whatever" SortExpression="fieldname" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox runat="server" ID="rowCheck" key='<%# Eval("id") %>' />
</ItemTemplate>
</asp:TemplateField>
</code></pre>
| 9,670
|
<p>I have an application on which I am implementing localization.</p>
<p>I now need to dynamically reference a name in the resouce file.</p>
<p>assume I have a resource file called Login.resx, an a number of strings: foo="hello", bar="cruel" and baz="world"</p>
<p>normally, I will refer as:
String result =Login.foo;
and result=="hello";</p>
<p>my problem is, that at code time, I do not know if I want to refer to foo, bar or baz - I have a string that contains either "foo", "bar" or "baz". </p>
<p>I need something like:</p>
<p>Login["foo"];</p>
<p>Does anyone know if there is any way to dynamically reference a string in a resource file?</p>
|
<p>You'll need to instance a <a href="http://msdn.microsoft.com/en-us/library/aa984408%28VS.71%29.aspx" rel="noreferrer"><code>ResourceManager</code></a> for the <code>Login.resx</code>:</p>
<pre><code>var resman = new System.Resources.ResourceManager(
"RootNamespace.Login",
System.Reflection.Assembly.GetExecutingAssembly()
)
var text = resman.GetString("resname");
</code></pre>
<p>It might help to look at the generated code in the code-behind files of the resource files that are created by the IDE. These files basically contain readonly properties for each resource that makes a query to an internal resource manager.</p>
|
<p>If you put your Resource file in the App_GlobalResources folder like I did, you need to use</p>
<blockquote>
<p>global::System.Resources.ResourceManager
temp = new
global::System.Resources.ResourceManager("RootNamespace.Login",
global::System.Reflection.Assembly.Load("App_GlobalResources"));</p>
</blockquote>
<p>It took me a while to figure this out. Hope this will help someone. :)</p>
| 4,966
|
<p>In Visual Basic, is there a performance difference when using the <code>IIf</code> function instead of the <code>If</code> statement?</p>
|
<p>VB has the following <code>If</code> statement which the question refers to, I think:</p>
<pre><code>' Usage 1
Dim result = If(a > 5, "World", "Hello")
' Usage 2
Dim foo = If(result, "Alternative")
</code></pre>
<p>The first is basically C#'s ternary conditional operator and the second is its coalesce operator (return <code>result</code> unless it’s <code>Nothing</code>, in which case return <code>"Alternative"</code>). <code>If</code> has thus replaced <code>IIf</code> and the latter is obsolete.</p>
<p>Like in C#, VB's conditional <code>If</code> operator short-circuits, so you can now safely write the following, which is not possible using the <code>IIf</code> function:</p>
<pre><code>Dim len = If(text Is Nothing, 0, text.Length)
</code></pre>
|
<p>Those functions are different! Perhaps you only need to use IF statement.
IIF will always be slower, because it will do both functions plus it will do standard IF statement.</p>
<p>If you are wondering why there is IIF function, maybe this will be explanation:</p>
<pre><code>Sub main()
counter = 0
bln = True
s = iif(bln, f1, f2)
End Sub
Function f1 As String
counter = counter + 1
Return "YES"
End Function
Function f2 As String
counter = counter + 1
Return "NO"
End Function
</code></pre>
<p>So the counter will be 2 after this, but s will be "YES" only. I know this counter stuff is useless, but sometimes there are functions that you will need both to run, doesn't matter if IF is true or false, and just assign value from one of them to your variable.</p>
| 4,803
|
<p>Why is <code>Array.Length</code> an int, and not a <code>uint</code>. This bothers me (just a bit) because a length value can never be negative. </p>
<p>This also forced me to use an int for a length-property on my own class, because when you
specify an int-value, this needs to be cast explicitly...</p>
<p>So the ultimate question is: is there any use for an unsigned int (<code>uint</code>)? Even Microsoft seems not to use them.</p>
|
<p>Unsigned int isn't CLS compliant and would therefore restrict usage of the property to those languages that do implement a <code>UInt</code>. </p>
<p>See here:</p>
<p>Framework 1.1</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/hfa3fa08(VS.71).aspx" rel="noreferrer">Introduction to the .NET Framework Class Library</a></p>
</blockquote>
<p>Framework 2.0</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/hfa3fa08(VS.80).aspx" rel="noreferrer">.NET Framework Class Library Overview </a></p>
</blockquote>
|
<p>Typically, integer values are signed, unless you explicitly need an unsigned value. It's just the way they are used. I may not agree with that choice, but that's just the way it is.</p>
<p>For the time being, with todays typical memory constraints, if your array or similar data structure needs an UInt32 length, you should consider other data structures.</p>
<p>With an array of bytes, Int32 will give you 2GB of values</p>
| 2,806
|
<p>I have a <code>DataTable</code> with a <code>Name</code> column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the <em>order by</em> clause.</p>
<pre><code>var names =
(from DataRow dr in dataTable.Rows
orderby (string)dr["Name"]
select (string)dr["Name"]).Distinct();
</code></pre>
<p>Why does the <code>orderby</code> not get enforced?</p>
|
<p><strong>The problem is that the Distinct
operator does not grant that it will
maintain the original order of
values.</strong></p>
<p>So your query will need to work like this</p>
<pre><code>var names = (from DataRow dr in dataTable.Rows
select (string)dr["Name"]).Distinct().OrderBy( name => name );
</code></pre>
|
<p>Try the following</p>
<pre><code>var names = (from dr in dataTable.Rows
select (string)dr["Name"]).Distinct().OrderBy(name => name);
</code></pre>
<p>this should work for what you need.</p>
| 2,246
|
<p>I am currently trying to print a company logo on another part I have printed in a different colour. To try and maximise the strength of the part, I need to print the part on a different orientation to what I intend on printing the logo on. As a result I need to in a sense re-adhere the part to the bed so I can print the logo. I am using PLA filament on a spring steel sheet (the default sheet with a Prusa Mini).</p>
<p>Any ideas would be appreciated before I accept defeat and just glue the parts together.</p>
|
<p>I have not done this, but I believe this is the best method and I want to test it at some point soon:</p>
<p>Model a negative for the footprint of the part you want to adhere to the bed, in the orientation you want to adhere it, with just a few mm of height, and clearance suitable for your printer (probably around 0.25 mm) in the XY plane, and print that with thick extrusions on the initial layer so that it adheres well to your bed. It should look exactly like a "thickened brim" for the part you want to re-adhere. Don't let the bed cool after printing it.</p>
<p>Now, you have a slot to insert your part into that will not only hold it to the bed, but holds it to particular coordinates you chose to print at, which you can align to the coordinates of the new model you want to print on top of it.</p>
<p>If you can't get the clearances right to hold without knocking off the negative footprint from the bed, you could try adding some threaded holes to it, so that you can put a couple set screws through it to hold the part in place. This technique can also be used if you want to avoid modeling a full negative (e.g. if you don't have the original in CAD form where you can easily negative it) - just print a few posts to hold set screws in approximately the right places on the bed.</p>
|
<p>Adherence is the 3D printer's worst enemy.</p>
<p>I use painter's tape, but I heard that you can if you need to remove and re-stick it back, heat the part lightly with a lighter and re-stick it back to the bed. Never tried but I'm guessing you would need to cool the bed, heat the part, and stick it back then reheat the bed and continue to print.</p>
<p>Glue sticks can maybe help or even hot glue. But I would be afraid in that case that the part wouldn't be level hence the glue would be to tick.</p>
| 1,922
|
<p>I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation)</p>
<p>I've chosen the <a href="http://en.wikipedia.org/wiki/Weibull_distribution" rel="nofollow noreferrer">Weibull</a> distribution as it "sort of" matches the distribution I've observed (ramps up quickly, drops off quickly but not instantly)</p>
<p>I use this distribution to generate the number of requests that should be sent each day between a given start and end date</p>
<p>I've hacked together an algorithm in Python that sort of works but it feels kludgy:</p>
<pre><code>how_many_days = (end_date - start_date).days
freqs = defaultdict(int)
for x in xrange(how_many_responses):
freqs[int(how_many_days * weibullvariate(0.5, 2))] += 1
timeline = []
day = start_date
for i,freq in sorted(freqs.iteritems()):
timeline.append((day, freq))
day += timedelta(days=1)
return timeline
</code></pre>
<p>What better ways are there to do this? </p>
|
<p>This is quick and probably not that accurate, but if you calculate the PDF yourself, then at least you make it easier to lay several smaller/larger ones on a single timeline. <code>dev</code> is the std deviation in the Guassian noise, which controls the roughness. Note that this is <em>not</em> the 'right' way to generate what you want, but it's easy.</p>
<pre><code>import math
from datetime import datetime, timedelta, date
from random import gauss
how_many_responses = 1000
start_date = date(2008, 5, 1)
end_date = date(2008, 6, 1)
num_days = (end_date - start_date).days + 1
timeline = [start_date + timedelta(i) for i in xrange(num_days)]
def weibull(x, k, l):
return (k / l) * (x / l)**(k-1) * math.e**(-(x/l)**k)
dev = 0.1
samples = [i * 1.25/(num_days-1) for i in range(num_days)]
probs = [weibull(i, 2, 0.5) for i in samples]
noise = [gauss(0, dev) for i in samples]
simdata = [max(0., e + n) for (e, n) in zip(probs, noise)]
events = [int(p * (how_many_responses / sum(probs))) for p in simdata]
histogram = zip(timeline, events)
print '\n'.join((d.strftime('%Y-%m-%d ') + "*" * c) for d,c in histogram)
</code></pre>
|
<p>Instead of giving the number of requests as a fixed value, why not use a scaling factor instead? At the moment, you're treating requests as a limited quantity, and randomising the days on which those requests fall. It would seem more reasonable to treat your requests-per-day as independent.</p>
<pre><code>from datetime import *
from random import *
timeline = []
scaling = 10
start_date = date(2008, 5, 1)
end_date = date(2008, 6, 1)
num_days = (end_date - start_date).days + 1
days = [start_date + timedelta(i) for i in range(num_days)]
requests = [int(scaling * weibullvariate(0.5, 2)) for i in range(num_days)]
timeline = zip(days, requests)
timeline
</code></pre>
| 7,732
|
<p>Does any one know how do I get the current open windows or process of a local machine using Java? </p>
<p>What I'm trying to do is: list the current open task, windows or process open, like in Windows Taskmanager, but using a multi-platform approach - using only Java if it's possible.</p>
|
<p>This is another approach to parse the the process list from the command "<strong>ps -e</strong>":</p>
<pre><code>try {
String line;
Process p = Runtime.getRuntime().exec("ps -e");
BufferedReader input =
new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line); //<-- Parse data here.
}
input.close();
} catch (Exception err) {
err.printStackTrace();
}
</code></pre>
<p>If you are using Windows, then you should change the line: "Process p = Runtime.getRun..." etc... (3rd line), for one that looks like this:</p>
<pre><code>Process p = Runtime.getRuntime().exec
(System.getenv("windir") +"\\system32\\"+"tasklist.exe");
</code></pre>
<p>Hope the info helps!</p>
|
<pre><code>package com.vipul;
import java.applet.Applet;
import java.awt.Checkbox;
import java.awt.Choice;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class BatchExecuteService extends Applet {
public Choice choice;
public void init()
{
setFont(new Font("Helvetica", Font.BOLD, 36));
choice = new Choice();
}
public static void main(String[] args) {
BatchExecuteService batchExecuteService = new BatchExecuteService();
batchExecuteService.run();
}
List<String> processList = new ArrayList<String>();
public void run() {
try {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("D:\\server.bat");
process.getOutputStream().close();
InputStream inputStream = process.getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(
inputStream);
BufferedReader bufferedrReader = new BufferedReader(
inputstreamreader);
BufferedReader bufferedrReader1 = new BufferedReader(
inputstreamreader);
String strLine = "";
String x[]=new String[100];
int i=0;
int t=0;
while ((strLine = bufferedrReader.readLine()) != null)
{
// System.out.println(strLine);
String[] a=strLine.split(",");
x[i++]=a[0];
}
// System.out.println("Length : "+i);
for(int j=2;j<i;j++)
{
System.out.println(x[j]);
}
}
catch (IOException ioException)
{
ioException.printStackTrace();
}
}
}
</code></pre>
<blockquote>
<pre><code> You can create batch file like
</code></pre>
<p>TASKLIST /v /FI "STATUS eq running" /FO "CSV" /FI "Username eq LHPL002\soft" /FI "MEMUSAGE gt 10000" /FI "Windowtitle ne N/A" /NH</p>
</blockquote>
| 7,828
|
<p>How can I request a random row (or as close to truly random as is possible) in pure SQL?</p>
|
<p>See this post: <a href="http://www.petefreitag.com/item/466.cfm" rel="noreferrer">SQL to Select a random row from a database table</a>. It goes through methods for doing this in MySQL, PostgreSQL, Microsoft SQL Server, IBM DB2 and Oracle (the following is copied from that link):</p>
<p>Select a random row with MySQL:</p>
<pre><code>SELECT column FROM table
ORDER BY RAND()
LIMIT 1
</code></pre>
<p>Select a random row with PostgreSQL:</p>
<pre><code>SELECT column FROM table
ORDER BY RANDOM()
LIMIT 1
</code></pre>
<p>Select a random row with Microsoft SQL Server:</p>
<pre><code>SELECT TOP 1 column FROM table
ORDER BY NEWID()
</code></pre>
<p>Select a random row with IBM DB2</p>
<pre><code>SELECT column, RAND() as IDX
FROM table
ORDER BY IDX FETCH FIRST 1 ROWS ONLY
</code></pre>
<p>Select a random record with Oracle:</p>
<pre><code>SELECT column FROM
( SELECT column FROM table
ORDER BY dbms_random.value )
WHERE rownum = 1
</code></pre>
|
<p>I have to agree with CD-MaN: Using "ORDER BY RAND()" will work nicely for small tables or when you do your SELECT only a few times.</p>
<p>I also use the "num_value >= RAND() * ..." technique, and if I really want to have random results I have a special "random" column in the table that I update once a day or so. That single UPDATE run will take some time (especially because you'll have to have an index on that column), but it's much faster than creating random numbers for every row each time the select is run.</p>
| 3,985
|
<p>In a database-centric application that is designed for multiple clients, I've always thought it was "better" to use a single database for ALL clients - associating records with proper indexes and keys. In listening to the Stack Overflow podcast, I heard Joel mention that FogBugz uses one database per client (so if there were 1000 clients, there would be 1000 databases). What are the advantages of using this architecture?</p>
<p>I understand that for some projects, clients need direct access to all of their data - in such an application, it's obvious that each client needs their own database. However, for projects where a client does not need to access the database directly, are there any advantages to using one database per client? It seems that in terms of flexibility, it's much simpler to use a single database with a single copy of the tables. It's easier to add new features, it's easier to create reports, and it's just easier to manage.</p>
<p>I was pretty confident in the "one database for all clients" method until I heard Joel (an experienced developer) mention that his software uses a different approach -- and I'm a little confused with his decision...</p>
<p>I've heard people cite that databases slow down with a large number of records, but any relational database with some merit isn't going to have that problem - especially if proper indexes and keys are used.</p>
<p>Any input is greatly appreciated!</p>
|
<p>Assume there's no scaling penalty for storing all the clients in one database; for most people, and well configured databases/queries, this will be fairly true these days. If you're not one of these people, well, then the benefit of a single database is obvious.</p>
<p>In this situation, benefits come from the encapsulation of each client. From the code perspective, each client exists in isolation - there is no possible situation in which a database update might overwrite, corrupt, retrieve or alter data belonging to another client. This also simplifies the model, as you don't need to ever consider the fact that records might belong to another client.</p>
<p>You also get benefits of separability - it's trivial to pull out the data associated with a given client ,and move them to a different server. Or restore a backup of that client when the call up to say "We've deleted some key data!", using the builtin database mechanisms.</p>
<p>You get easy and free server mobility - if you outscale one database server, you can just host new clients on another server. If they were all in one database, you'd need to either get beefier hardware, or run the database over multiple machines.</p>
<p>You get easy versioning - if one client wants to stay on software version 1.0, and another wants 2.0, where 1.0 and 2.0 use different database schemas, there's no problem - you can migrate one without having to pull them out of one database.</p>
<p>I can think of a few dozen more, I guess. But all in all, the key concept is "simplicity". The product manages one client, and thus one database. There is never any complexity from the "But the database also contains other clients" issue. It fits the mental model of the user, where they exist alone. Advantages like being able to doing easy reporting on all clients at once, are minimal - how often do you want a report on the whole world, rather than just one client?</p>
|
<p>There are a couple of meanings of "database"</p>
<ul>
<li>the hardware box</li>
<li>the running software (e.g. "the oracle")</li>
<li>the particular set of data files</li>
<li>the particular login or schema</li>
</ul>
<p>It's likely Joel means one of the lower layers. In this case, it's just a matter of software configuration management... you don't have to patch 1000 software servers to fix a security bug, for example.</p>
<p>I think it's a good idea, so that a software bug doesn't leak information across clients. Imagine the case with an errant where clause that showed me your customer data as well as my own.</p>
| 3,430
|
<p>if you uses Mono Remoting on Linux, what's your work-around for DateTime marshalling incompatibility between Mono and .NET Remoting?</p>
<p>i'm using WinForms on Windows using .NET 2.0 runtime, using Remoting on Linux using Mono. i cannot yet use Mono runtime on both ends as Mono's DataGridView isn't yet working.</p>
<p>[UPDATE]</p>
<p>i used Mono 1.9 when the question was posted. i'm using Mono 2.4 now, its DateTime is now compatible with .NET. kudos to Miguel de Icaza, his team and Novell</p>
|
<p>I think a much better solution would be refactoring the code, so instead of the (yet under-supported) remoting, use web services. XML serialization of most basic data types are IIRC fully supported; and in certain circumstances, fits the architecture much better (especially server-client architectures).</p>
|
<p>I think a much better solution would be refactoring the code, so instead of the (yet under-supported) remoting, use web services. XML serialization of most basic data types are IIRC fully supported; and in certain circumstances, fits the architecture much better (especially server-client architectures).</p>
| 9,589
|
<p>I'd like to be able to track file read/writes of specific program invocations. No information about the actual transactions is required, just the file names involved.</p>
<p>Is there a cross platform solution to this? <br />
What are various platform specific methods? <br />
On Linux I know there's strace/ptrace (if there are faster methods that'd be good too). <br />I think on mac os there's ktrace. <br />
What about Windows?</p>
<p>Also, it would be amazing if it would be possible to block (stall out) file accesses until some later time.</p>
<p>Thanks!</p>
|
<p>The short answer is no. There are plenty of platform specific solutions which all probably have similar interfaces, but they aren't inherently cross platform since file systems tend to be platform specific.</p>
<hr>
<blockquote>
<p>How do I do it well on each platform?</p>
</blockquote>
<p>Again, it will depend on the platform :) For Windows, if you want to track reads/writes in flight, you might have to go with IFS. If you just want to get notified of changes, you can use <code>ReadDirectoryChangesW</code> or the NTFS change journal.</p>
<p>I'd recommend using the NTFS change journal only because it tends to be more reliable.</p>
|
<p>On Windows you can use the command line tool <a href="http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx" rel="nofollow noreferrer" title="Handle">Handle</a> or the GUI version <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer" title="Process Explorer">Process Explorer</a> to see which files a given process has open.</p>
<p>If you're looking for a get this information in your own program you can use the <a href="http://www.microsoft.com/whdc/devtools/ifskit/default.mspx" rel="nofollow noreferrer" title="Installable File System Kit">IFS kit</a> from Microsoft to write a file system filter. The file system filter will show all file system operation for all process. File system filters are used in AV software to scan files before they are open or to scan newly created files.</p>
| 4,122
|
<p>I'm trying to create a Zip file from .Net that can be read from Java code.</p>
<p>I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully uncompressed via WinZip or WinRar I always get an error when trying to uncompress it using the Java.Utils.Zip class in Java.</p>
<p>Problem seems to be in the wrong header written by SharpZipLib, I've also posted a question on the SharpDevelop forum but with no results (see <a href="http://community.sharpdevelop.net/forums/t/8272.aspx" rel="nofollow noreferrer">http://community.sharpdevelop.net/forums/t/8272.aspx</a> for info) but with no result.</p>
<p>Has someone a code sample of compressing a Zip file with .Net and de-compressing it with the Java.Utils.Zip class?</p>
<p>Regards
Massimo</p>
|
<p>I have used <a href="http://www.codeplex.com/DotNetZip" rel="noreferrer">DotNetZip library</a> and it seems to work properly. Typical code:</p>
<pre><code>using (ZipFile zipFile = new ZipFile())
{
zipFile.AddDirectory(sourceFolderPath);
zipFile.Save(archiveFolderName);
}
</code></pre>
|
<p>To judge whether it's really a conformant ZIP file, see PKZIP's <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT" rel="nofollow noreferrer">.ZIP File Format Specification</a>.</p>
<p>For what it's worth I have had no trouble using SharpZipLib to create ZIPs on a Windows Mobile device and open them with WinZip or Windows XP's built-in Compressed Folders feature, and also no trouble producing ZIPs on the desktop with SharpZipLib and processing them with my own ZIP extraction utility (basically a wrapper around zlib) on the mobile device.</p>
| 9,643
|
<p>I would like to create a stored procedure in MySQL that took a list as argument. For example, say that I would like to be able to set multiple tags for an item in one call, then what I want to do is to define a procedure that takes the ID of the item and a list of tags to set. However, I can't seem to find any way to do this, there is no list datatype, as far as I'm aware, but can it be emulated somehow? Could the list of tags be a comma-separated string, which can somehow be split and looped over?</p>
<p>How do you usually work with lists in MySQL stored procedures?</p>
|
<p><a href="http://forums.mysql.com/read.php?98,50521,50521#msg-50521" rel="noreferrer">This</a> article has some good discussion on the problem of parsing an array to a stored procedure since stored procedures only allow valid table column data-types as parameters.</p>
<p>There are some neat things you can do with the <a href="http://dev.mysql.com/tech-resources/articles/csv-storage-engine.html" rel="noreferrer">csv</a> table type in mysql - that is if you are loading a flat file into the db.</p>
<p>You could create a temporary table in the stored procedure, iterate over the csv list and insert it to the temp table, then create a cursor which selects the values from that table. This <a href="http://forums.mysql.com/read.php?98,50521,184245#msg-184245" rel="noreferrer">answer</a> in the above mentioned thread shows a way of doing this.</p>
<p>Generally I would split the array before I come to the database and then perform the query individually on each item.</p>
|
<p>Not sure if these will work specifically in a SP, but there are ENUM and SET datatypes in MySQL 5 which may do what you need.
<a href="http://dev.mysql.com/doc/refman/5.0/en/enum.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/enum.html</a>
<a href="http://dev.mysql.com/doc/refman/5.0/en/set.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/set.html</a></p>
| 3,029
|
<p>What is the easiest way to extract the original exception from an exception returned via Apache's implementation of XML-RPC?</p>
|
<p>It turns out that getting the cause exception from the Apache exception is the right one. </p>
<pre><code>} catch (XmlRpcException rpce) {
Throwable cause = rpce.getCause();
if(cause != null) {
if(cause instanceof ExceptionYouCanHandleException) {
handler(cause);
}
else { throw(cause); }
}
else { throw(rpce); }
}
</code></pre>
|
<p>According to the <a href="http://www.xmlrpc.com/spec" rel="nofollow noreferrer">XML-RPC Spec</a> it returns the "fault" in the xml.</p>
<p>Is this the "Exception" you are referring to or are you refering to a Java Exception generated while making the XML-RPC call?</p>
<p><strong>Fault example</strong></p>
<pre><code>HTTP/1.1 200 OK
Connection: close
Content-Length: 426
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:02 GMT
Server: UserLand Frontier/5.1.2-WinNT
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>4</int></value>
</member>
<member>
<name>faultString</name>
<value>
<string>Too many parameters.</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
</code></pre>
| 7,476
|
<p>I want to consolidate all the loose information of the company I work for into a knowledge base. A wiki seems to be the way to go, but most of the relevant information is buried inside PST files, and it would take ages to convince people to manually translate their emails one by one (including attachments) into wiki pages. So I'm looking for a wiki engine that supports page creation by email, that is, capable of receiving email (supporting plain text, html and attachments) and then create the corresponding page. Supporting file indexing and looking for duplicates would be a huge bonus.</p>
<p>I tried with <a href="http://www.wikimatrix.org/" rel="nofollow noreferrer">WikiMatrix</a>, but didn't find what I was looking for. I wouldn’t mind to build my own engine (borrowing a couple of snippets here and there for <a href="http://www.codeproject.com/KB/cs/MIME_De_Encode_in_C_.aspx" rel="nofollow noreferrer">MIME decoding</a>), but I don’t think is that a rare problem so there is no implementation.</p>
|
<p>Both Jotspot and MediaWiki allow you to do this. The latter has support for a lot of plugins, of which this is one. The format is essentially PageTitle@something. Jotspot is a hosted solution where you get your own email address, MediaWiki is self-hosted and you give it a mailbox to monitor for incoming.</p>
<p>Articles are appended to pages if they already exist, or a new page is created if it does not. This does require a degree of discipline for naming conventions, but is great for CC'ing.</p>
<p>We use MediaWiki here and I like it a lot. It has the same flaws as many other Wiki packages (e.g difficult to reorganize without orphaning pages) but is as good if not better than other Wiki packages I've used.</p>
|
<p>I don't know if this is exactly what you're looking for, but I know many of 37 Signals' products support adding data through email. I use Highrise to keep track of some of my business correspondence, and I'm able to CC or forward emails to Highrise and they get added to the appropriate contact.</p>
| 3,269
|
<p>I know that I can do something like</p>
<pre><code>$int = (int)99; //(int) has a maximum or 99
</code></pre>
<p>To set the variable <code>$int</code> to an integer and give it a value of <code>99</code>. </p>
<p>Is there a way to set the type to something like <code>LongBlob</code> in MySQL for <code>LARGE</code> Integers in PHP?</p>
|
<p>No. PHP does what is called automatic type conversion.</p>
<p>In your example</p>
<pre><code>$int = (int)123;
</code></pre>
<p>the "(int)" just assures that at that exact moment 123 will be handled as an int.</p>
<p>I think your best bet would be to use a class to provide some sort of type safety.</p>
|
<p>No, the type LongBlob is specific to MySQL. In PHP it is seen as binary data (usually characters), if you tried to convert it to an int it would take the first 32 bits of data (platform dependent) and push that into the variable.</p>
| 6,490
|
<p>I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe.</p>
|
<p>The general rule is to pick <strong>CHAR</strong> if all rows will have close to the <em>same length</em>. Pick <strong>VARCHAR</strong> (or <em>NVARCHAR</em>) when the <em>length varies</em> significantly. CHAR may also be a bit faster because all the rows are of the same length.</p>
<p>It varies by DB implementation, but generally, VARCHAR (or <em>NVARCHAR</em>) uses one or two more bytes of storage (for length or termination) in addition to the actual data. So (assuming you are using a one-byte character set) storing the word "FooBar"</p>
<ul>
<li><strong>CHAR(6)</strong> = 6 bytes <em>(no overhead)</em></li>
<li><strong>VARCHAR(100)</strong> = 8 bytes <em>(2 bytes of overhead)</em></li>
<li><strong>CHAR(10)</strong> = 10 bytes <em>(4 bytes of waste)</em></li>
</ul>
<p>The bottom line is <strong>CHAR</strong> <em>can</em> be <em>faster</em> and more <em>space-efficient</em> for data of relatively the same length (within two characters length difference).</p>
<p><strong>Note</strong>: Microsoft SQL has 2 bytes of overhead for a VARCHAR. This may vary from DB to DB, but generally, there is at least 1 byte of overhead needed to indicate length or EOL on a VARCHAR.</p>
<p>As was pointed out by <em><a href="https://stackoverflow.com/users/1106569/gavin-towey">Gaven</a></em> in the comments: Things change when it comes to <a href="http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-utf8.html" rel="noreferrer">multi-byte characters</a> sets, and is a is case where VARCHAR becomes a much better choice.</p>
<p><em>A note about the declared length of the <strong>VARCHAR</strong></em>: Because it stores the length of the actual content, then you don't waste unused length. So storing 6 characters in <em>VARCHAR(6), VARCHAR(100), <em>or</em> VARCHAR(MAX)</em> uses the same amount of storage. Read more about the differences when using <a href="https://stackoverflow.com/a/8512232/255">VARCHAR(MAX)</a>. You declare a <em>maximum</em> size in VARCHAR to limit how much is stored.</p>
<p>In the comments <a href="https://stackoverflow.com/users/10990028/alwayslearning">AlwaysLearning</a> pointed out that the <a href="https://learn.microsoft.com/en-us/sql/t-sql/data-types/char-and-varchar-transact-sql?view=sql-server-ver15" rel="noreferrer">Microsoft Transact-SQL docs</a> seem to say the opposite. I would suggest that is an error or at least the docs are unclear.</p>
|
<p>In some SQL databases, VARCHAR will be padded out to its maximum size in order to optimize the offsets, This is to speed up full table scans and indexes. </p>
<p>Because of this, you do not have any space savings by using a VARCHAR(200) compared to a CHAR(200)</p>
| 8,433
|
<p>I'm researching and experimenting more with Groovy and I'm trying to wrap my mind around the pros and cons of implementing things in Groovy that I can't/don't do in Java. Dynamic programming is still just a concept to me since I've been deeply steeped static and strongly typed languages. </p>
<p>Groovy gives me the ability to <a href="http://en.wikipedia.org/wiki/Duck_typing" rel="noreferrer">duck-type</a>, but I can't really see the value. How is duck-typing more productive than static typing? What kind of things can I do in my code practice to help me grasp the benefits of it?</p>
<p>I ask this question with Groovy in mind but I understand it isn't necessarily a Groovy question so I welcome answers from every code camp.</p>
|
<p>A lot of the comments for duck typing don't really substantiate the claims. Not "having to worry" about a type is not sustainable for maintenance or making an application extendable. I've really had a good opportunity to see Grails in action over my last contract and its quite funny to watch really. Everyone is happy about the gains in being able to "create-app" and get going - sadly it all catches up to you on the back end.</p>
<p>Groovy seems the same way to me. Sure you can write very succinct code and definitely there is some nice sugar in how we get to work with properties, collections, etc... But the cost of not knowing what the heck is being passed back and forth just gets worse and worse. At some point your scratching your head wondering why the project has become 80% testing and 20% work. The lesson here is that "smaller" does not make for "more readable" code. Sorry folks, its simple logic - the more you have to know intuitively then the more complex the process of understanding that code becomes. It's why GUI's have backed off becoming overly iconic over the years - sure looks pretty but WTH is going on is not always obvious.</p>
<p>People on that project seemed to have troubles "nailing down" the lessons learned, but when you have methods returning either a single element of type T, an array of T, an ErrorResult or a null ... it becomes rather apparent.</p>
<p>One thing working with Groovy has done for me however - awesome billable hours woot!</p>
|
<p>It's not that duck typing is more productive than static typing as much as it is simply different. With static typing you always have to worry that your data is the correct type and in Java it shows up through casting to the right type. With duck typing the type doesn't matter as long as it has the right method, so it really just eliminates a lot of the hassle of casting and conversions between types.</p>
| 7,031
|
<p>I have a prusa 13 that's shipping in the mail, and I intend to make good use of it, one also own a da vinci jr. and the one time it got so clogged that the extruder itself was filled with pla, with that said I replace the extruder, for the da vinci, but besides that, as for my a prusa, what should I do if the extruder, not the nozzle gets clogged that badly?</p>
|
<p>From an electrical standpoint, a two-phase stepper motors (what most 3D printers use) works the same backwards and forwards, the phase just reverses. If you are stalling on only one direction, I would look to see if you have a mechanical bind in that direction. Generally a wiring issue will cause the motor to either not run at all or to run in the wrong direction.</p>
<p>A few things you can check:</p>
<ol>
<li>Decouple the motors from their mechanical load and confirm that they all run correctly when they aren't driving a load. If you can't do that, disconnect them all then connect a spare motor to each cable one-at-a-time.</li>
<li>Turn each of the axis with your hand and make sure it turns smoothly throughout the entire range in both directions. Note: Some times a binding issue is acceleration related - a loose frame or coupling can cause this.</li>
<li>Monitor the supply voltage to make sure that one of the motors is not pulling the supply down causing all the others to stall.</li>
</ol>
|
<p>Sounds like you are configured for NC switches but are using NO switches, causing them to invert their reported state. Issue a <strong>M119</strong> command and see if the endstop statuses are correct when none are triggered.</p>
| 776
|
<p>How do I perform an <code>IF...THEN</code> in an <code>SQL SELECT</code> statement?</p>
<p>For example:</p>
<pre><code>SELECT IF(Obsolete = 'N' OR InStock = 'Y' ? 1 : 0) AS Saleable, * FROM Product
</code></pre>
|
<p>The <code>CASE</code> statement is the closest to IF in SQL and is supported on all versions of SQL Server.</p>
<pre><code>SELECT CAST(
CASE
WHEN Obsolete = 'N' or InStock = 'Y'
THEN 1
ELSE 0
END AS bit) as Saleable, *
FROM Product
</code></pre>
<p>You only need to use the <code>CAST</code> operator if you want the result as a Boolean value. If you are happy with an <code>int</code>, this works:</p>
<pre><code>SELECT CASE
WHEN Obsolete = 'N' or InStock = 'Y'
THEN 1
ELSE 0
END as Saleable, *
FROM Product
</code></pre>
<p><code>CASE</code> statements can be embedded in other <code>CASE</code> statements and even included in aggregates.</p>
<p>SQL Server Denali (SQL Server 2012) adds the <a href="http://msdn.microsoft.com/en-us/library/hh213574%28v=sql.110%29.aspx" rel="noreferrer">IIF</a> statement which is also available in <a href="http://www.techonthenet.com/access/functions/advanced/iif.php" rel="noreferrer">access</a> (pointed out by <a href="https://stackoverflow.com/questions/63447/how-do-you-perform-an-if-then-in-an-sql-select/6769805#6769805">Martin Smith</a>):</p>
<pre><code>SELECT IIF(Obsolete = 'N' or InStock = 'Y', 1, 0) as Saleable, * FROM Product
</code></pre>
|
<p>There are multiple conditions.</p>
<pre><code>SELECT
(CASE
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1001' THEN 'DM'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1002' THEN 'GS'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1003' THEN 'MB'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1004' THEN 'MP'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1005' THEN 'PL'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1008' THEN 'DM-27'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1011' THEN 'PB'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1012' THEN 'UT-2'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1013' THEN 'JGC'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1014' THEN 'SB'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1015' THEN 'IR'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1016' THEN 'UT-3'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1017' THEN 'UT-4'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1019' THEN 'KR'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1020' THEN 'SYB-SB'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1021' THEN 'GR'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1022' THEN 'SYB-KP'
WHEN RIGHT((LEFT(POSID,5)),4) LIKE '1026' THEN 'BNS'
ELSE ''
END) AS OUTLET
FROM matrixcrm.Transact
</code></pre>
| 8,892
|
<p>I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says: </p>
<blockquote>
<p><code>IBOutlet</code> is a null-defined macro, which the C preprocessor removes at compile time.</p>
</blockquote>
<p>I'm curious - what's a null-defined macro?</p>
|
<pre><code>#define IBOutlet
</code></pre>
<p>Whenever IBOutlet is used in program text, it will be replaced with nothing at all.</p>
|
<p>Also - if you're unsure how anything is defined - command double-click it and Xcode will open the definition in the original source file.</p>
| 4,203
|
<p>I am working on a large C++ project in Visual Studio 2008, and there are a lot of files with unnecessary <code>#include</code> directives. Sometimes the <code>#include</code>s are just artifacts and everything will compile fine with them removed, and in other cases classes could be forward declared and the #include could be moved to the <code>.cpp</code> file. Are there any good tools for detecting both of these cases?</p>
|
<p>While it won't reveal unneeded include files, Visual studio has a setting <code>/showIncludes</code> (right click on a <code>.cpp</code> file, <code>Properties->C/C++->Advanced</code>) that will output a tree of all included files at compile time. This can help in identifying files that shouldn't need to be included.</p>
<p>You can also take a look at the pimpl idiom to let you get away with fewer header file dependencies to make it easier to see the cruft that you can remove.</p>
|
<p>Some of the existing answers state that it's hard. That's indeed true, because you need a full compiler to detect the cases in which a forward declaration would be appropriate. You cant parse C++ without knowing what the symbols mean; the grammar is simply too ambiguous for that. You must know whether a certain name names a class (could be forward-declared) or a variable (can't). Also, you need to be namespace-aware.</p>
| 9,997
|
<p>Is it possible to order results in SQL Server 2005 by the relevance of a freetext match? In MySQL you can use the (roughly equivalent) MATCH function in the ORDER BY section, but I haven't found any equivalence in SQL Server.</p>
<p>From the <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html" rel="noreferrer">MySQL docs</a>:</p>
<blockquote>
<p>For each row in the table, MATCH() returns a relevance value; that is, a similarity measure between the search string and the text in that row in the columns named in the MATCH() list.</p>
</blockquote>
<p>So for example you could order by the number of votes, then this relevance, and finally by a creation date. Is this something that can be done, or am I stuck with just returning the matching values and not having this ordering ability?</p>
|
<p>If you are using <code>FREETEXTTABLE</code> then it returns a column name <code>Rank</code>, so <code>order by Rank</code> should work. I don't know if other freetext search methods are also returning this value or not. You can have a try.</p>
|
<p>Both <code>FREETEXTTABLE</code> and <code>CONTAINSTABLE</code> will return the <code>[RANK]</code> column, but make sure you are using either the correct variation or union both of them to get all appropriate results.</p>
| 7,704
|
<p>I'm working on an application where users have to make a call and type a verification number with the keypad of their phone.</p>
<p>I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead, it will validate the number against an algorithm (like a credit card number).</p>
<p>Here are some of the requirements :</p>
<ul>
<li>It must be difficult to type a valid random code </li>
<li>It must be difficult to have a valid code if I make a typo (transposition of digits, wrong digit)</li>
<li>I must have a reasonable number of possible combinations (let's say 1M)</li>
<li>The code must be as short as possible, to avoid errors from the user</li>
</ul>
<p>Given these requirements, how would you generate such a number?</p>
<p>EDIT :</p>
<p>@Haaked: The code has to be numerical because the user types it with its phone.</p>
<p>@matt b: On the first step, the code is displayed on a Web page, the second step is to call and type in the code. I don't know the user's phone number.</p>
<p>Followup : I've found several algorithms to <em>check</em> the validity of numbers (See this interesting Google Code project : <a href="http://code.google.com/p/checkdigits/wiki/CheckDigitSystems" rel="nofollow noreferrer">checkDigits</a>).</p>
|
<p>After some research, I think I'll go with the <strong>ISO 7064 Mod 97,10</strong> formula. It seems pretty solid as it is used to validate IBAN (International Bank Account Number).</p>
<p>The formula is very simple:</p>
<ol>
<li>Take a number : <code>123456</code></li>
<li>Apply the following formula to obtain the 2 digits checksum : <code>mod(98 - mod(number * 100, 97), 97)</code> => 76</li>
<li>Concat number and checksum to obtain the code => 12345676</li>
<li>To validate a code, verify that <code>mod(code, 97) == 1</code></li>
</ol>
<p>Test :</p>
<ul>
<li><code>mod(12345676, 97) = 1</code> => GOOD</li>
<li><code>mod(21345676, 97) = 50</code> => BAD !</li>
<li><code>mod(12345678, 97) = 10</code> => BAD ! </li>
</ul>
<p>Apparently, this algorithm catches most of the errors.</p>
<p>Another interesting option was the <a href="http://en.wikipedia.org/wiki/Verhoeff_algorithm" rel="noreferrer">Verhoeff algorithm</a>. It has only one verification digit and is more difficult to implement (compared to the simple formula above). </p>
|
<blockquote>
<ul>
<li>I must have a reasonnable number of possible combinations (let's say 1M)</li>
<li>The code must be as short as possible, to avoid errors from the user</li>
</ul>
</blockquote>
<p>Well, if you want it to have at least one million combinations, then you need at least six digits. Is that short enough?</p>
| 6,829
|
<p>I wonder what type of servers for internal usage you virtualize in the last -say- 6 months. Here's what we got virtual so far:</p>
<ul>
<li>mediawiki</li>
<li>bugtracker (mantis)</li>
<li>subversion</li>
</ul>
<p>We didn't virtualize spezialized desktop PCs which are running a certain software product, that is only used once in a while. Do you plan to get rid of those old machines any time soon?</p>
<p>And which server products do you use? Vmware ESX, Vmware Server, Xen installations...?</p>
|
<p>My standard answer to questions like this is, "virtualization is great; be aware of its limitations".</p>
<p>I would never rely on a purely-virtual implementation of anything that's an infrastructure-level service (eg the authoritative DNS server for your site; management and monitoring tools). </p>
<p>I work for a company that provides server and network management tools. We are constantly trying to overcome the marketing chutzpah of virtualization vendors in that infrastructure tools shouldn't live in infrastructure tools.</p>
<p>Virtualization wants to control all of your services. However, there are some things that should always exist on physical hardware. </p>
<p>When something goes wrong with your virtual setup, troubleshooting and recovery can take a long time. If you're still running some of those services you require for your company on physical hardware, you're not dead-in-the-water.</p>
<p>Virtualization also introduces clock lag, disk and network IO lag, and other issues you wouldn't see on physical hardware.</p>
<p>Lastly, the virtualization tool you pick then becomes in charge of all of the resources under its command for its hosted VMs. That translates to the hypervisor - not you - deciding what VM should have priority at any given moment. If you're concerned about any tool, service, or function being guaranteed to have certain resources, it will need to be on physical hardware.</p>
<p>For anything that "doesn't matter", like web, mail, dhcp, ldap, etc - virtualization is great.</p>
|
<p>Our build machine running FinalBuilder runs on a Windows XP Virtual Machine running in VMWare Server on Linux.</p>
<p>It is very practical to move it and also to backup, we just stop the Virtual Machine and copy the disk image.</p>
<p>Some days ago we needed to change the host pc, it took less than 2 hours to have our builder up and running on another pc.</p>
| 3,112
|
<p>I am storing a PNG as an embedded resource in an assembly. From within the same assembly I have some code like this:</p>
<pre><code>Bitmap image = new Bitmap(typeof(MyClass), "Resources.file.png");
</code></pre>
<p>The file, named "file.png" is stored in the "Resources" folder (within Visual Studio), and is marked as an embedded resource.</p>
<p>The code fails with an exception saying: </p>
<blockquote>
<p>Resource MyNamespace.Resources.file.png cannot be found in class MyNamespace.MyClass</p>
</blockquote>
<p>I have identical code (in a different assembly, loading a different resource) which works. So I know the technique is sound. My problem is I end up spending a lot of time trying to figure out what the correct path is. If I could simply query (eg. in the debugger) the assembly to find the correct path, that would save me a load of headaches.</p>
|
<p>This will get you a string array of all the resources:</p>
<pre><code>System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
</code></pre>
|
<p>The name of the resource is the name space plus the "pseudo" name space of the path to the file. The "pseudo" name space is made by the sub folder structure using \ (backslashes) instead of . (dots).</p>
<pre><code>public static Stream GetResourceFileStream(String nameSpace, String filePath)
{
String pseduoName = filePath.Replace('\\', '.');
Assembly assembly = Assembly.GetExecutingAssembly();
return assembly.GetManifestResourceStream(nameSpace + "." + pseduoName);
}
</code></pre>
<p>The following call:</p>
<pre><code>GetResourceFileStream("my.namespace", "resources\\xml\\my.xml")
</code></pre>
<p>will return the stream of my.xml located in the folder-structure resources\xml in the name space: my.namespace.</p>
| 4,742
|
<p>In order to know how many times a pattern exists in current buffer, I do:</p>
<pre><code>:%s/pattern-here/pattern-here/g
</code></pre>
<p>It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status.</p>
<p>Is there a more elegant way to count?</p>
|
<p>To avoid the substitution, leave the second pattern empty, and add the “n” flag:</p>
<pre><code>:%s/pattern-here//gn
</code></pre>
<p>This is described as <a href="http://vimdoc.sourceforge.net/htmldoc/tips.html#count-items" rel="noreferrer">an official tip</a>.</p>
|
<p>vimgrep is your friend here:</p>
<pre><code>vimgrep pattern %
</code></pre>
<p>Shows:</p>
<pre><code>(1 of 37)
</code></pre>
| 9,595
|
<p>I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass this to each function but I can't figure out how to pass this or test the different errors that could come back as being correct or not.</p>
<p><b>Edit:</b> I should have said. I have a user class and I want to pass a different instance of this class to each unit test. </p>
|
<p>If your various user classes inherit from a parent user class, then I recommend you use the same inheritance structure for your test case classes.</p>
<p>Consider the following sample classes:</p>
<pre><code>class User
{
public function commonFunctionality()
{
return 'Something';
}
public function modifiedFunctionality()
{
return 'One Thing';
}
}
class SpecialUser extends User
{
public function specialFunctionality()
{
return 'Nothing';
}
public function modifiedFunctionality()
{
return 'Another Thing';
}
}
</code></pre>
<p>You could do the following with your test case classes:</p>
<pre><code>class Test_User extends PHPUnit_Framework_TestCase
{
public function create()
{
return new User();
}
public function testCommonFunctionality()
{
$user = $this->create();
$this->assertEquals('Something', $user->commonFunctionality);
}
public function testModifiedFunctionality()
{
$user = $this->create();
$this->assertEquals('One Thing', $user->commonFunctionality);
}
}
class Test_SpecialUser extends Test_User
{
public function create() {
return new SpecialUser();
}
public function testSpecialFunctionality()
{
$user = $this->create();
$this->assertEquals('Nothing', $user->commonFunctionality);
}
public function testModifiedFunctionality()
{
$user = $this->create();
$this->assertEquals('Another Thing', $user->commonFunctionality);
}
}
</code></pre>
<p>Because each test depends on a create method which you can override, and because the test methods are inherited from the parent test class, all tests for the parent class will be run against the child class, unless you override them to change the expected behavior.</p>
<p>This has worked great in my limited experience.</p>
|
<p>If you're looking to test the actual UI, you could try using something like Selenium (www.openqa.org). It lets you write the code in PHP (which I'm assuming would work with phpUnit) to drive the browser..</p>
<p>Another approach would be to have a common method that could be called by each test for your different user type. ie, something like 'ValidatePage', which you could then call from TestAdminUser or TestRegularUser and have the method simply perform the same basic validation of what you're expecting..</p>
| 8,342
|
<p>I am trying to determine the best time efficient algorithm to accomplish the task described below.</p>
<p>I have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another. This basically represents an undirected graph, with the records being the vertices and the connection data the edges.</p>
<p>All of the records in the set have connection information (i.e. no orphan records are present; each record in the set connects to one or more other records in the set).</p>
<p>I want to choose any two records from the set and be able to show all simple paths between the chosen records. By "simple paths" I mean the paths which do not have repeated records in the path (i.e. finite paths only).</p>
<p>Note: The two chosen records will always be different (i.e. start and end vertex will never be the same; no cycles).</p>
<p>For example:</p>
<pre>
If I have the following records:
A, B, C, D, E
and the following represents the connections:
(A,B),(A,C),(B,A),(B,D),(B,E),(B,F),(C,A),(C,E),
(C,F),(D,B),(E,C),(E,F),(F,B),(F,C),(F,E)
[where (A,B) means record A connects to record B]
</pre>
<p>If I chose B as my starting record and E as my ending record, I would want to find all simple paths through the record connections that would connect record B to record E.</p>
<pre>
All paths connecting B to E:
B->E
B->F->E
B->F->C->E
B->A->C->E
B->A->C->F->E
</pre>
<p>This is an example, in practice I may have sets containing hundreds of thousands of records.</p>
|
<p>It appears that this can be accomplished with a depth-first search of the graph. <strong>The depth-first search will find all non-cyclical paths between two nodes.</strong> This algorithm should be very fast and scale to large graphs (The graph data structure is sparse so it only uses as much memory as it needs to).</p>
<p>I noticed that the graph you specified above has only one edge that is directional (B,E). Was this a typo or is it really a directed graph? This solution works regardless. Sorry I was unable to do it in C, I'm a bit weak in that area. I expect that you will be able to translate this Java code without too much trouble though.</p>
<p><strong>Graph.java:</strong></p>
<pre class="lang-java prettyprint-override"><code>import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
public class Graph {
private Map<String, LinkedHashSet<String>> map = new HashMap();
public void addEdge(String node1, String node2) {
LinkedHashSet<String> adjacent = map.get(node1);
if(adjacent==null) {
adjacent = new LinkedHashSet();
map.put(node1, adjacent);
}
adjacent.add(node2);
}
public void addTwoWayVertex(String node1, String node2) {
addEdge(node1, node2);
addEdge(node2, node1);
}
public boolean isConnected(String node1, String node2) {
Set adjacent = map.get(node1);
if(adjacent==null) {
return false;
}
return adjacent.contains(node2);
}
public LinkedList<String> adjacentNodes(String last) {
LinkedHashSet<String> adjacent = map.get(last);
if(adjacent==null) {
return new LinkedList();
}
return new LinkedList<String>(adjacent);
}
}
</code></pre>
<p><strong>Search.java:</strong></p>
<pre class="lang-java prettyprint-override"><code>import java.util.LinkedList;
public class Search {
private static final String START = "B";
private static final String END = "E";
public static void main(String[] args) {
// this graph is directional
Graph graph = new Graph();
graph.addEdge("A", "B");
graph.addEdge("A", "C");
graph.addEdge("B", "A");
graph.addEdge("B", "D");
graph.addEdge("B", "E"); // this is the only one-way connection
graph.addEdge("B", "F");
graph.addEdge("C", "A");
graph.addEdge("C", "E");
graph.addEdge("C", "F");
graph.addEdge("D", "B");
graph.addEdge("E", "C");
graph.addEdge("E", "F");
graph.addEdge("F", "B");
graph.addEdge("F", "C");
graph.addEdge("F", "E");
LinkedList<String> visited = new LinkedList();
visited.add(START);
new Search().depthFirst(graph, visited);
}
private void depthFirst(Graph graph, LinkedList<String> visited) {
LinkedList<String> nodes = graph.adjacentNodes(visited.getLast());
// examine adjacent nodes
for (String node : nodes) {
if (visited.contains(node)) {
continue;
}
if (node.equals(END)) {
visited.add(node);
printPath(visited);
visited.removeLast();
break;
}
}
for (String node : nodes) {
if (visited.contains(node) || node.equals(END)) {
continue;
}
visited.addLast(node);
depthFirst(graph, visited);
visited.removeLast();
}
}
private void printPath(LinkedList<String> visited) {
for (String node : visited) {
System.out.print(node);
System.out.print(" ");
}
System.out.println();
}
}
</code></pre>
<p>Program Output:</p>
<pre class="lang-java prettyprint-override"><code>B E
B A C E
B A C F E
B F E
B F C E
</code></pre>
|
<p>Here's a thought off the top of my head:</p>
<ol>
<li>Find one connection. (Depth-first search is probably a good algorithm for this, since the path length doesn't matter.)</li>
<li>Disable the last segment.</li>
<li>Try to find another connection from the last node before the previously disabled connection.</li>
<li>Goto 2 until there are no more connections.</li>
</ol>
| 8,268
|
<p>I need to draw some simple network topology charts, suggestions of some good tools appreciated. </p>
<p>Edit: love freeware :-)</p>
|
<p>Try <a href="http://live.gnome.org/Dia" rel="nofollow noreferrer">Dia</a> - it's open source and cross platform.</p>
|
<p>NetworkNotepad is a useful, if quirky, programme.</p>
| 9,704
|
<p>I have designed database tables (normalised, on an MS SQL server) and created a standalone windows front end for an application that will be used by a handful of users to add and edit information. We will add a web interface to allow searching accross our production area at a later date.</p>
<p>I am concerned that if two users start editing the same record then the last to commit the update would be the 'winner' and important information may be lost. A number of solutions come to mind but I'm not sure if I am going to create a bigger headache.</p>
<ol>
<li>Do nothing and hope that two users are never going to be editing the same record at the same time. <em>- Might never happed but what if it does?</em></li>
<li>Editing routine could store a copy of the original data as well as the updates and then compare when the user has finished editing. If they differ show user and comfirm update <em>- Would require two copies of data to be stored.</em></li>
<li>Add last updated DATETIME column and check it matches when we update, if not then show differences. <em>- requires new column in each of the relevant tables.</em></li>
<li>Create an editing table that registers when users start editing a record that will be checked and prevent other users from editing same record. <em>- would require carful thought of program flow to prevent deadlocks and records becoming locked if a user crashes out of the program.</em></li>
</ol>
<p>Are there any better solutions or should I go for one of these?</p>
|
<p>If you expect infrequent collisions, <a href="http://msdn.microsoft.com/en-us/library/aa0416cz.aspx" rel="noreferrer">Optimistic Concurrency</a> is probably your best bet.</p>
<p>Scott Mitchell wrote a comprehensive tutorial on implementing that pattern:<br>
<a href="http://www.asp.net/Learn/data-access/tutorial-21-cs.aspx" rel="noreferrer">Implementing Optimistic Concurrency</a></p>
|
<p>The database will do this for you. Look at "select ... for update", which is designed just for this kind of thing. It will give you a write lock on the selected rows, which you can then commit or roll back.</p>
| 2,326
|
<p>I'm working on a internal web based tool for my company. Part of this tool is another application (The Cruise Control Dashboard) that runs in its own Virtual Directory under my root application.</p>
<p>I wanted to limit access to this internal application by setting up Forms Authentication on it, and having a login form in the root application.</p>
<p>I put the following into the root applications web.config:</p>
<pre><code><location path="ccnet">
<system.web>
<authentication mode="Forms">
<forms loginUrl="/default.aspx" timeout="5000"/>
</authentication>
<authorization>
<allow users="?"/>
<deny users="?"/>
</authorization>
</system.web>
</location>
</code></pre>
<p>However, the Forms Authentication does not appear to be working, it does not redirect back to the login page when I access that application directly.</p>
<p>I have a feeling I have the <allow> and <deny> tags set wrong. Can someone clarify?</p>
|
<blockquote>
<p>You might also need to put path="/" in the
</blockquote>
<p>That was it!</p>
<p>So, Summary, inorder todo this;</p>
<p>In root web.config add:</p>
<pre><code><machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
</code></pre>
<p>This must be done because by default it is "AutoGenerate,IsolateApps".</p>
<p>Second, you must name the form Auth cookie the same in both, I did this all in my root, using the location tag:</p>
<pre><code><authentication mode="Forms">
<forms name="ccAuth" loginUrl="/default.aspx" path="/" timeout="5000"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</code></pre>
<p>Finally:</p>
<pre><code><location path="ccnet">
<system.web>
<authentication mode="Forms">
<forms name="ccAuth" loginUrl="/default.aspx" path="/" timeout="5000"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</code></pre>
<p>Thanks everyone for your help. This was a stumper.</p>
|
<p>you are allowing all unauthenticated. You might be looking for something like this</p>
<pre><code><deny users="?"/>
</code></pre>
| 3,969
|
<p>We are currently using a somewhat complicated deployment setup that involves a remote SVN server, 3 SVN branches for DEV, STAGE, and PROD, promoting code between them through patches, etc. I wonder what do you use for deployment in a small dev team situation?</p>
|
<p>trunk for development, and a branch (production) for the production stuff.</p>
<p>On my local machine, I have a VirtualHost that points to the trunk branch, to test my changes.</p>
<p>Any commit to trunk triggers a commit hook that does an svn export and sync to the online server's dev URL - so if the site is stackoverflow.com then this hook automatically updates dev.stackoverflow.com</p>
<p>Then I use svnmerge to merge selected patches from trunk to production in my local checkouts. I have a VirtualHost again on my local machine pointing to the production branch.</p>
<p>When I commit the merged changes to the production branch, again an SVN export hook updates the production (live) export and the site is live!</p>
|
<p>We use release branching - this seems to be more efficient for us than the feature branching we were doing. </p>
<p>Don't make different branches for the different environments.</p>
| 2,574
|
<p>My thermoplastic FDM printer has a heated bed and uses glass as the printing surface. Sometimes the glass will chip or break entirely when I'm removing my print. This happens most often when the print has a large area in contact with the glass.</p>
<p>What can I do to keep this from happening?</p>
|
<p>Some things I've tried that have helped:</p>
<p>Lay down a layer of masking tape. Most people who do this use blue painter's tape. The plastic should stick nicely during printing, yet release reasonably easily when you remove the print from the heated bed.</p>
<p>Lay down a later of Kapton tape. The principle is the same as masking tape, but Kapton tape has a smooth surface and is more durable than masking tape. The down side is Kapton tape is far more expensive, and applying it correctly is a LOT more work, since you have to use water and you have to keep bubbles from getting underneath it.</p>
<p>Put some ABS scraps into a bottle of Acetone, and allow the acetone to break down the ABS til you have a slurry. Spread this slurry as evenly as possible across the build plate, and allow the acetone to evaporate away. This leaves a thin film of ABS on the plate, and will release much better than if you print directly onto the build plate. I recommend using clear ABS if you can, since some of it will stick to your print and clear will be the least visible. You'll need to re-apply it regularly, since it will come off with your print where it touches the build plate. <strong>WARNING</strong>: Use proper ventilation and avoid contact with acetone. That stuff's not good for you. Also it's flammable, so keep a fire extinguisher nearby.</p>
<p>I prefer the ABS/acetone slurry method, but it requires good ventilation and a handy fire extinguisher. Also note that you don't have to print in ABS to use an ABS/acetone slurry; I print primarily in PLA and it makes no difference.</p>
<p>I've also heard of others using a glue stick or some other surface treatments that allow for good adhesion during printing while still allowing for easy removal.</p>
|
<p>I have 2 suggestions.</p>
<p>First, get better glass. high quality <a href="https://en.wikipedia.org/wiki/Borosilicate_glass" rel="nofollow noreferrer">borosilicate plate glass</a> at least 3 mm thick should shrug off even scraping with a razor. </p>
<p>Second, don't scrape it with a razor, put the whole thing in the freezer (or fridge, or in front of a fan, wherever), borosilicate is known for having a very low thermal coefficient, so the plastic is going to shrink more than the glass and should pop right off</p>
| 134
|
<p>So I have a self build Mendel Reprap style 3d printer.</p>
<p>I've not used it in sometime after moving house but I'm looking to use it again. What should I pay attention to before calibrating and running it again?</p>
|
<p>Increase nozzle temperature. When the filament is new it will print easier, requiring less heat to print well. So if you didn't store your filament properly to begin with, increasing print temperature will make it jam less and increase layer bonding. </p>
<p>The reason for this is because the moisture that accumulates in the filament will absorb heat and evaporate when printed, meaning that the filament itself isn't getting the same amount of heating as it used to.</p>
<p>That being said, the storage suggestions mentioned by tbm should be your first priority. I personally put my filament in Zip Lock plastic bags and store these in a dry location not exposed to sun or temperature changes.</p>
|
<p>PLA absorbs moisture, so keeping the filament dry is a key factor. Aside from that, PLA is naturally more brittle than other plastics like ABS and Nylon Sorry, tried to find a graph to prove it, but couldn't find one.</p>
<p>There's a good <a href="https://groups.google.com/forum/#!topic/makerbot/Rdx2ZnJeQzs">Google Group discussion</a> and many other resources that go over good storage habits, but as for fixing the existing filament.</p>
<p>Try the following: </p>
<ul>
<li>Place PLA in an enclosure (plastic bin, Zip-loc bag, etc.)</li>
<li>If you have some, add some moisture absorber(s)</li>
<li>Place the tub in a warm environment (naturally or artificially) and make sure the area is dry as possible (not in the shed in the back, by the woods...). Possibly next to a heater vent or space heater in your house?</li>
</ul>
<p>Essentially, you're trying to treat the material. When the material goes through a heat treatment (aka the heat block in the extruder), the mechanical properties are beginning to change. The brittleness can be set by how quickly the material cools. I'm speculating that the moisture does any of the following:</p>
<ol>
<li>Keeps the filament from heating up to the desired extrusion temperature.</li>
<li>Burns the filament.</li>
<li>The moisture is evaporated, leaving gaps in the extruded filament (under microscope).</li>
</ol>
<p>I looked into this a few years ago and have forgotten most of what I found out, but I'll keep looking and update my answer here.</p>
| 326
|
<p>I recently got started in 3D printing but here's an issue I can't seem to find a solution for (I don't know what exactly to look for).</p>
<p>Here's what I did:</p>
<ul>
<li>I used InkScape to convert an emoji in to a svg and imported it in to Blender</li>
<li>Used the Solidify modifier to make the curve a solid and converted it in to a mesh</li>
<li>Extruded the mesh a bit, fixed a few non-manifold vertices and erroneous faces and saved the whole shebang as STL</li>
<li>Imported the STL in to my printers software:
<img src="https://i.imgur.com/5xdXhPz.png" alt="1"></li>
<li>After slicing it looks like this:
<img src="https://i.imgur.com/Z966Ovw.png" alt="2"></li>
</ul>
<p>Is the software making a mistake during the slicing? Or is my mesh screwed up?</p>
<p>I have a FlashForge Finder and using the software that came with it: FlashPrint.</p>
<p>Edit: I uploaded everything to <a href="https://www.thingiverse.com/thing:2616300" rel="nofollow noreferrer">Thingiverse</a> for those who are interested.</p>
|
<p>here is just a addenum to Tom van der Zanden's answer</p>
<p>this is (an example of) what you may design - nice object with virtual outline, and virtual fill
so this is what you see (and what you potentially expect)</p>
<p><a href="https://i.stack.imgur.com/61gRm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/61gRm.png" alt="enter image description here"></a></p>
<p>but here is what you get (and probably not really expect)</p>
<p><a href="https://i.stack.imgur.com/5HdqS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5HdqS.png" alt="enter image description here"></a></p>
<p>red parts are the areas which are not covered by fill because nozzle cannot reach there</p>
<p>solution is </p>
<ul>
<li>to redesign your object in smart way or</li>
<li>to use smaller nozzle or</li>
<li>to use smarter app (like <a href="http://slic3r.org/" rel="noreferrer">Slic3r</a>)</li>
</ul>
<p>and of course you can use all 3 options together to get best results ;)</p>
<p><strong>EDIT</strong>
here is simple explanation why smarter app could do the thing
<a href="https://i.stack.imgur.com/VBrLW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VBrLW.png" alt="enter image description here"></a></p>
<p>and here goes the difference</p>
<p><a href="https://i.stack.imgur.com/3nNEN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3nNEN.png" alt="enter image description here"></a></p>
<p>green parts are new covered areas</p>
<p>not much but somthing extra</p>
|
<p>This is likely not a problem with your mesh. It's a problem in the slicer software.</p>
<p>Because your 3D printer prints with a (for example) 0.4mm nozzle, it lays down lines of plastic that are around (for example) 0.5mm wide. The slicer has to create a pattern, consisting of 0.5mm wide lines, that fills in your object. The gaps shown in your object are likely smaller than this, and thus can't be filled.</p>
<p>I am not familiar with the flashforge software, but different slicers have different ways of dealing with this. Some offer a "gap fill" option that uses tricks to be able to fill in these very tiny gaps by rapidly moving the extruder back and forth over the gap. However, even then, it is sometimes unavoidable that tiny gaps remain. Some gaps are just too small to fill with the comparatively large nozzle.</p>
| 718
|
<p>I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of <strong><em>memory and speed</em></strong>, way of doing this? </p>
<p>A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be faster. The list option would also require that I keep the data separate from the structure, while dicts would allow for something of the sort:</p>
<pre><code>graph[I][J]["Property"]="value"
</code></pre>
<p>What would you suggest?</p>
<hr>
<p>Yes, I should have been a bit clearer on what I mean by efficiency. In this particular case I mean it in terms of random access retrieval.</p>
<p>Loading the data in to memory isn't a huge problem. That's done once and for all. The time consuming part is visiting the nodes so I can extract the information and measure the metrics I'm interested in.</p>
<p>I hadn't considered making each node a class (properties are the same for all nodes) but it seems like that would add an extra layer of overhead? I was hoping someone would have some direct experience with a similar case that they could share. After all, graphs are one of the most common abstractions in CS.</p>
|
<p>I would strongly advocate you look at <a href="http://networkx.github.com/" rel="noreferrer">NetworkX</a>. It's a battle-tested war horse and the first tool most 'research' types reach for when they need to do analysis of network based data. I have manipulated graphs with 100s of thousands of edges without problem on a notebook. Its feature rich and very easy to use. You will find yourself focusing more on the problem at hand rather than the details in the underlying implementation.</p>
<p><strong>Example of <a href="http://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_model" rel="noreferrer">Erdős-Rényi</a> random graph generation and analysis</strong></p>
<pre><code>
"""
Create an G{n,m} random graph with n nodes and m edges
and report some properties.
This graph is sometimes called the Erd##[m~Qs-Rényi graph
but is different from G{n,p} or binomial_graph which is also
sometimes called the Erd##[m~Qs-Rényi graph.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
__credits__ = """"""
# Copyright (C) 2004-2006 by
# Aric Hagberg
# Dan Schult
# Pieter Swart
# Distributed under the terms of the GNU Lesser General Public License
# http://www.gnu.org/copyleft/lesser.html
from networkx import *
import sys
n=10 # 10 nodes
m=20 # 20 edges
G=gnm_random_graph(n,m)
# some properties
print "node degree clustering"
for v in nodes(G):
print v,degree(G,v),clustering(G,v)
# print the adjacency list to terminal
write_adjlist(G,sys.stdout)
</code></pre>
<p>Visualizations are also straightforward:</p>
<p><img src="https://i.stack.imgur.com/5biM9.jpg" alt="enter image description here"></p>
<p>More visualization: <a href="http://jonschull.blogspot.com/2008/08/graph-visualization.html" rel="noreferrer">http://jonschull.blogspot.com/2008/08/graph-visualization.html</a></p>
|
<p>No doubt NetworkX is the best data structure till now for graph. It comes with utilities like Helper Functions, Data Structures and Algorithms, Random Sequence Generators, Decorators, Cuthill-Mckee Ordering, Context Managers</p>
<p>NetworkX is great because it wowrs for graphs, digraphs, and multigraphs. It can write graph with multiple ways: Adjacency List, Multiline Adjacency List,
Edge List, GEXF, GML. It works with Pickle, GraphML, JSON, SparseGraph6 etc. </p>
<p>It has implimentation of various radimade algorithms including:
Approximation, Bipartite, Boundary, Centrality, Clique, Clustering, Coloring, Components, Connectivity, Cycles, Directed Acyclic Graphs,
Distance Measures, Dominating Sets, Eulerian, Isomorphism, Link Analysis, Link Prediction, Matching, Minimum Spanning Tree, Rich Club, Shortest Paths, Traversal, Tree.</p>
| 2,359
|
<p>I'm printing part for a chess board from a set on Thingiverse, expanded a little to 50 mm square.
After the 3<sup>rd</sup> layer, I'm seeing what looks like raised ripples, and you can feel them with a finger too. I didn't see this when printing just 4 pieces earlier.
PLA at ~200 °C, bed is PEX/flex steel/magnet/AL.</p>
<p><a href="https://i.stack.imgur.com/TK9ZG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TK9ZG.jpg" alt="enter image description here"></a></p>
<p>The initial layer also had some streakiness (?) after the 1<sup>st</sup> layer.</p>
<p>Odd, as the bed tests out as pretty level using the paper under the nozzle test.</p>
<p><a href="https://i.stack.imgur.com/HYaQp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HYaQp.jpg" alt="enter image description here"></a></p>
<hr>
<p>Looking much better now that the infill is starting. Will have to look into calibrating the extruder when this print finishes. Printed a 6 hour iPhone stand yesterday, turned out really nice.</p>
<p><a href="https://i.stack.imgur.com/abdqo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/abdqo.jpg" alt="enter image description here"></a></p>
<hr>
<p>Top layer is nearing done (looks like top layer is finishing, then the lip to go for the edge of the board) and all signs of the rippling are gone.
Will check the 'level' again before we start on the light color squares.</p>
<p><a href="https://i.stack.imgur.com/Obcff.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Obcff.jpg" alt="enter image description here"></a></p>
|
<p>Printing some more parts tonight. Looks like solution is better bed "leveling" (tramming, or basically squareness between X, Y, and Z axis). Getting it dialed in to the correct height, 1/4 turn of a bed leveling screw at a time.</p>
<p>Also ordered some metal (stainless steel) shims so we can get and check the bed level more accurately than "this index card plus a little bit" as the card measures ~0.16mm and we want 0.18mm to 0.2mm or maybe 0.22mm it seems.</p>
|
<p>It looks like over-extrusion. When layers are printed with 100% infill, excess material has nowhere to go and these characteristic ripples form.</p>
<p>Always calibrate your extruder. 3D Hubs have a good article on the topic:</p>
<p><a href="https://www.3dhubs.com/talk/t/howto-calibrate-tune-and-fine-tune-your-printer-and-filament/5695" rel="nofollow noreferrer">How To Calibrate, Tune and Fine Tune your printer and filament</a></p>
| 1,387
|
<p>How can you <strong>cascade</strong> filter the attributes of more dimensions in a SSAS cube, viewed in Excel 2007.</p>
<p>For example, if we have a cube <em>Sales</em> with the dimension <em>Time</em> and dimension <em>Client</em>, once the dimension <em>Time</em> is filtered to show only the sales from a particular date, if "Client.ClientName" is chosen as a filter in the filter area, how can the list of clients be filtered so that only the clients that have sales in the particular date, be shown.</p>
|
<p>Take a look at <a href="http://www.clicksoft.ro" rel="nofollow noreferrer">www.clicksoft.ro</a> </p>
<p>The product named QuickCubeFiltrator is a wizard like addin for excel 2007 that does cascade filtering. Might be what you need.</p>
|
<p>I have tried this before and haven't had much luck. Not sure you can really do it easily. You can try using named sets and calculated members but most of the time it depends on your data and hierarchies. You can also look at reporting services, and how it does it behind the scenes in MDX, but I don't know what good that will do you in Excel though. Like I said, this is a tough one.</p>
| 8,981
|
<p>I'm a bit perplexed by drag and drop in wxPython (but perhaps this questions pertains to drag and drop in other GUI frameworks as well). The frameworks provides a couple of callbacks (OnEnter and OnDragOver) that purportedly allow me to inform the system whether the current mouse position is a valid place to drop whatever it is that is being dragged. From these methods I can return wx.DragNone, wx.DragCopy, etc. What baffles me is that from within these methods I am not allowed to call GetData, which means I am not allowed to examine the data that the user is dragging. If I cannot see the data, how am I supposed to know whether it is OK for the user to drop here?</p>
|
<p>@Geoff- </p>
<p>The system, which has been in production for 8+ years, was architected to use PL/SQL for the CRUDs and <em>most</em> of the business logic. The PL/SQL also generates 90% of the presentation layer (HTML/JavaScript), using <a href="http://www.orafaq.com/wiki/Mod_plsql_FAQ" rel="nofollow noreferrer">mod PL/SQL</a>. The other 10% is report data done via Oracle Reports Builder.</p>
<p>So, there isn't application code like you'd see in more modern, better architected systems. I do <strong>want</strong> to do things the <em>right</em> way, I just don't have that luxury given organizational constraints.</p>
|
<p>I wonder why you don't want to bring the data from Oracle into some application code and make JSON there?</p>
| 4,624
|
<p>When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and re-insert them manually.</p>
<p>I <em>know</em> you can reorder columns fairly easily in a DataGridView, however that would result in a lot of hardcoding and I want the designer to match up to the grid.</p>
<p>Does anyone know of any easier way of achieving this or is cutting/pasting the only available method?</p>
<p>I tried manually editing the .designer.cs file, but reordering properties there doesn't appear to do anything!</p>
<p><strong>Edit:</strong> Just to make it clear - I want to reorder what's in the LINQ to SQL designer, not what's in the table. I haven't made an error in ordering requiring a reversion to the original table layout; rather I have a table which I want to possess a different ordering in Visual Studio than in SQL Server.</p>
|
<p>Using Linq-to-Sql, you can have columns in the DataGridView appear different than in the original table by:</p>
<ol>
<li>In your Linq query, extract the columns that you want, in the order than you want, and store them in a var. Then the autogenerate columns should show them in that order in the DataGridView</li>
<li>Use Template columns in your DataGridView</li>
<li>Do not use drag-and-drop on the Linq-to-Sql design surface to create your entities. Rather, create them by hand and associate them with the database table using table and column properties</li>
</ol>
<p>As far as I know, there is no drag-and-drop column reorder in the designer itself</p>
|
<p>If you are in the scenario where you have reordered the columns in the database, and you now want to have this new order be reflected in the designer, I think that you have to delete the table from the designer and then put it in again. Or if you use <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" rel="nofollow noreferrer">SqlMetal</a> to generate your Linq-to-Sql classes, rerun it on your database and use the newly generated file.</p>
| 5,872
|
<p>I'm working on a C#/ASP.NET project that has all the javascript files in a /Javascript folder. If I refer to the JS file using this syntax: src="/Javascript/jsfile.js" then the file is correctly picked up if the project is deployed to the root of the URL.</p>
<p>However, if this "web site" is deployed to a sub-folder of the main url this won't work. So the solution could be to use relative urls - but there's a problem with that as well because the master pages reference many of the javascript files and these master pages can be used by pages in the root and in subfolders many levels deep.</p>
<p>Does anybody have any ideas for resolving this?</p>
|
<p>If you reference the JS-file in a section that is "runat=server" you could write src="~/Javascript/jsfile.js" and it will always work.</p>
<p>You could also do this in your Page_Load (In your masterpage):</p>
<pre><code>Page.ClientScript.RegisterClientScriptInclude("myJsFile", Page.ResolveClientUrl("~/Javascript/jsfile.js"))
</code></pre>
|
<p>@Jared: IE needs that /script . FF doesn't care.</p>
| 6,481
|
<p>I really enjoy Chrome, and the sheer exercise of helping a port would boost my knowledge-base.</p>
<p>Where do I start?</p>
<p>What are the fundamental similarities and differences between the code which will operated under Windows and Linux?</p>
<p>What skills and software do I need?</p>
<hr />
<h3>Note:</h3>
<p>The official website is Visual Studio oriented!<br />
Netbeans or Eclipse are my only options.<br />
I will not pay Microsoft to help an Open Source project.</p>
|
<p>EDIT: (2/6/10)</p>
<p>A Beta version of Chrome has been released for Linux. Although it is labeled beta, it works great on my Ubuntu box. You can download it from Google:</p>
<p><a href="http://www.google.com/chrome?platform=linux" rel="nofollow noreferrer">http://www.google.com/chrome?platform=linux</a></p>
<p>EDIT: (5/31/09)</p>
<p>Since I answered this question, there have been more new developments in Chrome (actually "Chromium") for Linux: An alpha build has been released. This means it's not fully functional.</p>
<p>If you use Ubuntu, you're in luck: add the following lines to your /etc/apt/sources.list</p>
<pre><code>deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
</code></pre>
<p>Then, at the command line:</p>
<pre><code>aptitude update
aptitude install chromium-browser
</code></pre>
<p>Don't forget to s/jaunty/yourUbuntuVersion/ if necessary. Also, you can s/aptitude/apt-get/, if you insist.</p>
<p>And.... <strong>Yes</strong>, it works. I'm typing this in my freshly installed Chromium browser right now!</p>
<p>The build is hosted by launchpad, and gave me some security warnings upon install, which I promptly ignored. Here's the website: <a href="https://launchpad.net/~chromium-daily/+archive/ppa" rel="nofollow noreferrer">https://launchpad.net/~chromium-daily/+archive/ppa</a></p>
<p><strong><em>The original answer:</em></strong></p>
<p><a href="http://code.google.com/p/chromium/wiki/LinuxBuildInstructions" rel="nofollow noreferrer">Linux Build Instructions</a></p>
|
<p>Read this article on Chrome and Open Source on Linux:</p>
<p><a href="http://arstechnica.com/journals/linux.ars/2008/09/02/google-unveils-chrome-source-code-and-linux-port" rel="noreferrer">http://arstechnica.com/journals/linux.ars/2008/09/02/google-unveils-chrome-source-code-and-linux-port</a></p>
<p>The Google V8 JavaScript Engine is also open source and available here if you want to contribute;</p>
<p><a href="http://code.google.com/p/v8/" rel="noreferrer">http://code.google.com/p/v8/</a></p>
<p>If you want to contribute on Chronium, here are the instructions:</p>
<p><a href="http://dev.chromium.org/developers/contributing-code" rel="noreferrer">http://dev.chromium.org/developers/contributing-code</a></p>
<blockquote>
<p><a href="http://dev.chromium.org/Home" rel="noreferrer">Chromium</a> is an open-source browser
project that aims to build a safer,
faster, and more stable way for all
Internet users to experience the web.
This site contains design documents,
architecture overviews, testing
information, and more to help you
learn to build and work with the
Chromium source code.</p>
</blockquote>
<p>Here is how you can get started:</p>
<p><a href="http://dev.chromium.org/developers/how-tos/getting-started" rel="noreferrer">http://dev.chromium.org/developers/how-tos/getting-started</a></p>
<hr>
<p>EDIT: Two more questions was added to the original question.</p>
<p>Building on Linux requires the following software:</p>
<ul>
<li>Subversion >= 1.4 </li>
<li>pkg-config >= 0.20</li>
<li>Python >= 2.4</li>
<li>Perl >= 5.x</li>
<li>gcc/g++ >= 4.2</li>
<li>bison >= 2.3</li>
<li>flex >= 2.5.34</li>
<li>gperf >= 3.0.3</li>
<li>libnss3-dev >= 3.12</li>
</ul>
<p>On Ubuntu 8.04, you can fetch all of the above as follows:</p>
<pre><code>$ sudo apt-get install subversion pkg-config python perl g++ bison flex gperf libnss3-dev
</code></pre>
<blockquote>
<p><strong>Note</strong>: There is no working
Chromium-based browser on Linux.
Although many Chromium submodules
build under Linux and a few unit tests
pass, all that runs is a command-line
"all tests pass" executable.</p>
</blockquote>
| 7,060
|
<p>I use solr to search for documents and when trying to search for documents using this query "<code>id:*</code>", I get this query parser exception telling that it cannot parse the query with * or ? as the first character. </p>
<pre><code>HTTP Status 400 - org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery
type Status report
message org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery
description The request sent by the client was syntactically incorrect (org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery).
</code></pre>
<p>Is there any patch for getting this to work with just * ? Or is it very costly to do such a query?</p>
|
<p>If you want all documents, do a query on *:*</p>
<p>If you want all documents with a certain field (e.g. id) try id:[* TO *]</p>
|
<p>I'm assuming with id:* you're just trying to match all documents, right?</p>
<p>I've never used solr before, but in my Lucene experience, when ingesting data, we've added a hidden field to every document, then when we need to return every record we do a search for the string constant in that field that's the same for every record.</p>
<p>If you can't add a field like that in your situation, you could use a RegexQuery with a regex that would match anything that could be found in the id field.</p>
<p>Edit: actually answering the question. I've never heard of a patch to get that to work, but I would be surprised if it could even be made to work reasonably well. See <a href="https://stackoverflow.com/questions/8532/with-lucene-why-do-i-get-a-too-many-clauses-error-if-i-do-a-prefix-search">this question</a> for a reason why unconstrained PrefixQuery's can cause a problem.</p>
| 3,674
|
<p>After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question.</p>
<p>What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to understand?</p>
|
<p>Eric Sink has a <a href="http://www.ericsink.com/scm/source_control.html" rel="nofollow noreferrer">good overview of source control</a>. There are also some <a href="https://stackoverflow.com/questions/871/why-is-git-better-than-subversion">existing</a> <a href="https://stackoverflow.com/questions/2658/version-control-getting-started">questions</a> here on SO.</p>
|
<p>Just start using source control, no matter what type you use. What you use doesn't matter; it's the use of it that is important</p>
| 2,590
|
<p>If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them</p>
<pre><code><a href='<%# "/Admin/Content/EditResource.aspx?ResourceId=" + Eval("Id").ToString() %>'>Edit</a>
</code></pre>
<p>I see this practice everywhere but it seems weird to me as I no longer am able to get compile time errors if I change the property name.
My preferred approach is to do something like this</p>
<pre><code><a runat="server" id="MyLink">Edit</a>
</code></pre>
<p>and then in the code behind</p>
<pre><code>MyLink.Href= "/Admin/Content/EditResource.aspx?ResourceId=" + myObject.Id;
</code></pre>
<p>I'm really interested to hear if people think the above approach is better since that's what I always see on popular coding sites and blogs (e.g. Scott Guthrie) and it's smaller code, but I tend to use ASP.NET because it is compiled and prefer to know if something is broken at compile time, not run time.</p>
|
<p>I wouldnt call it bad practice (some would disagree, but why did they give us that option in the first place?), but I would say that you'll improve overall readability and maintainability if you do not submit to this practice. You already conveyed out a good point, and that is IDE feature limitation (i.e., design time inspection, compile time warning, etc.).</p>
<p>I could go on and on about how many principles it violates (code reuse, separation of concerns, etc.), but I can think of many applications out there that break nearly every principle, but still work after several years. I for one, prefer to make my code as modular and maintainable as possible.</p>
|
<p>It's up to you. Sometimes "spagehetti" code is easier to maintain than building/using a full on templating system for something simple, but once you get fairly complicated pages, or more specifically, once you start including a lot of logic into the page itself, it can get dirty really quickly. </p>
| 9,399
|
<p>I made a simple logo using Inkscape, after saving as an svg file, but when I export that file into Fusion 360 something strange happened.</p>
<p>Multiple times I convert some images (png, svg) to svg file. The process I use is this:</p>
<ol>
<li>Scan logo image (scanner or smartphone)</li>
<li>Open image with Inkscape</li>
<li>Using the stroke, generate the shape</li>
<li>All process for generate and save</li>
</ol>
<p>This process explained above always works for me, when I copy the shape using the <em>stroke</em> in Inkscape.</p>
<p>However, when I was do the process using the <em>shape generator</em> - for example, rectangles, circles, squares, etc. - and export the file into the Fusion 360, it doesn't work.</p>
<h3>1 - Inkscape logo</h3>
<p><a href="https://i.stack.imgur.com/eA3Wz.png" rel="nofollow noreferrer" title="Inkscape"><img src="https://i.stack.imgur.com/eA3Wz.png" alt="inkscape" title="Inkscape" /></a></p>
<h3>2 - Logo import to Fusion 360</h3>
<p><a href="https://i.stack.imgur.com/9vskK.png" rel="nofollow noreferrer" title="Import into Fusion 360"><img src="https://i.stack.imgur.com/9vskK.png" alt="Import into Fusion 360" title="Import into Fusion 360" /></a></p>
<p>In the example above, the first word does not appear.</p>
|
<h1>read first</h1>
<p>When you use painters tape, you need to level your printer <strong>with</strong> the tape applied. You need to relevel if you change the tape type.</p>
<h1>Basics</h1>
<p>It's not <em>any</em> blue tape that printers love. There are basically two factors that make a tape useful:</p>
<ul>
<li>It has to stick during printing.</li>
<li>Its surface has to allow the filament to stick to it.</li>
</ul>
<p>Let's look at some <a href="https://www.youtube.com/watch?time_continue=2&v=GIEaOdKVCO8" rel="nofollow noreferrer">different tapes</a> and their suitability - from my own experience.</p>
<h2>ScotchBlue</h2>
<p>The <em>original</em> blue tape is actually <a href="https://www.scotchblue.com/3M/en_US/scotchblue/" rel="nofollow noreferrer">ScotchBlue</a> for delicate surfaces by 3M. It has a good surface to stick to and at the same time an adhesive that does not degrade to unsuitability by heating. The delicate surface one is just as good as the all surfaces type. But don't use the outdoor type, it is sealed too much.</p>
<h2>FrogTape</h2>
<p><a href="https://www.frogtape.com/" rel="nofollow noreferrer">FrogTape</a> has an adhesive that has no problems with heating, the surface is sometimes a little smoother. Its green variant is about as useful as ScotchBlue, while the yellow variant is easier to remove - which can be an issue when the printhead is not calibrated correctly.</p>
<h2>Generic painters tape</h2>
<p><em>Generic</em> painters tape is a can of worms - there are so many different ones it is hard to describe. I have had very good off-yellow rolls from the dollar store of the 'fine surface' type - as in the tape had a fine surface - and their adhesive was good and didn't degrade too much under heat. The followup roll was a little thinner of material and released under heat so it can be a hit and miss - it's ok for starting out though.</p>
<p>I also tried a roll of UHU painters tape of the <em>easy remove</em> type and it was <em>horrible</em>, as it didn't want to stick after the nozzle went over it once even on an unheated bed.</p>
<h2>Generic blue colored tape</h2>
<p>I even tried two blue colored tapes from different dollar/hobby stores. One was ok-ish and had a similar result as the good dollar store tape in look, but left a blue shadow on the base of the print after two or three prints. The other was showing similar behavior to other mild-adhesive/easy peel tapes.</p>
<h2>Conclusion</h2>
<p>It's not <em>color</em> that matters, it is the <em>formulation</em>. If you must use blue tape, spend the extra bucks for quality. Some bloggers <a href="https://3dprinting-blog.com/61-trying-out-different-kinds-of-tapes-for-3d-printing-on/" rel="nofollow noreferrer">compared other tapes</a>, tested <a href="http://www.3dprinterprices.net/kapton-tape-vs-blue-painters-tape/" rel="nofollow noreferrer">ScotchBlue vs Kapton</a>, <a href="https://all3dp.com/2/3d-printer-tape-the-best-tape-for-better-adhesion/" rel="nofollow noreferrer">discussed the benefits of either</a>, <a href="http://www.desiquintans.com/bluetape" rel="nofollow noreferrer">discussed the ScotchBlue tape in depth</a>.</p>
<p>While in general, I prefer to print on the surface of my (blue) BuildTak (clone), I occasionally whip out painters tape on an unheated surface for very delicate prints: I remove the print together with the tape from the surface, which allows better handling. Sacrificing a layer of tape only costs some cents after all while breaking a print is hours and filament for much more money wasted.</p>
|
<p>The second image isn't exactly painter's tape. Both images are types of masking tape, but the common manila/cream-colored masking tape vs the blue or green painter's tape <em>typically</em> has three features that make it less desirable for bed adhesion:</p>
<ol>
<li>Stronger glue holding the tape to the bed, that will make it harder to change later.</li>
<li>Narrower strips, so it's harder and takes longer to place the tape on the bed.</li>
<li>Thicker, softer material. This is <em>good</em> for filament adhesion, but bad for separating from the filament after the print and accurately leveling the bed.</li>
</ol>
<p>Again: those are only typical arrangements. You can get blue painters tape at the same narrow width as manila masking tape, and you can get wider or thin manila tape. It's more a matter of what you'll commonly find for sale, and in all probability the manila/cream-colored tape will work just fine.</p>
| 1,319
|
<p>I have a prusa i3 with Mendel firmware and a RAMPS board. Recently it has been randomly stopping during prints. The LCD screen will lock up, the print will stop, and the heating elements will turn off. Pressing the reset button on the RAMPS restarts the system and it works fine.</p>
<p>In addition to stopping during prints, it has also frozen up while just sitting while on.</p>
<p>My first thought is the power supply (12V 30A) is going bad, but is there anything else I should check before I buy a new one and replace it?</p>
<p>Update:</p>
<p>I replaced the power supply with a new one, and the printer did not stop and completed a print. I am voting to close the question.</p>
|
<p>It could be several things.</p>
<p>Your ramps board is overheating or has to much load on it. If you're not cooling the ramps board adding a fan may help the issue. </p>
<p>I know Robo3D had this issue and started shipping with a fan to cool the ramps board.</p>
<p>The ramps/arduino board could be faulty, the firmware may have gotten corrupted or the current version has a bug in the code.</p>
<p>If you are not printing from the sdcard on the lcd controller and using software through a usb connection, that computer may be causing the issue as well.</p>
|
<p>I had the same thing, the printer was not heating the nozzle anymore after starting the print. I fixed this by reinstalling the firmware.</p>
<p>It could also be that your stepper drivers are overheating. you can add a fan to cool them.</p>
<p>The SD card could be bad, maybe try an other card or another .gcode file.</p>
<p>It is probably not your power supply, a 30A power supply is more than enough, but you can measure the volts on the power supply while the printer is running, if it is around 12V it is probably alright.</p>
| 257
|
<p>I need to execute a large set of SQL statements (creating a bunch of tables, views and stored procedures) from within a C# program.</p>
<p>These statements need to be separated by <code>GO</code> statements, but <code>SqlCommand.ExecuteNonQuery()</code> does not like <code>GO</code> statements. My solution, which I suppose I'll post for reference, was to split the SQL string on <code>GO</code> lines, and execute each batch separately.</p>
<p>Is there an easier/better way?</p>
|
<p>Use SQL Server Management Objects (SMO) which understands GO separators. See my blog post here: <a href="http://weblogs.asp.net/jgalloway/archive/2006/11/07/Handling-_2200_GO_2200_-Separators-in-SQL-Scripts-_2D00_-the-easy-way.aspx" rel="noreferrer">http://weblogs.asp.net/jongalloway/Handling-_2200_GO_2200_-Separators-in-SQL-Scripts-<em>2D00</em>-the-easy-way</a></p>
<p>Sample code:</p>
<pre><code>public static void Main()
{
string scriptDirectory = "c:\\temp\\sqltest\\";
string sqlConnectionString = "Integrated Security=SSPI;" +
"Persist Security Info=True;Initial Catalog=Northwind;Data Source=(local)";
DirectoryInfo di = new DirectoryInfo(scriptDirectory);
FileInfo[] rgFiles = di.GetFiles("*.sql");
foreach (FileInfo fi in rgFiles)
{
FileInfo fileInfo = new FileInfo(fi.FullName);
string script = fileInfo.OpenText().ReadToEnd();
using (SqlConnection connection = new SqlConnection(sqlConnectionString))
{
Server server = new Server(new ServerConnection(connection));
server.ConnectionContext.ExecuteNonQuery(script);
}
}
}
</code></pre>
<p>If that won't work for you, see Phil Haack's library which handles that: <a href="http://haacked.com/archive/2007/11/04/a-library-for-executing-sql-scripts-with-go-separators-and.aspx" rel="noreferrer">http://haacked.com/archive/2007/11/04/a-library-for-executing-sql-scripts-with-go-separators-and.aspx</a></p>
|
<p>Too difficult :)</p>
<p>Create array of strings str[] replacing GO with ",@" :</p>
<pre><code> string[] str ={
@"
USE master;
",@"
CREATE DATABASE " +con_str_initdir+ @";
",@"
-- Verify the database files and sizes
--SELECT name, size, size*1.0/128 AS [Size in MBs]
--SELECT name
--FROM sys.master_files
--WHERE name = N'" + con_str_initdir + @"';
--GO
USE " + con_str_initdir + @";
",@"
SET ANSI_NULLS ON
",@"
SET QUOTED_IDENTIFIER ON
",@"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Customers]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Customers](
[CustomerID] [int] IDENTITY(1,1) NOT NULL,
[CustomerName] [nvarchar](50) NULL,
CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED
(
[CustomerID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
",@"
SET ANSI_NULLS ON
",@"
SET QUOTED_IDENTIFIER ON
",@"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GOODS]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[GOODS](
[GoodsID] [int] IDENTITY(1,1) NOT NULL,
[GoodsName] [nvarchar](50) NOT NULL,
[GoodsPrice] [float] NOT NULL,
CONSTRAINT [PK_GOODS] PRIMARY KEY CLUSTERED
(
[GoodsID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
",@"
SET ANSI_NULLS ON
",@"
SET QUOTED_IDENTIFIER ON
",@"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Orders]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Orders](
[OrderID] [int] IDENTITY(1,1) NOT NULL,
[CustomerID] [int] NOT NULL,
[Date] [smalldatetime] NOT NULL,
CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED
(
[OrderID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
",@"
SET ANSI_NULLS ON
",@"
SET QUOTED_IDENTIFIER ON
",@"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OrderDetails]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[OrderDetails](
[OrderID] [int] NOT NULL,
[GoodsID] [int] NOT NULL,
[Qty] [int] NOT NULL,
[Price] [float] NOT NULL,
CONSTRAINT [PK_OrderDetails] PRIMARY KEY CLUSTERED
(
[OrderID] ASC,
[GoodsID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
",@"
SET ANSI_NULLS ON
",@"
SET QUOTED_IDENTIFIER ON
",@"
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[InsertCustomers]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
create PROCEDURE [dbo].[InsertCustomers]
@CustomerName nvarchar(50),
@Identity int OUT
AS
INSERT INTO Customers (CustomerName) VALUES(@CustomerName)
SET @Identity = SCOPE_IDENTITY()
'
END
",@"
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Orders_Customers]') AND parent_object_id = OBJECT_ID(N'[dbo].[Orders]'))
ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[Customers] ([CustomerID])
ON UPDATE CASCADE
",@"
ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_Customers]
",@"
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_OrderDetails_GOODS]') AND parent_object_id = OBJECT_ID(N'[dbo].[OrderDetails]'))
ALTER TABLE [dbo].[OrderDetails] WITH CHECK ADD CONSTRAINT [FK_OrderDetails_GOODS] FOREIGN KEY([GoodsID])
REFERENCES [dbo].[GOODS] ([GoodsID])
ON UPDATE CASCADE
",@"
ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_GOODS]
",@"
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_OrderDetails_Orders]') AND parent_object_id = OBJECT_ID(N'[dbo].[OrderDetails]'))
ALTER TABLE [dbo].[OrderDetails] WITH CHECK ADD CONSTRAINT [FK_OrderDetails_Orders] FOREIGN KEY([OrderID])
REFERENCES [dbo].[Orders] ([OrderID])
ON UPDATE CASCADE
ON DELETE CASCADE
",@"
ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_Orders]
"};
for(int i =0; i<str.Length;i++)
{
myCommand.CommandText=str[i];
try
{
myCommand.ExecuteNonQuery();
}
catch (SystemException ee)
{
MessageBox.Show("Error "+ee.ToString());
}
}
</code></pre>
<p>That's all, enjoy.</p>
| 6,208
|
<p>Anyone who writes client-side JavaScript is familiar with the DOM - the tree structure that your browser references in memory, generated from the HTML it got from the server. JavaScript can add, remove and modify nodes on the DOM tree to make changes to the page. I find it very nice to work with (browser bugs aside), and very different from the way my server-side code has to generate the page in the first place.</p>
<p>My question is: what server-side frameworks/languages build a page by treating it as a DOM tree from the beginning - inserting nodes instead of echoing strings? I think it would be very helpful if the client-side and server-side code both saw the page the same way. You could certainly hack something like this together in any web server language, but a framework dedicated to creating a page this way could make some very nice optimizations.</p>
<p>Open source, being widely deployed and having been around a while would all be pluses.</p>
|
<p>You're describing <a href="http://www.youtube.com/watch?v=1QD9XQm_Jd4" rel="nofollow noreferrer">Rhino on Rails</a>, which is not out but will be soon.
Similarly, <a href="http://www.aptana.com/jaxer/" rel="nofollow noreferrer">Aptana Jaxer</a>, however RnR will include an actual framework (Rails) whereas Jaxer is just the server technology.</p>
|
<p>I see where you're coming from but it's all a bit moot isn't it. You can't send anything but rendered content to the browser, and you have to do it all in one go (AJAX aside). There's no value from what you are suggesting (from what I can see) as even if you build it tree-like, you're still only building a page which is sent wholesale to the client.</p>
| 3,569
|
<p>I have problems with layer widths and uneven outer walls on my 3D prints. Sometimes layers are squeezed and sometimes pushed outside. I noticed that these problems happen when there are retractions on layers. I don't have problems with round and simple objects without changes on layers or where all layers are identical.</p>
<p><a href="https://i.stack.imgur.com/wgANn.jpg" rel="nofollow noreferrer" title="Image showing uneven layers"><img src="https://i.stack.imgur.com/wgANn.jpg" alt="Image showing uneven layers" title="Image showing uneven layers" /></a></p>
<p>I think that this can be linked with pressure in the nozzle or retraction. It looks like sometimes the pressure is too high and it's pushing too much filament and sometimes it's too low and it's not pushing enough filament. In this picture, layers in the first circle are squished in and it looks like there is not enough filament being pushed from the nozzle. In the second circle layer is pushed out and is wider than other layers. Looks like there is not enough filament being extruded at the start of the layer and too much being extruded at the end.</p>
<p><a href="https://i.stack.imgur.com/eTbfq.jpg" rel="nofollow noreferrer" title="Image showing two areas: one with layer pushed in, and one with layer pushed out"><img src="https://i.stack.imgur.com/eTbfq.jpg" alt="Image showing two areas: one with layer pushed in, and one with layer pushed out" title="Image showing two areas: one with layer pushed in, and one with layer pushed out" /></a></p>
<p>This problem happens always on the same layers, where there are some retractions on these layers. I tried to print the same objects multiple times and it always occurs on the same layers.</p>
<p><a href="https://i.stack.imgur.com/UIP6a.jpg" rel="nofollow noreferrer" title="Image showing squished in layers"><img src="https://i.stack.imgur.com/UIP6a.jpg" alt="Image showing squished in layers" title="Image showing squished in layers" /></a></p>
<p><a href="https://i.stack.imgur.com/GyHLJ.jpg" rel="nofollow noreferrer" title="Image showing squished out layers"><img src="https://i.stack.imgur.com/GyHLJ.jpg" alt="Image showing squished out layers" title="Image showing squished out layers" /></a></p>
<p>What have I did to fix this problem:</p>
<ul>
<li>calibrated e-steps and slicer flow,</li>
<li>tightened belts,</li>
<li>different slicers (Cura, PrusaSlicer),</li>
<li>different filaments (e.g. PrusamentPLA),</li>
<li>disabled combing in slicer,</li>
<li>printed with and without infills,</li>
<li>different retraction distance (from 3 mm to 8 mm),</li>
<li>different retraction speeds (from 20 mm/s to 80 mm/s),</li>
<li>different retraction accelerations (from 500 to 1500),</li>
<li>different hotend temperatures (from 200 °C to 230 °C),</li>
<li>slow printing speed (up to 15 mm/s),</li>
<li>calibrated K-factor (also tried many values from 0.0 to 2.0),</li>
<li>calibrated junction deviation (also tried many values from 0.0 to 0.3),</li>
<li>printed with and without cooling.</li>
</ul>
<p>I think, that disabling coasting and changes in retraction settings helped a little, but not too much.</p>
<p>My setup:</p>
<ul>
<li>Ender 5, SKR mini E3 V1.2</li>
<li>Capricorn PTFE Bowden tube,</li>
<li>printing with PLA, but this problem also occurs with PETG.</li>
</ul>
<p>The most similar issue I've found is this question, <a href="https://3dprinting.stackexchange.com/q/10738/4762">Inconsistent Layer Issues</a>, but this didn't resolve my problem.</p>
<p><strong>How can I get rid of inconsistency in layers widths and get smoother outer walls?</strong></p>
<hr>
<p>I calibrated K-factor with <a href="https://marlinfw.org/tools/lin_advance/k-factor.html" rel="nofollow noreferrer">K-factor Calibration Pattern</a> and discovered that lines are always thicker after retraction at the start of the line and thinner at the end of the line. Then I generated and printed test files to confirm this. My lines are always thicker at the start of the line and they get thinner later. This is the problem presented in the second picture.</p>
<p>I printed 3 cubes (dimensions of a cube: X=0.2 mm, Y=100 mm, Z=10 mm). This is the result.</p>
<p><a href="https://i.stack.imgur.com/UFWb8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UFWb8.jpg" alt="Result of printing 3 cubes (X:0.2 mm, Y:100 mm, Z:10 mm)" /></a></p>
<p>This is the best representation of my problem. The order of printing was as follows: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 1 -> 2 etc. There are under extrusions at the end of the second and third line (points 4 and 6) and under extrusion at the start of the first line (point 1). These under extrusions are before (points 4 and 6) and after (point 1) travel moves.</p>
<p><strong>What can cause this problem?</strong></p>
|
<p>You can do this provided the part releases consistently after cooling. Your filament choice may cause problems, though. ABS is prone to warping and a fan constantly blowing on the part would make it worse. The second thing to consider would be the release agent. I assume you are using gluestick or something similar on the bed. This may be pulled off the bed after a couple prints.</p>
|
<p>In theory you could knock the item off the build plate and into a bin by positioning the print head behind the part and then pushing.</p>
<p>However your build plate would need to have a smooth front edge, so no clips in the way.</p>
<p>You'd also want to have some delay to let the bed cool down before attempting this, and have spare belts on hand for the day the installed belt breaks.</p>
<p>A fan may work IF you can control it to come on after the part has finished printing, AND your printer will release a finished part given time. Also, your finished part must be strong enough to survive the impact and fall without damage, else what's the point?</p>
<p>Also, your effective print volume would shrink - there has to be enough space at the back to drop the print head behind the part using gcode, and then slide the bed backward until the part falls off. You couldn't use the back ~75mm of the bed.</p>
<p>Personally I always have to use a scraper and occasionally a light hammer tap, so a fan wouldn't do anything.</p>
<hr />
<p>If I were doing this, I'd either pony up and buy one of those Creality belt-fed printers that have a rolling platform, and drop parts off the front. The CR-30 <a href="https://www.creality3dofficial.com/products/cr-30-infinite-z-belt-3d-printer" rel="nofollow noreferrer">https://www.creality3dofficial.com/products/cr-30-infinite-z-belt-3d-printer</a> or other manufacturers would have the same.</p>
<p>The other more homebrew option would be to consider where the bed ends up after job is done, and then have some kind of "wiper" mechanism that comes from the side and pushes the part over and off the bed. It would have to be low enough to get any brim and priming lines out of the way too. Since the printer probably can't control this, you'd be looking at an external controller like a computer running a print server, orchestrating the wiper and then starting the next job.</p>
<p>You'll also want a really big roll of filament, or a filament-out sensor so you're not printing air.</p>
| 2,027
|
<p>...instead of using the Atom syndication format?</p>
<p>Atom is a <a href="http://www.atomenabled.org/developers/syndication/" rel="noreferrer">well-defined</a>, general-purpose XML syndication format. RSS is fractured into four different versions. All the major feed readers have supported Atom for as long as I can remember, so why isn't its use more prevalent?</p>
<p>Worst of all are sites that provide feeds in both formats - what's the point?!</p>
<ul>
<li>UPDATE (18 August): Interestingly,
this site itself is using Atom for
its feeds rather than RSS.</li>
</ul>
|
<p>The fundamental thing that the Atom creators didn't understand (and that the Atom supporters still don't understand), is that Atom isn't somehow separate from RSS. There's this idea that RSS fractured, and that somehow Atom fixes that problem. But it doesn't. Atom is just another RSS splinter. A new name doesn't change the fact that it's just one more standard competing to do the same job, a job for which <em>any</em> of the competing standards are sufficient.</p>
<p>No one outside a fairly small group of people care at all which standard is used. They just want it to work. Atom, RSS 2.0, RSS 1.0, RSS 401(k), whatever. As long as it works, the users are happy. The RSS "brand" very much defines the entire feed category, though, so on the rare occasion that someone <em>does</em> know enough to choose, they will tend to choose RSS, because it's got "the name." They will also tend to choose RSS 2.0, because it's got the bigger number.</p>
<p>RSS, and especially RSS 2.0, are very much entrenched in the feed "industry." Atom hasn't taken off because it doesn't bring much except a new name. Why switch away from RSS when it works just fine? And why even bother using Atom on new projects if RSS is sufficient? Switching to a new feed format mostly means extra time spent learning the new format.</p>
<p>If nothing else <a href="http://www.apple.com/itunes/store/podcaststechspecs.html" rel="noreferrer">Apple's exclusive use of RSS 2.0 for podcasts</a> means that RSS 2.0 is here for the foreseeable future.</p>
|
<p>There are a lot of RSS feed readers out there that people are used to using, and most importantly, RSS is very well known and has been around much longer. Why mess with something if it works?</p>
| 3,353
|
<p>My Ender 5 Plus (original) does not perform leveling.</p>
<p>After the self-leveling command, the Z axis only descends.
I have already exchanged the BLTouch three times, and the problem remains unchanged.</p>
<p>I bought my E5P in December, in America, to bring it to Brazil, I had to completely dismantle it.</p>
<p>Machine reassembled, I start work again, everything works very well.
But, one day, I made the mistake of stopping an impression (due to problems with the appearance of the piece) and, before removing the piece from the bed, I pressed the HOME command, which caused the hotend/BLTouch to rest on the printed part, forcing the whole mechanism.</p>
<p>Well, I changed the BLTouch and the problems really started.<br />
When I send the leveling command, the Z-axis behaves erratically, going down instead of returning to the beginning and, with each command, it goes down more and more.</p>
<p>I changed the leveler again, the problem persisted, I disassembled piece by piece, wiped a general cleaning, applied a clean solution to contacts all over the electronics, reassembled, reinstalled the firmware (Version 1.71.0 KF), and everything went back to work.</p>
<p>Yesterday, I sent a piece for printing (PLA nozzle 1.00 mm, layer 0.36 mm, speed 100 mm/s, infill 40 %), and left for my morning walk. When I returned, there was a huge ball of melted material, adhered to the hotend, again more problems. I disassembled the entire hotend, carried out the total cleaning, reassembled it, and let's go back to work.</p>
<p>Leveling OK, there was a problem with the thermistor and the heating of the nozzle, I changed the thermistor and the heater cartridge (taking the opportunity, since several times the system had heating problems, when the temperature should be above 230 °C / 446 °F). Everything ready, come on...</p>
<ul>
<li>Leveling problem has returned.</li>
<li>BLTouch exchange done, nothing done</li>
<li>Loading the firmware again, nothing done</li>
<li>Review of connections, nothing done</li>
</ul>
<p>The Z-axis continues to descend, not responding to commands, and in the Pronterface the message appears:</p>
<pre><code>Error: STOP called because of BLTouch error - restart with M999
Error: STOP called because of BLTouch error - restart with M999
</code></pre>
<p>I've already exchanged BLTouch 2 times and it didn't work out.
I have 2 inductive levelers here, maybe the solution is to install them and forget the BLTouch, or do the leveling manually.</p>
<p>Questions:</p>
<ol>
<li>Has anyone had this kind of problem with the printer? If so, what is the solution?</li>
<li>removing the leveler and performing manual leveling, has anyone tried this? What changes in Marlin need to be made?</li>
<li>Does the replacement of the BLTouch by an inductive sensor imply in what firmware changes? Is there a tutorial about it?</li>
</ol>
<p>I appreciate any help you can get from friends</p>
|
<p>I had the same problem with my Ender 5 Plus.</p>
<p>There is a small set screw at the top of the BLTouch you will need to tighten this in to adjust the location of the sensor pin. Keep screwing it more and more until you see it initialize reliably that is it should move out and back twice to initialize.</p>
<p>When the BLTouch initializes correctly then the leveling can be completed.</p>
|
<p>I had the same issue. The probe for the BL touch was just stuck.</p>
<p>I manually pulled it out and tightened the screw and then the problem was fixed.</p>
| 1,930
|
<p>Let me preface this with me being quite a newbie to 3D printing, however, I am an engineer and coder, so tinkering with stuff like this is quite the norm for me. Don't be afraid to be too technical, knowledge is power!</p>
<p>I recently purchased a new Creality Ender 3 V2 based on a friend's recommendation and within a week or two, started getting terrible screeching from the print head fan. I already knew I wanted to get better PETG (and in the future, TPU) prints so I went ahead and bought a direct drive extruder (BIQU H2) to replace the Bowden setup.</p>
<p>I got everything tuned pretty well (or so I thought), which included tuning the E-steps (945 which is 10x the original value of 93, however normal for this BIQU H2), my home position, changing the retraction setting, setting my K-factor for linear advance, tuning PID, etc. I flashed these settings into a custom Jyers Marlin firmware. Everything was working fine, and I was starting to get some really high-quality calibration tests, so I then began tuning my slicer profile.</p>
<p>Then, yesterday, all of a sudden it is no longer printing correctly, even older G-code files before I messed with the slicer settings. It prints the prime line, retracts, moves, prints the brim, then retracts again, but doesn't start extruding to actually print the model. I've tried multiple G-code files that were working, and seem to get the same results, nothing prints beyond the first layer retraction or two. There is no clicking/vibrating or any attempts to move the extruder again after it stops printing.</p>
<p>After some more reading, it seems that maybe I should have adjusted the vRef on extruder driver pots, as the new stepper motor is 0.8a (I believe the original 4042 extruder is 2a). Is it possible I damaged my stepper driver for the extruder? From my understanding, it would be moving at 10x the speed of the old stepper attached to the Bowden tube extruder.</p>
<p>Some things I have done:</p>
<ul>
<li>Completely rebuilt the BIQU H2. There is no sign of jamming or that there has ever been a jam. The gears all move smoothly with no areas with additional resistance. The PTFE heatbreak was clear and freely allowed filament through. Once re-assembled, I can freely turn the extruder gear when heated and the stepper disabled, and I can extrude/retract using the printer GUI (even after a failed print). I also checked to make sure the gear was firmly attached to the stepper motor while apart, and it was. I also added some gear lubricant while I was in there.</li>
<li>Tried a print with the BIQU H2 stepper detached and the wires attached to the old 4042 stepper (and adjusted the steps back to 93). It seems to stop moving the stepper in about the same place, so I don't believe the issue has to do with the stepper motor which has led me to believe this must be firmware or driver related.</li>
<li>Tried letting the printer sit idle overnight, thinking maybe it was just an overheated driver after running calibration tests almost continuously for 2 days.</li>
<li>Tried printing the same known working G-code with the speed adjusted to 25% and 50%, the same issue occurs around the same position in the print process.</li>
</ul>
<p>For reference, I have an Ender 3 V2 with a 4.2.2 Motherboard. I'm not sure what stepper drivers it uses as there seems to be conflicting info online and I don't really want to remove the heatsinks if possible (but I will if I need to get this info and can't obtain it directly from the firmware). Unfortunately, the drivers are soldered to the motherboard so I guess I will need a new motherboard if I destroyed the extrusion driver. I do feel I probably should have made some driver adjustments given this stepper motor is 40% the amps, and runs at 10x the speed of the old stepper.</p>
<p>I'm sort of at a loss as to what to try next, any thoughts would be appreciated. I plan on flashing the stock firmware back later this evening to see if that helps, but I doubt it will. I have only made some small tweaks mainly related to home offset, build area, PID tune, and K-factor for linear advance (which were previously working fine).</p>
<p><strong>Edit:</strong>
I did some further testing yesterday. Flashing back to stock firmware didn't help at all. It also seems I may have been mistaken as further testing of the old 4042 stepper was successful if I attached it to the motherboard and ran the G-code which fails on the first layer, however I attached it with a spare cable as to not have to take apart my harness going to the X carriage. Using the same spare cable with the BIQU H2 unfortunately did not help. The issue is reproducible without any filament loaded at all as well. There is an ever so slight play in the motor drive, so I am going to disassemble the extruder again tonight and see if the issue is reproducible with the motor detached from the extruder drivetrain.</p>
<p>Also, just an interesting point, but multiple times after the failure I quickly checked the temp of the heatsinks on the drivers. Ironically, the only "hot" ones were the X/Y/Z steppers, and the extruder driver was only warm. Also, when the issue happens, the stepper becomes completely disengaged (I can turn the wheel freely without feeling the resistance of the stepper holding the position). Not sure if this is indicative of a driver failure, or standard practice for the driver if it encounters significant resistance.</p>
<p>Another interesting point, the motherboard was not grounded. Although attached indirectly to the frame using screws, the panel the motherboard was attached to was not making contact with the frame. Some minor sanding resolved this issue. Once done, I notice the exterior case of my Y motor is grounded, but the X and Z as well as the extruder do not seem to be grounded. Is it typical for the exterior of the motors to be grounded? Perhaps there are some other ground faults I need to sort.</p>
|
<p>Okay, so after yet another frustrating night of troubleshooting. I believe I have identified the specific problem. I reduced the G-code file to about 100 lines of code, that 100% reproduced the issue on the BIQU H2 stepper. With the original 4042 stepper, the problem was intermittent, but did occur from time to time in the same part of the print.</p>
<p>I pulled the motor from the transmission on the BIQU H2 and observed the issue happen without it attached to the extruder and it still failed at the same place (so confirmed it wasn't an issue with the extruder/clogging/etc). This specific place in the G-code had many quick short movements of the extruder. Commenting out this block of code allowed it to get past, until it did similar movements on the next layer. This pointed me to it having to be an issue with either the stepper (which tested fine on my ohm meter, so unlikely), the controller, or the firmware.</p>
<p>Long story short: <strong>It was Linear Advance being enabled in the firmware.</strong></p>
<p>I was too hasty to initially disregard the firmware being at fault. When I retested the original firmware, it was unusable as my offsets have changed with the new print head, so I rebuilt the Jyers Marlin with just a couple small changes for changing the homing as the original Jyers builds works fine. However I missed that I still had my Linear Advance settings enabled.</p>
<p>After doing some searching regarding Linear Advance and extruder motors, it seems this is a known issue with certain TMC drivers, and my board is one that can potentially have these drivers installed. It seems the "stealthChop" feature within the drivers causes issues with Linear Advance. It sounds like it can be disabled via UART but I do not believe there is any interface to the UART of the individual controller chips exposed to my mtherboard. I believe I will probably need to swap motherboards if I want to be able to use Linear Advance. I'm still pretty new to 3D printing, so maybe I don't need LA at all, however it did seem to make a positive impact on my prints before I ran into these issues which is why I had it enabled.</p>
<p>Some related references I found:</p>
<p><a href="https://github.com/KevinOConnor/klipper/issues/196#issuecomment-383122655" rel="nofollow noreferrer">https://github.com/KevinOConnor/klipper/issues/196#issuecomment-383122655</a>
<a href="https://www.reddit.com/r/ender3/comments/bncr8w/silent_board_and_linear_advance/" rel="nofollow noreferrer">https://www.reddit.com/r/ender3/comments/bncr8w/silent_board_and_linear_advance/</a></p>
|
<p>Check your retraction and run some experiments with it. I just had a very similar problem, when I switched from 0.6 mm retraction to 0.8 mm filament tended to get stuck between rolers and the cooler on layer change.
I don't have and never had linear advance enabled, so it's not the issue.
Unless I've misunderstood and your extruder didn't move at all (mine did move properly)</p>
| 1,997
|
<p>I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load.</p>
<p>How could I go about doing this?</p>
|
<p>You can use the <a href="http://php.net/manual/en/function.eval.php" rel="nofollow noreferrer">eval</a> command for this. <strong>I would recommend against this though, because there's a lot of pitfalls using this approach.</strong> Debugging is hard(er), it implies some security risks (bad content in the DB gets executed, uh oh).</p>
<p>See <a href="https://stackoverflow.com/questions/951373/when-is-eval-evil-in-php">When is eval evil in php?</a> for instance. Google for Eval is Evil, and you'll find a lot of examples why you should find another solution.</p>
<p>Addition: Another good article with some references to exploits is <a href="http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/" rel="nofollow noreferrer">this blogpost</a>. Refers to past vBulletin and phpMyAdmin exploits which were caused by improper Eval usage.</p>
|
<p>How I did this is to have a field in the database that identified something unique about the block of code needing to be executed. That one word is in the file name of that code. I put the strings together to point to the php file to be included. example:</p>
<pre><code>$lookFor = $row['page'];
include("resources/" . $lookFor . "Codebase.php");
</code></pre>
<p>In this way even if a hacker could access you DB he couldn't put malicious code straight in there to be executed. He could perhaps change the reference word, but unless he could actually put a file directly onto the server it would do him no good. If he could put files directly onto the server, you're sunk then anyway if he really wants to be nasty. Just my two cents worth.</p>
<p>And yes, there are reasons you would want to execute stored code, but there are cons.</p>
| 6,269
|
<p>I have written a Silverlight 2 application communicating with a WCF service (BasicHttpBinding). The site hosting the Silverlight content is protected using a ASP.NET Membership Provider. I can access the current user using HttpContext.Current.User.Identity.Name from my WCF service, and I have turned on AspNetCompatibilityRequirementsMode. </p>
<p>I now want to write a Windows application using the exact same web service. To handle authentication I have enabled the <a href="http://msdn.microsoft.com/en-us/library/bb386582.aspx" rel="noreferrer">Authentication service</a>, and can call "login" to authenticate my user... Okey, all good... But how the heck do I get that authentication cookie set on my other service client?! </p>
<p>Both services are hosted on the same domain </p>
<ul>
<li>MyDataService.svc <- the one dealing with my data</li>
<li>AuthenticationService.svc <- the one the windows app has to call to authenticate.</li>
</ul>
<p>I don't want to create a new service for the windows client, or use another binding...</p>
<p>The Client Application Services is another alternative, but all the examples is limited to show how to get the user, roles and his profile... But once we're authenticated using the Client Application Services there should be a way to get that authentication cookie attached to my service clients when calling back to the same server.</p>
<p>According to input from colleagues the solution is adding a wsHttpBinding end-point, but I'm hoping I can get around that...</p>
|
<p>I finally found a way to make this work. For authentication I'm using the "<a href="http://msdn.microsoft.com/en-us/library/bb386582.aspx" rel="noreferrer">WCF Authentication Service</a>". When authenticating the service will try to set an authentication cookie. I need to get this cookie out of the response, and add it to any other request made to other web services on the same machine. The code to do that looks like this:</p>
<pre><code>var authService = new AuthService.AuthenticationServiceClient();
var diveService = new DiveLogService.DiveLogServiceClient();
string cookieHeader = "";
using (OperationContextScope scope = new OperationContextScope(authService.InnerChannel))
{
HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty();
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty;
bool isGood = authService.Login("jonas", "jonas", string.Empty, true);
MessageProperties properties = OperationContext.Current.IncomingMessageProperties;
HttpResponseMessageProperty responseProperty = (HttpResponseMessageProperty)properties[HttpResponseMessageProperty.Name];
cookieHeader = responseProperty.Headers[HttpResponseHeader.SetCookie];
}
using (OperationContextScope scope = new OperationContextScope(diveService.InnerChannel))
{
HttpRequestMessageProperty httpRequest = new HttpRequestMessageProperty();
OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);
httpRequest.Headers.Add(HttpRequestHeader.Cookie, cookieHeader);
var res = diveService.GetDives();
}
</code></pre>
<p>As you can see I have two service clients, one fo the authentication service, and one for the service I'm actually going to use. The first block will call the Login method, and grab the authentication cookie out of the response. The second block will add the header to the request before calling the "GetDives" service method.</p>
<p>I'm not happy with this code at all, and I think a better alternative might be to use "Web Reference" in stead of "Service Reference" and use the .NET 2.0 stack instead.</p>
|
<p>It is possible to hide much of the extra code behind a custom message inspector & behavior so you don't need to take care of tinkering with the OperationContextScope yourself.</p>
<p>I'll try to mock something later and send it to you.</p>
<p>--larsw</p>
| 8,001
|
<p>I would like to know how to infer coercions (a.k.a. implicit conversions) during type inference. I am using the type inference scheme described in <a href="http://people.cs.uu.nl/bastiaan/phdthesis/index.html" rel="noreferrer">Top Quality Type Error Messages</a> by Bastiaan Heeren, but I'd assume that the general idea is probably the same in all Hindley-Milner-esque approaches.</p>
<p>It seems like coercion could be treated as a form of overloading, but the overloading approach described in this paper doesn't consider (at least not in a way I could follow) overloading based on requirements that the context places on return type, which is a must for coercions. I'm also concerned that such an approach might make it difficult to give priority to the identity coercion, and also to respect the transitive closure of coercibility. I can see sugaring each coercible expression, say <em>e</em>, to coerce(<em>e</em>), but sugaring it to coerce(coerce(coerce(... coerce(<em>e</em>) ...))) for some depth equal to the maximum nesting of coercions seems silly, and also limits the coercibility relation to something with a finite transitive closure whose depth is independent of the context, which seems (needlessly?) restrictive.</p>
|
<p>I hope you get some good answers to this.</p>
<p>I haven't yet read the paper you link to but it sounds interesting. Have you looked at all how ad-hoc polymorphism (basically overloading) works in Haskell? Haskell's type system is H-M plus some other goodies. One of those goodies is type classes. Type classes provide overloading, or as Haskeller's call it, ad-hoc polymorphism.</p>
<p>In GHC, the most widely used Haskell compiler, the type classes are implemented by passing dictionaries at run-time. The dictionary lets the run-time system do a lookup from type to implementation. Supposedly, <a href="http://repetae.net/computer/jhc/" rel="nofollow noreferrer">jhc</a> can use super-optimization to pick the right implementation at compile time but I'm skeptical it handles the fully polymorphic cases that Haskell can allow and I know of no formal proofs or papers asserting the correctness.</p>
<p>It sounds like your type inference will run into the same problems as other rank-n polymorphic approaches. You may well want to read some of the papers here for additional background: <a href="http://research.microsoft.com/~simonpj/" rel="nofollow noreferrer">Scroll down to "Papers about types"</a> His papers are haskell specific but the type theoretic stuff should be meaningful and useful to you.</p>
<p>I think this paper about rank-n polymorphism and the type checking issues should spark some interesting thoughts for you: <a href="http://research.microsoft.com/~simonpj/papers/higher-rank/" rel="nofollow noreferrer">http://research.microsoft.com/~simonpj/papers/higher-rank/</a></p>
<p>I wish I could provide a better answer! Good luck.</p>
|
<p>Could you give a little more clarification as to what exactly it is you're asking?</p>
<p>I have a slight idea, and if my idea is right then this answer should suffice as my answer. I believe you're talking about this from the perspective of someone who's creating a language, in which case you can look at a language like ActionScript 3 for an example. In AS3 you can typecast two different ways: 1) <em>NewType(object)</em>, or 2) <em>object as NewType</em>.</p>
<p>From an implementation standpoint I imaging every class should define it's own ways of converting to whichever types it <em>can</em> convert to (an Array can't really convert to an integer...or can it?). For example, if you try <em>Integer(myArrayObject)</em>, and myArrayObject does not define a way of converting to and Integer, you can either throw an exception or let it be and simply pass in the original object, uncasted.</p>
<p>My entire answer could be totally off though :-D Let me know if this isn't what you're looking for</p>
| 9,507
|
<p>So the SMEs at my current place of employment want to try and disable the back button for certain pages. We have a page where the user makes some selections and submits them to be processed. In some instances they have to enter a comment on another page. </p>
<p>What the users have figured out is that they don't have to enter a comment if they submit the information and go to the page with the comment and then hit the back button to return to the previous page. </p>
<p>I know there are several different solutions to this (and many of them are far more elegant then disabling the back button), but this is what I'm left with. Is it possible to prevent someone from going back to the previous page through altering the behavior of the back button. (like a submit -> return false sorta thing). </p>
<p>Due to double posting information I can't have it return to the previous page and then move to the current one. I can only have it not direct away from the current page. I Googled it, but I only saw posts saying that it will always return to the previous page. I was hoping that someone has some mad kung foo js skills that can make this possible.</p>
<p>I understand that everyone says this is a bad idea, and I agree, but sometimes you just have to do what you're told.</p>
|
<p>Don't do this, just don't. It's bad interface design and forces the user's browser to behave in a way that they don't expect.</p>
<p>I would regard any script that successfully stopped my back button from working to be a hack, and I would expect the IE team to release a security-fix for it.</p>
<p>The back button is part of their program interface, not your website.</p>
<p>In your specific case I think the best bet is to add an unload event to the page that warns the user if they haven't completed the form. The back button would be unaffected and the user would be warned of their action.</p>
|
<p>There simply is no reliable way to do this. You cannot guarantee that 100% of the time you can stop the user from doing this.</p>
<p>With that in mind, is it worth going to extremely exotic solutions to disable "most" of the time? That's for you to decide.</p>
<p>Good luck.</p>
| 7,815
|
<p>I need to script the creation of app pools and websites on IIS 6.0. I have been able to create these using adsutil.vbs and iisweb.vbs, but don't know how to set the version of ASP.NET for the sites I have just created to 2.0.50727.0.</p>
<p>Ideally I would like to adsutil.vbs to update the metabase. How do I do this?</p>
|
<p>@<a href="https://stackoverflow.com/questions/20923/vbscriptiis-how-do-i-automatically-set-aspnet-version-for-a-particular-website#20953">Chris</a> beat me to the punch on the ADSI way</p>
<p>You can do this using the aspnet_regiis.exe tool. There is one of these tools per version of ASP.NET installed on the machine. You could shell out to -</p>
<p>This configures ASP.NET 1.1</p>
<pre><code>%windir%\microsoft.net\framework\v1.1.4322\aspnet_regiis -s W3SVC/[iisnumber]/ROOT
</code></pre>
<p>This configures ASP.NET 2.0</p>
<pre><code>%windir%\microsoft.net\framework\v2.0.50727\aspnet_regiis -s W3SVC/[iisnumber]/ROOT
</code></pre>
<p>You probably already know this, but if you have multiple 1.1 and 2.0 sites on your machine, just remember to switch the website you're changing ASP.NET versions on to compatible app pool. ASP.NET 1.1 and 2.0 sites don't mix in the same app pool.</p>
|
<p>I found the following script <a href="http://www.diablopup.net/post/Set-an-IIS-Object%27s-ASPNET-Version-Using-VBScript.aspx" rel="nofollow noreferrer">posted</a> on Diablo Pup's blog. It uses ADSI automation.</p>
<pre><code>'******************************************************************************************
' Name: SetASPDotNetVersion
' Description: Set the script mappings for the specified ASP.NET version
' Inputs: objIIS, strNewVersion
'******************************************************************************************
Sub SetASPDotNetVersion(objIIS, strNewVersion)
Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap
Dim strSearchText, strReplaceText
Select Case Trim(LCase(strNewVersion))
Case "1.1"
strReplaceText = "v1.1.4322"
Case "2.0"
strReplaceText = "v2.0.50727"
Case Else
wscript.echo "WARNING: Non-supported ASP.NET version specified!"
Exit Sub
End Select
ScriptMaps = objIIS.ScriptMaps
arrVersions(0) = "v1.1.4322"
arrVersions(1) = "v2.0.50727"
'Loop through all three potential old values
For Each thisVersion in arrVersions
'Loop through all the mappings
For thisScriptMap = LBound(ScriptMaps) to UBound(ScriptMaps)
'Replace the old with the new
ScriptMaps(thisScriptMap) = Replace(ScriptMaps(thisScriptMap), thisVersion, strReplaceText)
Next
Next
objIIS.ScriptMaps = ScriptMaps
objIIS.SetInfo
wscript.echo "<-------Set ASP.NET version to " & strNewVersion & " successfully.------->"
End Sub
</code></pre>
| 4,129
|
<p>In C#, what is the difference (if any) between these two lines of code?</p>
<pre><code>tmrMain.Elapsed += new ElapsedEventHandler(tmrMain_Tick);
</code></pre>
<p>and</p>
<pre><code>tmrMain.Elapsed += tmrMain_Tick;
</code></pre>
<p>Both appear to work exactly the same. Does C# just assume you mean the former when you type the latter?</p>
|
<p>I did this</p>
<pre><code>static void Hook1()
{
someEvent += new EventHandler( Program_someEvent );
}
static void Hook2()
{
someEvent += Program_someEvent;
}
</code></pre>
<p>And then ran ildasm over the code.<br>
The generated MSIL was exactly the same.</p>
<p>So to answer your question, yes they are the same thing.<br>
The compiler is just inferring that you want <code>someEvent += new EventHandler( Program_someEvent );</code><br>
-- You can see it creating the new <code>EventHandler</code> object in both cases in the MSIL</p>
|
<p>I think the one way to really tell would be to look at the MSIL produced for the code.. Tends to be a good acid test..</p>
<p>I have funny concerns that it may somehow mess with GC.. Seems odd that there would be all the overhead of declaring the new delegate type if it never needed to be done this way, you know?</p>
| 4,653
|
<p>Is accessing a <strong>bool</strong> field atomic in C#? In particular, do I need to put a lock around:</p>
<pre><code>class Foo
{
private bool _bar;
//... in some function on any thread (or many threads)
_bar = true;
//... same for a read
if (_bar) { ... }
}
</code></pre>
|
<p><strong>Yes.</strong></p>
<blockquote>
<p>Reads and writes of the following data types are atomic: bool, char, byte, sbyte, short, ushort, uint, int, float, and reference types. </p>
</blockquote>
<p>as found in <a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/variables#atomicity-of-variable-references" rel="noreferrer">C# Language Spec</a>.</p>
<p>Edit: It's probably also worthwhile understanding the <a href="https://msdn.microsoft.com/en-us/library/x13ttww7(v=vs.140).aspx" rel="noreferrer"><strong>volatile</strong></a> keyword.</p>
|
<p>the approach I have used, and I think is correct, is</p>
<pre><code>volatile bool b = false;
.. rarely signal an update with a large state change...
lock b_lock
{
b = true;
//other;
}
... another thread ...
if(b)
{
lock b_lock
{
if(b)
{
//other stuff
b = false;
}
}
}
</code></pre>
<p>the goal was basically to avoid having to repetively lock an object on every iteration just to check if we needed to lock it in order to provide a large amount of state change information which occurs rarely. I <em>think</em> this approach works. And if absolute consistancy is required, I <em>think</em> volatile would be appropriate on the b bool.</p>
| 8,398
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.