instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>I tried finding a python script in google that will generate a random terrain when the game starts (or each time a the player advances to a new scene) but all the tools I found are for creating a terrain to render it, not for the game mode.</p> <p>Any idea how/where to find one?</p> <p>(I'm assuming that since Blender3D has game programming capabilities, it is OK for someone to ask in SO)</p>
<p>Is this link related?</p> <p><a href="http://blenderartists.org/forum/showthread.php?t=77794" rel="nofollow noreferrer">http://blenderartists.org/forum/showthread.php?t=77794</a></p> <p>To generate terrain (height map) the algorithm is pretty simple (fractal plasma), something like this algorithm (Java):</p> <p><a href="http://www.sinc.stonybrook.edu/stu/jseyster/plasma/" rel="nofollow noreferrer">http://www.sinc.stonybrook.edu/stu/jseyster/plasma/</a></p> <p>If you Google search for "fractal plasma python" you might find some example code.</p>
<p>You should be able to reprogram most of the python scripts available to generate terrain for rendering to generate terrain for your game... is there a specific thing you <em>need</em> from the script to make it suitable for realtime gameplay instead of a static render?</p>
5,173
<p>The company I just started working for is using <a href="http://www.stripesframework.org/display/stripes/Home" rel="noreferrer">Stripes</a> for parts of its web page development these days, and while it seems to be a nice enough web framework it no one really uses it-- it is almost non existent on the 'net. It's not even first in it's <a href="http://www.google.com/search?client=opera&amp;rls=en&amp;q=stripes&amp;sourceid=opera&amp;ie=utf-8&amp;oe=utf-8" rel="noreferrer">google search</a> and the result you <strong>do</strong> get is for its old home page.</p> <p>So, do any of you people use Stripes? Of your own volition? Do you know of any good tutorials / examples?</p>
<p>I've never used (or even heard of) Stripes.</p> <p>Regardless, there's a book from <a href="http://www.pragprog.com/" rel="nofollow noreferrer">The Pragmatic Bookshelf</a> called <a href="http://www.pragprog.com/titles/fdstr/stripes" rel="nofollow noreferrer">Stripes: ...and Java web development is fun again</a> that may be worth checking out. You could also check out the Stripes <a href="https://sourceforge.net/mail/?group_id=145476" rel="nofollow noreferrer">mailing list archive</a>.</p>
<p>We considered it when we were looking at open source frameworks. But we saw the same thing your did that there really just isn't much support or information for it. You should always weight the community support factor surrounding open source projects before picking one. (which is what you are doing here)</p>
3,649
<p>I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.</p>
<p>The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.</p> <pre>; Define functions for running Guile-written tests under the TAP protocol. ; Copyright &#169; 2008 by Omer Zak ; Released under the GNU LGPL 2.1 or (at your option) any later version. ;;; ;;; To invoke it: ;;; (use-modules (guiletap)) ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-module (guiletap)) (export plan) (export ok) (export bail_out) (export diag) (export is_ok) (use-modules (ice-9 format)) ; n is the number of tests. (define plan (lambda (n) (display (format "1..~d~%" n)))) ; n - test number ; testdesc - test descriptor ; res - result which is #f at failure, other at success. (define ok (lambda (n testdesc res) (if (not res)(display "not ")) (display (format "ok ~d - ~a~%" n testdesc)))) ; testdesc - test descriptor (define bail_out (lambda (testdesc) (display (format "Bail out! - ~a~%" testdesc)))) ; diagmsg - diagnostic message (define diag (lambda (diagmsg) (display (format "# ~a~%" diagmsg)))) ; n - test number ; testdesc - test descriptor ; expres - expected test result ; actres - actual test result (define is_ok (lambda (n testdesc expres actres) (ok n testdesc (equal? expres actres)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; !!! TODO: ; !!! To be implemented also: ; plan_no_plan ; plan_skip_all [REASON] ; ; is RESULT EXPECTED [NAME] ; isnt RESULT EXPECTED [NAME] ; like RESULT PATTERN [NAME] ; unlike RESULT PATTERN [NAME] ; pass [NAME] ; fail [NAME] ; ; skip CONDITION [REASON] [NB_TESTS=1] ; Specify TODO mode by setting $TODO: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; End of guiletap.scm</pre>
<p>The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.</p> <pre>; Define functions for running Guile-written tests under the TAP protocol. ; Copyright &#169; 2008 by Omer Zak ; Released under the GNU LGPL 2.1 or (at your option) any later version. ;;; ;;; To invoke it: ;;; (use-modules (guiletap)) ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-module (guiletap)) (export plan) (export ok) (export bail_out) (export diag) (export is_ok) (use-modules (ice-9 format)) ; n is the number of tests. (define plan (lambda (n) (display (format "1..~d~%" n)))) ; n - test number ; testdesc - test descriptor ; res - result which is #f at failure, other at success. (define ok (lambda (n testdesc res) (if (not res)(display "not ")) (display (format "ok ~d - ~a~%" n testdesc)))) ; testdesc - test descriptor (define bail_out (lambda (testdesc) (display (format "Bail out! - ~a~%" testdesc)))) ; diagmsg - diagnostic message (define diag (lambda (diagmsg) (display (format "# ~a~%" diagmsg)))) ; n - test number ; testdesc - test descriptor ; expres - expected test result ; actres - actual test result (define is_ok (lambda (n testdesc expres actres) (ok n testdesc (equal? expres actres)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; !!! TODO: ; !!! To be implemented also: ; plan_no_plan ; plan_skip_all [REASON] ; ; is RESULT EXPECTED [NAME] ; isnt RESULT EXPECTED [NAME] ; like RESULT PATTERN [NAME] ; unlike RESULT PATTERN [NAME] ; pass [NAME] ; fail [NAME] ; ; skip CONDITION [REASON] [NB_TESTS=1] ; Specify TODO mode by setting $TODO: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; End of guiletap.scm</pre>
9,763
<p>In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original?</p> <p>I usually just copy the string to a new variable then bind it to the <code>s///</code> regex that does the replacement on the new string, but I was wondering if there is a better way to do this?</p> <pre><code>$newstring = $oldstring; $newstring =~ s/foo/bar/g; </code></pre>
<p>This is the idiom I've always used to get a modified copy of a string without changing the original:</p> <pre><code>(my $newstring = $oldstring) =~ s/foo/bar/g; </code></pre> <p>In perl 5.14.0 or later, you can use the new <code>/r</code> <a href="https://metacpan.org/pod/release/FLORA/perl-5.14.2/pod/perl5140delta.pod#Non-destructive-substitution" rel="noreferrer">non-destructive substitution modifier</a>:</p> <pre><code>my $newstring = $oldstring =~ s/foo/bar/gr; </code></pre> <hr /> <p><strong>NOTE:</strong><br /> The above solutions work without <code>g</code> too. They also work with any other modifiers.</p> <p><strong>SEE ALSO:</strong><br /> <a href="https://perldoc.perl.org/perlrequick" rel="noreferrer"><code>perldoc perlrequick</code>: Perl regular expressions quick start</a></p>
<p>If you write Perl with <code>use strict;</code>, then you'll find that the one line syntax isn't valid, even when declared.</p> <p>With:</p> <pre><code>my ($newstring = $oldstring) =~ s/foo/bar/; </code></pre> <p>You get:</p> <pre><code>Can't declare scalar assignment in "my" at script.pl line 7, near ") =~" Execution of script.pl aborted due to compilation errors. </code></pre> <p>Instead, the syntax that you have been using, while a line longer, is the syntactically correct way to do it with <code>use strict;</code>. For me, using <code>use strict;</code> is just a habit now. I do it automatically. Everyone should.</p> <pre><code>#!/usr/bin/env perl -wT use strict; my $oldstring = "foo one foo two foo three"; my $newstring = $oldstring; $newstring =~ s/foo/bar/g; print "$oldstring","\n"; print "$newstring","\n"; </code></pre>
4,287
<p>I've been 3D printing as a hobby for a couple of years now, and have always heard how 3D printing is great for prototyping, but once you get beyond 10 or 20 pieces it's just not cost competitive with other technologies. I just accepted this to be truth, and have even told some of the customers I've gotten through 3DHubs and other marketplaces the same thing.</p> <p>Now I'm creating an item for resale and am 3D printing the case. As I'll need 40 - 50 cases at a time I thought I would shop around for other options. But I just received some quotes back on injection molding. The mold price (for half the case) was \$15k, plus \$10 per unit at a quantity of 50 and \$4 per unit at a quantity of 500. Even in the case of the latter, the cost of tooling plus production is \$34/piece. 3D printing the same part myself costs $7 in filament, and paying someone else to 3D print it cost \$28.</p> <p>Keeping in mind that 3D printing allows me to make changes to the design on the fly and print the exact number I need without having to worry about volume discounts, I now wonder if I've just been repeating a common misconception. Is 3D printing really noncompetitive for medium (10-500 pieces) production runs? If so, what makes it noncompetitive, given the extremely high up-front cost of IM?</p>
<h1>TL:DR</h1> <p>3D printing is great for low quantities of items, but terrible for large quantities of items. This is a continuous scale and as your quantity grows, the drawbacks of 3D printing become more pronounced. In your situation, you seem to be dancing in the nebulous zone where there isn't really a good answer as to which production method is better. It's more of a question of price vs speed. <hr/> There are several factors that limit additive manufacturing technologies (in this answer I'll just talk about FDM since you're asking about a plastic item) from being practical in large scale manufacturing. </p> <h1>Time</h1> <p>Compared to injection molding, 3D printing takes a very long time. An injection mold can make <a href="https://www.youtube.com/watch?v=WHwTHarf8Ck" rel="nofollow noreferrer">72 plastic caps in 3 seconds</a>. While I don't have a source, I would expect a similar item to take at least 5 minutes to be printed. In order to produce an average of 24 caps/second, you would need 7,200 3d printers working without down time. That doesn't take into consideration ...</p> <h1>Labor</h1> <p>Every 3d printed object needs to be removed from the print bed by hand. That requires a person to be there ready to remove the item. It's possible to have <a href="http://www.3ders.org/articles/20150419-automate-the-removal-and-3d-printing-of-multiple-objects-with-the-echodrive-add-on.html" rel="nofollow noreferrer">automated print removal</a>, but for now I've yet to see it as a standard option on any machine. An injection model machine can just pop the parts out into a box. Even with the capability to remove the parts extra labor is still required for 3d printing because ...</p> <h1>Quality</h1> <p>Injection molded parts are as smooth as the mold they were made in. While failures still exist even for molded items, their relatively cheap production cost and very quick production time ensure that an occasional failure won't be problematic. 3D printing on the other hand is still prone to <a href="https://all3dp.com/common-3d-printing-problems-3d-printer-troubleshooting-guide/" rel="nofollow noreferrer">variations</a> in the final product. For a few items, it's sensible to hand finish the parts with filing, sanding, or other reductive manufacturing techniques, but for many items this quickly become burdensome. Also, given the long production time compared to injection molding, even 1 discarded product will result in a long time required to produce a replacement.</p>
<p>Break even points have always been dependent on the part. If the goal is to make a rod or filament-like piece of your extrusion nozzle diameter, your extruder may be pretty competitive. Additive manufacture has come a long way already so the break even points may have shifted. Interestingly a great use for additive is to produce tooling.</p> <p>You could for example use the 3D printed part (with non-stick coating) to make a 600 deg F silicone mold from high temp RTV. Presuming you have the heating equipment, that mold can then be used to produce tens of the part at slightly lower quality. As silicone is flexible, it isnt good for high speed/pressure of injection molding.</p> <p>If you are willing to accept lower quality (3d printing with filament is pretty low so that's likely a yes) and your injection molder is willing to go for DMLS molds with minor smoothing/drilling post-operations, your tooling costs may be significantly lower than your original estimate. Chances are this isn't happening unless the injection molder is also an additive enthusiast, and often will have to be one and the same as the person who designed at least some of the 3d printed part.</p>
555
<p>How do I format a string to <a href="http://www.grammar-monster.com/lessons/capital_letters_title_case.htm" rel="noreferrer">title case</a>?</p>
<p>Here is a simple static method to do this in C#:</p> <pre><code>public static string ToTitleCaseInvariant(string targetString) { return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(targetString); } </code></pre>
<p>Without using a ready-made function, a super-simple low-level algorithm to convert a string to title case:</p> <p><pre><code> convert first character to uppercase. for each character in string, if the previous character is whitespace, convert character to uppercase. </pre></code></p> <p>This asssumes the "convert character to uppercase" will do that correctly regardless of whether or not the character is case-sensitive (e.g., '+').</p>
2,316
<p>The version of <strong>Subclipse (1.2.4)</strong> currently available through Aptana's automatic <em>Plugins Manager</em> does not work with the newest version of Subversion.</p> <p>I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a <a href="http://subclipse.tigris.org/update_1.4.x" rel="noreferrer">new remote update site</a> to my Update manager. When I tried to install it, it told me I needed <strong>Mylyn 3.0.0</strong>. So after much searching I found Mylyn 3.0.0 and added <a href="http://download.eclipse.org/tools/mylyn/update/e3.3" rel="noreferrer">another new remote update site</a> to my update manager. Then when I tried to install that, it told me I needed <strong>org.eclipse.ui 3.3.0</strong> or equivalent.</p> <p>Looking at the configuration details for Aptana, it looks like it is built against eclipse 3.2.2.</p> <p>Does anyone know if there is a way to upgrade the version of Eclipse Aptana that is built against to 3.3.0? Or if there is some other way to get Subclipse to work with the very newest version of Subversion?</p> <p>I know this isn't necessarily a "programming" question, but I hope it's ok since it's highly relevant to the programming experience.</p>
<p>Subclipse does not require Mylyn, but the update site includes a plugin that integrates Mylyn and Subclipse. This is intended for people that use Mylyn. In your case, you would want to just de-select Mylyn in the update dialog.</p> <p>Subclipse also requires Subversion 1.5 and the corresponding version of the JavaHL native libraries. I have written the start of an FAQ to help people understand JavaHL and how to get it. See: <a href="http://desktop-eclipse.open.collab.net/wiki/JavaHL" rel="noreferrer">http://desktop-eclipse.open.collab.net/wiki/JavaHL</a></p>
<p>I used the update url and I installed the JavaHL adapter, the Subclipse project itself <b>and</b> the SVNKit adapter BETA.</p> <p>After this it worked fine for me, this is for linux platform hope it works for you.</p>
2,249
<p>I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look "pretty". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser.</p>
<p>Strictly speaking, you need nothing. XML, even without a schema definition, works.</p> <p>A schema definition (in XSD, RelaxNG or DTD) helps various tools that work with the XML, because they can verify that the structure of the XML conforms to what you want.</p> <p>An XSLT translation to HTML is nice if the XML contains information you'll want to look at with a browser. It's far from necessary, though.</p> <p>To query the XML with XPath or XQuery, you need an XPath or XQuery processor.</p>
<p>Strictly speaking, you need nothing. XML, even without a schema definition, works.</p> <p>A schema definition (in XSD, RelaxNG or DTD) helps various tools that work with the XML, because they can verify that the structure of the XML conforms to what you want.</p> <p>An XSLT translation to HTML is nice if the XML contains information you'll want to look at with a browser. It's far from necessary, though.</p> <p>To query the XML with XPath or XQuery, you need an XPath or XQuery processor.</p>
9,048
<p>On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either.</p> <p>I had to do the following to build Apache and mod_rewrite:</p> <pre><code>./configure --prefix=/usr/local/apache2 --enable-rewrite=shared </code></pre> <ul> <li>Is there a way to tell Apache to build all modules as Shared Modules (DSOs) so I can control loading from the Apache config?</li> <li>Now that I have built Apache and the mod_rewrite DSO, how can I build another shared module without building all of Apache?</li> </ul> <p>(The last time I built Apache (2.2.8) on Solaris, by default it built everything as a shared module.)</p>
<p>Try the <code>./configure</code> option <code>--enable-mods-shared="all"</code>, or <code>--enable-mods-shared="&lt;list of modules&gt;"</code> to compile modules as shared objects. See further <a href="http://httpd.apache.org/docs/2.2/programs/configure.html#otheroptfeat" rel="noreferrer">details in Apache 2.2 docs</a></p> <p>To just compile Apache with the ability to load shared objects (and add modules later), use <code>--enable-so</code>, then consult the documentation on compiling modules seperately in the <a href="http://httpd.apache.org/docs/2.2/dso.html" rel="noreferrer">Apache 2.2. DSO docs</a>.</p>
<pre><code>./configure --prefix=/usr/local/apache2 --enable-mods-shared="all" --enable-proxy=shared </code></pre> <p>To get rewrite, proxy and bunch of other modules, I used the above command. In my previous installation, using --enable-mods-shared="all" compiled/installed the proxy module as well. But in <code>v2.2.22</code> "all" did not include the proxy module.</p>
5,774
<p>How do I figure out if an array contains an element? I thought there might be something like <code>[1, 2, 3].includes(1)</code> which would evaluate as <code>true</code>.</p>
<p>Some syntax sugar</p> <pre><code>1 in [1,2,3] </code></pre>
<p>You can also use matches with regular expression like this:</p> <pre><code>boolean bool = List.matches(&quot;(?i).*SOME STRING HERE.*&quot;) </code></pre>
7,514
<p>When I open cmd on my laptop it is defaulting to the F: drive. This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default?</p>
<p>I believe it defaults to <code>%HOMEDRIVE%\%HOMEPATH%</code> so if you can muck about with those environment variables that might be an option. I can't edit these environment variables on my company's network, so I had to use the <a href="http://technet.microsoft.com/en-us/library/cc756720.aspx" rel="nofollow noreferrer">AutoRun</a> to change it to something sane.</p>
<p>If you are opening it from a shortcut change the working dir for the shortcut.</p>
6,598
<p>In MS SQL Server, I create my scripts to use customizable variables:</p> <pre><code>DECLARE @somevariable int SELECT @somevariable = -1 INSERT INTO foo VALUES ( @somevariable ) </code></pre> <p>I'll then change the value of <code>@somevariable</code> at runtime, depending on the value that I want in the particular situation. Since it's at the top of the script it's easy to see and remember.</p> <p>How do I do the same with the PostgreSQL client <code>psql</code>?</p>
<p>Postgres variables are created through the \set command, for example ...</p> <pre><code>\set myvariable value </code></pre> <p>... and can then be substituted, for example, as ...</p> <pre><code>SELECT * FROM :myvariable.table1; </code></pre> <p>... or ...</p> <pre><code>SELECT * FROM table1 WHERE :myvariable IS NULL; </code></pre> <p><em>edit: As of psql 9.1, variables can be expanded in quotes as in:</em> </p> <pre><code>\set myvariable value SELECT * FROM table1 WHERE column1 = :'myvariable'; </code></pre> <p><em>In older versions of the psql client:</em> </p> <p>... If you want to use the variable as the value in a conditional string query, such as ...</p> <pre><code>SELECT * FROM table1 WHERE column1 = ':myvariable'; </code></pre> <p>... then you need to include the quotes in the variable itself as the above will not work. Instead define your variable as such ...</p> <pre><code>\set myvariable 'value' </code></pre> <p>However, if, like me, you ran into a situation in which you wanted to make a string from an existing variable, I found the trick to be this ...</p> <pre><code>\set quoted_myvariable '\'' :myvariable '\'' </code></pre> <p>Now you have both a quoted and unquoted variable of the same string! And you can do something like this ....</p> <pre><code>INSERT INTO :myvariable.table1 SELECT * FROM table2 WHERE column1 = :quoted_myvariable; </code></pre>
<p>I've posted a new solution for this <a href="https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-query/54322738#54322738">on another thread</a>.</p> <p>It uses a table to store variables, and can be updated at any time. A static immutable getter function is dynamically created (by another function), triggered by update to your table. You get nice table storage, plus the blazing fast speeds of an immutable getter.</p>
5,758
<p>How do you set your Cocoa application as the default web browser?</p> <p>I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.).</p>
<p>There are four steps to making an app that can act as the default web browser. The first three steps allow your app to act as a role handler for the relevant URL schemes (HTTP and HTTPS) and the final step makes it the default role handler for those schemes.</p> <p><strong>1) Add the URL schemes your app can handle to your application's info.plist file</strong></p> <p>To add support for <code>http://</code> and <code>https://</code> you'd need to add the following to your application's info.plist file. This tells the OS that your application is capable of handling HTTP and HTTP URLs.</p> <pre class="lang-xml prettyprint-override"><code>&lt;key&gt;CFBundleURLTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleURLName&lt;/key&gt; &lt;string&gt;http URL&lt;/string&gt; &lt;key&gt;CFBundleURLSchemes&lt;/key&gt; &lt;array&gt; &lt;string&gt;http&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;dict&gt; &lt;key&gt;CFBundleURLName&lt;/key&gt; &lt;string&gt;Secure http URL&lt;/string&gt; &lt;key&gt;CFBundleURLSchemes&lt;/key&gt; &lt;array&gt; &lt;string&gt;https&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre> <p><strong>2) Write an URL handler method</strong></p> <p>This method will be called by the OS when it wants to use your application to open a URL. It doesn't matter which object you add this method to, that'll be explicitly passed to the Event Manager in the next step. The URL handler method should look something like this:</p> <pre><code>- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { // Get the URL NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; //TODO: Your custom URL handling code here } </code></pre> <p><strong>3) Register the URL handler method</strong></p> <p>Next, tell the event manager which object and method to call when it wants to use your app to load an URL. In the code here I'm passed <code>self</code> as the event handler, assuming that we're calling <code>setEventHandler</code> from the same object that defines the <code>getUrl:withReplyEvent:</code> method.</p> <p>You should add this code somewhere in your application's initialisation code.</p> <pre><code>NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager]; [em setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; </code></pre> <p>Some applications, including early versions of Adobe AIR, use the alternative WWW!/OURL AppleEvent to request that an application opens URLs, so to be compatible with those applications you should also add the following:</p> <pre><code>[em setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:'WWW!' andEventID:'OURL']; </code></pre> <p><strong>4) Set your app as the default browser</strong></p> <p>Everything we've done so far as told the OS that your application is <em>a browser</em>, now we need to make it <em>the default browser</em>.</p> <p>We've got to use the Launch Services API to do this. In this case we're setting our app to be the default role handler for HTTP and HTTPS links:</p> <pre><code>CFStringRef bundleID = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; OSStatus httpResult = LSSetDefaultHandlerForURLScheme(CFSTR("http"), bundleID); OSStatus httpsResult = LSSetDefaultHandlerForURLScheme(CFSTR("https"), bundleID); //TODO: Check httpResult and httpsResult for errors </code></pre> <p>(It's probably best to ask the user's permission before changing their default browser.)</p> <p><strong>Custom URL schemes</strong></p> <p>It's worth noting that you can also use these same steps to handle your own custom URL schemes. If you're creating a custom URL scheme it's a good idea to base it on your app's bundle identifier to avoid clashes with other apps. So if your bundle ID is <code>com.example.MyApp</code> you should consider using <code>x-com-example-myapp://</code> URLs.</p>
<p>In order to appear as an option on <code>System Preferences &gt; General &gt; Default web browser</code> (at least for macOS 11) you need to add the document types for <strong>HTML</strong> and <strong>XHTML</strong> to the <em>Info.plist</em> (after the 4 steps already described on the <a href="https://stackoverflow.com/a/49512/4691224">accepted answer</a>), like this:</p> <pre><code>&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;HTML document&lt;/string&gt; &lt;key&gt;CFBundleTypeRole&lt;/key&gt; &lt;string&gt;Viewer&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.html&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;XHTML document&lt;/string&gt; &lt;key&gt;CFBundleTypeRole&lt;/key&gt; &lt;string&gt;Viewer&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.xhtml&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre>
7,212
<p>When trying to use <code>libxml2</code> as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.</p> <p>I have installed <code>python25</code> and all <code>libxml2</code> and <code>libxml2-py25</code> related libraries via fink and own the entire path including the library. Any ideas why I'd still need to sudo?</p>
<p>Check your path by running:</p> <pre><code>'echo $PATH' </code></pre>
<p>I would suspect the permissions on the library. Can you do a strace or similar to find out the filenames it's looking for, and then check the permissions on them?</p>
9,402
<p>The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?</p> <p>... or am I just being lazy?</p> <p>Note: rubysspi-1.2.4 does not work.</p> <p>This also works for "igem", part of the IronRuby project</p>
<p>I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my <code>HTTP_PROXY</code> environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:</p> <pre><code>SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT% </code></pre> <p>I set the four referenced variables before I get to this line obviously. As an example if my username is "wolfbyte", my password is "secret" and my proxy is called "pigsy" and operates on port 8080:</p> <pre><code>SET HTTP_PROXY=http://wolfbyte:secret@pigsy:8080 </code></pre> <p>You might want to be careful how you manage that because it stores your password in plain text in the machine's session but I don't think it should be too much of an issue.</p>
<p>for anyone tunnelling with SSH; you can create a version of the <code>gem</code> command that uses SOCKS proxy:</p> <ol> <li>Install <code>socksify</code> with <code>gem install socksify</code> (you'll need to be able to do this step without proxy, at least)</li> <li><p>Copy your existing gem exe</p> <pre><code>cp $(command which gem) /usr/local/bin/proxy_gem </code></pre></li> <li><p>Open it in your favourite editor and add this at the top (after the shebang)</p> <pre><code>require 'socksify' if ENV['SOCKS_PROXY'] require 'socksify' host, port = ENV['SOCKS_PROXY'].split(':') TCPSocket.socks_server = host || 'localhost' TCPSocket.socks_port = port.to_i || 1080 end </code></pre></li> <li><p>Set up your tunnel</p> <pre><code>ssh -D 8123 -f -C -q -N user@proxy </code></pre></li> <li><p>Run your gem command with proxy_gem</p> <pre><code>SOCKS_PROXY=localhost:8123 proxy_gem push mygem </code></pre></li> </ol>
2,642
<p>I currently have an MS Access application that connects to a PostgreSQL database via ODBC. This successfully runs on a LAN with 20 users (each running their own version of Access). Now I am thinking through some disaster recovery scenarios, and it seems that a quick and easy method of protecting the data is to use <a href="http://www.postgresql.org/docs/8.3/static/warm-standby.html" rel="noreferrer">log shipping</a> to create a warm-standby. </p> <p>This lead me to think about putting this warm-standby at a remote location, but then I have the question:</p> <p><strong>Is Access connecting to a remote database via ODBC usable?</strong> I.e. the remote database is maybe in the same country with ok ping times and I have a 1mbit SDSL line.</p>
<p>onnodb,</p> <p>The PostgreSQL ODBC driver is <a href="http://www.postgresql.org/ftp/odbc/versions/msi/" rel="noreferrer">actively developed</a> and an Access front-end combined with PostgreSQL server, in my opinion makes a great option on a LAN for rapid development. I have been involved in a reasonably big system (100+ PostgreSQL tables, 200+ Access forms, 1000+ Access queries &amp; reports) and it has run excellently for a few years, with ~20 users. Any queries running slow because Access is doing something stupid can generally just be solved by using <a href="http://www.postgresql.org/docs/8.3/interactive/sql-createview.html" rel="noreferrer">views</a>, and any really data-intensive code can easily be moved into PostgreSQL functions and then called from Access.</p> <p>The only main ODBC-related issue we have is that there is no way to kill a slow running query from Access, so we do often get users just killing Access and then massive queries are just left executing on the server.</p>
<p>PostgreSQL works great as a backend for MS Access, there are a couple of support functions you should use to make things easier. See here for more info on this:</p> <p><a href="http://www.amsoftwaredesign.com/smf/index.php?board=8.0" rel="nofollow noreferrer">http://www.amsoftwaredesign.com/smf/index.php?board=8.0</a></p>
5,884
<p>I want to link to a specific slide in an online PowerPoint file, (e.g. <code>http://www.example.com/hello.ppt</code>) but what I want is that when people click on my link, it goes straight to the nth slide.</p> <p>Is this possible?</p>
<p>Link to </p> <p><a href="http://www.whatever.com/hello.ppt" rel="nofollow noreferrer">http://www.whatever.com/hello.ppt</a><strong>#4</strong> </p> <p>for slide 4 to be opened initially.</p> <p>Take a look at this site: <a href="http://www.tinyempire.com/shortnotes/files/specific_slide_in_ppt.htm" rel="nofollow noreferrer">http://www.tinyempire.com/shortnotes/files/specific_slide_in_ppt.htm</a></p>
<p>The following method applies to any online version of PowerPoint (e.g. Office 365).</p> <ol> <li>Open the powerpoint file in your browser (the link could look like this: <a href="http://YourCompany.sharepoint.com/:p:/r/sites/SiteName/.." rel="nofollow noreferrer">http://YourCompany.sharepoint.com/:p:/r/sites/SiteName/..</a>.)</li> <li>In the thumbnails list (on the left), right-click on the slide you want to refer to and choose "link to this slide" (free translation, my version is in Dutch "Koppeling naar deze dia")</li> <li>In the pop-up screen, you can choose to share a read-only or an editable version</li> </ol>
2,362
<p>A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth.</p> <p>Is this true? How's this technique named?</p>
<p>There is a technique called "<a href="http://en.wikipedia.org/wiki/Hole_punching" rel="nofollow noreferrer">Hole Punching</a>" that works well with "Cone" NAT (Cone is a technical familly of router). That's not an 100% sure technique, today, it works well with UDP on about 80% of the router.</p> <p>There is some implementations of library to realize Hole Punching: <a href="http://sourceforge.net/projects/stun/" rel="nofollow noreferrer">STUN</a> (<a href="http://en.wikipedia.org/wiki/STUN" rel="nofollow noreferrer">wikipedia</a>)</p>
<p>This is true. It's the way <a href="https://www.copilot.com/" rel="nofollow noreferrer">FogCreek Copilot</a> works</p> <p>Take a look at item 2 on Joel's <a href="http://www.joelonsoftware.com/items/2007/01/26.html" rel="nofollow noreferrer">Copilot 2.0 post</a>.</p>
6,587
<p>Particularly, what is the best snippets package out there?</p> <p>Features:</p> <ul> <li>easy to define new snippets (plain text, custom input with defaults)</li> <li>simple navigation between predefined positions in the snippet</li> <li>multiple insertion of the same custom input</li> <li>accepts currently selected text as a custom input</li> <li><em>cross-platform</em> (Windows, Linux)</li> <li>dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred)</li> <li>nicely coexists with others packages in Emacs</li> </ul> <p>Example of code template, a simple <code>for</code> loop in C:</p> <pre><code>for (int i = 0; i &lt; %N%; ++i) { _ } </code></pre> <p>It is a lot of typing for such common code. I want to invoke a code template or snippet which inserts that boilerplate code for me. Additionally it stops (on TAB or other keystroke) at <code>%N%</code> (my input replaces it) and final position of the cursor is <code>_</code>. </p>
<p><a href="http://manual.macromates.com/en/snippets" rel="nofollow noreferrer">TextMate's snippets</a> is the most closest match but it is not a cross-platform solution and not for Emacs.</p> <p>The second closest thing is <a href="http://github.com/joaotavora/yasnippet/" rel="nofollow noreferrer" title="Yet Another Snippet Package for Emacs">YASnippet</a> (<a href="http://www.youtube.com/watch?v=vOj7btx3ATg" rel="nofollow noreferrer" title="yasnippet screencast">screencast</a> shows the main capabilities). But it interferes with <code>hippie-expand</code> package in my setup and the embedded language is EmacsLisp which I'm not comfortable with outside <code>.emacs</code>.</p> <p><strong>EDIT</strong>: Posted my answer here to allow voting on <code>YASnippet</code>.</p>
<p>You can try a lightweight solution <a href="https://github.com/jiahaowork/muban.el" rel="nofollow noreferrer">muban.el</a></p> <p>It is written completely in Elisp and has a very simple syntax.</p>
8,668
<p>I've been fighting on and off with issues with my build plate seemingly not being perfectly flat. I've ordered a machined straight-edge and some new feeler gauges to diagnose the problem (and test any potential replacement) better, but I'd like to get an idea of what options are available for obtaining a flatter build surface. I'm not really interested in approaches like BLTouch since I want accurate flat bottoms on my prints, not just consistent adhesion.</p> <p>My printer is an Ender 3 and I believe my problem is a mix of wear to the Buildtak clone surface and warping in its backing plate. Mine is the newer model with removable buildplate and clips, and the backing is <a href="https://www.reddit.com/r/3Dprinting/comments/9quifs/having_trouble_finding_ender_3_replacement/" rel="nofollow noreferrer">reportedly</a> a "glass fiber" (FR-4) material that's hard to find genuine replacements for.</p> <p>Glass seems like an obvious option - I might even put a buildtak clone on one side of it and use that most of the time - but I'm somewhat concerned about weight and whether having glass moved by the Y axis is going to limit acceleration. I've had (seemingly unrelated) problems on and off with layer shifts, which seem to be mostly Marlin's fault not mechanical, but I'm scared to introduce another factor that might encourage them.</p> <p>Are there other non-glass options I should consider that would provide a rigid, flat backing? I'm very happy with the buildtak clones and their adhesion properties, so my leaning it to look for something that makes a good backing for them rather than a material that's intended to be built directly upon.</p> <p><strong>Measurement results:</strong> Using a machined straightedge and feeler gauges, the surface seems to be at least 0.10 mm but less than 0.15 mm lower within a couple inches of the bed center. This is plausibly just wear on the buildtak-clone surface, so I think I'll try to see if I can get by with just replacing that for now. But I'm still interested in the general topic of the question.</p>
<h2>It all depends on what you mean by "flat".</h2> <p>Is the problem that the build plate isn't flat (perfectly planar), or is the problem that the distance to the build plate varies based on X and Y coordinates? They are very different problems.</p> <p>"Bed Leveling" is the process of allowing the firmware to know the Z position of the build plate for every (X,Y) location. Some printers support measuring a mesh of points and interpolating the mesh. This compensates quite well both for warped build plate, and for bad positioning mechanisms which add some position dependent Z-axis offset.</p> <p>If you really need a flat, planar, build surface, perhaps because you are printing mirrors or precision parts, glass should work well. It is still, and will not brook any inelastic bending. It will shatter before it takes on a curve. If possible, you could consider a Pyrex® bed, since it has a lower coefficient of thermal expansion and won't warp as much with a temperature gradient through the glass. </p> <p>I tried to find a spec on how flat your glass might be. I'm assuming it is "float glass", which is made by floating molten glass on a pool of molten tin. I didn't find a spec, but I found this answer to a similar question:</p> <blockquote> <p>I doubt you will find such a spec- float glass isn't manufactured for that purpose and it isn't really in the manufacturer's interests to maintain such a spec. that said, the stuff is surprisingly flat, just as a side effect of how it's made. you don't say what your needs are other than <em>near optical tolerances</em> . might just be good enough for you. consider though that granite surface plates of certified flatness can be had fairly inexpensively these days.</p> </blockquote> <p>So, it is clearly flat. I can't tell you how flat. And the flatness depends on not applying stress to the glass that causes it to bed. Thicker is stiffer (probably at the third power of the thickness ratio).</p>
<p>For evaluating the extent of a surface flatness problem and success of a solution, a real machined straightedge and decent feeler gauges are a huge help.</p> <p>Using them to measure where the problem was, I found that a not-perfectly-flat but non-rigid build surface like the one I have can be corrected with shims, at least as long as the underlying bed is not warped. I measured the error in the center of the build surface as very close to 0.1 mm, and placed a 24x24 mm square of 0.1 mm thickness blue tape on the aluminum bed under the removable build plate, then clipped it back on. Measuring again with the straightedge showed no significant inconsistencies.</p> <p>As a bonus, the feeler gauges are wonderful for height adjustment. After confirming flatness, I needed to re-level the build, and got it perfect on the first try with no trial-and-error feedback loop by homing the nozzle, then moving it to Z=0.1, and then at each adjustment point, adjusting until:</p> <ol> <li>the 0.1 mm feeler gauge could slip under the nozzle with some pressure, but without compressing the spring, and</li> <li>the 0.15 mm feeler gauge could not slip under the nozzle without visibly lowering the bed and compressing the spring</li> </ol> <p>I'm still interested in other options that might be lower-maintenance.</p>
1,589
<p>I have been working on a web services related project for about the last year. Our team found <a href="http://www.soapui.org" rel="noreferrer">soapUI</a> near the start of our project and we have been <em>mostly</em>(*) satisfied with it (the free version, that is).</p> <p>My question is: are there other tools/clients/frameworks that you have used/currently use for web services testing and would recommend?</p> <p>(*) There are some weird GUI glitches that appear once in a while. As is mentioned by some of the answers, we attributed this to a memory leak.</p>
<p>I use soapUI, and it's generally pretty good. Be aware that it seems to leak memory, and eventually it will no longer save your project, so save regularly!</p> <p>This is about the only hassle I have with it (other than the general ugliness that almost every Java application has!), and I can't live without it.</p>
<p>We've been using SoapUI since 1.x (will soon be adopting 3.0 from 2.5.1) and are all happy. It's much more stable when running with native LnF (File - Preferences - UI Settings - Native LF). I know it's available as an Eclipse plugin as well, but last I tried I failed to find how to add JAR-files to it (i.e. bin/ext in the stand-alone variant).</p>
5,196
<p>I am using StretchImage because the box is resizable with splitters. It looks like the default is some kind of smooth bilinear filtering, causing my image to be blurry and have moire patterns. </p>
<p>I needed this functionality also. I made a class that inherits PictureBox, overrides <code>OnPaint</code> and adds a property to allow the interpolation mode to be set:</p> <pre><code>using System.Drawing.Drawing2D; using System.Windows.Forms; /// &lt;summary&gt; /// Inherits from PictureBox; adds Interpolation Mode Setting /// &lt;/summary&gt; public class PictureBoxWithInterpolationMode : PictureBox { public InterpolationMode InterpolationMode { get; set; } protected override void OnPaint(PaintEventArgs paintEventArgs) { paintEventArgs.Graphics.InterpolationMode = InterpolationMode; base.OnPaint(paintEventArgs); } } </code></pre>
<p>When resizing an image in .net, the System.Drawing.Drawing2D.InterpolationMode offers the following resize methods:</p> <ul> <li>Bicubic</li> <li>Bilinear</li> <li>High</li> <li>HighQualityBicubic</li> <li>HighQualityBilinear</li> <li>Low</li> <li>NearestNeighbor</li> <li>Default</li> </ul>
4,885
<p>Is there any way to use this kind of format in .Net (C#)? I want to use the same skin format that uTorrent uses in my app, but i can't get the transparent background. Any ideas? Thanks for your time.</p>
<p>The PixelFormat enumeration lists the formats of 'bitmaps' you can create in .Net, so you'd want PixelFormat.Format32bppArgb:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/3z132tat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/3z132tat.aspx</a></p> <p>However I'm not entirely sure that the BMP file format supports transparency - so you would have to save the file as perhaps a PNG file instead.</p>
<p>The PixelFormat enumeration lists the formats of 'bitmaps' you can create in .Net, so you'd want PixelFormat.Format32bppArgb:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/3z132tat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/3z132tat.aspx</a></p> <p>However I'm not entirely sure that the BMP file format supports transparency - so you would have to save the file as perhaps a PNG file instead.</p>
6,283
<p>I've used the CF <a href="http://blogs.msdn.com/stevenpr/archive/2006/04/17/577636.aspx" rel="nofollow noreferrer">Remote Performance Monitor</a>, however this seems to only track memory initialised in the managed world as opposed to the unmanaged world. Well, I can only presume this as the numbers listed in the profiler are way short of the maximum allowed (32mb on CE 5). Profiling a particular app with the RPM showed me that the total usage of all the caches only manages to get to about 12mb and then slowly shrinks as (I assume) something unmanaged starts to claim more memory. The memory slider in System also shows that the device is very short on memory. If I kill the process the slider shows all the memory coming back. So it must (?) be this managed process that is swallowing the memory.</p> <p>Is there any simple(ish?) fashion how one can track unmanaged memory usage in some way that might enable me to match it up with the corresponding P/Invoke calls?</p> <p><strong>EDIT: To all you re-taggers it isn't .NET</strong>, tagging the question like this confuses things. It's .NETCF / Compact Framework. I know they appear to be similar but they're different because .NET rocks whereas CF is basically just a wrapper around NotImplementedException.</p>
<p>Try enabling <a href="http://blogs.msdn.com/stevenpr/archive/2005/06/22/431612.aspx" rel="nofollow noreferrer">Interop logging</a>.</p> <p>Also, if you have access to the code of the native dll you are using, check this out: <a href="http://msdn.microsoft.com/en-us/netframework/bb630228.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/netframework/bb630228.aspx</a></p>
<p>I've definitely been fighting with unmanaged issues in a C# managed app for a while -- it's not easy. </p> <p>What I've found to be most helpful is to have a regular output to a text log file. For example you can print the output of <a href="http://msdn.microsoft.com/en-us/library/aa908760.aspx" rel="nofollow noreferrer">GlobalMemoryStatus</a> every couple of minutes along with logging every time you load a new form. From there you can at least see that either memory gradually erodes, or a huge chunks of memory disappeared at specific times of the day.</p> <p>For us, we found a gradual memory loss all day as long as the device was being used. From there we eventually found that the barcode scanning device was being initialized for no particular reason in our Form base class (I blame the previous developer! :-)</p> <p>Setting up this logging may be a small hassle, but for us it paid huge dividends in the long run especially with the device in live use we can get real data, instrumentation, stack traces from exceptions, etc.</p>
3,153
<p>Is there any way to use inheritance in database (Specifically in SQL Server 2005)?</p> <p>Suppose I have few field like <strong>CreatedOn</strong>, <strong>CreatedBy</strong> which I want to add on all of my entities. I looking for an alternative way instead of adding these fields to every table.</p>
<p>There is no such thing as inheritance between tables in SQL Server 2005, and as noted by the others, you can get as far as getting help adding the necessary columns to the tables when you create them, but it won't be inheritance as you know it.</p> <p>Think of it more like a template for your source code files.</p> <p>As GateKiller mentions, you can create a table containing the shared data and reference it with a foreign key, but you'll either have to have audit hooks, triggers, or do the update manually.</p> <p>Bottom line: Manual work.</p>
<p>You could create a template in the template pane in Management Studio. And then use that template every time you want to create a new table.</p> <p>Failing that, you could store the CreatedOn and CreatedBy fields in an Audit trail table referencing the original table and id.</p> <p>Failing that, do it manually.</p>
2,764
<p>I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class and just an old school for loop</p>
<p>Using the new <code>for (... in ...)</code> syntax in Objective-C 2.0 is generally the fastest way to iterate over a collection because it can maintain a buffer on the stack and get batches of items into it.</p> <p>Using <code>NSEnumerator</code> is generally the slowest way because it often copies the collection being iterated; for immutable collections this can be cheap (equivalent to <code>-retain</code>) but for mutable collections it can cause an immutable copy to be created.</p> <p>Doing your own iteration — for example, using <code>-[NSArray objectAtIndex:]</code> — will generally fall somewhere in between because while you won't have the potential copying overhead, you also won't be getting batches of objects from the underlying collection.</p> <p>(PS - This question should be tagged as Objective-C, not C, since <code>NSEnumerator</code> is a Cocoa class and the new <code>for (... in ...)</code> syntax is specific to Objective-C.)</p>
<p>They are very similar. With Objective-C 2.0 most enumerations now default to <code>NSFastEnumeration</code> which creates a buffer of the addresses to each object in the collection that it can then deliver. The one step that you save over the classic for loop is not having to call <code>objectAtIndex:i</code> each time inside the loop. The internals of the collection you are enumerating implement fast enumeration with out calling <code>objectAtIndex:i method</code>.</p> <p>The buffer is part of the reason that you can't mutate a collection as you enumerate, the address of the objects will change and the buffer that was built will no longer match. </p> <p>As a bonus the format in 2.0 looks as nice as the classic for loop:</p> <pre><code>for ( Type newVariable in expression ) { stmts } </code></pre> <p>Read the following documentaion to go deeper: <a href="https://developer.apple.com/library/ios/documentation/Cocoa/Reference/NSFastEnumeration_protocol/index.html" rel="nofollow noreferrer">NSFastEnumeration Protocol Reference</a></p>
5,297
<p>My web application generates pdf files and either e-mails or faxes them to our customers. Somehow IIS6 is keeping hold of the file and blocking any other requests for it claiming the old '..the process cannot access the file 'xxx.pdf' because it is being used by another process.'</p> <p>When I recycle the application pool all is ok. Does anybody know why this is happening and how can I stop it.</p> <p>Thanks</p>
<p>As with everyone said, do call the <code>Close</code> and <code>Dispose</code> method on any IO objects you have open when reading/writing the PDF files.</p> <p>But I suppose you'd incorporated a <strong>3rd party component?</strong> to do the PDF writing for you? If that's the case you might want to check with the vendor and/or its documentation to make sure that you are doing things in the way the vendors intended them to be. Don't trust the black box you got from someone else unless it has proven itself.</p> <p>Another place to look might be what happens during multiple web request to the PDF files, are you sure that the file is not written simultaneously from multiple places? e.g. 2-3 requests genrating PDF simultaneously? or 2-3 pages along the PDF generation process?</p> <p>And lastly, you might want to check the exception logs to make sure that nothing is crashing/thread exiting and leaving the file handle open without you noticing it. It happens a lot in multiple threading scenarios, sometimes the thread just crashes and exits - which could happen especially if you use 3rd party components, they might be performing some <em>magic</em> tricks, you'd never know.</p>
<p>I'd look through your code and make sure all handles to open (generated) files have been closed properly. Sometimes you just can't rely on the garbage collector to sort these things out.</p>
9,752
<p>I have inherited an old crusty <code>PHP application</code>, and I'd like to refactor it into something a little nicer to deal with, but in a gradual manner. In perl's CPAN, there is a series of classes around Class::DBI that allow you to use database rows as the basis for objects in your code, with the library generating <code>accessor methods</code> etc as appropriate, but also allowing you to add additional methods.</p> <p>Does anyone know of something like this for PHP? Especially something that doesn't require wholesale adoption of a "framework"... bonus points if it works in PHP4 too, but to be honest, I'd love to have another reason to ditch that. :-)</p>
<p>It's now defunct but <a href="http://phpdbi.sourceforge.net/web/" rel="nofollow noreferrer">phpdbi</a> is possibly worth a look. If you're willing to let go of some of your caveats (the framework one), I've found that <a href="http://www.phpdoctrine.org/" rel="nofollow noreferrer">Doctrine</a> is a pretty neat way of accessing DBs in PHP. Worth investigating anyway.</p>
<p>The right thing to is to access the database via an abstraction layer in a way such if you change your RDBMS or how you implemented that access, you only have to modify this layer while all the rest of your application remains untouched. </p> <p>To do this, to free your application from knowing how to deal with the database, your abstraction layer for DB access must be implemented by a framework such as <a href="http://adodb.sourceforge.net/" rel="nofollow noreferrer">ADODB</a>. </p> <p>All the files related to this layer must be located in a sub directory:</p> <ul> <li>/ado</li> </ul> <p>In this directories you'll put all of your .php.inc files which contains general methods to access the database.</p>
2,973
<p>I have some strings of xxh:yym format where xx is hours and yy is minutes like "05h:30m". What is an elegant way to convert a string of this type to TimeSpan?</p>
<p>This seems to work, though it is a bit hackish:</p> <pre><code>TimeSpan span; if (TimeSpan.TryParse("05h:30m".Replace("m","").Replace("h",""), out span)) MessageBox.Show(span.ToString()); </code></pre>
<p>Are <a href="http://msdn.microsoft.com/en-us/library/system.timespan.parse.aspx" rel="nofollow noreferrer">TimeSpan.Parse</a> and <a href="http://msdn.microsoft.com/en-us/library/system.timespan.tryparse.aspx" rel="nofollow noreferrer">TimeSpan.TryParse</a> not options? If you aren't using an "approved" format, you'll need to do the parsing manually. I'd probably capture your two integer values in a regular expression, and then try to parse them into integers, from there you can create a new TimeSpan with its constructor.</p>
4,633
<p>I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add <em>typed</em> properties, so that the "value" returned is always of the type that I want it to be.</p> <p>The type should always be a primitive. This class subclasses an abstract class which basically stores the name and value as string. The idea being that this subclass will add some type-safety to the base class (as well as saving me on some conversion).</p> <p>So, I have created a class which is (roughly) this:</p> <pre><code>public class TypedProperty&lt;DataType&gt; : Property { public DataType TypedValue { get { // Having problems here! } set { base.Value = value.ToString();} } } </code></pre> <p>So the question is:</p> <p><strong>Is there a "generic" way to convert from string back to a primitive?</strong></p> <p>I can't seem to find any generic interface that links the conversion across the board (something like <em>ITryParsable</em> would have been ideal!).</p>
<p>I am not sure whether I understood your intentions correctly, but let's see if this one helps.</p> <pre><code>public class TypedProperty&lt;T&gt; : Property where T : IConvertible { public T TypedValue { get { return (T)Convert.ChangeType(base.Value, typeof(T)); } set { base.Value = value.ToString();} } } </code></pre>
<pre><code>public class TypedProperty&lt;T&gt; : Property { public T TypedValue { get { return (T)(object)base.Value; } set { base.Value = value.ToString();} } } </code></pre> <p>I using converting via an object. It is a little bit simpler.</p>
3,007
<p>Is there a simpler interface for end users to run "queries" on pre-existing SqlServer Analysis Service cubes? I'm looking for a way to deploy the cubes and allow the users to work with the data through a simpler interface than BIDS. Is this even possible?</p>
<p>I would recommend Excel too. It is an environment that your users are familiar with anyway, and they will be able to perform additional analysis (totals etc) without learning any new interfaces.</p> <p>However, I would advise against pivot tables as a method of getting the data into Excel. I once worked on a project using pivot tables, and it was a filthy nightmare. The more recent versions of Office have a slightly different tool called "Microsoft Office Excel Add-in for SQL Server Analysis Services" which can get OLAP data into Excel. I downloaded <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=DAE82128-9F21-475D-88A4-4B6E6C069FF0&amp;displaylang=en" rel="nofollow noreferrer">XLAddinSetup.msi for Excel 2002/3</a> or you can use <a href="http://office.microsoft.com/en-us/excel/HP101672991033.aspx" rel="nofollow noreferrer">this method for Excel 2007</a>.</p>
<p>Dundas has a set of tools that let you drag and drop dimensions/hierarchies/measures to create visualizations like charts and/or grids. The product name is Dundas Chart for ASP.NET Enterprise Edition, and it has a free demo.</p> <p>ProClarity also had a suite of tools. Not sure how you get those tools any longer, but I think they are part of MSDN now.</p>
7,244
<p>If one Googles for "difference between <code>notify()</code> and <code>notifyAll()</code>" then a lot of explanations will pop up (leaving apart the javadoc paragraphs). It all boils down to the number of waiting threads being waken up: one in <code>notify()</code> and all in <code>notifyAll()</code>.</p> <p>However (if I do understand the difference between these methods right), only one thread is always selected for further monitor acquisition; in the first case the one selected by the VM, in the second case the one selected by the system thread scheduler. The exact selection procedures for both of them (in the general case) are not known to the programmer.</p> <p>What's the <strong>useful</strong> difference between <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html#notify%28%29" rel="noreferrer">notify()</a> and <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html#notifyAll%28%29" rel="noreferrer">notifyAll()</a> then? Am I missing something?</p>
<blockquote> <p>However (if I do understand the difference between these methods right), only one thread is always selected for further monitor acquisition.</p> </blockquote> <p>That is not correct. <code>o.notifyAll()</code> wakes <em>all</em> of the threads that are blocked in <code>o.wait()</code> calls. The threads are only allowed to return from <code>o.wait()</code> one-by-one, but they each <em>will</em> get their turn.</p> <hr> <p>Simply put, it depends on why your threads are waiting to be notified. Do you want to tell one of the waiting threads that something happened, or do you want to tell all of them at the same time?</p> <p>In some cases, all waiting threads can take useful action once the wait finishes. An example would be a set of threads waiting for a certain task to finish; once the task has finished, all waiting threads can continue with their business. In such a case you would use <b>notifyAll()</b> to wake up all waiting threads at the same time.</p> <p>Another case, for example mutually exclusive locking, only one of the waiting threads can do something useful after being notified (in this case acquire the lock). In such a case, you would rather use <b>notify()</b>. Properly implemented, you <i>could</i> use <b>notifyAll()</b> in this situation as well, but you would unnecessarily wake threads that can't do anything anyway.</p> <hr> <p>In many cases, the code to await a condition will be written as a loop:</p> <pre><code>synchronized(o) { while (! IsConditionTrue()) { o.wait(); } DoSomethingThatOnlyMakesSenseWhenConditionIsTrue_and_MaybeMakeConditionFalseAgain(); } </code></pre> <p>That way, if an <code>o.notifyAll()</code> call wakes more than one waiting thread, and the first one to return from the <code>o.wait()</code> makes leaves the condition in the false state, then the other threads that were awakened will go back to waiting.</p>
<p>Waking up all does not make much significance here. wait notify and notifyall, all these are put after owning the object's monitor. If a thread is in the waiting stage and notify is called, this thread will take up the lock and no other thread at that point can take up that lock. So concurrent access can not take place at all. As far as i know any call to wait notify and notifyall can be made only after taking the lock on the object. Correct me if i am wrong.</p>
5,764
<p>I am implementing a HttpRequestValidationException in my Application_Error Handler, and if possible, I want to display a custom message.</p> <p>Now, I'm thinking about the StatusCode. In my current example, it sends a 200, which I think should not be done. I would like to send the (IMHO) more appropriate 400 Bad Request instead. However, at the same time, I would like to use Response.Write to enter a custom message. Firefox displays it properly, but IE7 gives me the Default unhelpful Internet Explorer Error Page.</p> <p>On one side, I guess that Internet Explorer just assumes that everything &lt;&gt; 200 is simply not having any &quot;good&quot; content, and the <a href="https://www.rfc-editor.org/rfc/rfc2616#section-10.4.1" rel="nofollow noreferrer">RFC is not really clear</a> here.</p> <p>So I just wonder, is sending a HTTP 200 for an Error Page caused by a HttpRequestValidationException good practice or not? Are there good alternatives?</p>
<p>An HTTP 200 Response Code does not indicate an error. It indicates that everything was OK. You should not use a 200 response code for an error. </p> <p>Internet Explorer shows its "Friendly Errors" page if the response is less than 512 bytes. Here's more on this issue: <a href="http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx</a>,</p>
<p>No, it's certainly not a good practice. 2XX status codes mean (among other things) that the <strong>request is valid</strong>. Which is just the contrary to raising a HttpRequestValidationException.</p> <p>I don't know how to make IE behave correctly, sadly. A slightly better way than to send a 200 would be to redirect it to an error page, but still far from perfect.</p>
7,352
<p>Is it possible to look back through the history of a Subversion repository for files of a certain name (even better would be for them to have a wildcard search)?</p> <p>I want to see if a <code>.bat</code> file has been committed to the repository at some point in the past but has since been removed in later updates. Even a dump of the file history at each revision would work, as I could just grep the output. I have looked through the manual but could not see a good way to do this.</p> <p>The logs for each commit are descriptive, so I cannot just look through the log messages to see what modifications were done. I presume Subversion does have a way of retrieving this?</p>
<p>TortoiseSVN can search the logs very easily, and on my system I can enter ".plg" in the search box and find all adds, modifies, and deletes for those files.</p> <p>Without Tortoise, the only way I can think of doing that would be to grep the full logs or parse the logs and do your own searching for 'A' and 'D' indicators on the file you are looking for (use <code>svn log --verbose</code> to get file paths).</p> <pre> svn log --verbose | grep .bat </pre>
<p>Personally I'd use</p> <pre><code>svnadmin dump -r1:HEAD /path/to/repo/ </code></pre> <p>Pipe it into less and search or grep with some context.</p>
4,018
<p>What is the difference between <code>UNION</code> and <code>UNION ALL</code>?</p>
<p><code>UNION</code> removes duplicate records (where all columns in the results are the same), <code>UNION ALL</code> does not.</p> <p>There is a performance hit when using <code>UNION</code> instead of <code>UNION ALL</code>, since the database server must do additional work to remove the duplicate rows, but usually you do not want the duplicates (especially when developing reports).</p> <p>To identify duplicates, records must be comparable types as well as compatible types. This will depend on the SQL system. For example the system may truncate all long text fields to make short text fields for comparison (MS Jet), or may refuse to compare binary fields (ORACLE)</p> <h3>UNION Example:</h3> <pre><code>SELECT 'foo' AS bar UNION SELECT 'foo' AS bar </code></pre> <p><strong>Result:</strong></p> <pre><code>+-----+ | bar | +-----+ | foo | +-----+ 1 row in set (0.00 sec) </code></pre> <h3>UNION ALL example:</h3> <pre><code>SELECT 'foo' AS bar UNION ALL SELECT 'foo' AS bar </code></pre> <p><strong>Result:</strong></p> <pre><code>+-----+ | bar | +-----+ | foo | | foo | +-----+ 2 rows in set (0.00 sec) </code></pre>
<p><code>UNION ALL</code> also works on more data types as well. For example when trying to union spatial data types. For example: </p> <pre><code>select a.SHAPE from tableA a union select b.SHAPE from tableB b </code></pre> <p>will throw</p> <p><code>The data type geometry cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable.</code></p> <p>However <code>union all</code> will not.</p>
7,253
<p>Alright, so maybe I shouldn't have shrunk this question sooo much... I have seen the post on <a href="https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers">the most efficient way to find the first 10000 primes</a>. I'm looking for <strong>all possible ways</strong>. The goal is to have a one stop shop for primality tests. Any and all tests people know for finding prime numbers are welcome.</p> <p>And so:</p> <ul> <li><strong>What are all the different ways of finding primes?</strong></li> </ul>
<p><a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow noreferrer">The Sieve of Eratosthenes</a> is a decent algorithm:</p> <blockquote> <ol> <li>Take the list of positive integers 2 to any given Ceiling.</li> <li>Take the next item in the list (2 in the first iteration) and remove all multiples of it (beyond the first) from the list.</li> <li>Repeat step two until you reach the given Ceiling.</li> <li>Your list is now composed purely of primes.</li> </ol> </blockquote> <p>There is a functional limit to this algorithm in that it exchanges speed for memory. When generating very large lists of primes the memory capacity needed skyrockets.</p>
<p>If you're wanting to find a way of generating prime numbers, this have been covered in a <a href="https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers#2753">previous question</a>.</p>
2,891
<p>Which OS do you prefer to program on? Client or Server</p> <p>There is a school of though that if you are doing (mostly) web programming (or other server based code), you should use a server OS for your dev machine, since that's closer to the environment where your app will be running.</p> <p>Update: I should add, this is really directed to the Windows crowd </p>
<p>OK, I know you're mainly talking about windows but...</p> <p>I used to develop on windows for deployment on *nix servers. Sure there were <em>lots</em> of gotchas with this way of working, but you just kind of get used to it. </p> <p>In October 2005 I switched to Linux, initially as an experiment, but I never went back. There was a steep learning curve. I thought I knew *nix pretty well after 10 years of dealing with it, but I knew nothing compared with the amount I learned using it on my desktop machine. </p> <p>Workflow has been so much smoother developing and deploying to similar platforms. </p> <p>More recently, we have even started to pick servers running Ubuntu server, so that they most closely match our Ubuntu desktop development machines. </p> <p>If you are talking about the difference between a desktop and a server edition, I'd guess you needn't worry about it. If you're developing on one OS for deployment on another, I'd consider changing your desktop platform.</p>
<p>Regardless of the operating system you're actually talking about, it shouldn't matter. Most applications you might write won't need to worry about the differences (if there indeed are any). Only in rare cases might you use some specific functionality that might only be available on a "server" edition of your OS.</p> <p>There are other considerations, for example Windows server editions are tuned by default to give less priority and attention to desktop programs, and more attention to things like the file cache. Personally, I would always choose a "client" edition of my chosen OS.</p>
8,280
<p>I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table:</p> <pre><code>ID COMPANY_ID EMPLOYEE 1 1 Anna 2 1 Bill 3 2 Carol 4 2 Dave </code></pre> <p>and I wanted to group by company_id to get something like:</p> <pre><code>COMPANY_ID EMPLOYEE 1 Anna, Bill 2 Carol, Dave </code></pre> <p>There is a built-in function in mySQL to do this <a href="http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat" rel="noreferrer">group_concat</a></p>
<h3>PostgreSQL 9.0 or later:</h3> <p>Modern Postgres (since 2010) has the <a href="http://www.postgresql.org/docs/current/static/functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE" rel="noreferrer"><code>string_agg(expression, delimiter)</code></a> function which will do exactly what the asker was looking for:</p> <pre><code>SELECT company_id, string_agg(employee, ', ') FROM mytable GROUP BY company_id; </code></pre> <p>Postgres 9 also added the ability to specify an <code>ORDER BY</code> clause <a href="https://www.postgresql.org/docs/current/static/sql-expressions.html#SYNTAX-AGGREGATES" rel="noreferrer">in any aggregate expression</a>; otherwise you have to order all your results or deal with an undefined order. So you can now write:</p> <pre><code>SELECT company_id, string_agg(employee, ', ' ORDER BY employee) FROM mytable GROUP BY company_id; </code></pre> <h3>PostgreSQL 8.4.x:</h3> <p>PostgreSQL 8.4 (in 2009) introduced <a href="http://www.postgresql.org/docs/8.4/interactive/functions-aggregate.html" rel="noreferrer" title="array_agg(expression)">the aggregate function <code>array_agg(expression)</code></a> which collects the values in an array. Then <code>array_to_string()</code> can be used to give the desired result:</p> <pre><code>SELECT company_id, array_to_string(array_agg(employee), ', ') FROM mytable GROUP BY company_id; </code></pre> <h3>PostgreSQL 8.3.x and older:</h3> <p>When this question was originally posed, there was no built-in aggregate function to concatenate strings. The simplest custom implementation (<a href="http://archives.postgresql.org/pgsql-novice/2003-09/msg00177.php" rel="noreferrer">suggested by Vajda Gabo in this mailing list post</a>, among many others) is to use the built-in <code>textcat</code> function (which lies behind the <code>||</code> operator):</p> <pre><code>CREATE AGGREGATE textcat_all( basetype = text, sfunc = textcat, stype = text, initcond = '' ); </code></pre> <p><a href="http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html" rel="noreferrer">Here is the <code>CREATE AGGREGATE</code> documentation.</a></p> <p>This simply glues all the strings together, with no separator. In order to get a &quot;, &quot; inserted in between them without having it at the end, you might want to make your own concatenation function and substitute it for the &quot;textcat&quot; above. Here is one I put together and tested on 8.3.12:</p> <pre><code>CREATE FUNCTION commacat(acc text, instr text) RETURNS text AS $$ BEGIN IF acc IS NULL OR acc = '' THEN RETURN instr; ELSE RETURN acc || ', ' || instr; END IF; END; $$ LANGUAGE plpgsql; </code></pre> <p>This version will output a comma even if the value in the row is null or empty, so you get output like this:</p> <pre><code>a, b, c, , e, , g </code></pre> <p>If you would prefer to remove extra commas to output this:</p> <pre><code>a, b, c, e, g </code></pre> <p>Then add an <code>ELSIF</code> check to the function like this:</p> <pre><code>CREATE FUNCTION commacat_ignore_nulls(acc text, instr text) RETURNS text AS $$ BEGIN IF acc IS NULL OR acc = '' THEN RETURN instr; ELSIF instr IS NULL OR instr = '' THEN RETURN acc; ELSE RETURN acc || ', ' || instr; END IF; END; $$ LANGUAGE plpgsql; </code></pre>
<p>According to version PostgreSQL 9.0 and above you can use the aggregate function called string_agg. Your new SQL should look something like this:</p> <pre><code>SELECT company_id, string_agg(employee, ', ') FROM mytable GROUP BY company_id; </code></pre>
6,550
<p>I have seen the references to VistaDB over the years and with tools like SQLite, Firebird, MS SQL et. al. I have never had a reason to consider it.</p> <p>What are the benefits of paying for VistaDB vs using another technology? Things I have thought of:<br> 1. Compact Framework Support. SQLite+MSSQL support the CF.<br> 2. Need migration path to a 'more robust' system. Firebird+MSSQL.<br> 3. Need more advanced features such as triggers. Firebird+MSSQL </p>
<p>The VistaDB client runtime is free. The runtime will never "expire at 3am" as you put it. Only the developer tools are licensed in that manner. You need 1 license per developer, simple. We even offer a really inexpensive Lite version with no Visual Studio tools.</p> <p><b>Some other benefits</b></p> <p><strong>100% managed code</strong> - there are no interop or other unmanaged calls in the engine. This is a big deal to some, and others couldn't care less. </p> <p><strong>No registry access required</strong> - Most other in proc databases require registry access to look for parent controls, or permissions. VistaDB only does what you tell it to do, and will even run in Medium Trust.</p> <p><b>XCopy deployment</b> for runtime and your database (single file). You can xcopy you application, the runtime, and your database and run. Nothing to install or configure on the machine, no special privileges needed (we can run in Medium Trust or higher).</p> <p><b>Isolated storage</b> - You can put your entire database into Isolated Storage and run it from there directly. This makes it very easy to build secure click once applications that write databases in a domain friendly way for corporate environments. There is no need to store the user data on a shared drive or worry about permission mapping.</p> <p><b>CLR Triggers / CLR Procs</b> - You can write CLR Code and use them as Triggers or Stored Procs. We have just recently introduced changes to make it even easier to maintain a single CLR Assembly that can run in both VistaDB and SQL Server 2005/2008.</p> <p><b>T-SQL Procs</b> - VistaDB T-SQL Procs are compatible with SQL Server 2005/2008. Any procedure that works in our engine will run in SQL Server. That does not mean anything that runs there will port to us. We are a subset of the functionality in SQL Server. But we are also the only way to run T-SQL Procs without SQL Server (SQL CE can't do it).</p> <p>I personally think one of the biggest features is the ability to upsize to SQL Server later. All of the VistaDB types, syntax, and CLR Procs, T-SQL procs, etc all will run on SQL Server. (You can't take everything from SQL Server down to VistaDB though, it is a subset)</p> <p><b>32/64 bit Deployment</b> - VistaDB is a single assembly deployment that runs both 32 and 64 bit without changes. SQL CE requires two different runtimes depending upon the OS, and cannot run under IIS at all. <strike>Access has no 64 bit runtime, and the most recent 32 bit runtime can only be deployed through MSI. The 32 bit version of Windows has the runtime, the 64 bit version does not.</strike></p> <p><b>Relational Integrity</b> - VistaDB also actually enforces your constraints and Foreign Keys. You can specific cascade update, and delete operations. The person who commented we are like SQLITE is wrong in this regard. They parse constraints, but do not enforce them.</p> <p>EDIT: They do have support for FK's now in SQLite. But they are not compiled in by default, and do not use the same syntax as SQL Server.</p> <p><strong>Medium Trust</strong> - The ability to run on a medium trust web server is another feature that many will not care about, but it is a big deal. Many third party controls can't even run in Medium Trust. We can run the complete engine within Medium Trust because of our commitment to 100% managed code and least permission required.</p> <p><b>- Full disclosure -</b> I am the owner of VistaDB so I may be biased. :)</p>
<p>I hadn't seen VistaDB before, it does look pretty cool.</p> <p><b>Update:</b> Received a comment from someone from VistaDB - their update model is only for getting new versions. Your old ones won't stop working if your license expires, which is good to know.</p> <p>Keeping the original post here as IMHO the warning about expiring software licenses is still worth thinking about, even though VistaDB itself is fine.</p> <hr> <p>It definitely seems 'more featureful' than SQLite, but I don't see anything there to justify the cost. The site seems to indicate that you can buy one license for $279, but it implies this is just a 1 year subscription. Would you have to then pay another $279 next year to stop your site falling over? </p> <p>If so, remember to factor into the 'cost' how much inconvenience it's going to be when you get a call at 3am (murphy's law, it's always 3am) from your panicking customers because their VistaDB license has expired :-(</p> <p>I've had this experience personally with some expiring software, and it's never good. You can send your customers emails and messages and flash their entire screen blinking red saying "YOU NEED TO GET A NEW LICENSE BEFORE NEXT WEEK" and they'll still never do it, and you'll still get the pain at 3am when it does expire.</p>
7,899
<p>How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request.</p> <p>This would allow people to hit a url to the type <a href="http://www.foo.com?Image=test.jpg" rel="noreferrer">http://www.foo.com?Image=test.jpg</a> and have the image display in their browser. So as you may know this revolves around the use of Response.ContentType.</p> <p>By using </p> <pre><code>Response.ContentType = "application/octet-stream"; </code></pre> <p>I am able to display images of type gif/jpeg/png (all i have tested so far), bit trying to display .swf or .ico files gives me a nice little error.</p> <p>using</p> <pre><code>Response.ContentType = "application/x-shockwave-flash"; </code></pre> <p>I can get flash files to play, but then the images are messed.</p> <p>So how do i <strong>easily</strong> choose the contenttype?</p>
<p>This is ugly, but the best way is to look at the file and set the content type as appropriate:</p> <pre><code>switch ( fileExtension ) { case "pdf": Response.ContentType = "application/pdf"; break; case "swf": Response.ContentType = "application/x-shockwave-flash"; break; case "gif": Response.ContentType = "image/gif"; break; case "jpeg": Response.ContentType = "image/jpg"; break; case "jpg": Response.ContentType = "image/jpg"; break; case "png": Response.ContentType = "image/png"; break; case "mp4": Response.ContentType = "video/mp4"; break; case "mpeg": Response.ContentType = "video/mpeg"; break; case "mov": Response.ContentType = "video/quicktime"; break; case "wmv": case "avi": Response.ContentType = "video/x-ms-wmv"; break; //and so on default: Response.ContentType = "application/octet-stream"; break; } </code></pre>
<p>This is part of a solution I use on a local intranet. Some of the variables you will have to collect yourself as I pull them from a database but you may pull them from somewhere else.</p> <p>The only extra but I've got in there is a function called <strong>getMimeType</strong> which connects to the database and pulls back the correct mine type based on file extension. This defaults to application/octet-stream if none is found.</p> <pre><code>// Clear the response buffer incase there is anything already in it. Response.Clear(); Response.Buffer = true; // Read the original file from disk FileStream myFileStream = new FileStream(sPath, FileMode.Open); long FileSize = myFileStream.Length; byte[] Buffer = new byte[(int)FileSize]; myFileStream.Read(Buffer, 0, (int)FileSize); myFileStream.Close(); // Tell the browse stuff about the file Response.AddHeader("Content-Length", FileSize.ToString()); Response.AddHeader("Content-Disposition", "inline; filename=" + sFilename.Replace(" ","_")); Response.ContentType = getMimeType(sExtention, oConnection); // Send the data to the browser Response.BinaryWrite(Buffer); Response.End(); </code></pre>
2,542
<p>This is a low-level systems question.</p> <p>I need to mix 32 bit and 16 bit code because I'm trying to return to real-mode from protected mode. As a bit of background information, my code is doing this just after GRUB boots so I don't have any pesky operating system to tell me what I can and can't do.</p> <p>Anyway, I use [BITS 32] and [BITS 16] with my assembly to tell nasm which types of operations it should use, but when I test my code use bochs it looks like the for some operations bochs isn't executing the code that I wrote. It looks like the assembler is sticking in extras <code>0x66</code> and <code>0x67</code>'s which confuses bochs.</p> <p>So, how do I get nasm to successfully assemble code where I mix 32 bit and 16 bit code in the same file? Is there some kind of trick? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>The problem turned out to be that I wasn't setting up my descriptor tables correctly. I had one bit flipped wrong so instead of going to 16-bit mode I was going to 32-bit mode (with segments that happened to have a limit of one meg). </p> <p>Thanks for the suggestions!</p> <p>Terry</p>
<p>You weren't kidding about this being low-level!</p> <p>Have you checked the generated opcodes / operands to make sure that nasm is honoring your BITS directives correctly? Also check to make sure the jump targets are correct - maybe nasm is using the wrong offsets.</p> <p>If it's not a bug in nasm, maybe there is a bug in bochs. I can't imagine that people switch back to 16-bit mode from 32-bit mode very often anymore.</p>
3,894
<p>What are the differences between <code>htmlspecialchars()</code> and <code>htmlentities()</code>. When should I use one or the other?</p>
<p>From the PHP documentation for <a href="http://us2.php.net/htmlentities" rel="noreferrer">htmlentities</a>:</p> <blockquote> <p>This function is identical to <code>htmlspecialchars()</code> in all ways, except with <code>htmlentities()</code>, all characters which have HTML character entity equivalents are translated into these entities. </p> </blockquote> <p>From the PHP documentation for <a href="http://us.php.net/htmlspecialchars" rel="noreferrer">htmlspecialchars</a>:</p> <blockquote> <p>Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with some of these conversions made; the translations made are those most useful for everyday web programming. If you require all HTML character entities to be translated, use <code>htmlentities()</code> instead.</p> </blockquote> <p>The difference is what gets encoded. The choices are everything (entities) or "special" characters, like ampersand, double and single quotes, less than, and greater than (specialchars).</p> <p>I prefer to use <code>htmlspecialchars</code> whenever possible.</p> <p>For example:</p> <pre class="lang-php prettyprint-override"><code> echo htmlentities('&lt;Il était une fois un être&gt;.'); // Output: &amp;lt;Il &amp;eacute;tait une fois un &amp;ecirc;tre&amp;gt;. // ^^^^^^^^ ^^^^^^^ echo htmlspecialchars('&lt;Il était une fois un être&gt;.'); // Output: &amp;lt;Il était une fois un être&amp;gt;. // ^ ^ </code></pre>
<pre><code>**HTML Character Entity Reference Chart at W3.org** </code></pre> <p><a href="https://dev.w3.org/html5/html-author/charref" rel="nofollow noreferrer">https://dev.w3.org/html5/html-author/charref</a></p> <pre><code>&amp;Tab; &amp;NewLine; ! &amp;excl; " &amp;quot; &amp;QUOT; # &amp;num; $ &amp;dollar; % &amp;percnt; &amp; &amp;amp; &amp;AMP; ' &amp;apos; ( &amp;lpar; ) &amp;rpar; * &amp;ast; &amp;midast; + &amp;plus; , &amp;comma; . &amp;period; / &amp;sol; : &amp;colon; ; &amp;semi; &lt; &amp;lt; &amp;LT; = &amp;equals; &gt; &amp;gt; &amp;GT; ? &amp;quest; @ &amp;commat; [ &amp;lsqb; &amp;lbrack; \ &amp;bsol; ] &amp;rsqb; &amp;rbrack; ^ &amp;Hat; _ &amp;lowbar; ` &amp;grave; &amp;DiacriticalGrave; { &amp;lcub; &amp;lbrace; | &amp;verbar; &amp;vert; &amp;VerticalLine; } &amp;rcub; &amp;rbrace; &amp;nbsp; &amp;NonBreakingSpace; ¡ &amp;iexcl; ¢ &amp;cent; £ &amp;pound; ¤ &amp;curren; ¥ &amp;yen; ¦ &amp;brvbar; § &amp;sect; ¨ &amp;Dot; &amp;die; &amp;DoubleDot; &amp;uml; © &amp;copy; &amp;COPY; ª &amp;ordf; « &amp;laquo; ¬ &amp;not; &amp;shy; ® &amp;reg; &amp;circledR; &amp;REG; ¯ &amp;macr; &amp;OverBar; &amp;strns; ° &amp;deg; ± &amp;plusmn; &amp;pm; &amp;PlusMinus; ² &amp;sup2; ³ &amp;sup3; ´ &amp;acute; &amp;DiacriticalAcute; µ &amp;micro; ¶ &amp;para; · &amp;middot; &amp;centerdot; &amp;CenterDot; ¸ &amp;cedil; &amp;Cedilla; ¹ &amp;sup1; º &amp;ordm; » &amp;raquo; ¼ &amp;frac14; ½ &amp;frac12; &amp;half; ¾ &amp;frac34; ¿ &amp;iquest; À &amp;Agrave; Á &amp;Aacute;  &amp;Acirc; à &amp;Atilde; Ä &amp;Auml; Å &amp;Aring; Æ &amp;AElig; Ç &amp;Ccedil; È &amp;Egrave; É &amp;Eacute; Ê &amp;Ecirc; Ë &amp;Euml; Ì &amp;Igrave; Í &amp;Iacute; Î &amp;Icirc; Ï &amp;Iuml; Ð &amp;ETH; Ñ &amp;Ntilde; Ò &amp;Ograve; Ó &amp;Oacute; Ô &amp;Ocirc; Õ &amp;Otilde; Ö &amp;Ouml; × &amp;times; Ø &amp;Oslash; Ù &amp;Ugrave; Ú &amp;Uacute; Û &amp;Ucirc; Ü &amp;Uuml; Ý &amp;Yacute; Þ &amp;THORN; ß &amp;szlig; à &amp;agrave; á &amp;aacute; â &amp;acirc; ã &amp;atilde; ä &amp;auml; å &amp;aring; æ &amp;aelig; ç &amp;ccedil; è &amp;egrave; é &amp;eacute; ê &amp;ecirc; ë &amp;euml; ì &amp;igrave; í &amp;iacute; î &amp;icirc; ï &amp;iuml; ð &amp;eth; ñ &amp;ntilde; ò &amp;ograve; ó &amp;oacute; ô &amp;ocirc; õ &amp;otilde; ö &amp;ouml; ÷ &amp;divide; &amp;div; ø &amp;oslash; ù &amp;ugrave; ú &amp;uacute; û &amp;ucirc; ü &amp;uuml; ý &amp;yacute; þ &amp;thorn; ÿ &amp;yuml; Ā &amp;Amacr; ā &amp;amacr; Ă &amp;Abreve; ă &amp;abreve; Ą &amp;Aogon; ą &amp;aogon; Ć &amp;Cacute; ć &amp;cacute; Ĉ &amp;Ccirc; ĉ &amp;ccirc; Ċ &amp;Cdot; ċ &amp;cdot; Č &amp;Ccaron; č &amp;ccaron; Ď &amp;Dcaron; ď &amp;dcaron; Đ &amp;Dstrok; đ &amp;dstrok; Ē &amp;Emacr; ē &amp;emacr; Ė &amp;Edot; ė &amp;edot; Ę &amp;Eogon; ę &amp;eogon; Ě &amp;Ecaron; ě &amp;ecaron; Ĝ &amp;Gcirc; ĝ &amp;gcirc; Ğ &amp;Gbreve; ğ &amp;gbreve; Ġ &amp;Gdot; ġ &amp;gdot; Ģ &amp;Gcedil; Ĥ &amp;Hcirc; ĥ &amp;hcirc; Ħ &amp;Hstrok; ħ &amp;hstrok; Ĩ &amp;Itilde; ĩ &amp;itilde; Ī &amp;Imacr; ī &amp;imacr; Į &amp;Iogon; į &amp;iogon; İ &amp;Idot; ı &amp;imath; &amp;inodot; IJ &amp;IJlig; ij &amp;ijlig; Ĵ &amp;Jcirc; ĵ &amp;jcirc; Ķ &amp;Kcedil; ķ &amp;kcedil; ĸ &amp;kgreen; Ĺ &amp;Lacute; ĺ &amp;lacute; Ļ &amp;Lcedil; ļ &amp;lcedil; Ľ &amp;Lcaron; ľ &amp;lcaron; Ŀ &amp;Lmidot; ŀ &amp;lmidot; Ł &amp;Lstrok; ł &amp;lstrok; Ń &amp;Nacute; ń &amp;nacute; Ņ &amp;Ncedil; ņ &amp;ncedil; Ň &amp;Ncaron; ň &amp;ncaron; ʼn &amp;napos; Ŋ &amp;ENG; ŋ &amp;eng; Ō &amp;Omacr; ō &amp;omacr; Ő &amp;Odblac; ő &amp;odblac; Œ &amp;OElig; œ &amp;oelig; Ŕ &amp;Racute; ŕ &amp;racute; Ŗ &amp;Rcedil; ŗ &amp;rcedil; Ř &amp;Rcaron; ř &amp;rcaron; Ś &amp;Sacute; ś &amp;sacute; Ŝ &amp;Scirc; ŝ &amp;scirc; Ş &amp;Scedil; ş &amp;scedil; Š &amp;Scaron; š &amp;scaron; Ţ &amp;Tcedil; ţ &amp;tcedil; Ť &amp;Tcaron; ť &amp;tcaron; Ŧ &amp;Tstrok; ŧ &amp;tstrok; Ũ &amp;Utilde; ũ &amp;utilde; Ū &amp;Umacr; ū &amp;umacr; Ŭ &amp;Ubreve; ŭ &amp;ubreve; Ů &amp;Uring; ů &amp;uring; Ű &amp;Udblac; ű &amp;udblac; Ų &amp;Uogon; ų &amp;uogon; Ŵ &amp;Wcirc; ŵ &amp;wcirc; Ŷ &amp;Ycirc; ŷ &amp;ycirc; Ÿ &amp;Yuml; Ź &amp;Zacute; ź &amp;zacute; Ż &amp;Zdot; ż &amp;zdot; Ž &amp;Zcaron; ž &amp;zcaron; ƒ &amp;fnof; Ƶ &amp;imped; ǵ &amp;gacute; ȷ &amp;jmath; ˆ &amp;circ; ˇ &amp;caron; &amp;Hacek; ˘ &amp;breve; &amp;Breve; ˙ &amp;dot; &amp;DiacriticalDot; ˚ &amp;ring; ˛ &amp;ogon; ˜ &amp;tilde; &amp;DiacriticalTilde; ˝ &amp;dblac; &amp;DiacriticalDoubleAcute; ̑ &amp;DownBreve; ̲ &amp;UnderBar; Α &amp;Alpha; Β &amp;Beta; Γ &amp;Gamma; Δ &amp;Delta; Ε &amp;Epsilon; Ζ &amp;Zeta; Η &amp;Eta; Θ &amp;Theta; Ι &amp;Iota; Κ &amp;Kappa; Λ &amp;Lambda; Μ &amp;Mu; Ν &amp;Nu; Ξ &amp;Xi; Ο &amp;Omicron; Π &amp;Pi; Ρ &amp;Rho; Σ &amp;Sigma; Τ &amp;Tau; Υ &amp;Upsilon; Φ &amp;Phi; Χ &amp;Chi; Ψ &amp;Psi; Ω &amp;Omega; α &amp;alpha; β &amp;beta; γ &amp;gamma; δ &amp;delta; ε &amp;epsiv; &amp;varepsilon; &amp;epsilon; ζ &amp;zeta; η &amp;eta; θ &amp;theta; ι &amp;iota; κ &amp;kappa; λ &amp;lambda; μ &amp;mu; ν &amp;nu; ξ &amp;xi; ο &amp;omicron; π &amp;pi; ρ &amp;rho; ς &amp;sigmav; &amp;varsigma; &amp;sigmaf; σ &amp;sigma; τ &amp;tau; υ &amp;upsi; &amp;upsilon; φ &amp;phi; &amp;phiv; &amp;varphi; χ &amp;chi; ψ &amp;psi; ω &amp;omega; ϑ &amp;thetav; &amp;vartheta; &amp;thetasym; ϒ &amp;Upsi; &amp;upsih; ϕ &amp;straightphi; ϖ &amp;piv; &amp;varpi; Ϝ &amp;Gammad; ϝ &amp;gammad; &amp;digamma; ϰ &amp;kappav; &amp;varkappa; ϱ &amp;rhov; &amp;varrho; ϵ &amp;epsi; &amp;straightepsilon; ϶ &amp;bepsi; &amp;backepsilon; Ё &amp;IOcy; Ђ &amp;DJcy; Ѓ &amp;GJcy; Є &amp;Jukcy; Ѕ &amp;DScy; І &amp;Iukcy; Ї &amp;YIcy; Ј &amp;Jsercy; Љ &amp;LJcy; Њ &amp;NJcy; Ћ &amp;TSHcy; Ќ &amp;KJcy; Ў &amp;Ubrcy; Џ &amp;DZcy; А &amp;Acy; Б &amp;Bcy; В &amp;Vcy; Г &amp;Gcy; Д &amp;Dcy; Е &amp;IEcy; Ж &amp;ZHcy; З &amp;Zcy; И &amp;Icy; Й &amp;Jcy; К &amp;Kcy; Л &amp;Lcy; М &amp;Mcy; Н &amp;Ncy; О &amp;Ocy; П &amp;Pcy; Р &amp;Rcy; С &amp;Scy; Т &amp;Tcy; У &amp;Ucy; Ф &amp;Fcy; Х &amp;KHcy; Ц &amp;TScy; Ч &amp;CHcy; Ш &amp;SHcy; Щ &amp;SHCHcy; Ъ &amp;HARDcy; Ы &amp;Ycy; Ь &amp;SOFTcy; Э &amp;Ecy; Ю &amp;YUcy; Я &amp;YAcy; а &amp;acy; б &amp;bcy; в &amp;vcy; г &amp;gcy; д &amp;dcy; е &amp;iecy; ж &amp;zhcy; з &amp;zcy; и &amp;icy; й &amp;jcy; к &amp;kcy; л &amp;lcy; м &amp;mcy; н &amp;ncy; о &amp;ocy; п &amp;pcy; р &amp;rcy; с &amp;scy; т &amp;tcy; у &amp;ucy; ф &amp;fcy; х &amp;khcy; ц &amp;tscy; ч &amp;chcy; ш &amp;shcy; щ &amp;shchcy; ъ &amp;hardcy; ы &amp;ycy; ь &amp;softcy; э &amp;ecy; ю &amp;yucy; я &amp;yacy; ё &amp;iocy; ђ &amp;djcy; ѓ &amp;gjcy; є &amp;jukcy; ѕ &amp;dscy; і &amp;iukcy; ї &amp;yicy; ј &amp;jsercy; љ &amp;ljcy; њ &amp;njcy; ћ &amp;tshcy; ќ &amp;kjcy; ў &amp;ubrcy; џ &amp;dzcy;   &amp;ensp;   &amp;emsp;   &amp;emsp13;   &amp;emsp14;   &amp;numsp;   &amp;puncsp;   &amp;thinsp; &amp;ThinSpace;   &amp;hairsp; &amp;VeryThinSpace; ​ &amp;ZeroWidthSpace; &amp;NegativeVeryThinSpace; &amp;NegativeThinSpace; &amp;NegativeMediumSpace; &amp;NegativeThickSpace; ‌ &amp;zwnj; ‍ &amp;zwj; ‎ &amp;lrm; ‏ &amp;rlm; ‐ &amp;hyphen; &amp;dash; – &amp;ndash; — &amp;mdash; ― &amp;horbar; ‖ &amp;Verbar; &amp;Vert; ‘ &amp;lsquo; &amp;OpenCurlyQuote; ’ &amp;rsquo; &amp;rsquor; &amp;CloseCurlyQuote; ‚ &amp;lsquor; &amp;sbquo; “ &amp;ldquo; &amp;OpenCurlyDoubleQuote; ” &amp;rdquo; &amp;rdquor; &amp;CloseCurlyDoubleQuote; „ &amp;ldquor; &amp;bdquo; † &amp;dagger; ‡ &amp;Dagger; &amp;ddagger; • &amp;bull; &amp;bullet; ‥ &amp;nldr; … &amp;hellip; &amp;mldr; ‰ &amp;permil; ‱ &amp;pertenk; ′ &amp;prime; ″ &amp;Prime; ‴ &amp;tprime; ‵ &amp;bprime; &amp;backprime; ‹ &amp;lsaquo; › &amp;rsaquo; ‾ &amp;oline; ⁁ &amp;caret; ⁃ &amp;hybull; ⁄ &amp;frasl; ⁏ &amp;bsemi; ⁗ &amp;qprime;   &amp;MediumSpace; ⁠ &amp;NoBreak; ⁡ &amp;ApplyFunction; &amp;af; ⁢ &amp;InvisibleTimes; &amp;it; ⁣ &amp;InvisibleComma; &amp;ic; € &amp;euro; ⃛ &amp;tdot; &amp;TripleDot; ⃜ &amp;DotDot; ℂ &amp;Copf; &amp;complexes; ℅ &amp;incare; ℊ &amp;gscr; ℋ &amp;hamilt; &amp;HilbertSpace; &amp;Hscr; ℌ &amp;Hfr; &amp;Poincareplane; ℍ &amp;quaternions; &amp;Hopf; ℎ &amp;planckh; ℏ &amp;planck; &amp;hbar; &amp;plankv; &amp;hslash; ℐ &amp;Iscr; &amp;imagline; ℑ &amp;image; &amp;Im; &amp;imagpart; &amp;Ifr; ℒ &amp;Lscr; &amp;lagran; &amp;Laplacetrf; ℓ &amp;ell; ℕ &amp;Nopf; &amp;naturals; № &amp;numero; ℗ &amp;copysr; ℘ &amp;weierp; &amp;wp; ℙ &amp;Popf; &amp;primes; ℚ &amp;rationals; &amp;Qopf; ℛ &amp;Rscr; &amp;realine; ℜ &amp;real; &amp;Re; &amp;realpart; &amp;Rfr; ℝ &amp;reals; &amp;Ropf; ℞ &amp;rx; ™ &amp;trade; &amp;TRADE; ℤ &amp;integers; &amp;Zopf; Ω &amp;ohm; ℧ &amp;mho; ℨ &amp;Zfr; &amp;zeetrf; ℩ &amp;iiota; Å &amp;angst; ℬ &amp;bernou; &amp;Bernoullis; &amp;Bscr; ℭ &amp;Cfr; &amp;Cayleys; ℯ &amp;escr; ℰ &amp;Escr; &amp;expectation; ℱ &amp;Fscr; &amp;Fouriertrf; ℳ &amp;phmmat; &amp;Mellintrf; &amp;Mscr; ℴ &amp;order; &amp;orderof; &amp;oscr; ℵ &amp;alefsym; &amp;aleph; ℶ &amp;beth; ℷ &amp;gimel; ℸ &amp;daleth; ⅅ &amp;CapitalDifferentialD; &amp;DD; ⅆ &amp;DifferentialD; &amp;dd; ⅇ &amp;ExponentialE; &amp;exponentiale; &amp;ee; ⅈ &amp;ImaginaryI; &amp;ii; ⅓ &amp;frac13; ⅔ &amp;frac23; ⅕ &amp;frac15; ⅖ &amp;frac25; ⅗ &amp;frac35; ⅘ &amp;frac45; ⅙ &amp;frac16; ⅚ &amp;frac56; ⅛ &amp;frac18; ⅜ &amp;frac38; ⅝ &amp;frac58; ⅞ &amp;frac78; ← &amp;larr; &amp;leftarrow; &amp;LeftArrow; &amp;slarr; &amp;ShortLeftArrow; ↑ &amp;uarr; &amp;uparrow; &amp;UpArrow; &amp;ShortUpArrow; → &amp;rarr; &amp;rightarrow; &amp;RightArrow; &amp;srarr; &amp;ShortRightArrow; ↓ &amp;darr; &amp;downarrow; &amp;DownArrow; &amp;ShortDownArrow; ↔ &amp;harr; &amp;leftrightarrow; &amp;LeftRightArrow; ↕ &amp;varr; &amp;updownarrow; &amp;UpDownArrow; ↖ &amp;nwarr; &amp;UpperLeftArrow; &amp;nwarrow; ↗ &amp;nearr; &amp;UpperRightArrow; &amp;nearrow; ↘ &amp;searr; &amp;searrow; &amp;LowerRightArrow; ↙ &amp;swarr; &amp;swarrow; &amp;LowerLeftArrow; ↚ &amp;nlarr; &amp;nleftarrow; ↛ &amp;nrarr; &amp;nrightarrow; ↝ &amp;rarrw; &amp;rightsquigarrow; ↞ &amp;Larr; &amp;twoheadleftarrow; ↟ &amp;Uarr; ↠ &amp;Rarr; &amp;twoheadrightarrow; ↡ &amp;Darr; ↢ &amp;larrtl; &amp;leftarrowtail; ↣ &amp;rarrtl; &amp;rightarrowtail; ↤ &amp;LeftTeeArrow; &amp;mapstoleft; ↥ &amp;UpTeeArrow; &amp;mapstoup; ↦ &amp;map; &amp;RightTeeArrow; &amp;mapsto; ↧ &amp;DownTeeArrow; &amp;mapstodown; ↩ &amp;larrhk; &amp;hookleftarrow; ↪ &amp;rarrhk; &amp;hookrightarrow; ↫ &amp;larrlp; &amp;looparrowleft; ↬ &amp;rarrlp; &amp;looparrowright; ↭ &amp;harrw; &amp;leftrightsquigarrow; ↮ &amp;nharr; &amp;nleftrightarrow; ↰ &amp;lsh; &amp;Lsh; ↱ &amp;rsh; &amp;Rsh; ↲ &amp;ldsh; ↳ &amp;rdsh; ↵ &amp;crarr; ↶ &amp;cularr; &amp;curvearrowleft; ↷ &amp;curarr; &amp;curvearrowright; ↺ &amp;olarr; &amp;circlearrowleft; ↻ &amp;orarr; &amp;circlearrowright; ↼ &amp;lharu; &amp;LeftVector; &amp;leftharpoonup; ↽ &amp;lhard; &amp;leftharpoondown; &amp;DownLeftVector; ↾ &amp;uharr; &amp;upharpoonright; &amp;RightUpVector; ↿ &amp;uharl; &amp;upharpoonleft; &amp;LeftUpVector; ⇀ &amp;rharu; &amp;RightVector; &amp;rightharpoonup; ⇁ &amp;rhard; &amp;rightharpoondown; &amp;DownRightVector; ⇂ &amp;dharr; &amp;RightDownVector; &amp;downharpoonright; ⇃ &amp;dharl; &amp;LeftDownVector; &amp;downharpoonleft; ⇄ &amp;rlarr; &amp;rightleftarrows; &amp;RightArrowLeftArrow; ⇅ &amp;udarr; &amp;UpArrowDownArrow; ⇆ &amp;lrarr; &amp;leftrightarrows; &amp;LeftArrowRightArrow; ⇇ &amp;llarr; &amp;leftleftarrows; ⇈ &amp;uuarr; &amp;upuparrows; ⇉ &amp;rrarr; &amp;rightrightarrows; ⇊ &amp;ddarr; &amp;downdownarrows; ⇋ &amp;lrhar; &amp;ReverseEquilibrium; &amp;leftrightharpoons; ⇌ &amp;rlhar; &amp;rightleftharpoons; &amp;Equilibrium; ⇍ &amp;nlArr; &amp;nLeftarrow; ⇎ &amp;nhArr; &amp;nLeftrightarrow; ⇏ &amp;nrArr; &amp;nRightarrow; ⇐ &amp;lArr; &amp;Leftarrow; &amp;DoubleLeftArrow; ⇑ &amp;uArr; &amp;Uparrow; &amp;DoubleUpArrow; ⇒ &amp;rArr; &amp;Rightarrow; &amp;Implies; &amp;DoubleRightArrow; ⇓ &amp;dArr; &amp;Downarrow; &amp;DoubleDownArrow; ⇔ &amp;hArr; &amp;Leftrightarrow; &amp;DoubleLeftRightArrow; &amp;iff; ⇕ &amp;vArr; &amp;Updownarrow; &amp;DoubleUpDownArrow; ⇖ &amp;nwArr; ⇗ &amp;neArr; ⇘ &amp;seArr; ⇙ &amp;swArr; ⇚ &amp;lAarr; &amp;Lleftarrow; ⇛ &amp;rAarr; &amp;Rrightarrow; ⇝ &amp;zigrarr; ⇤ &amp;larrb; &amp;LeftArrowBar; ⇥ &amp;rarrb; &amp;RightArrowBar; ⇵ &amp;duarr; &amp;DownArrowUpArrow; ⇽ &amp;loarr; ⇾ &amp;roarr; ⇿ &amp;hoarr; ∀ &amp;forall; &amp;ForAll; ∁ &amp;comp; &amp;complement; ∂ &amp;part; &amp;PartialD; ∃ &amp;exist; &amp;Exists; ∄ &amp;nexist; &amp;NotExists; &amp;nexists; ∅ &amp;empty; &amp;emptyset; &amp;emptyv; &amp;varnothing; ∇ &amp;nabla; &amp;Del; ∈ &amp;isin; &amp;isinv; &amp;Element; &amp;in; ∉ &amp;notin; &amp;NotElement; &amp;notinva; ∋ &amp;niv; &amp;ReverseElement; &amp;ni; &amp;SuchThat; ∌ &amp;notni; &amp;notniva; &amp;NotReverseElement; ∏ &amp;prod; &amp;Product; ∐ &amp;coprod; &amp;Coproduct; ∑ &amp;sum; &amp;Sum; − &amp;minus; ∓ &amp;mnplus; &amp;mp; &amp;MinusPlus; ∔ &amp;plusdo; &amp;dotplus; ∖ &amp;setmn; &amp;setminus; &amp;Backslash; &amp;ssetmn; &amp;smallsetminus; ∗ &amp;lowast; ∘ &amp;compfn; &amp;SmallCircle; √ &amp;radic; &amp;Sqrt; ∝ &amp;prop; &amp;propto; &amp;Proportional; &amp;vprop; &amp;varpropto; ∞ &amp;infin; ∟ &amp;angrt; ∠ &amp;ang; &amp;angle; ∡ &amp;angmsd; &amp;measuredangle; ∢ &amp;angsph; ∣ &amp;mid; &amp;VerticalBar; &amp;smid; &amp;shortmid; ∤ &amp;nmid; &amp;NotVerticalBar; &amp;nsmid; &amp;nshortmid; ∥ &amp;par; &amp;parallel; &amp;DoubleVerticalBar; &amp;spar; &amp;shortparallel; ∦ &amp;npar; &amp;nparallel; &amp;NotDoubleVerticalBar; &amp;nspar; &amp;nshortparallel; ∧ &amp;and; &amp;wedge; ∨ &amp;or; &amp;vee; ∩ &amp;cap; ∪ &amp;cup; ∫ &amp;int; &amp;Integral; ∬ &amp;Int; ∭ &amp;tint; &amp;iiint; ∮ &amp;conint; &amp;oint; &amp;ContourIntegral; ∯ &amp;Conint; &amp;DoubleContourIntegral; ∰ &amp;Cconint; ∱ &amp;cwint; ∲ &amp;cwconint; &amp;ClockwiseContourIntegral; ∳ &amp;awconint; &amp;CounterClockwiseContourIntegral; ∴ &amp;there4; &amp;therefore; &amp;Therefore; ∵ &amp;becaus; &amp;because; &amp;Because; ∶ &amp;ratio; ∷ &amp;Colon; &amp;Proportion; ∸ &amp;minusd; &amp;dotminus; ∺ &amp;mDDot; ∻ &amp;homtht; ∼ &amp;sim; &amp;Tilde; &amp;thksim; &amp;thicksim; ∽ &amp;bsim; &amp;backsim; ∾ &amp;ac; &amp;mstpos; ∿ &amp;acd; ≀ &amp;wreath; &amp;VerticalTilde; &amp;wr; ≁ &amp;nsim; &amp;NotTilde; ≂ &amp;esim; &amp;EqualTilde; &amp;eqsim; ≃ &amp;sime; &amp;TildeEqual; &amp;simeq; ≄ &amp;nsime; &amp;nsimeq; &amp;NotTildeEqual; ≅ &amp;cong; &amp;TildeFullEqual; ≆ &amp;simne; ≇ &amp;ncong; &amp;NotTildeFullEqual; ≈ &amp;asymp; &amp;ap; &amp;TildeTilde; &amp;approx; &amp;thkap; &amp;thickapprox; ≉ &amp;nap; &amp;NotTildeTilde; &amp;napprox; ≊ &amp;ape; &amp;approxeq; ≋ &amp;apid; ≌ &amp;bcong; &amp;backcong; ≍ &amp;asympeq; &amp;CupCap; ≎ &amp;bump; &amp;HumpDownHump; &amp;Bumpeq; ≏ &amp;bumpe; &amp;HumpEqual; &amp;bumpeq; ≐ &amp;esdot; &amp;DotEqual; &amp;doteq; ≑ &amp;eDot; &amp;doteqdot; ≒ &amp;efDot; &amp;fallingdotseq; ≓ &amp;erDot; &amp;risingdotseq; ≔ &amp;colone; &amp;coloneq; &amp;Assign; ≕ &amp;ecolon; &amp;eqcolon; ≖ &amp;ecir; &amp;eqcirc; ≗ &amp;cire; &amp;circeq; ≙ &amp;wedgeq; ≚ &amp;veeeq; ≜ &amp;trie; &amp;triangleq; ≟ &amp;equest; &amp;questeq; ≠ &amp;ne; &amp;NotEqual; ≡ &amp;equiv; &amp;Congruent; ≢ &amp;nequiv; &amp;NotCongruent; ≤ &amp;le; &amp;leq; ≥ &amp;ge; &amp;GreaterEqual; &amp;geq; ≦ &amp;lE; &amp;LessFullEqual; &amp;leqq; ≧ &amp;gE; &amp;GreaterFullEqual; &amp;geqq; ≨ &amp;lnE; &amp;lneqq; ≩ &amp;gnE; &amp;gneqq; ≪ &amp;Lt; &amp;NestedLessLess; &amp;ll; ≫ &amp;Gt; &amp;NestedGreaterGreater; &amp;gg; ≬ &amp;twixt; &amp;between; ≭ &amp;NotCupCap; ≮ &amp;nlt; &amp;NotLess; &amp;nless; ≯ &amp;ngt; &amp;NotGreater; &amp;ngtr; ≰ &amp;nle; &amp;NotLessEqual; &amp;nleq; ≱ &amp;nge; &amp;NotGreaterEqual; &amp;ngeq; ≲ &amp;lsim; &amp;LessTilde; &amp;lesssim; ≳ &amp;gsim; &amp;gtrsim; &amp;GreaterTilde; ≴ &amp;nlsim; &amp;NotLessTilde; ≵ &amp;ngsim; &amp;NotGreaterTilde; ≶ &amp;lg; &amp;lessgtr; &amp;LessGreater; ≷ &amp;gl; &amp;gtrless; &amp;GreaterLess; ≸ &amp;ntlg; &amp;NotLessGreater; ≹ &amp;ntgl; &amp;NotGreaterLess; ≺ &amp;pr; &amp;Precedes; &amp;prec; ≻ &amp;sc; &amp;Succeeds; &amp;succ; ≼ &amp;prcue; &amp;PrecedesSlantEqual; &amp;preccurlyeq; ≽ &amp;sccue; &amp;SucceedsSlantEqual; &amp;succcurlyeq; ≾ &amp;prsim; &amp;precsim; &amp;PrecedesTilde; ≿ &amp;scsim; &amp;succsim; &amp;SucceedsTilde; ⊀ &amp;npr; &amp;nprec; &amp;NotPrecedes; ⊁ &amp;nsc; &amp;nsucc; &amp;NotSucceeds; ⊂ &amp;sub; &amp;subset; ⊃ &amp;sup; &amp;supset; &amp;Superset; ⊄ &amp;nsub; ⊅ &amp;nsup; ⊆ &amp;sube; &amp;SubsetEqual; &amp;subseteq; ⊇ &amp;supe; &amp;supseteq; &amp;SupersetEqual; ⊈ &amp;nsube; &amp;nsubseteq; &amp;NotSubsetEqual; ⊉ &amp;nsupe; &amp;nsupseteq; &amp;NotSupersetEqual; ⊊ &amp;subne; &amp;subsetneq; ⊋ &amp;supne; &amp;supsetneq; ⊍ &amp;cupdot; ⊎ &amp;uplus; &amp;UnionPlus; ⊏ &amp;sqsub; &amp;SquareSubset; &amp;sqsubset; ⊐ &amp;sqsup; &amp;SquareSuperset; &amp;sqsupset; ⊑ &amp;sqsube; &amp;SquareSubsetEqual; &amp;sqsubseteq; ⊒ &amp;sqsupe; &amp;SquareSupersetEqual; &amp;sqsupseteq; ⊓ &amp;sqcap; &amp;SquareIntersection; ⊔ &amp;sqcup; &amp;SquareUnion; ⊕ &amp;oplus; &amp;CirclePlus; ⊖ &amp;ominus; &amp;CircleMinus; ⊗ &amp;otimes; &amp;CircleTimes; ⊘ &amp;osol; ⊙ &amp;odot; &amp;CircleDot; ⊚ &amp;ocir; &amp;circledcirc; ⊛ &amp;oast; &amp;circledast; ⊝ &amp;odash; &amp;circleddash; ⊞ &amp;plusb; &amp;boxplus; ⊟ &amp;minusb; &amp;boxminus; ⊠ &amp;timesb; &amp;boxtimes; ⊡ &amp;sdotb; &amp;dotsquare; ⊢ &amp;vdash; &amp;RightTee; ⊣ &amp;dashv; &amp;LeftTee; ⊤ &amp;top; &amp;DownTee; ⊥ &amp;bottom; &amp;bot; &amp;perp; &amp;UpTee; ⊧ &amp;models; ⊨ &amp;vDash; &amp;DoubleRightTee; ⊩ &amp;Vdash; ⊪ &amp;Vvdash; ⊫ &amp;VDash; ⊬ &amp;nvdash; ⊭ &amp;nvDash; ⊮ &amp;nVdash; ⊯ &amp;nVDash; ⊰ &amp;prurel; ⊲ &amp;vltri; &amp;vartriangleleft; &amp;LeftTriangle; ⊳ &amp;vrtri; &amp;vartriangleright; &amp;RightTriangle; ⊴ &amp;ltrie; &amp;trianglelefteq; &amp;LeftTriangleEqual; ⊵ &amp;rtrie; &amp;trianglerighteq; &amp;RightTriangleEqual; ⊶ &amp;origof; ⊷ &amp;imof; ⊸ &amp;mumap; &amp;multimap; ⊹ &amp;hercon; ⊺ &amp;intcal; &amp;intercal; ⊻ &amp;veebar; ⊽ &amp;barvee; ⊾ &amp;angrtvb; ⊿ &amp;lrtri; ⋀ &amp;xwedge; &amp;Wedge; &amp;bigwedge; ⋁ &amp;xvee; &amp;Vee; &amp;bigvee; ⋂ &amp;xcap; &amp;Intersection; &amp;bigcap; ⋃ &amp;xcup; &amp;Union; &amp;bigcup; ⋄ &amp;diam; &amp;diamond; &amp;Diamond; ⋅ &amp;sdot; ⋆ &amp;sstarf; &amp;Star; ⋇ &amp;divonx; &amp;divideontimes; ⋈ &amp;bowtie; ⋉ &amp;ltimes; ⋊ &amp;rtimes; ⋋ &amp;lthree; &amp;leftthreetimes; ⋌ &amp;rthree; &amp;rightthreetimes; ⋍ &amp;bsime; &amp;backsimeq; ⋎ &amp;cuvee; &amp;curlyvee; ⋏ &amp;cuwed; &amp;curlywedge; ⋐ &amp;Sub; &amp;Subset; ⋑ &amp;Sup; &amp;Supset; ⋒ &amp;Cap; ⋓ &amp;Cup; ⋔ &amp;fork; &amp;pitchfork; ⋕ &amp;epar; ⋖ &amp;ltdot; &amp;lessdot; ⋗ &amp;gtdot; &amp;gtrdot; ⋘ &amp;Ll; ⋙ &amp;Gg; &amp;ggg; ⋚ &amp;leg; &amp;LessEqualGreater; &amp;lesseqgtr; ⋛ &amp;gel; &amp;gtreqless; &amp;GreaterEqualLess; ⋞ &amp;cuepr; &amp;curlyeqprec; ⋟ &amp;cuesc; &amp;curlyeqsucc; ⋠ &amp;nprcue; &amp;NotPrecedesSlantEqual; ⋡ &amp;nsccue; &amp;NotSucceedsSlantEqual; ⋢ &amp;nsqsube; &amp;NotSquareSubsetEqual; ⋣ &amp;nsqsupe; &amp;NotSquareSupersetEqual; ⋦ &amp;lnsim; ⋧ &amp;gnsim; ⋨ &amp;prnsim; &amp;precnsim; ⋩ &amp;scnsim; &amp;succnsim; ⋪ &amp;nltri; &amp;ntriangleleft; &amp;NotLeftTriangle; ⋫ &amp;nrtri; &amp;ntriangleright; &amp;NotRightTriangle; ⋬ &amp;nltrie; &amp;ntrianglelefteq; &amp;NotLeftTriangleEqual; ⋭ &amp;nrtrie; &amp;ntrianglerighteq; &amp;NotRightTriangleEqual; ⋮ &amp;vellip; ⋯ &amp;ctdot; ⋰ &amp;utdot; ⋱ &amp;dtdot; ⋲ &amp;disin; ⋳ &amp;isinsv; ⋴ &amp;isins; ⋵ &amp;isindot; ⋶ &amp;notinvc; ⋷ &amp;notinvb; ⋹ &amp;isinE; ⋺ &amp;nisd; ⋻ &amp;xnis; ⋼ &amp;nis; ⋽ &amp;notnivc; ⋾ &amp;notnivb; ⌅ &amp;barwed; &amp;barwedge; ⌆ &amp;Barwed; &amp;doublebarwedge; ⌈ &amp;lceil; &amp;LeftCeiling; ⌉ &amp;rceil; &amp;RightCeiling; ⌊ &amp;lfloor; &amp;LeftFloor; ⌋ &amp;rfloor; &amp;RightFloor; ⌌ &amp;drcrop; ⌍ &amp;dlcrop; ⌎ &amp;urcrop; ⌏ &amp;ulcrop; ⌐ &amp;bnot; ⌒ &amp;profline; ⌓ &amp;profsurf; ⌕ &amp;telrec; ⌖ &amp;target; ⌜ &amp;ulcorn; &amp;ulcorner; ⌝ &amp;urcorn; &amp;urcorner; ⌞ &amp;dlcorn; &amp;llcorner; ⌟ &amp;drcorn; &amp;lrcorner; ⌢ &amp;frown; &amp;sfrown; ⌣ &amp;smile; &amp;ssmile; ⌭ &amp;cylcty; ⌮ &amp;profalar; ⌶ &amp;topbot; ⌽ &amp;ovbar; ⌿ &amp;solbar; ⍼ &amp;angzarr; ⎰ &amp;lmoust; &amp;lmoustache; ⎱ &amp;rmoust; &amp;rmoustache; ⎴ &amp;tbrk; &amp;OverBracket; ⎵ &amp;bbrk; &amp;UnderBracket; ⎶ &amp;bbrktbrk; ⏜ &amp;OverParenthesis; ⏝ &amp;UnderParenthesis; ⏞ &amp;OverBrace; ⏟ &amp;UnderBrace; ⏢ &amp;trpezium; ⏧ &amp;elinters; ␣ &amp;blank; Ⓢ &amp;oS; &amp;circledS; ─ &amp;boxh; &amp;HorizontalLine; │ &amp;boxv; ┌ &amp;boxdr; ┐ &amp;boxdl; └ &amp;boxur; ┘ &amp;boxul; ├ &amp;boxvr; ┤ &amp;boxvl; ┬ &amp;boxhd; ┴ &amp;boxhu; ┼ &amp;boxvh; ═ &amp;boxH; ║ &amp;boxV; ╒ &amp;boxdR; ╓ &amp;boxDr; ╔ &amp;boxDR; ╕ &amp;boxdL; ╖ &amp;boxDl; ╗ &amp;boxDL; ╘ &amp;boxuR; ╙ &amp;boxUr; ╚ &amp;boxUR; ╛ &amp;boxuL; ╜ &amp;boxUl; ╝ &amp;boxUL; ╞ &amp;boxvR; ╟ &amp;boxVr; ╠ &amp;boxVR; ╡ &amp;boxvL; ╢ &amp;boxVl; ╣ &amp;boxVL; ╤ &amp;boxHd; ╥ &amp;boxhD; ╦ &amp;boxHD; ╧ &amp;boxHu; ╨ &amp;boxhU; ╩ &amp;boxHU; ╪ &amp;boxvH; ╫ &amp;boxVh; ╬ &amp;boxVH; ▀ &amp;uhblk; ▄ &amp;lhblk; █ &amp;block; ░ &amp;blk14; ▒ &amp;blk12; ▓ &amp;blk34; □ &amp;squ; &amp;square; &amp;Square; ▪ &amp;squf; &amp;squarf; &amp;blacksquare; &amp;FilledVerySmallSquare; ▫ &amp;EmptyVerySmallSquare; ▭ &amp;rect; ▮ &amp;marker; ▱ &amp;fltns; △ &amp;xutri; &amp;bigtriangleup; ▴ &amp;utrif; &amp;blacktriangle; ▵ &amp;utri; &amp;triangle; ▸ &amp;rtrif; &amp;blacktriangleright; ▹ &amp;rtri; &amp;triangleright; ▽ &amp;xdtri; &amp;bigtriangledown; ▾ &amp;dtrif; &amp;blacktriangledown; ▿ &amp;dtri; &amp;triangledown; ◂ &amp;ltrif; &amp;blacktriangleleft; ◃ &amp;ltri; &amp;triangleleft; ◊ &amp;loz; &amp;lozenge; ○ &amp;cir; ◬ &amp;tridot; ◯ &amp;xcirc; &amp;bigcirc; ◸ &amp;ultri; ◹ &amp;urtri; ◺ &amp;lltri; ◻ &amp;EmptySmallSquare; ◼ &amp;FilledSmallSquare; ★ &amp;starf; &amp;bigstar; ☆ &amp;star; ☎ &amp;phone; ♀ &amp;female; ♂ &amp;male; ♠ &amp;spades; &amp;spadesuit; ♣ &amp;clubs; &amp;clubsuit; ♥ &amp;hearts; &amp;heartsuit; ♦ &amp;diams; &amp;diamondsuit; ♪ &amp;sung; ♭ &amp;flat; ♮ &amp;natur; &amp;natural; ♯ &amp;sharp; ✓ &amp;check; &amp;checkmark; ✗ &amp;cross; ✠ &amp;malt; &amp;maltese; ✶ &amp;sext; ❘ &amp;VerticalSeparator; ❲ &amp;lbbrk; ❳ &amp;rbbrk; ⟦ &amp;lobrk; &amp;LeftDoubleBracket; ⟧ &amp;robrk; &amp;RightDoubleBracket; ⟨ &amp;lang; &amp;LeftAngleBracket; &amp;langle; ⟩ &amp;rang; &amp;RightAngleBracket; &amp;rangle; ⟪ &amp;Lang; ⟫ &amp;Rang; ⟬ &amp;loang; ⟭ &amp;roang; ⟵ &amp;xlarr; &amp;longleftarrow; &amp;LongLeftArrow; ⟶ &amp;xrarr; &amp;longrightarrow; &amp;LongRightArrow; ⟷ &amp;xharr; &amp;longleftrightarrow; &amp;LongLeftRightArrow; ⟸ &amp;xlArr; &amp;Longleftarrow; &amp;DoubleLongLeftArrow; ⟹ &amp;xrArr; &amp;Longrightarrow; &amp;DoubleLongRightArrow; ⟺ &amp;xhArr; &amp;Longleftrightarrow; &amp;DoubleLongLeftRightArrow; ⟼ &amp;xmap; &amp;longmapsto; ⟿ &amp;dzigrarr; ⤂ &amp;nvlArr; ⤃ &amp;nvrArr; ⤄ &amp;nvHarr; ⤅ &amp;Map; ⤌ &amp;lbarr; ⤍ &amp;rbarr; &amp;bkarow; ⤎ &amp;lBarr; ⤏ &amp;rBarr; &amp;dbkarow; ⤐ &amp;RBarr; &amp;drbkarow; ⤑ &amp;DDotrahd; ⤒ &amp;UpArrowBar; ⤓ &amp;DownArrowBar; ⤖ &amp;Rarrtl; ⤙ &amp;latail; ⤚ &amp;ratail; ⤛ &amp;lAtail; ⤜ &amp;rAtail; ⤝ &amp;larrfs; ⤞ &amp;rarrfs; ⤟ &amp;larrbfs; ⤠ &amp;rarrbfs; ⤣ &amp;nwarhk; ⤤ &amp;nearhk; ⤥ &amp;searhk; &amp;hksearow; ⤦ &amp;swarhk; &amp;hkswarow; ⤧ &amp;nwnear; ⤨ &amp;nesear; &amp;toea; ⤩ &amp;seswar; &amp;tosa; ⤪ &amp;swnwar; ⤳ &amp;rarrc; ⤵ &amp;cudarrr; ⤶ &amp;ldca; ⤷ &amp;rdca; ⤸ &amp;cudarrl; ⤹ &amp;larrpl; ⤼ &amp;curarrm; ⤽ &amp;cularrp; ⥅ &amp;rarrpl; ⥈ &amp;harrcir; ⥉ &amp;Uarrocir; ⥊ &amp;lurdshar; ⥋ &amp;ldrushar; ⥎ &amp;LeftRightVector; ⥏ &amp;RightUpDownVector; ⥐ &amp;DownLeftRightVector; ⥑ &amp;LeftUpDownVector; ⥒ &amp;LeftVectorBar; ⥓ &amp;RightVectorBar; ⥔ &amp;RightUpVectorBar; ⥕ &amp;RightDownVectorBar; ⥖ &amp;DownLeftVectorBar; ⥗ &amp;DownRightVectorBar; ⥘ &amp;LeftUpVectorBar; ⥙ &amp;LeftDownVectorBar; ⥚ &amp;LeftTeeVector; ⥛ &amp;RightTeeVector; ⥜ &amp;RightUpTeeVector; ⥝ &amp;RightDownTeeVector; ⥞ &amp;DownLeftTeeVector; ⥟ &amp;DownRightTeeVector; ⥠ &amp;LeftUpTeeVector; ⥡ &amp;LeftDownTeeVector; ⥢ &amp;lHar; ⥣ &amp;uHar; ⥤ &amp;rHar; ⥥ &amp;dHar; ⥦ &amp;luruhar; ⥧ &amp;ldrdhar; ⥨ &amp;ruluhar; ⥩ &amp;rdldhar; ⥪ &amp;lharul; ⥫ &amp;llhard; ⥬ &amp;rharul; ⥭ &amp;lrhard; ⥮ &amp;udhar; &amp;UpEquilibrium; ⥯ &amp;duhar; &amp;ReverseUpEquilibrium; ⥰ &amp;RoundImplies; ⥱ &amp;erarr; ⥲ &amp;simrarr; ⥳ &amp;larrsim; ⥴ &amp;rarrsim; ⥵ &amp;rarrap; ⥶ &amp;ltlarr; ⥸ &amp;gtrarr; ⥹ &amp;subrarr; ⥻ &amp;suplarr; ⥼ &amp;lfisht; ⥽ &amp;rfisht; ⥾ &amp;ufisht; ⥿ &amp;dfisht; ⦅ &amp;lopar; ⦆ &amp;ropar; ⦋ &amp;lbrke; ⦌ &amp;rbrke; ⦍ &amp;lbrkslu; ⦎ &amp;rbrksld; ⦏ &amp;lbrksld; ⦐ &amp;rbrkslu; ⦑ &amp;langd; ⦒ </code></pre> <p>Not fully, pls track the link for fully document.</p>
6,860
<p>I have ms sql databases that grow very large. Upon examination I find that there is a bunch of unused space in certain tables. I don't do many physical deletes, so I don't think that its just deleted records. DBCC SHRINK doesn't make the file smaller. But, if I dump the table to a new, empty database, the size goes down about 80%. Instead of the 7gb I have in this table in the current database, I end up with about 1.5gb in the fresh database. Its as if sql server is allocating too much memory. Anyone encountered this before? I'd like to be able to shrink the table by removing unused allocated space without having to create a whole new database.</p> <p>Additional information:</p> <p>Full recovery model used. I'll try rebuilding the indexes, i think its been a while. ldf's are shrunk daily using some wacky stored proc that truncates them.</p>
<p>I have found that if you do not take care to backup your transistion log file (the LDF) you will get something like this behavior. I can not stress enough the importance of having good backup "hygiene". Not only will it save your bacon if something goes wrong but I will also help maintain a nice tight database.</p>
<p>In the options, you can specify how much you want to grow by. By default i believe it's 10%, so given a 200MB database, when you fill your last page, it will allocate another 20MB of page space. At 7GB it would allocate 700MB.</p> <p>I don't know exactly where you can modify it after you create a db, but i know it has it when you create the db. a little google work will most likely reveal the answer to you.</p> <p>NOTE: my answer is not how to fix it, but maybe how to prevent / explain why you might see all this unallocated space.</p>
6,857
<p>Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster.</p> <p>Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffic to the failover server. Not too bothered about losing messages. I'd just prefer not to write the code to handle re-routing.</p>
<p>You need to use a layer 4 <a href="http://en.wikipedia.org/wiki/Load_balancing_%28computing%29#Relationship_with_failover" rel="nofollow noreferrer">load balancer</a> in front of the two endpoints. Prob best to stick with a dedicated piece of hardware.</p>
<p>We've had good luck with BigIP as a solution, though it's not cheap or easy to set up. </p> <p>One nice feature is it allows you to set up your SSL certificate (and backdoor to the CA) at the load balancer's common endpoint. Then you can use protocols to transfer the requests back to the WCF servers so the entire transmission is encrypted. </p>
2,635
<p>I recently backed a 3D printer on Kickstarter, and I would like to 3D print parts for high-temperature applications. So I have two questions; </p> <ol> <li><p>What's the highest temperature polycarbonate can be safely heated to without warping or releasing toxins?</p></li> <li><p>If there's a filament with better temp-resistance I can print could you tell me? (If you know the highest temperature it could reach safely, that would be helpful too.)</p></li> </ol> <p>My 3D printer will have a heated bed up to 100°C, and an extruder temp of up to 250°C.</p>
<ul> <li><p>Polycarbonate is <a href="https://rigid.ink/blogs/news/why-3d-print-with-polycarbonate-how-to-get-best-results" rel="noreferrer">heat-resistant up to ~120C</a>. Above this temperature it will gradually become flexible and may irreversibly bend. It will not generate any toxic fumes all the way up to ignition temperature (630C), because <a href="http://www.noxtat.com/wp-content/uploads/2011/04/MSDS-SheetPC_TEC_2000_TEC_FUSION_2004.pdf" rel="noreferrer">it's fumes are not considered harmful</a>. Note though, that with your temperature limit you may not be able to print with polycarbonate, or only do so at a very low speed.</p></li> <li><p>According to the <a href="https://filaments.ca/pages/temperature-guide" rel="noreferrer">sheets of commercially available printable plastics</a>, PC has the highest printing temperature and heat resistance among them, seconded by nylon. This refers to the FDM printers only. SLS printers may be able to use other materials, even metals like aluminum or titanium, so if you really wish to get temperature-resistant prints, you may look for workshops that have SLS printers and ask them.</p></li> </ul>
<p>All plastics have two temperatures to consider for operation and evaluation: </p> <ol> <li><p>Melting point = the temperature that plastics starts to get soft; this can be considered for maximum temperature operation.</p></li> <li><p>Flow temperature = normally used for molding process and this have a wide range of temperatures depending on PPM´s and mixtures to meet a purpose like coffee cups. <a href="https://filaments.ca/pages/temperature-guide" rel="nofollow noreferrer">Here</a> a link for filament temperature guides</p></li> </ol> <p>Polycarbonates are the most plastic used for industrial and kitchen appliances. Due higher temperatures support and hardness, so I think is not possible to use polycarbonates in 3D printers due its temperatures are from 250°C to 320°C.</p>
749
<p>I keep having a recurring problem with my ender 3 pro. The bowden tube keeps popping off here (pictured)</p> <p><a href="https://i.stack.imgur.com/hWvUQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hWvUQ.jpg" alt="enter image description here" /></a></p> <p>I've read elsewhere online where people are having a similar problem, i.e. the ptfe tube is actually popping out, but I don't know if thats the case here. It's staying attached to the metal coupler, but that metal coupler is unscrewing during the course of the print and falling out. Any tips to fix it? New one? Some sort of loc-tite to get it to not unscrew? Any ideas?</p>
<p>If the fitting is remaining attached to the PTFE tubing, that would indicate that the threaded end of the fitting is pulling out of the drive assembly. This implies that the internal threads of the drive assembly have stripped out. This is not unusual for a plastic drive assembly.</p> <p>The best solution is to replace the drive assembly. I believe I paid about US$12 for the last one I purchased and it was aluminum, not plastic. A quick search for &quot;Ender 3 drive mechanism&quot; returned a number of choices. One of them from <a href="https://rads.stackoverflow.com/amzn/click/com/B07SY745CF" rel="nofollow noreferrer" rel="nofollow noreferrer">Amazon</a> (14.98) is anodized aluminum and purports to be improved over the original.</p> <p><a href="https://i.stack.imgur.com/bT6mO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bT6mO.jpg" alt="ender 3 compatible drive assembly" /></a></p> <p>A less than ideal solution would involve drilling out the stripped threads and installing an insert (sometimes called a Heli-coil™) but that could be as expensive as a replacement mechanism.</p>
<p>If the fitting is remaining attached to the PTFE tubing, that would indicate that the threaded end of the fitting is pulling out of the drive assembly. This implies that the internal threads of the drive assembly have stripped out. This is not unusual for a plastic drive assembly.</p> <p>The best solution is to replace the drive assembly. I believe I paid about US$12 for the last one I purchased and it was aluminum, not plastic. A quick search for &quot;Ender 3 drive mechanism&quot; returned a number of choices. One of them from <a href="https://rads.stackoverflow.com/amzn/click/com/B07SY745CF" rel="nofollow noreferrer" rel="nofollow noreferrer">Amazon</a> (14.98) is anodized aluminum and purports to be improved over the original.</p> <p><a href="https://i.stack.imgur.com/bT6mO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bT6mO.jpg" alt="ender 3 compatible drive assembly" /></a></p> <p>A less than ideal solution would involve drilling out the stripped threads and installing an insert (sometimes called a Heli-coil™) but that could be as expensive as a replacement mechanism.</p>
1,818
<p>I'm getting zits or blobs in lithophanes while printing on my Ender 3 and 10S Pro. I tried a suggestion: change resolution in mesh fixes of Cura to 0.5 (from 0.05 default). That removed the zits.</p> <p>But now there are white patches as shown in the image. I reduced the resolution to 0.2 but to no avail.</p> <p>Anyone else encountered this problem?</p> <p><a href="https://i.stack.imgur.com/Xpqvz.jpg" rel="nofollow noreferrer" title="Example of white patches in a lithophane print"><img src="https://i.stack.imgur.com/Xpqvz.jpg" alt="Example of white patches in a lithophane print" title="Example of white patches in a lithophane print" /></a></p> <p><a href="https://i.stack.imgur.com/tKl6c.jpg" rel="nofollow noreferrer" title="Example of zits/blobs in a lithophane print"><img src="https://i.stack.imgur.com/tKl6c.jpg" alt="Example of zits/blobs in a lithophane print" title="Example of zits/blobs in a lithophane print" /></a></p>
<p>In short, no. A 2D image has insufficient information to determine a 3D form.</p> <p>If you want to do this yourself, what you could do is start with the 2D outline in a program like Blender (as 0scar mentioned in a comment), extrude it to make a thin &quot;cardboard cutout&quot;, then begin shaping it into three dimensions from there. Imagine it like cutting a slab of Play-doh with a cookie cutter matching your 2D outline, then using the picture and your imagination as a guide to form it into 3D. I'm not sure whether something like that makes any more sense than just starting from scratch modeling it.</p> <p>Alternatively, nowadays there <em>might</em> be some &quot;AI&quot; models to produce a reasonable guess at what 3D structure you want, with the knowledge that it's supposed to be a person, for a 2D image you provide. I'm not sure if there's anything yet of usable quality, but it's something you could look for.</p>
<p>If you only have a 2D photo then as others have already said its not really possible. However if you have the action figure itself you could try a technique called Photogrammetry where you use your phone to take multiple images of the object and then use software to build up a model. Search youtube for guides on Photogrammetry or 3D scanning with your phone. I've never done it but certainly something I'd like to try!</p>
2,009
<p>There are a number of obfuscation programs out there for .Net and I've tried one, my exe seems much slower when obfuscated. Do all obfuscation programs have the same effect or have I chosen a bad one? I'm hoping some are better than others, if you know of a fast one let me know.</p>
<p>Obfuscation <em>shouldn't</em> change the runtime performance of your code. If it is then you've got a bad obfuscator that's doing much more than just obfuscating. All obfuscation should do is make your IL hard to read.</p>
<p>There are <a href="http://howtoselectguides.com/dotnet/obfuscators/1st#dp_methods" rel="nofollow noreferrer">different obfuscation methods</a> that tools can use. There are the simple rename methods that should not affect performance in any way. Other methods might change the flow of the code. That could have a negative impact on performance. You might want to check out other obfuscators and try out different settings.</p>
9,010
<p>Specifically using stainless steel nozzles, but I guess it's worth knowing about brass too. Is there any reason to be concerned about dimensional accuracy of the nozzle or anything like that as a result of repeated heating with a butane torch? </p>
<p>If you carbonize the filament or other particles that are clogging the nozzle, then you will never get them clean. In my experience, it's not worth cleaning the nozzle with anything other than cleaning filament. If that doesn't work then change the nozzle. Heating the metal nozzle with a torch will change the temper of the material. I used to try cleaning with a soldering iron; which was to no avail.</p> <p>Purchase a dozen brass nozzles and save your self the headache. Either that or a good quality set of stainless steel ones. They are easier to clean with the cleaning filament and aren't ablated by the filament as quickly, allowing for better dimensional accuracy over multiple prints.</p> <p><a href="https://i.stack.imgur.com/2OhXB.jpg" rel="nofollow noreferrer">https://www.amazon.com/eSUN-CLEANING-Filament-Printers-Cleaning/dp/B00MVIYNFW/</a></p> <p><a href="https://i.stack.imgur.com/2OhXB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2OhXB.jpg" alt="eSun Cleaning Filament"></a></p>
<p>If you can get the torch hot enough and you carbonise/burn the filament properly, it may work. You still need to do a cold pull to remove as many residues as you can, but if you heated it enough, the residuals maybe won't stick too much to the nozzle.</p> <p>You already have the butane, try and tell us.</p>
1,628
<p>I can't seem to find that option.</p> <p>Surely it's in there?</p>
<p>That would be Tools > Options</p> <p>Text Editor > All Languages > Line Numbers (at the bottom right)</p>
<p>Tools -> Options -> Text Editor -> All languages. Near the bottom.</p>
8,332
<p>I've been working on calibrating my Taz Workhorse, and was dealing with some under-extrusion issues, despite checking the e-steps on the extruder and relatively modest retraction settings (2.5&nbsp;mm at 25&nbsp;mm/second).</p> <p>Lulzbot tech support suggested I boost my flow to 105&nbsp;% to account for this, and the little Lulzbot gear that resulted was decent (note this picture is after some minor string removal).</p> <p><a href="https://i.stack.imgur.com/7nMzh.jpg" rel="nofollow noreferrer" title="Lulzbot gear"><img src="https://i.stack.imgur.com/7nMzh.jpg" alt="Lulzbot gear" title="Lulzbot gear"></a></p> <p>I tried moving on to a articulated Turtle, and there's a consistent failure at 17&nbsp;%, where you can hear the nozzle collide with a part and knock it off the print bed, followed by the usual mayhem.</p> <p><a href="https://i.stack.imgur.com/AMnAi.jpg" rel="nofollow noreferrer" title="Failed articulated turtle"><img src="https://i.stack.imgur.com/AMnAi.jpg" alt="Failed articulated turtle" title="Failed articulated turtle"></a></p> <p>From looking at the parts, it looks like all the small joints in the piece have a lot of excess material in them, causing an upward arc, and eventually getting high enough that they're well over the height of the next layer. That's where the collision occurs, presumably.</p> <p><a href="https://i.stack.imgur.com/qXsoQ.jpg" rel="nofollow noreferrer" title="Excess material on joints#1"><img src="https://i.stack.imgur.com/qXsoQ.jpg" alt="Excess material on joints#1" title="Excess material on joints#1"></a> <a href="https://i.stack.imgur.com/lNKaa.jpg" rel="nofollow noreferrer" title="Excess material on joints#2"><img src="https://i.stack.imgur.com/lNKaa.jpg" alt="Excess material on joints#2" title="Excess material on joints#2"></a></p> <p>What's the likely cause of this? The increased flow? Some other issue?</p> <p>Other settings are mostly the Ultimaker Cura defaults, but I've also turned combing and Z-hop on (combing, especially, to combat stringing).</p> <p>Print Settings:</p> <ul> <li>Lulzbot Taz Workhorse using Cura</li> <li>Polylite PLA 2.85&nbsp;mm</li> <li>Print temperature: 215&nbsp;&deg;C (roughly the middle of the range, and where previous calibrations put me)</li> <li>Bed temperature: 60&nbsp;&deg;C</li> <li>Retraction: 2.5&nbsp;mm at 25&nbsp;mm/sec</li> <li>Combing "on"</li> <li>Z-Hop When Retracted "on" @ 1&nbsp;mm</li> <li>Fan Speed: I've tried 60&nbsp;% (default) and 100&nbsp;%</li> <li>Print Speed: 40&nbsp;mm/s</li> <li>Flow: 105&nbsp;%</li> </ul>
<p>It looks to me like you have corner curling on overhangs, which can be contributed to by a mix of:</p> <ul> <li>overextrusion (poor dimensional accuracy of filament or wrong filament diameter setting)</li> <li>uneven extrusion (due to changes in the print head motion faster than the flow response to changes in the extruder)</li> <li>uneven cooling (especially due to proximity of one side to heated bed)</li> <li>too little cooling</li> </ul> <p>and possibly other factors. I would first try lowering the bed temperature. Technically you can print PLA on an unheated bed, but adhesion may be too poor. Dropping to 45°C (my preference now) should not hurt adhesion much and might help; it partly solved my corner-curling problems.</p> <p>Both uneven extrusion and insufficient cooling can be solved solved by printing slower, but that's no fun. It works for uneven extrusion because, even under constraints on acceleration/jerk, print head can change direction almost instantaneously at low speeds, yielding near-uniform absolute velocity.</p> <p>Uneven extrusion can also be solved by cranking up the limits on acceleration and jerk. This is a tradeoff because it might get you more vibration/ringing, and beyond the physical limits of your printer it may even start skipping steps and shifting layers (failed prints), but up to that point I think it's a worthwhile tradeoff. Effects from uneven extrusion are some of the worst, in my opinion, print quality/print failure issues, and worth other minor blemishes to fix them if needed.</p>
<p>No, the print does not fail on over-extrusion, it fails by curled up parts of the print as of a filament heating/print part cooling issue.</p> <p>If the curled up part has to be completely attached to the print bed (which is not the case after release of more information, but could be informative for others), your problem could be bed adhesion. If the original part does not (as has become clear in this case), so it is in fact an <em>"overhang"</em> you are printing, this could be a print cooling issue. Furthermore, in general your printing temperature appears to be too high, you could try lowering print temperature to 200&nbsp;&deg;C (which should work fine for 2.85&nbsp;mm for not too high printing speeds), and lowering print speed and or increase print part cooling percentage (or print a more effective print cooling duct).</p> <p>Furthermore, the picture of the articulated turtle appears to show that the left side is lower, as in the bed is not properly levelled or dented (but with glass the latter is virtually impossible as glass is flat as of the nature of the production process).</p>
1,445
<p>Here is my understanding of Coasting: Coasting stops extruding early in a move so that the string itself will finish the layer.</p> <p>Here is my understanding of Combing: Combing reduces the need to retract during travel moves by making sure that the nozzle oozes where you want it to on the way to the next point.</p> <p>I'm curious as to what types of prints these are good for, and also what types of prints these would be bad for.</p> <p>So for instance, Coasting is good for prints that have a high propensity to exhibit stringing, but what types of prints would I want coasting to be deselected for?</p> <p>Similarly for combing, although I know neither the pros nor cons other than it reduces the number of retractions (decreases wear on extruder?)</p> <p>In short, basically I'm looking for the pros and cons of both of these settings. Also if my understanding of the settings themselves is incorrect please let me know. Any advice would be much appreciated.</p>
<p>If anything, combing and coasting allow to <strong>mitigate problems that are printer and filament specific</strong>, rather than dependent on particular STL models.</p> <p><strong>Combing helps</strong> - as you imply in your question - <strong>with materials prone to oozing</strong> (e.g. PETG)</p> <p><strong>Coasting is particularly good for printers with a bowden extruders and low jerk/retraction speeds</strong>. This is because in bowden extruders there is a lot of filament compressed between the teeth of the extruder servo and the nozzle, and that pressure doesn't instantly disappears when the printer stop "pushing" (i.e.: turning the extruder servo).</p> <p>I believe there are <strong>firmware implementations where coasting is also used when approaching sharp corners</strong>. This is to mitigate the problem of "blobs" forming there. The mechanics of this are similar to those explained above: the pressure within the extruder cannot be instantly relieved and coasting accounts for that. The only difference being that - because of the micro-scale of the problem - even non-bowden printers are prone to corner blobs.</p> <p>In my experience (I look forward to other answers to "compare notes") there are <strong>very few reasons not to use combing</strong>. The only risk with it is that it increases the risk of the nozzle crashing into the print and destroying it. It sound dramatic, but it is in practice it requires everything to work against you: a big blob on the previous layer, the nozzle passing exactly there, poor bed adhesion... for me that has proved problematic only when printing miniatures with a 0.2 mm nozzle and 0.05 mm layer height (on a cheap printer).</p> <p><strong>There is of course a</strong> (usually very small) <strong>time penalty in combing</strong>, as it typically requires the nozzle to travel longer paths.</p> <p>In my experience (again: YMMV, I look forward to more answers!) <strong>the limitations of coasting are related to the way it is implemented</strong>. For example, a given coasting setting may work great for getting rid of oozing, but will create under-extrusion in other parts of the print, as the calculations performed within the firmware may be spot-on for linear motion but inaccurate for corners, or vice-versa.</p> <p>I believe this is the reason while some popular slicers (like cura) have this setting hidden under "experimental".</p>
<p>Coasting is good for filaments that ooze. The stop/up/start time at the end of a layer can be long enough that a visible seam appears if the layer starts in the same place. Transparent filaments also suffer from the velocity effect at layer shifts (more transparent when extruded slower). The disadvantage is that it becomes another parameter to tune per filament.</p> <p>Combing is most useful where a part has internal spaces, but might result in longer travel.</p>
792
<p>I print ABS on a LulzBot Taz 5 and frequently have issues with the corners of objects lifting off the bed.</p> <p>My extruder is at 230&nbsp;°C and the bed is at 90&nbsp;°C for the first layer and 100&nbsp;°C for the rest of the layers.</p> <p>I have experimented with using ABS slurry (ABS + acetone) on the bed for increased adhesion, building a foam enclosure for the printer, and varying the fan speed. I have noticed the problem is more common the taller the parts are and the sharper the corner is.</p> <p>Adding ABS slurry helped for smaller parts (less than an inch tall) but with my more recent larger parts the adhesion to the bed was so good that the corners of the part lifting actually peeled the PEI tape off of the bed.</p> <p>I have tried using both a skirt and a brim with no change. The skirt stays on the bed, the brim gets pulled up with the corner.</p>
<p>There are many different approaches to solving this issue and most of the answers already are spot-on. However, the fundamental reason for the "warping" is incorrect and inconsistent temperature across the material.</p> <p>If there is too much fluctuation in the temperature across the object in this heated state can result in warping. The reason you see this mostly on the build plate is because the temperature of the first few layers of molten plastic vary much more against the build plate than against higher layers. Note that you can see additional warping mid-print using ABS and this can be a result of a draft or sudden drop in ambient temperature.</p> <p>So, to help solve your problem, here are some suggestions (sorry if there are duplicates):</p> <ul> <li>Completely <a href="https://3dprinting.stackexchange.com/questions/1292/should-i-enclose-my-3d-printer">enclose/seal your machine's build area</a> to reduce (or eliminate if possible) draft and prevent the natural heat of the machine from escaping.</li> <li>Increase the temperature on your build plate. I almost exclusively use ABS on my printer and I keep my HBP at about 112C. However, I live in the NW of the US, so my climate is naturally cooler than say Florida.</li> <li>Alternatively, <a href="https://3dprinting.stackexchange.com/questions/1251/how-to-choose-an-extrusion-temperature">try decreasing the nozzle temperature</a> to a lower point within the ABS melting range. This will just shorten the gap between the inconsistencies in temperature across layers. It is typically better to print at lower temperatures if you can help it. Obviously there are differences in the filament, so you'll have to find that "sweet spot".</li> <li><a href="https://3dprinting.stackexchange.com/questions/470/bed-leveling-method/479#479">Ensure your build plate is flat</a> and your tape doesn't have bubbles. Your BP being flat should be a no brainer, but if your kapton tape (or whatever you use) has bubbles, your freshly printed plastic may not be getting the same temperature from the BP as the rest of your part. This is a bad thing as mentioned earlier.</li> <li>Use extra adhesion techniques such as "ABS Glue" (ABS w/ acetone) or even hairspray. This works about 80% of the time for me, but can make it a bit difficult when removing the parts off the BP.</li> </ul>
<p>I think you answered your question in your statement. Lulzbot and ABS. Lulz does not have an enclosure. </p> <p>Try using PLA for an open air system. Or build an enclosure. Following you can add glue or hairspray.</p> <p>But I promise you, with any open air printer, you will face this problem. I only use ABS on my FFCPs. Even with their passive heat chambers I plan to move to PLA for all my printers.</p>
102
<p>I have just edited a new post, <a href="https://3dprinting.stackexchange.com/questions/4153/help-understanding-bridge-settings">Help understanding bridge settings</a>, so that the video would be &quot;inlined&quot; and playable in the post itself<sup>1</sup>.</p> <p>However, the video does not show up, and only the raw link (<code>https://youtu.be/HaeCBru3mOI</code>) is displayed:</p> <blockquote> <p><a href="https://i.stack.imgur.com/f7jmC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f7jmC.png" alt="Only raw link is visible" /></a></p> </blockquote> <p>This is the markup:</p> <blockquote> <p><a href="https://i.stack.imgur.com/ukkfG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ukkfG.png" alt="Markup of post" /></a></p> </blockquote> <p>I have used the <em>same</em> markup method, for inlining the video clip as this post, <a href="https://aviation.stackexchange.com/questions/34121/is-atc-communication-subject-to-fcc-profanity-regulations">Is ATC communication subject to FCC profanity regulations?</a>, on SE.Aviation:</p> <blockquote> <p><a href="https://i.stack.imgur.com/kgTCg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kgTCg.png" alt="Markup on SE.Aviation" /></a></p> </blockquote> <p>and there the video clip is inlined:</p> <blockquote> <p><a href="https://i.stack.imgur.com/LrHrI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LrHrI.png" alt="Post on SE.Aviation showing inline video clip" /></a></p> </blockquote> <hr /> <h3>TL;DR</h3> <p>Is video inlining disabled on SE.3D Printing, or is it because we are still beta?</p> <p>If it can be enabled , then should/could it be enabled?</p> <p>I personally think it would be useful to enable it, and save a few mouse clicks (and RSI) having to open the video in another tab/window etc. What do other people think?</p> <hr /> <p><sup>1</sup> See <a href="https://meta.stackexchange.com/questions/121209/allow-embedded-html5-youtube-video?rq=1">Allow embedded HTML5 YouTube video</a></p>
<p>Per answer to <a href="https://meta.stackexchange.com/questions/296832/what-are-the-limitations-in-beta">What are the limitations in Beta</a></p> <p>"Inline videos is a feature that is off by default on all sites and only turned on if the community thinks it's necessary to improve the quality of a good portion of their question base." </p>
<p>A note of caution, <a href="https://stackoverflow.com/c/moderators/questions/257#answer-261">this post</a> on the Stack Moderators site, Pᴀᴜʟsᴛᴇʀ2's post, <a href="https://stackoverflow.com/c/moderators/questions/257">How do you request embedded video for your site?</a> - As mods can only follow these links I've included the content below:</p> <blockquote> <p>I don't know how exactly to request it, but I do want to point at one pretty big downside.</p> <p><strong>The player is pretty darn big.</strong> Plus, my experience is that it has a tendency to eat CPU cycles for breakfast.</p> <p>I looked at the numbers <a href="https://space.meta.stackexchange.com/questions/883/are-there-ways-to-make-posts-with-images-better-for-low-connect-speed-users-doe/885#comment3547_885">about a year ago over on Space Exploration Meta</a>. What I found was:</p> <blockquote> <p>Loading <a href="https://space.stackexchange.com/q/21891/415">https://space.stackexchange.com/q/21891/415</a> without using the browser cache downloads 7642 KB for me just now. Of that, <code>www.youtube.com</code> is responsible for 3182 KB and <code>i.stack.imgur.com</code> another 2729 KB. Excluding just the embedded images and the video-related downloads leaves about 1.7 MB to be downloaded. That's still a sizable chunk of data for what basically amounts to a few pages of text, but not quite as extreme as 7.6 MB.</p> </blockquote> <p>So one video embed adds about 3 MB download for everyone viewing the post, regardless of whether or not they are in any way interested in the video. (I think the video itself is downloaded on demand, so if someone actually watches the video, that adds even more data, but at that point at least they have some interest in it.) In situations where connections are metered by the megabyte, this can add up quickly, and is something that should be kept in mind before turning on this feature. Not everyone is on a fast, no-extra-charge-per-megabyte connection.</p> <p>(Yes, I'm big on keeping text as mostly text. I'm old-fashioned in that regard.)</p> </blockquote> <p>Also <a href="https://stackoverflow.com/c/moderators/questions/257#answer-260">this post</a>:</p> <blockquote> <blockquote> <p>Are there any downsides to having embedded video (performance or otherwise)?</p> </blockquote> <p>Yep, <a href="https://meta.stackexchange.com/a/279637/295232">performance could be an issue</a>. Also, malicious users could post links to videos with ... questionable ... content (though this could be alleviated by requiring some reputation to post embedded videos, just as some sites do with pictures).</p> </blockquote>
41
<p>Can anyone recommend a good library for generating an audio file, such as mp3, wav, or even midi, from python?</p> <p>I've seen recommendations for working with the id tags (song name, artist, etc) in mp3 files, but this is not my goal.</p>
<p>See <a href="http://wiki.python.org/moin/Audio/" rel="noreferrer">http://wiki.python.org/moin/Audio/</a> and <a href="http://wiki.python.org/moin/PythonInMusic" rel="noreferrer">http://wiki.python.org/moin/PythonInMusic</a>, maybe some of the projects listed there can be of help.</p> <p>Also, <a href="http://www.google.com/search?q=python+audio+library" rel="noreferrer">Google is your friend</a>.</p>
<p>I've never used it, but check out <a href="http://code.google.com/p/ounk/" rel="nofollow noreferrer">ounk</a>.</p>
6,723
<p>is there a way to abort threads created with QueueUserWorkItem?</p> <p>Or maybe I don't need to? What happens if the main application exits? Are all thread created from it aborted automatically?</p>
<p>You don't need to abort them. When your application exits, .NET will kill any threads with IsBackground = true. The .NET threadpool has all its threads set to IsBackground = true, so you don't have to worry about it.</p> <p>Now if you're creating threads by newing up the Thread class, then you'll either need to abort them or set their IsBackground property to true.</p>
<p>yeah, they are background, but f.ex if you have application where you use ThreadPool for some kinda multiple downloading or stuff, and you want to stop them, how do you stop ? my suggestion would be: exit thread asap, f.ex </p> <pre><code>bool stop = false; void doDownloadWork(object s) { if (!stop) { DownloadLink((String)s, location); } } </code></pre> <p>and if you set stop = true, second (currently in queue) threads automatically exit, after queue threads finishes it process.</p>
4,641
<p>I want to quickly test an ocx. How do I drop that ocx in a console application. I have found some tutorials in CodeProject and but are incomplete. </p>
<p>Sure..it's pretty easy. Here's a fun app I threw together. I'm assuming you have Visual C++.</p> <p>Save to test.cpp and compile: cl.exe /EHsc test.cpp</p> <p>To test with your OCX you'll need to either #import the typelib and use it's CLSID (or just hard-code the CLSID) in the CoCreateInstance call. Using #import will also help define any custom interfaces you might need.</p> <pre> #include "windows.h" #include "shobjidl.h" #include "atlbase.h" // // compile with: cl /EHsc test.cpp // // A fun little program to demonstrate creating an OCX. // (CLSID_TaskbarList in this case) // BOOL CALLBACK RemoveFromTaskbarProc( HWND hwnd, LPARAM lParam ) { ITaskbarList* ptbl = (ITaskbarList*)lParam; ptbl->DeleteTab(hwnd); return TRUE; } void HideTaskWindows(ITaskbarList* ptbl) { EnumWindows( RemoveFromTaskbarProc, (LPARAM) ptbl); } // ============ BOOL CALLBACK AddToTaskbarProc( HWND hwnd, LPARAM lParam ) { ITaskbarList* ptbl = (ITaskbarList*)lParam; ptbl->AddTab(hwnd); return TRUE;// continue enumerating } void ShowTaskWindows(ITaskbarList* ptbl) { if (!EnumWindows( AddToTaskbarProc, (LPARAM) ptbl)) throw "Unable to enum windows in ShowTaskWindows"; } // ============ int main(int, char**) { CoInitialize(0); try { CComPtr&lt;IUnknown&gt; pUnk; if (FAILED(CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**) &pUnk))) throw "Unabled to create CLSID_TaskbarList"; // Do something with the object... CComQIPtr&lt;ITaskbarList&gt; ptbl = pUnk; if (ptbl) ptbl->HrInit(); HideTaskWindows(ptbl); MessageBox( GetDesktopWindow(), _T("Check out the task bar!"), _T("StackOverflow FTW"), MB_OK); ShowTaskWindows(ptbl); } catch( TCHAR * msg ) { MessageBox( GetDesktopWindow(), msg, _T("Error"), MB_OK); } CoUninitialize(); return 0; } </pre>
<p>@orion thats so cool. Never thought of it that way.</p> <p>Well @jschroedl thats was fun indeed. </p> <p>Testing an activex in console app is fun. But I think its worth not trying down that path. You can call the methods or set and get the properties either through the way @jschroedl had explained or you can call the IDIspatch object through the Invoke function. </p> <p>The first step is to GetIDsByName and call the function through Invoke and parameters to the function should be an array of VARIANTS in the Invoke formal parameter list.</p> <p>All is fine and dandy. But once you get to events its downhill from there. Windows application requires a message pump to fire events. On a console you don't have one. I went down the path to implement a EventNotifier for the events just like you implement a CallBack interface in classic C++ way. But the events doesn't get to your implemented interface. </p> <p>I am pretty sure this cannot be done on a console application. But I am really hoping someone out there will have a different take on events in a console application</p>
3,852
<p>I'm trying to maintain a Setup Project in <code>Visual Studio 2003</code> (yes, it's a legacy application). The problem we have at the moment is that we need to write registry entries to <code>HKCU</code> for every user on the computer. They need to be in the <code>HKCU</code> rather than <code>HKLM</code> because they are the default user settings, and they do change per user. My feeling is that</p> <ol> <li>This isn't possible</li> <li>This isn't something the installer should be doing, but something the application should be doing (after all what happens when a user profile is created after the install?).</li> </ol> <p>With that in mind, I still want to change as little as possible in the application, so my question is, <strong>is it possible to add registry entries for every user in a <code>Visual Studio 2003</code> setup project?</strong> </p> <p>And, at the moment the project lists five registry root keys (<code>HKEY_CLASSES_ROOT, HKEY_CURRENT_USER</code>, <code>HKEY_LOCAL_MACHINE</code>, <code>HKEY_USERS</code>, and User/Machine Hive). I don't really know anything about the Users root key, and haven't seen User/Machine Hive. Can anyone enlighten me on what they are? Perhaps they could solve my problem above.</p>
<p>First: Yes, this is something that belongs in the Application for the exact reson you specified: What happens after new user profiles are created? Sure, if you're using a domain it's possible to have some stuff put in the registry on creation, but this is not really a use case. The Application should check if there are seetings and use the default settings if not.</p> <p>That being said, it IS possible to change other users Keys through the HKEY_USERS Hive.</p> <p>I have no experience with the Visual Studio 2003 Setup Project, so here is a bit of (totally unrelated) VBScript code that might just give you an idea where to look:</p> <pre><code>const HKEY_USERS = &amp;H80000003 strComputer = "." Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\default:StdRegProv") strKeyPath = "" objReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys strKeyPath = "\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing" For Each subkey In arrSubKeys objReg.SetDWORDValue HKEY_USERS, subkey &amp; strKeyPath, "State", 146944 Next </code></pre> <p>(Code Courtesy of <a href="http://jritmeijer.spaces.live.com/blog/cns!8A48A27460FB898A!965.entry" rel="noreferrer">Jeroen Ritmeijer</a>)</p>
<p>I'm partway to my solution with this entry on MSDN (don't know how I couldn't find it before).</p> <p>User/Machine Hive<br> Subkeys and values entered under this hive will be installed under the HKEY_CURRENT_USER hive when a user chooses "Just Me" or the HKEY_USERS hive or when a user chooses "Everyone" during installation.</p> <p><s><a href="http://msdn.microsoft.com/en-us/library/x6kd89c5(VS.80).aspx" rel="nofollow noreferrer">Registry Editor</a></s> <a href="http://web.archive.org/web/20100112132447/http://msdn.microsoft.com/en-us/library/x6kd89c5(VS.80).aspx" rel="nofollow noreferrer">Archive of MSDN Article</a></p>
2,323
<p>I'd like to buy a new nozzle for my Anycubic i3 Mega because it's not precise enough - it fails to print small details like 1&nbsp;mm eyebrows.</p> <p>Currently it has a 0.4&nbsp;mm nozzle and I'd like to buy a better one but I don't know how to choose one which is compatible with this printer.</p> <p>If you have any advice, please let me know.</p>
<p>According to <a href="https://youtu.be/QnnPsoL5cHE?t=18" rel="nofollow noreferrer">Anycubic</a> this printer uses the E3D V5 type hotend as can be seen from the linked video of the AnyCubic Mega:</p> <p><a href="https://i.stack.imgur.com/WSL8p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSL8p.png" alt="E3D v5 of Anycubic Mega exploded view"></a> <a href="https://i.stack.imgur.com/cuLc1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cuLc1.png" alt="E3D v5 of Anycubic Mega assembled view"></a></p> <p>The brass nozzle you see is fully compatible with the E3D v6 nozzle and can be found on those typical auction and Chinese websites by looking for "E3D nozzle". They are also available from <a href="https://e3d-online.com" rel="nofollow noreferrer">E3D directly</a>, the designer/creator of the E3D hotend family, and other specialized manufacturers like the <a href="http://olssonruby.com/" rel="nofollow noreferrer">Olsson Ruby</a>. These nozzles have a short nozzle (snout) and are screwed into the heater block with M6 threads.<sup>1)</sup></p> <p><a href="https://i.stack.imgur.com/32U1im.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/32U1im.jpg" alt="E3D v5/v6 nozzle"></a></p> <p>The smaller the diameter, the smaller the filament traces and the higher the print detail resolution. Note that a smaller diameter causes thinner walls for the same amount of (vertical) walls and may require additional perimeters to get similar strength and rigidity. The maximum layer thickness also decreases, as prints with a layer height above 75 % of the nozzle diameter have very poor quality. As an example, a 0.25 mm nozzle should not print layers thicker than <span class="math-container">$0.75 \times 0.25\text{ mm} = 0.19\text{ mm}$</span>. </p> <p>As such printing with smaller nozzle diameters increases print time. Also note that a smaller diameter requires more force to push the filament through and <em>could</em> use some extra temperature to make the filament more fluid or reduction of the print speed.</p> <p>Just buy some spare nozzles of different nozzle diameter and experiment what works best for you.</p> <p><sup>1)</sup> - <em>The other popular style of M6 threaded nozzles has a long body and long taper (often referred to as MK8 nozzle; they come in two different shapes). While these might work, they extend from the heater block considerably further and might need readjustment of the heater block (<a href="https://3dprinting.stackexchange.com/a/9913/8884">as explained here</a>): <br> <a href="https://i.stack.imgur.com/pl9G1s.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pl9G1s.jpg" alt="MK8 nozzle variant 1"></a><a href="https://i.stack.imgur.com/k3r8Vs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k3r8Vs.png" alt="MK8 nozzle variant 2"></a></em></p>
<p>We select nozzles depending on what project we want to,do and it must match with the hot end as well.</p>
1,274
<p>Is there a limit with the number of SSL connections?</p> <p>We are trying to connect through SSL with 2000 sessions. We have tried it a couple of times but it always dies at 1062nd. Is there a limit?</p>
<p>Your operating system will have a limit on the number of open files if you are on linux ulimit -a will show your various limits.</p> <p>I imagine yours is set to 1024 and some of the sessions just happened to have closed allow the figure of 1062 (this last bit is a guess)</p>
<p>Yes, everything has a limit. As far as I'm aware, there is no inherit limit with "SSL".. it is after all just a protocol.</p> <p>But, there is a limited amount of memory, ports, CPU on the machine you are connected to, from and every single one in between.</p> <p>The actually server you are connected to may have an arbitrary limit set too. </p> <p>This question doesn't have enough information to answer beyond "YES".</p>
6,767
<p>Whats the best/easiest way to obtain a count of items within an IEnumerable collection without enumerating over all of the items in the collection?</p> <p>Possible with LINQ or Lambda?</p>
<p>You will have to enumerate to get a count. Other constructs like the List keep a running count.</p>
<p>Not possible with LINQ, as calling .Count(...) does enumerate the collection. If you're running into the problem where you can't iterate through a collection twice, try this:</p> <pre><code>List&lt;MyTableItem&gt; myList = dataContext.MyTable.ToList(); int myTableCount = myList.Count; foreach (MyTableItem in myList) { ... } </code></pre>
4,837
<p>A few weeks ago, I was assigned to evaluate all our programmers. I'm very uncomfortable with this since I was the one who taught everyone the shop's programming language (they all got out of college not knowing the language and as luck would have it, I'm very proficient with it.). On the evaluation, I was very biased on their performance (perfect scores).</p> <p>I'm glad that our programming shop doesn't require an average performance level but I heard horror stories of shops which do require an average level.</p> <p>My question are as follows: </p> <ol> <li>As a programmer, what evaluation questions would you like to see?</li> <li>As a manager, what evaluation questions would you like to see?</li> <li>As the evaluator, how can you prevent bias in your evaluation?</li> <li>I would love to remove the evaluation test. Is there any advantages to having an evaluation test? Any disadvantage?</li> </ol>
<p>Gets things done is really all you need to evaluate a developer. After that you look at the quality that the developer generates. Do they write unit tests and believe in testing and being responsible for the code they generate? Do they take initiative to fix bugs without being assigned them? Are they passionate about coding? Are they always constantly learning, trying to find better ways to accomplish a task or make a process better? These questions are pretty much how I judge developers directly under me. If they are not directly under you and you are not a direct report for them, then you really shouldn't be evaluating them. If you are assigned in evaluating those programmers that aren't under you, then you need to be proactive to answer the above questions about them, which can be hard.</p> <p>You can't remove the evaluation test. I know it can become tedious sometimes, but I actually enjoy doing it and it's invaluable for the developer you are evaluating. You need to be a manager that cares about how your developers do. You are a direct reflection on them and as they are of you. One question I always leave up to the developer is for them to evaluate me. The evaluation needs to be a two lane road.</p> <p>I have to also evaluate off a cookie cutter list of questions, which I do, but I always add the above and try to make the evaluation fun and a learning exercise during the time I have the developer one on one, it is all about the developer you are reviewing.</p>
<p>What about getting everyone's input? Everyone that a person is working with will have a unique insight into that person. One person might think someone is a slacker, while another person sees that they are spending a lot of time planning before they start coding, etc.</p>
3,494
<p>One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done).</p> <p>I'm having a hard time finding resources/guides that take you past writing a simple &quot;Hello World&quot; OS.</p> <p>I know lots of people will probably recommend I look at Linux or BSD; but the code base for systems like that is (presumably) so big that I wouldn't know where to start.</p> <p>Any suggestions?</p> <p>Update: To make it easier for people who land on this post through Google here are some OS development resources:</p> <ul> <li><p><a href="https://web.archive.org/web/20120506110242/http://osix.net/modules/article/?id=359" rel="noreferrer">Writing Your Own Operating System</a> (Thanks Adam)</p> </li> <li><p><a href="http://www.linuxfromscratch.org/" rel="noreferrer">Linux From Scratch</a> (Thanks John)</p> </li> <li><p><a href="http://en.wikipedia.org/wiki/SharpOS_(operating_system)" rel="noreferrer">SharpOS (C# Operating System)</a> (Thanks lomaxx)</p> </li> <li><p><a href="http://www.minix3.org/" rel="noreferrer">Minix3</a> and <a href="http://minix1.woodhull.com/mxdownld.html" rel="noreferrer">Minix2</a> (Thanks Mike)</p> </li> <li><p><a href="http://wiki.osdev.org/Main_Page" rel="noreferrer">OS Dev Wiki</a> and <a href="http://forum.osdev.org/" rel="noreferrer">Forums</a> (Thanks Steve)</p> </li> <li><p><a href="http://www.osdever.net/" rel="noreferrer">BonaFide</a> (Thanks Steve)</p> </li> <li><p><a href="http://osdever.net/bkerndev/Docs/intro.htm" rel="noreferrer">Bran</a> (Thanks Steve)</p> </li> <li><p><a href="http://www.jamesmolloy.co.uk/tutorial_html/index.html" rel="noreferrer">Roll your own toy UNIX-clone OS</a> (Thanks Steve)</p> </li> <li><p><a href="http://www.brokenthorn.com/Resources/OSDevIndex.html" rel="noreferrer">Broken Thorn OS Development Series</a></p> </li> </ul> <p>Other resources:</p> <p>I found a nice resource named <a href="http://mikeos.berlios.de/" rel="noreferrer">MikeOS</a>, &quot;MikeOS is a learning tool to demonstrate how simple OSes work. It uses 16-bit real mode for BIOS access, so that it doesn't need complex drivers&quot;</p> <p><em>Updated 11/14/08</em></p> <p>I found some resources at <a href="http://www.freebyte.com/operatingsystems/#osprojects" rel="noreferrer">Freebyte's Guide to...Free and non-free Operating Systems</a> that links to kits such as OSKit and ExOS library. These seem super useful in getting started in OS development.</p> <p><em>Updated 2/23/09</em></p> <p><a href="https://stackoverflow.com/users/42019/ric-tokyo">Ric Tokyo</a> recommended <a href="http://code.google.com/p/nanoos/" rel="noreferrer">nanoos</a> in this <a href="https://stackoverflow.com/questions/580308/making-an-os-in-c/580362#580362">question</a>. Nanoos is an OS written in C++.</p> <p><em>Updated 3/9/09</em></p> <p>Dinah provided some useful Stack Overflow discussion of aspiring OS developers: <a href="https://stackoverflow.com/questions/340674/roadblocks-in-creating-a-custom-operating-system">Roadblocks in creating a custom operating system</a> discusses what pitfalls you might encounter while developing an OS and <a href="https://stackoverflow.com/questions/130065/os-development">OS Development</a> is a more general discussion.</p> <p><em>Updated 7/9/09</em></p> <p>LB provided a link to the <a href="http://www.scs.stanford.edu/07au-cs140/pintos/pintos.html" rel="noreferrer">Pintos Project</a>, an education OS designed for students learning OS development.</p> <p><em>Updated 7/27/09 (Still going strong!)</em></p> <p>I stumbled upon an <a href="http://academicearth.org/courses/operating-systems-and-system-programming" rel="noreferrer">online OS course</a> from Berkley featuring 23 lectures.</p> <p><a href="http://tomos.sourceforge.net/" rel="noreferrer">TomOS</a> is a fork of <a href="http://mikeos.berlios.de/" rel="noreferrer">MikeOS</a> that includes a little memory manager and mouse support. As MikeOS, it is designed to be an educational project. It is written in NASM assembler.</p> <p><em>Updated 8/4/09</em></p> <p>I found the <a href="http://www.cs.berkeley.edu/%7Ekubitron/courses/cs162-F08/" rel="noreferrer">slides and other materials</a> to go along with the online Berkeley lectures listed above.</p> <p><em>Updated 8/23/09</em></p> <p>All <a href="https://stackoverflow.com/questions/tagged/osdev">questions tagged osdev</a> on stackoverflow</p> <p><a href="http://www.eecs.harvard.edu/syrah/os161/" rel="noreferrer">OS/161</a> is an academic OS written in c that runs on a simulated hardware. This OS is similar in Nachos. Thanks Novelocrat!</p> <p>tangurena recommends <a href="http://en.wikipedia.org/wiki/MicroC/OS-II" rel="noreferrer">http://en.wikipedia.org/wiki/MicroC/OS-II</a>, an OS designed for embedded systems. There is a <a href="https://rads.stackoverflow.com/amzn/click/com/1578201039" rel="noreferrer" rel="nofollow noreferrer">companion book</a> as well.</p> <p><a href="https://rads.stackoverflow.com/amzn/click/com/0672327201" rel="noreferrer" rel="nofollow noreferrer">Linux Kernel Development</a> by Robert Love is suggested by Anders. It is a &quot;widely acclaimed insider's look at the Linux kernel.&quot;</p> <p><em>Updated 9/18/2009</em></p> <p>Thanks Tim S. Van Haren for telling us about <a href="http://www.gocosmos.org/index.en.aspx" rel="noreferrer">Cosmos</a>, an OS written entirely in c#.</p> <p>tgiphil tells us about <a href="http://www.mosa-project.org/" rel="noreferrer">Managed Operating System Alliance (MOSA) Framework</a>, &quot;a set of tools, specifications and source code to foster development of managed operating systems based on the Common Intermediate Language.&quot;</p> <p><em>Update 9/24/2009</em></p> <p>Steve found a couple resources for development on windows using Visual Studio, check out <a href="http://www.brokenthorn.com/Resources/OSDevMSVC.html" rel="noreferrer">BrokenThorn's guide setup with VS 2005</a> or <a href="http://wiki.osdev.org/Visual%5FStudio" rel="noreferrer">OSDev's VS Section</a>.</p> <p><em>Updated 9/5/2012</em></p> <p>kerneltrap.org is no longer available. The linux kernel v0.01 is available from <a href="http://www.kernel.org/pub/linux/kernel/Historic/linux-0.01.tar.gz" rel="noreferrer">kernel.org</a></p> <p><em>Updated 12/21/2012</em> A basic OS development <a href="http://nw08.american.edu/%7Emblack/teaching.html#OSPROJECT" rel="noreferrer">tutorial</a> designed to be a semester's project. It guides you through to build an OS with basic components. Very good start for beginners. Related <a href="http://nw08.american.edu/%7Emblack/papers/sigcse09.pdf" rel="noreferrer">paper</a>. Thanks Srujan!</p> <p><em>Updated 11/15/2013</em></p> <p><a href="http://www.cs.bham.ac.uk/%7Eexr/lectures/opsys/10_11/lectures/os-dev.pdf" rel="noreferrer">Writing a Simple Operating System From Scratch</a>. Thanks James Moore!</p> <p><em>Updated 12/8/2013</em></p> <p><a href="https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System" rel="noreferrer">How to make a computer operating system</a> Thanks ddtoni!</p> <p><em>Updated 3/18/2014</em></p> <p><a href="https://github.com/klange/toaruos" rel="noreferrer">ToAruOS an OS built mostly from scratch, including GUI</a></p> <p><em>Updated Sept 12 2016</em></p> <p><a href="http://www.independent-software.com/writing-your-own-toy-operating-system/" rel="noreferrer">Writing your own Toy Operating System</a></p> <p><em>Updated Dec 10 2016</em></p> <p><a href="https://www.cs.bham.ac.uk/%7Eexr/lectures/opsys/10_11/lectures/os-dev.pdf" rel="noreferrer">Writing a Simple Operating System —from Scratch</a> (thank you @Tyler C)</p>
<p>There are a lot of links after this <a href="http://www.osix.net/modules/article/?id=359" rel="noreferrer">brief overview</a> of what is involved in writing an OS for the X86 platform.</p> <p>The link that appears to be most promising (www.nondot.org/sabre/os/articles) is no longer available, so you'll need to poke through the <a href="http://web.archive.org/web/20021207220335/http://www.nondot.org/sabre/os/articles" rel="noreferrer">Archive.org version</a> to read it.</p> <p>At the end of the day the bootloader takes the machine code of the kernel, puts it in memory, and jumps to it. You can put any machine code in the kernel that you want, but most C programs expect an OS so you'll need to tell your compiler that it won't have all that, or the bootloader has to create some of it.</p> <p>The kernel then does all the heavy lifting, and I suspect it's the example kernel you want. But there's a long way to go between having a kernel that says, "Hello world" to having a kernel that loads a command interpretor, provides disk services, and loads and manages programs.</p> <p>You might want to consider subscribing to ACM to get access to their older literature - there are lots of articles in the late 80's and early 90's in early computing magazines about how to <a href="http://portal.acm.org/citation.cfm?id=87073.87079" rel="noreferrer">create alternative OSs</a>. There are likely books that are out of print from this era as well. You might be able to get the same information for free by looking up the indexes of those magazines (which are available on that site - click "index" near the magazine name) and then asking around for people with a copy.</p> <p>Lastly, I know that usenet is dead (for so sayeth the prophets of internet doom) but you'll find that many of the craggy old experts from that era still live there. You should search google groups (they have dejanews's old repository) and I expect you'll find many people asking the same questions a decade or 1.5 ago that you're asking now. You may even run across Linus Torvalds' many queries for help as he was developing linux originally. If searches don't bring anything up, ask in the appropriate newsgroup (probably starts with comp.arch, but search for ones with OS in the name).</p>
<p>Intresting Question for the programmers. See it will take long long long time to build OS like Windows or Mac but if you want build a simple ones then you can try your best</p> <ol> <li>You need to focus on Assembly Language,C and C++. You should be expert in these languages.</li> <li>First read a good book on how OS works[Google it], then read all the info from <a href="http://wiki.osdev.org/" rel="nofollow" title="Wiki OS">Wiki OS</a></li> <li>Search in youtube "How to create your own OS in Assembly Language" watch the video, <a href="http://www.youtube.com/watch?v=Lgd5aV2LKrk" rel="nofollow" title="Youtube Video, how to create your own OS">Eg. Video</a></li> <li>Download Linux OS source code and compile it yourself and try to modify the code yourself</li> <li>Now you are an experienced OS editor now download <a href="http://www.minix3.org/index.html" rel="nofollow" title="Minix">Minix</a> and <a href="http://www.qnx.com/" rel="nofollow" title="QNX">QNX</a> and start developing with them and get their docs from here <a href="http://www.minix3.org/documentation/index.html" rel="nofollow" title="Minix Doc">Minix Doc</a> and <a href="http://support7.qnx.com/download/download/20982/590.39_65_Quickstart_Guide_P6.pdf" rel="nofollow" title="QNX Doc">QNX Doc</a></li> </ol> <p>Now you have gained the master degree(Not completely just a little more to go) in creating OS now distribute this knownledge to your freinds and with their help try to create an OS as powerful as Mac, Linux or Windows</p>
6,475
<p>I've recently started work on the Compact Framework and I was wondering if anyone had some recommendations for unit testing beyond what's in VS 2008. MSTest is <em>ok</em>, but debugging the tests is a nightmare and the test runner is <em>so</em> slow.</p> <p>I see that NUnitLite on codeplex is an option, but it doesn't look very active; it's also in the roadmap for NUnit 3.0, but who knows when that will come out. Has anyone had any success with it?</p>
<p>What we've done that really improves our efficiency and quality is to multi target our mobile application. That is to say with a very little bit of creativity and a few conditional compile tags and custom project configurations it is possible to build a version of your mobile application that also runs on the desktop. </p> <p>If you put all your business logic you need tested in a separate project/assembly then this layer can be very effectively tested using any of the desktop tools you are already familiar with.</p>
<p>We use NUnitLite, although I think we did have had to add some code to it in order for it to work. </p> <p>One of the problems we found is that if you are using parts of the platform that only exist in CF, then you can only run those tests in NUnitLite on an emulator or Windows Mobile device, which makes it hard to run the tests as part of an integrated build process. We got round this by added a new test attribute allowing you to disable the tests what would only run on the CF (typically these would be p/invoking out to some windows mobile only dll).</p>
3,531
<p>Does anyone have experience using the URL Rewrite Module (see <a href="http://blogs.iis.net/bills/archive/2008/07/09/new-iis7-releases-url-rewrite-application-routing-and-load-balancing-and-powershell-cmd-lets.aspx" rel="nofollow noreferrer">here</a>)?</p> <p>Can it be used to do <a href="http://en.wikipedia.org/wiki/Reverse_proxy" rel="nofollow noreferrer">reverse proxy</a>?</p>
<p>If you have enough RAM, SQL will do an outstanding job determining what to load into RAM and what to seek on disk. </p> <p>This question is asked a lot and it reminds me of people trying to manually set which "core" their process will run on -- let the OS (or in this case the DB) do what it was designed for.</p> <p>If you want to verify that SQL is in fact reading your look-up data out of cache, then you can initiate a load test and use Sysinternals <a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel="nofollow noreferrer">FileMon</a>, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">Process Explorer</a> and <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">Process Monitor</a> to verify that the 1GB table is not being read from. For this reason, we sometimes put our "lookup" data onto a separate filegroup so that it is very easy to monitor when it is being accessed on disk.</p> <p>Hope this helps.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms178015(SQL.90).aspx" rel="nofollow noreferrer">DBCC PINTABLE</a> will explicitly pin a table in core if you want to make sure it remains cached.</p>
6,455
<p>I am looking for methods to reduce the amount of noise produced by my CR-10. I have the printer in my downstairs study and if I'm doing a long print job, you can hear it upstairs in my son's bedroom and I don't want it keep him awake.</p> <p>I've seen there are noise reduction feet available on Thingiverse but apparently these can result quite significant vibrations of the printer itself, which could mess up the print.</p> <p>I've also seen one guy using a paving block but I'm not sure how effective that would be and also don't think my cheap Ikea desk would cope very well with having a concrete block put on it.</p> <p>I was wondering about trying an off-cut of carpet. Has anyone tried this or have any other suggestions?</p>
<p>Personally for vibration reduction I use a large mouse pad I cut to size, but I'd imagine the carpet would perform just fine. I would also recommend enclosing your printer (this had the most profound effect for me) and upgrading your stepper drivers.</p>
<p>If you hear it from a floor to the other the only thing to change is the base of the printer. Nothing else matters.</p> <p>CNC Kitchen performed measurements especially to avoid noise being transferred to other rooms, the result is that placing the printer not on elastic feet, but on a single slab of concrete which is placed on top of foam is the best solution and reduces the noise significantly.</p> <p><div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/y08v6PY_7ak?start=0"></iframe> </div></div></p>
660
<p>I am building on C++ dll, by writing code in C#.</p> <p>I get an error, saying </p> <blockquote> <p>LoaderLock was detected Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.</p> </blockquote> <p>I tried seraching what this error exactly means, but I am drawing pointless articles, mostly saying that it's just a warning, and I should switch that off in Visual Studio. The other solutions seem to be due to ITunes, or this problem occurring when programming with DirectX. My problem is connected to neither.</p> <p>Can anybody explain, what this actually means?</p>
<p>The general idea of loader lock: The system runs the code in DllMain inside a lock (as in - synchronization lock). Therefore, running non-trivial code inside DllMain is &quot;asking for a deadlock&quot;, as described <a href="https://devblogs.microsoft.com/oldnewthing/20040128-00/?p=40853" rel="nofollow noreferrer">here</a>.</p> <p>The question is, why are you trying to run code inside DllMain? Is it crucial that this code run inside the context of DllMain or can you spawn a new thread and run the code in it, and not wait for the code to finish execution inside DllMain?</p> <p>I believe that the problem with manged code specifically, is that running managed code might involves loading the CLR and suchlike and there's no knowing what could happen there that would result in a deadlock... I would not heed the advice of &quot;disable this warning&quot; if I were you because most chances are you'll find your applications hangs unexpectedly under some scenarios.</p>
<p>This problem occurs because of the way in which the debugger in Visual Studio runs managed applications that use Microsoft Foundation Classes version 8.0 in one or more DLL files.</p> <p>Have a thorough reading at: <a href="http://msdn.microsoft.com/en-us/library/aa290048(vs.71).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa290048(vs.71).aspx</a></p>
8,061
<p>When houses are printed with concrete cement what replaces the steel rebar for reinforcement?</p> <p>Here's a link referencing printing concrete: <a href="https://www.aniwaa.com/house-3d-printer-construction/" rel="nofollow noreferrer">https://www.aniwaa.com/house-3d-printer-construction/</a></p> <blockquote> <p>House 3D printers use extrusion technology. Some construction 3D printers look like super-sized desktop FFF/FDM 3D printers (gantry style), whereas others consist of a rotating mechanical arm.</p> <p>In both cases, paste-type components such as concrete are used as filament. The material is pushed out of a special nozzle to form layers. To put it (very) simply, paste extrusion is similar using a piping bag to spread frosting on a cake.</p> <p>The printer creates the foundations and walls of the house or building, layer by layer. The ground is literally the printer’s build plate. Some concrete 3D printers, however, are used to 3D print brick molds. When molded, the bricks are then piled atop each other manually (or with a robotic arm).</p> </blockquote> <p>Like most of the people here my experience is with a printer (RepRap) that can use PLA or ABS. With all the materials normally put into concrete, using an extrusion printer to print concrete is puzzling.</p>
<p>The extruder can't push anymore when the filament is past the extruder gear. If your filament has run out to that point, the print will <em>not</em> halt but print without a filament, meaning that the print will fail. You need to pause the print in time and then put fresh filament into the printer.</p> <p>If the end of the filament is cut flat at the end and the new one is flat too, the new filament can push the old one out to the nozzle, reducing the waste to a minimum, if you can live without retraction for the amount of length that has to be used up. You could friction weld the two parts together to alleviate this.</p>
<p>The extruder can't push anymore when the filament is past the extruder gear. If your filament has run out to that point, the print will <em>not</em> halt but print without a filament, meaning that the print will fail. You need to pause the print in time and then put fresh filament into the printer.</p> <p>If the end of the filament is cut flat at the end and the new one is flat too, the new filament can push the old one out to the nozzle, reducing the waste to a minimum, if you can live without retraction for the amount of length that has to be used up. You could friction weld the two parts together to alleviate this.</p>
1,272
<p>I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/<code>.htaccess</code> voodoo.</p> <p>So if I go to <code>www.mydomain.com/test</code> it redirects (but keeps the url of (<code>www.mydomain.com/test</code>) in the browser's address bar and the pages are served by the dotted quad IP asp.net box.</p>
<p>Instead of pointing <code>www.yourdomain.com/test</code> at your test server, why not use <code>test.yourdomain.com</code>?</p> <p>Assuming you have access to the DNS records for <code>yourdomain.com</code>, you should just need to create an A record mapping <code>test.yourdomain.com</code> to your test server's IP address.</p>
<p>It is quite possible, if I understand what you're getting at.</p> <p>You have a PHP server with your domain pointing to it. You also have a separate ASP.NET server that only has an IP address associated with it, no domain.</p> <p>Is there any drawback to simply pointing your domain name to your ASP.NEt box?</p>
6,809
<p>What's the difference between the inner workings of Java's JVM and .NET's CLR?</p> <p>Perhaps a starting point would be, are they basically the same thing in their respective environments (Java > JVM > Machine code) (C# > CLR > IL).</p> <hr> <p><strong>Update:</strong> Several people have alluded to the points I was trying to cover:</p> <ol> <li>Garbage Collection </li> <li>Boxing/Unboxing</li> <li>JIT debugging </li> <li>Generics/Templates</li> <li>Please feel free to suggest other good topics that differentiate the two.</li> </ol> <p><a href="https://stackoverflow.com/users/5056/george-mauer">@George Mauer</a> - this sounds very interesting:</p> <blockquote> <p>Already posted this once but here is a <a href="http://www.artima.com/intv/anders.html" rel="nofollow noreferrer">series of interviews</a> with c# chief language designer Anders Hejlsberg. </p> </blockquote>
<p>From <a href="http://social.msdn.microsoft.com/forums/en-US/clr/thread/38223155-c07c-472a-8903-6cdaf5f110ea/" rel="nofollow noreferrer">here</a>. I couldn't have said it better (Well, with the exception of a flame war, this is a flameless place :-) ).</p> <blockquote> <p>Hello,</p> <p>Responding to your question seems fraught with peril by starting a flame war, so I'll proceed cautiously.</p> <p>There are a number of fundamental technical similarities between the Java Runtime and the Common Language Runtime, including garbage collected memory, an intermediate language (Microsoft IL versus Java ByteCode), core system libraries, and support for fairly high level languages, code security, and deployment.</p> <p>However, each of these 'similar' areas also have a number of sizable and small differences, and it's beyond the scope of a simple Forum post to describe most of them.</p> <p>I would suggest asking a more targetted question about any of the various runtime features and component areas (e.g. memory management, compilation, system libraries, security, etc.) and then we can provide a more targetted response (e.g. a blog, a technical article, or some books).</p> </blockquote>
<p>There differences in garbage collection as well. JVM uses Copying collector and Mark and sweep. .NET user Copying collector and Mark and compact (Much harder to implement).</p> <p>Also type erasure mentioned by Flyswat is important. JVM doesn't have a clue about generics and everything is object and associated perf. penalty of boxing and unboxing. Also reflection won't give you generic information. CLR supports generics natively.</p>
8,367
<p>I have an application that imports large volumes of data daily, several 100 thousands records.<br> Data comes from different sources. The data is read using C#, then bulk inserted into the database. <br> <br> This data is then processed:</p> <ul> <li>different tables are linked</li> <li>new tables are generated</li> <li>data is corrected using complicated algorithmns (totals of certain tables have to total zero)</li> </ul> <p>Most of this processing is done in stored procedures. <br> Although some of the complex processing would be simpler in C#, the extraction of the data into a dataset and its reinjection would slow things down considerably. <br> You may ask why I do not process the data before inserting it into the database, but I do not think it practical to manipulate 100,000s of records in memory, and the SQLs set based commands help when creating lots of records. <br> <br> This will probably spark up the age old question of using stored procedures and their pros and cons. (eg. How do you unit test stored procedures?) <br> <br> What I would like in response, is your experience with large volumes of data and how you tackled the problem.</p>
<p>I would use SSIS or DTS (assuming you are talking about MSSQL). They are made for that purpose and work with SPs if you need them.</p> <p>Another option is to preprocess the data using Perl. Even though it sounds like a wierd suggestion, Perl is actually extremely fast in these scenarios. I've used it in the past to process billions of records in reasonable time (i.e. days instead of weeks).</p> <p>Regarding "How do you Unit Test store procedures", you unit test them with MBUnit like anything else. Only bit of advice: the setup and rollback of the data can be tricky, you can either use a DTS transaction or explicit SQL statements.</p>
<p>Where you process data depends greatly on what you're doing. If you need, for example, to discard data which you don't want in your database, then you would process that in your C# code. However, data to process in the database should generally be data which should be "implementation agnostic". So if someone else wants to insert data from a Java client, the database should be able to reject bad data. If you put that logic into your C# code, the Java code won't know about it.</p> <p>Some people object and say "but I'll never use another language for the database!" Even if that's true, you'll still have DBAs or developers working with the database and they'll make mistakes if the logic isn't there. Or your new C# developer will try to shove in data and not know about (or just ignore) data pre-processors written in C#.</p> <p>In short, the logic you put in your database should be enough to guarantee that the data is correct without relying on external software.</p>
9,646
<p>Wondering if there is a better why in the WHERE clause of choosing records when you need to look at effective start and end dates?</p> <p>Currently this how I've done it in the past on MS SQL Server. Just worried about the date and not the time. I'm using SQL Server 2005.</p> <pre><code>AND Convert(datetime, Convert(char(10), ep.EffectiveStartDate, 101)) &lt;= Convert(datetime, Convert(char(10), GetDate(), 101)) AND Convert(datetime, Convert(char(10), ep.EffectiveEndDate, 101)) &gt;= Convert(datetime, Convert(char(10), GetDate(), 101)) </code></pre>
<p>That is terrible, take a look at <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/only-in-a-database-can-you-get-1000-impr" rel="nofollow noreferrer">Only In A Database Can You Get 1000% + Improvement By Changing A Few Lines Of Code</a> to see how you can optimize this since that is not sargable</p> <p>Also check out <a href="http://wiki.lessthandot.com/index.php/Get_Datetime_Without_Time" rel="nofollow noreferrer">Get Datetime Without Time</a> and <a href="http://wiki.lessthandot.com/index.php/Query_Optimizations_With_Dates" rel="nofollow noreferrer">Query Optimizations With Dates</a></p>
<p>try</p> <pre><code>ep.EffectiveStartDate BETWEEN @date1 AND @date2 </code></pre> <p>where you would do something like</p> <pre><code>declare @date1 datetime, @date2 datetime; set @date1 = cast('10/1/2000' as datetime) set @date2 = cast('10/1/2020' as datetime) </code></pre>
4,283
<p>Is there a good, native Mac tool to view Mercurial repositories, similar to gitnub for Git?</p>
<p>I know it's pretty old question, however just for sake of completeness, I think it is still worth to mention here the newest kid on the block called <a href="http://bitbucket.org/snej/murky/wiki/Home" rel="nofollow noreferrer">Murky</a>. </p>
<p>You can use the one "built in", <a href="http://www.selenic.com/mercurial/wiki/index.cgi/HgkExtension" rel="nofollow noreferrer"><code>hg view</code></a>. You'll need <code>TCL</code> installed though.</p> <blockquote> <p>From the documentation:</p> <blockquote> <p>The hgk Tcl script is a direct port of the gitk tool used with git. The hgk.py extension allows hgk to interact with mercurial in a git-like manner.</p> </blockquote> </blockquote> <p><em>edit</em> @ <a href="https://stackoverflow.com/questions/30903/good-mercurial-repository-viewer-for-mac#31434">Matthew</a>: yeah, that's why I linked to the documentation that explains it. You need to enable it in your .hgrc (like the <code>fetch</code> command), and TCL --as mentioned.</p>
5,076
<p>What is the power consumption of your heatbed (size) and hotend (model)?</p> <p>I want to verify that it is possible to use a battery to power them.</p>
<p>I have a Kill-A-Watt meter so I got a pretty good measurement for you with my Anet A6. Like Petar said each model is different but this should give you a idea. When heating both the nozzle and heat bed the printer consumes 160&nbsp;W of power, once to temp it backs down to 9&nbsp;W (it also uses 9&nbsp;W when just "sitting doing nothing and is on"). When the nozzle and bed get down in temp it hits back up to 160&nbsp;W. Basically it is never a consistent heating, it is on and off. Like a refrigerator. </p> <p>When it comes to heating only the nozzle the printer uses 60&nbsp;W (so 51&nbsp;W is going to the nozzle for heating).</p> <p>When it comes to heating only the bed the printer uses 142&nbsp;W (133&nbsp;W to the bed).</p> <p>This is interesting because it would make sense the printer needs more than 160&nbsp;W when 51&nbsp;W is going for the nozzle and 142&nbsp;W going to the bed, that makes 193&nbsp;W. I make mention of this because that may suggest my power supply is not big enough and the printer could really use around 200&nbsp;W. </p> <p>As a little bonus when the printer is moving around (stepper motors are active) I find it using 35-40&nbsp;W (or 26-31&nbsp;W) to power the steppers. </p> <p>So with all the said, is it possible to use a battery? Yes, you could. And to give a example a car battery should have 80 Amp-hours (or something like that, but we will go with it). With that battery you can get 960&nbsp;Wh (Watt-hours) from the battery before it dies. Going with my printer using 160&nbsp;W I will get 6 hours of printing time. But keep in mind as the battery is used the voltage will drop, so in the end the printer will be getting something like 10&nbsp;V which I am sure will affect heating and overall performance. </p> <p>Last thing I feel that needs to be said. If using a inverter to convert the 12&nbsp;V battery to 110&nbsp;V (or whatever voltage you use) a cheap one will not be healthy for the printer. Cheap inverters put out square waves instead of sines waves. Basically it will hurt the printer. You can learn more at this <a href="http://www.zelect.in/inverter/square-wave-inverter-vs-sine-wave-inverter" rel="nofollow noreferrer">WEBSITE</a></p> <p>"Update" on March 4 I read a comment that mentioned running right off the battery without a battery and then I thought of something that I did not think of before. And that would be protecting the battery itself</p> <p>So I said you can run the printer off the battery. There was one issue that I had not thought of. And that was the voltage drop and the battery discharged. A battery usually does not have voltage-cut off to keep the battery from being overly discharged, and a printer does not have anything to measure voltage (why should it). So a simple hook up of a 3D printer to a battery is prone to drain the battery much lower than 10&nbsp;V, which will greatly shorten a battery life-span. This can be prevented two ways. </p> <p>A circuit between battery and 3D printer. There is plenty of circuits that can be bought as long as they cut power to printer at 10&nbsp;V or something (for lead acid anyway) and can handle the amperage draw. </p> <p>An inverter can also be used because this voltage cut off is already in them. But remember that square waves are bad for the printer. </p>
<p>To answer the underlying (X-Y) question, yes it is possible to power a small 3D printer from a battery pack. <a href="https://www.3ders.org/articles/20171005-naomi-sexycyborg-wu-3d-prints-on-the-go-with-awesome-wearable-3d-printer.html" rel="nofollow noreferrer">This Article</a> describes a printer built by Naomi Wu, mounted on a frame to carry around whilst printing, as a 'novel' style of sponsored video. The printer here is a BIQU Delta printer, and the power supply is 2x 3Ah batteries (guessing this is @12V, but it's not clear). Presumably there is no heated bed, but still the run-time will be quite limited.</p> <p>The important part for working out battery life is the duty cycle of the hot-end, not the load required to get it up to temperature. This probably comes to something like 15-30 watts on average, provided you can live without a heated bed.</p> <p>Of course, if you have 10-15v batteries, the printer will probably run off these directly, no need to waste energy converting up to 110/220V and back again.</p>
831
<p>Pretty much every other editor that isn't a vi descendant (vim, cream, vi-emu) seems to use the emacs shortcuts (<kbd>ctrl</kbd>+<kbd>w</kbd> to delete back a word and so on)</p>
<p>Early software was often modal, but usability took a turn at some point, away from this style. </p> <p>VI-based editors are total enigmas -- they're the only real surviving members of that order of software. </p> <p>Modes are a no-no in usability and interaction design because we humans are fickle mammals who cannot be trusted to remember what mode the application is in. </p> <p>If you think you are in one "mode" when you are actually in another, then all sorts of badness can ensue. What you believe to be a series of harmless keystrokes can (in the wrong mode) cause unlimited catastrophe. This is known as a "mode error".</p> <p>To learn more, search for the term "modeless" (and "usability")</p> <p>As mentioned in the comments below, a Modal interface in the hands of an experienced and non-fickle person can be extremely efficient.</p>
<p>Though not really answering your question, there used to be a "modal like" way to write Japanese on cell phones before : The first letter you hit was a conson let's say K, and then, and then the next key you would hit would have the role of a conson. (Having two conson in a row is impossible in Japanese)</p> <p>Though it was main a few years ago, today it's only used by people who really want to hit fast.</p>
3,522
<p>So I've had my CR-10 Mini for some months now, and I've been continually having strange problems with bed leveling. Basically, after leveling the bed and printing a part, the bed is no longer leveled for printing again.</p> <p>Just now, I auto-homed, leveled the bed to where there was a pretty good amount of friction between the nozzle and a piece of paper, and started a print. The first layer didn't look like it was getting squished just that little bit that it should be, so I stopped the print, auto-homed again and checked the leveling with the paper. Low and behold, there was <strong>no friction at all</strong> between the nozzle and the paper. I re-leveled again and restarted the print, and then the first layer went down OK.</p> <p>So what I'd like to know is why the heck am I having so many leveling problems?!? I've checked to make sure all my set screws are tight, my belts properly tensioned, and the rollers on the bed adjusted to slide smoothly but still have a good amount of grab. Help?</p>
<p>The Creality CR-10 Mini is a <strong>portal printer</strong> using a <strong>single Z lead screw at one side</strong> of the portal to move the whole X axis gantry. This implies that the X gantry needs to be very stiff when raised and lowered from one side and also have a minimum of play on the rollers (especially on the lead screw driven side). </p> <p>I have seen many complaints from experience of people complaining that the gantry is not stiff enough, or that there is too much play on the rollers on either side of the gantry to result in a skew gantry. Consistent leveling is very hard on such machines. A colleague of me added an extra stepper (and split the original stepper connector) to have it raised and lowered from both sides. Do understand that this is also not optimal, missed steps on one of either sides can also cause the X gantry to become skew. A better solution is to create a belt driven extra lead screw that is powered by one stepper, you will not experience a skew gantry as the gantry is integrally moved.</p>
<p>The Creality CR-10 Mini is a <strong>portal printer</strong> using a <strong>single Z lead screw at one side</strong> of the portal to move the whole X axis gantry. This implies that the X gantry needs to be very stiff when raised and lowered from one side and also have a minimum of play on the rollers (especially on the lead screw driven side). </p> <p>I have seen many complaints from experience of people complaining that the gantry is not stiff enough, or that there is too much play on the rollers on either side of the gantry to result in a skew gantry. Consistent leveling is very hard on such machines. A colleague of me added an extra stepper (and split the original stepper connector) to have it raised and lowered from both sides. Do understand that this is also not optimal, missed steps on one of either sides can also cause the X gantry to become skew. A better solution is to create a belt driven extra lead screw that is powered by one stepper, you will not experience a skew gantry as the gantry is integrally moved.</p>
1,177
<p>Is there a difference (performance, overhead) between these two ways of merging data sets?</p> <pre><code>MyTypedDataSet aDataSet = new MyTypedDataSet(); aDataSet .Merge(anotherDataSet); aDataSet .Merge(yetAnotherDataSet); </code></pre> <p>and</p> <pre><code>MyTypedDataSet aDataSet = anotherDataSet; aDataSet .Merge(yetAnotherDataSet); </code></pre> <p>Which do you recommend?</p>
<p>Those two lines do different things.</p> <p>The first one creates a new set, and then merges a second set into it.</p> <p>The second one sets the ds reference to point to the second set, so:</p> <pre><code>MyTypedDataSet ds1 = new MyTypedDataSet(); ds1.Merge(anotherDataSet); //ds1 is a copy of anotherDataSet ds1.Tables.Add("test") //anotherDataSet does not contain the new table MyTypedDataSet ds2 = anotherDataSet; //ds12 actually points to anotherDataSet ds2.Tables.Add("test"); //anotherDataSet now contains the new table </code></pre> <hr> <p>Ok, let's assume that what you meant was:</p> <pre><code>MyClass o1 = new MyClass(); o1.LoadFrom( /* some data */ ); //vs MyClass o2 = new MyClass( /* some data */ ); </code></pre> <p>Then the latter is better, as the former creates an empty object before populating it.</p> <p>However unless initialising an empty class has a high cost or is repeated a large number of times the difference is not that important.</p>
<p>Your second example does <strong>not</strong> create a new dataset. It's just a second <em>reference</em> to an existing dataset.</p>
8,085
<p>Does anyone know any simple way to retrieve the country from a given IP Address, preferably in ISO_3166-1 format?</p>
<p>A lot of people (including my company) seem to use MaxMind GeoIP.</p> <p>They have a free version <a href="http://dev.maxmind.com/geoip/geoip2/geolite2/" rel="noreferrer">GeoLite</a> which is not as accurate as the paid version, but if you're just after something simple, it may be good enough.</p>
<p>You can give a try to <a href="https://astroip.co" rel="nofollow noreferrer">https://astroip.co</a>, it is a new Geolocation API I built which exposes geo data together with other useful datapoints like currency, timezone, ASN data and security.</p> <p>Here it is an example of the json response:</p> <pre><code>curl https://api.astroip.co/70.163.7.1 { &quot;status_code&quot;: 200, &quot;geo&quot;: { &quot;is_metric&quot;: false, &quot;is_eu&quot;: false, &quot;longitude&quot;: -77.0924, &quot;latitude&quot;: 38.7591, &quot;country_geo_id&quot;: 6252001, &quot;zip_code&quot;: &quot;22306&quot;, &quot;city&quot;: &quot;Alexandria&quot;, &quot;region_code&quot;: &quot;VA&quot;, &quot;region_name&quot;: &quot;Virginia&quot;, &quot;continent_code&quot;: &quot;NA&quot;, &quot;continent_name&quot;: &quot;North America&quot;, &quot;capital&quot;: &quot;Washington&quot;, &quot;country_name&quot;: &quot;United States&quot;, &quot;country_code&quot;: &quot;US&quot; }, &quot;asn&quot;: { &quot;route&quot;: &quot;70.160.0.0/14&quot;, &quot;type&quot;: &quot;isp&quot;, &quot;domain&quot;: &quot;cox.net&quot;, &quot;organization&quot;: &quot;ASN-CXA-ALL-CCI-22773-RDC&quot;, &quot;asn&quot;: &quot;AS22773&quot; }, &quot;currency&quot;: { &quot;native_name&quot;: &quot;US Dollar&quot;, &quot;code&quot;: &quot;USD&quot;, &quot;name&quot;: &quot;US Dollar&quot;, &quot;symbol&quot;: &quot;$&quot; }, &quot;timezone&quot;: { &quot;is_dst&quot;: false, &quot;gmt_offset&quot;: -18000, &quot;date_time&quot;: &quot;2020-12-05T17:04:48-05:00&quot;, &quot;microsoft_name&quot;: &quot;Eastern Standard Time&quot;, &quot;iana_name&quot;: &quot;America/New_York&quot; }, &quot;security&quot;: { &quot;is_crawler&quot;: false, &quot;is_proxy&quot;: false, &quot;is_tor&quot;: false, &quot;tor_insights&quot;: null, &quot;proxy_insights&quot;: null, &quot;crawler_insights&quot;: null }, &quot;error&quot;: null, &quot;ip_type&quot;: &quot;ipv4&quot;, &quot;ip&quot;: &quot;70.163.7.1&quot; } </code></pre>
2,343
<p>I got a Function that returns a <code>Collection&lt;string&gt;</code>, and that calls itself recursively to eventually return one big <code>Collection&lt;string&gt;</code>.</p> <p>Now, i just wonder what the best approach to merge the lists? <code>Collection.CopyTo()</code> only copies to string[], and using a <code>foreach()</code> loop feels like being inefficient. However, since I also want to filter out duplicates, I feel like i'll end up with a foreach that calls <code>Contains()</code> on the <code>Collection</code>.</p> <p>I wonder, is there a more efficient way to have a recursive function that returns a list of strings without duplicates? I don't have to use a <code>Collection</code>, it can be pretty much any suitable data type.</p> <p>Only exclusion, I'm bound to Visual Studio 2005 and .net 3.0, so no LINQ.</p> <p><strong>Edit:</strong> To clarify: The Function takes a user out of Active Directory, looks at the Direct Reports of the user, and then recursively looks at the direct reports of every user. So the end result is a List of all users that are in the "command chain" of a given user.Since this is executed quite often and at the moment takes 20 Seconds for some users, i'm looking for ways to improve it. Caching the result for 24 Hours is also on my list btw., but I want to see how to improve it before applying caching.</p>
<p>If you're using List&lt;> you can use .AddRange to add one list to the other list.</p> <p>Or you can use yield return to combine lists on the fly like this:</p> <pre><code>public IEnumerable&lt;string&gt; Combine(IEnumerable&lt;string&gt; col1, IEnumerable&lt;string&gt; col2) { foreach(string item in col1) yield return item; foreach(string item in col2) yield return item; } </code></pre>
<p>As far as merging goes:</p> <blockquote> <p>I wonder, is there a more efficient way to have a recursive function that returns a list of strings without duplicates? I don't have to use a Collection, it can be pretty much any suitable data type.</p> </blockquote> <p>Your function assembles a return value, right? You're splitting the supplied list in half, invoking self again (twice) and then merging those results. </p> <p>During the merge step, why not just check before you add each string to the result? If it's already there, skip it.</p> <p>Assuming you're working with sorted lists of course.</p>
7,995
<p>I recently asked a question about what I called "method calls". The answer referred to "messages". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I learned to program.</p> <p>Is there a distinction between the various terms for methods/messages/etc. in OO programming? Is this a difference that comes from different programming languages using different terminology to describe similar concepts?</p> <p>I seem to remember that in pre-OO languages, a distinction would sometimes be made between "subroutines" and "functions" based on whether a return value was expected, but even then, was this a language-by-language distinction?</p>
<p>I've found this to be a language and programming-paradigm thing. One paradigm — OOP — refers to objects with member methods, which conceptually are how you send messages to those objects (this view is reflected in UML, for example).</p> <p>Another paradigm — functional — may or may not involve classes of objects, but functions are the atomic unit of work. </p> <p>In structured programming, you had sub-routines (notice that the prefix "sub" implies structure).</p> <p>In imperative programming (which overlaps with structured quite a lot, but a slightly different way of looking at things), you have a more formulaic view of the world, and so 'functions' represent some operation (often mathematical).</p> <p>All you have to do to not sound like a rube is to use the terminology used by the language reference for the language you're using.</p>
<p>I'm not sure about origin of <em>message</em> terminology. Most ofter I encounter <em>messages</em> in UML design. Objects (Actors in UML terminology) can communicate with each other by means of <em>messages</em>. In real-world code <em>message</em> is just a function call usually. I think of message as of attempt to communicate with some object. It can be a real message (like messages in OS) or function calls.</p>
6,536
<p>I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams. This MS Visual Studio 2005 Workspace has all C source files. When i create a "DEBUG" configuration for the workspace and build and execute it, it runs fine, i.e. it generates all the 31 output files as expected. But when I set the configuration of the workspace to "RELEASE" mdoe, and repeat the process, the encoder crashes at some test case run.</p> <p>Now to debug this is verified following:</p> <ol> <li>Analyzed the code to see if there was any variable initialization being missed out in every run of the encoder </li> <li>Checked the various Workspace(Solution) options in both the modes (DEBUG and RELEASE). </li> </ol> <p>There are some obvious differences, but i turned the optimization related options explicitly same in both modes. </p> <p>But still could not nail the problem and find a fix for that. Any pointers?</p> <p>-Ajit.</p>
<p>It's hard to say what the problem might be without carefully inspecting the code. However...</p> <p>One of the differences between debug and release builds is how the function call stack frame is set up. There are certain classes of bad things you can do (like calling a function with the wrong number of arguments) that are not fatal in a debug build but crash horribly in a release build. Perhaps you could try changing the stack frame related options (I forget what they're called, sorry) in the release build to the same as the debug build and see whether that helps.</p> <p>Another thing might be to enable all the warnings you possibly can, and fix them all.</p>
<p>Are you sure there are no precompile directives that, say, ignores some really important code in Release mode but allows them in Debug?</p> <p>Also, have you implemented any logging that might point out to the precise assembly that's throwing the error?</p>
3,005
<p>I want to tackle an experiment with the following goal:</p> <blockquote> <p>Determine the correlations between printing parameters (temperatures, speeds, humidity, perimeters, infill, etc.) and tensile strength using a specific 3D printer, test specimen, and filament brand/model.</p> </blockquote> <p>This goal calls for two parts then: a standardized <strong>test procedure</strong> and <strong>test specimen</strong>. For the test procedure, I've been asking myself:</p> <blockquote> <p>What portable, measurable and roughly consistent tensile strength test does not require building a complicated machine, can be performed with ready-made tools or machines available at a large hardware store, and can be set up within 5 minutes?</p> </blockquote> <p>I am thinking here about a procedure that lies somewhere between this <a href="https://youtu.be/CZX8eHC7fws?t=136" rel="noreferrer">hanging scale test</a> and ISO 527. Definitely not using <a href="https://youtu.be/R7gpW6aCz0o?t=116" rel="noreferrer">bare hands</a> or <a href="https://youtu.be/bmgSojocJ3c?t=388" rel="noreferrer">pliers</a>. Once the procedure is defined, this begs the question:</p> <blockquote> <p>Is the ISO 3167 multipurpose test specimen an appropriate specimen for the test procedure outlined above or are there other specimens that are more suitable?</p> </blockquote> <p>I was thinking that, since the usual filaments have an ultimate strength of around <a href="https://www.simplify3d.com/support/materials-guide/properties-table/" rel="noreferrer">40-60 MPa</a>, perhaps the "recoil" would be too much and one needs to use a smaller, weaker specimen.</p>
<p>For these kind of tests you could rely on the <a href="https://www.astm.org/" rel="nofollow noreferrer">ASTM</a> standards. They define test procedures and test specimen sizes for different types of tests. Or you can derive a specimen yourself based on these standards (e.g. for my bachelor's degree I used an alternative notch impact specimen as I was bound to the amount of available material of the turbine rotor blade the specimens were taken from). Considering the material, you could device up a contraption made from extrusion profiles or something.</p> <p>Please do note that to get reasonable results, you would have to do a lot of tests as the spread in results is probably even more than in metals. </p> <p>The company I work for does this, these material qualification programmes run for long times (years, as we also do fatigue and creep testing), and a lot of samples are tested to qualify for use in Aerospace applications.</p>
<p>A reliable and repeatable test can be performed by printing cylinders, tapping them to M4 thread and then testing the resulting bolts.</p> <p>My Tech Fun <div class="youtube-embed"><div> <iframe width="640px" height="395px" src="https://www.youtube.com/embed/ZiQek0wei1g?start=0"></iframe> </div></div> does something like that, but he prints the thread directly, which may be less repeatable.</p> <p>Then you can perform pull and bend tests on the samples using simple attachments available at the hardware store.</p>
996
<p>Are there any automatic methods for trimming a path string in .NET?</p> <p>For example:</p> <pre><code>C:\Documents and Settings\nick\My Documents\Tests\demo data\demo data.emx </code></pre> <p>becomes</p> <pre><code>C:\Documents...\demo data.emx </code></pre> <p>It would be particularly cool if this were built into the Label class, and I seem to recall it is--can't find it though!</p>
<p>Use <strong>TextRenderer.DrawText</strong> with <strong>TextFormatFlags.PathEllipsis</strong> flag</p> <pre><code>void label_Paint(object sender, PaintEventArgs e) { Label label = (Label)sender; TextRenderer.DrawText(e.Graphics, label.Text, label.Font, label.ClientRectangle, label.ForeColor, TextFormatFlags.PathEllipsis); } </code></pre> <blockquote> <p>Your code is 95% there. The only problem is that the trimmed text is drawn on top of the text which is already on the label.</p> </blockquote> <p>Yes thanks, I was aware of that. My intention was only to demonstrate use of <code>DrawText</code> method. I didn't know whether you want to manually create event for each label or just override <code>OnPaint()</code> method in inherited label. Thanks for sharing your final solution though.</p>
<p>What you are thinking on the label is that it will put ... if it is longer than the width (not set to auto size), but that would be</p> <pre><code>c:\Documents and Settings\nick\My Doc... </code></pre> <p>If there is support, it would probably be on the Path class in System.IO</p>
4,084
<p>So, I am kinda new to ASP.net development still, and I already don't like the stock ASP.net controls for displaying my database query results in table format. (I.e. I would much rather handle the HTML myself and so would the designer!)</p> <p>So my question is: What is the best and most secure practice for doing this without using ASP.net controls? So far my only idea involves populating my query result during the Page_Load event and then exposing a DataTable through a getter to the *.aspx page. From there I think I could just iterate with a foreach loop and craft my table as I see fit.</p>
<p>I believe you're looking for a <code>&lt;Repeater&gt;</code> control. It contains some functionality similar to the GridViews, but allows you hand-craft all of the HTML for the Header, Item, and Footers yourself. Simply call the databinding code as you would for a gridview, and change the ASPX page to suit your exact HTML needs.</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc163780.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163780.aspx</a></p>
<p>If you're more interested in hand Coding your HTML, it might be worth looking at the <a href="http://www.asp.net/mvc/" rel="nofollow noreferrer">ASP.NET MVC project</a>. You get a little more control over things than standard WebForms.</p> <p>As an aside, plugging data access code in the Page_Load is never a good idea. It ties your presentation too much to your data code. Have a look at either the MVC as suggested above which applies a standard design pattern to separate concerns, or do a google search for "ASP.NET nTier" or something similar. It might take a little longer to get a site up and running, but it will save you pain in the long run.</p>
9,403
<p>I use cruisecontrol.rb for CI and FogBugz for bug tracking, but the more general the answers, the better.</p> <p>First is the technical problem: is there an API for FogBugz? Are there good tutorials, or better yet, pre-written code?</p> <p>Second is the procedural problem: what, exactly, should the CI put in the bug tracker when the build breaks? Perhaps:</p> <p>Title: "#{last committer} broke the build!"</p> <p>Body: "#{ error traces }"</p> <p>I suppose this presupposes the answer to this question: should I even put CI breaks into my bug tracking?</p>
<p>All the CI setups I've worked with send an email (to a list), but if you did want—especially if your team uses FogBugz much as a todo system—you could just open a case in FogBugz 6. <a href="http://www.fogcreek.com/FogBugz/docs/60/topics/advanced/API.html" rel="nofollow noreferrer">It has an API</a> that lets you open cases. For that matter, you could just configure it to send the email to your FogBugz' email submission address, but the API might let you do more, like assign the case to the last committer.</p> <p><a href="https://stackoverflow.com/users/1557/brian-laframboise">Brian</a>'s answer suggests to me, if your CI finds a failure in a commit that had a case number, you might even just reopen the existing case. Like codifying a case field for every little thing, though, there's a point where the CI automation could be "too smart," get it wrong, and just be annoying. Opening a new case could be plenty.</p> <p>And thanks: this makes me wonder if I should try integrating our <a href="http://search.cpan.org/~zev/Test-Chimps-0.07/" rel="nofollow noreferrer">Chimps</a> setup with our FogBugz! </p>
<p>CC comes with a utility that warns you when builds fail, it probably isn't worth logging the failing build in FogBugz - you don't need to track issues that are immediately resolved (as most broken builds will be)</p> <p>To go the other way round (FogBugz showing checkins that fixed the issue) you need a web based repository browser - FogBugz is easy to configure so that it shows the right changes.</p>
3,418
<p>I am currently loading a lightbox style popup that loads it's HTML from an XHR call. This content is then displayed in a 'modal' popup using <code>element.innerHTML = content</code> This works like a charm.</p> <p>In another section of this website I use a Flickr 'badge' (<a href="http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/" rel="noreferrer">http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/</a>) to load flickr images dynamically. This is done including a script tag that loads a flickr javascript, which in turn does some <code>document.write</code> statments.</p> <p>Both of them work perfectly when included in the HTML. Only when loading the flickr badge code <em>inside</em> the lightbox, no content is rendered at all. It seems that using <code>innerHTML</code> to write <code>document.write</code> statements is taking it a step too far, but I cannot find any clue in the javascript implementations (FF2&amp;3, IE6&amp;7) of this behavior.</p> <p>Can anyone clarify if this should or shouldn't work? Thanks.</p>
<p>In general, script tags aren't executed when using innerHTML. In your case, this is good, because the <code>document.write</code> call would wipe out everything that's already in the page. However, that leaves you without whatever HTML document.write was supposed to add.</p> <p>jQuery's HTML manipulation methods will execute scripts in HTML for you, the trick is then capturing the calls to <code>document.write</code> and getting the HTML in the proper place. If it's simple enough, then something like this will do:</p> <pre><code>var content = ''; document.write = function(s) { content += s; }; // execute the script $('#foo').html(markupWithScriptInIt); $('#foo .whereverTheDocumentWriteContentGoes').html(content); </code></pre> <p>It gets complicated though. If the script is on another domain, it will be loaded asynchronously, so you'll have to wait until it's done to get the content. Also, what if it just writes the HTML into the middle of the fragment without a wrapper element that you can easily select? <a href="http://github.com/iamnoah/writeCapture" rel="noreferrer">writeCapture.js</a> (full disclosure: I wrote it) handles all of these problems. I'd recommend just using it, but at the very least you can look at the code to see how it handles everything.</p> <p>EDIT: Here is a <a href="http://iamnoah.github.com/writeCapture/lbFlickrDemo.html" rel="noreferrer">page</a> demonstrating what sounds like the effect you want.</p>
<p>Can I get some clarification first to make sure I get the problem?</p> <p><code>document.write</code> calls will add content to the markup at the point in the markup at which they occur. For example if you include <code>document.write</code> calls in a function but call the function elsewhere, the <code>document.write</code> output will happen at the point in the markup the function is <em>defined</em> not where it is <em>called</em>.</p> <p>Therefore for this to work at all the Flickr <code>document.write</code> statements will need to be part of the <code>content</code> in <code>element.innerHTML = content</code>. Is this definitely the case?</p> <p>You might quickly test if this should work at all by adding a single and simple <code>document.write</code> call in the content that is set as the <code>innerHTML</code> and see what this does:</p> <pre><code>&lt;script&gt; var content = "&lt;p&gt;1st para&lt;/p&gt;&lt;script&gt;document.write('&lt;p&gt;2nd para&lt;/p&gt;');&lt;/script&gt;" element.innerHTML = content; &lt;/script&gt; </code></pre> <p>If that works, the concept of <code>document.write</code> working in content set as the <code>innerHTML</code> of an element might just work.</p> <p>My gut feeling is that it won't work, but it should be pretty straightforward to test the concept.</p>
7,751
<p>I want to build a 3D printer with a heating chamber of around 90 °C with build area 200x200x200 mm. I have never build a CoreXY system, so my design is currently an XY system with moving X motor (mounted on Y). Since it has a heating chamber I can't use normal stepper motor (there's a way, but I have to provide forced air cooling like NASA did, or water cooling). Extruder is Bowden type. I have already sourced almost all components, but I'm stuck at choosing the motor.</p> <p>I could find high temperature stepper motor in India (that's where I'm from), but it cost too much. I <a href="https://visionminer.com/products/high-temp-motorx-extruder?_pos=1&amp;_sid=7b5e5e603&amp;_ss=r" rel="nofollow noreferrer">found one at the Visionminer website</a>, they're the dealers for Intamsys printers, which has a chamber of 90 °C and they are providing replacement stepper motors as well.</p> <p>Comparing the cost, the motor I found in India costs three times as above. Even with shipping I will save a lot. But one issue is they're not providing any details about torque and current rating. There's one image in the website and it says,</p> <pre><code>MOONS STEPPING MOTOR TYPE 17HDB001-11N 60904162 18/04/12 </code></pre> <p>I thought it might be a MOONS motor, so I contacted them, no reply so far. I tried to find the motor by part number, but failed. I tried mailing Visionminer as well.</p> <p>Anyone have any idea which motor is this or know any high temperature motors?</p> <p>Also they use Gates belts, which is rated for 85 °C. How reliable will it be in 90 °C chamber?</p> <p>I will heat the chamber using a external heater with fan.</p> <p>My extruder is Bowden, same as you've shown E3D V6, with updated high temp parts. Plated Cu heater block + Nozzle, High temp heating coil and Thermocouple.</p> <p>But In my design X axis motor is moving one. I mean it's mounted on Y Similar to this <a href="https://drive.google.com/open?id=1g-pOCmL_2Vm1df78jYKZNPT7aMvoe8Ke" rel="nofollow noreferrer">image</a></p> <p><a href="https://i.stack.imgur.com/BJ3qe.jpg" rel="nofollow noreferrer" title="X axis stepper mounted on Y axis"><img src="https://i.stack.imgur.com/BJ3qe.jpg" alt="X axis stepper mounted on Y axis" title="X axis stepper mounted on Y axis" /></a></p> <p>So it will be inside the chamber and I have to cool it somehow or looks for high temp motor</p> <p>What I'm trying to print is PEEK, and it requires around 80-90 Degree chamber, and most stepper motors are rated for an ambient temperature of 50 Degrees. And I'm really planning to seal the chamber using SS sheet. It's going to be something like <a href="https://www.intamsys.com/funmat-ht-3d-printer/" rel="nofollow noreferrer">Intamsys funmat HT</a>. What is the biggest print, I mean duration that you run your printer at 60 Degrees?</p>
<p>An alternative to finding steppers that can withstand the heat, you can consider not getting the heat near the steppers:</p> <ul> <li><em>Moving the steppers outside the heated build volume</em><br> With 2 extra pulleys per stepper you can get the steppers outside the build volume.</li> </ul> <p><a href="https://i.stack.imgur.com/he7hz.png" rel="nofollow noreferrer" title="CoreXY kinematics based on source image of Greg Hoge"><img src="https://i.stack.imgur.com/he7hz.png" alt="CoreXY kinematics, steppers brought outside chamber" title="CoreXY kinematics based on source image of Greg Hoge"></a></p> <ul> <li><em>Shield the motors from the heat by placing them in a cooler tunnel or behind a face plate/cover</em><br> You can also shield the steppers from the heat, e.g. the Ultimaker 3(E) the steppers are behind a cover.</li> </ul> <p>Be aware that creating a 90&nbsp;&deg;C heat chamber, all the printed parts for the CoreXY need to be printed in a filament type that can withstand prolonged exposure to the temperature you want the chamber to be (or be made in metal). For the mentioned temperature this implies the use of some more exotic filament types, see e.g. <a href="/a/6120/">this answer</a>.</p>
<p>You don't need to worry about the stepper for heating chamber since the direct drive uses a fan for cooling the motor area.</p> <p><a href="https://i.stack.imgur.com/MfR7h.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MfR7h.jpg" alt="enter image description here"></a></p> <p>When I started to make my own printer I had the same question but in order to make me feel good and peace. I prefer to use a bowder extruder.</p> <p><a href="https://i.stack.imgur.com/AChjC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AChjC.jpg" alt="enter image description here"></a></p> <p>This bowden extruder comes in different sizes: Normal as picture shows above, small, and mini like the other that shows pre assembled below.</p> <p><a href="https://i.stack.imgur.com/plV2c.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/plV2c.jpg" alt="enter image description here"></a></p> <p>However the question should be different like, <strong>Can I print inside an oven?</strong> for this will address the question to other possibilities:</p> <p>1.- Cover or shield the motor with some foil to avoid the heating <br> 2.- Add a water cooling like CPU, so the water flows from outside to the motor to keep a low temperature. <br> 3.- Add cooling fans, this ones should take te air from outside and tha air can be directed with a corrugated tube for the Extruder motor and the radiator. For the X, Y and Z motors can be a rigid tube. </p> <p>This cooling fans won't affect the internal chamber temperature due the cooling process is punctual. </p> <p>4.- Many electronics components are designed to work at 105°, so won't be affected in short terms, however the life of circutry will decrease a lot, since designs cover until 5 years at normal conditions so your printer can last up to 1.5 years.</p> <p>Recommendations:</p> <p>I don't see a real reason to keep the printer isolated to high temperatures while the porpuse of this is to keep temperature variations from clime like winter and summer. In my case the print room has a normal temperature of 38°C on summers and -2°C on winter, so how can I print with the same quality on winter if the printer is so cold? <em>ah, I need a chamber to keep that temperature of summer</em>. then I made the chamber to acheive 38°C not the whole temperature of the bed print. </p> <p>If I need to print ABS so I set the bed temperature to 80°C so the parts won´t get warped, due the temperature for adhesive for ABS is the correct; also this temperature won´t over heat the chamber at least near to 60°C, but can it be reduced extracting the heat with other fan. For this case is just only one or two fans.</p> <p><a href="https://i.stack.imgur.com/KPzRf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KPzRf.jpg" alt="enter image description here"></a></p> <p>Note: The Idea to have the whole printer inside an oven will help to keep that 80°-95°C under control is good, but some times is hard to implement it due materials and its purposes are different and serviseable life will be too low.</p> <p>So your chamber should include the printing area only or follow the recommendation as the picture above. Those photo was taken from the site <a href="https://www.engineering.com/3DPrinting/3DPrintingArticles/ArticleID/5353/A-New-Industrial-RepRap-Emerges.aspx" rel="nofollow noreferrer">industrial RepRap</a> and also exposes som e features as i'm suggesting.</p>
1,429
<p>So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET".</p> <p>I've seen some examples/helpers out on the nets, but some are dated. Figured this would be a good place to keep the latest and greatest.</p> <p>I'm using latest version of rhino mocks</p>
<p>Using MoQ it looks something like this:</p> <pre><code>var request = new Mock&lt;HttpRequestBase&gt;(); request.Expect(r =&gt; r.HttpMethod).Returns("GET"); var mockHttpContext = new Mock&lt;HttpContextBase&gt;(); mockHttpContext.Expect(c =&gt; c.Request).Returns(request.Object); var controllerContext = new ControllerContext(mockHttpContext.Object , new RouteData(), new Mock&lt;ControllerBase&gt;().Object); </code></pre> <p>I think the Rhino Mocks syntax is similar.</p>
<p>I find that long mocking procedure to be too much friction.</p> <p>The best way we have found - using ASP.NET MVC on a real project - is to abstract the HttpContext to an IWebContext interface that simply passes through. Then you can mock the IWebContext with no pain.</p> <p>Here is an <a href="http://code.google.com/p/tarantino/source/browse/trunk/src/Tarantino.Core/Commons/Services/Web/IWebContext.cs" rel="nofollow noreferrer">example</a></p>
5,261
<p>I'm writing opengl code in python using the library pyglet. When I draw to the screen using pyglet.graphics.vertex_list or pyglet.graphics.batch objects, they are very slow (~0.1 fps) compared to plain old pyglet.graphics.draw() or just glVertex() calls, which are about 40fps for the same geometry. In Linux the vertex_list is about the same speed as glVertex, which is disappointing, and batch methods are about twice as fast, which is a little better but not as much gain as I was hoping for.</p>
<p>Don't forget to invoke your pyglet scripts with 'python -O myscript.py', the '-O' flag can make a huge performance difference.</p> <p>See pyglet docs <a href="https://pyglet.readthedocs.io/en/pyglet-1.3-maintenance/programming_guide/gl.html?highlight=performance#error-checking" rel="nofollow noreferrer">here</a> and <a href="https://pyglet.readthedocs.io/en/pyglet-1.3-maintenance/programming_guide/options.html?highlight=debug_gl" rel="nofollow noreferrer">here</a>.</p>
<p>I don't know personally, but I noticed that you haven't posted to <a href="http://groups.google.com/group/pyglet-users" rel="nofollow noreferrer">the pyglet mailing list</a> about this. More Pyglet users, as well as the primary developer, read that list.</p>
9,282
<p>I am a complete noob when it comes to the 3d printing world. I just finished assembling my printer and I plug it into my computer with the included usb cable and nothing happens. My computer does recognize the printer being plugged in but it just says "unrecognized device in com 4". Nothing else past that. Somebody please help me with the following steps that need to be taken to get my CPU talking with my printer. </p>
<p>Your question addresses (USB) computer connection, so that will be addressed in this answer. For connection to the printer, you need 2 things (apart from the apparent things as computer, printer and cable):</p> <ol> <li>A working CH340 driver installed on the computer for USB communication with the board,</li> <li>a piece of software to talk to the computer at a bit transfer rate the printer understands.</li> </ol> <p>The cheap Arduino based boards rely on the CH340 chip for USB communication. You should check whether you have correctly installed this driver. These drivers are erroneous and prone to cause problems. Sometime re-installation works, once did work for me.</p> <p>The SD card supplied by Anet contains a folder (on my SD card: <code>.\A8\A8资料\Software\CH340G Drive</code>) with the installer file of the driver. Once installed properly, you should be able to connect various applications to the A8, provided you use the correct baud rate of 115200.</p> <p>All this said, <strong>are you asking the correct question</strong>? Why do you need to connect to a computer, as you can print just fine by putting sliced <code>.stl</code> files (<code>.gcode</code> files) onto the SD card (when inserted in the computer using the adapter) and reinsert the card again in the printer to select the file using the menu buttons of the printer. Printing from SD card is considered safer then printing via the computer over USB as the print will stop when the PC is shut down or crashes.</p>
<p>Try using the provided SD card and SD adapter with Cura to give the printer gcode. If your computer isn't communicating properly with your printer, you can just download Cura 14 (it comes on the SD card) and upload the configuration file (also on the SD card). You can then plug the SD card into your main board and access it via the LCD screen. </p>
895
<p>octoprint seems to have a setting that involves googles DNS server.</p> <p>my question is is that server used to access octoprint over the internet via printoid "android app" or via browser? if not then what does it mean? <a href="https://i.stack.imgur.com/MWTnq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MWTnq.jpg" alt="enter image description here"></a></p>
<p>The program is pinging that address to check the internet connection to "prevent resource intensive operations if it's already clear that they won't succeed anyhow". It checks for connectivity, if it has it then it will check for update otherwise it won't check for an update.</p>
<p>That's just Google's DNS (name resolution) server. 8.8.8.8 and 8.8.4.4 are the Google values. Your ISP will also have a DNS server that you could use, which is what it says to use Google's "if you don't know what to set here".</p> <p>Using the Google values are your best bet since they'll pretty much absolutely always be online and available.</p>
728
<p>Is <a href="http://cpan.uwinnipeg.ca/dist/DBI" rel="noreferrer">CPAN DBI</a> the best database interface to use in Perl for general database use? Are there some better options?</p>
<p>If you're just looking for low-level database access&mdash;you feed it any SQL string (optionally with place-holders and bind values) and it runs your query and gives you back the results&mdash;then yes, <a href="http://search.cpan.org/dist/DBI/" rel="nofollow noreferrer">DBI</a> is your best bet, by far.</p> <p>If you want a higher-level interface (i.e., one that requires little or no use of raw SQL in your code) then there are several ORMs (<a href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="nofollow noreferrer">object-relational mappers</a>) available for Perl. Check out the <a href="http://www.perlfoundation.org/perl5/index.cgi?orm" rel="nofollow noreferrer">ORM</a> page at the Perl Foundation's Perl 5 wiki for more information and links. (If you want help choosing among them or have specific questions, you could narrow the focus of this question or perhaps post another one.)</p>
<p>Basically you should be used to using only DBI firstly.</p>
6,435
<p>Using the svnmerge.py tool it is possible to merge between branches, up and down. It is hard to find the details for doing this. Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details requested!</p>
<p>It looks like you're asking about 1.5 merge tracking. Here's a quick overview for doing merges to/from trunk (or another branch): <a href="http://blog.red-bean.com/sussman/?p=92" rel="nofollow noreferrer">http://blog.red-bean.com/sussman/?p=92</a></p>
<p>With svnmerge.py, you initialize both branches (when going in one direction, you only need to initialize one of the branches). Then merge using the -b (For bidirectional flag). Here is a summary starting from branch one to branch two. $REPO is the protocol and path to your repository.</p> <blockquote> <p>svn copy $REPO/branches/one $REPO/branches/two \<br> -m "Creating branch two from branch one."<br> svn checkout branches/one one<br> svn checkout branches/two two</p> <p>cd one svnmerge init ../two<br> cd ../two<br> svnmerge init ../one </p> </blockquote> <p>You may now edit both branches. Changes from one to two can be merged by:</p> <blockquote> <p>cd two<br> svnmerge merge -b -S one<br> svn commit -F svnmerge-commit-message.txt </p> </blockquote> <p>Conversely, changes from two to one can be merge by:</p> <blockquote> <p>cd one<br> svnmerge merge -b -S two<br> svn commit -F svnmerge-commit-message.txt </p> </blockquote> <p>Be sure to note the -b flag!</p>
9,393
<p>I have a query where I am searching against a string:</p> <pre><code>SELECT county FROM city WHERE UPPER(name) = 'SAN FRANCISCO'; </code></pre> <p>Now, this works fine, but it doesn't scale well, and I need to optimize it. I have <a href="http://www.ibm.com/developerworks/db2/library/techarticle/0203adamache/0203adamache.html" rel="nofollow noreferrer">found an option</a> along the lines of creating a generated view, or something like that, but I was hoping for a simpler solution using an index.</p> <p>We are using DB2, and I really want to use an <a href="http://ibmsystemsmag.blogs.com/db2utor/2007/11/db2-9-index-wit.html" rel="nofollow noreferrer">expression in an index</a>, but this option seems to only be available on z/OS, however we are running Linux. I tried the expression index anyways:</p> <pre><code>CREATE INDEX city_upper_name_idx ON city UPPER(name) ALLOW REVERSE SCANS; </code></pre> <p>But of course, it chokes on the UPPER(name).</p> <p>Is there another way I can create an index or something similar in this manner such that I don't have to restructure my existing queries to use a new generated view, or alter my existing columns, or any other such intrusive change?</p> <p>EDIT: I'm open to hearing solutions for other databases... it might carry over to DB2...</p>
<p>You could add an indexed column holding a numerical hash key of the city name. (With duplicates allowed).</p> <p>Then you could do a multi-clause where :</p> <pre><code>hash = [compute hash key for 'SAN FRANCISCO'] SELECT county FROM city WHERE cityHash = hash AND UPPER(name) = 'SAN FRANCISCO' ; </code></pre> <p>Alternatively, go through your db manual and look at the options for creating table indexes. There might be something helpful.</p>
<p>Oracle supports function-based indexes. Their canonical example:</p> <pre><code> create index emp_upper_idx on emp(upper(ename)); </code></pre>
3,392
<p>I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily?</p>
<p>Try WinSQL lite at <a href="http://www.indus-soft.com/SynametricsWebApp/WinSQL.jsp" rel="nofollow noreferrer">http://www.indus-soft.com/SynametricsWebApp/WinSQL.jsp</a>. It is absolutely free and does not expire. It is only one file and does not come with any bulky DLLs. If you don't like it, simply delete the file from your hard drive.</p> <p>An introduction about how to use it against an informix database can be found in <a href="http://www.inquiry.com/techtips/info_pro/10min/10min0700/10min0700.asp" rel="nofollow noreferrer">this article</a>.</p>
<p>The best alround one is <a href="http://www.toadsoft.com/" rel="nofollow noreferrer">TOAD</a></p>
5,416
<p>I've seen several Q&amp;As on recycling and reusing plastic from failed prints, but what have you done with the last few meters of filament? I've been keeping the ends of PLA (or sections I needed to cut) to maybe use for friction welding pieces together, but I only need so much for that. I've considered just shoving the last bit in the tube and using a new roll to push it through (so long as retractions aren't necessary).</p> <p>This is especially a concern for more exotic filaments where friction welding isn't useful and the price is higher for that 1m section (something like Copperfill).</p> <p>Note: I have a Bowden extruder. I imagine this is less of an issue with DD extruders.</p>
<p>The welding option is only appropriate if you have the tool needed for it, the lighter welding is really hard to do and if your printer allows it you could just watch for the moment the spool runs out and push the new filament as the last of the previous one gets extruded, that's what I used to do on my bowden extruder reprap and apart from a really negligible retraction problem on one layer it just works</p> <p>Or you could go the cool way:</p> <ul> <li>Use the last of the filament for friction/iron welding to fix or glue 3D printed parts together</li> <li>Use it as regular filament with a 3D printer pen to fix 3D printed parts</li> <li>"Use it for pin/studs/rivets/hinges in prints." as tjb1 said</li> <li>Stock it with your failed/ waste 3D printed parts and use them in a recyclebot later to make new filament or simply melt it in an oven to make plastic boards/injection molding material</li> <li>Throw it away but that would be a waste over time</li> </ul>
<ul> <li><p>Weld the fragment to the beginning of a new spool and use it that way. <a href="http://www.i3dinno.com/easywelder-p186486.html" rel="noreferrer">Most are made from metal</a> so they aren't that easy to make at home. Here is another <a href="https://3dprinting.stackexchange.com/questions/1345/how-to-connect-filament-end-to-end">answer</a> that lists other methods to weld filament including using heat shrink tubing.</p></li> <li><p>As you mentioned, you can use it for friction welding.</p></li> <li><p>Use it for pin/studs/rivets/hinges in prints.</p></li> <li><p>Throw it away. 1.75mm * 1Kg is about 330m of filament, 3mm * 1Kg is about 110m of filament. The leftover isn't worth much when you consider how much is on a spool.</p></li> </ul>
725
<p><strong>Original Question</strong></p> <p>I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. (<em>But the answers to this post have helped a lot.</em>)</p> <p>What can I do better to teach him effectively? Is there a logical order that I can use to run through concept by concept? Are there complexities I should avoid till later?</p> <p>The language we are working with is <a href="http://www.python.org" rel="noreferrer">Python</a>, but advice in any language is welcome.</p> <hr> <p><strong>How to Help</strong></p> <p>If you have good ones please add the following in your answer:</p> <ul> <li>Beginner Exercises and Project Ideas</li> <li>Resources for teaching beginners</li> <li>Screencasts / blog posts / free e-books</li> <li>Print books that are good for beginners</li> </ul> <p>Please describe the resource <em>with a link to it</em> so I can take a look. I want everyone to know that I have definitely been using some of these ideas. Your submissions will be aggregated in this post.</p> <hr> <p><strong>Online Resources</strong> for teaching beginners:</p> <ul> <li><a href="http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-189January--IAP--2008/CourseHome/" rel="noreferrer">A Gentle Introduction to Programming Using Python</a></li> <li><a href="http://openbookproject.net/thinkcs/python/english2e/index.html" rel="noreferrer">How to Think Like a Computer Scientist</a></li> <li><a href="http://www.alice.org/" rel="noreferrer">Alice: a 3d program for beginners</a></li> <li><a href="http://scratch.mit.edu/" rel="noreferrer">Scratch (A system to develop programming skills)</a></li> <li><a href="http://www.htdp.org/" rel="noreferrer">How To Design Programs</a></li> <li><a href="http://mitpress.mit.edu/sicp/full-text/book/book.html" rel="noreferrer">Structure and Interpretation of Computer Programs</a></li> <li><a href="http://pine.fm/LearnToProgram/" rel="noreferrer">Learn To Program</a></li> <li><a href="http://samizdat.mines.edu/howto/HowToBeAProgrammer.html" rel="noreferrer">Robert Read's How To Be a Programmer</a></li> <li><a href="http://creators.xna.com/" rel="noreferrer">Microsoft XNA</a></li> <li><a href="http://vodpod.com/watch/914464-inspirational-oscon-keynote" rel="noreferrer">Spawning the Next Generation of Hackers</a></li> <li><a href="http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444" rel="noreferrer"><em>COMP1917 Higher Computing</em> lectures by Richard Buckland</a> (requires iTunes)</li> <li><a href="http://diveintopython.net/" rel="noreferrer">Dive into Python</a></li> <li><a href="http://en.wikibooks.org/wiki/Programming:Python" rel="noreferrer">Python Wikibook</a></li> <li><a href="http://projecteuler.net/" rel="noreferrer">Project Euler</a> - sample problems (mostly mathematical)</li> <li><a href="http://www.pygame.org/" rel="noreferrer">pygame</a> - an easy python library for creating games</li> <li><a href="http://inventwithpython.com/IYOCGwP_book1.pdf" rel="noreferrer">Invent Your Own Computer Games With Python</a></li> <li><a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx" rel="noreferrer">Foundations of Programming</a> for a next step beyond basics.</li> <li><a href="http://www.iam.unibe.ch/~scg/SBE/" rel="noreferrer">Squeak by Example</a> </li> <li><a href="http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/" rel="noreferrer">Snake Wrangling For Kids</a> (It's not just for kids!)</li> </ul> <hr> <p><strong>Recommended Print Books</strong> for teaching beginners</p> <ul> <li><a href="http://www.acceleratedcpp.com/" rel="noreferrer">Accelerated C++</a></li> <li><a href="https://rads.stackoverflow.com/amzn/click/com/1598631128" rel="noreferrer" rel="nofollow noreferrer">Python Programming for the Absolute Beginner</a></li> <li><a href="https://rads.stackoverflow.com/amzn/click/com/0735611319" rel="noreferrer" rel="nofollow noreferrer">Code by Charles Petzold</a></li> <li><a href="https://rads.stackoverflow.com/amzn/click/com/1590282418" rel="noreferrer" rel="nofollow noreferrer">Python Programming: An Introduction to Computer Science 2nd Edition</a></li> </ul>
<p>I've had to work with several beginner (never wrote a line of code) programmers, and I'll be doing an after school workshop with high school students this fall. This is the closest thing I've got to documentation. It's still a work in progress, but I hope it helps.</p> <p>1) <b>FizzBuzz.</b> Start with command line programs. You can write some fun games, or tools, very quickly, and you learn all of the language features very quickly without having to learn the GUI tools first. These early apps should be simple enough that you won't need to use any real debugging tools to make them work.</p> <p>If nothing else things like FizzBuzz are good projects. Your first few apps should not have to deal with DBs, file system, configuration, ect. These are concepts which just confuse most people, and when you're just learning the syntax and basic framework features you really don't need more complexity.</p> <p>Some projects:</p> <ul> <li>Hello World!</li> <li>Take the year of my birth, and calculate my age (just (now - then) no month corrections). <i>(simple math, input, output)</i></li> <li>Ask for a direction(Up, down, left, right), then tell the user their fate (fall in a hole, find a cake, ect). <i>(Boolean logic)</i></li> <li>FizzBuzz, but count once every second. <i>(Loops, timers, and more logic)</i></li> <li>Depending on their age some really like an app which calls the users a random insult at some interval. <i>(Loops, arrays, timers, and random if you make the interval random)</i></li> </ul> <p>2) <b>Simple Project</b> Once they have a good grasp of language features, you can start a project(simple, fun games work good.). You should try to have the first project be able to be completed within 6-12 hours. Don't spend time to architect it early. Let them design it even if it sucks. If it falls apart, talk about what happened and why it failed, then pick another topic and start again.</p> <p>This is where you start introducing the debugging capabilities of your tools. Even if you can see the problem by reading the code you should teach them how to use the tools, and then show them how you could see it. That serves the dual purpose of teaching the debugging tools and teaching how to ID errors without tools.</p> <p>Once, or if, the project gets functional you can use it to introduce refactoring tools. Its good if you can then expand the project with some simple features which you never planned for. This usually means refactoring and significant debugging, since very few people write even half decent code their first time.</p> <p>Some projects:</p> <ul> <li>Hangman game</li> <li>Experimenting with robotics(<a href="http://www.vexlabs.com" rel="nofollow noreferrer">Vex</a> and <a href="http://mindstorms.lego.com" rel="nofollow noreferrer">Mindstorms</a> are options) </li> </ul> <p>3) <b>Real Project </b> Start a real project which may take some time. Use proper source control, and make a point to have a schedule. Run this project like a real project, if nothing else its good experience having to deal with the tools.</p> <p>Obviously you need to adjust this for each person. The most important thing I've found is to make even the first simple apps apply to what the person is interested in. </p> <p>Some projects:</p> <ul> <li>Tetris</li> <li>Text file based blog engine</li> <li>More advanced robotics work</li> </ul>
<p>I would actually argue to pick a simpler language with fewer instructions. I personally learned on BASIC at home, as <a href="http://www.codinghorror.com/blog/archives/001104.html" rel="nofollow noreferrer">did Jeff</a>. This way, you don't have to delve into more complicated issues like object oriented programming, or even procedures if you don't want to. Once he can handle simple control flow, then move on to something a little more complicated, but only simple features.</p> <p>Maybe start with very simple programs that just add 2 numbers, and then grow to something that might require a branch, then maybe reading input and responding to it, then some kind of loop, and start combining them all together. Just start little and work your way up. Don't do any big projects until he can grasp the fundamentals (otherwise it may very well be too daunting and he could give up midway). Once he's mastered BASIC or whatever you choose, move on to something more complicated.</p> <p>Just my $0.02</p>
2,525
<p>There's PLA filament clogged in my Bowden tube, is there a best practice for cleaning it out or do I need to replace the whole tube?</p> <p>Also, the couplings are totally stuck, so I guess those would need replacement too or are there ways to get stuck couplings off?</p> <p>Click <a href="https://streamable.com/bi73e" rel="nofollow noreferrer">here</a> for a video.</p>
<p>As a short-term fix, grab a twist drill bit that is on the order of 1.5 mm diameter (assuming a 1.75 mm tube). Using a hand drill, slowly and gently drill out the clogged filament. Obviously you want to try to avoid scarring the teflon lining, so better to use the thinnest drill that will work. </p> <p>With a little training and a little luck, you'll get the clog cleared. I would recommend removing the nozzle first so that the chips don't fall into the nozzle.</p>
<p>Most standard filaments soften at 200 °C, meaning a pot of near-boiling water should soften whatever is stuck, allowing you to either fuse another strand of filament to it or use it to push it out of the tube.</p>
1,040
<p>I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far:</p> <pre><code>drop table exams; drop table question_bank; drop table anwser_bank; create table exams ( exam_id uniqueidentifier primary key, exam_name varchar(50), ); create table question_bank ( question_id uniqueidentifier primary key, question_exam_id uniqueidentifier not null, question_text varchar(1024) not null, question_point_value decimal, constraint question_exam_id foreign key references exams(exam_id) ); create table anwser_bank ( anwser_id uniqueidentifier primary key, anwser_question_id uniqueidentifier, anwser_text varchar(1024), anwser_is_correct bit ); </code></pre> <p>When I run the query I get this error:</p> <blockquote> <p>Msg 8139, Level 16, State 0, Line 9 Number of referencing columns in foreign key differs from number of referenced columns, table 'question_bank'.</p> </blockquote> <p>Can you spot the error?</p>
<pre><code>create table question_bank ( question_id uniqueidentifier primary key, question_exam_id uniqueidentifier not null, question_text varchar(1024) not null, question_point_value decimal, constraint fk_questionbank_exams foreign key (question_exam_id) references exams (exam_id) ); </code></pre>
<p>Necromancing.<br /> Actually, doing this correctly is a little bit trickier. </p> <p>You first need to check if the primary-key exists for the column you want to set your foreign key to reference to. </p> <p>In this example, a foreign key on table T_ZO_SYS_Language_Forms is created, referencing dbo.T_SYS_Language_Forms.LANG_UID </p> <pre><code>-- First, chech if the table exists... IF 0 &lt; ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'T_SYS_Language_Forms' ) BEGIN -- Check for NULL values in the primary-key column IF 0 = (SELECT COUNT(*) FROM T_SYS_Language_Forms WHERE LANG_UID IS NULL) BEGIN ALTER TABLE T_SYS_Language_Forms ALTER COLUMN LANG_UID uniqueidentifier NOT NULL -- No, don't drop, FK references might already exist... -- Drop PK if exists -- ALTER TABLE T_SYS_Language_Forms DROP CONSTRAINT pk_constraint_name --DECLARE @pkDropCommand nvarchar(1000) --SET @pkDropCommand = N'ALTER TABLE T_SYS_Language_Forms DROP CONSTRAINT ' + QUOTENAME((SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS --WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' --AND TABLE_SCHEMA = 'dbo' --AND TABLE_NAME = 'T_SYS_Language_Forms' ----AND CONSTRAINT_NAME = 'PK_T_SYS_Language_Forms' --)) ---- PRINT @pkDropCommand --EXECUTE(@pkDropCommand) -- Instead do -- EXEC sp_rename 'dbo.T_SYS_Language_Forms.PK_T_SYS_Language_Forms1234565', 'PK_T_SYS_Language_Forms'; -- Check if they keys are unique (it is very possible they might not be) IF 1 &gt;= (SELECT TOP 1 COUNT(*) AS cnt FROM T_SYS_Language_Forms GROUP BY LANG_UID ORDER BY cnt DESC) BEGIN -- If no Primary key for this table IF 0 = ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' AND TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'T_SYS_Language_Forms' -- AND CONSTRAINT_NAME = 'PK_T_SYS_Language_Forms' ) ALTER TABLE T_SYS_Language_Forms ADD CONSTRAINT PK_T_SYS_Language_Forms PRIMARY KEY CLUSTERED (LANG_UID ASC) ; -- Adding foreign key IF 0 = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME = 'FK_T_ZO_SYS_Language_Forms_T_SYS_Language_Forms') ALTER TABLE T_ZO_SYS_Language_Forms WITH NOCHECK ADD CONSTRAINT FK_T_ZO_SYS_Language_Forms_T_SYS_Language_Forms FOREIGN KEY(ZOLANG_LANG_UID) REFERENCES T_SYS_Language_Forms(LANG_UID); END -- End uniqueness check ELSE PRINT 'FSCK, this column has duplicate keys, and can thus not be changed to primary key...' END -- End NULL check ELSE PRINT 'FSCK, need to figure out how to update NULL value(s)...' END </code></pre>
7,121
<p>I am reviewing a big java application to see if there are any performance bottlenecks. The real problem is that I cannot pinpoint the performance issues to any single module. The whole application is slow as such.</p> <p>Is there some tool/technique I can use to help me out in this?</p>
<p>Try using a profiler on your running code. It should help you identify the bottlenecks. Try <a href="http://www.ej-technologies.com/products/jprofiler/overview.html" rel="noreferrer">jprofiler</a> or <a href="http://www.netbeans.org/features/java/profiler.html" rel="noreferrer">Netbeans profiler</a></p>
<p>For testing/development purposes, you can download Oracle JRockit Mission Control for free from <a href="http://www.oracle.com/technology/software/products/jrockit/index.html" rel="nofollow noreferrer">this</a> site. (Requires Login, but accounts can be set up with any email adress)</p> <p>Docs <a href="http://www.oracle.com/technology/products/jrockit/missioncontrol/index.html" rel="nofollow noreferrer">Here</a>. It will allow you to find hotspots, memory leaks and much more.</p>
5,876