instruction stringlengths 27 22.5k | chosen stringlengths 27 28.2k | rejected stringlengths 19 24.9k | __index_level_0__ int64 0 10k |
|---|---|---|---|
<p>I posted the code below to the Sun developers forum since I thought it was erroring (the true error was before this code was even hit). One of the responses I got said it would not work and to throw it away. But it is actually working. It might not be the best code (I am new to Java) but is there something inhere... | <p>The literal answer is no - there is never anything "inherently wrong" with code, it's a matter of whether it meets the requirements - which may or may not include being maintainable, secure, robust or fast.</p>
<p>The code you are running is actually a JET query purely within Access - the Java code is doing nothing... | <p>Question to Joshua McKinnon:</p>
<p>Can you provide a citation about MS's plans to never introduce 64-bit ODBC drivers for Jet? This sounds reasonable, so I'm not doubting you at all, I would just like to know if you have a source for it that you can point to.</p>
<p>Surely MS <em>is</em> providing access to Jet o... | 5,056 |
<p>With Ender 3 is there a way to configure printer extruder to go all way up when the printing finishes?</p>
<p>Or even with the Ultimaker Cura software?</p>
<p>I want this, because i'm going to put a switch on the top of the printer that will switch it off when the printer finishes (if i can make the arm with the e... | <p>The most safe way to move the printer up to the maximum print height is to use a concept known as "<strong>keywords</strong>" (sort of constants that are filled by the correct value when slicing) in Ultimaker Cura, certainly if you have multiple printers with different print area sizes.</p>
<p>To use these keywords... | <p>If you use OctoPrint, there is a plugin that will allow you to take action on certain events, such as print completion. The action that it can take would allow you to turn of a TP-link smart plug; which would turn off the printer. You could then use the phone app to turn it back on.</p>
| 1,415 |
<p>I have this clogging problem on my 3D printer that I am having a really hard time to solve. I am a hobbiest so in no way am I a professional with regards to 3D printers. I also know that this is a popular issue and I have tried a lot of the proposed solutions (going through a lot of PLA filament and failed prints) t... | <h2>A Scriptable Process for Generating Multi-Material STL Files:</h2>
<p>I am now using interactive CAD software to define the more complex features of the object I am printing (in the current case, clock faces), and then using OpenSCAD to do the boolean volume operations. </p>
<p>To print the composite object, I n... | <p>You do not necessarily need a specific design tool, you can use any tool you want to create your multiple material product. It is the slicer software that manages the materials by assigning the correct extruder. E.g. Cura is able to join 2 STL files that fit together and assign each part a specific extruder and thus... | 861 |
<p>I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java.</p>
<p>If I have <em>x</em> items which I want to display in chunks of <em>y</em> per page, how many pages will be needed?</p>
| <p>Found an elegant solution:</p>
<pre><code>int pageCount = (records + recordsPerPage - 1) / recordsPerPage;
</code></pre>
<p>Source: <a href="http://www.cs.nott.ac.uk/~rcb/G51MPC/slides/NumberLogic.pdf" rel="noreferrer">Number Conversion, Roland Backhouse, 2001</a></p>
| <p>You'll want to do floating point division, and then use the ceiling function, to round up the value to the next integer.</p>
| 3,854 |
<p>I really feel that I should learn <a href="http://en.wikipedia.org/wiki/Lisp_(programming_language)" rel="noreferrer">Lisp</a> and there are plenty of good resources out there to help me do it.</p>
<p>I'm not put off by the complicated syntax, but where in "traditional commercial programming" would I find places it... | <p>One of the main uses for Lisp is in Artificial Intelligence. A friend of mine at college took a graduate AI course and for his main project he wrote a "<a href="http://en.wikipedia.org/wiki/Lights_Out_(video_game)" rel="noreferrer">Lights Out</a>" solver in Lisp. Multiple versions of his program utilized slightly d... | <p>Syntax is irrelevant, readability is not!</p>
| 2,673 |
<p>I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way:</p>
<pre><code>Shoes.app do
t = para "Not clicked!"
button "The Label" do
alert "You clicked the button!" # when clicked, make an alert
t.replace "Clicked!" # ..and replace the label's text... | <p>You could actually pull this off, but it would require using metaclasses, which are <em>deep</em> magic (there be dragons). If you want an intro to metaclasses, there's a series of <a href="http://www.ibm.com/developerworks/linux/library/l-pymeta.html" rel="nofollow noreferrer">articles from IBM</a> which manage to ... | <p>Declarative is not necessarily more (or less) pythonic than functional IMHO. I think a layered approach would be the best (from buttom up):</p>
<ol>
<li>A native layer that accepts and returns python data types.</li>
<li>A functional dynamic layer.</li>
<li>One or more declarative/object-oriented layers.</li>
</ol>... | 8,314 |
<p>I'm wondering how to use a VideoDisplay object (defined in MXML) to display video streamed from FMS via a NetStream.</p>
<p>The <a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/VideoDisplay.html" rel="noreferrer">Flex3 docs</a> suggest this is possible:</p>
<blockquote>
<p>The Video Display ... supp... | <p>Unfortunately you can attachNetStream() only on Video object. So you are doomed to use em if you want to get data from FMS.</p>
<p>By the way attachCamera() method <strong>publishes</strong> local camera video to the server so be careful ;)</p>
| <p>it works.</p>
<p>mx:VideoDisplay live="true" autoPlay="true" source="rtmp://server.com/appname/streamname" /></p>
<p>that will give you live video through a videodisplay... problem is it won't use an existing netconnection object, it creates it's own... which is what I'm trying to find a work around for.</p>
| 6,377 |
<p>I have a dual-extruder printer with a separate heating element for each head, thus able to combine materials in a single print job even if they don't share a single temperature range.</p>
<p>Now the question: When (outside of using expensive dedicated support material or doing multicolor prints for aesthetic reason... | <p>The answers are </p>
<ol>
<li><p>yes</p></li>
<li><p>yes</p></li>
<li><p>probably</p></li>
</ol>
<p>Which is to say, if you only want to use MaterialNumberTwo for disposable supports, then you should be fine. Presumably the slicer software is material-aware and adjusts the feed so the layer heights are the same ... | <p>I have printed ABS on top of PLA and it has bonded well. It was simple, then "campaign"-style buttons with Prusament Galaxy Black on the bottom and HatchBox white ABS on top. There was no tendency to warp, as I would expect if the ABS were shrinking more than the PLA.</p>
<p>I expected this to not work, but I nee... | 1,439 |
<p>How do you automatically set the focus to a textbox when a web page loads?</p>
<p>Is there an HTML tag to do it or does it have to be done via Javascript?</p>
| <p>If you're using jquery:</p>
<pre><code>$(function() {
$("#Box1").focus();
});
</code></pre>
<p>or prototype:</p>
<pre><code>Event.observe(window, 'load', function() {
$("Box1").focus();
});
</code></pre>
<p>or plain javascript:</p>
<pre><code>window.onload = function() {
document.getElementById("Box1").fo... | <p>Use the below code. For me it is working</p>
<pre><code>jQuery("[id$='hfSpecialty_ids']").focus()
</code></pre>
| 6,784 |
<p>I'd like a dead simple explanation of policy injection for less-informed co-workers. Where is a good resource for this? I learned about policy injection from the entlib help files, which I'm sure aren't the best option.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/cc309370.aspx" rel="nofollow noreferrer">The MSDN documentation for Policy Injection</a> has a pretty clear explanation:</p>
<blockquote>
<p>Applications include a mix of business
logic and crosscutting concerns, and
the two are typically
intermingled—which c... | <p>What the EntLib calls Policy Injection, is really Aspect Oriented Programming. I wrote a post <a href="http://iridescence.no/post/Aspect-Oriented-Programming-A-Primer.aspx" rel="nofollow noreferrer">introducing the concepts of AOP on my blog</a> a while back, maybe it'll be helpful.</p>
| 9,917 |
<p>Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting.</p>
<p>Are there any work-arounds or ways to fix this? I'm using vim 7.1.</p>
| <p>You might like to try this <a href="http://www.vim.org/scripts/script.php?script_id=1491" rel="noreferrer">improved Javascript syntax highlighter</a> rather than the one that ships with VIMRUNTIME.</p>
| <p>For a quick and dirty fix, sometimes I just scroll up and down and the highlighting readjusts. <kbd>Ctrl</kbd>+<kbd>L</kbd> for a screen redraw can also fix it.</p>
| 8,326 |
<p>What is the best Image Manager to integrate in TinyMce editor apart the official Moxiecode commercial ones?</p>
<p>I'm looking to integrate a light texteditor in an asp.net mvc application and I choosed the Tinymce solution (and not the classic FCKEditor as this seems more lightweight and more jquery friendly).</p>... | <p>There are a couple of open source plugins on SourceForge,</p>
<p><a href="http://sourceforge.net/tracker/?group_id=103281&atid=738747" rel="noreferrer">http://sourceforge.net/tracker/?group_id=103281&atid=738747</a>
(search for image)</p>
<p>The plugin architecture is easy to understand if you know Javascr... | <p>Carlton : Alfresco seems to be a Java based solution.
Ta: I've looked into the plugin folders but none was really good for asp.net mvc.
What I'm now testing is a mix between Tiny with the image uploader of FCKEditor:
this is the pho version but I think it is pretty easy to convert to .net [Tinyfck][1]</p>
<p>[1]: t... | 4,003 |
<p>Do we want to add a BLOG to this site?
Blogs are another way of communicating things that don't fit the Q&A model.</p>
<p>Here is a good description of <a href="https://stackoverflow.blog/2011/06/23/blog-overflow/">what a Blog is and how you can start one</a>.</p>
<p>This post on the SuperUser Blog asking for ... | <p>The description of blogs you've cited is 6 years old. Unfortunately, <a href="https://meta.stackexchange.com/questions/291741/we-will-no-longer-be-hosting-blog-overflow">blogs have since been discontinued</a>.</p>
<p>It is no longer possible to start a new blog.</p>
| <p>+1 - As it seems a good idea. Not sure what would go in it though - do you have any concrete examples of blog ideas? </p>
<p>I already have a (messy) <a href="https://gr33nonline.wordpress.com/" rel="nofollow noreferrer">blog</a>, and I am not sure if I could also write a blog on here too. I wonder what the score i... | 43 |
<p>I have an Image control with it's source bound to a property on an object(string url to an image). After making a service call, i update the data object with a new URL. The exception is thrown after it leaves my code, after invoking the PropertyChanged event.</p>
<p>The data structure and the service logic are al... | <pre><code>System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => {...});
</code></pre>
<p>Also look <a href="https://stackoverflow.com/questions/1924408/invalid-cross-thread-access-issue/1925827#1925827">here.</a></p>
| <p>The property getter for RootVisual on the Application class has a thread check which causes that exception. I got around this by storing the root visual's dispatcher in my own property in my App.xaml.cs:</p>
<pre><code>public static Dispatcher RootVisualDispatcher { get; set; }
private void Application_Startup(obj... | 6,915 |
<p>After trying to avoid JavaScript for years, Iv started using Query for <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">validation</a> in MVC asp.net, as there does not seem to be an official way of doing validation, Iv been surprised how good jQuery is. </p>
<p>Fir... | <p>Try specifying both a wrapper and a label container in your options. I also added <code>display:none;</code> to the style of error-container to let jQuery decide when to show it.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre cl... | <p>regarding intellisense for jquery (and other plugins): in order to have full intellisense in your own script files as well, just include the following line at the top of your .js file once for each file you want intellisensee from:</p>
<pre><code>/// <reference path="[insert path to script file here]" />
</co... | 8,671 |
<p>When using 3rd party libraries/components in production projects, are you rigorous about using only released versions of said libraries?</p>
<p>When do you consider using a pre-release or beta version of a library (in dev? in production, under certain circumstances)? </p>
<p>If you come across a bug or shortcomin... | <p>I am a big fan of not coding something when someone else has a version that I could not code in a reasonable amount of time or would require me to become an expert on something that wouldn't matter in the long run. </p>
<p>There are several open source components and libraries I have used in our production environm... | <ul>
<li>Yes. Unless there's a feature we really need in a beta version.</li>
<li>There's no point using a beta version in dev if you aren't certain you'll use it in production. That just seems like a wasted exercise</li>
<li>I'll use the patch. Why write code for something you've paid for?</li>
</ul>
| 4,271 |
<p>Does anyone know a tool for Profiling JavaScript in IE?</p>
<p>List available:</p>
<ul>
<li><a href="http://blogs.msdn.com/ie/archive/2008/09/11/introducing-the-ie8-developer-tools-jscript-profiler.aspx" rel="noreferrer">IE8</a> (Internet Explorer 8 only)</li>
<li><a href="http://www.whitefrost.com/documents/html/... | <p>Checkout <a href="http://ejohn.org/blog/deep-tracing-of-internet-explorer/" rel="noreferrer">http://ejohn.org/blog/deep-tracing-of-internet-explorer/</a> the dynaTrace tool shown here is fantastic and works with IE7.</p>
| <p>We use Firebugs console.log, console.time and console.timeEnd (I think) a lot.</p>
<p>Firebug also has a built in profiler.</p>
| 4,074 |
<p>I have a simple web service operation like this one:</p>
<pre><code> [WebMethod]
public string HelloWorld()
{
throw new Exception("HelloWorldException");
return "Hello World";
}
</code></pre>
<p>And then I have a client application that consumes the web service and then calls the ope... | <p>Unfortunately I don't think this is possible.</p>
<p>The exception you are raising in your web service code is being encoded into a Soap Fault, which then being passed as a string back to your client code.</p>
<p>What you are seeing in the SoapException message is simply the text from the Soap fault, which is not ... | <p>I ran into something similar a bit ago and <a href="http://theruntime.com/blogs/jacob/archive/2008/01/28/getting-at-the-details.aspx" rel="nofollow noreferrer">blogged about it</a>. I'm not certain if it is precisely applicable, but might be. The code is simple enough once you realize that you have to go through a M... | 5,201 |
<p>Can you suggest a tool for testing accessibility and section 508/ADA compliance of a Website with MS Share Point and .Net 2.0 as the underlying platform?</p>
| <p>In my experience, testing Sharepoint for accessibility is not worth it. Even if you've used the Accessibility Toolkit for Sharepoint (AKS) with Sharepoint 2007, the end result is far from accessible.</p>
<p>The trouble is that accessibility was not, and still is not a big consideration for MS when they made Sharepo... | <p>You can try FireEyes(http://www.deque.com/products/worldspace-fireeyes/download-worldspace-fireeyes) . You can run it in firebug and can set up your own set of rules through a dedicated server.</p>
<p>FireEyes is an unprecedented, nextgen web accessibility tool that ensures both static and dynamic content within a ... | 9,654 |
<h2>The problem</h2>
<p>When I print with my mElephant 3D printer from Makeblock, the prints come out with waved walls like in the picture below. I am using PLA filament from <a href="https://makeblock.lt" rel="noreferrer">https://makeblock.lt</a></p>
<p><img src="https://makeblock.lt/up/so/3d-waves.jpg" alt="3d-wave... | <p>I had the same problem with ABS, but printing different test objects I found out that the distance between the wavy structures depends on the cross sectional area of the object. Printing the testcube in 70.1% (1/sqrt(2) times of the original size) takes half the time per layer and the distance between two grooves do... | <p>Looks like something is catching on the z axis. A bent peice would likely cause much smaller deformations unless it was very obviously bent. Something could be loose, allowing the vertical play, perhaps the motor mounts.</p>
<p>More likely I think is a level-difference between the z-axis worm gears, possibly caused... | 514 |
<p>I've got a group of inter-related classes that are all overridden together to create a particular implementation. I'm wondering if it is a good idea to enclose the interrelated subclasses in a namespace.</p>
<p>For example purposes, consider the following namespaces and classes:</p>
<pre><code>namespace Protocol
{... | <p>I think you are perhaps worrying too much!</p>
<p>Does it make sense logically? Do you know where to find your code within the namespaces?</p>
<p>I would much rather see a codebase like the above with a small number of classes, relevant to the name with a hierarchy, than one large namespace where everything is int... | <p>If this were me, I would define 2 namespaces:</p>
<pre><code>Protocol
</code></pre>
<p>and</p>
<pre><code>Protocol.Driver
</code></pre>
<p>Dividing the namespace like this separates your "library code" vs your "executable / test code."
I also create my namespaces to match the directory structure; it will give lo... | 3,915 |
<p>An example of an app that does this is <a href="http://www.humanized.com/enso/" rel="nofollow noreferrer">Enso</a>, it pops up when you press the caps lock.</p>
| <p>You can act on global hotkeys by calling the winapi function <a href="https://www.pinvoke.net/default.aspx/user32/RegisterHotKey.html" rel="nofollow noreferrer">RegisterHotKey</a>. Also see <a href="https://www.codeproject.com/Articles/4345/NET-system-wide-hotkey-component" rel="nofollow noreferrer">https://www.code... | <p>You need to install a hook in user32.dll. Lookup the Win32-API call SetWindowsHookEx. You can call it from C# via the stuff in System.Runtime.InteropServices.</p>
<p><a href="https://www.codeproject.com/Articles/14485/Low-level-Windows-API-hooks-from-C-to-stop-unwante" rel="nofollow noreferrer">This article</a> dis... | 8,581 |
<p>Consider these two function definitions:</p>
<pre><code>void foo() { }
void foo(void) { }
</code></pre>
<p>Is there any difference between these two? If not, why is the <code>void</code> argument there? Aesthetic reasons?</p>
| <p>In <strong>C</strong>: </p>
<ul>
<li><code>void foo()</code> means "a function <code>foo</code> taking an unspecified number of arguments of unspecified type" </li>
<li><code>void foo(void)</code> means "a function <code>foo</code> taking no arguments"</li>
</ul>
<p>In <strong>C++</strong>: </p>
<ul>
<li><code... | <p>In C, you use a void in an empty function reference so that the compiler has a prototype, and that prototype has "no arguments". In C++, you don't have to tell the compiler that you have a prototype because you can't leave out the prototype.</p>
| 7,391 |
<p>So for my text parsing in C# <a href="https://stackoverflow.com/questions/13963/best-method-of-textfile-parsing-in-c">question</a>, I got directed at YAML. I'm hitting a wall with this library I was recommended, so this is a quickie.</p>
<pre><code>heading:
name: A name
taco: Yes
age: 32
heading:
name: Another... | <p>Partially. YAML supports the notion of multiple consecutive "documents". If this is what you are trying to do here, then yes, it is correct - you have two documents (or document fragments). To make it more explicit, you should separate them with three dashes, like this:</p>
<pre><code>---
heading:
name: A name
ta... | <p>Just to make an explicit comment about it: You have a duplicate mapping key issue. A YAML processor will resolve this as a !!map, which prohibits duplicate keys. Not all processors enforce this constraint, though, so you might get an incorrect result if you pass an incorrect YAML stream to a processor.</p>
| 3,652 |
<p>I am trying to create a two-piece snap-fit or joint using a 3D printer (Resin). After that, I plan to coat the joint with a conductive spray and create an electrical connection when the two pieces are joined together.</p>
<p><strong>Has this been done before? Are certain types of joint mechanism recommended?</strong... | <p><a href="https://www.instructables.com/Copper-Electroforming-on-3d-Printed-PLAABS-Objects/" rel="nofollow noreferrer">Electroforming</a> is the process of applying a conductive paint to a non-conductive surface. Once dry, the object is subjected to a process similar to electroplating, in that molecules of a conducti... | <p>For your task you basically have several options:</p>
<ol>
<li><strong>Electroforming</strong> (see @fred_dot_u answer). Pros: high electrical conductivity due to actual metal layer; very low friction between polished metal layers. Cons: the process is quite dirty and requires additional materials and processing, pl... | 2,167 |
<h2>Problem</h2>
<p>My CR-10 printer seems to be trying to print the model 4 or 5 layers too low. This means that for the first few layers, the printing nozzle is forced against the bed, preventing extrusion until the print reaches higher layers.</p>
<h2>Outcome</h2>
<p>This results in the bottom part of the print h... | <p>Did you verify the Cura z-offset actually changed the corresponding G-Codes? </p>
<p>I had the opposite problem on my RF1000. To fix the problem I added the following 2 lines to my start G-Codes:</p>
<pre><code>M3001 ; Activate Z-Compensation
M206 Z-0.3 ; Set z offset 0.3mm closer to the nozzle
</code></pre>
<p>... | <p>Did you verify the Cura z-offset actually changed the corresponding G-Codes? </p>
<p>I had the opposite problem on my RF1000. To fix the problem I added the following 2 lines to my start G-Codes:</p>
<pre><code>M3001 ; Activate Z-Compensation
M206 Z-0.3 ; Set z offset 0.3mm closer to the nozzle
</code></pre>
<p>... | 1,437 |
<p>How do I determine using TSQL what roles are granted execute permissions on a specific stored procedure? Is there a system stored procedure or a system view I can use?</p>
| <p>In 7.0 or 2000, you can modify and use the following code:</p>
<pre><code>SELECT convert(varchar(100),
'GRANT ' +
CASE WHEN actadd & 32 = 32 THEN 'EXECUTE'
ELSE
CASE WHEN actadd & 1 = 1 THEN 'SELECT' + CASE WHEN actadd & (8|2|16) > 0 ... | <p>You can try something like this. Note, I believe 3 is EXECUTE.</p>
<pre><code>SELECT
grantee_principal.name AS [Grantee],
CASE grantee_principal.type WHEN 'R' THEN 3 WHEN 'A' THEN 4 ELSE 2 END - CASE 'database' WHEN 'database' THEN 0 ELSE 2 END AS [GranteeType]
FROM
sys.all_objects AS sp
INNER JOIN sys.database_p... | 9,283 |
<p>Is global memory initialized in C++? And if so, how?</p>
<p>(Second) clarification:</p>
<p>When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized? I'm trying to understand if it is zeroed out, or garbage for example.</p>
<p>The situation is: ca... | <p>Yes global primitives are initialized to NULL.</p>
<p>Example:</p>
<pre><code>int x;
int main(int argc, char**argv)
{
assert(x == 0);
int y;
//assert(y == 0); <-- wrong can't assume this.
}
</code></pre>
<p>You cannot make any assumptions about classes, structs, arrays, blocks of memory on the heap...</... | <p>Variables declared with static/global scope are always initialized under VC++ at least.</p>
<p>Under some circumstances there can actually be a difference in behaviour between:</p>
<pre><code>int x = 0;
int main() { ... }
</code></pre>
<p>and</p>
<pre><code>int x;
int main() { ... }
</code></pre>
<p>If you ar... | 8,561 |
<p>I wrote an O(n!) sort for my amusement that can't be trivially optimized to run faster without replacing it entirely. [And no, I didn't just randomize the items until they were sorted]. </p>
<p>How might I write an even worse Big-O sort, without just adding extraneous junk that could be pulled out to reduce the t... | <p>There's a (proven!) worst sorting algorithm called <a href="http://c2.com/cgi/wiki?SlowSort" rel="noreferrer">slow sort</a> that uses the “multiply and surrender” paradigm and runs in exponential time.</p>
<p>While your algorithm is slower, it doesn't progress steadily but instead performs random jumps. Additionall... | <p>One way that I can think of would be to calculated the post position of each element through a function that vary gradually moved the large elements to the end and the small ones to the beginning. If you used a trig based function, you could make the elements osculate through the list instead of going directly towar... | 4,520 |
<p>This is an antique problem with VB6 DLL and COM objects but I still face it day to day. What tools or procedures can be used to see which DLL file or version another DLL is referencing?</p>
<p>I am referring to compiled DLLs at runtime, not from within VB6 IDE.</p>
<p>It's DLL hell.</p>
| <p><a href="http://www.dependencywalker.com/" rel="noreferrer">Dependency Walker</a> shows you all the files that a DLL links to (or is trying to link to) and it's free.</p>
| <p><a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" rel="nofollow noreferrer">ProcessExplorer</a> shows you all the DLLs that are currently loaded in a process at a particular moment. This gives you another angle on <a href="http://www.dependencywalker.com/" rel="nofollow noreferrer">Dependency Wa... | 9,490 |
<p>... say for CentOS?</p>
| <p>From what I understand a virtul IP can let you abstract the address from the physical interface(s) the traffic actually goes through. If your server has two network cards it can have a single virtual IP and have the traffic go through either network physical interface. If hardware failure occurs on one of the two ne... | <p>Check out this article on <a href="http://en.wikipedia.org/wiki/Virtual_IP_address" rel="nofollow noreferrer">Virtual IP address</a>. As indicated it usually floats between machines, and is sometimes used to fail-over a service from one device to another. Are you thinking of a virtual interface instead perhaps?</p... | 9,494 |
<p>In C++ program, I am trying to #import TLB of .NET out-of-proc server.</p>
<p>I get errors like:</p>
<blockquote>
<p>z:\server.tlh(111) : error C2146: syntax error : missing ';' before identifier 'GetType'</p>
<p>z:\server.tlh(111) : error C2501: '_TypePtr' : missing storage-class or type specifiers</p>
<p>z:\server... | <p>Added no_namespace and raw_interfaces_only to my #import:</p>
<pre><code>#import "server.tlb" no_namespace named_guids
</code></pre>
<p>Also using TLBEXP.EXE instead of REGASM.EXE seems to help this issue.</p>
| <p>Also, make sure your C# class doesn't have this attribute:</p>
<p>[ClassInterface(ClassInterfaceType.AutoDual)] <-- Seems to cause errors in C++ with _TypePtr</p>
| 3,382 |
<p>I'm interested in printing small machine parts (gears, linkages, structural components) so I'm looking for accuracy and mechanical strength over speed and volume.</p>
<p>I'm also somewhat concerned about harmful emissions so would like a solution with some sort of filtration, whether it's built into the machine or ... | <p>Your environmental conditions will preclude finding a machine suitable for your purposes in the budget specified.</p>
<p>Humidity is a problem with many material types, especially nylon, but also with PLA and ABS, the more common filaments used in 3D printing.</p>
<p>You can likely reject PLA for your mechanical n... | <p>There is more than one question here. Which touches three topics: the choice of appropriate 3D printing technique, the choice of materials, and control of any hazardous, noxious, or annoying out-gassing. </p>
<p>It is important to understand the limits of the 3D printing process you will choose. Each process has... | 674 |
<p>I want to write C/C++ programs that take input from a MIDI device. </p>
<p>The MIDI device connects to my PC using a USB connector. </p>
<p>I'm looking for a (C/C++ implemented) library that I can use to read the MIDI signals from the MIDI device through the USB port.</p>
<p>I'm happy manipulating the MIDI data o... | <p><a href="http://portmedia.sourceforge.net/portmidi/" rel="noreferrer">PortMidi</a> is another open source cross-platform MIDI I/O library worth checking out. On the other hand, if you are working on a sysex type of app, then direct Win32 works easily enough.</p>
<p>Just came across another open source cross-platfo... | <p>Check out the open source project <a href="http://lmms.sourceforge.net/" rel="nofollow noreferrer">LMMS</a>. It's a music studio for Linux that includes the ability to use MIDI keyboards with software instruments. If you dig around in <a href="http://lmms.sourceforge.net/wiki/index.php?title=Accessing_SVN" rel="nofo... | 2,541 |
<p>I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate.</p>
<p>I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded and installed "Microsoft SQL Server 2005 Express Edition with Advan... | <pre><code>sp_fulltext_database 'enable'
CREATE FULLTEXT CATALOG [myFullText]
WITH ACCENT_SENSITIVITY = ON
CREATE FULLTEXT INDEX ON [dbo].[tblName] KEY INDEX [PK_something] ON [myFullText] WITH CHANGE_TRACKING AUTO
ALTER FULLTEXT INDEX ON [dbo].[otherTable] ADD ([Text])
ALTER FULLTEXT INDEX ON [dbo].[teyOtherTable] E... | <p>Use sql server management studio.</p>
<p>Login as admin to your windows account.</p>
<p>Then select database and right click on database in sql server management studio and select Define Full Text Index and you are guided throughout the process by management studio.</p>
| 2,607 |
<p>I'm curious to hear the experiences of those who are currently running their SVN server on Windows. </p>
<p>Jeff Atwood has a post on <a href="https://blog.codinghorror.com/setting-up-subversion-on-windows/" rel="nofollow noreferrer">how to setup SVN as a Windows service</a>. It's a great first step, but it doesn't... | <p>Use <a href="http://www.visualsvn.com/" rel="nofollow noreferrer">VisualSVN Server</a>. It integrates with Windows authentication and it handles all the apache setup. It's as painless as SVN can be on Windows.</p>
| <p>I think you are seeing the difference betweeen the svn protocol and hosting the svn protocol on another.<br>
Similar performance decreases when using svn+ssh compared to svn. </p>
<p>The ease of setup, has made it a no brainer for my team, we just threw it on a vm and ran.</p>
| 4,414 |
<p>Should I be able to hand turn the stepper motor for the extruder of an Ender 3?</p>
<p>Trying to figure out why the motor isn’t turning on a new to me, never used, but out-of-warranty Ender 3.</p>
<p>Swapping controller cables I discovered the extruder port on the motherboard is dead, but even if I put it on the X a... | <p>Yes - you should be able to turn the extruder by hand when it is unplugged and therefore not powered.</p>
<p>The V2 comes with a blue plastic knob for this purpose, it may be too small to turn the shaft by hand.</p>
<p>When powered and "steppers enabled" the motors need a lot more force to overcome, but ev... | <p>Criggie's answer is basically correct, but I disagree with the conclusion that it:</p>
<blockquote>
<p>Could be expensive - you might want to compare cost of parts with cost of a new printer, remembering there may be other non-functional components still undiscovered.</p>
</blockquote>
<p>If you want to turn the End... | 2,145 |
<p>I am currently using Linq to NHibernate (although that is not an issue with regards to this question) to execute queries against my database and I want to be able to test whether the current <code>IQueryable</code> result instance has been executed or not.</p>
<p>The debugger knows that my <code>IQueryable</code> h... | <p>How about writing an IQueryable wrapper like this:</p>
<pre><code>class QueryableWrapper<T> : IQueryable<T>
{
private IQueryable<T> _InnerQueryable;
private bool _HasExecuted;
public QueryableWrapper(IQueryable<T> innerQueryable)
{
_InnerQueryable = innerQueryable;
... | <p>I believe you can use <a href="https://learn.microsoft.com/en-us/dotnet/api/system.data.linq.datacontext.log" rel="nofollow noreferrer">DataContext.Log</a> to log everything that is executed.</p>
| 7,966 |
<p>Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database. But all the query work is done on the client side, I'd like to move some of this to PHP. </p>
<p>What driver and/or connection string is needed to connect to Sql Svr and what is the syntax to use in PHP?</p>
<hr>
<p>Update: OK so I... | <p>You have two options:</p>
<p>1) <strong>php_mssql extension</strong> : If you'd like something that has the same API mysql and mysqli has, then use the php_mssql extension. But there is a catch, the bundled ntwdblib.dll file with PHP is not working. You have to find this file from a SQL Server 2000 installation or ... | <p>PHP provides an extension for accessing Microsoft SQL Server databases. To use the SQL Server extension, all that is required is to activate the extension in the PHP configuration file.</p>
<p>Details on <a href="http://msdn.microsoft.com/en-us/library/bb264561.aspx" rel="nofollow noreferrer">the MSDN page</a></p>
| 4,021 |
<p>I'm parsing text from a file and storing it in a string. The problem is that some of the text in the original files contains <code>ASCII art</code> and whatnot that I would like to preserve. When I print out the string on the <code>HTML page</code>, even if it does have the same formatting and everything since it ... | <p>use the <pre> tag (pre formatted), that will use a mono spaced font (for your art) and keep all the white space</p>
<pre><code><pre>
text goes here and here
and here and here Some out here
▄ ▄█▄ █▄ ▄
▄█▀█▓ ▄▓▀▀█▀ ▀▀▀█▓▀▀ ▀▀ ▄█▀█▓▀▀▀▀▀▓▄▀██▀▀
██ ██ ▀██... | <p>just echo the necessary special characters (\s, \n, or \r ) along with your string in your PHP code.</p>
<pre><code><?php
echo ("hello world \n")
?>
</code></pre>
| 5,727 |
<p>Is there a public/government web service that I can call to find out what the national holidays are for a given year? (For the US and/or any country in the world.)</p>
<p>Edit: Does anybody have a set of formulas to calculate US holidays? (C# would be my language of choice if there is a choice.)</p>
| <p>There's a web service at <a href="http://www.holidaywebservice.com" rel="noreferrer">http://www.holidaywebservice.com</a> which will provide dates of holidays for the USA, Republic of Ireland, England and Scotland. They also sell a DLL and source code.</p>
<p>As for details of algorithms, you could do worse than ch... | <p>Some parsing may be required, and it's not 100% complete, but you can use <a href="http://en.wikipedia.org/wiki/List_of_holidays_by_country" rel="nofollow noreferrer">wikipedia</a>.</p>
| 8,469 |
<p>I am pondering about buying a Creality Ender-3, and I am honestly confused about some reviews. Some claim it is running 24 V, one did claim it was 12 V, most don't mention it. Since I know about some issues with the clamps, if I get myself an Ender-3, I want to replace the hotend with a proper one from day one. So k... | <p>Bearing in mind that the specifications on Amazon's page are sometimes not 100% (even though they are <em>in this case</em>), it is always best to check on the manufacturer's website.</p>
<p>From Creality3D's own website, <a href="https://www.creality3dofficial.com/" rel="nofollow noreferrer">Creality3D.shop</a>, on... | <p>After checking the amazon listings of the ender-3, they contain more information than the gearbest listing: indeed it is a <strong>24V</strong> machine.</p>
<blockquote>
<p>Product description</p>
<p>[...]</p>
<p><strong>Output: DC 24 V 15 A 360 W</strong></p>
<p>[...]</p>
</blockquote>
| 956 |
<p>You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:</p>
<pre><code># THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE #
# ^ ... | <p>The simplest thing to do is to is to force the line to break by inserting an element at the end of the line that will occupy more than the left available space and then hiding it. I've accomplished this quite easily with a simple <code>span</code> element like so:</p>
<p><div class="snippet" data-lang="js" data-hid... | <p>I know the original question specified HTML + CSS, but it didn't specifically say <em>no javascript</em> ;)</p>
<p>Trying to keep the css and markup as clean as possible, and as semantically meaningful as possible to (using a UL for the menu) I came up with this suggestion. Probably not ideal, but it may be a good ... | 7,214 |
<p>I came across a printed <a href="http://www.eiffel.com/general/column/2008/02.html" rel="nofollow noreferrer">article by Bertrand Meyer</a> where he states that tests can be generated from specifications. My development team does nothing like this, but it sounds like a good technique to consider. How are you generat... | <p>This might be a reference to <a href="http://rspec.info/" rel="nofollow noreferrer">RSpec</a>, which is a really clever way of developing tests as a series of requirements. I'm still getting used to it, but it's been very handy in both defining what I need to do and then ensuring I do it.</p>
| <p>I would say it depends on your specs. I have yet to work anywhere where the specs were good enough to create full unit tests from specifications - the level of detail just wasn't there. My managers always told us that if we specified to that level they could just ship the specs off to India and get it coded on the... | 4,877 |
<p>Just received my new Ender 3 v2. When using the Auto Home feature, the Y-axis motor drives the bed as far back as possible then the motor grinds for about 10-15 seconds. The Y-axis limit switch is not being depressed and the limit stop is about .5 inches away from the switch. The control unit locks at this point and... | <p>You could still get heat creep with a Bowden tube. It has different characteristics. Instead of jamming up in the direct drive, the filament can melt too far upwards into the heat break where it can refreeze and jam. The characteristic, if you can pull out the filament, is widened filament extending into the heat... | <p><em>Answer created from octopus8's comments. If octopus8 wants to post their own answer, this wiki answer can be deleted.</em></p>
<hr />
<p>185 °C is quite ok for several PLAs I have when printing slow.</p>
<p>Honestly, I couldn't believe that the heat can go up the heatsink and Bowden tube to make extruder frame h... | 1,888 |
<p>Does anyone have any tips or gotcha moments to look out for when trying to migrate MySQL tables from the the default case-insenstive swedish or ascii charsets to utf-8? Some of the projects that I'm involved in are striving for better internationalization and the database is going to be a significant part of this ch... | <p>Some hints:</p>
<ul>
<li>Your <code>CHAR</code> and <code>VARCHAR</code> columns will use up to 3 times more disk space. (You probably won't get much disk space grow for Swedish words.)</li>
<li>Use <code>SET NAMES utf8</code> before reading or writing to the database. If you don't this then you will get partiall... | <blockquote>
<p>Your <code>CHAR</code> and <code>VARCHAR</code> columns will use up to 3 times more disk space.</p>
</blockquote>
<p>Only if they're stuffed full of latin-1 with ordinals > 128. Otherwise, the increased space use of UTF-8 is minimal.</p>
| 6,919 |
<p>I'm currently working on a web application which has a page which displays a single chart (a .png image). On another part of this page there are a set of links which, when clicked, the entire page reloads and looks exactly the same as before except for the chart in the middle of the page.</p>
<p>What I want to do ... | <p>I've used something like this to preload an image and then automatically call back to my javascript when the image is finished loading. You want to check complete before you setup the callback because the image may already be cached and it may not call your callback.</p>
<pre><code>function PreloadImage(imgSrc, cal... | <p>@iAn's solution looks good to me. The only thing I'd change is instead of using setTimeout, I'd try and hook into the images 'Load' event. This way, if the image takes longer than 3 seconds to download, you'll still get the spinner.</p>
<p>On the other hand, if it takes less time to download, you'll get the spinn... | 7,441 |
<p>I heard Joel and Jeff talking about <a href="http://www.mikeindustries.com/blog/sifr/" rel="nofollow noreferrer">sIFR</a> in one of the <a href="https://stackoverflow.fogbugz.com/default.asp?W12621" rel="nofollow noreferrer">early podcasts</a>. I've been using it on <a href="http://www.american-data.com" rel="nofol... | <p>You use sIFR moderately, say for headlines. Try not to use it for links, because links in Flash don't work as well as normal HTML links. It also makes little sense to use sIFR only for text that never changes, an image would work a lot better.</p>
<p>I haven't heard about the upside-down problem in a few years now,... | <p>I had plenty of headaches after implementing <a href="http://www.mikeindustries.com/blog/sifr/" rel="nofollow noreferrer">sIFR</a> on my last website project. Most of the problems were to do with browser inconsistencies like you are describing. Text would appear in odd places, not wrap properly or just not display t... | 3,853 |
<p>I have a class in system-C with some data members as such: </p>
<pre><code>long double x[8];
</code></pre>
<p>I'm initializing it in the construction like this:</p>
<pre><code>for (i = 0; i < 8; ++i) {
x[i] = 0;
}
</code></pre>
<p>But the first time I use it in my code I have garbage there.</p>
<p>Becau... | <p>The trick is to combine a <code>UNION</code> with a literal string to determine the type of 'object' returned. In most (?) cases, UNION ALL will be more efficient, and should be used unless duplicates are required in the sub-queries. The following pattern should suffice:</p>
<pre><code> SELECT "group" type, name
... | <p>If you use "UNION ALL" then the db doesn't try to remove duplicates - you won't have duplicates between the two queries anyway (since the first column is different), so UNION ALL will be faster.<br>
(I assume that you don't have duplicates inside each query that you want to remove)</p>
| 8,024 |
<p>I'm new to 3D printing and I was wondering about the risks of leaving my printer to print overnight? I'm aware that if something goes wrong I'll wake up to spaghetti for breakfast but what are the other things like having the nozzle and bed heated that long? And, when it's done it just sits there on so what could th... | <p>Presuming that you're talking about an 8 hour period, your printer should be designed to run for 8 hours continuous anyway, so nothing will happen regarding the bed or screen that wouldn't happen with a normal print.</p>
<p>If the first few layers stick to the bed, it's likely that you're print will at least be part... | <p>There are software solutions like "Spaghetti Detective" (recently renamed to "Obico") which can watch your print via a camera, and potentially stop the job if it looks bad.</p>
<p>Most of the time my print failures come early, in the form of poor bed adhesion - watch the job start for a while be... | 2,156 |
<p>I find myself doing this sort of thing all the time. I've been considering writing a macro/function to make this sort of thing easier, but it occurs to me that I'm probably reinventing the wheel.</p>
<p>Is there an existing function that will let me accomplish this same sort of thing more succinctly?</p>
<pre><co... | <p>There are several built-in ways of doing this. One way would be:</p>
<pre><code>(remove-if-not 'good-enough-score-p word-list)
</code></pre>
<p>And another:</p>
<pre><code>(loop for word in word-list
when (good-enough-score-p word)
collect word)
</code></pre>
<p>And yet another:</p>
<pre><code>(ma... | <p>There are a couple ways you can do this. First, and probably most easily, you can do it recursively.</p>
<pre><code>(defun remove-low-words (word-list)
(if (good-enough-score-p (car word-list))
(list word (remove-low-words (cdr word-list)))
(remove-low-words (cdr word-list))))
</code></pre>
<p>You c... | 5,945 |
<p>I have printed a MPCNC machine. It has a print area of about 30" x 30" and up to 11" tall. (yes, those numbers are correct).</p>
<p>I found a perfect piece of glass at a garage sale for $5.00 to use as my print bed. </p>
<p>My problem now is how to heat the glass? I was wondering if there is some sort of tape ... | <p>Your best option may be to seek out a silicone rubber heating mat, using those terms for your web search. A quick search on my part shows many resources, some of which are known to the 3d printing manufacturing world, while others are equally suited for that purpose.</p>
<p>Don't bond the heater to the glass. You'l... | <p>Maybe you can stick a <a href="https://en.wikipedia.org/wiki/Nichrome" rel="nofollow" title="nichrome">nichrome</a> wire under the glass using a heat resistant tape. You'll have to make the appropriate calcs (or just trial/error) to achieve the desired temperature at a consistent timing.</p>
| 370 |
<p>I am trying to run the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en" rel="nofollow noreferrer">VS 2008 SP1 installer</a>, but it says that I need 6,366MB of available space, and my C drive currently only has 2,452MB available. Is there any ... | <p>Burn it to a DVD and install it from there. Also remove any development software that you don't need from Visual Studio, such as C++, VB.NET, Crystal Reports, etc.</p>
| <p>You can have Visual Studio install components onto a separate hard drive from your primary but be warned, you still end up with a lot of data on your primary drive.</p>
<p>I tried to install VS 2008 on a machine with 2gb of hard drive space on the primary and a lot of the secondary, you still end up with about 1gb ... | 3,704 |
<p>I'm looking for ideas on how to draw a skinnable "button" in a game application. If I use a fixed sprite non-vector image for the button background, then I can't size the button easily. If I write code to draw a resizable button (like Windows buttons are drawn), then the programmer has to get involved -- and it make... | <p>If you really want to accomplish this, the way to do it is with texture coordinates. Much like you would make a stretchable button/panel design in HTML with a table, you simply define the UV coordinates for the corners, the top stretchable area, the bottom stretchable area, the side stretchable areas, and then the ... | <p>Yes. I am working on an Editor. It's a XAML-like language (or OpenLaszlo-like, if you prefer) for XNA. So the buttons can be resized by the editor. The buttons might also be resized by a style sheet. </p>
<p>I guess you're right that it's likely that the buttons will all be the same size in a real design. But even ... | 2,867 |
<p>I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database.</p>
<p>Afte... | <p>Try a rake task. For example:</p>
<ol>
<li>Create the file <strong>/lib/tasks/bootstrap.rake</strong></li>
<li>In the file, add a task to create your default user:</li>
</ol>
<pre><code>
namespace :bootstrap do
desc "Add the default user"
task :default_user => :environment do
User.create( ... | <p>Some of the answers are outdated. Since Rails 2.3.4, there is a simple feature called Seed available in <code>db/seed.rb</code> :</p>
<pre><code>#db/seed.rb
User.create( :name => 'default', :password => 'password' )
Comment.create( :title => 'Title', :body => 'First post!' )
</code></pre>
<p>It provide... | 8,756 |
<p>I have a medium sized application that runs as a .net web-service which I do not control,
and I want to create a loose pythonic API above it to enable easy scripting.</p>
<p>I wanted to know what is the best/most practical solution for using web-services in python.</p>
<p>Edit:
I need to consume a complex soap WS
... | <p>If I have to expose APIs, I prefer doing it as JSON. Python has excellent support for JSON objects (JSON Objects are infact python dictionaries)</p>
| <p>Most of the packages on python that a SOAP service through them can be called works on python 2.x, but had problems on Python 3.x</p>
<p>The best fit for python 3.x that I've found is <a href="https://pypi.python.org/pypi/suds-jurko/0.6" rel="nofollow">suds-jurko</a></p>
| 4,863 |
<p>I believe this question is asked on every private Beta... what should be the name of our chatroom?</p>
| <p><strong>The Hotbed.</strong></p>
<p>Colloquially, "hotbed" generally refers to a center of activity. Here, it will have a double meaning (referencing the hot bed of a 3D printer.</p>
| <h1>Filibusters!</h1>
<p>I've heard that from somewhere. It's a play on the word "filament"</p>
<p><sup>Oh, Just as a heads up, I can think of the weirdest names...</sup></p>
| 12 |
<p>I have an Ender 3 Pro with upgraded Bowden capricorn tube. The tube will move approximately 1-2 mm during normal operation, though it will not come out of the coupler at all. I have read that the movement if unchanging (constant movement of 1-2 mm) can be compensated for with settings adjustment to avoid r... | <p>The slipping does result in lost retraction distance. It does not result in underextrusion, lost material (except possibly via having insufficient retraction after the reduction), or anything like that.</p>
<p>If your retraction is set to 6 mm, but the bowden pulls 2 mm into the coupler when you retract, those firs... | <p>This is happening to my E3 pro. When the Bowden tube slips back filament fills up the gap causing a heat creep issue. This of course causes clogged nozzle. If retracting I have had the swollen filament lodge in the tube to the point I had to remove tube and heat high enough with heat gun to soften filament for a rev... | 1,494 |
<p>I had the idea of a search engine that would index web items like other search engines do now but would only store the file's title, url and a hash of the contents.</p>
<p>This way it would be easy to find items on the web if you already had them and didn't know where they came from or wanted to know all the places... | <p>Check out <a href="http://en.wikipedia.org/wiki/Locality_sensitive_hashing" rel="nofollow noreferrer">the wikipedia page on locality sensitive hashing</a>. There's also <a href="http://www.mit.edu/~andoni/LSH/" rel="nofollow noreferrer">a good page hosted by a research on MIT</a>.</p>
<p>In general, there are seve... | <p>It's not a bad idea. Sometimes I find myself stumbled upon some file trying to figure out where it comes from :) But how are you going to track item's sources? Content can be obtained by various means - web browser, download manager, simply by copying from network share.</p>
| 7,373 |
<p>What's the best way to delete all rows from a table in sql but to keep n number of rows on the top? </p>
| <pre><code>DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table)
</code></pre>
<p><strong>Edit:</strong> </p>
<p>Chris brings up a good performance hit since the TOP 10 query would be run for each row. If this is a one time thing, then it may not be as big of a deal, but if it is a common thing, then I did ... | <p>I would solve it using the technique below. The example expect an <em>article</em> table with an <em>id</em> on each row.</p>
<pre><code>Delete article where id not in (select top 1000 id from article)
</code></pre>
<p>Edit: Too slow to answer my own question ...</p>
| 6,851 |
<p>In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. I... | <p>I have a dialog that I wrote called an OpenFileOrFolder dialog that allows you to open either a folder or a file.</p>
<p>If you set its AcceptFiles value to false, then it operates in only accept folder mode.</p>
<p><a href="https://github.com/scottwis/OpenFileOrFolderDialog" rel="noreferrer">You can download the ... | <p>I know the question was on configuration of <code>OpenFileDialog</code> but seeing that Google brought me here i may as well point out that if you are ONLY looking for folders you should be using a <code>FolderBrowserDialog</code> Instead as answered by another SO question below</p>
<p><a href="https://stackoverflo... | 5,093 |
<p>I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects.</p>
<p>In OpenGL light positions get transformed just like everything else with the MODELVIEW... | <p>The answer I discovered eventually was that while OpenGL only has its one amalgamated <code>MODELVIEW</code> matrix, in D3D the "world" and "view" transforms are kept separate, and placing lights seems to be the major reason for this. So the answer is you use <code>D3DTS_VIEW</code> to set up matrices that should a... | <p>For the fixed function pipeline, the lights position and direction are set in world space. The docs for the light structures do tell you that, but I'm not surprised that you missed it in the docs. There's not much information on the fixed function pipeline anymore as the focus has to programmable shaders.</p>
| 9,724 |
<p>The company where I work created this application which is core to our business and relies on the web browser to enforce certain "rules" that without them renders the application kinda useless to our customers. Sorry about having to be circumspect, An NDA along with a host of other things prevents me from saying ex... | <p>If the bulk of your application is on the back-end, you should still be able to keep the majority of the code intact and only replace the front-end. However, Silverlight requires an understanding of WPF, which is dramatically different than the HTML/JS that your app currently uses. I'd say if your UI is pretty thin,... | <p>How heavily do you use the class libraries, and things that might be considered 'dangerous', like pinvoke, file system access and System.Diagnostics.Process? </p>
| 9,014 |
<p>I need to determine if I'm on a particular view. My use case is that I'd like to decorate navigation elements with an "on" class for the current view. Is there a built in way of doing this?</p>
| <p>Here what i am using. I think this is actually generated by the MVC project template in VS:</p>
<pre><code>public static bool IsCurrentAction(this HtmlHelper helper, string actionName, string controllerName)
{
string currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
... | <p>Here is something a little different, use a FilterAttribute:</p>
<pre><code> [NavigationLocationFilter("Products")]
public ViewResult List()
{
return View();
}
</code></pre>
<p>...</p>
<pre><code>public class NavigationLocationFilterAttribute : ActionFilterAttribute
{
public string Curr... | 6,177 |
<p>In order for my application (.Net 1.1) to use the system configured proxy server (trough a proxy.pac script) I was using an interop calls to WinHTTP function WinHttpGetProxyForUrl, passing the proxy.pac url I got from the registry.</p>
<p>Unfortunately, I hit a deployment scenario, where this does not work, as the ... | <p>Just a thought: Why not create a micro web server that can serve the local PAC file over a localhost socket. You should use a random URI for the content so that it is difficult to browse this in unexpected ways.</p>
<p>You could then pass a URL like <a href="http://localhost:1234/gfdjklskjgfsdjgklsdfklgfsjkl" rel="... | <p>Can't answer your problem unfortunately (though a few years ago I played with jscript.net and it would only be a few lines to build and run that way)</p>
<p>I hit a similar proxy.pac hiccup with a personal work-around-the-office-proxy file a while back - in the end I went with the easiest option and dropped it into... | 8,959 |
<p>Linux/Gcc/LD - Toolchain.</p>
<p>I would like to remove STL/Boost debug symbols from libraries and executable, for two reasons:</p>
<ol>
<li>Linking gets very slow for big programs</li>
<li>Debugging jumps into stl/boost code, which is annoying</li>
</ol>
<p>For 1. incremental linking would be a big improvement, ... | <p>As far as I know there's no real option to do what you want in gcc. The main problem being that all the code you want to strip debug symbols for is defined in headers.</p>
<p>Otherwhise it would be possible to build a library separatly, strip that, and link with the stripped version.</p>
<p>But only getting debug ... | <p>Which compiler are you using? For example, if I understand your question correctly, this is a trivial matter in MS Visual Studio.</p>
| 9,924 |
<p>I have a Duplicator i3 mini, which has yet to make it a month without breaking. This time it is extra broken because the filament is not extruding properly. the most successful print I've had yet had about a centimeter before turning into an absolute mess. I have a picture. It was not stringy, and had the exact shap... | <p>Underextrusion and clogs can also be caused by insufficient temperature in the hot end. You've not reference your temperatures, so consider to use a test model and print at different temperatures. Too low temps can result in the problem you present, while too hot temps will increase stringing and peculiar blobs on t... | <p>That looks like underextrusion as a result of a clog. Try cleaning the nozzle or replacing it.</p>
<p>See this link for more information about clogged nozzles.
<a href="https://3dprinting.stackexchange.com/questions/5191/if-i-have-a-nozzle-clog-can-i-easily-get-rid-of-it-by-simply-replacing-the-nozz">If I have a no... | 1,416 |
<p>I am overriding a lot of SAP's Portal functionality in my current project. I have to create a custom fixed width framework, custom iView trays, custom KM API functionality, and more.</p>
<p>With all of these custom parts, I will not be using a lot of the style functionality implemented by SAP's Theme editor. What... | <p>I'd consider it dirty hack, but as a non-Portal developer I'd consider using JavaScript to insert a new link element in the head pointing to your new CSS file. Of course you'd have a flash of un-styled content because the script probably won't run until after part of the page has been downloaded and rendered, but ... | <p>I hate that I'm answering my own question, but I did find a potential solution that's not documented well and in typical SAP fashion uses deprecated methods. So it might be a slightly less dirty hack than what Eric suggested. I found it through an unrelated SDN forum post.</p>
<p>Basically, you dive into the requ... | 8,781 |
<p>Rather than rewriting the entire contents of an xml file when a single element is updated, is there a better alternative to updating the file?</p>
| <p>I would recommend using VTD-XML <a href="http://vtd-xml.sourceforge.net/" rel="noreferrer">http://vtd-xml.sourceforge.net/</a></p>
<p>From their FAQ ( <a href="http://vtd-xml.sourceforge.net/faq.html" rel="noreferrer">http://vtd-xml.sourceforge.net/faq.html</a> ):</p>
<blockquote>
<p>Why should I use VTD-XML for... | <p><strong>Process Large XML Files with XQuery Works with Gigabyte Size XML Files</strong>
<a href="http://www.xquery.com" rel="nofollow noreferrer">http://www.xquery.com</a></p>
<p>XQuery is a query language that was designed as a native XML query language. Because most types of data can be represented as XML, XQuery... | 8,783 |
<p>There is a little circuit board, or breadboard or something <a href="http://reprap.org/wiki/Prusa_i3_Rework_Electronics_and_wiring#Wiring" rel="nofollow noreferrer">in the diagram of the wiring for the i3</a>.</p>
<p>And it's mentioned that the z-axis motors need to be <a href="http://reprap.org/wiki/Prusa_i3_Rewor... | <p>In the diagram, they do show the wires connecting together, which is right. You can accomplish that just about any way you like, so long as you pair up the wires correctly from one motor to the other.</p>
<p>I'm assuming both "Z" motors are the same type and have the same color-coding for their wires. If not, you'l... | <p>For some unknown reason, everywhere everybody is saying that Z stepper motors need to be connected in parallel... And this was always the only obvious way, until recently some people started to connect these motors in series.</p>
<p>And I personally started to believe the right way is to connect them in series.</p>... | 171 |
<p>I made a test print for a small gear (~ 1.5 inches in diameter) a few months ago, with a hole through the center. On the first try, the filament (ABS) fused to the print bed, meaning that I had to spend ten minutes scraping off material to loosen it. One solution to this is to use painter's tape spread across the pr... | <p>This can highly depend on the slicer you are using. Some software such as Makerware and Slic3r allow you to adjust the settings for the first raft/part layers. I might suggest adjusting this "Z0" point to about 1/4-1/2 of your layer height. Essentially the first layer (or two) will not adhere as well.</p>
<p>This i... | <p>My very first thought was you didn't re-calibrate your Z0 after adding the blue tape. It sounds like the print head was too close to the print bed to begin with, and adding the blue tape just made it that much worse. </p>
| 104 |
<p>I've seen examples like this: </p>
<pre><code>public class MaxSeconds {
public static final int MAX_SECONDS = 25;
}
</code></pre>
<p>and supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the best way to c... | <p>That is perfectly acceptable, probably even the standard.</p>
<pre><code>(public/private) static final TYPE NAME = VALUE;
</code></pre>
<p>where <code>TYPE</code> is the type, <code>NAME</code> is the name in all caps with underscores for spaces, and <code>VALUE</code> is the constant value;</p>
<p>I highly recom... | <p>I wouldn't call the class the same (aside from casing) as the constant ... I would have at a minimum one class of "Settings", or "Values", or "Constants", where all the constants would live. If I have a large number of them, I'd group them up in logical constant classes (UserSettings, AppSettings, etc.)</p>
| 9,174 |
<p>How do I speed up prints for the Monoprice Select IIIP Plus printer?</p>
<p>The manual shows [Cura] examples of:</p>
<ul>
<li>Print speed: 50mm/s</li>
<li>Travel Speed: 80mm/s</li>
<li>Bottom Layer Speed: 20mm/s</li>
<li>Infill Speed: 50mm/s</li>
<li>Outer shell speed: 15mm/s</li>
<li>Inner shell speed: 30mm/s</li... | <p>In my experience a print speed of 50-70mm/s is ideal. Even if you set the speed to 150mm/s the print head still changes directions often and rarely will have enough time to accelerate from 0->150 before changing direction again. </p>
<p>Some more effective ways of speeding up prints is to adjust</p>
<ul>
<li>Layer... | <p>I was using Cura's default settings for a Prusa I3 on my MonoPrice Select V2 (model #13860), and got horrible results frequently. Then I used the settings you list, and got very nice results. Compare the below images for the bottom layer of 4 benchys, with adhesion brim.</p>
<p>I'm using PLA, 0.4mm nozzle, 60C for ... | 654 |
<p>Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security?</p>
| <p>I use WebORB for .NET to do Flex remoting and then use DLINQ on the server. One tricky thing about using LINQ with WebORB is that WebORB uses Reflection to automatically retrieve all the relationships of the object(s) you return to Flex. This causes severe time penalties as LINQ uses lazy loading to load relationshi... | <p>He Asked about ADO.NET Data Services not web service</p>
| 6,660 |
<p>I want to know how to make a mold of a 3D design in .stl format.</p>
<p>Suppose I have a 3D partin .stl format (for e.g. a cylinder) and I want to make/design a mold for this object (i.e. the structure through which I could make the cylinder). Is there any way to do so? Are there any tools to do so?</p>
<p>My requ... | <p>You can also bring the model and a big box into slic3r, align and orient them (enclose the model in the box), and do a subtract modifier, leaving a hollow where the two intersected. You probably want to do this twice, for a top mould and a botom mould. I've done this, but I don't see any instructions online for it. ... | <p>In addition to the answer of Davo (which describes a surprising feature of the slicer software I was unaware of), a more generic description would involve the use of a 3D solid model CAD program. You should be aware that a model in STL format is not a solid model, it is a surface model. In order to make a mold you w... | 894 |
<p>I was wondering how as semantic service like Open Calais figures out the names of companies, or people, tech concepts, keywords, etc. from a piece of text. Is it because they have a large database that they match the text against? </p>
<p>How would a service like Zemanta know what images to suggest to a piece of te... | <p>I'm not familiar with the specific services listed, but the field of natural language processing has developed a number of techniques that enable this sort of information extraction from general text. As Sean stated, once you have candidate terms, it's not to difficult to search for those terms with some of the oth... | <p>Open Calais probably use language parsing technology and language statics to guess which words or phrases are Names, Places, Companies, etc. Then, it is just another step to do some kind of search for those entities and return meta data.</p>
<p>Zementa probably does something similar, but matches the phrases agains... | 4,207 |
<p>I was surprised recently to find that it's possible to have a return statement in a finally block in Java.</p>
<p>It seems like lots of people think it's a bad thing to do as described in '<a href="https://web.archive.org/web/20070922061412/http://weblogs.java.net/blog/staufferjames/archive/2007/06/_dont_return_in.... | <p>The examples you provided are reason enough to <i>not</i> use flow-control from finally.</p>
<p>Even if there's a contrived example where it's "better," consider the developer who has to maintain your code later and who might not be aware of the subtleties. That poor developer might even be you....</p>
| <p>Returning from inside a <code>finally</code> block will cause <code>exceptions</code> to be lost.</p>
<p><strong>A return statement inside a finally block will cause any exception that might be thrown in the try or catch block to be discarded.</strong> </p>
<p>According to the <a href="http://docs.oracle.com/javas... | 7,045 |
<p>I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user starts entering text in the search fi... | <p>You will need to use some P/Inovke interop code to do this. Look for the Win32 API <code>SendMessage</code> function and the <code>EM_SETCUEBANNER</code> message.</p>
| <p>There is built-in functionality in the text box control -- <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletemode.aspx" rel="nofollow noreferrer">AutoCompleteMode</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletesource.aspx" rel... | 6,902 |
<p>I have read through several reviews on Amazon and some books seem outdated. I am currently using MyEclipse 6.5 which is using Eclipse 3.3. I'm interested in hearing from people that have experience learning RCP and what reference material they used to get started.</p>
| <p>I've been doing Eclipse RCP development for almost 2 years now. When I first started, I wanted a book for help and many people told me, with Eclipse you're better off using the <a href="http://wiki.eclipse.org/index.php/Rich_Client_Platform" rel="nofollow noreferrer">Eclipsepedia</a> and Google.</p>
<p>However, I ... | <p>I read the <a href="https://rads.stackoverflow.com/amzn/click/com/0321334612" rel="nofollow noreferrer" rel="nofollow noreferrer">book</a> suggested by Thomas and it's really worth reading, although not very up-to-date.</p>
| 2,938 |
<p>Like many people, I have burnt the pins in the micro-controller connected to the E0 motor - the E0 motor is not working anymore and I need to print tomorrow! I need to control the extruder motor with the working E1 pins. How do I change this in firmware? </p>
<p>I tried to change to the pins in `pins_RAMPS.h" but i... | <p>I would change the pin assignments by swapping E0 and E1 in <code>pins_RAMPS.h</code>.</p>
| <p>As a quick and dirty solution you may try to enable two extruders in configuration file, re-upload firmware, and then edit your GCODE file to replace all E0 references with E1.</p>
| 447 |
<p>I've had to do some introspection in python and it wasn't pretty:</p>
<pre><code>name = sys._getframe(1).f_code
name = "%s:%d %s()" %(os.path.split(name.co_filename)[1],name.co_firstlineno,name.co_name)
</code></pre>
<p>To get something like</p>
<pre><code>foo.py:22 bar() blah blah
</code></pre>
<p>In our debugg... | <p>A print statement does its IO through "sys.stdout.write" so you can override sys.stdout if you want to manipulate the print stream.</p>
| <p>The python <a href="http://www.python.org/doc/current/lib/module-inspect.html" rel="nofollow noreferrer">inspect</a> module makes this a lot easier and cleaner. </p>
| 6,288 |
<p>I recently read a nice <a href="http://macdevelopertips.com/ruby/using-a-string-as-a-file-in-ruby.html" rel="noreferrer">post</a> on using <code>StringIO</code> in Ruby. What the author doesn't mention, though, is that <code>StringIO</code> is just an "I." There's no "O." You <em>can't</em> do this, for example:<... | <p>I looked at the ruby documentation for <code>StringIO</code>, and it looks like what you want is <a href="http://ruby-doc.org/stdlib/libdoc/stringio/rdoc/classes/StringIO.html#method-i-string" rel="noreferrer"><code>StringIO#string</code></a>, not <code>StringIO#to_s</code></p>
<p>Thus, change your code to:</p>
<p... | <p>Well, a StringBuffer is not quite as necessary in Ruby, mainly because Strings in Ruby are mutable... thus you can build up a string by modifying the existing string instead of constructing new strings with each concat.</p>
<p>As a note, you can also use special string syntax where you can build a string which refe... | 3,156 |
<p>The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/I... | <p>Try using a Socket for your client instead of the TcpClient Class.</p>
<p>Then you can use Socket.Bind to target your local network adapter</p>
<pre><code> int port = 1234;
IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName());
//find ip address for your adapter here
IPAddress localAddress = ent... | <p>Basically, once the TcpClient.Connect method has been successful, it will have created a mapping between the physical MAC address of the embedded system and the route it should take to that address (i.e. which network card to use).</p>
<p>I don't believe that all messages then sent over the TcpClient connection wil... | 7,211 |
<p>I am using Slic3r to generate the GCode for my Marlin-based printer. For some reason with increasing height my print starts to get messed up. On another part it starts to act like this when there are small parts. Is this related to my Slic3r settings, maybe to much filament being extruded or is this due to something... | <p>To me, this looks like a combination of bad filament, high temperature and/or fast speeds.</p>
<ul>
<li>Too high extrusion temperature will make difficult to let each layer cool enough before the next layer begins. This is why you see the poor results on the smaller areas of the print in your second photo.</li>
<li... | <p>This can happen if your filament is having to be pulled off the spool and slipping in the extruder. Check if slippage is happening at the extruder, perhaps see if results change by providing some hand powered help. I have seen this with some glossy PLA I have used.</p>
| 321 |
<p>We've got a scenario that requires us to parse lots of e-mail (plain text), each e-mail 'type' is the result of a script being run against various platforms. Some are tab delimited, some are space delimited, some we simply don't know yet.</p>
<p>We'll need to support more 'formats' in the future too.</p>
<p>Do we ... | <p>Regex.</p>
<p>Regex can solve almost everything except for world peace. Well maybe world peace too.</p>
| <p>With as little information you provided, i would choose Regex.</p>
<p>But what kind of information you want to parse and what you would want to do will change the decision to Lex/Yacc maybe..</p>
<p>But it looks like you've already made your mind up with String search :)</p>
| 8,025 |
<p>I am new to ActionScript 3 and have run into a problem:</p>
<p>Using Flex Builder 3, I have a created a project with a few simple classes. If code in class A instantiates an object of class B (class B is in its own source file) then the code compiles fine, but I get the following run time error:</p>
<blockquote>
... | <p>I finally realized what was wrong: Class B was subclassing from DisplayObject which I now see is an abstract class. Class B did not implement the abstract members, thus the error. I'll probably change class B to subclass from Sprite instead.</p>
<p>This seems like a problem that should have been caught by the compi... | <p>It's worth noting that if you're including classes that someone else built, and they used Flash CS3 and you're using Flex, or vice versa, that the core libraries of each are different and some things are not included in both. Check out the two reference docs to be sure:</p>
<p>CS3: <a href="http://livedocs.adobe.co... | 9,375 |
<p>What would be the best way to design a threaded commenting system so that it doesn't hammer the database?</p>
| <p><strong>SELECT ... START WITH ... CONNECT BY</strong></p>
<p>Oracle has an extension to SELECT that allows easy tree-based retrieval.</p>
<p>This query will traverse a table where the nesting relationship is stored in <strong>parent</strong> and <strong>child</strong> columns.</p>
<pre><code>select * from my_tabl... | <p>What I normally do in this case is to have a single thread that is responsible for putting the data into the database, and have all auxiliary threads report to that thread, which then queues up the data, and writes it either serially, or in batches (depending on the requirements, and how much database activity I'm w... | 5,706 |
<p>Suppose I have:</p>
<ol>
<li>Toby</li>
<li>Tiny</li>
<li>Tory</li>
<li>Tily</li>
</ol>
<p>Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at position 3)</p>
<p>I tried looking at... | <p>Finding a list of characters that are common in ALL strings at a certain position is trivially simple. Just iterate on each string for each character position 1 character position at a time. If any string's character is not the match of it's closest neighbor string's character, then the position does not contain a... | <p>In lisp:</p>
<pre><code>CL-USER> (defun common-chars (&rest strings)
(apply #'map 'list #'char= strings))
COMMON-CHARS
</code></pre>
<p>Just pass in the strings:</p>
<pre><code>CL-USER> (common-chars "Toby" "Tiny" "Tory" "Tily")
(T NIL NIL T)
</code></pre>
<p>If you want the characters thems... | 9,422 |
<p>Is there an easy way to find the storage card's path on a Windows Mobile device
when there is a storage card and a bluetooth ftp connection?</p>
| <p>Keep in mind that "\Storage Card" is english oriented. A device made for a different region may have a different name. The name of the storage card path on my device varies with how I am using the device. </p>
<p>Some time ago in the MSDN forms I responded to a few questions on how to detect the storage cards in ... | <p>On Windows CE 5 (which is the base for Windows Mobile 6) the storage cards get mounted at the root file system as "Storage Card\", "Storage Card2\", etc.</p>
<p>To find out if it's mounted call GetFileAttributes (or the remote version CeGetFileAttributes I believe) passing in the full path ("\Storage Card\"). If it... | 6,149 |
<p>What is the best way to authorize all users to one single page in a asp.net website.</p>
<p>For except the login page and one other page, I deny all users from viewing pages in the website. </p>
<p>How do you make this page accessible to all users?</p>
| <p>I've been using forms authentication and creating the necessary GenericIdentity and CustomPrincipal objects that allows me to leverage the User.IsInRole type functions you typically only get with Windows authentication.</p>
<p>That way in my web.config file, I can do stuff like...</p>
<pre><code><location path=... | <p>I created a base "page" class that handles that sort of thing. All my pages can then be decorated with the RequiresLogin attribute if a login is required to view them. If the attribute is not present, the page is accessible to all.</p>
<p>Example:</p>
<pre><code><RequiresLogin()> _
<RequiresPermission("p... | 3,905 |
<p>my <b>SSRS DataSet</b> returns a field with HTML, e.g.</p>
<pre><code><b>blah blah </b><i> blah </i>.
</code></pre>
<p>how do i strip all the HTML tags? has to be done with <b>inline</b> VB.NET</p>
<p>Changing the data in the table is not an option.</p>
<p><strong>Solution found</strong> ... | <p>Thanx to Daniel, but I needed it to be done inline ... here's the solution:</p>
<p><code>= System.Text.RegularExpressions.Regex.Replace(StringWithHTMLtoStrip, "<[^>]+>","")</code></p>
<p>Here are the links:</p>
<p><a href="http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx" rel="noreferrer">ht... | <p>If you know the HTML is well-formed enough, you could, if you make sure it has a root node, convert the data in that field into a System.Xml.XmlDocument and then get the InnerText value from it.</p>
<p>Again, you will have to make sure the text has a root node, which you can add yourself if needs be, since it will ... | 5,533 |
<p>As the question states, should <a href="https://3dprinting.stackexchange.com/questions/tagged/bed" class="post-tag" title="show questions tagged 'bed'" rel="tag">bed</a> and <a href="https://3dprinting.stackexchange.com/questions/tagged/build-plate" class="post-tag" title="show questions tagged 'build-pl... | <p>It should not be about merging of tags, rather we should come up with a proper terminology to identify the correct parts of the "build platform".</p>
<p>Basically, every printer consists of a frame with some sort of guide rails<sup>1</sup> moving a carriage. On this carriage a build surface is attached whe... | <h1>Edit: I like Trish's suggestion best.</h1>
<p>I vote <strong>no</strong>. Our (Hyrel) printers have, on some models, a thick aluminum <a href="https://3dprinting.stackexchange.com/questions/tagged/bed" class="post-tag" title="show questions tagged 'bed'" rel="tag">bed</a> that can reach 200C, but we expect... | 74 |
<p>Do any editors honer C #line directives with regards to goto line features?</p>
<p><em>Context:</em>
I'm working on a code generator and need to jump to a line of the output but the line is specified relative to the the #line directives I'm adding.
I can drop them but then finding the input line is even a worse pai... | <p>If the editor is scriptable it should be possible to write a script to do the navigation. There might even be a Vim or Emacs script that already does something similar.</p>
<p>FWIW when I writing a lot of Bison/Flexx I wrote a <a href="http://www.zeusedit.com" rel="nofollow noreferrer">Zeus</a> Lua macro script tha... | <p><code>#line</code> directives are normally inserted by the precompiler, not into source code, so editors won't usually honor that if the file extension is <code>.c</code>.</p>
<p>However, the normal file extension for post-compiled files is <code>.i</code> or <code>.gch</code>, so you might try using that and see w... | 7,362 |
<p>In C# is there a shorthand way to write this:</p>
<pre><code>public static bool IsAllowed(int userID)
{
return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe ...);
}
</code></pre>
<p>Like:</p>
<pre><code>public static bool IsAllowed(int userID)
{
return (userID in Personnel.JohnDoe, Personnel... | <p>How about this?</p>
<pre><code>public static class Extensions
{
public static bool In<T>(this T testValue, params T[] values)
{
return values.Contains(testValue);
}
}
</code></pre>
<p>Usage:</p>
<pre><code>Personnel userId = Personnel.JohnDoe;
if (userId.In(Personnel.JohnDoe, Personnel.... | <p>A nice little trick is to sort of reverse the way you usually use .Contains(), like:-</p>
<pre><code>public static bool IsAllowed(int userID) {
return new int[] { Personnel.JaneDoe, Personnel.JohnDoe }.Contains(userID);
}
</code></pre>
<p>Where you can put as many entries in the array as you like.</p>
<p>If the... | 5,293 |
<p>I am about to purchase a TronXY X3 or P802; but, my PC is running Windows 10.</p>
<p>The spec sheet for the printers does not list anything above Windows 7.
Is anyone using either of these printers with Windows 10?</p>
| <p>Since the printer supports using an SD card, you don't <em>need</em> to connect it directly to a PC. Serial over USB has been broken in the past in various Win10 builds, I've not tried it recently and I've not tried connecting my A8 to my PC recently either.</p>
<p>If you need to use USB, and can't make it work wit... | <p>For Windows 10 driver, go directly to the Microsoft update catalogue.
<a href="https://www.catalog.update.microsoft.com/Search.aspx?q=USB%5CVID_1A86%26PID_7523" rel="nofollow noreferrer">https://www.catalog.update.microsoft.com/Search.aspx?q=USB%5CVID_1A86%26PID_7523</a></p>
<p>Download the .cab file, extract the co... | 550 |
<p>I'm setting up a dedicated SQL Server 2005 box on Windows Server 2008 this week, and would like to pare it down to be as barebones as possible while still being fully functional.</p>
<p>To that end, the "Server Core" option sounds appealing, but I'm not clear about whether or not I can run SQL Server on that SKU. ... | <p>Not sure how credible <a href="http://www.builderau.com.au/program/windows/soa/Getting-started-with-Windows-Server-2008-Core-edition/0,339024644,339288700,00.htm" rel="noreferrer">this source is</a>, but:</p>
<blockquote>
<p>The Windows Server 2008 Core edition can:</p>
<ul>
<li><p>Run the file server role... | <p>Server Core won't be very useful (to me at least, and I think many others as well) until they get a version of .Net framework on it. Maybe a specialized subset like they have in the Compact Framework on smart phones.</p>
| 2,379 |
<p>My RubyOnRails app is set up with the usual pack of mongrels behind Apache configuration. We've noticed that our Mongrel web server memory usage can grow quite large on certain operations and we'd really like to be able to dynamically do a graceful restart of selected Mongrel processes at any time.</p>
<p>However, ... | <p>I've done a little more investigation into the Mongrel source and it turns out that Mongrel installs a signal handler to catch an standard process kill (TERM) and do a graceful shutdown, so I don't need a special procedure after all.</p>
<p>You can see this working from the log output you get when killing a Mongrel... | <p>Try using:</p>
<pre><code>mongrel_cluster_ctl stop
</code></pre>
<p>You can also use:</p>
<pre><code>mongrel_cluster_ctl restart
</code></pre>
| 4,740 |
<p>Documentation is severely lacking on anything to do with stored procedures in mysql with PHP. I currently have a stored procedure that I call via PHP, how can I get the value of an out parameter?</p>
| <p>it looks like it's answered in this post:</p>
<p><a href="http://forums.mysql.com/read.php?52,198596,198717#msg-198717" rel="noreferrer">http://forums.mysql.com/read.php?52,198596,198717#msg-198717</a></p>
<p>With mysqli PHP API: </p>
<p>Assume sproc myproc( IN i int, OUT j int ): </p>
<pre><code>$mysqli = new m... | <p>Here's an example of how to do this with mysql, mysqli, and pdo:</p>
<p><a href="http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/" rel="noreferrer">http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/</a></p>
| 7,050 |
<p>I have a concept that's roughly 18"x30" (about 457x762 mm), and I just realized that the Makerbot and similar printers only allow dimensions around the size of a piece of paper. What are other options? Are there large 3D printers I just don't know about? I looked up TMC injection mold, but couldn't find anything on ... | <p>As Trish states, a print service would appear to be your best bet. Building a printer large enough may work out costing more than the print service, especially if it is only for one print of a proof of concept.</p>
<p>Anecdotally, I visited a 3D Printing shop in Bangkok, <a href="http://jwh3dprinting.com/english/ou... | <h1>Yes<sup>If you have the money</sup></h1>
<p>Either read <a href="https://all3dp.com/1/best-large-3d-printer-large-format-scale-3d-printers/#section-best-large-3d-printers-under-1000" rel="nofollow noreferrer">here</a> or look at the ones I plucked out of that list to show you:</p>
<p>First of all, 3D printers on FD... | 1,054 |
<p>For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?</p>
| <p><code>ICriteria</code> has a <code>SetFirstResult(int i)</code> method, which indicates the index of the first item that you wish to get (basically the first data row in your page). </p>
<p>It also has a <code>SetMaxResults(int i)</code> method, which indicates the number of rows you wish to get (i.e., your page si... | <p>You don't need to define 2 criterias, you can define one and clone it.
To clone nHibernate criteria you can use a simple code:</p>
<pre><code>var criteria = ... (your criteria initializations)...;
var countCrit = (ICriteria)criteria.Clone();
</code></pre>
| 7,835 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.