instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>The print is a collapsible sword I'm using as a test. Everything seems fine on the outside, but inside it seems the segment parts of the sword inside the hilt are fusing together at the seam lines causing them to stick together.</p> <p><strong>Model</strong>: <a href="https://thangs.com/designer/3dprintingworld/3d-m...
<p>After some trial and error I found that the issue was stringing due to excess moisture in the filament from being stored outside of a sealed low-humidity container for long periods.</p> <p>After placing it in a heated dehydrator for 2 days, my next print had low stringing and did not bond interlaced parts together s...
<p>You did well to decrease the temperature. You could go even lower to 200°C As you noticed, You really have a little bit of stringing between the elements. That's what binds the parts together. Many times when you print only a single part this will be no problem. With many nested parts, you retraction really has to b...
2,178
<p>I have created a database model in Visio Professional (2003). I know that the Enterprise version has the ability to create a DB in SQL Server based on the data in Visio. I do not have the option to install Enterprise. Aside from going through the entire thing one table and relationship at a time and creating the who...
<p>I have not done this, but here it goes.</p> <ol> <li>Convert Visio file to Visio XML format.</li> <li>Use <a href="http://dia-installer.de/index_en.html" rel="nofollow noreferrer">Dia for Windows</a> and <a href="http://www.redferni.uklinux.net/dia/vdx/" rel="nofollow noreferrer">Dia VDX plug-in</a> to convert Visi...
<p>If you can somehow obtain the type library from the enterprise version you can use VBA to get out the definitions. Secondhand enterprise architect versions of VS 2002 and VS 2003 can be brought from ebay for a few hundred dollars.</p>
5,847
<p>I added a custom install action to my installer to add one of my installation directories to the System PATH environment variable. After I run the installer, the PATH variable reflects the changes (when I access it through the Control Panel::System applet), but when I start a new command shell, the PATH variable doe...
<p>I think this depends on how you are starting the new Command shell. For example, when you change the PATH environment variable under System properties, the change isn't reflected until you open a new Command prompt. I think when you launch a new "cmd" process (from the Run dialog for example), you get a fresh copy o...
<p>How are you adding the environment variable?</p> <p>Without using any external tools, you can <a href="http://www.windowsnetworking.com/kbase/WindowsTips/WindowsNT/AdminTips/Miscellaneous/SetEnvManipulateNTEnvironmentalVariables.html" rel="nofollow noreferrer">add it to the registry</a>. Then, your test of opening...
6,152
<p>What are some of the ways? What frameworks can you use?</p>
<p>Here's a project which does this: <a href="http://tsqlunit.sourceforge.net/" rel="nofollow noreferrer">http://tsqlunit.sourceforge.net/</a></p> <p>Also, Visual Studio Team System for DBA has built-in support for unit testing of Databases.</p>
<p><a href="http://tst.codeplex.com/" rel="nofollow noreferrer">T.S.T. the T-SQL Test Tool</a></p> <blockquote> <p>TST is a tool that simplifies the task of writing and running test automation for code written in T-SQL. At the heart of the TST tool is the TST database. This database contains a series of st...
7,702
<p>I'm in the process of building a 3D printer and have all the stepper motors wired up and the controller connected to the computer running pronterface.</p> <p>I can move each axis and also send g-code to the printer.</p> <p>Now <strong>how can I define the current position to be the 0/0/0 position?</strong> I'd lik...
<blockquote> <p>G92 X0 Y0 Z0</p> </blockquote> <p>tells the printer that the current position is (0,0,0).</p>
<p>There's a handy list of G0-codes at <a href="http://reprap.org/wiki/G-code" rel="nofollow">http://reprap.org/wiki/G-code</a> -- though the list is too big to be convenient for finding a code if you're not already sure what it's called... :(</p>
158
<p>I would like to write small console based applications on Windows Mobile. What console applications might I use?</p>
<p>it may be useful to know that when you use printf from a standard windows mobile application, the output will end up in the kernel log of the device.</p> <p>This has several drawbacks: * Access to the kernellog is manufacturer+device dependent. * The length of the string you can print is limited to 255 characters...
<p>There is no command prompt style console on Windows Mobile. If you're really after a command prompt, check out www.pocketdos.com for a high level of dos application compatibility. If you're more interested in writing small applications for Windows Mobile, C# or VB.Net are your best choices. On small mobile devices ...
9,962
<p>I am trying out FirePHP.</p> <p>I installed it and restarted Firefox, enabled Firebug for my localhost, moved the demo <code>oo.php</code> file that comes with the download into an IIS virtual directory, changed the include path, removed the <code>apache_request_headers()</code> call since I am running IIS, and the...
<p>I believe FirePHP required you install a Firefox extension (in addition to Firebug) that watches for the HTTP headers and puts them in the console. </p> <p>If that isn't the problem then I'd recommend grabbing a copy of <a href="http://www.charlesproxy.com/" rel="noreferrer">Charles</a>. It will let you view the he...
<p>I had the same issue and it turned out that the 'Net' tab of firebug wasn't enabled caused firephp to not show anything in the console. Enabled Net tab and voila!</p>
9,437
<p>So I'm embarking on an <code>ASP.NET MVC</code> project and while the experience has been a good one overall, I'm not quite as pleased with the spaghetti mess that my controllers have become. I've looked around online (CodeCampServer, etc...) and they all seem to suffer the same issue wherein controller methods viol...
<p>ASP.NET Preview 5 (available on <a href="http://www.codeplex.com/aspnet" rel="noreferrer">CodePlex</a>) has an answer for this: the [AcceptVerbs] attribute. Phil Haack has a <a href="http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx" rel="noreferrer">blog post</a> discussion how it's used.</p...
<p>How are different people handling this issue? I know that i just spent a couple hours reviewing the jumble inside of the model folder. I'm finding creating folders is helpful in reducing the visual clutter, using matching namespaces helps alot too.</p> <p>But my controllers are monoliths at the moment. the troub...
5,689
<p>I'd like to customize and modify some parts on Thingiverse, beyond just simple scaling for 3D printing.</p> <p>I've been looking for some tools that convert the STL files into something that is easily edited, but so far all that I've found are really buggy and crash frequently as soon as one loads a reasonably comp...
<p>If you want to do basic edits to an STL, a program such as <a href="http://www.meshmixer.com/" rel="noreferrer">MeshMixer</a> might be right for your. It offers the ability to combine and subtract models, add custom supports, and similar, in a fairly straight forward manner.</p> <p>An alternative that allows your t...
<p>If you want a WYSIWYG-style editor and are not content with OpenSCAD, I found 123D Design (Autodesk, definitively not FOSS but free for hobbyists) to have (on a Mac) a compromise between power and ease of use that most appealed to me.</p> <p>If you insist on FOSS probably Blender comes closest, but I found it to be...
177
<p>Why can I not see an <strong>option</strong> for copying database objects when I <code>right click &gt; tasks</code> on my database? </p>
<p>MS Sql Server Express doesn't come with SSIS which is what you will need to import/export objects out of your database.</p> <p>You can also manually script this process. One way is to use BCP (<a href="http://msdn.microsoft.com/en-us/library/ms162802.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/l...
<p>Have a look at Red Gate <a href="http://www.red-gate.com/products/SQL_Compare/index.htm" rel="nofollow noreferrer">SQL Compare</a> and <a href="http://www.red-gate.com/products/SQL_Data_Compare/index.htm" rel="nofollow noreferrer">SQL Data Compare</a>.</p> <p>You can download the trial and use them to build a scrip...
9,668
<p>I'm trying out the following query:</p> <pre><code>SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ORDER BY B ASC LIMIT 5 </code></pre> <p>That's three queries stuck together, kinda sorta. ...
<p>Maybe you should try including a fourth column, stating the table it came from, and then order and group by it:</p> <pre><code>SELECT A,B,C, "query 1" as origin FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C, "query 2" as origin FROM table WHERE field LIKE '%query' UNION SELECT A,B,C, "query 3" as origin F...
<p>If there isn't a sort that makes sense to order them you desire, don't union the results together - just return 3 separate recordsets, and deal with them accordingly in your data tier.</p>
2,588
<p>Using TortoiseSVN against VisualSVN I delete a source file that I should not have deleted. Now this isn't a train smash because I can get the file back from the daily backup. However I would like to undelete it from SVN (VisualSVN) so that I can get the history back. However I can't work out how to do that.</p> <p>...
<p>What you have to do is the following:</p> <ol> <li>Right click on the folder where you think it is.</li> <li>Choose Show Log under TortioseSVN</li> <li>Find the checkin that the file was deleted in</li> <li>Go down the list and find the file</li> <li>Select Revert changes for this version to undelete.</li> </ol>
<p>Did you only delete it locally, or did you commit the deletion? In the latter case, try checking out the previous revision.</p>
3,477
<p>For a school project, my teacher gave me a brand new Longer 3D printer to create parts with. After one good job, the printer cannot get past the raft creation without air printing. The thickness of the printed filament tapers down until no filament is coming out. I do not believe there is a jam in the hot end becaus...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
1,871
<p>I have a Java application which I want to shutdown 'nicely' when the user selects Start->Shutdown. I've tried using JVM shutdown listeners via Runtime.addShutdownHook(...) but this doesn't work as I can't use any UI elements from it.</p> <p>I've also tried using the exit handler on my main application UI window but...
<p>You can make shortcut to:</p> <pre><code>msiexec /uninstall [path to msi or product code] </code></pre>
<p>Visual Studio 2013 allows you to create an Uninstall shortcut in the shortcut design page if you use the Installshield Add-on.</p>
8,695
<p>How many rows should be in the (main) buffer of a virtual Listview control?</p> <p>I am witting an application in pure 'c' to the Win32 API. There is an ODBC connection to a database which will retrieve the items (actually rows). </p> <p>The MSDN sample code implies a fixed size buffer of 30 for the end cache (W...
<p>Use the ListView_ApproximateViewRect (or the LVM_APPROXIMATEVIEWRECT message) to get the view rect height.</p> <p>Use the ListView_GetItemRect (or the LVM_GETITEMRECT message) to get the height of an item.</p> <p>Divide the view rect height by the height of an item to get the number of items that can fit in your v...
<p>@Brian R. Bondy Thanks for the explicit help for how to do get the number of items. In fact I was all ready working my way to understanding that it could be done (for list or report view) with ListView_GetCountPerPage, and I would use you way to get it for for the others, though I don't need the ListView_Approxima...
6,940
<p>I have a Prusa i3 that homes properly when you use the menu. After adjusting the bed and homing several times, it keeps the head at a reliable distance. However, when I try to print from an SD card, the printer buries the hot end in the heat bed.</p> <p>What needs to be adjusted to fix this issue?</p> <p>G-code from...
<p>The correlation between the endstop switch -- or sensor -- and the surface of the bed is not known <em>a priori</em> . In your case, there are two possibilities. I'd say the more likely is that your g-code generator is not setting the Z-height offset from the bed correctly. The other is that your bed is tilted,...
<p>I had the same issue: Z-axis correctly homing manually but not when printing.</p> <p>What worked for me is disabling the following line in the Marlin configuration file:</p> <pre><code>#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN </code></pre>
523
<p>Why don't 3D printer heads use ceramic inner walls? PTFE tubes melt with high enough temperatures and all metal ends risk jamming as heat makes its way up the head.</p>
<p>It <em>can</em> be done cheaply, as two different users have proven, see </p> <ul> <li><a href="https://reprap.org/forum/read.php?1,538786" rel="nofollow noreferrer">A practical 10 Cents Ceramic tube hotend</a>, and;</li> <li><a href="https://reprap.org/forum/read.php?70,172916" rel="nofollow noreferrer">Hotend wit...
<p>Because PTFE doesn't transmit heat very well? The whole idea when using a PTFE tube (and this is just my understanding ... which could be wrong), is for the tubing not to transmit heat, therefore allowing the filament to pass through it without melting or at the very least, collecting a lot of heat along the way (wh...
1,454
<p>can anyone explain in the simplest terms please what is the difference between a point cloud and a voxel mesh?</p>
<p>A point cloud is often derived by sampling. Each point represents an observation. Sometimes, a point cloud is turned into a surface by fitting triangles to the points in the form of an STL file.</p> <p>A raster is a 2D grid of pixels. It divides the area of an image into constant-sized little squares. Each of t...
<p>I believe a point cloud is just a collection of points, while voxels - "3D pixels" - define location and a cube area. They seem to be pretty equivalent mathematically.</p>
678
<p>How can I use XPath to select an XML-node based on its content? </p> <p>If I e.g. have the following xml and I want to select the &lt;author&gt;-node that contains Ritchie to get the author's full name:</p> <pre><code>&lt;books&gt; &lt;book isbn='0131103628'&gt; &lt;title&gt;The C Programming Language&...
<pre><code>/books/book/authors/author[contains(., 'Ritchie')] </code></pre> <p>or</p> <pre><code>//author[contains(., 'Ritchie')] </code></pre>
<p>The XPath for this is: </p> <pre><code>/books/book/authors/author[contains(., 'Ritchie')] </code></pre> <p>In C# the following code would return "Ritchie, Dennis M.":</p> <pre><code>xmlDoc.SelectSingleNode("/books/book/authors/author[contains(., 'Ritchie')]").InnerText; </code></pre>
4,986
<p>Can anyone recommend a good repository viewer for Git, similar to gitk, that works on Mac OS X Leopard? (I'm not saying gitk doesn't work)</p> <p>Of course I would like a native Mac application, but as I haven't found any, what are the best options to gitk?</p> <p>I know about gitview, but I'm looking forward to e...
<p>There's also <a href="http://www.gitx.org" rel="noreferrer">gitx</a>, it's progressing well and under active development (multiple commits per day).</p>
<p>You should checkout Sprout (formerly GitMac). <a href="http://sproutmacapp.com" rel="nofollow">http://sproutmacapp.com</a> it focuses on making Git easy, and browsing and committing changes in your projects</p> <p><a href="http://sproutmacapp.com" rel="nofollow">http://sproutmacapp.com</a> </p>
4,954
<p>I need to call into a Win32 API to get a series of strings, and I would like to return an array of those strings to JavaScript. This is for script that runs on local machine for administration scripts, not for the web browser.</p> <p>My IDL file for the COM object has the interface that I am calling into as:</p> <...
<p>If i recall correctly, you'll need to wrap the <code>SAFEARRAY</code> in a <code>VARIANT</code> in order for it to get through, and then use a <a href="http://msdn.microsoft.com/en-us/library/y39d47w8(VS.85).aspx" rel="noreferrer">VBArray object</a> to unpack it on the JS side of things:</p> <pre><code>HRESULT GetA...
<p><a href="https://stackoverflow.com/questions/45169/how-do-i-return-an-array-of-strings-from-an-activex-object-to-jscript#45211">Shog9</a> is correct. COM scripting requires that all outputs be VARIANTS. </p> <p>In fact, it also requires that all the <strong>INPUTs</strong> be VARIANTS as well -- see the nasty detai...
6,698
<p>How do I get the history of commits that have been made to the repository for a particular user? </p> <p>I am able to access CVS either through the command line or TortioseCVS, so a solution using either method is sufficient.</p>
<pre><code>cvs history -u username </code></pre> <p>gives a history of changes the user has made</p>
<p>Or try this one:</p> <pre><code>cvs history -x AMR -D "your-desired-date" </code></pre> <p>Example </p> <pre><code>cvs history -x AMR -D "2012-04-12" </code></pre>
8,139
<p>The <strong><a href="http://msdn.microsoft.com/en-us/library/4wyz8787(VS.80).aspx" rel="noreferrer">TRACE macro</a></strong> can be used to output diagnostic messages to the debugger when the code is compiled in <strong>Debug</strong> mode. I need the same messages while in <strong>Release</strong> mode. Is there a ...
<p>Actually, the TRACE macro is a lot more flexible than OutputDebugString. It takes a printf() style format string and parameter list whereas OutputDebugString just takes a single string. In order to implement the full TRACE functionality in release mode you need to do something like this:</p> <pre><code>void trace(c...
<p>In MFC, TRACE is defined as ATLTRACE. And in release mode that is defined as:</p> <pre><code>#define ATLTRACE __noop </code></pre> <p>So, using the out-the-box TRACE from MFC, you won't actually be able to read any TRACE text, because it won't even be written out. You could write your own TRACE function...
4,727
<p>I have a custom SharePoint application page deployed to the _layouts folder. It's a custom "new form" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPContext.Current.List to see the current list I'm working with. But ...
<p>Generally speaking I try and copy whatever approach the product group has taken when looking to add functionality of my own. In this case they add their own edit/view/add pages via the list definition itself.</p> <p>I built a solution that also needed its own custom "New" form, not open source unfortunately, though...
<p>I'm not using a custom "new form", so this might not apply. I added an event receiver to my custom content type and then do my custom code in the ItemAdded or ItemAdding events. This code fires when the event is added to a list. You can use the event receiver properties to get to the parent List, Web, and Site.</...
4,869
<p>I wondered if anyone had successfully managed, or knew how to automate the Safari web browser on the Windows platform.</p> <p>Ideally I would like to automate Safari in a similar way to using <a href="http://msdn.microsoft.com/en-us/library/aa741317.aspx" rel="nofollow noreferrer">mshtml</a> for Internet Explorer. ...
<p>you might check my post here where I am using the method described above to automate Chrome in C#</p> <p><a href="http://markcz.wordpress.com/2012/02/18/automating-chrome-browser-from-csharp/" rel="nofollow">http://markcz.wordpress.com/2012/02/18/automating-chrome-browser-from-csharp/</a></p> <p>Martin</p>
<p><a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> has been very useful for me for compatibility testing.</p>
8,553
<p>I've seen a few attempted SQL injection attacks on one of my web sites. It comes in the form of a query string that includes the "cast" keyword and a bunch of hex characters which when "decoded" are an injection of banner adverts into the DB.</p> <p>My solution is to scan the full URL (and params) and search for th...
<p>I don't.</p> <p>Instead, I use parametrized SQL Queries and rely on the database to clean my input.</p> <p>I know, this is a novel concept to PHP developers and MySQL users, but people using real databases have been doing it this way for years.</p> <p>For Example (Using C#)</p> <pre><code>// Bad! SqlCommand foo ...
<p>Thanks for the answers and links. Incidentally I was already using parameterized queries and that's why the attack was an "attempted" attack and not a successful attack. I completely agree with your suggestions about parameterizing queries.</p> <p>The MSDN posted link mentions "constraining the input" as part of th...
6,380
<p>How can I stop Visual Studio (both 2005 and 2008) from crashing (sometimes) when I select the "Close All But This" option?This does not happen all the time either.</p>
<p>First, check <a href="http://www.windowsupdate.com" rel="nofollow noreferrer">Windows Update</a> and make sure both VS environments are up to date.</p> <p>If that doesn't help, uninstall them both completely, reinstall only 2005, update and test it. If 2005 doesn't crash, install 2008, update and test them both. Do...
<p>Another alternative:</p> <ol> <li>Study for 10 years to become a really good programmer</li> <li>Apply for (and get) a job at Microsoft in the Visual Studio team</li> <li>Fix the bug</li> </ol>
9,435
<p>We have a codebase that is several years old, and all the original developers are long gone. It uses many, many threads, but with no apparent design or common architectural principles. Every developer had his own style of multithreaded programming, so some threads communicate with one another using queues, some lo...
<p>Invest in a copy of Intel's <a href="http://www.intel.com/cd/software/products/asmo-na/eng/239144.htm" rel="nofollow noreferrer">VTune</a> and its thread profiling tools. It will give you both a system and a source level view of the thread behaviour. It's certainly not going to autodocument the thing for you, but sh...
<p>One thing to keep in mind with using log4net or similar tool is that they change the timing of the application and can often hide the underlying race conditions. We had some poorly written code to debug and introduced logging and this actually removed race conditions and deadlocks (or greatly reduced their frequency...
3,123
<p>What would be the easiest way to detach a specific JPA Entity Bean that was acquired through an EntityManager. Alternatively, could I have a query return detached objects in the first place so they would essentially act as 'read only'?</p> <p>The reason why I want to do this is becuase I want to modify the data wit...
<p>(may be too late to answer, but can be useful for others)</p> <p>I'm developing my first system with JPA right now. Unfortunately I'm faced with this problem when this system is almost complete.</p> <p>Simply put. Use Hibernate, or wait for JPA 2.0.</p> <p>In Hibernate, you can use 'session.evict(object)' to remo...
<p>I think you can also use method EntityManager.refresh(Object o) if primary key of the entity has not been changed. This method will restore original state of the entity.</p>
5,138
<p>I'm looking for a simple solution for a yes/no dialog to use in a Java ME midlet. I'd like to use it like this but other ways are okey.</p> <pre><code>if (YesNoDialog.ask("Are you sure?") == true) { // yes was chosen } else { // no was chosen } </code></pre>
<p>You need an <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Alert.html" rel="nofollow noreferrer">Alert</a>:</p> <blockquote> <p>An alert is a screen that shows data to the user and waits for a certain period of time before proceeding to the next Displayable. An alert can contai...
<p>I dont have programed in Java ME, but i found in it's reference for optional packages the <a href="http://java.sun.com/javame/reference/apis/jsr209/" rel="nofollow noreferrer">Advanced Graphics and User Interface API</a>, and it's used like the Java SE API to create these dialogs with the <a href="http://java.sun.co...
8,108
<p>I'm attempting to use an existing CAS server to authenticate login for a Perl CGI web script and am using the <a href="http://search.cpan.org/dist/AuthCAS" rel="nofollow noreferrer">AuthCAS</a> Perl module (v 1.3.1). I can connect to the CAS server to get the service ticket but when I try to connect to validate the...
<p>As usually happens when I post questions like this, I found the problem. It turns out the <a href="http://search.cpan.org/dist/Crypt-SSLeay" rel="nofollow noreferrer">Crypt::SSLeay</a> module was not installed or at least not up to date. Of course the error messages didn't give me any clues. Updating it and all t...
<p>Well, from the <a href="http://search.cpan.org/src/OSALAUN/AuthCAS-1.3.1/lib/AuthCAS.pm" rel="nofollow noreferrer">module source</a> it looks like that IO::Socket error is coming from get_https2</p> <pre><code>[...] unless ($ssl_socket) { $errors = sprintf "error %s unable to connect https://%s:%s/\n",&amp;IO::...
4,645
<p>I'm printing flat objects (like rectangular) with PLA on a glass bed and 70 celcius degrees (also tried 75 celcius too, 65 celcius and lower ends with adhesion problem in general). Also I use brims too. Most of the time, after a while it shrinks and warps (when print continues).</p> <p>Room temperature is steady, t...
<p>Warping is caused by the plastic shrinking as it cools and inadequate bed adhesion is usually the what lets it warp. Either cleaning your print surface very thoroughly with rubbing alcohol or using something like a glue stick on your print bed will mitigate that warping enough that you won't suffer problems with you...
<p>PLA doesn't usually have water absorption issues. It usually prints just fine ... Maker's Muse did a video using 7yo PLA filament (IIRC) which had been stored in the open. Printed without issues. Not saying all PLA's are going to work as well, but I don't think it's a place I'd be looking first for an issue. Moistur...
1,568
<p>The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE.</p> <pre><code>#! /bin/sh if [ "${1+set}" != "set" ] then echo "Usage; winewrap EXEC [ARGS...]" exit 1 fi EXEC="$1" shift ARGS="" for p in "$@"; do if [ -e "$p" ] ...
<p>I you do want to have the assignment to CMD you should use </p> <p><code>eval $CMD</code> </p> <p>instead of just <code>$CMD</code> in the last line of your script. This should solve your problem with spaces in the paths, I don't know what to do about the "\t" problem.</p>
<p>You can try preceeding the spaces with \ like so:</p> <pre><code>/home/chris/.wine/drive_c/Program Files/Microsoft\ Research/Z3-1.3.6/bin/z3.exe </code></pre> <p>You can also do the same with your \t problem - replace it with \\t.</p>
5,678
<p>I'm using the After Effects CS3 Javascript API to dynamically create and change text layers in a composition.</p> <p>Or at least I'm trying to because I can't seem to find the right property to change to alter the actual text of the TextLayer object.</p>
<p>Hmm, must read docs harder next time.</p> <pre><code>var theComposition = app.project.item(1); var theTextLayer = theComposition.layers[1]; theTextLayer.property("Source Text").setValue("This text is from code"); </code></pre>
<p>I wrote a simple function for myself to change properties. Here it is:</p> <pre><code>function change_prop(prop, name, value){ var doc = prop.value; doc[name] = value; prop.setValue(doc); return prop; } </code></pre> <p>Example use:</p> <pre><code>// Changing source text change_prop(text_layer.p...
9,483
<p>I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?</p>
<p>Using <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expressions</a> is probably the best way. You can see a bunch of tests <a href="http://jsfiddle.net/ghvj4gy9/embedded/result,js/" rel="noreferrer">here</a> (taken from <a href="https://cs.chromium.org/chromium/src/third_party/bl...
<p>One of my coworker shared this regex with me. I like it a lot.</p> <pre><code>function isValidEmailAddress (email) { var validEmail = false; if (email) { email = email.trim().toLowerCase(); var pattern = /^[\w-']+(\.[\w-']+)*@([a-zA-Z0-9]+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*?\.[a-zA-Z]{2,6}|(\d{1...
6,822
<p>I'm trying to understand how namespaces work in XML. When I have an element like foo:bar, the attributes will often not have namespaces on them. But sometimes they will. Are the attribute in the namespace of the element, even when the default namespace has been declared? Looking over the xsd for xhtml it seems the a...
<p>Most of the time, attributes will not be in any namespace. The <a href="http://www.w3.org/TR/REC-xml-names/#defaulting" rel="noreferrer">namespace spec</a> says (<em>emphasis</em> mine):</p> <blockquote> <p>A default namespace declaration applies to all unprefixed <em>element</em> names within its scope. Default ...
<p>Read up at <a href="http://www.w3.org/TR/REC-xml-names/#scoping" rel="nofollow noreferrer">6.1 Namespace Scoping</a> and <a href="http://www.w3.org/TR/REC-xml-names/#defaulting" rel="nofollow noreferrer">6.2 Namespace Defaulting</a> on w3c.</p> <p>Basically:</p> <blockquote> <p>The scope of a namespace declarati...
6,287
<pre><code>&lt;servlet&gt; &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt; &lt;servlet-class&gt;workflow.WDispatcher&lt;/servlet-class&gt; &lt;load-on-startup&gt;2&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt; &lt;url-pattern&...
<pre><code>&lt;url-pattern&gt;*NEXTEVENT*&lt;/url-pattern&gt; </code></pre> <p>The URL pattern is not valid. It can either end in an asterisk or start with one (to denote a file extension mapping).</p> <p>The url-pattern specification:</p> <blockquote> <ul> <li>A string beginning with a ‘/’ character and ending ...
<p>A workaround that can achieve that is to add a servlet filter to do URL re-writes e.g. re-write <em>NEXTEVENT</em> to /NEXTEVENT/<em>(the one before the NEXTEVENT)/</em>(the one after NEXTEVENT) or something similar.</p>
4,629
<p>Is there ever a circumstance in which I would not want to use the <a href="http://msdn.microsoft.com/en-us/library/cb8x3kfz.aspx" rel="noreferrer"><code>AndAlso</code></a> operator rather than the <a href="http://msdn.microsoft.com/en-us/library/sdbcfyzh.aspx" rel="noreferrer"><code>And</code></a> operator? &hellip...
<p>From <a href="http://msdn.microsoft.com/en-us/library/wz3k228a.aspx" rel="noreferrer">MSDN</a>:</p> <p><strong>Short-Circuiting Trade-Offs</strong></p> <p><em>Short-circuiting can improve performance by not evaluating an expression that cannot alter the result of the logical operation. However, if that expression ...
<p>They are completely different functionalities in VB.net and both have their use cases (though for the most common use both will work)</p> <p><code>AndAlso</code> and <code>OrElse</code> are <strong>conditional</strong> operators, they return a true or false boolean value and only evaluate what they need to until the...
7,872
<p>How do I find out which process is listening on a TCP or UDP port on Windows?</p>
<h1><a href="https://en.wikipedia.org/wiki/PowerShell" rel="noreferrer">PowerShell</a></h1> <h2>TCP</h2> <pre><code>Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess </code></pre> <h2>UDP</h2> <pre><code>Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess </...
<p>For Windows, if you want to find stuff listening or connected to port 1234, execute the following at the cmd prompt: </p> <pre><code>netstat -na | find "1234" </code></pre>
7,056
<p>I've built and done some simple tests on a TEVO Tarantula but I've noticed some pretty dramatic under extrusions. </p> <p>My equipment:</p> <ul> <li>TEVO Tarantula;</li> <li>Jim Brown's easy config fork of Marlin;</li> <li>Titan extruder (came with printer).</li> </ul> <p>I've updated the firmware with the 400 st...
<p>It is definitively possible to do what you want, but your questions are samewhat problematic:</p> <blockquote> <p>So, I need to know if it's possible to print that cylinder hard enough to work as an axis.</p> </blockquote> <p>"hard enough" is a mysterious quantity. What is the intended application? The load of ...
<p>It is considered good practice to limit your post to one question at a time. The question about hardware and material is too broad to be a good question and I will set that aside.</p> <p>Equally unfortunate, your drawing is ambiguous. I suppose if English is not your native language, I'm not helping things either.<...
855
<p>I am having this problem with my printer. It doesn't print smooth circular objects. The objects are typically "ribbed" or ridged... never smooth. I am not sure how to fix this.</p> <p>I have tried fixing it in Meshmixer, I've tried <em>Sli3r</em> (I normally use <em>Cura</em> 2.7). I've tried turning down accelerat...
<p>Any deviation from smoothness is caused by irregularity in the material feed, the motion, or both. In this case, I would suggest both.</p> <p>The problem is that current 3D printer control firmware (If someone has a counter-example in the hobbiest space, please add it) prints in linear segments. This starts as @s...
<p>Did you try to use different infill? Denser or less dense?</p> <p>You can also try to reduce overlapping infil with outlines.</p> <p>Try to set 2 or 3 outer perimeters / outlines.</p>
688
<p>We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader.</p> <p>In tweaking that class to work with Oracle, we've come across an inte...
<p>I find it better to use null, instead of DB null.</p> <p>The reason is because, as you said, you're separating yourself from the DB world.</p> <p>It is generally good practice to check reference types to ensure they aren't null anyway. You're going to be checking for null for things other than DB data, and I find ...
<p>Use <code>DBNull</code>.<br> We encouintered some sort of problems when using null.<br> If I recall correctly you cannot INSERT a null value to a field, only DBNull.<br> Could be Oracle related only, sorry, I do not know the details anymore.</p>
3,390
<p>I'm trying to unit test a custom ConfigurationSection I've written, and I'd like to load some arbitrary configuration XML into a <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configuration.aspx" rel="noreferrer">System.Configuration.Configuration</a> for each test (rather than put the test co...
<p>There is actually a way I've discovered....</p> <p>You need to define a new class inheriting from your original configuration section as follows:</p> <pre><code>public class MyXmlCustomConfigSection : MyCustomConfigSection { public MyXmlCustomConfigSection (string configXml) { XmlTextReader reader ...
<p>Looking at the members of the class, I'd say the answer is probably no*. I'm not sure why you'd want to do this anyway, rather than create your own XML configuration file.</p> <p>*That's no, excluding messy reflection hacks</p>
4,132
<p>I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: <code>(2006, 'MySQL server has gone away')</code></p> <p>I did a bit of checking, and saw that this was because the connections to MySQL were not being renewed. This shouldn't ...
<p>I think I fixed it. It's turns out I had a simple config error. My ini file read:</p> <pre><code>sqlalchemy.default.url = [connection string here] sqlalchemy.pool_recycle = 1800 </code></pre> <p>The problem is that my <code>environment.py</code> file declared that the engine would only map keys with the prefix: <c...
<p>You might want to check MySQL's timeout variables:</p> <pre><code>show variables like '%timeout%'; </code></pre> <p>You're probably interested in <code>wait_timeout</code> (less likely but possible: <code>interactive_timeout</code>). On Debian and Ubuntu, the defaults are 28800 (MySQL kills connections after 8 ho...
2,965
<p>The Compact Framework doesn't support Assembly.GetEntryAssembly to determine the launching .exe. So is there another way to get the name of the executing .exe?</p> <p>EDIT: I found the answer on Peter Foot's blog: <a href="http://peterfoot.net/default.aspx" rel="nofollow noreferrer">http://peterfoot.net/default.asp...
<p>I am not sure whether it works from managed code (or even the compact framework), but in Win32 you can call GetModuleFileName to find the running exe file.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms683197(VS.85).aspx" rel="nofollow noreferrer">MSDN: GetModuleFileName</a></p>
<p>In managed code, i think you can use this: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.executablepath.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.application.executablepath.aspx</a></p> <p>Application.ExecutablePath</p>
4,554
<p>Is it possible to use a flash document embedded in HTML as a link?</p> <p>I tried just wrapping the <code>object</code> element with an <code>a</code> like this:</p> <pre><code>&lt;a href="http://whatever.com"&gt; &lt;object ...&gt; &lt;embed ... /&gt; &lt;/object&gt; &lt;/a&gt; </code></pre> <p>I...
<p>Though the object really should respond to being wrapped in an a href tag, you could open the swf in vim and just throw in an <code>_root.onPress=function(){getURL("http://yes.no/");};</code> or if it's AS3, something like <code>_root.addEventHandler(MouseEvent.PRESS, function (e:event) {getURL("http://yes.no/");});...
<p>As an addition to dlamblin's answer it is often best to use the clickTAG technique to open URLS from a flash movie.</p> <p>More information can be found here:</p> <p><a href="http://www.adobe.com/resources/richmedia/tracking/designers_guide/" rel="nofollow noreferrer">http://www.adobe.com/resources/richmedia/track...
5,350
<p>I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to <code>padding</code> and <code>position:relative</code>,...
<p>I believe the error lies in the mark up that the color picker is generating. I saved the page and removed that code for the color picker and it renders fine in IE/FF/SF. </p>
<p>Sorry I should have mentioned that as well. I tried floating that content right and additionally tried floating it left and setting the position with the thinking that both divs would start out at left:0 where setting the margin of the right would move it over.</p> <p>Thanks</p>
7,300
<p>How do I determine the (local-) path for the "Program Files" directory on a remote computer? There does not appear to any version of SHGetFolderPath (or related function) that takes the name of a remote computer as a parameter.</p> <p>I guess I could try to query HKLM\Software\Microsoft\Windows\CurrentVersion\Progr...
<p>Those are all slightly different, and generally have an acceptable usage.</p> <ul> <li><code>var.</code><a href="http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx" rel="noreferrer"><code>ToString</code></a><code>()</code> is going to give you the string representation of an object, regardless of w...
<p>At one time, I remember seeing the MSDN library state to use CStr() because it was faster. I do not know if this is true though.</p>
6,204
<p>My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a database diff tool to compare both the...
<p>I use Red Gate Sql Compare for comparing schemas. It also has an interesting feature that allows you to save a snapshot of the schema which you can then use in later diffs. for example compare the schema of today with the schema of a month ago.</p>
<p>We never actually purchased it as we ended up using SQL Server 2005, but DBDiff seemed to do the trick: <a href="http://www.dkgas.com/downdbdiff.cgi" rel="nofollow noreferrer">http://www.dkgas.com/downdbdiff.cgi</a></p> <p>It works with any ODBC compatible DB.</p>
4,801
<p>So I'm been pounding on this problem all day. I've got a LinqDataSource that points to my model and a GridView that consumes it. When I attempt to do an update on the GridView, it does not update the underlying data source. I thought it might have to do with the LinqDataSource, so I added a SqlDataSource and the sam...
<p>You are missing the &lt;UpdateParameters&gt; sections of your DataSources.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.updateparameters.aspx" rel="nofollow noreferrer">LinqDataSource.UpdateParameters</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/sy...
<p>This is a total shot in the dark since I haven't used ASP at all.</p> <p>I've been just learning XAML and WPF, which appears to be very similar to what you've posted above and I know that for some UI controls you need to specify the binding mode to two-way in order to get updates in both directions.</p>
7,587
<p>In other words, is this Singleton implementation thread safe:</p> <pre><code>public class Singleton { private static Singleton instance; private Singleton() { } static Singleton() { instance = new Singleton(); } public static Singleton Instance { get { return instance;...
<p>Static constructors are guaranteed to be run only once per application domain, before any instances of a class are created or any static members are accessed. <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors" rel="noreferrer">https://learn.microsoft.c...
<p>The static constructor is locked. While the type initializer is running, any other thread which attempts to access the class in such a way that would trigger the type initializer will block.</p> <p>However, the thread which is running the type initializer can access uninitialized static members. So be sure not to ca...
2,874
<p>I have a Flex <code>ComboBox</code> that gets populated by a <code>dataprovider</code> all is well...</p> <p>I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a <code>dataprovider</code>? I have not seen any examples of such, but I can't imagine this bei...
<p>If you don't need the default item to be selectable you can use the <code>prompt</code> property of <code>ComboBox</code> and set the <code>selectedIndex</code> to -1. That will show the string you set <code>propmt</code> to as the selected value until the user chooses another. It will not appear in the list of opti...
<p>This can be used following code for selected default value of combobox</p> <pre><code>var index:String = "foo"; for(var objIndex:int = 0; objIndex &lt; comboBox.dataProvider.length; objIndex++) { if(comboBox.dataProvider[objIndex].label == index) { comboBox.selectedIndex = objIndex; break; } } &lt;m...
5,566
<p>I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings.</p> <p>Does anyone know any faster ways of doing this or tips to speed up the methods?</p> <pre><code>castM...
<p>I've been using the following snipplet to parse UTC date strings:</p> <pre><code>private function parseUTCDate( str : String ) : Date { var matches : Array = str.match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)Z/); var d : Date = new Date(); d.setUTCFullYear(int(matches[1]), int(matches[2]) - 1, i...
<p>Here is my implementation. Give this a try.</p> <pre><code>public static function dateToUtcTime(date:Date):String { var tmp:Array = new Array(); var char:String; var output:String = ''; // create format YYMMDDhhmmssZ // ensure 2 digits are used for each format entry, so 0x00 suffuxed at each byte tmp....
2,534
<p>Is there any easy/general way to clean an XML based data source prior to using it in an XmlReader so that I can gracefully consume XML data that is non-conformant to the hexadecimal character restrictions placed on XML?</p> <p>Note: </p> <ul> <li>The solution needs to handle XML data sources that use character enc...
<p>It <strong>may not be perfect</strong> (emphasis added since people missing this disclaimer), but what I've done in that case is below. You can adjust to use with a stream.</p> <pre><code>/// &lt;summary&gt; /// Removes control characters and other non-UTF-8 characters /// &lt;/summary&gt; /// &lt;param name="inStr...
<pre><code>private static String removeNonUtf8CompliantCharacters( final String inString ) { if (null == inString ) return null; byte[] byteArr = inString.getBytes(); for ( int i=0; i &lt; byteArr.length; i++ ) { byte ch= byteArr[i]; // remove any characters outside the valid UTF-8 range as...
4,109
<p>I would like to debug an embedded system containing gdb remotely using some kind of gui (ie like ddd). The embedded system does not have the sources or build symbols. However my local x windows box has. However the execution must happen on the embedded system. How can I from my development box drive gdb remotely wit...
<p>I think, gdbserver could help you.</p>
<p>On Remote target:</p> <pre><code>target&gt; gdbserver localhost:1234 &lt;application&gt; </code></pre> <p>On Host (build machine):</p> <pre><code>host&gt; gdb &lt;application&gt; </code></pre> <p>Note that the on target may be stripped off from the symbols. But host may have all the symbols.</p> <pre><code>gd...
9,672
<p>I am looking for easy steps that are simple and effective in making a web application more secure.</p> <p>What are your top tips for secure web applications, and what kind of attack will they stop?</p>
<p>Microsoft Technet has en excellent article:</p> <p><a href="http://technet.microsoft.com/en-us/library/cc512638.aspx" rel="nofollow noreferrer">Ten Tips for Designing, Building, and Deploying More Secure Web Applications</a></p> <p>Here are the topics for the tips answered in that article:</p> <ol> <li>Never Dire...
<p>Set the secure flag on cookies for SSL applications. Otherwise there is always a highjacking attack that is <em>much</em> easier to conduct than breaking the crypto. This is the essence of CVE-2002-1152.</p>
6,953
<p>What is the maximum size for a MySQL table? Is it 2 million at 50GB? 5 million at 80GB?</p> <p>At the higher end of the size scale, do I need to think about compressing the data? Or perhaps splitting the table if it grew too big?</p>
<p>I once worked with a very large (Terabyte+) MySQL database. The largest table we had was literally over a billion rows. </p> <p>It worked. MySQL processed the data correctly most of the time. It was extremely unwieldy though. </p> <p>Just backing up and storing the data was a challenge. It would take days to resto...
<p>About your first question, the effective maximum size for the <em>database</em> is usually determined by operating system, specifically the file size MySQL Server will be able to create, not by MySQL Server itself. Those limits play a big role in <em>table</em> size limits. And MyISAM works differently from InnoDB. ...
7,110
<p>I have a filename in a format like:</p> <blockquote> <p><code>system-source-yyyymmdd.dat</code></p> </blockquote> <p>I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.</p>
<p>You can use the <a href="http://en.wikipedia.org/wiki/Cut_(Unix)" rel="noreferrer">cut command</a> to get at each of the 3 'fields', e.g.:</p> <pre><code>$ echo "system-source-yyyymmdd.dat" | cut -d'-' -f2 source </code></pre> <p>"-d" specifies the delimiter, "-f" specifies the number of the field you require</p>
<p>The simplest (and IMO best way) to do this is simply to use <code>read</code>:</p> <pre><code>$ IFS=-. read system source date ext &lt;&lt; EOF &gt; foo-bar-yyyymmdd.dat &gt; EOF $ echo $system foo $ echo $source $date $ext bar yyyymmdd dat </code></pre> <p>There are many variations on that theme, many of which ar...
7,194
<p>So they say PLA is biodegradable. But I still don't know how much biodegradable.</p> <p>I live in a flat and we have composting trash can in the courtyard. However if I throw PLA in there and it does not decompose, neighbors are gonna be pissed since many of them are intending to use the soil for their balcony flow...
<p>This question has been asked on just about every forum out there. Here's one example from <a href="https://www.filabot.com/blogs/news/57233604-the-misleading-biodegradability-of-pla" rel="nofollow noreferrer">filabot.com</a> .</p> <blockquote> <p>The reality however, is that this process will take several hundred y...
<p>PLA products will take up to 6 months to degrade in commercial composting facility. In home composting facility, it may take longer time.</p> <p>Source: <a href="http://www.biogreenchoice.com/category_s/1866.htm" rel="nofollow noreferrer">http://www.biogreenchoice.com/category_s/1866.htm</a></p>
524
<p>Courses for people who are being introduced to programming very often include a code project, which I think is a nice way to learn. However, such projects often feel too artificial, and are thus not very rewarding to work on.</p> <p>What are your ideas of rewarding code projects? (Preferably easy to begin, and exte...
<p>As has been stated a few times, what you are trying to teach the beginner is very important to the project.</p> <p>My advice to you for planning something like this:</p> <p>1) Avoid making a computer game</p> <p>A computer game, while fun to build, doesn't reward the programmer with results early on (it's very co...
<p>It really depends on what you're trying to teach the beginner. If you're trying to teach syntax, then simple "Hello World" programs and ones that spit out every odd number between 1 and 100 are fine to get them started. If you're trying to teach data structures, then maybe something like a 20 questions game or som...
4,635
<p>I'm working on a spec for a piece of software for my company and as part of the auditing system I think it would be neat if there was a way to grab the current Active Directory user.</p> <p>Hopefully something like:</p> <pre><code>Dim strUser as String strUser = ActiveDirectory.User() MsgBox "Welcome back, " &amp;...
<p><a href="http://bytes.com/forum/thread717576.html" rel="nofollow noreferrer">Try this article</a> - I have some code at work that will erm, work if this doesn't...</p> <p>Relevant quote:</p> <blockquote> <pre class="lang-vba prettyprint-override"><code>Private Declare Function GetUserName Lib "advapi32.dll" Alia...
<p>Depending on environment variables to remain valid is a bad idea, since they can easily be changed within a user session.</p>
3,054
<p>I'm reading some MPEG Transport Stream protocol over UDP and it has some funky bitfields in it (length 13 for example). I'm using the "struct" library to do the broad unpacking, but is there a simple way to say "Grab the next 13 bits" rather than have to hand-tweak the bit manipulation? I'd like something like the w...
<p>The <a href="https://github.com/scott-griffiths/bitstring" rel="nofollow noreferrer">bitstring</a> module is designed to address just this problem. It will let you read, modify and construct data using bits as the basic building blocks. The latest versions are for Python 2.6 or later (including Python 3) but version...
<p>It's an often-asked question. There's an <a href="http://code.activestate.com/recipes/113799/" rel="noreferrer">ASPN Cookbook</a> entry on it that has served me in the past.</p> <p>And there is an <a href="http://wiki.python.org/moin/BitManipulation" rel="noreferrer">extensive page of requirements one person would...
6,078
<p>I finally manage to setup the ABL on my Prusa. I run G28 to home all axes (for z I use the same probe used for ABL). Then I run G29 E ( I use E because otherwise for some reason I have not understood yet, Z does not lift during probings) probing 4 points on the corners of the bed.</p> <p>finally I get the map of th...
<p>I found the issue. As I mentioned in my question UPDATE, trying to print something that cover the full bed, the ABL was not working. The issue was the Gcode I added after the G29. In fact for some reason I added a G28 X0 after the G29 and that basically cancel the data acquired in the G29. I learned something new, d...
<p>I believe that the matrix is shown transposed from how it should be, but that doesn't affect the answer. The compensated Z position is derived from the original <code>(X,Y,Z)</code> position by multiplying the corresponding vector with that matrix. This means that the new Z position would be</p> <pre><code>Z' = 0.9...
423
<p>What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.</p>
<p>I am one of the authors of Drools, I will avoid pimping my wares. </p> <p>But some other options are Jess (not open source) but uses the clips syntax (which we also support a subset of) - which is kinda a lisp dialect. </p> <p>It really depends what you want it for, Haley have strong Natural language tech (and the...
<p>WF is available already in .net 3.0. It is a bit buggy though on the Designer-side in Visual Studio and can get quite messy. I use it on Sharepoint (where WF is pretty much your only option anyway) and overall I am quite satisfied with it, even though the learning curve is rather steep.</p> <p><a href="http://www.a...
2,833
<p>The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort.</p> <p>I recently received a non-pieceofcrapuous laptop, and I am in the process of copying everything from old to new. I'm trying...
<p>I find RoboCopy is a good alternative to xcopy. It supports high latency connections much better and supports resuming a copy.</p> <h3>References</h3> <p><a href="http://en.wikipedia.org/wiki/Robocopy" rel="noreferrer">Wikipedia - robocopy</a></p> <h3>Downloads</h3> <p><strong>Edit</strong> Robocopy was introduc...
<p>I would suggest using <a href="http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html" rel="nofollow noreferrer">rsync</a>, several ports are available, but <a href="http://www.itefix.no/i2/node/10650" rel="nofollow noreferrer">cwrsync</a> seems to work nicely on Windows.</p>
8,312
<p>So when my Prusa I3 is heating up, a small bit of filament is coming out of the nozzle, forming a small string at.</p> <p>When the printing starts, this results in a small plastic ball on the bed, impacting the overall printing process.</p> <p>How can I avoid this?</p>
<p>On my Kossel Mini I programmed it to go to the edge of the bed and purge a small amount of filament which creates a dot. I purge enough to get the dot to stick to the bed and then go on with printing, when the head moves the dot stays attached and usually pulls excess material off the nozzle. This can be added to ...
<p>I just go and pull it off the print head with pliers when it's about to start and sometimes shortly after it starts printing, but its probably not the safest way to deal with the problem. Printing a skirt, brim, or raft should help to fix the problem.</p>
574
<p>We have a service that has some settings that are supported only over net.tcp. What's the best way to add another endpoint? Do I need to create an entire new host?</p>
<p>A service may have multiple endpoints within a single host, but every endpoint must have a unique combination of address, binding and contract. For an IIS-hosted service (that is, an .SVC file), just set the address of the endpoint to a <strong>relative</strong> URI and make sure that your Visual Studio or wsdl.exe ...
<p>You will need to create an entire new host if you are currently using IIS as your host - IIS only supports HTTP and not TCP bindings. If however you are using WAS or a windows service, then you'll be able to get away with simply creating a new net.tcp endpoint.</p>
6,836
<p>I'd like to provide some way of creating dynamically loadable plugins in my software. Typical way to do this is using the <a href="http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx" rel="noreferrer">LoadLibrary</a> WinAPI function to load a dll and calling <a href="http://msdn.microsoft.com/en-us/library/...
<p>The following code snippet (C#) constructs an instance of any concrete classes derived from <code>Base</code> found in class libraries (*.dll) in the application path and stores them in a list.</p> <pre><code>using System.IO; using System.Reflection; List&lt;Base&gt; objects = new List&lt;Base&gt;(); DirectoryInfo...
<p>This is my implementation, Inspired in <a href="https://www.codeproject.com/Tips/546639/How-to-create-an-easy-plugin-system-in-Csharp" rel="nofollow noreferrer">this code</a> avoiding to iterate over all assemblies and all types (or at least filtering with linQ). I just load the library and try to load the class whi...
3,504
<p>I am now in the process of planning the deployment of a SharePoint solution into a production environment.<br> I have read about some tools that promise an easy way to automate this process, but nothing that seems to fit my scenario.</p> <p>In the testing phase I have used SharePoint Designer to copy site content b...
<p>I would also suggest checking out the SharePoint Content Deployment Wizard by Chris O'Brien. <a href="http://www.codeplex.com/SPDeploymentWizard" rel="nofollow noreferrer">http://www.codeplex.com/SPDeploymentWizard</a> </p> <p>Should help smooth the process you describe, and it's a nice tool for your kitbag regardl...
<p>We have a BizTalk 2006 with Web Application and Several WebServices that need to go from Dev to UAT to Live.</p> <p>We use MSBuild right from within VS to build, run tests, dependent on test result, complie, zip and ship to servers.</p> <p>Small MSBuild script on server to unzip, move the files, install clean web ...
3,093
<p>Inspired by <a href="https://devblogs.microsoft.com/oldnewthing/20080902-00/?p=21003" rel="noreferrer">Raymond Chen's post</a>, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff.</p> <pre><code...
<p><strong>O(n^2) time and O(1) space algorithm</strong> ( without any workarounds and hanky-panky stuff! )</p> <p><strong>Rotate by +90:</strong></p> <ol> <li>Transpose</li> <li>Reverse each row</li> </ol> <p><strong>Rotate by -90:</strong></p> <p><em>Method 1 :</em></p> <ol> <li>Transpose</li> <li>Reverse each c...
<p>The O(1) memory algorithm:</p> <ol> <li><p>rotate the outer-most data, then you can get below result:</p> <pre><code>[3][9][5][1] [4][6][7][2] [5][0][1][3] [6][2][8][4] </code></pre></li> </ol> <p>To do this rotation, we know </p> <pre><code> dest[j][n-1-i] = src[i][j] </code></pre> <p>Observe below: ...
6,405
<p>When is this called? More specifically, I have a control I'm creating - how can I release handles when the window is closed. In normal win32 I'd do it during <code>wm_close</code> - is <code>DestroyHandle</code> the .net equivalent?</p> <hr> <p>I don't want to destroy the window handle myself - my control is liste...
<p>Normally <code>DestroyHandle</code> is being called in <code>Dispose</code> method. So you need to make sure that all controls are disposed to avoid resource leaks.</p>
<p>Normally <code>DestroyHandle</code> is being called in <code>Dispose</code> method. So you need to make sure that all controls are disposed to avoid resource leaks.</p>
6,506
<p>I have a Monoprice MP10 with magnetic flexible paper coated build plate and I have just tried printing bed level test which is, of necessity, very thin on the build plate.</p> <p>Watching the item print, I saw that the bed level was obviously way way off at the back left corner and down the left side. I was printing...
<p>In my experience with the Creality magnetic textured build surface, it's easier to remove a thin print while the surface is still pretty warm -- probably between 35 °C and 40 °C -- as opposed to fully cooled to room temperature.</p> <p>If the print is <em>very</em> thin, however (as when the nozzle is much too close...
<p>You could try freezing your bed with cooling spray around the print and then wait some seconds and try peel it off.</p> <p>I had the problem once on my PEI sheet and it did help. I used this spray: <a href="https://www.distrelec.ch/de/kuehlmittel-spray-prefix-prefix-200-suffix-suffix-ml-kontakt-chemie-freeze-75-200-...
1,742
<p>For classes that have a long list of setters that are used frequently, I found this way very useful (although I have recently read about the <a href="http://en.wikipedia.org/wiki/Builder_pattern" rel="noreferrer">Builder pattern</a> in <em>Effective Java</em> that is kinda the same).</p> <p>Basically, all setter met...
<p>@pek<br/> Chained invocation is one of proposals for Java 7. It says that if a method return type is void, it should implicitly return <strong>this</strong>. If you're interested in this topic, there is a bunch of links and a simple example on <a href="http://tech.puredanger.com/java7#chained" rel="noreferrer">Alex ...
<p>I agree with @Bernard that method chaining like this muddles the purpose of the setters. Instead I would suggest that if you are always creating chains of setters like this that you create a custom Constructor for your class so instead of</p> <pre><code> MyClass .setInt(1) .setString("test") .setBool...
5,155
<p><a href="http://www.google.com/search?q=how%20to%20mock%20sealed%20class" rel="noreferrer">Mocking sealed classes</a> can be quite a pain. I currently favor an <a href="http://en.wikipedia.org/wiki/Adapter_pattern" rel="noreferrer">Adapter pattern</a> to handle this, but something about just keeps feels weird. </p...
<p>My general rule of thumb is that objects that I need to mock should have a common interface too. I think this is right design-wise and makes tests a lot easier (and is usually what you get if you do TDD). More about this can be read in the Google Testing Blog <a href="http://googletesting.blogspot.com/2008/08/by-mik...
<p>Is there a way to implement a sealed class from an interface... and mock the interface instead?</p> <p>Something in me feels that having sealed classes is wrong in the first place, but that's just me :)</p>
2,822
<p>From what I can gather, there are three categories:</p> <ol> <li>Never use <code>GET</code> and use <code>POST</code></li> <li>Never use <code>POST</code> and use <code>GET</code></li> <li>It doesn't matter which one you use.</li> </ol> <p>Am I correct in assuming those three cases? If so, what are some examples f...
<p>Use <code>POST</code> for destructive actions such as creation (I'm aware of the irony), editing, and deletion, because you can't hit a <code>POST</code> action in the address bar of your browser. Use <code>GET</code> when it's safe to allow a person to call an action. So a URL like:</p> <pre><code>http://myblog.or...
<p>Gorgapor, <code>mod_rewrite</code> still often utilizes <code>GET</code>. It just allows to translate a friendlier URL into a URL with a <code>GET</code> query string.</p>
6,876
<p>I have a large table with 1 million+ records. Unfortunately, the person who created the table decided to put dates in a <code>varchar(50)</code> field.</p> <p>I need to do a simple date comparison -</p> <pre><code>datediff(dd, convert(datetime, lastUpdate, 100), getDate()) &lt; 31 </code></pre> <p>But it fails on...
<p>Place the <code>CASE</code> and <code>ISDATE</code> inside the <code>CONVERT()</code> function.</p> <pre class="lang-sql prettyprint-override"><code>SELECT COUNT(*) FROM MyTable WHERE DATEDIFF(dd, CONVERT(DATETIME, CASE IsDate(lastUpdate) WHEN 1 THEN lastUpdate ELSE '12-30-1899' END), GetDat...
<p>I would suggest cleaning up the mess and changing the column to a datetime because doing stuff like this</p> <pre><code>WHERE datediff(dd, convert(datetime, lastUpdate), getDate()) &lt; 31 </code></pre> <p>cannot use an index and it will be many times slower than if you had a datetime colum,n and did</p> <pre><co...
4,776
<p>I've been trying to understand how Ruby blocks work, and to do that I've been trying to implement them in C.</p> <p>One easy way to implement closures is to pass a <code>void*</code> to the enclosing stack to the closure/function but Ruby blocks also seem to handle returns and break statements from the scope that u...
<p>The concept of closures requires the concept of contexts. C's context is based on the stack and the registers of the CPU, so to create a block/closure, you need to be able to manipulate the stack pointer in a correct (and reentrant) way, and store/restore registers as needed.</p> <p>The way this is done by interpre...
<p>There's a good set of slides on Ruby Blocks as part of the "Rails with Passion" course:</p> <p><a href="http://www.javapassion.com/rubyonrails/ruby_blocks.pdf" rel="nofollow noreferrer">Ruby_Blocks.pdf</a></p> <p>This covers representing a block, how they get passed arguments and executed, and even further into th...
4,022
<p>In the past we declared properties like this:</p> <pre><code>public class MyClass { private int _age; public int Age { get{ return _age; } set{ _age = value; } } } </code></pre> <p>Now we can do:</p> <pre><code>public class MyClass { public int Age {get; set;} } </code><...
<p>The aim of the new automatic properties is to reduce the amount of boilerplate code you need to write when you just have a simple property that doesn't need any special logic in the get or the set. </p> <p>If you want to access the private member that these properties use, that's usually for a few reasons:</p> <ul...
<p>You can't, it's a language feature as opposed to a IDE feature. To be honest i'd prefer then IDE to add the private variable in for you. I agree that it is slightly weird for the class to internally have to use the public entry point to access its own variables. Hence I don't use this new feature that much myself.</...
8,672
<p>I am new to any scripting language. But, still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, what is the best online resource to learn Perl?</p>
<p>If you already know a bit of perl, <a href="http://www.perlmonks.org/" rel="noreferrer">PerlMonks</a> is a great online resource. You can ask questions in their <a href="http://www.perlmonks.org/?node=Seekers%20of%20Perl%20Wisdom" rel="noreferrer">Seekers of Perl Wisdom</a> section and the answers are often of very...
<p>If you are a beginner, I would suggest you take a look at the cookbook provided by PLEAC. You can find it at <a href="http://pleac.sf.net" rel="nofollow noreferrer">http://pleac.sf.net</a>. There you can find cookbooks for most languages.</p>
9,599
<p>The exact error is as follows</p> <blockquote> <p>Could not load file or assembly 'Microsoft.SqlServer.Replication, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. An attempt was made to load a program with an incorrect format.</p> </blockquote> <p>I've rece...
<p>The <a href="https://stackoverflow.com/a/41451/148412">answer by baldy</a> below is correct, but you may also need to enable 32-bit applications in your AppPool. </p> <p>Source: <a href="http://www.alexjamesbrown.com/uncategorized/could-not-load-file-or-assembly-chilkatdotnet2-or-one-of-its-dependencies-an-attempt-...
<p>in windows form application I do this, Right-click on Project->Properties->Build->Check Prefer 32-bit checkbox. Thanks all</p>
6,274
<p>Can someone please tell me how to submit an HTML form when the return key is pressed and if there are no buttons in the form? <strong>The submit button is not there</strong>. I am using a custom div instead of that.</p>
<p>To submit the form when the enter key is pressed create a javascript function along these lines.</p> <pre><code>function checkSubmit(e) { if(e &amp;&amp; e.keyCode == 13) { document.forms[0].submit(); } } </code></pre> <p>Then add the event to whatever scope you need eg on the div tag:</p> <p><code>&l...
<p>Similar to Chris Marasti-Georg's example, instead using inline javascript. Essentially add onkeypress to the fields you want the enter key to work with. This example acts on the password field.</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;title&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;form action="" me...
4,977
<p>I need to read from Outlook .MSG file in .NET <em>without</em> using COM API for Outlook (cos it will not be installed on the machines that my app will run). Are there any free 3rd party libraries to do that? I want to extract From, To, CC and BCC fields. Sent/Receive date fields would be good if they are also store...
<p><strong>Update:</strong> I have found a 3rd party COM library called <a href="http://www.dimastr.com/redemption/" rel="noreferrer">Outlook Redemption</a> which is working fine for me at the moment. If you use it via COM-Interop in .NET, don't forget to release every COM object after you are done with it, otherwise y...
<p>If you open the .MSG file in a text editor, i believe you will find that the information you are after is stored as plain text inside the file. (It is on all the messages i have checked at least)</p> <p>It would be pretty easy to write some code to parse the file looking for lines beginning with "From:" or "To:" et...
3,669
<p>I was trying to get my head around XAML and thought that I would try writing some code. </p> <p>Trying to add a grid with 6 by 6 column definitions then add a text block into one of the grid cells. I don't seem to be able to reference the cell that I want. There is no method on the grid that I can add the text blo...
<p>WPF makes use of a funky thing called <a href="http://msdn.microsoft.com/en-us/library/ms749011.aspx" rel="noreferrer">attached properties</a>. So in your XAML you might write this:</p> <pre><code>&lt;TextBlock Grid.Row="0" Grid.Column="0" /&gt; </code></pre> <p>And this will effectively move the TextBlock into ce...
<p>The cell location is an attached property - the value belongs to the TextBlock rather than Grid. However, since the property itself belongs to Grid, you need to use either the property definition field or the provided static functions.</p> <pre><code>TextBlock tb = new TextBlock(); // // Locate tb in the second row...
2,913
<p>I have some code that creates a fairly large xml DOM and writes it off to a file (up to 50-100MB) . It basically creates the DOM and then calls a toString on it and writes it out with ofstream. Is there a way to get streaming output of the generated dom so that it doesn't create the whole structure in memory all at ...
<p>Ok, turns out libxml2 has a streaming API:</p> <p><a href="http://xmlsoft.org/examples/testWriter.c" rel="nofollow noreferrer">http://xmlsoft.org/examples/testWriter.c</a></p> <p>It's a little old style (very C-ish) but you can write your wrapper around it.</p>
<p>Look under keyword "C++ XML writer;" XML writers generate XML to file without building the entire DOM in memory so they don't need to use very much memory at all. You didn't mention platform, but Microsoft XmlLite has IXmlWriter.</p>
7,304
<p>I know that just using <code>rand()</code> is predictable, if you know what you're doing, and have access to the server.</p> <p>I have a project that is <strong>highly</strong> dependent upon choosing a random number that is as unpredictable as possible. So I'm looking for suggestions, either other built-in functio...
<p>Adding, multiplying, or truncating a poor random source will give you a poor random result. See <a href="http://random.org/randomness/" rel="noreferrer">Introduction to Randomness and Random Numbers</a> for an explanation.</p> <p>You're right about PHP rand() function. See the second figure on <a href="http://rando...
<p>Variation on @KG, using the milliseconds since EPOCH as the seed for rand?</p>
2,748
<p>Given a large set of data, I was able to create a 3D graph in Microsoft Excel. How can I create a STL file similar to this graph to create a physical model of this graph? <a href="https://i.stack.imgur.com/xvJhX.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/xvJhX.jpg" alt="enter image description here">...
<p>Before worrying too much about the hydrophilic properties of PLA, it might be worthwhile to test a fitting.</p> <p>First, print a fitting and see that the freshly made print is strong enough to carry the pressure of the water, and the compression force of hose clamp you may need to connect the stiff irrigation hose...
<p>PLA will biodegrade over time. ABS would last longer, and stand up to higher temps.</p>
888
<p>We're a .NET team which uses the Oracle DB for a lot of reasons that I won't get into. But deployment has been a bitch. We are manually keeping track of all the changes to the schema in each version, by keeping a record of all the scripts that we run during development. </p> <p>Now, if a developer forgets to check-...
<p>Red Gate Schema Compare for Oracle has now been released!</p> <p><a href="http://www.red-gate.com/products/schema_compare_for_oracle/index.htm" rel="nofollow noreferrer">http://www.red-gate.com/products/schema_compare_for_oracle/index.htm</a></p> <p>There is a 28-day fully functional free trial. Please give it a g...
<p>There are various tools out there that you can use, I haven't used any of them myself though so I've got no comments to make about them, but another "trick" that you can use is to create a trigger on DDL events, so you can basically capture (to a table, or log file or whatver) any changes done between deployments.</...
6,958
<p>I noticed that my version of Ultimaker Cura was out of date, so I tried to go to <a href="https://ultimaker.com" rel="nofollow noreferrer">their website</a> and download a new version. For whatever reason, I could not get the <a href="https://ultimaker.com/en/products/ultimaker-cura-software/download-request/191" r...
<p>The answer to your question is: <strong>&quot;From the application developer itself!&quot;</strong>.</p> <p>Below is the explanation how you can (directly) download Ultimaker Cura from the most reputable source: Ultimaker.com</p> <hr /> <h2>Regular download</h2> <p>When clicking the <a href="http://ultimaker.com/en/...
<p>Cura is a software tool developed by Ultimaker for 3D printers. There is a downloadable page for this tool: <a href="https://ultimaker.com/en/products/ultimaker-cura-software/list" rel="nofollow noreferrer">https://ultimaker.com/en/products/ultimaker-cura-software/list</a>. There is no restriction to download it.</p...
966
<p>(I'm using Visual C++ 2008) I've always heard that main() is <em>required</em> to return an integer, but here I didn't put in <code>return 0;</code> and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main()...
<blockquote> <h1>3.6.1 Main function</h1> <p>....</p> <p>2 An implementation shall not predefine the <code>main</code> function. This function shall not be overloaded. It shall have a return type of type <code>int</code>, but otherwise its type is implementation-defined. All implementations shall allow both of the foll...
<p>I'm pretty sure VC++ just inserts a return 0 if you don't include one in main functions. The same thing can happen with functions too, but in those cases at least you'll get a warning.</p>
4,222
<p>Ok, I have a strange exception thrown from my code that's been bothering me for ages.</p> <pre><code>System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall at System.Net.Sockets.Socket.Accept() at System.Net.Sockets.TcpListener.AcceptTcpClient() </code></pr...
<p>Is it possible that the serverSocket is being closed from another thread? That will cause this exception.</p>
<p>More recently I saw this exception when using HttpWebRequest to PUT a large file and the Timeout period was passed.</p> <p>Using the following code as long as your upload time > 3 seconds it will cause this error as far as I could see.</p> <pre><code>string path = "Reasonably large file.dat"; int bufferSize = 1024...
5,181
<p>I would like to ask this in more of a general sense than anything, just for people to make note.</p> <p>I am printing out things for people and some files have some edges hanging out the side. I always worry, since it is printing in mid air, that it would screw up the print. But I was able to go, maybe 1mm(I am not...
<p>If I understand correctly, your question is specifically for <strong>overhangs at 90°</strong> (so an horizontal plane that has no support under it.</p> <p>The first to notice is that <strong>you can only pull this off if the extrusion happens perpendicular to the surface from which the overhang is coming off</stro...
<p>To add to what mac described, there are small detail effects which sometimes change the behaviour of an overhang (and not necessarily in a predictable manner).</p> <p>Concave overhangs might sag (rather than turn out like a bridge). Convex overhangs might pull tight. Cooling plastic tends to shrink,so might sag les...
803
<p>I am using <a href="http://code.google.com/p/js2-mode/" rel="noreferrer">js2-mode</a> to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.</p>
<p>Do you have</p> <pre> (setq-default indent-tabs-mode nil) </pre> <p>in your .emacs? It works fine for me in emacs 23.0.60.1 when I do that. js2-mode uses the standard emacs function indent-to, which respects indent-tabs-mode, to do its indenting.</p>
<p>Add this to your <code>.emacs</code> file somewhere after you load js2 mode:</p> <pre><code>(setq js2-mode-hook '(lambda () (progn (set-variable 'indent-tabs-mode nil)))) </code></pre>
6,786
<p>I picked up some no-name &quot;silk&quot; PLA in a multi color pack as part of a project where I needed some additional distinct colors and structural properties didn't matter, but now I'm playing with the excess I'm not using for that, and its behavior is really weird. On overhangs with detail on the downward-facin...
<p>It has additives to the PLA to change its characteristics.</p> <blockquote> <p>Typically, “silk” filaments are enhanced PLA filaments, owing their glossy result to various additives. As such, they tend to show most of the same pros and cons of PLA filament. In the case where silk filaments have a different base, the...
<p>It has additives to the PLA to change its characteristics.</p> <blockquote> <p>Typically, “silk” filaments are enhanced PLA filaments, owing their glossy result to various additives. As such, they tend to show most of the same pros and cons of PLA filament. In the case where silk filaments have a different base, the...
1,942
<p>My university is part of MSDNAA, so I downloaded it a while back, but I just got around to installing it. I guess part of it replaces FrontPage for web editing, and there appears to be a video editor and a vector graphics editor, but I don't think I've even scratched the surface of what it is and what it can do. Cou...
<p>Expression Studio is basically a design studio. It consists of a bunch of design software that Microsoft has bought for the most part. The audience is designers, not developers. The gist of the software is that Expression Blend enables designers and programmers to work seamlessly together in letting the designer cre...
<p>The <a href="http://www.microsoft.com/expression/" rel="nofollow noreferrer">Expression site</a> is the first place to start. These are tools that bridge the developer/designer gap for building rich internet applications with Silverlight and WPF. They compete with Adobe Studio products.</p> <p>Whilst Visual Studio ...
4,846
<p>I need to find out how to format numbers as strings. My code is here:</p> <pre><code>return str(hours)+":"+str(minutes)+":"+str(seconds)+" "+ampm </code></pre> <p>Hours and minutes are integers, and seconds is a float. the str() function will convert all of these numbers to the tenths (0.1) place. So instead of ...
<p>Starting with Python 3.6, formatting in Python can be done using <a href="https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep498" rel="noreferrer">formatted string literals</a> or <em>f-strings</em>:</p> <pre><code>hours, minutes, seconds = 6, 56, 33 f'{hours:02}:{minutes:02}:{seconds:02} {"pm" if hours &gt;...
<p><em>str()</em> in python on an integer will <strong>not</strong> print any decimal places.</p> <p>If you have a float that you want to ignore the decimal part, then you can use str(int(floatValue)).</p> <p>Perhaps the following code will demonstrate:</p> <pre><code>&gt;&gt;&gt; str(5) '5' &gt;&gt;&gt; int(8.7) 8 ...
4,266
<p>I have a Ruby on Rails Website that makes HTTP calls to an external Web Service.</p> <p>About once a day I get a SystemExit (stacktrace below) error email where a call to the service has failed. If I then try the exact same query on my site moments later it works fine. It's been happening since the site went live ...
<p>Using fcgi with Ruby is known to be very buggy. </p> <p>Practically everybody has moved to <a href="http://mongrel.rubyforge.org/" rel="noreferrer">Mongrel</a> for this reason, and I recommend you do the same.</p>
<p>I would also take a look at <a href="http://modrails.com/" rel="nofollow noreferrer">Passenger</a>. It's a lot easier to get going than the traditional solution of Apache/nginx + Mongrel.</p>
2,294
<p><a href="https://3dprinting.stackexchange.com/a/2820/5782">In this answer</a> user <a href="https://3dprinting.stackexchange.com/users/4345/barafu-albino">Barafu</a> says,</p> <blockquote> <p>Yet I manage to keep my tolerances +- 0.05 mm which is enough for everything but miniature printing.</p> </blockquote> <p...
<p>Dimensional accuracy is not as important as dimensional uniformity. I can print with undersized (or oversized) filament, adjusting the flow appropriately, provided the filament has a consistent diameter. When creating filament in-house, without expensive equipment, it is difficult to maintain the same diameter throu...
<p>Put it simply: they say 1.75&nbsp;mm with a &plusmn; error of 0.05&nbsp;mm. Which means your flow may vary &plusmn;2.9&nbsp;% while you are printing creating blobs and such. </p> <p>The smaller the filament tolerance, the more expensive the production costs.</p>
500
<p>Struts 1.3 application. Main website is NOT served by struts/Java. I need to forward the result of a struts action to a page in the website, that is outside of the struts context. Currently, I forward to a JSP in context and use a meta-refresh to forward to the real location. That seems kinda sucky. Is there a ...
<p>You can't "forward", in the strict sense. Just call <code>sendRedirect()</code> on the <code>HttpServletResponse</code> object in your <code>Action</code> class's <code>execute()</code> method and then, <code>return null</code>.</p> <p>Alternately, either call <code>setModule()</code> on the <code>ActionForward</co...
<p>I ended up doing response.sendRedirect().</p>
8,939
<p>I know that tables are for tabular data, but it's so tempting to use them for layout. I can handle DIV's to get a three column layout, but when you got 4 nested DIV's, it get tricky. </p> <p>Is there a tutorial/reference out there to persuade me to use DIV's for layout?</p> <p>I want to use DIV's, but I refuse to ...
<p>There's the <a href="http://developer.yahoo.com/yui/grids/" rel="nofollow noreferrer">Yahoo Grid CSS</a> which can do all sorts of things. </p> <p>But remember: <strong>CSS IS NOT A RELIGION</strong>. If you save hours by using tables instead of css, do so. </p> <p>One of the corner cases I could never make my min...
<p>This may be unhelpful but I somehow don't understand all these problems related to CSS. If a newspaper designer would try to embed a movie in the ad page, everybody would agree that he's a bit crazy. But still those same people pine after three-column layouts in HTML. HTML is just not apt to handle this kind of layo...
8,640
<p>I am trying to link two fields of a given table to the same field in another table. I have done this before so I can't work out what is wrong this time.</p> <p>Anyway:</p> <pre><code>Table1 - Id (Primary) - FK-Table2a (Nullable, foreign key relationship in DB to Table2.Id) - FK-Table2b (Nullable, foreign key relat...
<p>No idea on the cause, but I just reconstructed my .dbml from scratch and it fixed itself. Oh for a "refresh" feature...</p>
<p>I had the same problem. This error appeared when I tried to link different types of fields, or when I tryied to drag-and-drop table to .dbml space, but .dbml already had contained linked tables with different types of linked fields.</p>
6,686