instruction stringlengths 27 22.5k | chosen stringlengths 27 28.2k | rejected stringlengths 19 24.9k | __index_level_0__ int64 0 10k |
|---|---|---|---|
<p>I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml.</p>
... | <p><a href="http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage" rel="nofollow noreferrer">http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage</a> is a list of all non-Elisp extension languages you can use.</p>
<p>It does appear to be dynamic language centric.</p>
<p><a href="http://co... | <p>There is no "Extension API". Emacs Lisp is way in there, and it ain't moving.</p>
<p>You can run Emacs commands from your other process. Have a look at Gnuserv.</p>
<p>There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example... | 3,597 |
<p>When you cut or break a PLA model (for example to remove support) it often leaves an ugly while mark where the removed piece was connected.</p>
<p>Sanding also tend to leave dull white scratches on the sanded surface.</p>
<p>What can I do to restore the white areas to the original filament color?</p>
| <p>A quick blast from a heat gun will very slightly reflow the surface texture and eliminate white marks. </p>
<p>However, it's important to avoid over-heating the perimeter layers or you'll see them soften and sag into the infill. So wait for the heat gun to get fully hot and then use a short duration of high heat. L... | <p>Note that on lighter colours these light scratches can be hard to see. On white PLA they're almost invisible unless you hold it against the light at an angle and look at the specular reflection.</p>
<p>I've had some luck on a flat surface (the face of a game tile I printed) by going through various grades of sand p... | 202 |
<p>Is there a better way to flash a window in Java than this:</p>
<pre><code>public static void flashWindow(JFrame frame) throws InterruptedException {
int sleepTime = 50;
frame.setVisible(false);
Thread.sleep(sleepTime);
frame.setVisible(true);
Thread.sleep(sleepTime);
... | <p>There are two common ways to do this: use JNI to set urgency hints on the taskbar's window, and create a notification icon/message. I prefer the second way, since it's cross-platform and less annoying.</p>
<p>See <a href="http://java.sun.com/javase/6/docs/api/java/awt/TrayIcon.html" rel="nofollow noreferrer">docume... | <p>Well, there are a few minor improvements we could make. ;)</p>
<p>I would use a Timer to make sure callers don't have to wait for the method to return. And preventing more than one flashing operation at a time on a given window would be nice too.</p>
<pre><code>import java.util.Map;
import java.util.Timer;
import ... | 6,687 |
<p>In addition, are there any performance advantages to static methods over instance methods?</p>
<p>I came across the following recently: <a href="http://www.cafeaulait.org/course/week4/22.html" rel="noreferrer">http://www.cafeaulait.org/course/week4/22.html</a> :</p>
<blockquote>
<p>When should a method be static... | <p>Make methods static when they are not part of the instance. Don't sweat the micro-optimisations.</p>
<p>You might find you have lots of private methods that could be static but you always call from instance methods (or each other). In that case it doesn't really matter that much. However, if you want to actually be... | <p>Here is a related discussion as to <a href="https://stackoverflow.com/questions/23228/why-is-stringformat-static"><strong>why String.Format is static</strong></a> that will highlight some reasons.</p>
| 7,119 |
<p>If I have a table structure that is: </p>
<pre><code>code, description, isdeleted
</code></pre>
<p>where <code>code</code> is the primary key.</p>
<p>The user creates a record, then later on deletes it. Because I am using soft deletes the <code>isdeleted</code> will be set to true. Then in my queries I would be d... | <p>I know many people have argued that the data should be natural, but you should be using a primary key that is completely separate from your data if you're going to be supporting soft deletes without the intention of always re-using the previous record when this situation arises.</p>
<p>Having a divorced primary key... | <p>When you select records (excluding soft-deletes) to display them in user interface/ output file, use where not isdeleted.</p>
<p>But when the user requests an insert operation, perform two queries.</p>
<ol>
<li><p>Lookup all records (ignoring isdeleted value).</p></li>
<li><p>Based on first query result, perform a... | 9,552 |
<p>Is there a way to restart the Rails app (e.g. when you've changed a plugin/config file) while Mongrel is running. Or alternatively quickly restart Mongrel. Mongrel gives these hints that you can but how do you do it?</p>
<p>** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).</p>
<p>** Rai... | <p>You can add the -c option if the config for your app's cluster is elsewhere:</p>
<pre><code>mongrel_rails cluster::restart -c /path/to/config
</code></pre>
| <p>For example,</p>
<pre><code>killall -USR2 mongrel_rails
</code></pre>
| 9,990 |
<p>I find myself to be a visual person and sometimes it's easier to learn something if I can draw diagram/pictures out of it. My question is which tool do I use if I want to map a programming framework (for example .net) visually and see the relationship between all entities (such as classes and members).</p>
| <p>You might try <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a>. The great <a href="http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx" rel="nofollow noreferrer">Scott Hanselman discusses it more here.</a> Tons of visual dependency formats too. It sounds like it... | <p>A decent first-cut might be to write a simple PERL script to parse out dependencies and then pipe that data to <a href="http://www.graphviz.org/" rel="nofollow noreferrer" title="Graphviz">Graphviz</a> for visualization.</p>
| 6,837 |
<p>I am thinking about providing a version of say, the database schema and the <code>dlls</code> for business logic in the footer of my web application.</p>
<p>Is this advised?</p>
<p>Are there any pitfalls, or pointers of how to do this best?</p>
<p>Usability concerns?</p>
<p><strong>I already have a version schem... | <p>I quite like what is done e.g. <a href="http://episteme.arstechnica.com/" rel="noreferrer">here</a>. If you look towards the bottom of the page, there's a piece of text "powered by eve community". If you click that text you get a small chunk of technical information.</p>
<p>To me, this is a nice tradeoff between ... | <p>IMO, the only reasons to show version numbers are:</p>
<ul>
<li>To show progress is being made</li>
<li>To help bug reports be localized to the version they were discovered in</li>
</ul>
<p>So if these things are important for your bug reports, then expose them. If not, then don't.</p>
| 4,439 |
<p>I'm comparing between two techniques to create partitioned tables in SQL 2005.</p>
<ul>
<li>Use partitioned views with a standard version of SQL 2005 (described <a href="http://www.sqlservercentral.com/articles/SQL+Server+2005/61676/" rel="nofollow noreferrer">here</a>)</li>
<li>Use the built in partition in the En... | <p>Yes and no. Cases can be linked to each other, but if you're looking for a tree of cases (prerequisites and such), you need FogBugz 7 or later.</p>
<p>If you're using FogBugz 7.3 or greater, you can now use the <a href="http://www.fogcreek.com/fogbugz/plugins/plugin.aspx?ixPlugin=57" rel="nofollow noreferrer">Case ... | <p>FogBugz 7 now supports sub-cases. This may or may not solve your problem, depending on how you want to handle it.</p>
| 4,682 |
<p>I am creating an ZIP file with <code>ZipFile</code> in Python 2.5, it works OK so far:</p>
<pre><code>import zipfile, os
locfile = "test.txt"
loczip = os.path.splitext (locfile)[0] + ".zip"
zip = zipfile.ZipFile (loczip, "w")
zip.write (locfile)
zip.close()
</code></pre>
<p>But I could... | <p>I created a simple library to create a password encrypted zip file in python. - <a href="https://github.com/smihica/pyminizip" rel="noreferrer"><strong>here</strong></a></p>
<pre><code>import pyminizip
compression_level = 5 # 1-9
pyminizip.compress("src.txt", "dst.zip", "password", compression_level)
</code></pre>... | <p>You can use the <a href="http://www.chilkatsoft.com/python.asp" rel="nofollow noreferrer">Chilkat</a> library. It's commercial, but has a free evaluation and seems pretty nice.</p>
<p>Here's an example I got from <a href="http://www.example-code.com/python/zip.asp" rel="nofollow noreferrer">here</a>:</p>
<pre><co... | 3,794 |
<p>I have two points (a line segment) and a rectangle. I would like to know how to calculate if the line segment intersects the rectangle. </p>
| <p>From my "Geometry" class:</p>
<pre><code>public struct Line
{
public static Line Empty;
private PointF p1;
private PointF p2;
public Line(PointF p1, PointF p2)
{
this.p1 = p1;
this.p2 = p2;
}
public PointF P1
{
get { return p1; }
set { p1 = value; }... | <p>I hate browsing the MSDN docs (they're awfully slow and weird :-s) but I think they should have something similar to <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/Rectangle2D.html#intersectsLine%28double,%20double,%20double,%20double%29" rel="nofollow noreferrer">this Java method</a>... and if they ... | 4,995 |
<p>We have a couple of ASP.Net dataview column templates that are dynamically added to the dataview depending on columns selected by users.</p>
<p>These templated cells need to handle custom databindings:</p>
<pre><code>public class CustomColumnTemplate:
ITemplate
{
public void InstantiateIn( Control contain... | <p>I have worked extensively with templated control and I have not found a better solution.</p>
<p>Why are you referencing the contentLable in the event handler?</p>
<p>The sender is the label you can cast it to the label and have the reference to the label. Like below.</p>
<pre><code> //add a custom data bi... | <p>One solution is to make your template <em>itself</em> implement <code>IDisposable</code>, and then dispose the controls in your template's <code>Dispose</code> method. Of course this means you need some sort of collection to keep track of the controls you've created. Here is one way to go about it:</p>
<pre><code>p... | 4,979 |
<p>All the recent VisualSVN Server posts made me want to check it out. I have SVN running right now through Apache, but I'd like to try out VisualSVN Server, mostly for the Active Directory integration. Their docs don't describe whether you can easily migrate an existing repository. </p>
<p>Anyone done this before?</p... | <p><a href="http://www.visualsvn.com/server" rel="nofollow noreferrer">VisualSVN Server</a> will use your existing SVN repositories with no problems. I have successfully migrated repositories from SVN + Apache to VisualSVN Server on multiple occasions.</p>
| <p>There is a VisualSVN Server Knowledge Base article about the case: </p>
<p><a href="http://www.visualsvn.com/support/topic/00010/" rel="nofollow noreferrer"><strong>How can I import my existing repository into newly installed VisualSVN Server?</strong></a> </p>
<p><img src="https://i.stack.imgur.com/GDcjy.png" wid... | 3,386 |
<p>Is it possible to get a breakdown of CPU utilization <strong>by database</strong>?</p>
<p>I'm ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like <code>taskmgr</code>) or each SPID (like <code>spwho2k5</code>), I want to view the total CP... | <p>Sort of. Check this query out:</p>
<pre><code>SELECT total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical... | <p>Take a look at <a href="http://www.sqlsentry.com/" rel="nofollow noreferrer">SQL Sentry</a>. It does all you need and more.</p>
<p>Regards,
Lieven</p>
| 4,862 |
<p>I need to make chocolate busts.</p>
<p>Is it better to make silicon reverse of the bust and cast the bust or directly print it using chocolate printer (I prefer cost and process speed over quality)? I don't have chocolate printer so if this method will be better I will need to use some 3D printing service.</p>
<p>I ... | <p>For your application, you should 3d print a positive model, then make a silicone mould negative of that model. Then use the silicone mould to make the final chocolate. Clean the silicone thoroughly before initial use. Fill gaps in the 3d printed model with a light epoxy resin. Use mould release and ensure you wash a... | <blockquote>
<p>I prefer ... process speed</p>
</blockquote>
<p>Printing is unlikely to win that battle. You might print a plastic mold once you can use for casts, but if you do make sure you use a liner of some kind. 3d-printed plastics are not considered food-safe.</p>
| 1,720 |
<p>How, in general, does one determine if a PC supports hardware virtualization? I use VirtualPC to set up parallel test environments and I'd enjoy a bit of a speed boost.</p>
| <p>Download this: <a href="http://www.cpuid.com/cpuz.php" rel="noreferrer">http://www.cpuid.com/cpuz.php</a></p>
<p>Also check, <a href="http://en.wikipedia.org/wiki/X86_virtualization" rel="noreferrer">http://en.wikipedia.org/wiki/X86_virtualization</a></p>
<p>Edit: Additional, I know it's for XEN but the instructio... | <p>Try just turning the option on in VirtualPC. If it doesn't do anything (or the option isn't available), then your PC doesn't.</p>
| 4,097 |
<p>There is a rich scripting model for Microsoft Office, but not so with Apple iWork, and specifically the word processor Pages. While there are some AppleScript hooks, it looks like the best approach is to manipulate the underlying XML data.</p>
<p>This turns out to be pretty ugly because (for example) page breaks ar... | <p>In order for two applications (separate processes) to exchange events, they must agree on how these events are communicated. There are many different ways of doing this, and exactly which method to use may depend on architecture and context. The general term for this kind of information exchange between processes is... | <p>What's the nature of that OnEmailSent event from that third party application? I mean, how do you know the application is triggering such an event?</p>
<p>If <em>you</em> are planning on doing interprocess communication, the first question you should ask yourself is: Is it really necessary?</p>
<p>Without question... | 3,848 |
<p>Suppose I want to implement a reasonably efficient 'keyword recognition algorithm', that is first given a list of keyword, and must then answer if another given word was in the list. </p>
<p>In an imperative language, I would store the keywords in a tree (one node per character). Then, when receiving a word to test... | <p>I think what you mean is a character per node... sort of like a simple hash tree scheme for keyword lookup. Assuming this or even another kind of tree... imagine doing something like this (in pseudo-LISP):</p>
<pre><code>(defun buildtree (wordlist) ...code to build tree recursively returns the tree...)
(define loo... | <p>I imagine you'd want something like a tree with a list of children, as described <a href="http://csus.cs.mcgill.ca/wiki/COMP-302_(Panangaden%2C_Pientka%2C_Winter_06)_Lectures#Trees_with_a_list_of_children" rel="nofollow noreferrer">here</a>.</p>
| 6,911 |
<p>I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.)</p>
... | <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6E938A6E-B383-466B-A3EE-5A655BF5DB8C&displaylang=en" rel="nofollow noreferrer">DirectMusicProducer</a> is probably your best free option if you are playing using DirectMusic. I don't believe the MIDI record feature will include control changes, bu... | <p>try looking in the <a href="http://www.midi.org/about-midi/specinfo.shtml" rel="nofollow noreferrer">Midi 1.0 spec</a></p>
<p>Here's a table of the <a href="http://www.midi.org/about-midi/table3.shtml" rel="nofollow noreferrer">control change messages</a> though it looks like you're looking for a way to do this in ... | 5,420 |
<p>I need help with finding what properties or designs I need to look for. I know that I will need these characteristics to work with the material of my choice: </p>
<ul>
<li>Can reach 300 °C or up</li>
<li>Can handle nozzle size larger than 1 mm</li>
<li>Can be used with polycarbonate filament</li>
</ul>
... | <p>By interpreting your question as <em>"Can most hotends print polycarbonate at 300°C+?"</em>, and taking into consideration the answers to <a href="https://3dprinting.stackexchange.com/questions/4209/can-cheap-hotend-parts-sourced-from-china-actually-produce-good-prints">Can cheap hotend parts sourced from... | <p>By interpreting your question as <em>"Can most hotends print polycarbonate at 300°C+?"</em>, and taking into consideration the answers to <a href="https://3dprinting.stackexchange.com/questions/4209/can-cheap-hotend-parts-sourced-from-china-actually-produce-good-prints">Can cheap hotend parts sourced from... | 1,025 |
<p>I have been wanting to learn about 3D printing a long time so I really want this site to succeed but I have no previous experience with the subject. </p>
<p>I was wondering how can I help the site at this early stage. I thought about asking about how to get started with 3D printing but SE explicitly discourages "ea... | <h1>Vote!</h1>
<p>Private Betas love, love, <em>love</em> votes. Without votes, it's difficult to attain privileges, get rewards, and help push us out to public beta.</p>
<h1>Ask Questions!</h1>
<p>I know you said this:</p>
<blockquote>
<p>I thought about asking about how to get started with 3D printing but SE ex... | <p>I would suggest doing a bit of basic research on 3D printing (including reading questions and answers). From these you will learn more about it and hopefull you will have new questions about 3D printing that can be asked. </p>
<p>If you are looking at getting a 3D printer, you could ask about different features l... | 0 |
<p>Task: implement paging of database records suitable for different RDBMS. Method should work for mainstream engines - MSSQL2000+, Oracle, MySql, etc.</p>
<p>Please don't post RDBMS specific solutions, I know how to implement this for most of the modern database engines. I'm looking for the universal solution. Only t... | <p>There would have been a universal solution if SQL specifications had included paging as a standard. The requirement for any RDBMS language to be called an RDBMS language does not include paging support as well. </p>
<p>Many database products support SQL with proprietary extensions to the standard language. Some of ... | <p>SubSonic can do this for you if you if you can tolerate Open Source...
<a href="http://subsonicproject.com/querying/webcast-using-paging/" rel="nofollow noreferrer">http://subsonicproject.com/querying/webcast-using-paging/</a></p>
<p>Other than that I know NHib does as well</p>
| 8,705 |
<p>I recently broke the cooling fan on my Voxelab Aquila while doing some maintenance, and I'm in the middle of a multi piece print that I would like to finish soon. I found the fan replacement I need, but it's not going to arrive for over a week. I was wondering if it would be ok to print a few things with the broken ... | <p>As long as your ambient temperature is not excessive and you're not using a very high bed temperature, you should be fine.</p>
<p>With insufficient cooling, there is a risk of heat creep - that is, of the heat from the melt zone working its way up to the area where the filament is supposed to be solid, potentially c... | <p>If the fan is the part cooling fan, you'll have reduced cooling on the part as it is printed. This isn't necessarily going to be a problem, although you may have irregularities in the print surface.</p>
<p>If the fan is the heat sink cooling fan, reduced cooling will be problematic. This could result in heat creep a... | 2,142 |
<p>Ruby setters—whether created by <code>(c)attr_accessor</code> or manually—seem to be the only methods that need <code>self.</code> qualification when accessed within the class itself. This seems to put Ruby alone the world of languages:</p>
<ul>
<li>All methods need <code>self</code>/<code>this</code> (like Perl, ... | <p>Well, I think the reason this is the case is because <code>qwerty = 4</code> is ambiguous—are you defining a new variable called <code>qwerty</code> or calling the setter? Ruby resolves this ambiguity by saying it will create a new variable, thus the <code>self.</code> is required.</p>
<p>Here is another case wher... | <p>Because otherwise it would be impossible to set local variables at all inside of methods. <code>variable = some_value</code> is ambiguous. For example:</p>
<pre><code>class ExampleClass
attr_reader :last_set
def method_missing(name, *args)
if name.to_s =~ /=$/
@last_set = args.first
else
sup... | 6,646 |
<p>I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C?</p>
| <p><a href="http://xmlsoft.org/" rel="nofollow noreferrer">libxml</a> is a heavily used and documented XML library for C, which provides a SAX API. <a href="http://expat.sourceforge.net/" rel="nofollow noreferrer">Expat</a> is another, but in my experience is not as well documented.</p>
| <p>Expat does StAX</p>
<p><pre><code>
#include "expat.h"`
VRM_parser = XML_ParserCreate("ISO-8859-1");
XML_SetElementHandler(VRM_parser, CbStartTagHandler, CbEndTagHandler);
XML_Parse(VRM_parser, text, strlen(text), 0); // start of XML
XML_Parse(VRM_parser, text, strlen(text), 0); // more XML
XML_Parse(VRM_parser, te... | 5,812 |
<p>There is a lot of information out there on object-relational mappers and how to best avoid impedance mismatch, all of which seem to be moot points if one were to use an object database. My question is why isn't this used more frequently? Is it because of performance reasons or because object databases cause your d... | <ul>
<li><strong>Familiarity.</strong> The administrators of databases know relational concepts; object ones, not so much.</li>
<li><strong>Performance.</strong> Relational databases have been proven to scale far better.</li>
<li><strong>Maturity.</strong> SQL is a powerful, long-developed language.</li>
<li><strong>Ve... | <p>Sören</p>
<p>All of the reasons you stated are valid, but I see the problem with OODBMS is the logical data model. The object-model (or rather the network model of the 70s) is not as simple as the relational one, and is therefore inferior.</p>
| 8,676 |
<p>I'm trying to parse a grammar in ocamlyacc (pretty much the same as regular yacc) which supports function application with no operators (like in Ocaml or Haskell), and the normal assortment of binary and unary operators. I'm getting a reduce/reduce conflict with the '-' operator, which can be used both for subtracti... | <p>Unfortunately, the only answer I can come up with means increasing the complexity of the grammar.</p>
<ol>
<li>split <code>expr</code> into <code>simple_expr</code> and <code>expr_with_prefix</code></li>
<li>allow only <code>simple_expr</code> or <code>(expr_with_prefix)</code> in an APPLY</li>
</ol>
<p>The first ... | <p>Well, this simplest answer is to just ignore it and let the default reduce/reduce resolution handle it -- reduce the rule that appears first in the grammar. In this case, that means reducing <code>expr MINUS expr</code> in preference to <code>MINUS expr</code>, which is exactly what you want. After seeing <code>a-... | 4,413 |
<p>I'm comparing it Java where you can start your application server in debug mode, then attach your IDE to the server. And you can change your code "on the fly" without restarting the server. As long as your changes don't affect any method signatures or fields you can just hit recompile for a class and the application... | <p>From <a href="http://blog.mattsmith.co.nz/Lists/Posts/Post.aspx?ID=45" rel="noreferrer">Matt Smiths</a> blog on how to get F5 debugging with sharepoint. A very cool trick.</p>
<ol>
<li>Create a web application project in Visual Studio (File -> New -> Project -> ASP.Net Web Application, not File -> New -> Web Site).... | <blockquote>
<p>And you can change your code "on the fly" without restarting the server</p>
</blockquote>
<p>You can accomplish this with ASP.net if you make a Web Site project (as opposed to a Web Application Project). Using a Web Site project, you can post changes to code-behinds without having to refresh anything... | 5,187 |
<p>I have a K280 3D printer with a MKS V1.5 and Repetier firmware.</p>
<p><a href="https://i.stack.imgur.com/yCoXM.jpg" rel="nofollow noreferrer" title="Damaged transistor associated with E0 (3rd one on the right)"><img src="https://i.stack.imgur.com/yCoXM.jpg" alt="Damaged transistor associated with E0 (3rd one on th... | <p>If you go through the <a href="https://www.repetier.com/firmware/v100/index.php" rel="nofollow noreferrer">Repetier-Firmware configuration tool for version 1.0.2</a> you can select the E1 stepper for the E0 extruder (or whatever stepper you want to use for it) in the tools tab sheet. I'm not familiar with Repetier, ... | <p>You can try editing the gcodes by searching and replacing E0 for E1, so this way the extruder E1 will be enabled.</p>
<p>Other way is setting the Slicer to use 2 extruders but everything for printing on E1 like: Perimeter, Infill, Solid, Support/raft/skirt, Support / raft interface.</p>
<p>The third one, Switch th... | 771 |
<p>If I start a process via Java's <a href="http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html" rel="noreferrer">ProcessBuilder</a> class, I have full access to that process's standard in, standard out, and standard error streams as Java <code>InputStreams</code> and <code>OutputStreams</code>. However... | <p>You will need to copy the <a href="http://java.sun.com/javase/6/docs/api/java/lang/Process.html" rel="noreferrer">Process</a> out, err, and input streams to the System versions. The easiest way to do that is using the <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/IOUtils.html" rel="norefer... | <p>For <code>System.in</code> use the following <code>pipein()</code> instead of <code>pipe()</code></p>
<pre><code>pipein(System.in, p.getOutputStream());
</code></pre>
<p>Implementation:</p>
<pre><code>private static void pipein(final InputStream src, final OutputStream dest) {
new Thread(new Runnable() {
... | 8,518 |
<p>I have a basic Creality Ender-3 with a black rough bed cover. I'm printing with PLA.</p>
<p>After assembly, I printed 3 or 4 small toys sliced by Cura with basic settings. All were printed very well!</p>
<p>However, after that, extruded filament would not stick to the bed. I tried the following:</p>
<ul>
<li>Bed ... | <p>I think you may have used the wrong substance to clean your bed. Try using Isopropyl Alcohol (IPA). You may have left some residue behind from the soap, which is now interfering with adhesion. When that is done, ensure you've gone through the steps for bed leveling again. It's amazing how much of a difference proper... | <p>Set the bed temperature to the glass transition temperature, around 80 °C for PLA:</p>
<ul>
<li><p>Filament is slippery and non-adhesive at room temperature</p>
</li>
<li><p>Filament becomes sticky when near its melting temperature</p>
</li>
<li><p>Printed items can pop off of the bed by themselves when cool. This ... | 1,502 |
<p>I have a strange issue with my heated bed. It has been working well for a long time, but recently it has developed an issue where the temperature reported by the thermistor will occasionally jump by around 10 degrees.</p>
<p><a href="https://i.stack.imgur.com/aMRF7.png" rel="noreferrer"><img src="https://i.stack.im... | <p>It really looks like either a bad thermistor or bad electrical joints. Are the connections to the thermistor itself crimped, or soldered? Are there connectors near the thermistor that can get heated up by the bed?</p>
<p>Electrical connections that are mechanical in nature (such as crimped, or using a connector) ca... | <p>It really looks like either a bad thermistor or bad electrical joints. Are the connections to the thermistor itself crimped, or soldered? Are there connectors near the thermistor that can get heated up by the bed?</p>
<p>Electrical connections that are mechanical in nature (such as crimped, or using a connector) ca... | 138 |
<p>I would like to filter an array of items by using the <code>map()</code> function. Here is a code snippet:</p>
<pre><code>var filteredItems = items.map(function(item)
{
if( ...some condition... )
{
return item;
}
});
</code></pre>
<p>The problem is that filtered out items still uses space in th... | <p>You should use the <code>filter</code> method rather than map unless you want to mutate the items in the array, in addition to filtering.</p>
<p>eg.</p>
<pre><code>var filteredItems = items.filter(function(item)
{
return ...some condition...;
});
</code></pre>
<p>[Edit: Of course you could always do <code>sou... | <p>following statement cleans object using map function.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var arraytoclean = [{v:65, toberemoved:"gronf"}, {v:12, toberemoved:n... | 3,070 |
<p>I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers. </p>
<p>I have been looking online trying to find real differences between the two and have asked on crackoverflow. ... | <p>I've had to interview people for a few C# positions and this is my general advice for VB.Net developers interviewing for a C# position:</p>
<ul>
<li>Make sure you are clear that you have been working VB.Net. This seems obvious but is something that apparently isn't (in my experience).</li>
<li>Try to give a code s... | <p>VB or C# both are syntax only diffrent but if you are applying way of logic is same.</p>
| 3,557 |
<p>I use <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html" rel="nofollow noreferrer">dnsmasq</a> to resolve DNS queries on my home network. Unfortunately, if a domain name is not known, it will append my own domain name to the request which means that I always end up viewing my own site in a browser.</p>
<p>For ... | <p>try querying with a trailing dot to explicitly set the root:</p>
<pre><code>host dlksfhoiahdsfiuhsdf.com.
</code></pre>
| <p>I tried removing <em>domain-needed</em> from my own configuration to replicate your issue and it did not produce this behaviour. It's the only other parameter I could find that might be close to relevant.</p>
<p>What does your hosts file look like? Maybe something weird is going on there that makes it think all we... | 2,773 |
<p>We all know how to use <code><ctrl>-R</code> to reverse search through history, but did you know you can use <code><ctrl>-S</code> to forward search if you set <code>stty stop ""</code>? Also, have you ever tried running bind -p to see all of your keyboard shortcuts listed? There are over 455 on Mac OS... | <pre><code>cd -
</code></pre>
<p>It's the command-line equivalent of the back button (takes you to the previous directory you were in).</p>
| <p>Some useful mencoder commands I found out about when looking for some audio and video editing tools:</p>
<p>from .xxx to .avi</p>
<pre><code>mencoder movie.wmv -o movie.avi -ovc lavc -oac lavc
</code></pre>
<p>Dump sound from a video:</p>
<pre><code>mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile fileou... | 9,388 |
<p>Of all the forms of CAPTCHA available, which one is the "least crackable" while remaining fairly human readable?</p>
| <p>I agree with Thomas. Captcha is on its way out. But if you must use it, <a href="http://www.recaptcha.net" rel="noreferrer">reCAPTCHA</a> is a pretty good provider with a simple API.</p>
| <p>As far as I know, the Google's one is the best that there is. It hasn't been broken by computer programs yet. What I know that the crackers have been doing is to copy the image and then send it to many phishing websites where humans solve them to enter those websites.</p>
| 8,421 |
<p>I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.</p>
<p>Here's an example of the equations:</p>
<pre><code>-44.3940 = a * 50.0 + b * 37.0 + tx
-45.3049 = a * 43.0 + b * 39.0 + tx
-44.9594 = a * 52.0 + b * 41.0 + tx
</code></pre>
<p>From this, I'd like to get the... | <p><a href="http://en.wikipedia.org/wiki/Cramers_rule" rel="noreferrer">Cramer's Rule</a>
and
<a href="http://en.wikipedia.org/wiki/Gaussian_elimination" rel="noreferrer">Gaussian Elimination</a>
are two good, general-purpose algorithms (also see <a href="http://en.wikipedia.org/wiki/Simultaneous_linear_equations" rel=... | <p>For general cases, you could use python along with numpy for Gaussian elimination. And then plug in values and get the remaining values.</p>
| 2,320 |
<p>I'm looking for clamps to fix the glass on my heatbed. After some search I found that some people use clamps printed of PLA. Can I use PLA clamps for a heated heatbed (~60 °C)? </p>
<p>I also tried foldback clips but they block my nozzle. The Anet A8 starts in the front left corner. When I start to print, the ... | <p>How about the Ultimaker clips? Ultimaker uses 2 mm heat bed and 4 mm glass, that should be within reach by bending the clips a bit. They have quite a low profile/footprint.</p>
<p><a href="https://i.stack.imgur.com/kdjTts.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kdjTts.jpg" alt="... | <p>Let's analyze the problem:</p>
<ul>
<li>We have a 5.5 mm total thickness.</li>
<li>We want to (semi)permanently affix the two layers together mechanically.</li>
<li>The clips shall not be higher than about 0.2 mm to allow the nozzle to pass over them.</li>
</ul>
<h1>(non)Solution attempt zero:</h1>
<p>Let's look at ... | 1,038 |
<p>I'm just curious how most people make their ASP.NET pages printer-friendly? Do you create a separate printer-friendly version of the ASPX page, use CSS or something else? How do you handle situations like page breaks and wide tables?</p>
<p>Is there one elegant solution that works for the majority of the cases? </p... | <p>You basically make another CSS file that hide things or gives simpler "printer-friendly" style to things then add that with a <code>media="print"</code> so that it only applies to print media (when it is printed)</p>
<pre><code><link rel="stylesheet" type="text/css" media="print" href="print.css" />
</code></... | <p>I am a php user, but the point must be that the result no matter what is HTML and HTML is styled with CSS and there is an option for your style sheets for just using the style for printing. This should be the way to do it, imho. About big tables, there isnt really a magic "fix" for that. Page will break where it b... | 6,891 |
<p>When using host headers to host multiple websites on the same IP address in IIS, is there any way of accessing that website from a browser running on the local machine?</p>
<p>This is normally required when a given web component only allows configuration from the local machine. It's also useful when things like ASP... | <p>Just an idea: Mapping the hostname to 127.0.0.1 in the hosts ($WINDOWS$\system32\drivers\etc) file may help. This way you should be able to pull up the local IIS site by typing the hostname as if it's a remote server</p>
| <p>Maybe I am not understanding the question, but what's wrong with just typing in the URL for the website? If it's the matter of domain name resolution, you can point to the right DNS or put it in <a href="http://en.wikipedia.org/wiki/Hosts_file" rel="nofollow noreferrer">hosts</a> file.</p>
| 5,733 |
<p>I'm looking for a method, or a code snippet for converting std::string to LPCWSTR</p>
| <p>The solution is actually a lot easier than any of the other suggestions:</p>
<pre><code>std::wstring stemp = std::wstring(s.begin(), s.end());
LPCWSTR sw = stemp.c_str();
</code></pre>
<p>Best of all, it's platform independent.</p>
| <p>It's so easy, no need to apply any custom method. Try with this:</p>
<pre><code>string s = "So Easy Bro"
LPCWSTR wide_string;
wide_string = CA2T(s.c_str());
</code></pre>
<p>I think, it will works.</p>
| 4,684 |
<p>Lets say that you have websites www.xyz.com and www.abc.com.</p>
<p>Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. </p>
<p>Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.... | <p>Try using FormAuthentication by setting the web.config authentication section like so:</p>
<pre><code><authentication mode="Forms">
<forms name=".ASPXAUTH" requireSSL="true"
protection="All"
enableCrossAppRedirects="true" />
</authentication>
</code></pre>
<p>Generate a machine ke... | <p>Alternatively if you want to roll your own and the sites in question are not on the same servers or don't have access to a shared database (in which case see the above responses) then you could place a <a href="http://en.wikipedia.org/wiki/Web_beacon" rel="nofollow noreferrer">web beacon</a> on each of the sites whi... | 9,772 |
<p>I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net website to allow users to upload files. For those unfamiliar, the uploader works by using a Flash applet to give me more control over the FileOpen dialog. I can specify a filter for file types, allow multiple files to be selected, etc. It's g... | <p><a href="http://swfupload.org/forum/generaldiscussion/98" rel="noreferrer">Here</a> is a post from the maintainer of <a href="http://swfupload.org" rel="noreferrer">SWFUpload</a> which explains how to load the session from an ID stored in Request.Form. I imagine the same thing would work for the Yahoo component.</p>... | <p>The ASP.Net Session ID is stored in <code>Session.SessionID</code> so you could set that in a hidden field and then post it to the next page.</p>
<p>I think, however, that if the application restarts, the sessionID will expire if you do not <a href="http://support.microsoft.com/kb/317604" rel="nofollow noreferrer">... | 6,495 |
<p>I have a bunch of files that I need to be able to <em>transport</em> and <em>install</em> quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome.</p>
<p>My idea for a solution would be to write up... | <p>Sounds like <code>robocopy</code> tool is exactly what you need.
Very <em>powerful</em> replication command-line tool.</p>
<ul>
<li><a href="http://technet.microsoft.com/en-us/library/cc733145" rel="nofollow noreferrer">MS TechNet reference</a>,</li>
<li><a href="http://en.wikipedia.org/wiki/Robocopy" rel="nofollow... | <p>I like to use VBscript for this kind of thing. The VBS engine is on every recent windows machine and the language is a little more like real programming than a batch script.</p>
<p>Also, if your installer grows to require WMI functions too, this becomes a piece of cake.</p>
| 3,709 |
<p>We're doing an "Amazing Race" kind of event, and thought it would be cool to have CDs that could only play once... like a "this message will self destruct in 5 seconds..." </p>
<p>Any thoughts on how to do this? I was thinking it could be a compiled HTML website that would write a cookie and only play once. I don... | <p>If the content is HTML and run inside a normal browser window, then a cookie may work but there are caveats:</p>
<ul>
<li>User runs the CD once when IE is the default browser. User runs at a later time, when Firefox is the default browser so cookie cannot be checked.</li>
<li>The browser's security settings may be ... | <p>Not quite what you're looking for, but you could put in on re-writable media and have an executable over-write itself (or part of itself).</p>
<p>I don't know if a CD-RW could do that automatically, or if you would have to look at cheap USB sticks.</p>
| 6,366 |
<p>I've opened an old workspace that is a libray and its test harness. It used to work fine but now doesn't and older versions of the code don't work either with the same errors. I've tried recreating the project and that causes the same errors too. Nothing seems out of order in project settings and the code generated ... | <p>One possibility lies with Win32 ANSI/Unicode "name-mangling", which turns the symbol <code>GetMessage</code> into either <code>GetMessageA</code> or <code>GetMessageW</code>. There are three possibilities:</p>
<ol>
<li><p>Windows.h hasn't been loaded, so <code>GetMessage</code> stays <code>GetMessage</code></p></li... | <p>windows.h is declared at the top of IOCompletionPort.h as an include - I was sick of seeing 7 lines just to include 1 file so I have wrapped it its own file and includes that itself. This also contains some additional #defines (i.e. ULONG_PTR) as our main app won't compile with the Platform SDK installed:-(</p>
<ol>... | 2,775 |
<p>Sending a message from the Unix command line using <code>mail TO_ADDR</code> results in an email from <code>$USER@$HOSTNAME</code>. Is there a way to change the "From:" address inserted by <code>mail</code>?</p>
<p>For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedor... | <p>In my version of mail ( Debian linux 4.0 ) the following options work for controlling the source / reply addresses</p>
<ul>
<li>the <strong>-a</strong> switch, for additional headers to apply, supplying a From: header on the command line that will be appended to the outgoing mail header</li>
<li>the <strong>$REPLYT... | <p>The answers provided before didn't work for me on CentOS5. I installed mutt. It has a lot of options. With mutt you do this this way:</p>
<pre><code>export EMAIL=myfrom@example.com
export REPLYTO=myreplyto@example.com
mutt -s Testing chris@example.org
</code></pre>
| 7,832 |
<p>Any suggestions for tools to monitor page load times/errors and other performance metrics for a PHP application?</p>
<p>I am aware of the FireBug and YSlow tools, but this is for more server monitoring.</p>
| <p>There is the classic 'ab' (apachebench) program. More power comes from <a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMmeter</a>. For server health, I recommend Munin, which can painlessly capture data from several systems and aggregate it on one page. </p>
| <p>Try <a href="http://www.nagios.org/" rel="nofollow noreferrer">Nagios</a>, it's the default tool to monitor servers. You can write plugins to report just about any data. </p>
| 9,485 |
<p>I bought a 32 GB SDHC (Sandisk) I'd like to use for my Monoprice 3D printer.<br>
I have downloaded Partition Wizard and partitioned a 2GB primary partition formatted as FAT and it still does not show any files. </p>
<p>What am I doing wrong?</p>
| <p>For an SD card to work with the printer firmware <a href="https://monopricesupport.kayako.com/article/59-why-is-my-printer-not-reading-my-sd-card" rel="noreferrer">Monoprice suggests to format the SD card to FAT32</a>.</p>
<p>However, the Monoprice Select Mini V2 is not able to read SDHC memory cards, it is advised... | <p>I was having problems formatting micro SD cards for my Monoprice Mini v2. I have some 256 MB cards tried formatting them FAT FAT32 etc, no luck.</p>
<p>Then I downloaded a program called <a href="https://www.sdcard.org/downloads/formatter/" rel="nofollow noreferrer">SD Memory Card Formatter</a> did the format on th... | 1,160 |
<p>This morning, I was reading <a href="http://steve.yegge.googlepages.com/when-polymorphism-fails" rel="noreferrer">Steve Yegge's: When Polymorphism Fails</a>, when I came across a question that a co-worker of his used to ask potential employees when they came for their interview at Amazon.</p>
<blockquote>
<p>As a... | <p><strong>Polymorphic Tree Walking</strong>, Python version</p>
<pre><code>#!/usr/bin/python
class Node:
"""base class, you should not process one of these"""
def process(self):
raise('you should not be processing a node')
class BinaryNode(Node):
"""base class for binary nodes"""
def __init_... | <p>should use a functional language imo. Trees are harder to represent and manipulate in OO languages.</p>
| 3,354 |
<p>Right, initially ran:</p>
<pre><code>c:\regsvr32 Amazing.dll
</code></pre>
<p>then, (accidentally - I might add) I must have run it again, and (indeed) again when new versions of 'Amazing.dll' were released. Yes - I know <em>now</em> I should've run:</p>
<pre><code>c:\regsvr32 /u Amazing.dll
</code></pre>
<p>bef... | <p>Your object's GUID's should not be changing. In other words, once you register the COM object, re-registering shouldn't be adding anything additional to the registry.</p>
<p>Unless you added additional COM interfaces or objects to the project.</p>
<p>In any case, if this is a one time deal (and it sounds like it i... | <p>I've got myself into a horrible mess with COM before. I had to pick my way though the registry deleting each reference, unfortunately.</p>
| 4,010 |
<p>I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do... | <p>I figured out a better way of doing this, using the CellFormatting event:</p>
<pre><code>Private Sub uxContacts_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles uxContacts.CellFormatting
If uxContacts.CurrentCell IsNot Nothing Then
If e.... | <p>You want to use the DataGridView RowPostPaint method. Let the framework draw the row, and afterwards go back and color in the cell you're interested in.</p>
<p>An example is here at <a href="http://msdn.microsoft.com/en-us/library/85kxk29c.aspx" rel="nofollow noreferrer">MSDN</a></p>
| 9,913 |
<p>I have found a video about Invisalign. I saw a 3D printer in the video but I did not understand its type. Can you help me? Do you share a brief piece of information about its type?</p>
<p>Below is the video on YouTube.</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src=... | <p>In the video, there is this still from <a href="https://youtu.be/bKsGNrEKx9M?t=32" rel="nofollow noreferrer">0:32</a>:</p>
<p><a href="https://youtu.be/bKsGNrEKx9M?t=32" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jf2F8.png" alt="enter image description here" /></a></p>
<p>The labeling is iPro 8000... | <p>If you look at the video at 37 seconds, it appears to be SLA or DLP.</p>
<p>Further reading: <a href="https://www.solidprint3d.co.uk/wp-content/uploads/2019/04/SLA_vs_DLP.pdf" rel="nofollow noreferrer">https://www.solidprint3d.co.uk/wp-content/uploads/2019/04/SLA_vs_DLP.pdf</a></p>
| 1,876 |
<p>Basically I want to get the number of lines-of-code in the repository after each commit.</p>
<p>The only (really crappy) ways I have found is to use <code>git filter-branch</code> to run <code>wc -l *</code>, and a script that runs <code>git reset --hard</code> on each commit, then runs <code>wc -l</code></p>
<p>T... | <p>You might also consider <a href="http://gitstats.sourceforge.net/" rel="noreferrer">gitstats</a>, which generates this graph as an html file. </p>
| <p>The first thing that jumps to mind is the possibility of your git history having a nonlinear history. You might have difficulty determining a sensible sequence of commits.</p>
<p>Having said that, it seems like you could keep a log of commit ids and the corresponding lines of code in that commit. In a post-commit h... | 4,370 |
<p>Code below does not run correctly and throws <code>InvalidOperationExcepiton</code>.</p>
<pre><code>public void Foo()
{
DataContext context = new DataContext();
LinqEntity item = new LinqEntity(){ Id = 1, Name = "John", Surname = "Doe"} ;
context.LinqEntities.Attach(item, true);
}
</code></pre>
| <p>By default, the entities will use all fields for checking concurrency when making edits. That's what's throwing the InvalidOperationException.</p>
<p>This can be setting the Update Check property for all fields to Never. This must be done on all fields to attach the entity as modified. If this is done, an additi... | <p>When using an ORM you typically select an object before updating it. </p>
<p>You can use <code>DataContext.ExecuteCommand(...)</code> to bypass the ORM if you do not want to do a select. </p>
| 6,126 |
<p>I have a regex call that I need help with.</p>
<p>I haven't posted my regex, because it is not relevant here.
What I want to be able to do is, during the Replace, I also want to modify the ${test} portion by doing a Html.Encode on the entire text that is effecting the regex.</p>
<p>Basically, wrap the entire text ... | <p>Heres an implementation of this I've used to pick out special replace strings from content and localize them.</p>
<pre><code> protected string FindAndTranslateIn(string content)
{
return Regex.Replace(content, @"\{\^(.+?);(.+?)?}", new MatchEvaluator(TranslateHandler), RegexOptions.Ignore... | <p>If you do a Regex.Match, the resulting match objects group at the 0th index, is the subset of the intput that matched the regex.</p>
<p>you can use this to stitch in the bold tags and encode it there.</p>
| 6,892 |
<p>Has anyone found a good compression format for MS Sqlserver databases? If so, what do you use and are you pleased with how it performs? </p>
<p>My company frequently will compress a database snapshot from one of our clients and download it so we have a local copy for testing and dev purposes. We tried zip in the pa... | <p>In sql 2008 you have native compression, if you have to do this a lot and don't have SQL server 2008 then take a look at something like <a href="http://www.quest.com/litespeed-for-sql-server/" rel="nofollow noreferrer">Quest LiteSpeed</a> which compreeses the backup automatically</p>
| <p>In the no-cost category, newer versions of <a href="http://www.gzip.org/#faq10" rel="nofollow noreferrer">gzip</a> and <a href="http://www.bzip.org/" rel="nofollow noreferrer">bzip2</a> are supposed to include large file support (someone on the internet tells me that bzip2 1.0.1 and beyond is large file compatible t... | 4,334 |
<p>We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have that. I'm wondering if anyone has... | <p>My <a href="http://petemontgomery.wordpress.com/2008/08/07/caching-the-results-of-linq-queries/" rel="noreferrer">LINQ query result cache</a> is probably just what you're looking for.</p>
<pre><code>var q = from c in context.Customers
where c.City == "London"
select new { c.Name, c.Phone };
var res... | <p>See the 'GetReferenceData' method in the 'ReferenceData' class in <a href="http://blog.huagati.com/res/index.php/2008/06/23/application-architecture-part-2-data-access-layer-dynamic-linq/" rel="nofollow noreferrer">this article</a>:
<a href="http://blog.huagati.com/res/index.php/2008/06/23/application-architecture-p... | 5,802 |
<p>I recently upgraded to Subversion 1.5, and now I cannot commit my code to the repository. I get an error message: "403 Forbidden in response to MKACTIVITY". I know the upgrade worked because my fellow developers are not getting this issue. What's going on?</p>
| <p>Answering my own question:</p>
<p>Apparently my SVN URL had the wrong case! A Google search turned up an article (no longer available online) that explained what was going on. My URL was of the form <a href="http://svn.foobar.com/foobar" rel="noreferrer">http://svn.foobar.com/foobar</a> but the actual repository wa... | <p>I think the thing here is that Subversion (regardless of OS platform its server is installed on) <strong>is</strong> case sensitive.</p>
<p>However, clients' OS maybe not. And that might create a problem. </p>
<p>In my company I have had this case and it took me about an hour to figure it out. So, one developer, w... | 8,132 |
<p>I need to determine when my Qt 4.4.1 application receives focus.</p>
<p>I have come up with 2 possible solutions, but they both don’t work exactly as I would like.</p>
<p>In the first possible solution, I connect the focusChanged() signal from qApp to a SLOT. In the slot I check the ‘old’ pointer. If it ‘0’, the... | <p>I think you need to track the <a href="http://doc.qt.io/qt-4.8/qevent.html#Type-enum" rel="nofollow noreferrer">QEvent::ApplicationActivate</a> event.</p>
<p>You can put an <a href="http://doc.qt.io/qt-4.8/qobject.html#eventFilter" rel="nofollow noreferrer">event filter</a> on your QApplication instance and then lo... | <p>Looking at the Qt docs it seems that focus events are created each time a widget gets the focus, so the sample code you posted won't work for the reasons you stated. </p>
<p>I am guessing that QApplication::focusedChanged does not work the way you want because some widgets don't accept keyboard events so also retur... | 8,813 |
<p>I have a cron job on an Ubuntu Hardy VPS that only half works and I can't work out why. The job is a Ruby script that uses mysqldump to back up a MySQL database used by a Rails application, which is then gzipped and uploaded to a remote server using SFTP.</p>
<p>The gzip file is created and copied successfully but ... | <p>Are you sure the temporary file is being created correctly when running as a cron job? The working directory for your script will either be specified in the HOME environment variable, or the /etc/passwd entry for the user that installed the cron job. If deploy does not have write permissions for the directory in whi... | <p>Is cron sending emails with logs?</p>
<p>If not, pipe the output of cron to a log file.</p>
<p>Make sure to redirect STDERR to the log.</p>
| 3,419 |
<p>I have a small diagnostic VB.Net application ( 2 forms, 20 subs & functions) written using VB.Net 2008 that targets Framework 2.0 and higher, but now I realize I need to support Framework 1.1. I'm looking for the most efficient way to accomplish this given these constraints:</p>
<ul>
<li>I don't know which pa... | <p>Your app sounds small enough that I would create a fresh project/solution in a separate folder for the 1.1 framework, copy over the necessary files, use the "Add Existing Item" option, and then build. All the problems will bubble up to the surface that way.</p>
<p>A rather "ugly" approach, but it'll show you everyt... | <p>Probably not. If you don't understand which bits are 2.0-specific, you're probably going to have to go the trial-and-error route. However, you can probably save yourself quite a bit of work if you go looking for generics beforehand. In my experience, those are the most numerous 1.1-incompatible bits that tend to mak... | 8,956 |
<p>I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?</p>
| <p>In order to truncate a string to a UTF8 byte array without splitting in the middle of a character I use this:</p>
<pre><code>static string Truncate(string s, int maxLength) {
if (Encoding.UTF8.GetByteCount(s) <= maxLength)
return s;
var cs = s.ToCharArray();
int length = 0;
int i = 0;
... | <p>Efficient way would be finding how much (pessimistically) bytes you will need per character with</p>
<pre><code>Encoding.GetMaxByteCount(1);
</code></pre>
<p>then dividing your string size by the result, then converting that much characters with</p>
<pre><code>public virtual int Encoding.GetBytes (
string s,
in... | 5,461 |
<p>Are there any open source algorithms in c# that solve the problem of creating a difference between two text files?</p>
<p>It would be super cool if it had some way of highlighting what exact areas where changed in the text document also.</p>
| <p>There is <a href="http://www.menees.com/Diff.Net.htm" rel="nofollow noreferrer">Menees Diff</a> which will provide you with a C# diff implementation. The source code is included. I've used it in the past with good success wrapping it in my own implemenation.</p>
| <p>Check out <a href="http://en.wikipedia.org/wiki/Diff" rel="noreferrer">diff</a>. Here it is <a href="http://www.gnu.org/software/diffutils/diffutils.html" rel="noreferrer">in the gnu project</a> (open source, of course), and many more links to implementations are found in the wikipedia article. A comparison of diffe... | 9,096 |
<p>I am writing a coding standards document for a team of about 15 developers with a project load of between 10 and 15 projects a year. Amongst other sections (which I may post here as I get to them) I am writing a section on code formatting. So to start with, I think it is wise that, for whatever reason, we establish ... | <p>First find a automated code-formatter that works with your language. Reason: Whatever the document says, people will inevitably break the rules. It's much easier to run code through a formatter than to nit-pick in a code review.</p>
<p>If you're using a language with an existing standard (e.g. Java, C#), it's eas... | <p>It obviously varies depending on languages and technologies. By the look of your example name space I am going to guess java, in which case <a href="http://java.sun.com/docs/codeconv/" rel="nofollow noreferrer">http://java.sun.com/docs/codeconv/</a> is a really good place to start. You might also want to look at s... | 6,991 |
<p>I'm doing a authorization check from a WinForms application with the help of the AzMan authorization provider from Enterprise Library and am receiving the the following error:</p>
<blockquote>
<p>Unable to update the password. The value provided as the current password is incorrect. (Exception from HRESULT: 0x800... | <p>You can use this:</p>
<pre><code>super if defined?(super)
</code></pre>
<p>Here is an example:</p>
<pre><code>class A
end
class B < A
def t
super if defined?(super)
puts "Hi from B"
end
end
B.new.t
</code></pre>
| <p>Rather than checking if the super method exists, you can just define it</p>
<pre><code>class ActiveRecord::Base
def after_initialize
end
end
</code></pre>
<p>This works in my testing, and shouldn't break any of your existing code, because all your other classes which define it will just be silently overrid... | 3,197 |
<p>This site may attract questions such as</p>
<ul>
<li><p>Is it legal to sell 3D printed objects from a model repository?</p></li>
<li><p>Are 3D printed guns legal in my jurisdiction?</p></li>
<li><p>If my custom-built printer sets my house on fire, does the insurance cover it?</p></li>
</ul>
<p>Are such questions a... | <p><strong>Yes - in some cases.</strong></p>
<p>First, overlap between sites is fine. <em>It doesn't matter if a question is on topic somewhere else</em>; that's no reason to eliminate it from a different site's scope. There were some issues when HSM sprang up, because Mathematics, Physics, and other sites allowed his... | <p>No, such questions should not be allowed. This site deals only with the practical issues of 3D printing. Questions about legal issues should be redirected to sites dealing specifically with those, since users of this site do not have the expertise to address legal issues. A 3D printing expert does not make a legal e... | 10 |
<p>All the articles I've found via google are either obsolete or contradict one another.</p>
<p>What's the easiest way to print a form or, say, a richtextbox in c#? I think it's using the <code>PrintDiaglog</code> class by setting the <code>Document</code>, but how does this get converted?</p>
| <p>At least in VS 2008, its very easy. It took me about a couple of minutes to code the answer after reading your question. Here's where I borrowed it from:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/6he9hz8c.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/6he9hz8c.aspx</a></p>
<p>I tested... | <p>Someone I know created a component that extends controls with a lot of properties that give you a lot of control over how the form prints. It's worth a look.</p>
<p><a href="http://www.xtremevbtalk.com/showthread.php?t=279707" rel="nofollow noreferrer">MCL PrintForm Helper Component</a></p>
| 2,726 |
<p>I've done calibration test with "Concentric circle test" (<a href="https://www.thingiverse.com/thing:11895" rel="nofollow noreferrer">https://www.thingiverse.com/thing:11895</a>) and at specific points there are little bumped points on the print. Also Thingiverse page of the test mentions about these.</p>
<p>How ca... | <p>The 5V is derived from the 12V supply by a linear regulator (L7805CD, DPAK package with 100 C/W thermal resistance). The maximum you can draw from it (without overheating the regulator) is around 200mA. Considering the electronics on the board are already using some power, the maximum would be around a 150mA fan but... | <p>5 V and 3.3 V are both <a href="https://learn.sparkfun.com/tutorials/logic-levels/33-v-cmos-logic-levels" rel="nofollow noreferrer">logic "highs"</a> in computing and measured against GND. If the fan simply has to know the on stance and nothing more, then you could run a fan with the logic 5 V (and probably 3.3 V fo... | 1,380 |
<p>I am trying to retrieve a user on Sharepoint's user photo through the WSS 3.0 object model. I have been browsing the web for solutions, but so far I've been unable to find a way to do it. Is it possible, and if so how?</p>
| <p>Here is a code snippet that should help get the job done for you. You may need to do some additional validation to avoid any exceptions (ensuring the profile actually exists, ensuring the image URL actually exists, etc...):</p>
<pre><code> //get current profile manager
UserProfileManager objUserProfileManag... | <p>Ah, You have to use the UserProfileManager class.
More information here: <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.userprofilemanager.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.userprofilemanager.aspx</a></p... | 8,649 |
<p>Have you ever seen any of there error messages?</p>
<blockquote>
<p>-- SQL Server 2000</p>
<p>Could not allocate ancillary table for view or function resolution.<br />
The maximum number of tables in a query (256) was exceeded.</p>
<p>-- SQL Server 2005</p>
<p>Too many table names in the query. The maximum allowable... | <p>For SQL Server 2005, I'd recommend using table variables and partially building the data as you go. </p>
<p>To do this, create a table variable that represents your final result set you want to send to the user.</p>
<p>Then find your primary table (say the orders table in your example above) and pull that data, pl... | <p>I'd like to see that query, but I imagine it's some problem with some sort of iterator, and while I can't think of any situations where its possible, I bet it's from a bad while/case/cursor or a ton of poorly implemented views.</p>
| 2,453 |
<p>When I try to print a Unicode string in a Windows console, I get an error .</p>
<p><code>UnicodeEncodeError: 'charmap' codec can't encode character ....</code></p>
<p>I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this?
Is there any way I can make Pyt... | <p><strong>Note:</strong> This answer is sort of outdated (from 2008). Please use the solution below with care!!</p>
<hr>
<p>Here is a page that details the problem and a solution (search the page for the text <em>Wrapping sys.stdout into an instance</em>):</p>
<p><a href="http://wiki.python.org/moin/PrintFails" rel... | <p>James Sulak asked,</p>
<blockquote>
<p>Is there any way I can make Python automatically print a ? instead of failing in this situation?</p>
</blockquote>
<p>Other solutions recommend we attempt to modify the Windows environment or replace Python's <code>print()</code> function. The answer below comes closer to ... | 2,732 |
<p>I'm developing a compiler framework for .NET and want a flexible way of defining pipelines. I've considered the following options:</p>
<ul>
<li>WWF</li>
<li>Custom XML pipeline description</li>
<li>Custom pipeline description in code (using Nemerle's macros to define syntax for it)</li>
<li>Other code-based descri... | <p>If you know Ruby then a solution is to write a simple internal DSL that can generate whatever pipeline data types and reader/writer code you need. Generating XML is a quick way to get started. You can always change the DSL to generate another format later if required.</p>
<p>You may also want to look at the <a href... | <p>I know <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">Boo</a> let you have fun with the compiler, not sure if it does in the manner you want.</p>
| 8,746 |
<p>I was wondering if anybody knew of a method to configure apache to fall back to returning a static HTML page, should it (Apache) be able to determine that PHP has died? This would provide the developer with a elegant solution to displaying an error page and not (worst case scenario) the source code of the PHP page ... | <p>The PHP source code is only displayed when apache is not configured correctly to handle php files. That is, when a proper handler has not been defined. </p>
<p>On errors, what is shown can be configured on php.ini, mainly the display_errors variable. That should be set to off and log_errors to on on a production en... | <p>There are 2 ways to use PHP and Apache.</p>
<pre><code>1. Install PHP as an Apache module: this way the PHP execution is a thread inside the apache process. So if PHP execution fails, then Apache process fails too. there is no fallback strategy.
2. Install PHP as a CGI script handler: this way Apache will start a ... | 8,734 |
<p>An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple unmanaged samples but I can't find an... | <p>The article is good, but doesn't actually answer the question. OLEDB is a set of COM interfaces that could in fact be implemented in .Net via COM Interop though I've never heard of such an implementation and probably isn't advisable.</p>
<p>The set of OLEDB interfaces are documented by Microsoft <a href="http://msd... | <p>I am not sure I really understand your question?! There already <em>is</em> a managed OleDBProvider?!</p>
<pre><code>using System.Data.OleDb;
</code></pre>
<p>I would certainly discourage writing a provider that exists and works absolutely fine! :)</p>
<p>But in answer to your first question, you can of course cr... | 7,683 |
<p>I'm supposed to learn how to use <a href="http://www.ni.com/labview/" rel="nofollow noreferrer">LabVIEW</a> for my new job, and I'm wondering if anybody can recommend some good books or reference/tutorial web sites.</p>
<p>I'm a senior developer with lots of Java/C#/C++ experience.</p>
<p>I realize that this quest... | <p><strong>It will take some <em>training</em> and some <em>time</em> to learn the style needed to develop maintainable code</strong>.</p>
<p>Coming from Java/C#/C++, you probably have a good idea of good software architecture. Now you just need to learn the peculiarities of LabView and the common pitfalls.</p>
<p>Fo... | <p>When I started with LabVIEW a few years ago I was given a link to the <a href="http://cnx.rice.edu/content/col10241/latest/" rel="nofollow noreferrer">LabVIEW Graphical Programming Course</a>. It covers the basics and having a sound knowledge of other programming languages I think helped me pick things up quickly.</... | 6,912 |
<p>The <a href="http://dev.jquery.com/view/trunk/ui/demos/functional/#ui.dialog" rel="nofollow noreferrer">demos</a> for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, everything seemed to be working fine, but later I found ... | <p>I think it is because you have the classes different.<br/>
<code><div id="SERVICE03_DLG" class="flora"></code> (flora)<br/>
<code><div id="SERVICE03_DLG" class="ui-dialog"></code> (custom)</p>
<p>Even with the flora theme, you would still use the ui-dialog class to define it as a dialog.</p>
<p>I've d... | <p>Man, this is a good one. I've tried doing a bunch of things on these two pages. Have you tried just leaving the CSS out altogether and trying both pages then? I used Firebug to remove the CSS from the header on both pages, and the input still worked on one and not on the other - but, I'm inclined to believe that ... | 6,752 |
<p>When a user hits Refresh on their browser, it reloads the page but keeps the contents of form fields. While I can see this being a useful default, it can be annoying on some dynamic pages, leading to a broken user experience.</p>
<p>Is there a way, in HTTP headers or equivalents, to change this behaviour?</p>
| <pre><code><input autocomplete="off">
</code></pre>
| <p>I wonder, if you set the page not to be cached through meta tags, will that fix the problem? <a href="http://lists.evolt.org/archive/Week-of-Mon-20030106/131984.html" rel="nofollow noreferrer">http://lists.evolt.org/archive/Week-of-Mon-20030106/131984.html</a> If it does, it'll have the benefit of working on browser... | 7,546 |
<p>What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? </p>
<p>Do they actually provide actual value to your job? Or are they just something that people talk abo... | <p>Any large program that is well written will use design patterns, even if they aren't named or recognized as such. That's what design patterns are, designs that repeatedly and <em>naturally</em> occur. If you're interfacing with an ugly API, you'll likely find yourself implementing a <code>Facade</code> to clean it... | <p>I absolutely use design patterns. At this point I take MVC for granted as a design pattern. My primary reason for using them is that I am humble enough to know that I am likely not the first person to encounter a particular problem. I rarely start a piece of code knowing which pattern I am going to use; I constan... | 3,268 |
<p>How do I use Perl to create graphs?</p>
<p>I'm running scheduled job that creates text reports. I'd like to move this to the next step (for the management) and also create some graphs that go along with this. Is this possible / feasible? It'd be great if I could do this using Office some how.</p>
<h2>update: s... | <p>GD and GD::Graph are probably your best bets, you can use them to create images that you can then embed into whatever you need.</p>
| <p><a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel" rel="nofollow noreferrer">Spreadsheet::WriteExcel</a> will let you just get the data into Excel, then write Excel equations for the graphs.</p>
| 9,009 |
<p>Working on implementing TFS throughout our organization. It is easy to integrate with <code>.NET</code> projects and any platform that uses Eclipse or a derivative of Eclipse for editing.<br>
What's the best way to use TFS version control with Xcode (now that I find out we need to write some iPhone apps)?</p>
| <p>Xcode integration is something that we at <a href="http://www.teamprise.com" rel="noreferrer">Teamprise</a> have been looking into a lot. One of the main problems for us is that Apple does not provide a version control API that we can hook into to add a new version control system to Xcode - for integrated version co... | <p>The biggest problem with this is that Xcode only runs on OS X and TFS client tools only run on Windows. If you're host operating system in OS X and you have a Windows virtual environment running locally (like Parallels or VMFusion) then you could use Team Explorer or the command-line tools to work with the reposito... | 9,567 |
<p>I use a MacBook, but I've got a usual keyboard attached to it.</p>
<p>The problem is that the keys don't exactly map 1-to-1. One thing is the APPLE and ALT keys. They map to WIN and ALT, but they are usually physically inverted, so if you want to use them with the same layout you have to invert them in the OS.
The ... | <p>In OS X 10.5 they allow you to have different keyboard setups for different keyboards. This works most of the time. I've had issues with very old keyboards that are plugged in via a PS2 to USB but otherwise it works fine.</p>
| <p>You could investigate DoubleCommand, it may do what you need.</p>
<p>There's an experimental version that allows for different properties for different keyboards.</p>
| 8,050 |
<p>I have been working on some legacy C++ code that uses variable length structures (TAPI), where the structure size will depend on variable length strings. The structures are allocated by casting array <code>new</code> thus:</p>
<pre class="lang-cpp prettyprint-override"><code>STRUCT* pStruct = (STRUCT*)new BYTE[size... | <p>Technically I believe it could cause a problem with mismatched allocators, though in practice I don't know of any compiler that would not do the right thing with this example.</p>
<p>More importantly if <code>STRUCT</code> where to have (or ever be given) a destructor then it would invoke the destructor without hav... | <p>Rob Walker <a href="https://stackoverflow.com/questions/73134/will-this-c-code-cause-a-memory-leak-casting-vector-new#73163">reply</a> is good.</p>
<p>Just small addition, if you don't have any constructor or/and distructors, so you basically need allocate and free a chunk of raw memory, consider using free/malloc ... | 9,883 |
<p>If I create an HTTP <code>java.net.URL</code> and then call <code>openConnection()</code> on it, does it necessarily imply that an HTTP post is going to happen? I know that <code>openStream()</code> implies a GET. If so, how do you perform one of the other HTTP verbs without having to work with the raw socket laye... | <p>If you retrieve the <code>URLConnection</code> object using <code>openConnection()</code> it doesn't actually start communicating with the server. That doesn't happen until you get the stream from the <code>URLConnection()</code>. When you first get the connection you can add/change headers and other connection pr... | <p>No it does not. But if the protocol of the URL is HTTP, you'll get a <a href="http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html" rel="nofollow noreferrer"><code>HttpURLConnection</code></a> as a return object. This class has a <code>setRequestMethod</code> method to specify which HTTP method you ... | 6,042 |
<p>I have a mesh of a bowl that has the perfect shape of half a sphere. I want to easily convert it to the containing sphere solid and a box solid that will be subtracted from it.</p>
<p><a href="https://i.stack.imgur.com/FlT0X.png" rel="nofollow noreferrer" title="Conversion process"><img src="https://i.stack.imgur.c... | <p>The answers by @markshancock and @fred-dot-u describe the process of creating a CAD primitive sphere and subtracting a cube; this is a trivial task in most any 3D CAD program. You could manually measure the mesh to determine its dimensions, and frankly, I would recommend this approach. (If you have a large task like... | <p>So it depends a lot on what you want to do.</p>
<ol>
<li><p>If you want to mathematically calculate what cube fits in what size sphere, that is straight forward. The <a href="http://mathcentral.uregina.ca/qq/database/qq.09.04/brett1.html" rel="nofollow noreferrer">diagonal for the cube</a> has to fit into the diam... | 663 |
<p>I have a large exiting C++ project involving:</p>
<ul>
<li>4 applications</li>
<li>50+ libraries</li>
<li>20+ third party libraries</li>
</ul>
<p>The project uses QMake (part of Trolltech's Qt) to build the production version on Linux, but I've been playing around at building it on MacOS.</p>
<p>I can build in on... | <p>I'm sure this could be of some great help for you :</p>
<p><a href="https://blog.qt.io/blog/2007/08/23/deploying-mac-applications-without-the-hassle/" rel="nofollow noreferrer">deployqt</a></p>
<p>Hope this helps !</p>
| <p>I side-stepped this problem completely by building my Qt app statically on OS X. That might not be practical for you though.</p>
| 4,658 |
<p>I'd like to print modifications for my bird feeder, both to patch over the hail damage from last summer and to try to deter the neighborhood squirrels. I have an FDM printer (and experience with nylon, ABS, and PLA, though don't restrict answers to those if there's something else that's better), what kind of filame... | <p>PET(G) is a strong contender. It is very strong and water-resistant, and as such is often used to make pop bottles.</p>
<p>PLA has a reputation for being "biodegradable" and therefore it is often discouraged to use PLA outside and/or in contact with water. However, PLA only biodegrades under very specific condition... | <p>I think ABS would be your best bet. It's not biodegradable and realtivley easy to print.</p>
<p>But you can use more or less any material if you use some form of coating on it. I would always go for coated PLA instead of other materials just because PLA is the easiest to print and it's nontoxic.</p>
| 88 |
<p>My company is using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe" rel="nofollow noreferrer">Visual SourceSafe</a> (VSS) and Visual Studio 2005 (soon 2008). They want to switch to <a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System" rel="nofollow noreferrer">CVS</a>, but the develope... | <p>Screaming at VSS for lost source code, etc. Seriously though, it is a very different model (<a href="http://en.wikipedia.org/wiki/Optimistic_replication#Examples" rel="nofollow noreferrer">optimistic locking</a>), so you will probably lose some productivity for the first little while. I would probably look at using ... | <p>My hack is as follows:</p>
<p>I am mainly a Java developer and I use Eclipse/RAD. The support for CVS is great and is very easy to work with.</p>
<p>For the C# work I do I tried to find a CVS plugin for Visual Studio but was unhappy with the one I found. In the end, I decided to use Eclipse to handle the versionin... | 7,570 |
<p>So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair, and then there is one optional list of key value pairs below that (but no more levels than these). Would this be suitab... | <p>There is an actual Data Type called KeyValuePair, use like this</p>
<pre><code>KeyValuePair<string, string> myKeyValuePair = new KeyValuePair<string,string>("defaultkey", "defaultvalue");
</code></pre>
| <p><a href="http://msdn.microsoft.com/en-us/library/xfhwa508.aspx" rel="nofollow noreferrer">Dictionary Class</a> is exactly what you want, correct.</p>
<p>You can declare the field directly as Dictionary, instead of IDictionary, but that's up to you.</p>
| 3,030 |
<p>How can I get an image to stretch the height of a <code>DIV</code> class?</p>
<p>Currently it looks like this:</p>
<p><img src="https://i.stack.imgur.com/DcrXC.png" width="650" /></p>
<p>However, I would like the <code>DIV</code> to be stretched so the <code>image</code> fits properly, but I do not want to resize... | <p>Add <code>overflow:auto;</code> to <code>.product1</code></p>
| <pre><code>display:inline
float:left
</code></pre>
<p>is your problem</p>
<p>Floating makes the parents width not be stretched by the child, try placing the image without the float. If you take the float off, it should give you the desired effect.<br>
Another approach would be to make sure you are clearing your f... | 6,248 |
<p>When I'm joining three or more tables together by a common column, I'd write my query like this:</p>
<pre><code>SELECT *
FROM a, b, c
WHERE a.id = b.id
AND b.id = c.id
</code></pre>
<p>a colleague recently asked my why I didn't do explicit <em>Join Transitive Closure</em> in my queries like this:</p>
<pre><... | <p>You don't need to do this in todays database engines, but there was a time when things like that would give the query optimizer more hints as to possible index paths and thus to speedier results.</p>
<p>These days that entire syntax is going out anyway.</p>
| <p>That syntax has its uses though ... there are times when you find you need to join two tables on more than one field</p>
| 3,221 |
<p>The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as:</p>
<pre><code>áéíóú
</code></pre>
<p>...an inspection of the return value of ge... | <p>VPC to Hyper-V is one way.</p>
| <p>You should review Windows 2008 R2 SP1 upgrade with RemoteFX, it comes with a new video driver for VM's that allow 3D, extended desktops and more. It will help resolve some of the issues you are seeing today.</p>
<p>Both the Host server and VM need to be running SP1 of Windows 2008 R2.</p>
<p><a href="http://blogs.... | 6,478 |
<p><strong>A Little Background Information</strong>:<br>
I've been looking at a few PHP framework recently, and it came down to two. The Zend Framework or CodeIgniter. </p>
<p>I prefer CodeIgniter, because of its simple design. It's very bare bone, and it is just kept simple. The thing I don't like though is the weak ... | <p>Slightly OT, hope you don't mind...</p>
<p>I'm a Zend Framework user and I think it's worth saying that the loose coupling means you don't need to include any files you're not actively using. Hopefully this negates your concern about unnecessary overhead.</p>
<p>With the layouts stuff added in a recent release of... | <p>Check out this <a href="http://codeigniter.com/forums/viewthread/94035/" rel="nofollow noreferrer">custom CodeIgniter templating library</a>. I've already used it on several projects and it is easy to use. I know this post is late but it's worth checking out.</p>
| 6,229 |
<p>I'm looking for a way to extract the audio part of a FLV file. </p>
<p>I'm recording from the user's microphone and the audio is encoded using the <a href="http://en.wikipedia.org/wiki/Nellymoser_Asao_Codec" rel="nofollow noreferrer">Nellymoser Asao Codec</a>. This is the default codec and there's no way to change ... | <p><a href="http://ffmpeg.mplayerhq.hu/" rel="nofollow noreferrer">ffMpeg</a> is the way to go !
It worked for me with SVN Rev 14277.</p>
<p>The command I used is : <code>ffmpeg -i source.flv -nv -f mp3 destination.mp3</code></p>
<p><strong>GOTCHA</strong> :</p>
<p>If you get this error message : <code>Unsupported a... | <p>I was going to recommend this: <a href="http://code.google.com/hosting/takenDown?project=nelly2pcm&notice=7281" rel="nofollow noreferrer">http://code.google.com/hosting/takenDown?project=nelly2pcm&notice=7281</a>.</p>
<p>But its been taken down. Glad I got a copy first :-)</p>
| 9,320 |
<p>Is anyone out there using D for real world applications? If so, what are you using it for? I can't seem to find anything big on the web written in D.</p>
<p>Despite the lack of known big users, D seems like a very promissing language to me, and according to <a href="http://www.tiobe.com/index.php/content/paperinfo/... | <p>I'm using D for my research work in the area of computer graphics. I and others have had papers published in our fields based on work done using D. I think it's definitely ready for use on small to medium sized research projects where performance matters. It's a nice fit for research work because often you're sta... | <p>I started a ray-traced renderer in D with ldmd2.</p>
<p><a href="http://palaes.rudanium.org/SubSpace/render.php" rel="nofollow">http://palaes.rudanium.org/SubSpace/render.php</a></p>
| 8,020 |
<p>On a number of occasions I've broken small plastic parts that are nearly impossible to replace but could easily be 3-D printed. The latest such mishap is the volume knob on the factory-installed radio on my car. </p>
<p>I have little experience in 3D printing, and would like to be able to replace these parts with... | <p>The easiest way is as you currently do: model the pieces by hand, using (digital) calipers to measure them.</p>
<p>Scanning technology isn't very good, and the models are not of printable quality. Usually, fixing a scan is more work than modeling an item from scratch.</p>
| <p>There is scanning technology: either hardware or software (such software typically works from multiple 2D photographs). It has limitations, but is an active research area, and getting better all the time. "Autodesk 123D Catch" and "3-Sweep" are a couple examples.</p>
<p>One tradeoff between automatic and manual is ... | 97 |
<p>Can I return it as an object if I am doing a </p>
<pre><code>Select OneItem from Table Where OtherItem = "blah"?
</code></pre>
<p>Is there a better way to do this?</p>
<p>I am building a constructor to return an object based on its name rather than its ID.</p>
| <p><code>query.UniqueResult<T>()</code> returns just one <strong>T</strong></p>
| <p>Or using LINQ you can have <code>query.First()</code>, <code>query.SingleOrDefault()</code>, <code>query.Min(predicate)</code> etc...</p>
| 7,571 |
<p>Can anyone tell me what is the <em>memory usage overhead associated with PHP opcode cache</em>? </p>
<p>I've seen a lot of reviews of <code>opcode cache</code> but all of them only concentrate on the performance increase. I have a small entry level <em>VPS and memory limits</em> are a concern for me. </p>
| <p>Most of the memory overhead will come from the opcode cache size. Each opcode cacher has their own default(e.g. 30MB for APC) which you can change through the config file.</p>
<p>Other than the cache size, the actual memory overhead of the cacher itself is negligible.</p>
| <p>In todays world: It's neglectible. I think memory consumption was about 50 MB bigger with eAccelerator then it was without when I did my <a href="http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/" rel="nofollow noreferrer">benchmarks</a>.</p>
<p>If you really need... | 4,918 |
<p>Let's say you have a class called Customer, which contains the following fields:</p>
<ul>
<li>UserName</li>
<li>Email</li>
<li>First Name</li>
<li>Last Name</li>
</ul>
<p>Let's also say that according to your business logic, all Customer objects must have these four properties defined.</p>
<p>Now, we can do this ... | <p>Two design approaches to consider</p>
<p>The <a href="http://www.hillside.net/plop/plop98/final_submissions/P10.pdf" rel="noreferrer">essence</a> pattern</p>
<p>The <a href="https://martinfowler.com/bliki/FluentInterface.html" rel="noreferrer">fluent interface</a> pattern</p>
<p>These are both similar in intent, ... | <p>Unless it's more than 1 argument, I always use arrays or objects as constructor parameters and rely on error checking to make sure the required parameters are there.</p>
| 6,148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.