instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>In the image, <a href="https://i.stack.imgur.com/fcPgL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fcPgL.png" alt="enter image description here"></a>there is an object circled in blue on the anet a8 printer that I need to buy a replacement of, however, I can not find it online, please help.</p>
<p>This is the throat block for direct drive extrusion, Anet8 is a cheap clone of Prusa printers, so it's easy to find parts for Anet printers. </p> <p>This is one extruder kit that may help your needs, <a href="https://es.aliexpress.com/store/product/1Set-3D-Printer-makerbot-MK8-Extruder-Aluminum-extrusion-Frame-Block-DIY-Kit-for-Reprap-i3/1962255_32715673423.html?spm=a219c.search0104.3.269.W5yIqd&amp;ws_ab_test=searchweb0_0,searchweb201602_2_10152_10065_10151_10344_10068_10345_10342_10343_10173_10340_10341_10541_10562_10084_10083_10307_10060_10155_5680016_10154_10056_10055_10539_10537_10312_10059_10313_10314_10534_10533_100031_10103_10073_10102_10557_10142_10107,searchweb201603_25,ppcSwitch_5&amp;btsid=79693e48-00b7-4029-908d-314b37935569&amp;algo_expid=64c2aa2b-e9de-4722-8ecb-0ba5542f5a86-34&amp;algo_pvid=64c2aa2b-e9de-4722-8ecb-0ba5542f5a86" rel="nofollow noreferrer">1 Unidades Impresora 3D makerbot MK8 Extrusora De extrusión de Aluminio Bloque de DIY Kit para Reprap i3</a>. This is a link for Aliexpress - of course there are other dealers.</p>
<p>Like @ZuOverture said the name of this component is the filament drive. Most of the manufactures sell the whole extrusion device already assembled, to avoid mismatches between the components of the extrusion device. If your device is somehow damaged, and without possibilities to be used in the printer the easiest solution would be to buy a new extrusion device. If financially is unfeasible for you, you may have the option to generate the 3D model of this piece and share the file to someone who could print this component for you. </p>
740
<p>I have a VPS host running 3 sites using Ubuntu Hardy. I've spent much time setting it up. That includes all the installation + configuration and stuff. What ways are there to do backup + restore for VPS? </p>
<p>Backups alone aren't enough. You should be keeping a detailed system log of all configuration changes you make to the system so that you can reproduce your configuration elsewhere. Ideally, perform the changes on a local VM, then write a script to perform those changes automatically, then run those scripts on the live server. By avoiding manual configuration, all your configuration is repeatable, so to deploy to a new server, you just have to run all of your scripts in sequence.</p>
<p>It'll depend a lot on what your host offers. MediaTemple and Slicehost both offer snapshot backups for a nominal fee. Contact your host and ask if they offer such a solution.</p> <p>If your host doesn't offer anything, you could always backup the critical stuff regularly to something like Amazon's S3 storage service.</p>
9,846
<p>I'm struggling with an upgrade I made to my Creality CR-10. I upgraded the extruder to an E3D V6 hotend. The extruder mount and cooling fans are installed and working, however, I'm doing something wrong with installing the bowden tube into the hotend. Inevitably after I print a few layers, the extruder jambs and the issue is always the same: the bowden tube has backed itself out a few tenths of a millimeter, and the filament has mushroomed into the vacant space and hardened so that the filament cannot go forward or backwards.</p> <p>I've tried several things to fix the issue including:</p> <ul> <li>Trying various pneumatic fittings from various suppliers</li> <li>Recutting the end of the bowden tube to attempt to make it more flush</li> <li>Replacing the bowden tube </li> <li>Three different E3D heat-breaks from different supplier</li> <li>Various ways of inserting the bowden tube including: pushing it after the fitting was screwed in, pushing it into a fitting that was back out a couple turns and then screwing the fitting in</li> </ul> <p>The only thing that has (partially) worked was when I would ductape and hot-glue the bowden tube into the fitting so it couldn't back out. However, since I'm still tweaking things, I inevitably have to disassemble things and I'm back to square one.</p> <p>I'm trying to figure out what mistake I am making to keep causing this issue. As an example, originally I used the pneumatic fittings wrong and thought I was supposed to pull the plastic part out to release the tube, rather than simply pushing it in to release the tube. (Needless to say, I wrecked a lot of fittings that way.)</p> <p>What else might I be doing wrong to keep causing this issue? What are other culprits to this issue happening repeatedly? Are there firmware settings that may help (or be aggravating the issue)?</p>
<p>You may need to secure the pneumatic coupling in the closed position with a small plastic clip (which should be supplied with the hot end).</p> <p><a href="https://i.stack.imgur.com/h3ljP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h3ljP.jpg" alt="Pneumatic coupling with retaining clip"></a></p> <p>You can print your own, providing that your printer will work for long enough (a paper clip might do the trick):</p> <p><a href="https://www.thingiverse.com/thing:2798864" rel="nofollow noreferrer">Thingiverse: Bowden Tube Clip v3</a></p> <p><strong>Addendum:</strong></p> <p>Some pneumatic couplers are sprung, so that you have to depress the coupling ring in order to release the tubing. In this case, no clip is usually required. Other pneumatic couplers (such as the one on an E3D V6) are unsprung. This makes it easier to secure and release the tube using the supplied clip. The disadvantage is that you may lose the clip. Sprung couplers sometimes lose their springiness, in which case a clip can be used to secure them in the closed position</p> <p>It's "swings and roundabouts", really. You can to choose between the awkwardness of sprung couplers, or the risk of losing a clip. Either way, print some spare clips. You may need them one day.</p>
<p>This sounds more like a problem with heat creep. When you installed the new hotend, did you reuse the old cooling solution? You might need more heatblock insulation and / or cooling power.</p>
1,235
<p>I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this.</p> <pre><code>template&lt;typename ImplemenationClass&gt; class WrapperClass { // the code goes here } </code></pre> <p>Now, how do I make sure that <code>ImplementationClass</code> can be derived from a set of classes only, similar to java's generics</p> <pre><code>&lt;? extends BaseClass&gt; </code></pre> <p>syntax?</p>
<p>It's verbose, but you can do it like this:</p> <pre><code>#include &lt;boost/utility/enable_if.hpp&gt; #include &lt;boost/type_traits/is_base_of.hpp&gt; struct base {}; template &lt;typename ImplementationClass, class Enable = void&gt; class WrapperClass; template &lt;typename ImplementationClass&gt; class WrapperClass&lt;ImplementationClass, typename boost::enable_if&lt; boost::is_base_of&lt;base,ImplementationClass&gt; &gt;::type&gt; {}; struct derived : base {}; struct not_derived {}; int main() { WrapperClass&lt;derived&gt; x; // Compile error here: WrapperClass&lt;not_derived&gt; y; } </code></pre> <p>This requires a compiler with good support for the standard (most recent compilers should be fine but old versions of Visual C++ won't be). For more information, see the <a href="http://www.boost.org/doc/libs/1_36_0/libs/utility/enable_if.html" rel="nofollow noreferrer">Boost.Enable_If documentation</a>.</p> <p>As Ferruccio said, a simpler but less powerful implementation:</p> <pre><code>#include &lt;boost/static_assert.hpp&gt; #include &lt;boost/type_traits/is_base_of.hpp&gt; struct base {}; template &lt;typename ImplementationClass&gt; class WrapperClass { BOOST_STATIC_ASSERT(( boost::is_base_of&lt;base, ImplementationClass&gt;::value)); }; </code></pre>
<p>See <a href="http://www.research.att.com/~bs/bs_faq2.html#constraints" rel="nofollow noreferrer">Stoustrup's own words on the subject</a>.</p> <p>Basically a small class, that you instantiate somewhere, e.g. the templated classes constructor.</p> <pre><code>template&lt;class T, class B&gt; struct Derived_from { static void constraints(T* p) { B* pb = p; } Derived_from() { void(*p)(T*) = constraints; } }; </code></pre>
7,921
<p>My drupal site (internal) will not display the TinyMCE editor when using Google Chrome browser. Has anyone gotten TinyMCE to work with Chrome in Drupal 5?</p>
<p>There are a number of known incompatibilities between TinyMCE and WebKit (the rendering engine used by Chrome). If you're using TinyMCE 2.x, you might want to try the <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari" rel="nofollow noreferrer">Safari plug-in to TinyMCE</a>; Safari also uses WebKit. I gather also that <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Compatiblity" rel="nofollow noreferrer">TinyMCE 3.x has better support for Safari/WebKit</a> than TinyMCE 2.x, so you might want to try upgrading to the latest 3.x version. </p> <p>HTH</p> <p>Alastair</p>
<p>I upgraded the TinyMCE to the latest, but it still fails. The editor will display the first time you try to edit after login, but subsequent editing fails to bring up the TinyMCE editor</p> <p>On the upside, Drupal 6.4 and the latest TinyMCE appear to work correctly, so I guess I'll need to update Drupal to v. 6 for this website.</p> <p>edit Refreshing the edit page renders TinyMCE in my current setup, so that's my answer for Drupal 5.7 in Chrome.</p>
7,359
<p>When asked to create system XYZ and you ask to do it in Python over PHP or Ruby, what are the main features you can mention when they require you to explain it?</p>
<p>This is one of those cases that really boil down to personal preference or situational details. If you're more comfortable and experienced with Python, then say so. Are they asking you to justify it because they're more comfortable with one of the other environments? After you're done, will the system be passed off to someone else for long-term maintenance?</p> <p>If they ask you to use a technology or language that you're not as familiar with, then make sure they know up-front that it's going to take you longer.</p>
<p>I agree with mreggen. Tell them by working in Python you can get things done faster. Getting things done faster possibly means money saved by the client. In the least it means that you are working with a language you a more comfortable in, meaning faster development, debugging, and refactoring time. There will be less time spent looking up documentation on what function to use to find the length of a string, etc. </p>
2,693
<p>We've been running <a href="http://eaccelerator.net/" rel="noreferrer" title="eAccelerator">eAccelerator</a> on each of 3 webservers and are looking to move to a <a href="http://www.danga.com/memcached/" rel="noreferrer" title="memcache">memcache</a> pool across all 3, hopefully reducing by about 2/3 our db lookups.</p> <p>One of the handy things about eAccelerator is the web-based control interface (<a href="http://eaccelerator.net/browser/eaccelerator/tags/0.9.5-rc1/control.php" rel="noreferrer" title="control.php">control.php</a>), which has proved very useful when we've had to flush the cache unexpectedly, quickly monitor which scripts are in cache, etc.</p> <p>We've been looking but haven't found anything that offers the same type of functionality for memcache - does anyone know if such a thing exists?</p> <p>Obviously flushing cache etc is easy enough with memcache on the console, but our particular set-up means we may have guys monitoring our front-end and needing to flush the cache who will not necessarily have shell access on the servers. </p>
<p><a href="http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/" rel="nofollow noreferrer">memcache.php</a> may be what you're looking for.</p> <blockquote> <p>memcache.php that you can get stats and dump from multiple memcache servers.</p> </blockquote> <p>Can <a href="http://livebookmark.net/journal/2008/07/30/memcachephp-can-delete-keys-now/" rel="nofollow noreferrer">delete keys</a> and <a href="http://livebookmark.net/journal/2008/08/28/memcachephp-flushes-servers/" rel="nofollow noreferrer">flush servers</a>.</p>
<blockquote> <p>If all you need to do is to be able to flush the cache from a web-application, you could create a simple php-page and then use the system() call...</p> </blockquote> <p>Cache flushing is part of what we're looking for, but also a way to monitor what scripts are currently in there, how much data is in there, etc - basically the same stuff available on the EA control panel page. </p> <p>We've played around with munin plugins for showing data usage, and were thinking we'd have to go down the line suggested above (system calls, etc), but were hoping that someone, somewhere would have rolled something similar already!</p>
5,749
<p>There are many different flavored HTML WYSIWYG editors from javascript to ASP.Net web controls, but all too often the features are the same. Does anyone have a favorite HTML editor they like to use in projects? Why?</p>
<p>I'm partial to TinyMCE WYSIWYG editor due to the following reasons:</p> <ol> <li><p>Javascript - so it is broadly usable regardless of the platform I'm working in.</p></li> <li><p>Easy to use - just a couple lines of code and a textarea and the control is up and running.</p></li> <li><p>Easily themed - so I can quickly make it look like the site in which it is being used</p></li> <li><p>Most importantly - easily customized to show/hide particular buttons depending on my application needs</p></li> </ol>
<p>It completely depends on what you are using it for.</p> <p>For instance, I use VS2008 for ASP.NET coding, and Notepad++ for looking at HTML source. It's all in what your end use for the editor will be. You won't care how well it renders a decent PHP development experience if all you are doing is modifying CSS files, for instance.</p>
9,146
<p>Currently I monitoring a particular file with a simple shell one-liner:</p> <pre><code>filesize=$(ls -lah somefile | awk '{print $5}') </code></pre> <p>I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further statistical use.</p>
<p>You can check the size of the file using the -s operator.</p> <pre> use strict; use warnings; use File::Slurp qw(read_file write_file); use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; use Spreadsheet::WriteExcel; my $file = 'path_to_file'; my $size_file = 'path_to_file_keeping_the_size'; my $excel_file = 'path_to_excel_file.xls'; my $current_size = -s $file; my $old_size = 0; if (-e $size_file) { $old_size = read_file($size_file); } if ($old_size new; my $excel = $parser->Parse($excel_file); my $row = 1; $row++ while $excel->{Worksheet}[0]->{Cells}[$row][0]; $excel->AddCell(0, $row, 0, scalar(localtime)); $excel->AddCell(0, $row, 1, $current_size); my $workbook = $excel->SaveAs($excel_file); $workbook->close; } else { my $workbook = Spreadsheet::WriteExcel->new($excel_file); my $worksheet = $workbook->add_worksheet(); $worksheet->write(0, 0, 'Date'); $worksheet->write(0, 1, 'Size'); $worksheet->write(1, 0, scalar(localtime)); $worksheet->write(1, 1, $current_size); $workbook->close; } } write_file($size_file, $current_size); </pre> <p>A simple way to write Excel files would be using <a href="http://search.cpan.org/dist/Spreadsheet-Write/" rel="noreferrer">Spreadsheet::Write</a>. but if you need to update an existing Excel file you should look into <a href="http://search.cpan.org/dist/Spreadsheet-ParseExcel/" rel="noreferrer">Spreadsheet::ParseExcel</a>.</p>
<p>The module you should be using is <a href="http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm" rel="nofollow noreferrer">Spreadsheet::WriteExcel</a>.</p>
9,717
<p>I'm new to printing resin miniatures for Dungeons &amp; Dragons and most of my prints are successful, i.e. one or more miniatures print as expected.</p> <p>However when I have multiple minis on the build plate the one in the middle works okay but the ones on the edges don't adhere to the build plate.</p> <p>Should I limit myself to one or two minis in the center of the build plate? Or should it work and I just need to get my settings correct?</p> <p>Note I'm using a Beam 3D Prism printer.</p>
<p>You can definitely print full build plates of minis. You just need to find correct settings. If nothing sticks to the build plate - then you should increase bottom exposure time. Also check if the build plate is even. You can also sand your build plate a little bit to make adhesion better. Additionally, print with lower print speeds to increase success. Finally, if your FEP is worn out and scratched or hazy, you should replace it.</p> <p>I own a company producing 3D printing resins. We also write extensive printing guides from time to time. You can read more on finding correct settings in this <a href="https://ameralabs.com/blog/the-complete-resin-3d-printing-settings-guide-for-beginners/" rel="nofollow noreferrer">article</a> of mine.</p>
<p>I regularly print multiple models on the build plate of an Elegoo Saturn. If your built plate is level and your tank is firmly fastened down you should have no problems.</p> <p>What I have found is the my slicer (Chitubox) will sometimes corrupt the base layer if I print multiple models. With me this usually causes the bottom layer to be deformed, and to have jutting protrusions that were not on the original layer, or for the slicer not to recognize the base layer as being flat.</p> <p>The second picture shows an example of how the skate or one model was deformed. The small pieces of cured resin are corrupted data and aren't part of any model or support structure. They were not visible in Chitubox unless I manually rotated the object view and saw little visual glitches.</p> <p>I would advice that you check your sliced files.</p> <p>See the example image:</p> <p><a href="https://i.stack.imgur.com/dnTJC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dnTJC.png" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/gQzHT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gQzHT.jpg" alt="enter image description here" /></a></p>
1,646
<p>I'd like to enable/disable some other controls based on how many items are in my <code>ListView</code> control. I can't find any event that would do this, either on the <code>ListView</code> itself or on the <code>ListViewItemCollection</code>. Maybe there's a way to generically watch any collection in C# for changes?</p> <p>I'd be happy with other events too, even ones that sometimes fire when the items don't change, but for example the <code>ControlAdded</code> and <code>Layout</code> events didn't work :(.</p>
<p>@Domenic</p> <p>Not too sure, Never quite got that far in the thought process. </p> <p>Another solution might be to extend ListView, and when adding and removing stuff, instead of calling .items.add, and items.remove, you call your other functions. It would still be possible to add and remove without events being raised, but with a little code review to make sure .items.add and .items.remove weren't called directly, it could work out quite well. Here's a little example. I only showed 1 Add function, but there are 6 you would have to implement, if you wanted to have use of all the available add functions. There's also .AddRange, and .Clear that you might want to take a look at.</p> <pre><code>Public Class MonitoredListView Inherits ListView Public Event ItemAdded() Public Event ItemRemoved() Public Sub New() MyBase.New() End Sub Public Function AddItem(ByVal Text As String) As ListViewItem RaiseEvent ItemAdded() MyBase.Items.Add(Text) End Function Public Sub RemoveItem(ByVal Item As ListViewItem) RaiseEvent ItemRemoved() MyBase.Items.Remove(Item) End Sub End Class </code></pre>
<p>I can't find any events that you could use. Perhaps you could subclass ListViewItemCollection, and raise your own event when something is added, with code similar to this.</p> <pre><code>Public Class MyListViewItemCollection Inherits ListView.ListViewItemCollection Public Event ItemAdded(ByVal Item As ListViewItem) Sub New(ByVal owner As ListView) MyBase.New(owner) End Sub Public Overrides Function Add(ByVal value As System.Windows.Forms.ListViewItem) As System.Windows.Forms.ListViewItem Dim Item As ListViewItem Item = MyBase.Add(value) RaiseEvent ItemAdded(Item) Return Item End Function End Class </code></pre>
6,936
<p>In my automated NAnt build we have a step that generates a lot of code off of the database (using SubSonic) and the code is separated into folders that match the schema name in the database. For example:</p> <ul> <li>/generated-code <ul> <li>/dbo <ul> <li>SomeTable.cs</li> <li>OtherTable.cs</li> </ul></li> <li>/abc <ul> <li>Customer.cs</li> <li>Order.cs </li> </ul></li> </ul></li> </ul> <p>The schema names are there to isolate the generated classes that an app will need. For example, there is an ABC app, that will pull in the generated code from this central folder. I'm doing that on a pre-build event, like this:</p> <blockquote> <p>del /F /Q $(ProjectDir)Entities\generated*.cs</p> <p>copy $(ProjectDir)....\generated-code\abc*.cs $(ProjectDir)Entities\generated*.cs</p> </blockquote> <p>So on every build, the Nant script runs the generator which puts all the code into a central holding place, then it kicks off the solution build... which includes pre-build events for each of the projects that need their generated classes.</p> <p>So here's the friction I'm seeing:</p> <p>1) Each new app needs to setup this pre-build event. It kind of sucks to have to do this.</p> <p>2) In our build server we don't generate code, so I actually have an IF $(ConfigurationName) == "Debug" before each of those commands, so it doens't happen for release builds</p> <p>3) Sometimes the commands fail, which fails our local build. It will fail if: - there is no generated code yet (just setting up a new project, no database yet) - there is no existing code in the directory (first build)</p> <p>usually these are minor fixes and we've just hacked our way to getting a new project or a new machine up and running with the build, but it's preventing me from my 1-click-build Nirvana.</p> <p>So I'd like to hear suggestions on how to improve this where it's a bit more durable. Maybe move the copying of the code into the application folders into the NAnt script? This seems kind of backwards to me, but I'm willing to listen to arguments for it.</p> <p>OK, fire away :)</p>
<p>How often does your DB schema change? Wouldn't it be possible to generate the database-related files on demand (e.g. when the schema changes) and then check them into your code repository?</p> <p>If your database schema doesn't change, you can also package the compiled *.cs classes and distribute the archive to other projects.</p>
<p>We have two projects in our solution that are built completely out of generated code. Basically, we run the code generator .exe as a post-build step for another project and along with generating the code, it automates the active instance of visual studio to make sure that the generated project is in the solution, that it has all of the generated code files, and that they are checked out/added to TFS as necessary. </p> <p>It very rarely flakes out during the VS automation stage, and we have to run it "by hand" but that's usually only if you have several instances of VS open with >1 instance of the solution open and it can't figure out which one it's supposed to automate. </p> <p>Our solution and process are such that the generation should always be done and correct before our auto-build gets to it, so this approach might not work for you. </p>
6,821
<p>I have a xslt stylesheet with multiple <code>xsl:import</code>s and I want to merge them all into the one xslt file.</p> <p>It is a limitation of the system we are using where it passes around the xsl stylesheet as a string object stored in memory. This is transmitted to remote machine where it performs the transformation. Since it is not being loaded from disk the href links are broken, so we need to remove the <code>xsl:import</code>s from the stylesheet.</p> <p>Are there any tools out there which can do this?</p>
<p>You can use an XSL stylesheet to merge your stylesheets. However, this is equivalent to using the xsl:include element, not xsl:import (as Azat Razetdinov has already pointed out). You can read up on the difference <a href="http://www.w3.org/TR/xslt#section-Combining-Stylesheets" rel="nofollow noreferrer">here</a>.</p> <p>Therefore you should first replace the xsl:import's with xsl:include's, resolve any conflicts and test whether you still get the correct results. After that, you could use the following stylesheet to merge your existing stylesheets into one. Just apply it to your master stylesheet:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:template match="xsl:include"&gt; &lt;xsl:copy-of select="document(@href)/xsl:stylesheet/*"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>The first template replaces all xsl:include's with the included stylesheets by using the document function, which reads in the file referenced in the href attribute. The second template is the <a href="https://stackoverflow.com/questions/56837/how-can-i-make-an-exact-copy-of-a-xml-nodes-children-with-xslt">identity transformation</a>.</p> <p>I've tested it with Xalan and it seems to work fine.</p>
<pre><code> import multiple xsl in single xsl &lt;xsl:import href="FpML_FXOption_Trade_Template1.xsl"/&gt; &lt;xsl:apply-imports/&gt; &lt;calypso:keyword&gt; &lt;calypso:name&gt;DisplayOptionStyle&lt;/calypso:name&gt; &lt;calypso:value&gt;Vanilla&lt;/calypso:value&gt; &lt;/calypso:keyword&gt; &lt;xsl:import href="FpML_FXOption_Trade_Template2.xsl"/&gt; &lt;xsl:apply-imports/&gt; </code></pre>
9,554
<p>I want to show HTML content inside Flash. Is there some way to do this? I am talking about full blown HTML (with JavaScript if possible).</p>
<p><a href="http://www.wdvl.com/Reviews/Graphics/Flash5/external.html" rel="nofollow noreferrer">Here is a decent article</a> on how to accomplish that.</p> <p><a href="https://stackoverflow.com/questions/22909/is-there-some-way-to-show-html-content-inside-flash#24396">@Flubba</a>: I didn't say "<em>great</em>" article, I said "<em>decent</em>" - there is a big difference. Besides, no one else had answered and it had been around a while. I figured a "decent" answer was better than none. I am no Flash expert, so...</p>
<p>If it is complex HTML and Javascript, one possible way is <a href="http://drumbeatinsight.com/htmlcomponent" rel="nofollow noreferrer">HTMLComponent</a>, a method that uses an iframe over your flash to make it appear like the HTML is in your app. There are a few downsides to this method however - most of them described in detail <a href="http://www.deitte.com/archives/2008/07/dont_use_iframe.htm" rel="nofollow noreferrer">at Deitte.com</a>.</p> <p>If this can move offline, you could use Air (it has an mx:HTML component built in). <a href="http://www.deitte.com/archives/2008/07/an_air_version.htm" rel="nofollow noreferrer">Deitte.com</a> has a detail of this technique as well.</p>
4,294
<p>How do I get the path of the directory in which a <a href="http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29" rel="noreferrer">Bash</a> script is located, <em>inside</em> that script?</p> <p>I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:</p> <pre><code>$ ./application </code></pre>
<pre><code>#!/usr/bin/env bash SCRIPT_DIR=$( cd -- &quot;$( dirname -- &quot;${BASH_SOURCE[0]}&quot; )&quot; &amp;&gt; /dev/null &amp;&amp; pwd ) </code></pre> <p>is a useful one-liner which will give you the full directory name of the script no matter where it is being called from.</p> <p>It will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you also want to resolve any links to the script itself, you need a multi-line solution:</p> <pre><code>#!/usr/bin/env bash SOURCE=${BASH_SOURCE[0]} while [ -L &quot;$SOURCE&quot; ]; do # resolve $SOURCE until the file is no longer a symlink DIR=$( cd -P &quot;$( dirname &quot;$SOURCE&quot; )&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; pwd ) SOURCE=$(readlink &quot;$SOURCE&quot;) [[ $SOURCE != /* ]] &amp;&amp; SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done DIR=$( cd -P &quot;$( dirname &quot;$SOURCE&quot; )&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; pwd ) </code></pre> <p>This last one will work with any combination of aliases, <code>source</code>, <code>bash -c</code>, symlinks, etc.</p> <p><strong>Beware:</strong> if you <code>cd</code> to a different directory before running this snippet, the result may be incorrect!</p> <p>Also, watch out for <a href="http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/" rel="noreferrer"><code>$CDPATH</code> gotchas</a>, and stderr output side effects if the user has smartly overridden cd to redirect output to stderr instead (including escape sequences, such as when calling <code>update_terminal_cwd &gt;&amp;2</code> on Mac). Adding <code>&gt;/dev/null 2&gt;&amp;1</code> at the end of your <code>cd</code> command will take care of both possibilities.</p> <p>To understand how it works, try running this more verbose form:</p> <pre><code>#!/usr/bin/env bash SOURCE=${BASH_SOURCE[0]} while [ -L &quot;$SOURCE&quot; ]; do # resolve $SOURCE until the file is no longer a symlink TARGET=$(readlink &quot;$SOURCE&quot;) if [[ $TARGET == /* ]]; then echo &quot;SOURCE '$SOURCE' is an absolute symlink to '$TARGET'&quot; SOURCE=$TARGET else DIR=$( dirname &quot;$SOURCE&quot; ) echo &quot;SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')&quot; SOURCE=$DIR/$TARGET # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located fi done echo &quot;SOURCE is '$SOURCE'&quot; RDIR=$( dirname &quot;$SOURCE&quot; ) DIR=$( cd -P &quot;$( dirname &quot;$SOURCE&quot; )&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; pwd ) if [ &quot;$DIR&quot; != &quot;$RDIR&quot; ]; then echo &quot;DIR '$RDIR' resolves to '$DIR'&quot; fi echo &quot;DIR is '$DIR'&quot; </code></pre> <p>And it will print something like:</p> <pre class="lang-none prettyprint-override"><code>SOURCE './scriptdir.sh' is a relative symlink to 'sym2/scriptdir.sh' (relative to '.') SOURCE is './sym2/scriptdir.sh' DIR './sym2' resolves to '/home/ubuntu/dotfiles/fo fo/real/real1/real2' DIR is '/home/ubuntu/dotfiles/fo fo/real/real1/real2' </code></pre>
<p>I want to make sure that the script is running in its directory. So</p> <pre><code>cd $(dirname $(which $0) ) </code></pre> <p>After this, if you really want to know where the you are running then run the command below.</p> <pre><code>DIR=$(/usr/bin/pwd) </code></pre>
8,466
<p>I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job.</p> <p>The error data contains all of the sever variables at the time that the error occurred. These have been formatted into an XML document that looks something to the effect of:</p> <pre><code>&lt;error&gt; &lt;serverVariables&gt; &lt;item&gt; &lt;value&gt; &lt;/item&gt; &lt;/serverVariables&gt; &lt;queryString&gt; &lt;item name=""&gt; &lt;value string=""&gt; &lt;/item&gt; &lt;/queryString&gt; &lt;/error&gt; </code></pre> <p>I would like to read this data from the string that it is stored in and display it to the user via a windows form in a useful way. XML Notepad does a cool job of formatting xml, but is not really was I am looking for since I would prefer to rather display item details in a <em>Name : string</em> format.</p> <p>Any suggestions or am I looking and a custom implementation?</p> <p>[EDIT] A section of the data that needs to be displayed:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;error host="WIN12" type="System.Web.HttpException" message="The file '' does not exist." source="System.Web" detail="System.Web.HttpException: The file '' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) at" time="2008-09-01T07:13:08.9171250+02:00" statusCode="404"&gt; &lt;serverVariables&gt; &lt;item name="ALL_HTTP"&gt; &lt;value string="HTTP_CONNECTION:close HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) " /&gt; &lt;/item&gt; &lt;item name="AUTH_TYPE"&gt; &lt;value string="" /&gt; &lt;/item&gt; &lt;item name="HTTPS"&gt; &lt;value string="off" /&gt; &lt;/item&gt; &lt;item name="HTTPS_KEYSIZE"&gt; &lt;value string="" /&gt; &lt;/item&gt; &lt;item name="HTTP_USER_AGENT"&gt; &lt;value string="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" /&gt; &lt;/item&gt; &lt;/serverVariables&gt; &lt;queryString&gt; &lt;item name="tid"&gt; &lt;value string="196" /&gt; &lt;/item&gt; &lt;/queryString&gt; &lt;/error&gt; </code></pre>
<p>You can transform your XML data using <a href="http://www.xml.com/pub/a/2002/08/14/dotnetxslt.html" rel="nofollow noreferrer">XSLT</a><br> Another option is to use XLinq.<br> If you want concrete code example provide us with sample data</p> <p><strong>EDIT</strong>: here is a sample XSLT transform for your XML file: </p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="text"/&gt; &lt;xsl:template match="//error/serverVariables"&gt; &lt;xsl:text&gt;Server variables: &lt;/xsl:text&gt; &lt;xsl:for-each select="item"&gt; &lt;xsl:value-of select="@name"/&gt;:&lt;xsl:value-of select="value/@string"/&gt; &lt;xsl:text&gt; &lt;/xsl:text&gt; &lt;/xsl:for-each&gt; &lt;/xsl:template&gt; &lt;xsl:template match="//error/queryString"&gt; &lt;xsl:text&gt;Query string items: &lt;/xsl:text&gt; &lt;xsl:for-each select="item"&gt; &lt;xsl:value-of select="@name"/&gt;:&lt;xsl:value-of select="value/@string"/&gt; &lt;xsl:text&gt; &lt;/xsl:text&gt; &lt;/xsl:for-each&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>You can apply this transform using <a href="http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx" rel="nofollow noreferrer">XslCompiledTransform</a> class. It should give output like this:</p> <blockquote> <p>Server variables:<br> ALL_HTTP:HTTP_CONNECTION:close HTTP_USER_AGENT:Mozilla/4.0 (compatible MSIE 6.0; Windows NT 5.1; SV1)<br> AUTH_TYPE:<br> HTTPS:off<br> HTTPS_KEYSIZE:<br> HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;S ) </p> <p>Query string items:<br> tid:196 </p> </blockquote>
<p>You could try using the <code>DataGridView</code> control. To see an example, load an XML file in DevStudio and then right-click on the XML and select "View Data Grid". You'll need to read the API documentation on the control to use it.</p>
5,836
<p>After a resin print completes, what is the expected process to finish the print? Is some cleaning expected? I also some manufacturers sell UV chambers to cure the print surface, is this required?</p> <p>I purchased a low-cost printer from China that is quite high-quality hardware, but sadly short on documentation. Insight on the proper post-print process is appreciated.</p>
<p>I don't think it is the thermistor degrading. To answer your question directly, all my thermistors have failed because the tiny wire has broken off, and generally the fail is “hard” not soft.</p> <p>It is more likely you’re experiencing absorbed humidity in the filament from it being out on the spool too long. this makes you have to increase the temperature.</p> <p>I’m sure if you dehydrated the spool in the oven for a bit you’d get better prints and a slightly lower print temp.</p> <p>Additionally, keep in mind that a lot of PLA on the market nowadays runs at higher temps because it’s laced with something (“PLA+”?). Check the item description for indicators of a new or improved formula.</p> <p>You could try ordering a thermistor of the same make and testing the temperature of it. You can get a half dozen for about \$10. The Marlin firmware your printer probably uses should have a section for thermistors and what kind you’re using. It’s probably type “1” which is the cheap kind.</p> <p>You can try using one of those distant head thermometers to measure the temperature wirelessly at the hot end. These are probably over \$100 right now because of COVID. I think that is how a well-resourced person would handle this (i'm not one personally).</p> <p>Maybe start with the oven and while it’s cooking, research the thermistors and what goes in to replacing one. It’s a good learning experience because one day your hotend may be irreparably clogged and you’ll want to know some of the steps to disassemble it.</p>
<p>It is indeed possible that the thermistor is broken (yet not sure). I am aware of two types of issues with thermistors:</p> <ol> <li><p>The contact (soldering) is broken, usually due to the temperature extreme variations. The thermistor will indicate the maximum temperature in case of PTC or minimum temperature in case of NTC. In some cases, due to vibrations or other factor, the contact will eventually touch, showing improbable jumps of temperature.</p> </li> <li><p>The thermistor is broken internally. In that case it will just indicate a wrong temperature. I can't say if constant temperature or constant delta.</p> </li> </ol> <p>For how to troubleshot the component, however, EE.SE seems more convenient.</p>
1,727
<p>Normally, I'm all fine with my printer and filament. But today I changed the filament for another brand and no matter what, it sticks to the nozzle so nothing comes to the bed and soon my nozzle is full of PLA... I use a sheet of paper for printer to level the bed at 0.1 mm. While leveling, I get the nozzle close enough to feel a bit of resistance from the paper while moving that sheet. Please help me...</p>
<p>I believe the problem is not so much that the filament is sticking to the nozzle; it's that the filament is not sticking to the bed.</p> <p>You've confirmed that you have correct clearance for the nozzle to bed distance. The next considerations are bed temperature and nozzle temperature. New brands often require new parameters.</p> <p>Consider to raise the bed temperature 5 °C. If you're not using any adhesive medium, perhaps a bit of glue stick will help to have the filament stick better/properly.</p> <p>It's unlikely that the nozzle temperature is incorrect, as too low would result in a nozzle clog, while too high would &quot;drizzle out&quot; and be everywhere, but don't reject too-high entirely.</p> <p>If you can get the bed adhesion correct, your nozzle should remain clear.</p>
<p>I believe the problem is not so much that the filament is sticking to the nozzle; it's that the filament is not sticking to the bed.</p> <p>You've confirmed that you have correct clearance for the nozzle to bed distance. The next considerations are bed temperature and nozzle temperature. New brands often require new parameters.</p> <p>Consider to raise the bed temperature 5 °C. If you're not using any adhesive medium, perhaps a bit of glue stick will help to have the filament stick better/properly.</p> <p>It's unlikely that the nozzle temperature is incorrect, as too low would result in a nozzle clog, while too high would &quot;drizzle out&quot; and be everywhere, but don't reject too-high entirely.</p> <p>If you can get the bed adhesion correct, your nozzle should remain clear.</p>
1,791
<p>Tag-based web sites often suffer from the delicacy of language such as synonyms, homonyms, etc. For programmers looking for information, say on Stack Overflow, concrete examples are:</p> <ul> <li>Subversion or SVN (or svn, with case-sensitive tags)</li> <li>.NET or Mono</li> <li>[Will add more]</li> </ul> <p>The problem is that we <em>do</em> want to preserve our delicacy of language and make the machine deal with it as good as possible.</p> <p>A site like del.icio.us sees its tag base grow a lot, thus probably hindering usage or search. Searching for SVN-related entries will probably list a majority of entries with both subversion and svn tags, but I can think of three issues:</p> <ol> <li>A search is incomplete as many entries may not have both tags (which are 'synonyms').</li> <li>A search is less useful as Q/A often lead to more Qs! Notably for newbies on a given topic.</li> <li>Tagging a question (note: or an answer separately, sounds useful) becomes philosophical: 'Did I Tag the Right Way?'</li> </ol> <p>One way to address these issues is to create semantic links between tags, so that subversion and SVN are automatically bound by the system, not by poor users.</p> <p><em>Is it an approach that sounds good/feasible/attractive/useful? How to implement it efficiently?</em></p>
<p>Recognizing synonyms and semantic connections is something that <i>humans are good at</i>; a solution to organizing an open-ended taxonomy like what SO is featuring would probably be well served by finding a way to leave the matching to humans.</p> <p>One general approach: someone (or some team) reviews <i>new</i> tags on a daily basis. New synonyms are added to synonym groups. Searches hit synonym groups (or, more nuanced, hit either literal matches or synonym group matches according to user preference).</p> <p>This requires support for synonym groups on the back end (work for the dev team). It requires a tag wrangler or ten (work for the principals or for trusted users). It <i>doesn't</i> require constant scaling, though&mdash;the rate at which the total tag pool grows will likely (after the initial Here Comes Everybody bump of the open beta) will in all likelihood <i>decrease</i> over time, as any organic lexicon's growth-rate does.</p> <p>Synonymy strikes me as the go-to issue. Hierarchical mapping is an ambitious and more complicated issue; it may be worth it or it may not be, but given the relative complexity of defining the hierarchy it'd probably be better left as a Phase 2 to any potential synonym project's Phase 1.</p>
<p>Tags are basically our admission that search algorithms aren't up to snuff. If we can get a computer to be smart enough to identify that things tagged "Subversion" have similar content to things tagged "svn", presumably we can parse the contents, so why not skip tags altogether, and match a search term directly to the content (i.e., autotagging, which is basically mapping keywords to results)?!</p>
4,158
<p>I have a wildcard subdomain enabled and dynamically parse the URL by passing it as-is to my <code>index.php</code> (ex. <code>somecity.domain.com</code>). </p> <p>Now, I wish to create a few subdomains that are static where I can install different application and not co-mingle with my current one (ex. <code>blog.domain.com</code>).</p> <p>My <code>.htaccess</code> currently reads:</p> <pre><code>RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </code></pre> <p>Can I manipulate this <code>.htaccess</code> to achieve what I need? Can it be done through Apache?</p>
<p>Your .htaccess does nothing useful, as Apache is probably configured with DirectoryIndex index.php. Well, it does move domain.com/a to domain.com/index.php, but I doubt that is what you want.</p> <p>Your wildcard virtualhost works because you probably have ServerAlias *.domain.com in your configuration, or a single virtualhost and DNS pointing to the address of your server. (When you have a single virtualhost, it shows up for any request, and the first listed virtualhost is the default one)</p> <p>You have to create new VirtualHosts for the static domains, leaving the default one as, well, the default one :)</p> <p>Check <a href="http://httpd.apache.org/docs/2.2/vhosts/examples.html" rel="nofollow noreferrer">these</a> <a href="http://wiki.apache.org/httpd/ExampleVhosts" rel="nofollow noreferrer">tutorials</a> that explain it all.</p>
<p>You'll have to configure apache for those static sub-domains. The "catch-all" site will be the default site configured, so that one will catch the other ones.</p>
8,393
<p>If I want to use the validation framework that you can use with ASP.NET MVC, will the JavaScript conflict with other JavaScript frameworks like jQuery or YUI?</p>
<p>No, it will not. Currently, ASP.NET MVC doesn't have an inherent validation framework. So you are free to use any server/client-side validation framework you wish.</p>
<p>There are many MVC frameworks. There are many JavaScript frameworks that have different functionalities. If you want a meaningful answer, you should choose an MVC and a JavaScript framework and ask concerning those two. Please be as detailed as possible in your questions.</p> <p>As an example, the validation handling on ActiveRecord (used in Ruby on Rails) only performs validations on the server end. You can always add JavaScript validations on top of that, but the server-side validations are what really matters for data integrity.</p>
9,087
<p>I am familiar with several approaches to making the back button work in AJAX applications in various situations, but I have not found a solution that will work gracefully in my specific scenario.</p> <p>The pages I am working with are the search interface for a site. You enter terms in a normal search box, click "go and wind up at a search results page. On the search results page there are a ton of UI controls for filtering/sorting the search results to find what you are looking for. Some of the operations triggered by these controls may take a (relatively) long time to complete (e.g. several seconds).</p> <p>This latency is fine in case where the user is initially filtering/sorting their results... there's a nice AJAX spinner and so on... however when the user clicks on a search result and then clicks on the BACK button, I would like the page to instantly be restored to the state it was in when they clicked through. </p> <p>I can restore the states using IFRAMEs/fragment identifiers as a dictionary of page history, but what ends up happening is that when the user first hits the back button the initial page is loaded, then it (re) makes the AJAX query to get the page state back, which triggers the AJAX spinner and another wait of possible several seconds.</p> <p>Is there any approach that does not require this kind of two-stage load of the page when the user returns to the page via the BACK button?</p> <p>Edited to add: I am partial to jquery but I'd be happy with solutions that depend on other libraries/toolkits or that are standalone/raw javascript.</p> <p>Edited to add: I should've added that I'm trying to avoid cookies/sessions because this prevents people having multiple brower windows/tabs open and manipulating different sets of search results at the same time.</p> <p>Edit: Matt, can you elaborate on your proposed solution (triggering a page change event via fragment identifer)? I see how this would help with BACK button clicks across the same page but not coming BACK to the search results page after clicking on a specific result.</p>
<p>Just use a <strong>cookie</strong>.</p>
<p>Would it help to trigger a page change event using the "Add some info to the # at the end of the URL approach".</p> <p>That way, clicking the back button shouldn't actually change the page, and you should be able to restore state without the first page load.</p>
5,441
<p>I have noticed major watches watch brands do not seem to offer manuals to 3D print your own parts.</p> <p>Is there a reason for this?</p> <p>I would assume in this day and age, with <a href="https://www.careeronestop.org/Toolkit/Careers/Occupations/occupation-profile.aspx?keyword=Watch%20repairers&amp;onetcode=49906400&amp;location=US" rel="nofollow noreferrer">watch repair a dying profession</a>, transitioning parts to 3D printing would be a logical next step (notice luxury watches are still very popular but <a href="https://monochrome-watches.com/top-50-swiss-watch-brands-2020-market-share-sales-editorial/" rel="nofollow noreferrer">also fluctuating</a>).</p> <p>I have found <a href="https://www.youtube.com/watch?v=_8AvZnqt5NE" rel="nofollow noreferrer">minimal information</a> on 3D printing watches. Maybe there is another name for this science and it's not typically fit for 3D printing? It appears some <a href="https://www.scmp.com/magazines/style/tech-design/article/2127463/how-3d-printing-changing-swiss-luxury-watchmaking" rel="nofollow noreferrer">purists</a> aren't into 3D printing. So it appears watch parts are <a href="https://www.productionmachining.com/articles/keeping-watch-on-small-parts" rel="nofollow noreferrer">machined</a> except for the small parts.</p>
<p>The OpenSCAD <code>surface</code> function will do this. You can feed it a greyscale image or a textfile containing a matrix. Documentation and examples can be found at <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface" rel="nofollow noreferrer">https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface</a></p> <p>OpenSCAD is a cross platform free open source cad package.</p>
<p>FreeCAD can import JPG (and IIRC TIFF and PNG as well) image files and produce a lithophane type height-map based on the brightness of each pixel. I'd be rather surprised if other 3D CAD software aimed at the 3D printing user base couldn't do the same. Most of the common free-to-use 3D CAD packages have Linux versions; FreeCAD certainly does (I use it on Kubuntu 20.04, and it should work on any recent version of any flavor of Debian-based Linux, if your hardware meets it requirements).</p>
1,956
<p>How do you write code that is easily read by other people and who have had no hand in writing any part of it?</p>
<p>The best way to ensure that others can read your code is to make sure that it is clear and concise. Namely,</p> <ul> <li>Use self documenting names for variables, functions, and classes.</li> <li>Comment complex algorithms so that the reader doesn't have to spend to long figuring out what it does.</li> <li>Ensure that tabbing and line breaks are constant throughout the code.</li> </ul> <p>Beyond that you start to get in to the areas that might be a bit subjective, most people should agree on these items.</p>
<p>Probably the most important point is to keep your syntax consistent. I would also have a look at the design guidelines for the language you are writing in.</p>
6,040
<p>I'm working with Subversion based on Windows and would like to write an easy utility in .NET for working with the Apache password file. I understand that it uses a function referred to as MD5Crypt, but I can't seem to find a description of the algorithm beyond that at some point it uses MD5 to create a hash.</p> <p>Can someone describe the MD5Crypt algorithm and password line format?</p>
<p>A precise textual description of the crypt algorithm updated for use with sha256 and sha512 is at <a href="http://www.akkadia.org/drepper/SHA-crypt.txt" rel="nofollow">http://www.akkadia.org/drepper/SHA-crypt.txt</a></p> <p>It includes contrasts with the MD5 algorithm, so it should give you what you're looking for.</p>
<p>You can find an implementation of md5crypt in the <a href="http://tcllib.sourceforge.net/doc/md5crypt.html" rel="nofollow noreferrer">tcllib package.</a> Download is available from <a href="http://sourceforge.net/project/showfiles.php?group_id=12883" rel="nofollow noreferrer">sourceforge</a>.</p> <p>You can also find an example of an apache-compatible md5crypt in the <a href="http://esup-casgeneric.sourceforge.net/api/src-html/md5/MD5Crypt.html#line.220" rel="nofollow noreferrer">source code for the CAS Generic Handler</a></p>
4,346
<p>Right, I know I am totally going to look an idiot with this one, but my brain is just <em>not</em> kicking in to gear this morning.</p> <p>I want to have a method where I can say &quot;if it goes bad, come back with this type of Exception&quot;, right?</p> <p>For example, something like (<strong>and this doesn't work</strong>):</p> <pre><code> static ExType TestException&lt;ExType&gt;(string message) where ExType:Exception { Exception ex1 = new Exception(); ExType ex = new Exception(message); return ex; } </code></pre> <p>Now whats confusing me is that we <em>KNOW</em> that the generic type is going to be of an Exception type due to the <em>where</em> clause. However, the code fails because we cannot implicitly cast <em>Exception</em> to <em>ExType</em>. We cannot explicitly convert it either, such as:</p> <pre><code> static ExType TestException&lt;ExType&gt;(string message) where ExType:Exception { Exception ex1 = new Exception(); ExType ex = (ExType)(new Exception(message)); return ex; } </code></pre> <p>As that fails too.. So <strong>is this kind of thing possible?</strong> I have a strong feeling its going to be real simple, but I am having a tough day with the old noggin, so cut me some slack :P</p> <hr /> <h2>Update</h2> <p>Thanks for the responses guys, looks like it wasn't me being a <em>complete</em> idiot! ;)</p> <p>OK, so <a href="https://stackoverflow.com/questions/41397/asking-a-generic-method-to-throw-specific-exception-type-on-fail#41398">Vegard</a> and <a href="https://stackoverflow.com/questions/41397/asking-a-generic-method-to-throw-specific-exception-type-on-fail#41404">Sam</a> got me on to the point where I could instantiate the correct type, but then obviously got stuck because the <em>message</em> param is read-only following instantiation.</p> <p><a href="https://stackoverflow.com/questions/41397/asking-a-generic-method-to-throw-specific-exception-type-on-fail#41408">Matt</a> hit the nail right on the head with his response, I have tested this and all works fine. Here is the example code:</p> <pre><code> static ExType TestException&lt;ExType&gt;(string message) where ExType:Exception, new () { ExType ex = (ExType)Activator.CreateInstance(typeof(ExType), message); return ex; } </code></pre> <p>Sweet! :)</p> <p>Thanks guys!</p>
<p>You can almost do it like this:</p> <pre><code>static void TestException&lt;E&gt;(string message) where E : Exception, new() { var e = new E(); e.Message = message; throw e; } </code></pre> <p>However, that doesn't compile because Exception.Message is read only. It can only be assigned by passing it to the constructor, and there's no way to constrain a generic type with something other than a default constructor.</p> <p>I think you'd have to use reflection (Activator.CreateInstance) to "new up" the custom exception type with the message parameter, like this:</p> <pre><code>static void TestException&lt;E&gt;(string message) where E : Exception { throw Activator.CreateInstance(typeof(E), message) as E; } </code></pre> <p><strong>Edit</strong> Oops just realised you're wanting to <em>return</em> the exception, not throw it. The same principle applies, so I'll leave my answer as-is with the throw statements.</p>
<p>I think seeing as all exceptions should have a parameterless constructor, and have the <code>Message</code> property, so the following should work:</p> <pre><code>static ExType TestException&lt;ExType&gt;(string message) where ExType:Exception { ExType ex = new ExType(); ex.Message = message; return ex; } </code></pre> <p>Edit: OK, Message is read only, so you'll have to hope the class implements the Exception(string) constructor instead.</p> <pre><code>static ExType TestException&lt;ExType&gt;(string message) where ExType:Exception { return new ExType(message); } </code></pre>
6,266
<p>Is there is any way to change the datasource location for a report and all of it's subreports without having to open each of them manually?</p>
<p>Here is how I set my connections at runtime. I get the connection info from a config location.</p> <pre><code> #'SET REPORT CONNECTION INFO For i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1 rsource.ReportDocument.DataSourceConnections(i).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword) Next For i = 0 To rsource.ReportDocument.Subreports.Count - 1 For x = 0 To rsource.ReportDocument.Subreports(i).DataSourceConnections.Count - 1 rsource.ReportDocument.OpenSubreport(rsource.ReportDocument.Subreports(i).Name).DataSourceConnections(x).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword) Next Next </code></pre>
<p>I'm guessing you're talking about .rdl files from Reporting Services? (If not, my answer might be wrong)</p> <p>They're basically just XML, so you could load each one of them in and do an XPath query to get the node that contains the datasource and update it.</p>
6,178
<p>I have a problem with maintaining state in an ASP.NET AJAX page. Short version: I need some way to update the page ViewState after an async callback has been made, to reflect any state changes the server made during the async call. </p> <p>This seems to be a common problem, but I will describe my scenario to help explain:</p> <p>I have a grid-like control which has some JavaScript enhancements - namely, the ability to drag and drop columns and rows. When a column or row is dropped into a new position, an AJAX method is invoked to notify the control server-side and fire a corresponding server-side event ("OnColumnMoved" or "OnRowMoved").</p> <p>ASP.NET AJAX calls, by default, send the entire page as the request. That way the page goes through a complete lifecycle, viewstate is persisted and the state of the control is restored before the RaiseCallbackEvent method is invoked.</p> <p>However, since the AJAX call does not update the page, the ViewState reflects the <em>original</em> state of the control, even after the column or row has been moved. So the second time a client-side action occurs, the AJAX request goes to the server and the page &amp; control are built back up again to reflect the <em>first</em> state of the control, not the state after the first column or row was moved.</p> <p>This problem extends to many implications. For example if we have a client-side/AJAX action to add a new item to the grid, and then a row is dragged, the grid is built server-side with one less item than on the client-side.</p> <p>And finally &amp; most seriously for my specific example, the actual data source object we are acting upon is stored in the page ViewState. That was a design decision to allow keeping a stateful copy of the manipulated data which can either be committed to DB after many manipulations or discarded if the user backs out. That is very difficult to change.</p> <p>So, again, I need a way for the page ViewState to be updated on callback after the AJAX method is fired.</p>
<p>If you're already shuffling the ViewState around anyway, you might as well use an UpdatePanel. Its partial postbacks <strong>will</strong> update the page's ViewState automatically.</p>
<p>I actually found both of those links you provided, but as noted they are simply describing the problem, not solving it. The author of the blog post suggests a workaround by using a different ViewState provider, but unfortunately that isn't a possibility in this case...I really need to leave the particulars of the ViewState alone and just hook on to what is being done out-of-the-box.</p>
2,449
<p>I've been using a resin printer for some time now, and am looking for a filament printer to compliment it. It will mostly be used to print scenery or bases to match 3-6&quot; models printer on the resin printer.</p> <p>I'm aiming for an entry level printer, or possible a mid level one on black Friday sale if I can find one.</p> <p>Should I limit myself to looking for one with a heated bed or auto-bed leveling, or should I mark these down as being bonus features that are nice to have but which are not essential for the kind of printing that I will be doing?</p> <p>I will probably be using basic budget filament to print items under 6&quot;. Probably no more than 2 prints a week.</p>
<p>Most &quot;auto-leveling&quot; is not leveling but compensation for a non-flat or non-level bed surface. It's helpful to beginners who don't understand bed leveling or evaluating bed surface flatness and replacing a bad bad, for the sake of being able to get started without prints failing to adhere, but it will necessarily give you moderate to severe accuracy problems in the first cm or so of your print unless you manually level the bed right too. (This is as opposed to real three-point, three-motor leveling systems, which <em>do</em> really level and are great, but won't be found on entry-level printers.) Decide whether you want to spend money on that accordingly.</p> <p>Personally, I find heated bed unnecessary unless you'll be printing ABS, ASA, or maybe PETG (it's hard but not impossible to print PETG without it). Heating the bed kinda makes PLA print worse (at least there are tradeoffs; it does help adhesion though), and flexible materials never need heat. However, pretty much all popular printers nowadays offer a heated bed anyway, so I don't think you'd be saving anything by going without it, and you're likely enough to want it at some point that you should just get it.</p>
<p>FWIW, what I consider the primary entry-level filament printer, the Creality Ender 3 (under $200 any, sometimes lower depending on daily exchange rates) is sold with <em>heated bed included</em>.</p> <p>Beyond that, a so-called self-leveling system is IMO overrated. For 20-25 dollars you can get a glass build surface, which eliminates non-planar build surface; combine this with proper tramming technique using a feeler gage set that costs under $10 and you can pretty easily achieve results equal to or better than what a &quot;self-leveling&quot; setup would give on a poorly trammed or warped bed.</p> <p>Conversely, if your idea of &quot;entry level&quot; is the few sub-$100 printers, their tiny build volume and lack of any option to install either heated bed or upgraded extruders and hot ends takes them out of the running for anything other than toys.</p>
2,021
<p>I built a cheap Delta printer with ATMega board and 1.8° motors. The micro stepping is limitied to 1/16. Beside a decent print quality, I observe a moire effect on flat surfaces. The moire is clearly caused by a combination of both, the 1.8° motors steps and the low microstepping. </p> <p>I thought about using 0.9° stepper motors together with a combination of board and drivers which support &lt; 1/32 micro stepping. Is there a comparison somewhere illustrating potential quality differences on larger delta printers and is this the way to remove the moire effect? For cartesian printers I would not bother using such motors, but I noticed that a higher holding torque at smaller steps is desirable for delta printers.</p> <p><strong>Example</strong> </p> <p>Not one of my prints, but this is how it looks <a href="https://i.stack.imgur.com/ao5PD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ao5PD.png" alt="enter image description here"></a></p>
<p>Delta bots always need all motors to step to maintain a straight level. <a href="https://3dprinting.stackexchange.com/questions/5796/full-steps-mode-for-z-axis-stepper-controller">Microstepping</a>, is not magic, the <strong>incremental torque</strong> decreases per step so that you will be more likely to miss a few micro-steps. Furthermore, the signal that creates voltages for the micro-step positioning is usually not perfectly sinusoidal (pulse-width voltage modulation is used to achieve micro-stepping by controlling the current; the driver sends two voltage sine waves, 90 degrees out of phase to the motor windings), micro-stepping drives can only <strong>approximate</strong> a <strong>true sine wave</strong>. This means that some torque ripples, resonance, and noise remains and hence resulting in odd stepper behavior, like seen below from <a href="https://hackaday.com/2016/08/29/how-accurate-is-microstepping-really/" rel="nofollow noreferrer">this ref.</a> (after the half step the stepper jumps to the full step and maintains that value for a while):</p> <p><a href="https://i.stack.imgur.com/ICxJV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ICxJV.jpg" alt="enter image description here"></a></p> <p>This is seen as a <a href="https://en.wikipedia.org/wiki/Moir%C3%A9_pattern" rel="nofollow noreferrer">Moiré</a> pattern in your printed products. As an example, if the head is moved in Z direction by micro-step, you will almost certainly notice that the head doesn't move on every micro-step, but only every 3rd or 4th micro-step (as an example). When using higher resolution steppers like the 0.9&deg; stepper motors, you will still miss micro-steps (e.g. the same, so also on every 3rd or 4th micro-step the head moves), but as the micro-step is half the size of that one of a 1.8&deg; stepper motor, the accuracy as in precision and resolution is higher.</p> <p>In that sense, if you change your stepper drivers for higher micro-stepping drivers (from 1/16 to 1/32 as you mention), it will not help you improve the resolution much because the incremental torque from one to another 1/32 micro-step is lower than for 1/16 micro-steps as can be seen in the figure below (taken from <a href="https://www.micromo.com/media/wysiwyg/Technical-library/Stepper/6_Microstepping%20WP.pdf" rel="nofollow noreferrer">this ref.</a>). </p> <p><a href="https://i.stack.imgur.com/mBonI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mBonI.png" alt="Incremental stepper torque as function of micro-step size"></a></p> <p>So, using 0.9&deg; motors (and keeping 1/16 micro-stepping) improves positioning accuracy as described above, it will also reduce the noise, because the torque per unit angular error is nearly doubled. Also remember that if you are using 8-bit electronics (you hint to an ATMega board), then even 1/32 micro-stepping burdens the processor to achieve reasonable travel speeds. With 8-bit electronics, it is usually suggested to use 1/16 stepping.</p> <p>Upgrading an existing printer from 1.8&deg; to 0.9&deg; stepper motors is probably not worth for the majority of users (note that the maximum allowable speed also reduces when using 0.9&deg; stepper motors). Unless you are designing and building a new delta, or aren't on a tight budget you could opt for the additional costs of buying 0.9&deg; stepper motors.</p> <p>Note that updating to higher micro-stepping values not necessarily implies that the quality of your products also increase. See e.g. <a href="https://3dprinting.stackexchange.com/a/159/5740">this reference</a>.</p>
<p>I am looking at the example print you supplied and trying to understand the defects. Was the object printed vertically, so that the object Z-axis is running from top to bottom in the picture? </p> <p>If so, then the horizontal defects look like resonance artifacts, which could be caused by the issue you raise of the stepper motor not responding to small movement commands. The only thing that will prevent the motor from responding is stiction, or difficulty starting a movement. Stiction is a non-linear aspect of friction in which the "starting" friction is higher than the "sliding" friction. It might be worth checking for surfaces which must slide against each other, and assure they are lubricated with a dry, non-tacky lubricant.</p> <p>A typical delta machine behaves the same way on each layer. The equations which govern how high on the tower the top of the delta-leg should be for each x,y, and z point is linear in Z, but non-linear in X and Y. With that in mind, I have no hypothesis to describe the defects that would be described as cathedrals if they were wood grain.</p> <p>Or, perhaps the object was printed so that the surface shown is parallel to the bed? If so, the defects looks like more than a couple of microsteps. Is it possible that one drive is not working correctly? If so, I would suggest that the motor on the tower pointed to (or pointed from) by the cathedrals is not working like the others. It could be binding too tightly to the tower, or the pully may be loose, or the driver isn't working correctly for one of the two coils.</p>
1,114
<p>Does anybody know of a method for creating custom Performance Counters using ordinary unmanaged Visual C++?</p> <p>I know that it can be done easily using managed C++, but I need to do it using an unmanaged Windows service.</p> <p>I also know that you can retrieve performance counter data, but I need to create some custom counters and increment them during the applications runtime.</p>
<p>See here: <a href="http://msdn.microsoft.com/en-us/library/aa371925.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa371925.aspx</a></p> <p>It is not really hard, but a bit tedious as the API involves extensive usage of self-referential, variable-length structures and has to employ some IPC mechanism to obtain the data from the monitored process. </p>
<p>I was looking for something a litte easier to implement. I will probably have to use this approach. I was also shown by a colleague (thanks PJ) that there is a Scribble tutorial that has been modified to show how to add a Performance Counter using ATL classes: <a href="http://msdn.microsoft.com/en-us/library/z1xc8ye3(VS.80).aspx" rel="nofollow noreferrer" title="PerformanceScribble Sample: Performance Monitoring in an MFC Application">PerformanceScribble Sample: Performance Monitoring in an MFC Application</a></p> <p>The big drawback here is that currently my application doesn't use MFC or ATL, and I would have to add the support for it.</p>
7,959
<p>The cube is a 2 cm x 2 cm with infill at 30 % and layer height 0.2 mm, more details can be seen below.</p> <p>I'm printing with PETG using an Ender 3 printer.</p> <p>There seems to be a gap between the perimeter walls, I have already referred to other forums and specifically: &quot; <a href="https://3dprinting.stackexchange.com/questions/10276/how-to-fix-wall-separation-in-3d-prints-gaps-in-between-wall-perimeters">How to fix wall separation in 3D prints (gaps in between wall perimeters)?</a> &quot;, but I still can't find a solution for it.</p> <p>Most would suggest to tighten up the pulleys, I've tried that, but that didn't work. Others also suggested tweaking to a higher temperature, again I've tried from a range of 230-250 °C, but this also failed.</p> <p>Infill and initial/top layers seems to be strong and all lines are bonded except for the perimeter walls.</p> <p>More details regarding the problem:</p> <p><a href="https://i.stack.imgur.com/WjFY6m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjFY6m.jpg" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/1wJjGm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1wJjGm.jpg" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/Z2tJGm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z2tJGm.jpg" alt="enter image description here" /></a></p> <p>Here are my print settings:</p> <p><a href="https://i.stack.imgur.com/IOZBWm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IOZBWm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/SNKEbm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SNKEbm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/srVksm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/srVksm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/1Q6zNm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Q6zNm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/i9nPsm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i9nPsm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/GgFkvm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GgFkvm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/3e3zVm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3e3zVm.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/GNGD5m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GNGD5m.png" alt="enter image description here" /></a></p>
<p>PETG filament is not entirely rigid and compresses slightly in the Ender 3's extruder gear and Bowden extruder setup. Tightening it will only make this effect greater. Being compressed at the point where mm of extruder advance is applied means less than the desired advance of at-nominal-diameter filament will take place. I find I need a flow of 104% to compensate for this.</p> <p>When adjusting flow in Cura, make sure you get the main flow setting not the first-layer one (which is an additional factor on top of the main one and can be left at 100%), <em>and</em> that all the derived flow settings for each type of extrustion (walls, top/bottom, infill, etc.) all come out matching the value you set. When I first tried fixing this with flow, they didn't propagate right and I ended up testing changes that weren't actually doing anything.</p> <p>With that said, you may have something else going on too. The underextrusion looks pretty severe, <em>including</em> in the top layers which you said looked okay. You should not see deep grooves between the lines like that. I suspect they're only bonded to the layer below, not to their neighbors. This could be a result of tightening the extruder pulley, or some other problem.</p>
<p>I agree with @R.. GitHub STOP HELPING ICE, looks like under extrusion you could try a flow rate test print like this <a href="https://www.thingiverse.com/thing:3397997" rel="nofollow noreferrer">link</a> to try and dial in the value.</p> <p>But probably worth just trying a flow of 105% and see if it solves the problem. Another thing worth verifying is that your printer is feeding accurately. You can mark out 100mm from the feed hole, then manually command the printer to extrude 100mm, then measure the distance from the 100mm mark. This will tell you if you have a feed problem.</p>
1,715
<p>On Fedora Core 7, I'm writing some code that relies on <code>ARG_MAX</code>. However, even if I <code>#include &lt;limits.h&gt;</code>, the constant is still not defined. My investigations show that it's present in <code>&lt;sys/linux/limits.h&gt;</code>, but this is supposed to be portable across Win32/Mac/Linux, so directly including it isn't an option. What's going on here?</p>
<p>The reason it's not in limits.h is that it's not a quantity giving the limits of the value range of an integral type based on bit width on the current architecture. That's the role assigned to limits.h by the ISO standard.</p> <p>The value in which you're interested is not hardware-bound in practice and can vary from platform to platform and perhaps system build to system build.</p> <p>The correct thing to do is to call <code>sysconf</code> and ask it for "ARG_MAX" or "_POSIX_ARG_MAX". I <em>think</em> that's the POSIX-compliant solution anyway.</p> <p>Acc. to my documentation, you include one or both of unistd.h or limits.h based on what values you're requesting.</p> <p>One other point: many implementations of the exec family of functions return E2BIG or a similar value if you try to call them with an oversized environment. This is one of the defined conditions under which exec can actually return.</p>
<p>ARG_MAX is defined in /usr/include/linux/limits.h. My linux kernel version is 3.2.0-38.</p>
6,890
<p>Given a list of locations such as</p> <pre class="lang-html prettyprint-override"><code> &lt;td&gt;El Cerrito, CA&lt;/td&gt; &lt;td&gt;Corvallis, OR&lt;/td&gt; &lt;td&gt;Morganton, NC&lt;/td&gt; &lt;td&gt;New York, NY&lt;/td&gt; &lt;td&gt;San Diego, CA&lt;/td&gt; </code></pre> <p>What's the easiest way to generate a Google Map with pushpins for each location?</p>
<p>I'm assuming you have the basics for Maps in your code already with your API Key.</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript" href="http://maps.google.com/maps? file=api&amp;v=2&amp;key=xxxxx"&gt; function createMap() { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(37.44, -122.14), 14); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="createMap()" onunload="GUnload()"&gt; </code></pre> <p>Everything in Google Maps is based off of latitude (lat) and longitude (lng).<br /> So to create a simple marker you will just create a GMarker with the lat and lng.</p> <pre><code>var where = new GLatLng(37.925243,-122.307358); //Lat and Lng for El Cerrito, CA var marker = new GMarker(where); // Create marker (Pinhead thingy) map.setCenter(where); // Center map on marker map.addOverlay(marker); // Add marker to map </code></pre> <p>However if you don't want to look up the Lat and Lng for each city you can use Google's Geo Coder. Heres an example:</p> <pre><code>var address = "El Cerrito, CA"; var geocoder = new GClientGeocoder; geocoder.getLatLng(address, function(point) { if (point) { map.clearOverlays(); // Clear all markers map.addOverlay(new GMarker(point)); // Add marker to map map.setCenter(point, 10); // Center and zoom map on marker } }); </code></pre> <p>So I would just create an array of GLatLng's of every city from the GeoCoder and then draw them on the map.</p>
<p>I guess more information would be needed to really give you an answer, but over at Django Pluggables there is a <a href="http://djangoplugables.com/projects/django-googlemap/" rel="nofollow noreferrer">django-googlemap plugin</a> that might be of help.</p> <p><strong>Edit:</strong> Adam has a much better answer. When it doubt look at the API examples. </p>
3,606
<p>I'm making a method combining Scrum with the OpenUP lifecycle and deliverables. I also want to keep the OpenUP disciplines apart from "Project Management". I can "hide" it so that it's not immediately obvious in my generated method site. But when you then navigate to the "Risk List" artefact for example the PM is still seen as contributing, and if you click on the link, you get taken to the PM Discipline page.</p> <p>How can I remove it completely from my method without deleting it from the OpenUP library which I'm consuming?</p>
<p>I've never used EPF Composer.</p> <p>I did a little bit of google searches and I understand what you are looking for can be done through Configurations (select OpenUP in your Library view) and published View definitions.</p> <p>See slide 83 and 84 of this PPT document. You should be able to take it from there.</p> <p><a href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=%22epf%20composer%22%20%22standard%20categories%22&amp;source=web&amp;cd=9&amp;ved=0CFoQFjAI&amp;url=http://www.mountainview-itsm.com/Mountainview/downloads/An_Introduction_to_EPF.ppt&amp;ei=p9tVUfTwD4-i8gTFroEY&amp;usg=AFQjCNGlAoGW_ujO2uRyTa_h9jYwJq2YfA" rel="nofollow">An Introduction to the Eclipse Process Framework</a>.</p> <p>In case the link does not work, I searched for "EPF Composer" "Standard categories" on google and the document is at the bottom of the first results page.</p> <p>Good luck.</p>
<p>To those who are to lazy <a href="https://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=5&amp;ved=0ahUKEwiUr9P6prjJAhVM2RoKHeQ7AWgQFgg0MAQ&amp;url=http%3A%2F%2Fwww.mountainview-itsm.com%2Fitil-training%2Fdownloads%2FAn_Introduction_to_EPF.ppt&amp;usg=AFQjCNHCNYUI70q5JaQKxZbpqMtdUIAu_w&amp;cad=rja" rel="nofollow noreferrer">to search and browse slides</a>:</p> <p>Slide 83:<br> Select sub-set of method library for publishing to HTML or exporting to MS. Use “Content” selections for course grain (Plug-in and package level) configuration. Use “Add/Subtract these Categories” for fine grain (element level) configuration.</p> <p><a href="https://i.stack.imgur.com/RJvxQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RJvxQ.png" alt="enter image description here"></a></p> <p>Slide 84:<br> Categories group related elements<br> Views defined by selecting Categories<br> <a href="https://i.stack.imgur.com/7iyuV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7iyuV.png" alt="enter image description here"></a></p>
9,683
<p>After watching every possible YouTube video on the subject and reading any source available, and although I'm a PhD and quite computer savvy, I still can't make my Anet A6 (no probe) behave in terms of Z offset. I upgraded to silicone bed buffers instead of the stock springs; now my bed is ~5 mm raised, and I don't know how to proceed. Some observations:</p> <ul> <li><p><strong>G28</strong> makes the nozzle go to the center of the bed. Display says X 111 and Y 111. Is it preferable to set the home to the bottom-left corner, or is the center just fine?</p> </li> <li><p><strong>G28</strong> makes the nozzle squish the bed ~5 mm deep.</p> </li> <li><p>I've tried the <strong>G92</strong> approach and the <strong>M428</strong> approach. I can't quite understand what's the difference between them. Can anyone explain why sometimes the former is used and sometimes the latter?</p> </li> <li><p>I had high hopes for <strong>M428</strong>. What could be simpler? You physically guide the nozzle to where you want it to be, send the command, and that's your new 0,0,0. But I guess not. Since my &quot;home&quot; is at 111,111 and apparently M428 can only be used at a maximum of 20 mm from 0, I get a &quot;too far from reference&quot; error message.</p> </li> <li><p>At any rate, both approaches (also <strong>M206</strong>) haven't helped. When I <strong>G28</strong>, the nozzle still squishes the bed. The display either says Z 5 or Z -5 or whatever I've played with, but the nozzle still squishes the poor bed.</p> </li> <li><p>In my LCD menu (Marlin 1.1.9), I don't have Control -&gt; Motion -&gt; Z offset. Since many videos recommend using this, this is quite sad. Can anyone tell me why this option is absent?</p> </li> <li><p>On a very conceptual level, I can't quite understand why in all the video guides the bed screws are completely ignored when discussing Z offset. One guy showed how he's correcting his Z offset 0.3 mm using G-code. But he could've easily done it by adjusting his screws... They all say &quot;Z offset means the distance between your nozzle and bed, and here is how to adjust it&quot;. Now comes G-code, or LCD menu, etc. But why is everyone forgetting that you can adjust the distance between your bed and nozzle using the screws?! I can't seem to wrap my head around this. In my case, of course, I can't use the screws -- they've reached their limit, so I need to add extra using G-code. But nobody seems to really explain this nicely...</p> </li> </ul> <p><strong>Summary:</strong> I urgently need a walkthrough for 6-year-olds. Make that 4-year-olds.</p>
<p>So the new silicone buffers raised the bed by 5 mm? When this happens, you should raise the endstop also with 5 mm. Else the printer will go down to the Z endstop that is effectively 5 mm below the level of the bed. I guess the buffers cannot be compressed by 5 mm, so you need to move the endstop up to the level your buffer compression is in reach of.</p> <p>No software offset will work (for your current setup: homing on the bed surface does not work as the switch need to be triggered prior to having any offset in play) other than a hardware change or compression of the buffers of 5 mm. It would only be possible to use a software offset when the nozzle homes off the bed surface (next to the bed). The only thing you would have had to do is add in your start G-code:</p> <pre><code>G0 Z5 ; Move the head to 5 mm G92 Z0 ; Call this Z = 0 </code></pre> <p>If <code>#define Z_SAFE_HOMING</code> is enabled, you should comment the line in the configuration file to make it home Z at the homed X, Y position.</p> <p>I will not go into all G-codes, details are read on the <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-codes Wiki pages</a> and <a href="https://marlinfw.org/docs/gcode/" rel="nofollow noreferrer">Marlin firmware G-codes</a>, these won't be able to help you out unless you fix the homing on the bed surface. Currently, you need to do a hardware fix, your endstop is below the surface level of the bed. Alternative is to remove homing Z above the bed surface and redefine the Z offset. A hardware fix is a better solution, and if you manage to print a fancy Z endstop holder and counterpart with a screw you will be able to level the bed more easily.</p> <p>E.g. <a href="https://marlinfw.org/docs/gcode/M428.html" rel="nofollow noreferrer"><code>M428</code></a> can set an offset, yes, but, it needs a reference; that reference is the homing reference or the current position. The current position of a printer that is just turn on is meaningless, it can be everywhere in the print volume. So you need to trigger the endstops first, that is not possible when it is not reachable (without compressing the bed).</p>
<p>Setting any offset will move the whole print (&quot;effectively shifts the coordinate space&quot;) - so you can set up for printing above or below bed, or shifting several cm to the right, for example - and then your print may not actually fit the printing space. For example: my frame is blocking X moves at the top, I can set the 20 mm X offset to avoid accident when printing high (so shift the print). Or when setting the new print on top of another print, thus shifting the position, etc. If you call <code>M428</code> in any position, then current position will become the new offset. Current offset settings is reported by <code>M503</code> (or <code>M206</code> without parameters).</p> <p>Also <code>G92</code> is used as ad-hoc operation when relative positioning is used. It makes sense for extruder movements, but is not used for moving the printing head in practice. I would say that any such calls for X,Y,Z sound like some hacking, and you should know exactly what you are doing for tricking printer's logic this way. I would avoid this at all.</p> <p>Normally (0,0,0) for cartesian printers is nearest-bottom-left point of the bed. If properly zero the printer is what you are trying to achieve, then you should:</p> <ul> <li>zero any X,Y,Z offsets: <code>M206 X0 Y0 Z0</code> (unless some is justified like in the frame example)</li> <li>save this setting for future: <code>M500</code></li> <li>home the printer - it zero the position, and then automiaticall backoff to some &quot;safe distance&quot; (programmed in firmware)</li> <li>use LCD to move carriage back to zero: at least for the Z axis</li> <li>regulate bed screws to fit the zero position of printing head</li> </ul> <p>There are settings in <a href="https://marlinfw.org/docs/configuration/configuration.html#homing" rel="nofollow noreferrer">Marlin's file Configuration_adv.h</a>:</p> <ul> <li><p>Marlin 1.1:</p> <pre><code>#define X_HOME_BUMP_MM 5 #define Y_HOME_BUMP_MM 5 #define Z_HOME_BUMP_MM 2 </code></pre> </li> <li><p>Marlin 2.x:</p> <pre><code>#define HOMING_BUMP_MM { 5, 5, 2 } // (mm) Backoff from endstops after first bump </code></pre> </li> </ul> <p>They do not change the zero (do not set offset), but force the carriage to move away from zero during homing operation and (Marlin 1.1) after homing, becuse usually it is convenient. Marlin 2.x offers separate parameter for final backoff:</p> <pre><code>//#define HOMING_BACKOFF_MM { 2, 2, 2 } </code></pre> <p>If you would like to center the head after homing, I would suggest to use these settings.</p>
1,832
<p>As a temporary stopgap until all the designers are in place we are currently hand-cranking a whole bunch of xml configuration files at work. One of the issues with this is file-versioning because people forget to update version numbers when updating the files (which is to be expected as humans generally suck at perfection).</p> <p>Therefore I figure that as we store the files in Sharepoint I should be able to write a script to pull the files down from Sharepoint, get the version number and automatically enter/update the version number from Sharepoint into the file. This means when someone wants the "latest" files they can run the script and get the latest files with the version numbers correct (there is slightly more to it than this so the reason for using the script isn't just the benefit of auto-versioning).</p> <p>Does anyone know how to get the files + version numbers from Sharepoint?</p>
<p>In order to take control over the properties that you want to be cached you can call 'RefreshCache()' passing the properties that you want to hang around:</p> <pre class="lang-c# prettyprint-override"><code>System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(); // Push the property values from AD back to cache. entry.RefreshCache(new string[] {"cn", "www" }); </code></pre>
<p>Active Directory is pretty efficient at storing information and the retrieval shouldn't be that much of a performance hit. If you are really intent on storing the names, you'll probably want to store them in some sort of a tree stucture, so you can see the relationships of all the people. Depending on how the number of people, you might as well pull all the information you need daily and then query all the requests against your cached copy. </p>
5,328
<p>I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this?</p> <p>EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry</p>
<p>Use a 3 step process:</p> <ol> <li>Generate a script from the working database</li> <li>Create a new database from that script</li> <li>Create a backup of the new database</li> </ol>
<p>I make heavy use of this tool:<br> <a href="http://www.dswsoft.com/sqlbalance.php" rel="nofollow noreferrer">SQLBalance for MySQL</a> </p> <p>Unfortunately; its windows only... but works like a charm to move databases around, data or no data, merge or compare.</p>
2,567
<p>There was a previous question suggesting that the <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> and <a href="https://3dprinting.stackexchange.com/questions/tagged/support-materials" class="post-tag" title="show questions tagged &#39;support-materials&#39;" rel="tag">support-materials</a> tags should be merged, and at the time the only response was <a href="https://3dprinting.meta.stackexchange.com/q/168/11242">to keep them distinct</a>. 2 years later, I think it is time to disagree.</p> <p>I've already found <a href="https://3dprinting.stackexchange.com/questions/5318">questions</a> which talk about support material in the abstract sense, of how to slice, rather than the intended use of the tag to identify the specific material used for support. This automatically makes the tags too imprecise to retain.</p> <p>We should retain the <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> tag, and merge the other two into it, since that covers the whole group of questions cleanly. I don't think we need synonyms, unless the other tags get re-added by users in the future.</p> <p>I don't think the aim of tags is to generate a complete literal taxonomy of the subject, rather we are trying to define:</p> <ul> <li>What subjects are on topic (support certainty is)</li> <li>How to most usefully group questions.</li> </ul> <p>Now, support (the structure) and the types of material are literally different things,but together they encompasses the topic of support. There is nothing wrong about referring to the specialist filaments as support. It is also misleading to assume that the structure can be discussed in isolation from the potential materials which can be used.</p> <p>Along the lines of avoiding the highly complex <a href="https://3dprinting.meta.stackexchange.com/a/61/4927">suggested heirarchical filament taxonomy</a>, I think we can best help people to find questions about support by consolidating the questions under a single tag.</p>
<p>I object to merging the two, my reasoning having been explained in chat several times, and brought to point by tbm115:</p> <blockquote> <p>Tbm0115 - &quot;support-material&quot; should define the material-type (ie. PLA, ABS, PVA, etc.) which in FDM is usually the same as the print-material. However, in the case of machines like dual-extruders can be completely different. The print-material for the body of the part can be PLA while the support-material can be PVA.</p> <p>Support-structure defines the &quot;style&quot; of structure that is generated by the slicer. For instance, I can have a scaffolding-like structure to support bridges and spire-like structure for small overhangs. Personally, I view infill as a subset of support-structure because it is material that is meant to support the overall body including ceilings. With infill I can have square, hexagonal, even cat-like styles of support structure.</p> <p>Trish - I agree on the structure being more about style (Trees, pylons, towers, included in the design or not, everywhere or not) while support material is more a subset of filament - PVA is one of those, but also one could use (in a dual extruder) ABS on a PLA print, and then remove the supports with acetone or some other stuff. One might use a super low melting filament and remove with heat.</p> </blockquote>
<p>Both tbm0115 and Sean make very good arguments and I am really on the fence on this one... So, I am withdrawing my solution for the moment, as I am not sure that I agree with the amalgamation of the two tags. However, <em>if</em> they are to be amalgamated then I would propose that this would be the way to do it...</p> <hr> <p><strike>You might not like this temporary solution, as you state that synonyms aren't needed...</p> <p>I can make <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged &#39;support-structures&#39;" rel="tag">support-structures</a> and <a href="https://3dprinting.stackexchange.com/questions/tagged/support-materials" class="post-tag" title="show questions tagged &#39;support-materials&#39;" rel="tag">support-materials</a> synonyms of <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a>, <em>for the moment</em> (so swapping the <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structure" class="post-tag" title="show questions tagged &#39;support-structure&#39;" rel="tag">support-structure</a> and its synonym <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a> that I did yesterday and add <a href="https://3dprinting.stackexchange.com/questions/tagged/support-materials" class="post-tag" title="show questions tagged &#39;support-materials&#39;" rel="tag">support-materials</a> as a synonym of <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a>).</p> <p>Then <em>later</em> they can be merged into <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged &#39;support&#39;" rel="tag">support</a>, once any issues (or non-issues) have been raised or pointed out - or if there are any serious objections later on down the line, the synonyms can be easily removed and reverted (whereas a merge can't be).</p> <p>Does that sound like a acceptable plan?</strike></p>
58
<p>For the geometry I am making, I want to extrude each face individually along its normal.</p> <p>This is a standard procedure in 3D modeling software like Blender; see Example 3 <a href="https://blender.stackexchange.com/questions/7365/extrude-faces-along-local-normals">here</a>. </p> <p>Is this possible in OpenSCAD?</p>
<p>Extruding faces is only possible on 2D polygons. From a 3D object you cannot capture the face and extrude it. To extrude "faces" you would need to define the shape of the face and extend it in the third dimension of your choice. This way a 3D shape is created that could be concatenated (joined using e.g. <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling#union" rel="nofollow noreferrer"><code>union</code></a>) to the original shape. For the extrusion, the function <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion#Linear_Extrude" rel="nofollow noreferrer"><code>linear_extrude</code></a> is available:</p> <pre><code>linear_extrude(height = fanwidth, center = true, convexity = 10, twist = -fanrot, slices = 20, scale = 1.0, $fn = 16) {...} </code></pre>
<p>Built-in to the language and its CSG model, no - processing the CSG tree is a completely separate phase following execution of the functional language, and there is no way to "read back" anything from the conversion of the model into faces in order to operate on the faces.</p> <p>However, you can do this if you're willing to do some heavy lifting yourself, or look for library code from someone else who's already done it. What it would involve is working out a description form of your own in terms of nested lists representing the model, with a module for converting the list to an OpenSCAD CSG tree. You can then write functions to manipulate this description in arbitrary ways, essentially reinventing the CSG phase of OpenSCAD within its own language. Some lesser versions of this have definitely been done in the past for things like implementing "loft" type functionality in OpenSCAD.</p>
1,462
<p>I have a need to do auditing all database activity regardless of whether it came from application or someone issuing some sql via other means. So the auditing must be done at the database level. The database in question is Oracle. I looked at doing it via Triggers and also via something called Fine Grained Auditing that Oracle provides. In both cases, we turned on auditing on specific tables and specific columns. However, we found that Performance really sucks when we use either of these methods.</p> <p>Since auditing is an absolute must due to regulations placed around data privacy, I am wondering what is best way to do this without significant performance degradations. If someone has Oracle specific experience with this, it will be helpful but if not just general practices around database activity auditing will be okay as well. </p>
<p>I'm not sure if it's a mature enough approach for a production system, but I had quite a lot of success with monitoring database traffic using a network traffic sniffer.</p> <p>Send the raw data between the application and database off to another machine and decode and analyse it there. </p> <p>I used PostgreSQL, and decoding the traffic and turning it into a stream of database operations that could be logged was relatively straightforward. I imagine it'd work on any database where the packet format is documented though.</p> <p>The main point was that it put no extra load on the database itself.</p> <p>Also, it was passive monitoring, it recorded all activity, but couldn't block any operations, so might not be quite what you're looking for.</p>
<p>if you are using oracle then there is feature called CDC(Capture data change) which is more performance efficient solution for audit kind of requirements.</p>
9,310
<p>We have a small embedded system without any video or serial ports (i.e. we can't output text via printf).<br> We would like to track the progress of our code through the initialization sequence.<br> Is there some simple things we can do to help with this.<br> It is not running any OS, and the hardware platform is somewhat customizable.</p>
<p>The simplest most scalable solution are state LEDs. Toggle LEDs based on actions, either in binary form or when certain actions occur if you can narrow your focus.</p> <p>The most powerful will be a hardware JTAG device. You don't even need to set breakpoints - simply being able to stop the application and inspect the state of memory may be enough. Note that some hardware platforms do not support "fancy" options such as memory watches or hardware breakpoints. The former is usually worked around with constantly stopping the processor and reading memory (turns your 10MHz system into a 1kHz system), while the latter is sometimes performed using code replacement (replace the targeted instruction with a different jump), which sometimes masks other problems. Be aware of these issues and which embedded processors they apply to.</p>
<p>A JTAG debugger is also an option, though cumbersome to set up.</p>
9,488
<p>If I have data like this:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Key</th> <th>Name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Dan</td> </tr> <tr> <td>2</td> <td>Tom</td> </tr> <tr> <td>3</td> <td>Jon</td> </tr> <tr> <td>4</td> <td>Tom</td> </tr> <tr> <td>5</td> <td>Sam</td> </tr> <tr> <td>6</td> <td>Dan</td> </tr> </tbody> </table> </div> <p>What is the SQL query to bring back the records where <code>Name</code> is repeated 2 or more times?</p> <p>So the result I would want is</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Tom</th> </tr> </thead> <tbody> <tr> <td>Dan</td> </tr> </tbody> </table> </div>
<p>Couldn't be simpler...</p> <pre class="lang-sql prettyprint-override"><code>Select Name, Count(Name) As Count From Table Group By Name Having Count(Name) &gt; 1 Order By Count(Name) Desc </code></pre> <p>This could also be extended to delete duplicates:</p> <pre class="lang-sql prettyprint-override"><code>Delete From Table Where Key In ( Select Max(Key) From Table Group By Name Having Count(Name) &gt; 1 ) </code></pre>
<p>This could also be accomplished by joining the table with itself,</p> <pre><code>SELECT DISTINCT t1.name FROM tbl t1 INNER JOIN tbl t2 ON t1.name = t2.name WHERE t1.key != t2.key; </code></pre>
2,537
<p>I noticed that many people here use <a href="http://macromates.com/" rel="nofollow noreferrer">TextMate</a> for coding on OS X. I've recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don't know what you're looking for.</p> <p>So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what's included?</p>
<p>Don't neglect the 'mate' command line tool. You can use it to pipe output into TextMate, so if you do the following...</p> <pre><code>diff file1.py file2.py | mate </code></pre> <p>...it will not only open in TextMate, but it is smart enough to know that you're looking at a diff and highlight lines on screen.</p> <p>TextMate's SVN integration is great; it also seems to have bundles for some other version control systems as well.</p> <p>Add GetBundle to browse the bundle repository. I found the jQuery bundle through it and it's very handy.</p> <p>As others have mentioned, rolling your own bundle for frequently used snippets is very helpful. If you have some snippets that are specific to a project or framework, you might want to prefix all of them with a common letter to keep the namespace tidy.</p>
<p>The <code>mate</code> command line tool is great, you can open an individual file or my favourite use of it is to open a directory of files as a project (e.g. <code>mate .</code>)</p>
5,390
<p>I have the unfortunate task of fixing a legacy ASP site that was migrated to Windows Server 2003, and I know nothing about ASP. The main issue appears to be with ASPSmartUpload, of which I have version 2.3 installed. According to <a href="http://foradvice.net/smart_upload_faq.htm" rel="nofollow noreferrer">http://foradvice.net/smart_upload_faq.htm</a>:</p> <blockquote> <p>FAQ: does aspSmartUpload work on Windows 2003 server ?</p> <p>Yes, last versions of aspSmartUpload work fine on the Windows 2003 server. If you upgrade your OS and used an old version of aspSmartUpload, you have to download and setup aspSmartUpload 3.2+.</p> </blockquote> <p>Of course, aspsmart.com doesn't respond and any Google result for "aspsmartupload 3.2" points to the dead link. The latest version I can find anywhere is v3.0, on some dodgy-looking DLL download site.</p> <p>What is the best way to resolve this, or can anyone provide a working link to version 3.2 of ASPSmartUpload? Thanks!</p>
<p>We searched for quite a while before finding these dlls. </p> <p>Here is the link for the <a href="http://www.umbrellastudio.com/how-to/aspsmartupload-dll/" rel="nofollow">ASPSMARTUPLOAD.DLL Usage</a> page that tells you how to install it and a link for downloading version 3.3. </p> <p>From what I understand, windows server 2008 requires version 3.2 or higher, but we couldn't find version 3.2. I believe version 3.3 will work the same.</p> <p>One other item, we had to get msvbvm50.dll VB Runtimes for this to work on windows server 2008.</p> <p>Once these files were registered the server restarted we got past this issue.</p>
<p>Fortunately I have a copy of the original v3.3 distribution. I've shared it <a href="http://1drv.ms/1BhbuD5" rel="nofollow">here</a>.</p>
6,743
<p>I have an application deployed into multiple zones and there are some issues with opening larger documents (20-50MB) across the WAN. </p> <p>Currently the documents are stored in Zone 1 (Americas) and a link stored in the database to the docs. </p> <p>I have heard some things about blobs in oracle and store binary in MS SQL Server 2005 and then perhaps copying the database to other zones.</p> <p>Any other suggestions or good results with one of the described options?</p>
<p>Your best option here may be caching the document in the requested zone the first time it is requested, and pinging the source document's last modified each time the cached document is requested in order to determine if it needs refreshed. In this case you're only requesting a small piece of information (a date) across the WAN most of the times the document is accessed. This works best for a subset of documents that are frequently requested. </p> <p>If you have a large set of documents, each infrequently requested by a disparate group, then you may want to look into replicating the documents in each of your zones each time the master is updated. This may best be accomplished by storing the document as binary data in your master database and having the slaves pull from the master.</p>
<p>If you're running on Windows you could look at <a href="http://en.wikipedia.org/wiki/Distributed_File_System_(Microsoft)" rel="nofollow noreferrer">Distributed File Systems</a></p>
3,125
<p>I've used the PHP MVC framework Symfony to build an on-demand web app.</p> <p>It has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as <a href="http://robrosenbaum.com/php/howto-disable-session-timeout-in-symfony/" rel="nofollow noreferrer">this one</a> did not help me.</p> <p>I intend not to migrate to Symfony 1.1 (which fixes this bug) in the foreseeable future.</p> <p>Has anyone been there and solved it? I would be most grateful for a hint or two!</p>
<p>I looked into it, and my coworker agrees that a heartbeat page call should work, you just have to make sure that the action invoked does reset the session timer (things like ajax field completion don't do this on their own).</p>
<p>The company I work for has been using Symfony and the workaround that we've used is to trigger a warning with javascript before the user gets logged out. I suspect that there is a a way to make 'heartbeat' ajax calls to the server to trigger the timer to reset, but that may be a lot of trouble. I think that there may not be a full fix that's suitable for you though, except maybe re-writing the session handler.</p> <p>Sorry I couldn't be more specific, if I get the chance, I'll ask our Symfony devs if they know of a better solution.</p>
4,480
<p>This happened to me in Visual Studio 2008 pre and post 2008 sp1 on more than one computer and to someone else I know, so it can't be an isolated incident.</p> <p>Seemingly random, every so often I lose all syntax highlighting in my aspx page (the html) so that Visual Studio now looks like a really expensive version of notepad.</p> <p>Does anyone know why does happens? Better yet, anyone know how to fix it?</p>
<p>it happened to me after an uninstall of visual studio using a removal tool at <a href="http://msdn.microsoft.com/en-us/vstudio/bb968856.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vstudio/bb968856.aspx</a> I had to run this before upgrading sql server management studio to 2008 version syntax highlighting has disappeared since because of package loading failures. I didn't find the fix yet so if anybody has an idea...</p>
<p>when this happens to me, i let it sit there for a minute. it will usually bring the syntax highlighting back.</p>
6,750
<p>what I'm after is something I can feed a number into and it will return the highest order bit. I'm sure there's a simple way. Below is an example output (left is the input)</p> <pre>1 -> 1 2 -> 2 3 -> 2 4 -> 4 5 -> 4 6 -> 4 7 -> 4 8 -> 8 9 -> 8 ... 63 -> 32</pre>
<p>From Hacker's Delight:</p> <pre><code>int hibit(unsigned int n) { n |= (n &gt;&gt; 1); n |= (n &gt;&gt; 2); n |= (n &gt;&gt; 4); n |= (n &gt;&gt; 8); n |= (n &gt;&gt; 16); return n - (n &gt;&gt; 1); } </code></pre> <p>This version is for 32-bit ints, but the logic can be extended for 64-bits or higher.</p>
<p>A nifty solution I came up with is to binary search the bits.</p> <pre><code>uint64_t highestBit(uint64_t a, uint64_t bit_min, uint64_t bit_max, uint16_t bit_shift){ if(a == 0) return 0; if(bit_min &gt;= bit_max){ if((a &amp; bit_min) != 0) return bit_min; return 0; } uint64_t bit_mid = bit_max &gt;&gt; bit_shift; bit_shift &gt;&gt;= 1; if((a &gt;= bit_mid) &amp;&amp; (a &lt; (bit_mid &lt;&lt; 1))) return bit_mid; else if(a &gt; bit_mid) return highestBit(a, bit_mid, bit_max, bit_shift); else return highestBit(a, bit_min, bit_mid, bit_shift); } </code></pre> <p>Bit max is the highest power of 2, so for a 64 bit number it would be 2^63. Bit shift should be initialized to half the number of bits, so for 64 bits, it would be 32.</p>
7,659
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/476163">NAnt or MSBuild, which one to choose and when?</a> </p> </blockquote> <p>What is the best build tool for <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a>?</p> <p>I currently use <a href="http://en.wikipedia.org/wiki/NAnt" rel="nofollow noreferrer">NAnt</a> but only because I have experience with <a href="http://en.wikipedia.org/wiki/Apache_Ant" rel="nofollow noreferrer">Ant</a>. Is <a href="http://en.wikipedia.org/wiki/MSBuild" rel="nofollow noreferrer">MSBuild</a> preferred?</p>
<p>We actually use a combination of <a href="http://en.wikipedia.org/wiki/NAnt" rel="noreferrer">NAnt</a> and <a href="http://en.wikipedia.org/wiki/MSBuild" rel="noreferrer">MSBuild</a> with <a href="http://en.wikipedia.org/wiki/CruiseControl" rel="noreferrer">CruiseControl</a>. NAnt is used for script flow control and calls MSBuild to compile projects. After the physical build is triggered, NAnt is used to publish the individual project build outputs to a shared location.</p> <p>I am not sure this is <i>the best</i> process. I think many of us are still looking for a great build tool. One promising thing I heard recently on .NET Rocks, <a href="http://www.dotnetrocks.com/default.aspx?showNum=362" rel="noreferrer">episode 362</a>, is <a href="http://codebetter.com/blogs/james.kovacs/archive/2008/06/27/introducing-psake.aspx" rel="noreferrer">James Kovac's PSake</a>, a build system he based entirely on PowerShell. It sounds really promising since what you can do with PowerShell is fairly limitless in theory.</p>
<p>Generally speaking, I get the impression that NAnt offers more flexibility compared to MSBuild, whereas (with my relatively simple needs) I've been fine with the latter so far.</p>
3,726
<p>My company is in the process of starting down the <strong>Grails</strong> path. The reason for that is that the current developers are heavy on <strong>Java</strong> but felt the need for a <strong>MVC-style language</strong> for some future web development projects. Personally, I'm coming from the design/usability world, but as I take more "front-end" responsibilities I'm starting to feel the need for learning a language more intensively so I can code some logic but especially the front-end code for my UIs and stuff.</p> <p>I've been trying to get into <strong>Python/Django</strong> personally, but just never invested too much time on it. Now that my company is "jumping" into Grails I bought the "<em>Agile Web Development with Rails (3rd Ed - Beta)</em>" and I'm starting to get into <strong>RoR</strong>. I'd still like to learn <strong>Python</strong> in the future or on the side, but my biggest question is: </p> <ul> <li>Should I be learning RoR, and have a more versatile language in my "portfolio", knowing that my RoR knowledge will be useful for my Grails needs as well??</li> </ul> <p>-OR-</p> <ul> <li>Should I just skip RoR and focus on learning Grails that I'll be needing for work soon, and work on learning RoR/Django (Ruby/Python) later?</li> </ul> <p>Basically the question revolves around the usefulness of Grails in a non-corporate setting and the similarities between Rails and Grails. (and this, while trying to avoid the centennial discussion of Python vs Ruby (on Rails) :))</p>
<p>Mmh, I don't know how to say this. Some people might bash me over this. </p> <h2>Language (Groovy and Ruby)</h2> <p>As a language I reckon Ruby is more funky compared to Groovy. Groovy only exists to ease Java programmer as you don't need to learn too much new syntax. But overall I reckon is not as funky as Ruby. Groovy wouldn't be the JVM language that is worth to learn based on attender's vote in this year's JavaOne but instead Scala is the one to go. Besides that, <a href="http://macstrac.blogspot.com/2009/04/scala-as-long-term-replacement-for.html" rel="noreferrer">the original creator of Groovy himself does not have faith in the language he created himself</a> in the first place. </p> <h2>Community and Job openings</h2> <p>As for the community, Grails community is not as big as Rails, though since the acquirement by Spring more and more people are using it in serious application. Rails has more job openings in the market compared to Grails (that is if you want to invest in looking a new job). </p> <h2>The framework (Grails and Rails)</h2> <p>But, as a framework, if you really care about maintainability and need access to Java framework and legacy Java system, Grails is the way to go as it provides cleaner access to Java. Grails itself is built upon several popular Java framework (Spring &amp; Hibernate). Rails itself IMHO is funky like Ruby itself, but it's funkyness costs you maintainability. <a href="http://merbist.com/2008/11/09/merb-1-0-released/" rel="noreferrer">Matz himself prefers Merb over Rails 2</a> because Rails create a DSL on top of Ruby which is really against the Ruby philosophy. And I reckon because Rails itself is opiniated, which in turn if you don't have the same opinion as the creator, it might not fit your needs.</p> <p><strong>Conclusion</strong></p> <p>So in your case, learn Grails as that is the company's consensus (you need to respect the consensus) and if you still want to secure your job. But, invest some time learning Rails and Ruby too if you want to open a chance getting a new job in the future.</p>
<p>At a first glance you would think they are completely differente stories, since they are based on extremely different languages (Ruby and Groovy).</p> <p>Then, after reading a couple of tutorials, you'll realize they share the same principles, scaffolding, duck typing, .. and finally the same goal: <strong>making agile programming feasible</strong>.</p> <p>If you already feel comfortable with terms like IoC and MVC, you'll find any of these options easy and exciting to learn.</p>
2,708
<p>What is the simplest SQL query to find the second largest integer value in a specific column? </p> <p>There are maybe duplicate values in the column.</p>
<pre><code>SELECT MAX( col ) FROM table WHERE col &lt; ( SELECT MAX( col ) FROM table ) </code></pre>
<pre><code>select top 1 MyIntColumn from MyTable where MyIntColumn &lt;&gt; (select top 1 MyIntColumn from MyTable order by MyIntColumn desc) order by MyIntColumn desc </code></pre>
5,205
<p>I'm currently working on an application where we have a SQL-Server database and I need to get a full text search working that allows us to search people's names.</p> <p>Currently the user can enter a into a name field that searches 3 different varchar cols. First, Last, Middle names</p> <p>So say I have 3 rows with the following info.</p> <p>1 - Phillip - J - Fry</p> <p>2 - Amy - NULL - Wong</p> <p>3 - Leo - NULL - Wong</p> <p>If the user enters a name such as 'Fry' it will return row 1. However if they enter Phillip Fry, or Fr, or Phil they get nothing.. and I don't understand why its doing this. If they search for Wong they get rows 2 and 3 if they search for Amy Wong they again get nothing.</p> <p>Currently the query is using CONTAINSTABLE but I have switched that with FREETEXTTABLE, CONTAINS, and FREETEXT without any noticeable differences in the results. The table methods are be preferred because they return the same results but with ranking.</p> <p>Here is the query.</p> <pre><code>.... @Name nvarchar(100), .... --""s added to prevent crash if searching on more then one word. DECLARE @SearchString varchar(100) SET @SearchString = '"'+@Name+'"' SELECT Per.Lastname, Per.Firstname, Per.MiddleName FROM Person as Per INNER JOIN CONTAINSTABLE(Person, (LastName, Firstname, MiddleName), @SearchString) AS KEYTBL ON Per.Person_ID = KEYTBL.[KEY] WHERE KEY_TBL.RANK &gt; 2 ORDER BY KEYTBL.RANK DESC; .... </code></pre> <p>Any Ideas...? Why this full text search is not working correctly ?</p>
<p>If you're just searching people's names, it might be in your best interest to not even use the full text index. Full text index makes sense when you have large text fields, but if you're mostly dealing with one word per field, I'm not sure how much extra you would get out of full text indexes. Waiting for the full text index to reindex itself before you can search for new records can be one of the many problems.</p> <p>You could just make a query such as the following. Split your searchstring on spaces, and create a list of the search terms.</p> <pre> Select FirstName,MiddleName,LastName From person WHERE Firstname like @searchterm1 + '%' or MiddleName like @searchterm1 + '%' or LastName like @searchterm1 + '%' or Firstname like @searchterm2 + '%' etc.... </pre>
<p>FreeTextTable should work.</p> <pre><code>INNER JOIN FREETEXTTABLE(Person, (LastName, Firstname, MiddleName), @SearchString) </code></pre> <p>@SearchString should contain the values like 'Phillip Fry' (one long string containing all of the lookup strings separated by spaces).</p> <p>If you would like to search for Fr or Phil, you should use asterisk: Phil* and Fr*</p> <p>'Phil' is looking for exactly the word 'Phil'. 'Phil*' is looking for every word which is starting with 'Phil'</p>
3,776
<p>How do you get the maximum number of bytes that can be passed to a <code>sendto(..)</code> call for a socket opened as a UDP port?</p>
<p>Use getsockopt(). <a href="http://www.mkssoftware.com/docs/man3/getsockopt.3.asp" rel="noreferrer">This site</a> has a good breakdown of the usage and options you can retrieve.</p> <p>In Windows, you can do:</p> <pre> int optlen = sizeof(int); int optval; getsockopt(socket, SOL_SOCKET, SO_MAX_MSG_SIZE, (int *)&optval, &optlen); </pre> <p>For Linux, according to the UDP man page, the kernel will use MTU discovery (it will check what the maximum UDP packet size is between here and the destination, and pick that), or if MTU discovery is off, it'll set the maximum size to the interface MTU and fragment anything larger. If you're sending over Ethernet, the typical MTU is 1500 bytes.</p>
<p>As UDP is not connection oriented there's no way to indicate that two packets belong together. As a result you're limited by the maximum size of a single IP packet (65535). The data you can send is somewhat less that that, because the IP packet size also includes the IP header (usually 20 bytes) and the UDP header (8 bytes). </p> <p>Note that this IP packet can be fragmented to fit in smaller packets (eg. ~1500 bytes for ethernet).</p> <p>I'm not aware of any OS restricting this further.</p> <h2>Bonus</h2> <p><code>SO_MAX_MSG_SIZE</code> of UDP packet</p> <ul> <li>IPv4: 65,507 bytes</li> <li>IPv6: 65,527 bytes</li> </ul>
4,543
<p>I'd like to write a game for the Nintendo Wii. How do I go about obtaining an SDK and/or any other tools necessary for writing a game?</p>
<p>The Wii Remote and Wii Balance Board use bluetooth. You can <a href="http://www.wiiprojects.org/bluetooth.html" rel="noreferrer">pair them with your PC</a> and write your own PC apps that interact with them (like <a href="http://www.cs.cmu.edu/~johnny/projects/wii/" rel="noreferrer">this guy</a>). If you want to make something that actually runs on the Wii, you can try finding some <a href="http://en.wikipedia.org/wiki/Wii_homebrew" rel="noreferrer">homebrew development</a> help.</p> <p>If you want to actually sell your software for Wii, you need:</p> <ol> <li>game development experience</li> <li>secure office facilities</li> <li>$2,000 - $10,000 for dev kit (WiiWare is cheapest)</li> </ol> <p><a href="http://www.warioworld.com/" rel="noreferrer">The Nintendo Software Development Support Group</a></p> <p><a href="http://www.warioworld.com/apply/" rel="noreferrer">Authorized Developer Application</a></p> <p>UPDATE: Also see the <a href="https://wiiu-developers.nintendo.com" rel="noreferrer"><strong>Wii U</strong> Developer Site</a>. Nintendo now has a simple application for individual developers to makes games for the Wii U, giving you access to the SDK and dev-kits.</p>
<p>You would have to get in contact with Nintendo of America and obtain a developer kit from them. Be prepared to spend a wad of dough though.</p> <p>Check this out: <a href="http://www.nintendo.com/corp/developer.jsp" rel="noreferrer">http://www.nintendo.com/corp/developer.jsp</a></p>
4,912
<p>In my day job I, and others on my team write a lot of hardware models in Verilog-AMS, a language supported primarily by commercial vendors and a few opensource simulator projects. One thing that would make supporting each others code more helpful would be a LINTER that would check our code for common problems and assist with enforcing a shared code formatting style. I of course want to be able to add my own rules and, after I prove their utility to myself, promote them to the rest of the team.. I don't mind doing the work that has to be done, but of course also want to leverage the work of other existing projects. </p> <p>Does having the allowed language syntax in a yacc or bison format give me a leg up? or should I just suck each language statement into a perl string, and use pattern matching to find the things I don't like? </p> <p>(most syntax and compilation errors are easily caught by the commercial tools.. but we have some of our own extentions.) </p>
<p>lex/flex and yacc/bison provide easy-to-use, well-understood lexer- and parser-generators, and I'd really recommend doing something like that as opposed to doing it procedurally in e.g. Perl. Regular expressions are powerful stuff for ripping apart strings with relatively-, but not totally-fixed structure. With any real programming language, the size of your state machine gets to be simply unmanageable with anything short of a Real Lexer/Parser (tm). Imagine dealing with all possible interleavings of keywords, identifiers, operators, extraneous parentheses, extraneous semicolons, and comments that are allowed in something like Verilog AMS, with regular expressions and procedural code alone.</p> <p>There's no denying that there's a substantial learning curve there, but writing a grammar that you can use for flex and bison, and doing something useful on the syntax tree that comes out of bison, will be a much better use of your time than writing a ton of special-case string-processing code that's more naturally dealt with using a syntax-tree in the first place. Also, what you learn writing it this way will truly broaden your skillset in ways that writing a bunch of hacky Perl code just won't, so if you have the means, I highly recommend it ;-)</p> <p>Also, if you're lazy, check out the Eclipse plugins that do syntax highlighting and basic refactoring for Verilog and VHDL. They're in an incredibly primitive state, last I checked, but they may have some of the code you're looking for, or at least a baseline piece of code to look at to better inform your approach in rolling your own.</p>
<p>In trying to find my answer, I found this on <a href="http://www.ibm.com/developerworks/edu/au-dw-au-parsingwithantlr-i.html" rel="nofollow noreferrer">ANTLR</a> - might be of use</p>
9,614
<p>I've been trying to understand <a href="http://msdn.microsoft.com/en-gb/library/system.diagnostics.process.mainwindowhandle.aspx" rel="nofollow noreferrer">Process.MainWindowHandle</a>.</p> <p>According to MSDN; "The main window is the window that is created when the process is started. After initialization, other windows may be opened, including the Modal and TopLevel windows, but <em>the first window associated with the process remains the main window</em>." (Emphasis added)</p> <p>But while debugging I noticed that MainWindowHandle seemed to change value... which I wasn't expecting, especially after consulting the documentation above.</p> <p>To confirm the behaviour I created a standalone WinForms app with a timer to check the MainWindowHandle of the "DEVENV" (Visual Studio) process every 100ms.</p> <p>Here's the interesting part of this test app...</p> <pre><code> IntPtr oldHWnd = IntPtr.Zero; void GetMainwindowHandle() { Process[] processes = Process.GetProcessesByName("DEVENV"); if (processes.Length!=1) return; IntPtr newHWnd = processes[0].MainWindowHandle; if (newHWnd != oldHWnd) { oldHWnd = newHWnd; textBox1.AppendText(processes[0].MainWindowHandle.ToString("X")+"\r\n"); } } private void timer1Tick(object sender, EventArgs e) { GetMainwindowHandle(); } </code></pre> <p>You can see the value of MainWindowHandle changing when you (for example) click on a drop-down menu inside VS.</p> <p><img src="https://i.stack.imgur.com/r54iB.png" alt="MainWindowHandleMystery"></p> <p>Perhaps I've misunderstood the documentation. </p> <p>Can anyone shed light?</p>
<p>@edg,</p> <p>I guess it's an error in MSDN. You can clearly see in Relfector, that "Main window" check in .NET looks like:</p> <pre><code>private bool IsMainWindow(IntPtr handle) { return (!(NativeMethods.GetWindow(new HandleRef(this, handle), 4) != IntPtr.Zero) &amp;&amp; NativeMethods.IsWindowVisible(new HandleRef(this, handle))); } </code></pre> <p>When .NET code enumerates windows, it's pretty obvious that first visible window (i.e. top level window) will match this criteria.</p>
<p>Actually Process.MainWindowHandle is a handle of top-most window, it's not really the "Main Window Handle"</p>
7,069
<p>Given a handle of type <code>HWND</code> is it possible to confirm that the handle represents a real window?</p>
<p>There is a function <code>IsWindow</code> which does exactly what you asked for.</p> <pre><code>BOOL isRealHandle = IsWindow(unknwodnHandle); </code></pre> <p>Look at <a href="http://msdn.microsoft.com/en-us/library/ms633528(VS.85).aspx" rel="nofollow noreferrer">this link</a> for more information.</p>
<p>Generally no. By the time you've got confirmation that a Window is valid another process/thread my come along and remove it for you.</p>
3,105
<p>I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(VS.80).aspx" rel="noreferrer">InternalsVisibleTo</a> attribute to the rescue!</p> <p>Just add: </p> <pre><code>[assembly:InternalsVisibleToAttribute("UnitTestAssemblyName")] </code></pre> <p>to your Core classes AssemblyInfo.cs file</p> <p>See <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/assemblies-gac/friend-assemblies" rel="noreferrer">Friend Assemblies (C# Programming Guide)</a> for best practices.</p>
<h2>Let's start with an example class:</h2> <pre class="lang-cs prettyprint-override"><code>using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo(&quot;App.Infrastructure.UnitTests&quot;)] namespace App.Infrastructure.Data.Repositories { internal class UserRepository : IUserRepository { // internal members that you want to test/access } } </code></pre> <p>The <code>[assembly: InternalsVisibleTo(&quot;Input_The_Assembly_That_Can_Access_Your_Internals_Here&quot;)]</code> attribute allows <em>all</em> of your <strong>internal classes and members to be accessed by another assembly</strong>, but the <strong>InternalsVisibleTo</strong> attribute is not only applied to a single class (on where you declared it), rather on the <strong>WHOLE</strong> assembly itself.</p> <p>In the example code - <code>App.Infrastructure.UnitTests</code> can access all internals in the assembly that you declared (InternalsVisibleTo attribute) it even if you didn't explicitly declare it to other classes that belong to the same assembly.</p> <br> <h3><a href="https://youtu.be/noxNMji-DRw" rel="nofollow noreferrer">I found out in this youtube video:</a> That there are 2 approaches to make your internals accessible to certain assemblies (or assembly)</h3> <p><strong>1. Creating your own AssemblyInfo.cs file</strong></p> <p>These are the <strong>only</strong> lines you'll need in your AssemblyInfo.cs (delete all &quot;default&quot; code, and replace with the code below)</p> <pre class="lang-cs prettyprint-override"><code>using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo(&quot;App.Infrastructure.UnitTests&quot;), InternalsVisibleTo(&quot;Another.Assembly&quot;)] </code></pre> <p><strong>2. Adding the InternalsVisibleTo attribute in the project's .csproj (double click the project that you want its internals to be exposed)</strong></p> <pre><code>&lt;ItemGroup&gt; &lt;AssemblyAttribute Include=&quot;System.Runtime.CompilerServices.InternalsVisibleTo&quot;&gt; &lt;_Parameter1&gt;The_Assembly_That_Can_Access_Your_Internals&lt;/_Parameter1&gt; &lt;/AssemblyAttribute&gt; &lt;AssemblyAttribute Include=&quot;System.Runtime.CompilerServices.InternalsVisibleTo&quot;&gt; &lt;_Parameter1&gt;Another_Assembly_Or_Project&lt;/_Parameter1&gt; &lt;/AssemblyAttribute&gt; &lt;/ItemGroup&gt; </code></pre> <p><strong>Note:</strong> <a href="https://youtu.be/noxNMji-DRw" rel="nofollow noreferrer">watch the whole youtube video for a more detailed explanation on Assembly-Level Attributes</a></p>
7,519
<p>What is the best way to programmatically send an SMS text message?</p> <p>Are there any free Web Service based SMS gateways?</p> <p>I know that if I happen to know the user's carrier (Sprint, AT&amp;T, etc), I can send an <a href="http://en.wikipedia.org/wiki/SMS_gateways" rel="noreferrer">SMS by emailing an address</a> based on phone number + carrier. I would like a good solution that does not require me to know the carrier. Barring that, is there an easy way to lookup carrier given a cell phone number?</p> <p>I understand that there are some services independent of the major mobile carriers that offer a per-message fee-based service, with API. What I would like to know is how such organizations tap into the SMS networks. Do they have contracts with mobile carriers to resell their services?</p>
<p>Use <a href="http://www.twilio.com/" rel="noreferrer">http://www.twilio.com/</a></p> <p>They have a REST interface to send SMS's and even to establish phone calls or receive phone calls.</p> <p>You even get 30$ credits to try it out.</p> <p>Def. the cheapest solution you will find.</p>
<p>Sorry, after re-reading your question i realized this is not the answer your looking for. However this is what i did for my command line program. There's a website where if you put in the telephone number it gives you the carrier. So when i entered my number it screen scraped the website, got the carrier and if the carrier is in my list, i retrieved the email of that carrier</p> <p>Most companies offer a SMS-to-email kinda thing. For example <code>myphonenumber@verizon.com</code> or something (there's a whole list on wikipedia).</p> <p>I used that to create my self a little command line application in c# that sends out text messages. However, you don't really get a "reply" and the number is a pre-assigned one from the company. </p> <p>I think if you want to go the free route, this is your best bet.</p> <p>Here's the wikipedia link: <a href="http://en.wikipedia.org/wiki/SMS_gateways" rel="nofollow noreferrer">SMS gateway</a></p>
2,628
<p>I found an old Creaform3D EXAscan laying around at the company I work for, and tried to plug it on a computer to see if it still works. </p> <p>I discovered that it uses a software called RapidForm for data acquisition, but its license is expired.</p> <p>I looked in the manufacturer site for drivers or something similar but there isn't anything.</p> <p>Is there any other software or way to read the data coming from such scanner? </p>
<p>The <a href="https://www.creaform3d.com/en/customer-support/legacy-products/exascan-scanner" rel="nofollow noreferrer">Creaform EXAscan</a> is according to the manufacturer a laser based machine. This means that it determines data points and their positions by some triangonometry done with a laser, 32.000 times a second, resulting in very high density point clouds. This demands a powerful program to work with.</p> <p>At some point, your company used <a href="http://www.directdimensions.com/port_featuredprojects.php?fileName=fp_rapidform" rel="nofollow noreferrer">Rapidform</a>, which costs a wooping 10 to 30 grand for a license. Other software in this niece are - <a href="https://forum.solidworks.com/thread/41681" rel="nofollow noreferrer">according to a solidworks thread</a> - <a href="https://de.3dsystems.com/software" rel="nofollow noreferrer">Geomagic</a> and <a href="https://www.innovmetric.com/en/products/polyworks-inspector" rel="nofollow noreferrer">PolyWorks</a>. The gist of the thread seems to be that these "big 3" were the best ones at the market in 2011. However I have no idea if they work together with the given hardware or what the later two cost.</p>
<p>So if the original manufacturer still exists, <a href="https://www.creaform3d.com/en/customer-support/legacy-products/exascan-scanner" rel="nofollow noreferrer">(which they appear to, and even list your scanner under 'legacy' products)</a> your best chance of getting it working is going to be to contact them directly. Using proprietary hardware WITHOUT the associated proprietary software can range from merely tedious but possible, to outright impossible, depending on the specific company. Oftentimes with tech products like this, the business model isn't about the product itself, but about the license fees for the software to use it. That they can charge yearly for. It's possible that the raw data is just a stereo camera file with extensions renamed, and equally possible that the firmware in the scanner will do some sort of check for valid license before it will even start scanning, they don't really have much info on their legacy products on their page</p>
868
<p>I can create the following and reference it using</p> <pre><code>area[0].states[0] area[0].cities[0] var area = [ { "State" : "Texas", "Cities" : ['Austin','Dallas','San Antonio'] }, { "State" :"Arkansas", "Cities" : ['Little Rock','Texarkana','Hot Springs'] } ] ; </code></pre> <p>How could I restructure "area" so that if I know the name of the state, I can use it in a reference to get the array of cities?</p> <p>Thanks</p> <p><strong>EDIT</strong> Attempting to implement with the answers I received (thanks @Eli Courtwright, @17 of 26, and @JasonBunting) I realize my question was incomplete. I need to loop through "area" the first time referencing "state" by index, then when I have the selection of the "state", I need to loop back through a structure using the value of "state" to get the associated "cities". I do want to start with the above structure (although I am free to build it how I want) and I don't mind a conversion similar to @eli's answer (although I was not able to get that conversion to work). Should have been more complete in first question. Trying to implement 2 select boxes where the selection from the first populates the second...I will load this array structure in a js file when the page loads.</p>
<p>If you want to just create it that way to begin with, just say</p> <pre><code>area = { "Texas": ['Austin','Dallas','San Antonio'] } </code></pre> <p>and so on. If you're asking how to take an existing object and convert it into this, just say</p> <pre><code>states = {} for(var j=0; j&lt;area.length; j++) states[ area[0].State ] = area[0].Cities </code></pre> <p>After running the above code, you could say</p> <pre><code>states["Texas"] </code></pre> <p>which would return</p> <pre><code>['Austin','Dallas','San Antonio'] </code></pre>
<p>This would give you the array of cities based on knowing the state's name:</p> <pre><code>var area = { "Texas" : ["Austin","Dallas","San Antonio"], "Arkansas" : ["Little Rock","Texarkana","Hot Springs"] }; // area["Texas"] would return ["Austin","Dallas","San Antonio"] </code></pre>
8,179
<p>i have a wcf service that does an operation. and in this operation there could be a fault. i have stated that there could be a fault in my service contract. </p> <p>here is the code below;</p> <pre><code>public void Foo() { try { DoSomething(); // throws FaultException&lt;FooFault&gt; } catch (FaultException) { throw; } catch (Exception ex) { myProject.Exception.Throw&lt;FooFault&gt;(ex); } } </code></pre> <p>in service contract;</p> <pre><code>[FaultException(typeof(FooFault))] void Foo(); </code></pre> <p>when a FaultException was thrown by DoSomething() method while i was running the application, firstly the exception was caught at "catch(Exception ex)" line and breaks in there. then when i pressed f5 again, it does what normally it has to. i wonder why that break exists? and if not could it be problem on publish?</p>
<p>Are you consuming the WCF service from Silverlight? If so, a special configuration is needed to make the service return a HTTP 200 code instead of 500 in case of error. The details are here: <a href="http://msdn.microsoft.com/en-us/library/dd470096%28VS.96%29.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/dd470096%28VS.96%29.aspx</a></p>
<p>@yapiskan,</p> <p>C# is a strong typed language Foo&lt; X> != Foo. So if you need to catch some exception, provide <em>exact</em> type in <em>catch</em> clause.</p> <p>You can learn more on exception handling reading <a href="http://msdn.microsoft.com/en-us/library/ms229005.aspx" rel="nofollow noreferrer">this</a> MSDN article.</p>
7,076
<p>I'm trying to 3D print a lattice work or truss, basically some beams forming a rectangle and additional beams forming the diagonals and where those beams cross, they should be fused. So, something like this:</p> <p><a href="https://i.stack.imgur.com/gdKj1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gdKj1.jpg" alt="simple lattice" /></a></p> <p>The problem is that any slicer I give a form like this to starts drawing triangles around the inner openings and in best case those triangles then touch if you use enough walls, but the pull strength you would get from beams in such a truss is lost because the opposite corners of the rectangle are not connected by a single length of filament laid down. Here as example what PrusaSlicer does for every layer:</p> <p><a href="https://i.stack.imgur.com/dpkQW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dpkQW.jpg" alt="enter image description here" /></a></p> <p>Basically this gives separate triangles at the top, bottom, left and right with some rectangular walls at the outside. Not bad, but I think that for extra strength it would be better if on even layers there would be long extrusions going all the way from the top-left corner to the bottom-right corner (and hence interrupting extrusion on the other diagonal) and on odd layers having just the opposite (so long extrusions from bottom-left to top-right).</p> <p>So, my question: is there any way to tell the slicer to do something like that? So, having extra long (alternating) corner to corner extrusions next to the triangular &quot;outer&quot; walls that it normally puts down? Or, is there some other trick I could use to get a similar effect (while also having long extrusions between adjacent corners)?</p>
<h2>Yes you can!</h2> <p>To have stronger prints you would have to choose the correct direction of filament deposition paths/traces. This answer demonstrates changing the direction of the filament path in Ultimaker Cura slicer.</p> <p>To do this, it requires some tinkering of your model and choosing the correct slicer parameters (decimals aren't allowed in changing the direction in Cura, only integer or round-off degrees).</p> <p>To recreate the experiment I have created a similar model in <a href="https://openscad.org/" rel="nofollow noreferrer">OpenSCAD</a>:</p> <pre><code>union(){ difference(){ cube([100, 50, 1],center = true); // outer contour cube([90, 40, 1.1],center = true); // inner contour } // add 2 cross beams for (i=[-1:2:1]) { // Note: // 26.565051177078 would have been exactly corner to corner, but // decimals aren't allowed in Cura, hence the choice for 26 degrees rotate([0,0,i*26]){ cube([100, 5, 1],center = true); } } } </code></pre> <p>Which gives you: <a href="https://i.stack.imgur.com/F527k.png" rel="nofollow noreferrer" title="Rectangle with cross beams"><img src="https://i.stack.imgur.com/F527k.png" alt="Rectangle with cross beams" title="Rectangle with cross beams" /></a></p> <p>Create an STL from the code and load this into Ultimaker Cura slicer.</p> <p>The trick is to direct the deposition of the top/bottom pattern [<code>lines</code>] and the infill [<code>lines</code>] in the direction you need (and for infill a high infill percentage). Remember the 26° angle of the cross beams, the definition of Cura line direction is different, so the angle of deposition needs to be ±(90 - 26) = ±64° which is denoted as [64, -64] in the slicer. Note the top and bottom contain 2 layers, the rest is infill. You can also have no infill by selecting very large top/bottom thickness, or, no top/bottom layers and only infill (this answer demonstrates <strong>both options</strong>, but you could choose just one).</p> <p>Look at the bottom layer (see slicer settings on the right): <a href="https://i.stack.imgur.com/72Gbu.png" rel="nofollow noreferrer" title="Bottom layer"><img src="https://i.stack.imgur.com/72Gbu.png" alt="Bottom layer" title="Bottom layer" /></a></p> <p>The second layer looks like: <a href="https://i.stack.imgur.com/XfdHA.png" rel="nofollow noreferrer" title="Second layer"><img src="https://i.stack.imgur.com/XfdHA.png" alt="Second layer" title="Second layer" /></a></p> <p>First infill layer: <a href="https://i.stack.imgur.com/yY10h.png" rel="nofollow noreferrer" title="First infill layer"><img src="https://i.stack.imgur.com/yY10h.png" alt="First infill layer" title="First infill layer" /></a></p> <p>Second infill layer (needed to lower the top layer to a single layer to be able to display this): <a href="https://i.stack.imgur.com/RbtzN.png" rel="nofollow noreferrer" title="Second infill layer (needed to lower the top layer to a single layer to be able to display this)"><img src="https://i.stack.imgur.com/RbtzN.png" alt="Second infill layer" title="Second infill layer (needed to lower the top layer to a single layer to be able to display this)" /></a></p> <p>As seen by the sliced layers, you can have an alternating pattern where the filament path is continuous for each cross-beam every other layer. This should increase the load (tension) the beam is able to support opposed to the given pattern in the question body.</p>
<p>Have a look at <a href="https://www.reddit.com/r/3Dprinting/comments/pt80ap/new_3d_printing_slicer_geared_towards_highspeed/" rel="nofollow noreferrer">Chisel</a> infills there are very strength optimised, limitation is currently that they must be single line width, but multiple-lines thick infill will be supported soon. After that, it's very simple, basically setting double corrugated infill with corrugation size 1 for your rectangle model.</p>
2,025
<p>I've recently changed my Ender3's hotend to E3D v6 clone with Titan direct extruder, so I can print faster than on stock. But when I increased the speed up to 70 mm/s for walls and 80 mm/s for infill (PETG, nozzle temperature of 225 °C, bed temperature of 80 °C, 0.2 mm layer height, 0.4 mm layer width), I've faced this kind of issue:</p> <p><a href="https://i.stack.imgur.com/ipyUr.jpg" rel="nofollow noreferrer" title="3D printer printing a model with errors"><img src="https://i.stack.imgur.com/ipyUr.jpg" alt="3D printer printing a model with errors" title="3D printer printing a model with errors" /></a></p> <p>Here's how it looks in Cura:</p> <p><a href="https://i.stack.imgur.com/668ki.jpg" rel="nofollow noreferrer" title="Screenshot of Cura's preview of model"><img src="https://i.stack.imgur.com/668ki.jpg" alt="Screenshot of Cura's preview of model" title="Screenshot of Cura's preview of model" /></a></p> <p>The printer's head goes from left to right, counter-clockwise and I get issues on both exits from curved shape.</p> <p><a href="https://i.stack.imgur.com/AMZUz.jpg" rel="nofollow noreferrer" title="Another Cura preview further into the print with arrows indicating problem areas"><img src="https://i.stack.imgur.com/AMZUz.jpg" alt="Another Cura preview further into the print with arrows indicating problem areas" title="Another Cura preview further into the print with arrows indicating problem areas" /></a></p> <p>First of all, I thought, it is connected somehow with retraction, but according to Cura, both problem places are in the middle of the current layer. Later I thought it could be related to Linear Advance and disabled it on the next test print, but it did nothing:( Slowing the printer down to 60-65 % in mid print solved the issue, but it's not what I changed the hotend for:)</p> <p>Maybe someone has any ideas, what's wrong with it?</p>
<p>In my experience, 225 °C is the lower range for PETG, that combined with a higher than normal printing speed of 70 mm/s might be your issue. The lower your print temps the lower the maximum nozzle flow rate. I would recommend increasing the nozzle temperature.</p> <p>For a point of reference, on my printer with an E3D v6 clone and a generic extruder I print PETG at 235 °C and 60 mm/s and 24 mm/s outer perimeter speed, with a 0.2 mm layer thickness. Though admittedly not optimized for speed.</p>
<p>In other words, your print exhibits issues when the hotend is accelerating, like if not enough filament were pushed in.</p> <p>It is advised to calibrate for linear advance after replacing the extruder.</p> <p>Check <a href="https://marlinfw.org/docs/features/lin_advance.html" rel="nofollow noreferrer">https://marlinfw.org/docs/features/lin_advance.html</a> and</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/n3yK0lJ8TWM?start=0"></iframe> </div></div></p> <p>and check <a href="https://marlinfw.org/tools/lin_advance/k-factor.html" rel="nofollow noreferrer">https://marlinfw.org/tools/lin_advance/k-factor.html</a></p>
1,998
<p>I need to print a rotor for a DC motor I'm designing. In the process of testing the behaviors of the motor performances, I would need a material that will not deform at a temperature range between 100 °C to 150 °C.</p> <p>Since I don't have a 3D printer yet, I would like to know what would be the best choice for my need. I was planning to buy an Ender 3, but I'm not sure this entry-level 3D printer will allow me to obtain the results I'm looking for. I'm excluding PLA material because I think it's the most &quot;fragile&quot; material from this point of view and for my needs.</p> <p>My questions are:</p> <ol> <li>Which material should I use in order to have a 3D printed object (rotor) that will not deform at a temperature that varies from 100 °C to 150 °C?</li> <li>Can an Ender 3 (planning to use full metal hotend and also hotbed) be used to print the filament that is heat resistant? Should I buy a resin 3D printer?</li> </ol>
<p>PEEK (poly ether ether ketone) has a glass transition temperature of 145 ‎°C (293 °F).</p> <p>Melting temperature 345 ‎°C (653 °F)</p> <p>Nozzle temperature 370 - 410 ‎°C</p> <p>Heated bed 120 - 150 ‎°C</p> <hr /> <p>Polycarbonate has a glass transition temperature of about 147 °C (297 °F)</p> <hr /> <p>Polypropylene has a glass transition temperature is 215 °C</p> <hr /> <p>Polymaker PolyMide CoPA (specialized Nylon) Filament has a softening temperature of ~180 °C, but they don't specify the glass transition temperature. Other materials have the glass transition temperature about 5 °C below the temperature the material softens.</p> <p>However, the glass transition temperature is only an indication of a physical change: while uncommon, a material may be rigid enough well above it's glass transition temperature. <a href="https://3dprinting.stackexchange.com/questions/15490/how-to-interpret-various-thermal-related-filament-properties">How to interpret various thermal-related filament properties?</a></p> <p>A side issue to consider as far as layout is FDM prints are weakest between layers (layer separation), so you want a layout where this affects your print the least.</p>
<p>Using an Ender 3 for high temperature materials is possible but you need to enclose it to be able to heat the air up to 100 °C.</p> <p>It's quite involved and it would be much better, if it's something you do seldomly, to have the parts printed professionally.</p> <p>Many thing start warping or breaking at 100 °C.</p>
1,844
<p>I've seen lots of examples of making an entire regular expression case-insensitive. What I'm wondering about is having just part of the expression be case-insensitive.</p> <p>For example, let's say I have a string like this:</p> <pre><code>fooFOOfOoFoOBARBARbarbarbAr </code></pre> <p>What if I want to match all occurrences of "foo" regardless of case but I only want to match the upper-case "BAR"s?</p> <p>The ideal solution would be something that works across regex flavors but I'm interested in hearing language-specific ones as well (Thanks <a href="https://stackoverflow.com/questions/43632/can-you-make-just-part-of-a-regex-case-insensitive#43636">Espo</a>)</p> <p><strong><em>Edit</em></strong></p> <p>The link Espo provided was very helpful. There's a good example in there about turning modifiers on and off within the expression.</p> <p>For my contrived example, I can do something like this:</p> <pre><code>(?i)foo*(?-i)|BAR </code></pre> <p>which makes the match case-insensitive for just the foo portion of the match.</p> <p>That seemed to work in most regex implementations except Javascript, Python, and a few others (as Espo mentioned). </p> <p>The big ones that I was wondering about (Perl, PHP, .NET) all support inline mode changes.</p>
<p>Perl lets you make part of your regular expression case-insensitive by using the (?i:) pattern modifier.</p> <p>Modern regex flavors allow you to apply modifiers to only part of the regular expression. If you insert the modifier (?ism) in the middle of the regex, the modifier only applies to the part of the regex to the right of the modifier. You can turn off modes by preceding them with a minus sign. All modes after the minus sign will be turned off. E.g. (?i-sm) turns on case insensitivity, and turns off both single-line mode and multi-line mode.</p> <p>Not all regex flavors support this. JavaScript and Python apply all mode modifiers to the entire regular expression. They don't support the (?-ismx) syntax, since turning off an option is pointless when mode modifiers apply to the whole regular expressions. All options are off by default.</p> <p>You can quickly test how the regex flavor you're using handles mode modifiers. The regex (?i)te(?-i)st should match test and TEst, but not teST or TEST.</p> <p><a href="http://www.regular-expressions.info/modifiers.html" rel="noreferrer">Source</a></p>
<p>You could use </p> <pre><code>(?:F|f)(?:O|o)(?:O|o) </code></pre> <p>The ?: in the brackets in .Net means it's non-capturing, and just used to group the terms of the | (or) statement.</p>
6,522
<p>I can create a menu item in the Windows Explorer context menu by adding keys in the registry to <strong>HKEY_CLASSES_ROOT\Folder\shell</strong>.</p> <p>How can I create submenu items to the just created menu item?</p>
<p>First and foremost - backup everything! The databases, the machine itself... You can never be too careful.</p> <p>I was able to upgrade the TFS installation at my company by using these resources:</p> <p><a href="http://olausson.net/blog/CommentView,guid,6f97b619-a5ac-41af-a908-f099d49a3b16.aspx" rel="nofollow noreferrer">http://olausson.net/blog/CommentView,guid,6f97b619-a5ac-41af-a908-f099d49a3b16.aspx</a> <a href="http://blogs.msdn.com/sudhir/archive/2007/05/31/upgrade-2005-with-wss2-0-to-orcas-wss3-0.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sudhir/archive/2007/05/31/upgrade-2005-with-wss2-0-to-orcas-wss3-0.aspx</a> <a href="http://weblogs.asp.net/dmckinstry/archive/2007/08/27/considerations-on-using-tfs-2008-with-visual-studio-2005.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/dmckinstry/archive/2007/08/27/considerations-on-using-tfs-2008-with-visual-studio-2005.aspx</a></p> <p>It's not that hard and can in fact be done in a couple of hours, with better luck.</p>
<p>Simply, follow the guidance in the Install document for TFS 2008 - It has an upgrade section. It talks about backing up databases and so on already. The instructions are clear and layed out well. </p>
6,085
<p>So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects.</p> <pre><code>List&lt;MyObject&gt; myObjects = new List&lt;MyObject&gt;(); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); </code></pre> <p>So I want to remove objects from my list based on some criteria. For instance, <code>myObject.X &gt;= 10.</code> I would like to use the <code>RemoveAll(Predicate&lt;T&gt; match)</code> method for to do this.</p> <p>I know I can define a delegate which can be passed into RemoveAll, but I would like to know how to define this inline with an anonymous delegate, instead of creating a bunch of delegate functions which are only used in once place.</p>
<p>There's two options, an explicit delegate or a delegate disguised as a lamba construct:</p> <p>explicit delegate</p> <pre><code>myObjects.RemoveAll(delegate (MyObject m) { return m.X &gt;= 10; }); </code></pre> <p>lambda</p> <pre><code>myObjects.RemoveAll(m =&gt; m.X &gt;= 10); </code></pre> <hr /> <p>Performance wise both are equal. As a matter of fact, both language constructs generate the same IL when compiled. This is because C# 3.0 is basically an extension on C# 2.0, so it compiles to C# 2.0 constructs</p>
<p>Predicate is a delegate which takes an param and returns a boolean.</p> <p>We can do the same in following ways</p> <p>1) <strong>Using inline Lambda expression</strong></p> <pre><code>RemoveAll(p=&gt; p.x &gt; 2); </code></pre> <p>2) <strong>Using anonymous function</strong></p> <pre><code>RemoveAll(delegate(myObject obj){ return obj.x &gt;=10; }) </code></pre> <p>3) <strong>Using Predicate delegate</strong></p> <pre><code>Predicate&lt;myObject&gt; matches = new Predicate&lt;myObject&gt;(IsEmployeeIsValid); RemoveAll(matches); Predicate&lt;Foo&gt; matches = delegate(Foo o){ return o.X &gt;= 20; }); RemoveAll(matches); </code></pre> <p>3) <strong>Declaring a delegate explicitily and pointing to a function</strong></p> <pre><code>public delegate bool IsInValidEmployee (Employee emp); IsInValidEmployee invalidEmployeeDelegate = new IsInValidEmployee(IsEmployeeInValid); myObjects.RemoveAll(myObject=&gt;invalidEmployeeDelegate(myObject); </code></pre> <p>// Actual function</p> <pre><code>public static bool IsEmployeeInValid(Employee emp) { if (emp.Id &gt; 0 ) return true; else return false; } </code></pre>
8,366
<p>I find that white filaments are quite translucent and printing 5 layers of white filament onto 2 layers of black filament (at 0.2 mm layers, the white layers being 100% infilled and the underlying black layer covering about 85% of the whole area) produces a slightly grey color on the top.</p> <p>Is that a limitation of the white colour (or the actual material used)?</p> <p>Are there materials, that address this issue to some extent?</p> <p>Adjusting layer thickness while keeping the overall height won't change things, right?</p>
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the nozzle. You should do this for all 4 corners. Be careful though, you dont want the bed too far away from the nozzle, or problems maybe arise with the print not sticking to the bed.</p> <p>Hope this helps, Luke.</p>
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the nozzle. You should do this for all 4 corners. Be careful though, you dont want the bed too far away from the nozzle, or problems maybe arise with the print not sticking to the bed.</p> <p>Hope this helps, Luke.</p>
1,684
<p>I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation block and all static methods.</p> <p>Is this something that's worth keeping since it will require merging a lot of conflicts, what sort of situation would I be looking at for this refactoring to be worthwhile?</p> <p>We are running this app under Weblogic 8.1 (so JDK 1.4.2)</p> <hr> <p>sorry Thomas, let me clarify..</p> <p>the HEAD version has the traditional singleton pattern (private constructor, getInstance() etc)</p> <p>the branch version has no constructor, is a 'public abstract class' and modified all the methods on the object to be 'static'. The code that used to exist in the private constructor is moved into a static block.</p> <p>Then all usages of the class are changed which causes multiple conflicts in the merge.</p> <p>There are a few cases where this change was made.</p>
<p>From a strict runtime performance point of view, the difference is really negligible. The main difference between the two lies down in the fact that the "static" lifecycle is linked to the classloader, whereas for the singleton it's a regular instance lifecycle. Usually it's better to stay away from the ClassLoader business, you avoid some tricky problems, especially when you try to reload the web application.</p>
<p>Does this discussion help? (I don't know if it's taboo to link to another programming forum, but I'd rather not just quote the whole discussion =) )</p> <p><a href="http://forums.sun.com/thread.jspa?threadID=5221231&amp;messageID=9898827" rel="nofollow noreferrer">Sun Discussion on this subject</a></p> <p>The verdict seems to be that it doesn't make enough of a difference to matter in most cases, though technically the static methods are more efficient.</p>
4,790
<p>Does anyone know how to get IntelliSense to work reliably when working in C/C++ projects? It seems to work for about 1 in 10 files. Visual Studio 2005 seems to be a lot better than 2008.</p> <p>Edit: Whilst not necessarily a solution, the work-around provided here: </p> <p><a href="https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39590">How to get IntelliSense to reliably work in Visual Studio 2008</a></p> <p>Is probably the best bet if I want a decent IntelliSense system.</p>
<p>I've also realized than Intellisense is sometime 'lost', on some big project. Why? No idea.</p> <p>This is why we have bought <a href="http://www.wholetomato.com/" rel="noreferrer">Visual Assist</a> (from <a href="http://www.wholetomato.com/" rel="noreferrer">Tomato software</a>) and disabled Intellisense by deleting the dll feacp.dll in the Visual studio subdirectory (C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages)</p> <p>This is not a solution, just a workaround.</p>
<p>About this problem i've notice something interesting (on Visual Studio 2010): to solve this problem i've changed <code>#include</code> sintax in my header files, before was (old project done with VS 2005 and reopened using VS 2010):</p> <pre><code>#include &lt;myfile.h&gt; </code></pre> <p>and i fix this with:</p> <pre><code>#include "myfile.h" </code></pre> <p>After intellisense start working correctly! I hope this can help!</p>
6,054
<p>I am new to Fusion 360 and I think I'm going straight to something complicated. Is there a way to make a nose cone for a model rocket? What tools would one you to accomplish this?</p>
<p>If you have a specific shape in mind and can create a sketch to represent that shape, you are halfway to your goal.</p> <p>The concept is simple. Create a single line sketch that would represent the desired curve, starting from, in this example, the nose of the cone and traveling to the base. Create only one-half of the nose cone curve and maintain a "standard" axis reference, say, using the Y-axis as the rotation point.</p> <p>The process is called <a href="http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-5C62F370-7AB4-4DFD-BE61-F8830F30A6D7" rel="noreferrer">revolve. Fusion 360</a> supports this action directly.</p> <pre><code>In the Sculpt workspace, choose Create Revolve. Select the profile to revolve. In the Revolve dialog: Click Axis and then select the axis to revolve around. Choose Full or Angle to specify whether the revolution is full or to a specific angle. For Direction choose One Side, Two Side or Symmetrical. For Symmetry, choose None or Circular. </code></pre> <p>The above text is taken directly from the link. The specific web site also includes a Flash video of the steps involved.</p> <p>If thickness is required for your creation, consider to draw the sketch from the nose to the base, then use Offset or hand sketch in a parallel line that returns to the nose. Ensure the base segment is joined and that the nose segments are open and are aligned to the Y-axis.</p> <p>As the sketch is revolved, the nose sections will "close" while the base creates the closure necessary to make a solid that is hollow within and open at the bottom.</p> <p>Use The Google or your preferred search engine with the terms "Fusion 360 Revolve" to find many tutorials and videos with the same information presented in various ways.</p>
<p>Try model8ng the rocket into the workspace, and then you can extruder a nose cone from the top using a 30 degree angle</p>
696
<p>I have a class with a <code>ToString</code> method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. </p> <p><strong>Should I include the DTD as a string within the unit test to avoid a dependency</strong> on it, or is there a smarter way to do this?</p>
<p>If your program validates the XML against the DTD during normal execution, then you should just get the DTD from wherever your program will get it.</p> <p>If not and the DTD is extremely short (only a few lines), then storing it as a string in your code is probably okay.</p> <p>Otherwise, I'd put it in an external file and have your unit test read it from that file.</p>
<p>Using a DTD in the unit test to test its validity is one thing, testing for the correct content is another.</p> <p>You can use the DTD to check for the validity of the generated xml which I would simply read the way you do in your program. I personally would not include it inline (as a String); there is always a dependency between you application code and the unit test. When the generated xml changes, the DTD will also change.</p> <p>To test for the correct content I would go for <a href="http://www.xmlunit.org" rel="nofollow">XMLUnit</a>. </p> <p>Asserting xml using XMLUnit:</p> <pre><code>XMLUnit.setIgnoreWhitespace(true); XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true); Diff diff = new Diff(expectedDocument, obtainedDocument); XMLAssert.assertXMLIdentical("xml invalid", diff, true); </code></pre> <p>One thing you might come across is the fact that the generated xml might contain changing identifiers (id/uid attributes or alike). This can be solved by using a <a href="http://www.xmlunit.org/api/java/master/org/custommonkey/xmlunit/DifferenceListener.html" rel="nofollow">DifferenceListener</a> when asserting the generated xml.</p> <p>Example implementation of such DifferenceListener:</p> <pre><code>public class IgnoreVariableAttributesDifferenceListener implements DifferenceListener { private final List&lt;String&gt; IGNORE_ATTRS; private final boolean ignoreAttributeOrder; public IgnoreVariableAttributesDifferenceListener(List&lt;String&gt; attributesToIgnore, boolean ignoreAttributeOrder) { this.IGNORE_ATTRS = attributesToIgnore; this.ignoreAttributeOrder = ignoreAttributeOrder; } @Override public int differenceFound(Difference difference) { // for attribute value differences, check for ignored attributes if (difference.getId() == DifferenceConstants.ATTR_VALUE_ID) { if (IGNORE_ATTRS.contains(difference.getControlNodeDetail().getNode().getNodeName())) { return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL; } } // attribute order mismatch (optionally ignored) else if (difference.getId() == DifferenceConstants.ATTR_SEQUENCE_ID &amp;&amp; ignoreAttributeOrder) { return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL; } // attribute missing / not expected else if (difference.getId() == DifferenceConstants.ATTR_NAME_NOT_FOUND_ID) { if (IGNORE_ATTRS.contains(difference.getTestNodeDetail().getValue())) { return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL; } } return RETURN_ACCEPT_DIFFERENCE; } @Override public void skippedComparison(Node control, Node test) { // nothing to do } } </code></pre> <p>using DifferenceListener:</p> <pre><code> XMLUnit.setIgnoreWhitespace(true); XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true); Diff diff = new Diff(expectedDocument, obtainedDocument); diff.overrideDifferenceListener(new IgnoreVariableAttributesDifferenceListener(Arrays.asList("id", "uid"), true)); XMLAssert.assertXMLIdentical("xml invalid", diff, true); </code></pre>
7,496
<p>I am developing a web page code, which fetches dynamically the content from the server and then places this content to container nodes using something like</p> <pre><code>container.innerHTML = content; </code></pre> <p>Sometimes I have to overwrite some previous content in this node. This works fine, until it happens that previous content occupied more vertical space then a new one would occupy AND a user scrolled the page down -- scrolled more than new content would allow, provided its height.</p> <p>In this case the page redraws incorrectly -- some artifacts of the old content remain. It works fine, and it is even possible to get rid of artifacts, by minimizing and restoring the browser (or force the window to be redrawn in an other way), however this does not seem very convenient.</p> <p>I am testing this only under Safari (this is a iPhone-optimized website).</p> <p>Does anybody have the idea how to deal with this?</p>
<p>The easiest solution that I have found would be to place an anchor tag <code>&lt;a&gt;</code> at the top of the <code>div</code> you are editing:</p> <pre><code>&lt;a name="ajax-div"&gt;&lt;/a&gt; </code></pre> <p>Then when you change the content of the <code>div</code>, you can do this to have the browser jump to your anchor tag:</p> <pre><code>location.hash = 'ajax-div'; </code></pre> <p>Use this to make sure the user isn't scrolled down too far when you update the content and you shouldn't get the issue in the first place.</p> <p>(tested in the latest FF beta and latest safari)</p>
<p>It sounds like you are having a problem with the browser itself. Does this problem only occur in one browser?</p> <p>One thing you might try is using a lightweight library like <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a>. It handles browser differences fairly nicely. To set the inner HTML for a div with the ID of <strong>container</strong> you would simply write this:</p> <pre><code>$('#container').html( content ); </code></pre> <p>That will work in most browsers. I do not know if it will fix your problem specifically or not but it may be worth a try.</p>
8,913
<p>On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment."</p> <p>A couple of <strong>possible approaches</strong> I know about, and browser compatibility (based on a quick test):</p> <p><strong>1) Do a <code>window.open</code> pointing to the new file.</strong> </p> <pre><code>- FireFox 3 blocks this. - IE6 blocks this. - IE7 blocks this. </code></pre> <p><strong>2) Create an iframe pointing to the new file.</strong> </p> <pre><code>- FireFox 3 seems to think this is OK. (Maybe it's because I already accepted it once?) - IE6 blocks this. - IE7 blocks this. How can I do this so that at least these three browsers will not object? </code></pre> <p>Bonus: is there a method that doesn't require browser-conditional statements? </p> <p>(I believe that download.com employs both methods conditionally, but I can't get either one to work.)</p> <p><strong>Responses and Clarifications:</strong></p> <pre><code>Q: "Why not point the current window to the file?" A: That might work, but in this particular case, I want to show them some other content while their download starts - for example, "would you like to donate to this project?" </code></pre> <p><strong>UPDATE: I have abandoned this approach. See my answer below for reasons.</strong></p>
<p>You can also do a meta refresh, which most browsers support. Download.com places one in a noscript tag.</p> <pre><code>&lt;meta http-equiv="refresh" content="5;url=/download.php?doc=123.zip"/&gt; </code></pre>
<p>How about changing the location to point to the new file? (e.g. by changing window.location)</p>
8,551
<p>I've got a number of non-technical users that all share a set of project files. It would be ideal to have them using version control, but I think that both subversion and git are too technical for non-technical office staff.</p> <p>Is there any distributed source control software that would work well for normal people?</p>
<p>If source control is too technical they can use <a href="http://svnbook.red-bean.com/en/1.2/svn.webdav.autoversioning.html" rel="noreferrer">Subversion with WebDav</a>.</p> <p>The less technical people will just save files normally from whatever application they use, without worrying/thinking about source control. They get the benefit of auto-versioning without doing anything. </p> <p>When ever they need more functionality they can learn to use TortoiseSVN to view diffs, revert to old version that were made automatically for them etc... </p> <p>From the subversion book :</p> <blockquote> <p>Because so many operating systems already have integrated WebDAV clients, the use case for this feature borders on fantastical: imagine an office of ordinary users running Microsoft Windows or Mac OS. Each user “mounts” the Subversion repository, which appears to be an ordinary network folder. They use the shared folder as they always do: open files, edit them, save them. Meanwhile, the server is automatically versioning everything. Any administrator (or knowledgeable user) can still use a Subversion client to search history and retrieve older versions of data.</p> </blockquote>
<p>Have you tried Adobe's version cue? This is not open source / free but it may be easier to use for the end-user.</p> <p><a href="http://www.adobe.com/products/creativesuite/versioncue/" rel="nofollow noreferrer">http://www.adobe.com/products/creativesuite/versioncue/</a></p>
7,291
<p>Acetone is banned in my country, and I cannot get it.</p> <p>What substitute could I use?</p>
<p>The answer really depends on what you are using it for. Is it for dissolving ABS? A <a href="https://www.google.com/search?q=accetone%20substitute" rel="nofollow noreferrer">quick google search</a> should show you what you want.</p> <p>The thread, <a href="https://www.researchgate.net/post/Could_you_recommend_me_a_suitable_alternative_to_acetone_as_solvent" rel="nofollow noreferrer">Could you recommend me a suitable alternative to acetone as solvent?</a>, has a good many points that are worth considering:</p> <p>For example, you may need to consider the <em>Polarity Index</em></p> <blockquote> <p><a href="http://macro.lsu.edu/howto/solvents/Polarity%20index.htm" rel="nofollow noreferrer">Burdick &amp; Jackson solvents</a> are arranged in order of increasing polarity index, a relative measure of the degree of interaction of the solvent with various polar test solutes.</p> </blockquote> <p>If you are using it to dissolve a polymer other than ABS, then the family/class of polymer may need to be considered:</p> <blockquote> <p>Apart from your desired solvent qualities (non-flammability and low boiling point), the choice will be totally dependent on the family/ class which the polymer  belongs. Based on the principal that 'like dissolves like, the attached document will provide you with good ideas on which solvent to use when a particular repeating unit of the polymer is involved. </p> </blockquote> <p>Butanone is a possibility:</p> <blockquote> <p>One alternative is butanone (button-2-one) - this is similar to acetone, but has a much higher boiling point. It is often used for alkylations etc. It has a boiling point of 79-80°C compared to 56°C of acetone. </p> </blockquote> <p>or NMP:</p> <blockquote> <p>N-methyl-2-pyrrolidone (NMP) can be used. It is a polar aprotic solvent and dissolves many polymers. It has high boiling point ( >200 degree centigrade)  It is soluble in water and easy to dispose which is a great advantage during work up of reactions. </p> </blockquote> <p>However, some other alternative chemicals are listed here (from <a href="https://www.mindat.org/forum.php?read,6,266290,271485" rel="nofollow noreferrer">Any good alternative to Acetone</a>?:</p> <ul> <li>Butyl alcohol</li> <li>methyl isobutyl keytone (MIBK)</li> <li>denatured alcohol</li> <li>MEK (methyl,ethyl,ketone), i.e. Kleen-Strip MEK Alternative</li> <li>Ethyl Acetate</li> </ul> <p>Some branded items, from <a href="https://www.hunker.com/12552932/alternatives-to-acetone" rel="nofollow noreferrer">Alternatives to Acetone</a>:</p> <blockquote> <ul> <li>Surfasolve</li> </ul> <blockquote> <p>Surfasolve is a 100 percent biodegradable acetone replacement that removes adhesives, degreases tools and works as a resin solvent. Surfasolve is a non-regulated product.</p> </blockquote> <ul> <li>Bio-Solv</li> </ul> <blockquote> <p>Bio-Solv is an acetone replacement that is 100 percent biodegradable. It is not deemed a hazmat, so shipping will not cost you more. This acetone alternative is not listed on California Proposition 65, a law passed in 1986 to keep substances that cause cancer and birth defects out of drinking water. Nevertheless, you want to use Bio-Solv in a well-ventilated area because of an unpleasant odor. It is not, however, a hazardous air pollutant. Bio-Solv is not petroleum based.</p> </blockquote> <ul> <li>Replacetone</li> </ul> <blockquote> <p>Replacetone is another acetone alternative. It is nonflammable and nonvolatile. It can be used as an acetone or MEK (methyl ethyl ketone, an industrial solvent) replacement that is biodegradable. Both Replacetone and Bio-Solv are referred to as green acetone.</p> </blockquote> <ul> <li>Methyl Acetate</li> </ul> <blockquote> <p>Methyl acetate is offered as an acetone replacement. Manufactured by the Eastman Chemical Company, it is utilized in industrial applications. It is biodegradable, volatile organic compound exempt and non-HAP (hazardous air pollutant)</p> </blockquote> </blockquote> <h3>Important note</h3> <p>However, <em>some of these items may also be banned in your country</em>, so check first. As you do not say which country that you are from, it is not possible to qualify this statement.</p> <p>It is worth remembering that some of these substances are <em>not</em> as safe as acetone, and <em>the fumes may be more toxic</em>, so they should always be used in <em>well ventilated spaces</em>.</p>
<p>I have used DCM (dichloromethane, or ethylene dichloride) to dissolve ABS (or cold-weld/glue parts together).</p> <p>From <a href="https://en.wikipedia.org/wiki/Acrylonitrile_butadiene_styrene" rel="nofollow noreferrer">ABS wikipedia page</a>: </p> <blockquote> <p><strong>ABS polymers</strong> are resistant to aqueous acids, alkalis, concentrated hydrochloric and phosphoric acids, alcohols and animal, vegetable and mineral oils, but they are swollen by glacial acetic acid, carbon tetrachloride and aromatic hydrocarbons and <strong>are attacked by concentrated sulfuric and nitric acids. They are soluble in esters, ketones, ethylene dichloride and acetone</strong>.</p> </blockquote>
605
<p>How do I get today's date in C# in mm/dd/yyyy format?</p> <p>I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time.</p> <p>BTW: I'm in the US so M/dd would be correct, e.g. September 11th is 9/11.</p> <p><em>Note: an answer from kronoz came in that discussed internationalization, and I thought it was awesome enough to mention since I can't make it an 'accepted' answer as well.</em></p> <p><a href="https://stackoverflow.com/questions/32747/how-do-i-get-todays-date-in-c-in-8282008-format#32819" title="kronoz&#39;s answer">kronoz's answer</a></p>
<pre><code>DateTime.Now.ToString("M/d/yyyy"); </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx</a></p>
<p>Or without the year:</p> <pre><code>DateTime.Now.ToString("M/dd") </code></pre>
5,275
<p>Not entirely sure what's going on here; any help would be appreciated.</p> <p>I'm trying to create a new .NET MVC web app. I was pretty sure I had it set up correctly, but I'm getting the following error:</p> <pre><code>The type 'System.Web.Mvc.ViewPage' is ambiguous: it could come from assembly 'C:\MyProject\bin\System.Web.Mvc.DLL' or from assembly 'C:\MyProject\bin\MyProject.DLL'. Please specify the assembly explicitly in the type name. </code></pre> <p>The source error it reports is as follows:</p> <pre><code>Line 1: &lt;%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %&gt; Line 2: Line 3: &lt;asp:Content ID="indexContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="server"&gt; </code></pre> <p>Anything stand out that I'm doing completely wrong?</p>
<p>Are you using a CodeBehind file, I don't see CodeBehind="" attribute where you are specifying the Inherits from? Then you have to point inherits to the class name of the codebehind.</p> <p>Example:</p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication4.Views.Home.Index" %&gt; </code></pre> <p>Make sure the Inherits is fully qualified. It should be the namespace followed by the class name.</p>
<p>No this should be a structural error message.</p> <p>Check <a href="http://trikks.wordpress.com/2011/08/26/the-type-is-ambiguous-it-could-come-from-assembly-or-from-assembly-please-specify-the-assembly-explicitly-in-the-type-name/" rel="nofollow">http://trikks.wordpress.com/2011/08/26/the-type-is-ambiguous-it-could-come-from-assembly-or-from-assembly-please-specify-the-assembly-explicitly-in-the-type-name/</a></p>
7,107
<p>I'm trying to script the shutdown of my VM Servers in a .bat. if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.</p> <pre><code>c: cd "c:\Program Files\VMWare\VmWare Server" vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspend soft -q vmware-cmd C:\VMImages\DevEnv\DevEnv\DevEnv.vmx suspend soft -q vmware-cmd C:\VMImages\DevEnv\TCVMDEV02\TCVMDEV02.vmx suspend soft =q robocopy c:\vmimages\ \\tcedilacie1tb\VMShare\DevEnvironmentBackups\ /mir /z /r:0 /w:0 vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx start vmware-cmd C:\VMImages\DevEnv\DevEnv\DevEnv.vmx start vmware-cmd C:\VMImages\DevEnv\TCVMDEV02\TCVMDEV02.vmx start </code></pre>
<p>Run it inside another command instance with <code>CMD /C</code></p> <pre><code>CMD /C vmware-cmd C:\... </code></pre> <p>This should keep the original BAT files running.</p>
<p>You could write a little Program that executes the command an returns a value (say -1 for an error). This value can then be used in your Batch-File.</p>
9,994
<p>In Perl, an object is just a reference to any of the basic Perl data types that has been blessed into a particular class. When you use the ref() function on an unblessed reference, you are told what data type the reference points to. However, when you call ref() on a blessed reference, you are returned the name of the package that reference has been blessed into. </p> <p>I want to know the actual underlying type of the blessed reference. How can I determine this?</p>
<p><code>Scalar::Util::reftype()</code> is the cleanest solution. The <a href="http://search.cpan.org/dist/Scalar-List-Utils/lib/Scalar/Util.pm" rel="noreferrer"><code>Scalar::Util</code></a> module was added to the Perl core in version 5.7 but is available for older versions (5.004 or later) from CPAN.</p> <p>You can also probe with <code>UNIVERSAL::isa()</code>:</p> <pre><code>$x-&gt;isa('HASH') # if $x is known to be an object UNIVERSAL::isa($x, 'HASH') # if $x might not be an object or reference </code></pre> <p>Obviously, you'd also have to check for <code>ARRAY</code> and <code>SCALAR</code> types. The UNIVERSAL module (which serves as the base class for all objects) has been part of the core since Perl 5.003.</p> <p>Another way -- easy but a little dirty -- is to stringify the reference. Assuming that the class hasn't overloaded stringification you'll get back something resembling <code>Class=HASH(0x1234ABCD)</code>, which you can parse to extract the underlying data type:</p> <pre><code>my $type = ($object =~ /=(.+)\(0x[0-9a-f]+\)$/i); </code></pre>
<p>And my first thought on this was: "Objects in Perl are always hash refs, so what the hack?"</p> <p>But, Scalar::Util::reftype is the answer. Thanks for putting the question here.</p> <p>Here is a code snippet to prove this.. (in case it is of any use to anyone).</p> <pre> $> perl -e 'use strict; use warnings "all"; my $x = [1]; bless ($x, "ABC::Def"); use Data::Dumper; print Dumper $x; print ref($x) . "\n"; use Scalar::Util "reftype"; print reftype($x) . "\n"'` </pre> <p>Output:</p> <pre> $VAR1 = bless( [ 1 ], 'ABC::Def' ); ABC::Def ARRAY </pre>
3,226
<p>Is there a way to change the appearance of an icon (ie. contrast / luminosity) when I hover the cursor, without requiring a second image file (or without requiring a hidden portion of the image)?</p>
<p><a href="http://www.w3schools.com/css/css_image_transparency.asp" rel="nofollow noreferrer">Here's some good information about image opacity and transparency with CSS</a>.</p> <p>So to make an image with opacity 50%, you'd do this:</p> <pre><code>&lt;img src="image.png" style="opacity: 0.5; filter: alpha(opacity=50)" /&gt; </code></pre> <p>The <strong>opacity:</strong> part is how Firefox does it, and it's a value between 0.0 and 1.0. <strong>filter:</strong> is how IE does it, and it's a value from 0 to 100.</p>
<p>The way I usually see things done with smaller images such as buttons it that only a certain portion of the image is shown. Then many states of the picture will make up a larger picture which gets shifted around behind the visible port. I'll delete this when someone has code.</p>
8,516
<p>I am receiving a message from a commercial program stating that the "LogMessage" stored procedure is not found. There does not appear to be a stored procedure called LogMessage in the associated MS SQLServer 2000 database. What can I do to track down the missing procedure, other than calling the company?</p>
<p>The reason you couldn't find it is because it's not there. Unless you have the original proc, you're going to have to call the company.</p> <p>Granted, you could take a stab at creating the proc, yourself. But why bother when somebody already has the original proc?</p> <p>Is this a fresh install of the commercial product? If so, this is completely their responsibility.</p>
<p>LogMessage seems pretty self-explanatory. You could probably take a stab at creating one yourself just to see what happens, if you can't easily get the real thing.</p> <p>Create a new table called LoggedMessages and just insert to the table when the proc is called. Then see what pops in.</p> <p>Kind of hacky, but given that it's a logging mechanism, which is tangential to the main features of the app, you could give it a try.</p>
9,972
<p>I was reading <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage">this question</a> about how to parse URLs out of web pages and had a question about the <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage#6183">accepted answer</a> which offered this solution:</p> <pre class="lang-none prettyprint-override"><code>((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+) </code></pre> <p>The solution was offered by <a href="https://stackoverflow.com/users/350/csmba">csmba</a> and he credited it to <a href="http://regexlib.com/Search.aspx?k=URL" rel="nofollow noreferrer">regexlib.com</a>. Whew. Credits done.</p> <p>I think this is a fairly naive regular expression but it's a fine starting point for building something better. But, my question is this:</p> <p>What is the point of <code>{1}</code>? It means "exactly one of the previous grouping", right? Isn't that the default behavior of a grouping in a regular expression? Would the expression be changed in any way if the <code>{1}</code> were removed?</p> <p>If I saw this from a coworker I would point out his or her error but as I write this the response is rated at a 6 and the expression on regexlib.com is rated a 4 of 5. So maybe I'm missing something?</p>
<p>@<a href="https://stackoverflow.com/questions/13470/question-about-specific-regular-expression#13479">Rob</a>: I disagree. To enforce what you are asking for I think you would need to use negative-look-behind, which is possible but is certainly not related to use {1}. Neither version of the regexp address that particular issue.</p> <p>To let the code speak:</p> <pre><code>tibook 0 /home/jj33/swap &gt; cat text Text this is http://example.com text this is Text this is http://http://example.com text this is tibook 0 /home/jj33/swap &gt; cat p #!/usr/bin/perl my $re1 = '((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+)'; my $re2 = '((mailto\:|(news|(ht|f)tp(s?))\://)\S+)'; while (&lt;&gt;) { print "Evaluating: $_"; print "re1 saw \$1 = $1\n" if (/$re1/); print "re2 saw \$1 = $1\n" if (/$re2/); } tibook 0 /home/jj33/swap &gt; cat text | perl p Evaluating: Text this is http://example.com text this is re1 saw $1 = http://example.com re2 saw $1 = http://example.com Evaluating: Text this is http://http://example.com text this is re1 saw $1 = http://http://example.com re2 saw $1 = http://http://example.com tibook 0 /home/jj33/swap &gt; </code></pre> <p>So, if there is a difference between the two versions, it's doesn't seem to be the one you suggest.</p>
<p>I don't think it has any purpose. But because RegEx is almost impossible to understand/decompose, people rarely point out errors. That is probably why no one else pointed it out. </p>
3,439
<p>I'm wondering how you can implement a program similar to <code>tail -f</code> in C/C++, a program that watches for and processes new lines added to a log file?</p>
<p>You can use fseek() to clear the eof condition on the stream. Essentially, read to the end of the file, sleep for a while, fseek() (without changing your position) to clear eof, the read to end of file again. wash, rinse, repeat. man fseek(3) for details.</p> <p>Here's what it looks like in perl. perl's seek() is essentially a wrapper for fseek(3), so the logic is the same:</p> <pre><code>wembley 0 /home/jj33/swap &gt;#&gt; cat p my $f = shift; open(I, "&lt;$f") || die "Couldn't open $f: $!\n"; while (1) { seek(I, 0, 1); while (defined(my $l = &lt;I&gt;)) { print "Got: $l"; } print "Hit EOF, sleeping\n"; sleep(10); } wembley 0 /home/jj33/swap &gt;#&gt; cat tfile This is some text in a file wembley 0 /home/jj33/swap &gt;#&gt; perl p tfile Got: This is Got: some Got: text Got: in Got: a file Hit EOF, sleeping </code></pre> <p>Then, in another session:</p> <pre><code>wembley 0 /home/jj33/swap &gt; echo "another line of text" &gt;&gt; tfile </code></pre> <p>And back to the original program output:</p> <pre><code>Hit EOF, sleeping Got: another line of text Hit EOF, sleeping </code></pre>
<p><a href="https://stackoverflow.com/questions/18632/how-to-monitor-a-text-file-in-realtime#18635">See here</a></p> <p>You could either call out to tail and retrieve the stream back into your app, or as it's open source, maybe try to pull it into your own code.</p> <p>Also, it is possible in C++ iostream to open a file for viewing only and just read to the end, while buffering the last 10-20 lines, then output that.</p>
4,240
<p>I've recently purchased an Ender 3 and have had great success with some Cura settings found on a YouTube Tutorial at 0.2 mm resolution.</p> <p>So then I noticed that there were default settings in Cura for the Ender 3. Except printing at 0.2 mm it selects a 20 % infill, and when choosing 0.1 mm it changed the infill to 10 %.</p> <p>I changed infill to 20 % and attempted to print this but there were gaps in the bottom layer and it won't stick to the bed. Is there anything else I need to change in the process?</p> <p>The shape is essentially a cube with a circular hole in the middle, sliced in half.</p>
<p>The more infill, the more material. The more material, the more stress is inside the part while it cools down from printing temperature to ambient temperature. Parts with higher infill density tend to warp more (the edges curl up).</p> <p>But 20 % should be fine, you shouldn't have any issue at that percentage (unless you're printing with ABS/ASA).</p> <p>I think it's a first layer issue, the 0.2 mm first layer gets more 'squished' onto the bed, thats why you get better adhesion. I'm using PrusaSlicer, every default print profile in PrusaSlicer uses a 0.2 mm first layer, maybe there is something like that in Cura too?</p> <p>For example the 0.1 mm PrusaSlicer profile will squish a 0.2 mm first layer onto the bed and changes to 0.1 mm layers for the rest of the print.</p>
<p>Basically you have 2 issues, first, an adhesion in combination with layer thickness problem, second, an infill problem.</p> <p>Starting with the infill issue, when you lower the layer height, without increasing the amount of layers for the &quot;Top/Bottom Thickness&quot;, you get a very thin shell (unless the top bottom thickness is expressed in mm). A lower layer height should, because of the lesser amount of filament being extruded over the infill, should be accompanied with a higher infill value, but that is necessary for the top layers, your issue is with the bottom layer and adhesion. As said, a lower layer height also implies lower filament flow, for the first layer this lower flow causes an inconsistent flow to adhere the filament to the bed (probably caused by the gap between the nozzle and bed from leveling with a piece of paper). Most slicers will add some extra features to increase the change to get the filament to stick to the bed; one of those is an increased first layer height (e.g. in Ultimaker Cura, the first default layer height for Ultimaker 3 printers is laarger than the rest of the layers), others include modifying the flow by e.g. over-extruding for the first layer.</p> <p>You could try to increase your first layer height to the value you create successful prints with, specify the thickness of the bottom and top (or increase the amount of layers for printing these) and increase the infill percentage.</p>
1,110
<p>I'm having a problem getting a clean first layer on an Ender 3 with BLTouch auto bed leveling. Thickness seems to fluctuate all over the bed, but in a consistent (repeatable) way. Here's my attempt to print a <a href="https://www.thingiverse.com/thing:2187071" rel="nofollow noreferrer">single layer 5 square bed calibration test</a>:</p> <p><a href="https://i.stack.imgur.com/bKYFc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bKYFc.jpg" alt="Full bed"></a> I stopped the print midway through filling the first square, but you get the idea. Lines go from too low so no filament comes out to too high.</p> <p>I printed this several (many) times with slight settings tweaks and it looks pretty much the same every time; the ups and downs aren't random. For example, the center square always is always too low on the left and too high on the right:</p> <p><a href="https://i.stack.imgur.com/2wI8h.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2wI8h.jpg" alt="Center square"></a></p> <p>The printer is a SainSmart Ender 3 Pro with a BLTouch V3.1 and Creality glass bed, otherwise stock. I flashed a bootloader and Marlin 2.0 using the <a href="https://github.com/3d-printing-canada/Ender-3-BL-Touch-Installation" rel="nofollow noreferrer">instructions and pre-compiled firmware</a> from 3D Printing Canada. I'm using the glass bed upside-down on the plain glass side (no coating).</p> <p>I pre-heated and leveled the four corners manually using the paper method. I auto-homed and then lowered the hot end until it would just catch a piece of paper and used that height to set the Z offset using M851 and saved it with M500. It's currently set at -2.80.</p> <p>I added <code>G29</code> to GCode start in Cura, and it does a 3x3 probe before the print starts. Here's the output when I run <code>M420 V</code>:</p> <pre><code>Bilinear Leveling Grid: 0 1 2 0 -0.207 +0.172 +0.162 1 -0.100 -0.160 +0.220 2 -0.118 +0.215 +0.295 </code></pre> <p>Here's what it looks like in the Bed Visualizer plug-in in Octoprint:</p> <p><a href="https://i.stack.imgur.com/Vy4YI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vy4YI.png" alt="Bed visualization"></a></p> <p>If I understand this right (dubious) it's showing that the glass is lower toward the front and left, highest at back-right. But it's only 0.4mm from the lowest to highest points. And the whole point of mesh leveling is to compensate for this anyway.</p> <p>At Paulster's suggestion I turned off mesh leveling using <code>M420 S0</code>, leveled manually, and printed again. The result is pretty similar (note that this time I let it run all the way through):</p> <p><a href="https://i.stack.imgur.com/hwWJ1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hwWJ1.jpg" alt="Second print without mesh leveling"></a></p> <p>Where should I start looking to diagnose this problem?</p> <p><strong>Update</strong></p> <p>I noticed my X-axis belt was a bit loose, so I tightened it up. It seems to have helped with the odd Z slanting. My test print is still not great though, so this may not be the whole problem. Also I've never seen this effect listed as one caused by loose belts, so it's dubious as the cause. Here's the current test print after tightening the belt:</p> <p><a href="https://i.stack.imgur.com/RWlJd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RWlJd.jpg" alt="Updated test print"></a> <a href="https://i.stack.imgur.com/1deao.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1deao.jpg" alt="Closeup test print"></a></p> <p>It's flatter, but I'm still getting (I think) under-extrusion and some odd wobbles at the corners.</p>
<p>This turned out to be a problem with the tightness of the rollers at the left and right sides of the X-axis gantry (that roll up and down the Z rails).</p> <p>Z-axis motion is driven by a single stepper motor on the left side, so the rollers have to be just the right amount of tight to keep the right side in sync. If the right side is tighter or looser than the left then it lags behind, which gives the gantry a slight slant which changes as it goes up and down.</p> <p>If the gantry is changing pitch throughout the print, no amount of bed leveling will help. Even auto-leveling is worthless, because the readings the BLTouch takes become immediately out of sync with the gantry as soon as it moves again.</p> <p>The solution is to adjust the eccentric nuts in the rollers on the left and right. The best description I could find is that they need to be just tight enough that there's some resistance if you roll the top wheel with your finger, but loose enough that you can roll it without forcing the gantry up and down.</p> <p>I ended up putting a magnetic digital level on top of the gantry rail so I could see exactly how much its incline changed. Send gcode to slide it up and down, then adjust the eccentric nuts a little bit, then repeat. Once I got it so the level didn't change, I re-leveled the bed and printed a beautiful first layer.</p> <p>That was almost a year ago and it's been working ever since. I've had to re-adjust the eccentric nuts periodically when things start to get off, probably due to thermal expansion when the weather changes.</p>
<p>Two things:</p> <ol> <li>Did you bring the bed up to operating temperature to do the levelling (manual or automatic). The metal &amp; glass will expand/warp at different levels depending on temp.</li> <li>Check your G-code to make sure it is not doing a <code>G28</code> (auto home). That turns off auto-levelling. If it is there you can add:</li> </ol> <pre> G28 ;Home M420 S1 ; turn levelling on M501 ; reload your last-saved bed levelling from EEPROM </pre> <p>This assumes you saved the results from your auto-levelling with <code>M500</code>:</p> <pre><code>G29 ; Automatic Bed Levelling M500 ; save the bed levelling data to EEPROM </code></pre>
1,544
<p>I've started to work a bit with master pages for an ASP.net mvc site and I've come across a question. When I link in a stylesheet on the master page it seems to update the path to the sheet correctly. That is in the code I have</p> <pre><code>&lt;link href="../../Content/Site.css" rel="stylesheet" type="text/css" /&gt; </code></pre> <p>but looking at the source once the page is fed to a browser I get</p> <pre><code>&lt;link href="Content/Site.css" rel="stylesheet" type="text/css" /&gt; </code></pre> <p>which is perfect. However the same path translation doesn't seem to work for script files. </p> <pre><code>&lt;script src="../../Content/menu.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>just comes out as the same thing. It still seems to work on a top level page but I suspect that is just the browser/web server correcting my error. Is there a way to get the src path to be globbed too? </p>
<pre><code>&lt;script src="&lt;%= ResolveClientUrl("~/Content/menu.js") %&gt;" type="text/javascript"&gt;&lt;/script&gt; </code></pre>
<p>Use this instead:</p> <pre><code>&lt;link href="~/Content/Site.css" rel="stylesheet" type="text/css" /&gt; </code></pre>
9,011
<p>I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just OK, but never great.</p> <p>Just to get the ball rolling, here is a review of things I've seen.</p> <p>This example is SVN-based, but applies to most VCS's (not so much to distributed version control).</p> <ol> <li><p>branch the individual projects that are part of site /division/web/projectName/vb/src/[trunk|branches|tags]</p></li> <li><p>branch the whole site, in the case I've seen, the whole site except for core components was branched. /division/[trunk|branches|tags]/web/projectName/vb/src/</p></li> <li><p>Use main-line a default, only branch when necessary for <strong>huge</strong> changes.</p></li> </ol>
<p>Example for SVN: </p> <p>trunk/</p> <p>branch/</p> <p>tags/</p> <p>The trunk should be kept at a point where you can always push a release from it. There should be no huge gaping bugs that you know about(of course there will be eventually but that is what you should strive for). </p> <p>Every time you need to make a new feature, do a design change, whatever, branch. Tag that branch at the start. Then when you are finished with the branch tag it at the end. This helps out with merging back into trunk. </p> <p>Every time you need to push a release, tag. This way if something goes horribly wrong you can rollback to the previous release. </p> <p>This setup keeps trunk as clean as possible and allows you to make quick bug fixes and push them out while keeping the majority of your development in branches. </p> <p><strong>Edit:</strong> For 3rd party stuff it depends. If I can avoid it I do not have it under source control. I keep it in a directory outside source control and include it from there. For things like jquery, I do leave it under source control. The reason is it simplifies my script for pushing. I can simply have it do an svn export and rsync. </p>
<p>We migrated from the bad world of VSS with one giant repository (over 4G) before switching to SVN. I really struggled with how to set up the new repository for our company. Our company is very "old" school. It's difficult to get change I'm one of the younger developers and I'm 45! I am part of a corporate development team that works on programs for a number of departments in our company. Anyway I set up our directories like this</p> <pre><code>+ devroot +--Dept1 +--Dept1Proj1 +--Dept2Proj2 +--Dept2 +--Dept2Proj1 +--Tools +--Purchase3rdPartyTools +--NLog +--CustomBuiltLibrary </code></pre> <p>I wanted to include the ability to branch, but quite honestly that's just too much at this point. Couple things we still struggle with using this scheme.</p> <ul> <li>It's hard to fix production problems if you are working on a major product upgrade (ie because we don't do branching)</li> <li>It's hard to manage the concept of promoting from "Dev" to "Prod". (Don't even ask about promoting to QA)</li> </ul>
3,752
<p>Can I Print models from Sources like <a href="https://www.thingiverse.com/" rel="noreferrer">Thingiverse</a> and sell them ? I will be only charging the print costs and will provide full credits and attributes to the original creator of the model (with links to their profiles) in my web-page.</p> <p>There are websites like <a href="https://www.3dhubs.com/" rel="noreferrer">3dhubs</a> where the seller will print any file the user uploads. Similarly I want to charge only for the printing services. </p>
<p>I've informed myself a bit about this and found out the following:</p> <p><strong>It is good that you state the Name/Website or any Reference about original creator</strong> Creative Commons absolutely requires this, even if you don't charge anything for your prints. So, whether you are trying selling your print or not, you should still always do this.</p> <p><strong>You are not allowed to sell your prints</strong> Creative Commons License dictates that you are not allowed to commercialize products that are based on any of their sources. This means, even if you are only charging the printing costs, you are not allowed to sell them, as you are profiting of their sources because you did not design the prints yourself.</p> <p>For further information on this, you should probably check out the official page for this, <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow noreferrer">https://creativecommons.org/licenses/by-nc-sa/3.0/</a></p> <p>I hope this helps, Max</p>
<p>According to <a href="https://www.publicknowledge.org/files/What%27s%20the%20Deal%20with%20Copyright_%20Final%20version2.pdf" rel="nofollow noreferrer">Weinberg, 2013</a>, artistic works are copyrightable: if you're printing an action figure or such a useless pretty piece of art, it's protected by copyright.</p> <p>For utilitarian things, the copyrightable portion must be severable: if you're printing a video game controller with an artistic design drawn upon its case—not an artistic shape, but a design that could be lifted from the surface and applied as a separate artistic display—then that design is protected, and the controller that happens to be an aesthetically-pleasing shape is not (i.e. you could wipe away the design details and have the blunt shape of the thing and that would not be protected).</p> <p>Purely-utilitarian things are not copyrightable. If you're printing a lamp or a cup holder or whatnot, there are no rights to extend over that.</p> <p>This is important: copyright allows you to make decisions about what rights you will extend. If you don't have the right to copyright, you can't simply slap a license on something and assert you do in fact have that right. CC-NC licensing prevents you from making a derivative or a collection <em>and selling it</em>, but there is no right to the printed object upon which to extend to the user the right to sell the printed object. That means, conversely, that there is no right to the printed object to prohibit the user from selling it.</p> <p>That actually creates some odd situations, e.g. CC-BY doesn't apply, either. You can't strip the author's name off the file and pass it off as your own, but you don't have to credit them for the physical object. It is, however, potentially asinine to do that. Even that can be a judgment call: it's likely socially-acceptable to print e.g. an ABS gear for a particular machine that strips its ABS gears and sell a repair kit without crediting whoever posted it on Thingaverse; but if somebody made a more unique object, such as a fancy planter for house plants, it might not be copyrightable as an <em>object</em>, but it's certainly not a copy of a gear that goes into a machine and is instead a <em>unique</em> creation of the user who created it.</p>
1,150
<p>Caveat: I'm relatively new to coding as well as <a href="http://macromates.com/" rel="nofollow noreferrer">TextMate</a>, so apologies if there is an obvious answer I'm missing here.</p> <p>I do a lot of HTML/CSS markup, there are certain patterns that I use a lot, for example, forms, navigation menus etc. What I would like is a way to store those patterns and insert them quickly when I need them. </p> <p>Is there a way to do this using TextMate?</p>
<p>You can do this very easily in TextMate using <a href="http://manual.macromates.com/en/snippets" rel="nofollow noreferrer">Snippets</a>. Just add a new snippet in the bundle editor, and set up how you want to trigger it. You can set a key shortcut, or have it pop up when you hit <code>Tab</code> after a certain word/pattern.</p> <p>There are many things you can do with them—in your case, it would probably be very useful to set so-called &quot;placeholders&quot; in your snippets, which are the parts that change every time (e.g. the names of the fields in the form). Then, as soon as you insert the snippet, you can hit <code>Tab</code> to move between these.</p>
<p>As mentioned prior snippets are what you are looking for.</p> <p>For reference look here: <a href="http://manual.macromates.com/en/snippets" rel="nofollow noreferrer">http://manual.macromates.com/en/snippets</a><br> <a href="http://screenflicker.com/mike/code/div-snippets/" rel="nofollow noreferrer">http://screenflicker.com/mike/code/div-snippets/</a></p>
6,557
<p>I've used TinkerCAD (<a href="https://www.tinkercad.com/" rel="nofollow noreferrer">https://www.tinkercad.com/</a>) and was able to easily model objects for 3D printing, despite having no prior experience in 3D modeling. However it needs to be connected to the internet to work, which is not always available at my location. At minimum, I need an ability to create solid shapes and holes, and with resize, align and rotate options.</p> <p>Is there an equivalent program that's free, with a similar intuitive interface as TinkerCAD, and works completely offline?</p>
<p>I have used a standard soldering iron to modify and fix 3D prints in the past. You have to keep some things in mind when doing so:</p> <ul> <li>Don't overheat your material. PLA can take a soldering iron of about 230 °C before charring.</li> <li>Don't use a tip with solder, or you will get grey deposits in the plastic.</li> <li>Round tips or flat tips both work fine, but you want to not dump <em>too</em> much heat into the model or you start to deform the print as it needs to cool again.</li> <li>Using snippets from the end of the spool for soldering is a good way to recycle the &quot;waste&quot;.</li> </ul>
<p>Cutting materials with a 'hot knife' isn't anything new. There should be a fairly established toolset for working foam. For 3D prints, I prefer to add coatings rather than modify surfaces with a hand held tool after. I do run a drill bit through printed holes though.</p>
1,912
<p>We have hundreds of websites which were developed in asp, .net and java and we are paying lot of money for an external agency to do a penetration testing for our sites to check for security loopholes. Are there any (good) software (paid or free) to do this? </p> <p>or.. are there any technical articles which can help me develop this tool?</p>
<p>There are a couple different directions you can go with automated testing tools for web applications.</p> <p>First, there are the <strong>commercial web scanners</strong>, of which HP WebInspect and Rational AppScan are the two most popular. These are "all-in-one", "fire-and-forget" tools that you download and install on an internal Windows desktop and then give a URL to spider your site, scan for well-known vulnerabilities (ie, the things that have hit Bugtraq), and probe for cross-site scripting and SQL injection vulnerabilities. </p> <p>Second, there are the <strong>source-code scanning tools</strong>, of which Coverity and Fortify are probably the two best known. These are tools you install on a developer's desktop to process your Java or C# source code and look for well-known patterns of insecure code, like poor input validation. </p> <p>Finally, there are the <strong>penetration test tools</strong>. By far the most popular web app penetration testing tool among security professionals is Burp Suite, which you can find at <a href="http://www.portswigger.net/proxy" rel="noreferrer">http://www.portswigger.net/proxy</a>. Others include Spike Proxy and OWASP WebScarab. Again, you'll install this on an internal Windows desktop. It will run as an HTTP proxy, and you'll point your browser at it. You'll use your applications as a normal user would, while it records your actions. You can then go back to each individual page or HTTP action and probe it for security problems.</p> <p>In a complex environment, and especially if you're considering anything DIY, <strong>I strongly recommend the penetration testing tools</strong>. Here's why:</p> <p>Commercial web scanners provide a lot of "breadth", along with excellent reporting. However:</p> <ul> <li><p>They tend to miss things, because every application is different.</p></li> <li><p>They're expensive (WebInspect starts in the 10's of thousands).</p></li> <li><p>You're paying for stuff you don't need (like databases of known bad CGIs from the '90s).</p></li> <li><p>They're hard to customize.</p></li> <li><p>They can produce noisy results.</p></li> </ul> <p>Source code scanners are more thorough than web scanners. However:</p> <ul> <li><p>They're even more expensive than the web scanners.</p></li> <li><p>They require source code to operate.</p></li> <li><p>To be effective, they often require you to annotate your source code (for instance, to pick out input pathways).</p></li> <li><p>They have a tendency to produce false positives.</p></li> </ul> <p>Both commercial scanners and source code scanners have a bad habit of becoming shelfware. Worse, even if they work, their cost is comparable to getting 1 or 2 entire applications audited by a consultancy; if you trust your consultants, you're guaranteed to get better results from them than from the tools. </p> <p>Penetration testing tools have downsides too:</p> <ul> <li><p>They're much harder to use than fire-and-forget commercial scanners.</p></li> <li><p>They assume some expertise in web application vulnerabilities --- you have to know what you're looking for.</p></li> <li><p>They produce little or no formal reporting.</p></li> </ul> <p>On the other hand:</p> <ul> <li><p>They're much, much cheaper --- the best of the lot, Burp Suite, costs only 99EU, and has a free version.</p></li> <li><p>They're easy to customize and add to a testing workflow.</p></li> <li><p>They're much better at helping you "get to know" your applications from the inside.</p></li> </ul> <p>Here's something you'd do with a pen-test tool for a basic web application:</p> <ol> <li><p>Log into the application through the proxy</p></li> <li><p>Create a "hit list" of the major functional areas of the application, and exercise each once.</p></li> <li><p>Use the "spider" tool in your pen-test application to find all the pages and actions and handlers in the application.</p></li> <li><p>For each dynamic page and each HTML form the spider uncovers, use the "fuzzer" tool (Burp calls it an "intruder") to exercise every parameter with invalid inputs. Most fuzzers come with basic test strings that include:</p> <ul> <li><p>SQL metacharacters</p></li> <li><p>HTML/Javascript escapes and metacharacters</p></li> <li><p>Internationalized variants of these to evade input filters</p></li> <li><p>Well-known default form field names and values</p></li> <li><p>Well-known directory names, file names, and handler verbs</p></li> </ul></li> <li><p>Spend several hours filtering the resulting errors (a typical fuzz run for one form might generate 1000 of them) looking for suspicious responses.</p></li> </ol> <p>This is a labor-intensive, "bare-metal" approach. But when your company owns the actual applications, the bare-metal approach pays off, because you can use it to build regression test suites that will run like clockwork at each dev cycle for each app. This is a win for a bunch of reasons:</p> <ul> <li><p>Your security testing will take a predictable amount of time and resources per application, which allows you to budget and triage.</p></li> <li><p>Your team will get maximally accurate and thorough results, since your testing is going to be tuned to your applications.</p></li> <li><p>It's going to cost less than commercial scanners and less than consultants.</p></li> </ul> <p>Of course, if you go this route, you're basically turning yourself into a security consultant for your company. I don't think that's a bad thing; if you don't want that expertise, WebInspect or Fortify isn't going to help you much anyways. </p>
<p><a href="https://www.mcafeesecure.com/" rel="nofollow noreferrer">formerly hackersafe McAfee Secure.</a></p>
9,776
<p>Sometimes supports are very difficult to remove (physically) when I print with ABS. The image below, from <a href="https://www.thingiverse.com/thing:1613957" rel="nofollow noreferrer">Thingiverse - MOF-5 unit cell</a>, is after significant effort to remove the yellow ABS supports from a black ABS model.</p> <p><a href="https://i.stack.imgur.com/3Ze3e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Ze3e.png" alt="Yellow ABS supports removed from black ABS model"></a></p> <p>I've learned about polyvinylalcohol (PVA) as a 3D-printing filament which is soluble in water. It seems like a great option for dual-extruder printers, where you can print the model with ABS or PLA and the supports with PVA, then throw the whole thing in water and let the supports dissolve.</p> <p>I've considered other options since PVA is ~4x more expensive than ABS.</p> <p>Doing a PLA print with ABS supports, followed by dissolution of ABS with acetone, is my best idea currently.</p> <p>Has anyone found success with another option? </p>
<p>I've had great success printing with HIPS (high-impact polystyrene) as a support for both PLA and ABS. Most sites recommend it for use with ABS because the materials melt at similar temperatures and work best with heated beds, but I've had good luck using it as a support material with PLA on a bed at 60°C. It doesn't stick as well to PLA as it does to ABS, so supports tend to peel away very readily. The downside is that, if you need the support to anchor your print at all, it doesn’t really stick well enough to accomplish this task. For that, you must pair HIPS with ABS. </p> <p>When you print with ABS or have complicated interwoven support structures, HIPS can be dissolved with D-limonene, a citrus based cleaner sold under various names like Citrisolv (others exist), or with dipentene (a mixture of L and D-limonene that doesn't smell as pleasant). </p> <p>Regarding cost: I've found HIPS to be slightly more expensive than PLA/ABS, but only 1.5x the cost, not 4x like PVA. Additionally, it isn't hydroscopic in the same way as PVA so it lasts longer out of the package. Since you're using it as support, you also tend to use far less filament than you do for the main print (sparse support structures as opposed to solid print structures). </p> <p>Water-soluble alternatives: There are a few proprietary blends of polymers sold by the big commercial printer manufacturers (3DSystems, Stratasys) that only work in their machines… these are generally soluble in basic solutions (water + sodium hydroxide or sodium carbonate). These are usually very expensive and you'd have to rewind the filament on a spool, as they come in cartridges made for specific printers. You'd also have to experiment with the right build conditions and solution blends to remove the material afterward. Airwolf has a support material called <a href="https://airwolf3d.com/shop/water-soluble-support-3d-print/" rel="nofollow noreferrer">Hydrofill</a> that purports to be soluble in plain water… I'm not sure how this is different from standard PVA, though I assume it <em>is</em> different. Hopefully more companies will work on developing water-soluble options to help us keep the 3D printing world full of renewable, less-environmentally-harmful options for filaments (both print and support). </p> <h2>Update:</h2> <p>Ultimaker now has a material called <a href="https://ultimaker.com/en/products/materials/breakaway" rel="nofollow noreferrer">Ultimaker Breakaway</a>. After using it for a few models, it works remarkably well, allowing me, for the first time, to print <strong>nice</strong> rounded surfaces on the bases of my prints. It really does just break away from the surface, much like HIPS but without the lack of adhesion problems between HIPS and PLA. </p>
<p>While I haven't used PVA yet, think of it this way, it may be 4x the cost but you use significantly less material for support structures even if you have a lot of support.</p>
606
<p>I have designed a cupholder for my center console in my truck with PETG. I was hoping it wouldn't deform and it didn't for a while but we got some high temperatures the past few days (around 32-38 °C or 90-100 °F).</p> <p>Kind of figured it wouldn't hold up mid-summer but I was wondering if ABS would be my next best choice or if there is something better for this. It does see some sunlight but not a lot.</p> <p>I do want to start producing some to sell and don't want it deforming in high-temperature areas. Also, I have an Ender 3 Pro so I can't do super crazy filaments.</p>
<p>ABS, or preferably ASA which is &quot;a better ABS&quot;, is probably your main option. ASA holds up better under UV/sunlight and is easier to print (less warping). Like ABS it should be printed with ventilation, and benefits some from an enclosure but can be done without it or with a primitive one (cardboard box).</p> <p>Another great option would be TPU. It's not subject to a glass transition temperature above room temperature (my understanding is that technically its <span class="math-container">$T_g$</span> is very very cold, but that may be a misunderstanding) and does not really warp/deform permanently until you reach temperatures near what you could print it at. I've used it as a mold for melting crayons in an oven at 175 ˚F (80 ˚C) with no problem. Depending on your perspective it could be easier or harder than ABS to print. If your extruder is bad at handling flex materials you might have to go really slow, or you might have trouble with jamming on retraction, but unlike ABS it has no heat/warping issues while printing and can be done even on a cold bed, and does not particularly need ventilation (although as always, be careful if you have pet birds around).</p> <p>Note that while TPU is considered a &quot;flex&quot; material, it can be fairly rigid at high infill with rigid infill patterns like triangles or cubic, or printed 100% solid, especially if you go with harder variants. 95A is typically the highest you see but sometimes you can find 98A.</p>
<p>Personally, I'd get the design <em>just right</em> and then I'd use the &quot;Get an Instant Quote&quot; option on the &quot;Solutions&quot; menu at shapeways.com . It'll be expensive, but you could have it printed in sintered powdered stainless steel or aluminum. You'll want to design as many voids into it as you can, because they charge by the gram. There are cheaper vendors and you may have one locally, especially if you tell them &quot;totally not a rush job&quot; and they can run it with other parts.</p>
1,993
<p>We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools.</p> <p>Obviously, this is a big security nightmare waiting to happen.</p> <p>Unfortunately, we've not yet found any classes in the .NET Framework that execute command line programs while providing the same kind of guards against injection attacks as the IDbCommand objects do for databases.</p> <p>Right now, we're using a very primitive string substitution which I suspect is rather insufficient:</p> <blockquote> <pre><code>protected virtual string Escape(string value) { return value .Replace(@"\", @"\\") .Replace(@"$", @"\$") .Replace(@"""", @"\""") .Replace("`", "'") ; } </code></pre> </blockquote> <p>What do you guys do to prevent command-line injection attacks? We're planning to implement a regex that is very strict and only allows a very small subset of characters through, but I was wondering if there was a better way.</p> <p>Some clarifications:</p> <ul> <li>Some of these tools do not have APIs we can program against. If they did, we wouldn't be having this problem.</li> <li>The users don't pick tools to execute, they enter meta-data which the tools we've chosen use (for example, injecting meta data such as copyright notices into target files). </li> </ul>
<p>Are you executing the programs directly or going through the shell? If you always launch an external program by giving the full path name to the executable and leaving the shell out of the equation, then you aren't really susceptible to any kind of command line injection.</p> <p>EDIT: DrFloyd, the shell is responsible for evaluating things like the backtick. No shell, no shell evaluation. Obviously, you've still got to be aware of any potential security gotchas in the programs that you're calling -- but I don't think this question is about that.</p>
<p>Well, if you can invoke the tools programmatically without the command line, that would probably be your best option. Otherwise, you could potentially execute the command line tool via a user that has absolutely no access to do anything (except perhaps a single directory that they can't do any harm with)... though that may end up breaking the tool, depending on what the tool does.</p> <p>Just note, I have never had to face this problem, because I have never actually had to invoke a command line tool from an externally facing application where the tool requires input from the user.</p>
6,658
<p>One simple method I've used in the past is basically just creating a second table whose structure mirrors the one I want to audit, and then create an update/delete trigger on the main table. Before a record is updated/deleted, the current state is saved to the audit table via the trigger.</p> <p>While effective, the data in the audit table is not the most useful or simple to report off of. I'm wondering if anyone has a better method for auditing data changes?</p> <p>There shouldn't be too many updates of these records, but it is highly sensitive information, so it is important to the customer that all changes are audited and easily reported on.</p>
<p>How much writing vs. reading of this table(s) do you expect?</p> <p>I've used a single audit table, with columns for Table, Column, OldValue, NewValue, User, and ChangeDateTime - generic enough to work with any other changes in the DB, and while a LOT of data got written to that table, reports on that data were sparse enough that they could be run at low-use periods of the day.</p> <p><strong>Added:</strong> If the amount of data vs. reporting is a concern, the audit table could be replicated to a read-only database server, allowing you to run reports whenever necessary without bogging down the master server from doing their work.</p>
<p>Are there any built-in audit packages? Oracle has a nice package, which will even send audit changes off to a separate server outside the access of any bad guy who is modifying the SQL.</p> <p>Their example is awesome... it shows how to alert on anybody modifying the audit tables.</p>
2,587
<p>What is the fastest, easiest tool or method to convert text files between character sets?</p> <p>Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.</p> <p>Everything goes: one-liners in your favorite scripting language, command-line tools or other utilities for OS, web sites, etc.</p> <h2>Best solutions so far:</h2> <p>On Linux/UNIX/OS X/cygwin:</p> <ul> <li><p>Gnu <a href="http://www.gnu.org/software/libiconv/documentation/libiconv/iconv.1.html" rel="noreferrer">iconv</a> suggested by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64889">Troels Arvin</a> is best used <strong>as a filter</strong>. It seems to be universally available. Example:</p> <pre><code> $ iconv -f UTF-8 -t ISO-8859-15 in.txt &gt; out.txt </code></pre> <p>As pointed out by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64991">Ben</a>, there is an <a href="http://www.iconv.com/iconv.htm" rel="noreferrer">online converter using iconv</a>.</p> </li> <li><p><a href="https://github.com/rrthomas/recode/" rel="noreferrer">recode</a> (<a href="http://www.informatik.uni-hamburg.de/RZ/software/gnu/utilities/recode_toc.html" rel="noreferrer">manual</a>) suggested by <a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64888">Cheekysoft</a> will convert <strong>one or several files in-place</strong>. Example:</p> <pre><code> $ recode UTF8..ISO-8859-15 in.txt </code></pre> <p>This one uses shorter aliases:</p> <pre><code> $ recode utf8..l9 in.txt </code></pre> <p>Recode also supports <em>surfaces</em> which can be used to convert between different line ending types and encodings:</p> <p>Convert newlines from LF (Unix) to CR-LF (DOS):</p> <pre><code> $ recode ../CR-LF in.txt </code></pre> <p>Base64 encode file:</p> <pre><code> $ recode ../Base64 in.txt </code></pre> <p>You can also combine them.</p> <p>Convert a Base64 encoded UTF8 file with Unix line endings to Base64 encoded Latin 1 file with Dos line endings:</p> <pre><code> $ recode utf8/Base64..l1/CR-LF/Base64 file.txt </code></pre> </li> </ul> <p>On Windows with <a href="https://learn.microsoft.com/en-us/powershell/" rel="noreferrer">Powershell</a> (<a href="https://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets#64937">Jay Bazuzi</a>):</p> <ul> <li><code>PS C:\&gt; gc -en utf8 in.txt | Out-File -en ascii out.txt</code></li> </ul> <p>(No ISO-8859-15 support though; it says that supported charsets are unicode, utf7, utf8, utf32, ascii, bigendianunicode, default, and oem.)</p> <h2>Edit</h2> <p>Do you mean iso-8859-1 support? Using &quot;String&quot; does this e.g. for vice versa</p> <pre><code>gc -en string in.txt | Out-File -en utf8 out.txt </code></pre> <p>Note: The possible enumeration values are &quot;Unknown, String, Unicode, Byte, BigEndianUnicode, UTF8, UTF7, Ascii&quot;.</p> <ul> <li>CsCvt - <a href="http://www.cscvt.de" rel="noreferrer">Kalytta's Character Set Converter</a> is another great command line based conversion tool for Windows.</li> </ul>
<p><a href="http://linux.die.net/man/1/iconv" rel="noreferrer">Stand-alone utility</a> approach</p> <pre class="lang-none prettyprint-override"><code>iconv -f ISO-8859-1 -t UTF-8 in.txt &gt; out.txt </code></pre> <pre class="lang-none prettyprint-override"><code>-f ENCODING the encoding of the input -t ENCODING the encoding of the output </code></pre> <p>You don't have to specify either of these arguments. They will default to your current locale, which is usually UTF-8.</p>
<p>As described on <a href="https://stackoverflow.com/questions/132318/how-do-i-correct-the-character-encoding-of-a-file">How do I correct the character encoding of a file?</a> <a href="http://www.synalysis.net" rel="nofollow noreferrer">Synalyze It!</a> lets you easily convert on OS X between all encodings supported by the <a href="http://icu-project.org" rel="nofollow noreferrer">ICU library</a>.</p> <p>Additionally you can display some bytes of a file translated to Unicode from all the encodings to see quickly which is the right one for your file.</p>
9,052
<p>Does anyone have a definitive answer to whether <a href="http://msdn.microsoft.com/en-us/library/ms162557.aspx" rel="nofollow noreferrer">Sql Server Management Objects</a> is compatible with Sql Server 7.0? The docs state:</p> <blockquote> <p>Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment.</p> </blockquote> <p>But trying to connect to a Sql 7 instance gets me:</p> <blockquote> <p>"This SQL Server version (7.0) is not supported."</p> </blockquote> <p>Has anyone been successful in getting these 2 to play nice?</p>
<p><em>you can use SMO to connect to SQL Server versions 7, 2000, and 2005, but SMO does not support databases set to compatibility levels 60, 65, and 70.</em></p> <p>for SQL Server 7.0 the compatibility level is 70</p> <p>Obviously this is conflicting information...I assume if your compatibility level of your DB is 70 you can not connect.</p> <p>To check run: EXEC sp_dbcmptlevel '<em>databasename</em>'</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa259649.aspx" rel="nofollow noreferrer">Looking through this link</a>, it seems you might be able to change the compatibility level by running this:</p> <p>EXEC sp_dbcmptlevel '<em>databasename</em>', 80</p> <p>Obviously make a back up before changing anything.</p>
<p>Sorry for the late answer... there is <a href="http://msdn.microsoft.com/en-us/library/ms162130(SQL.90).aspx" rel="nofollow noreferrer">partial support</a> for SQL 2000 and SQL 7</p>
5,349