instruction stringlengths 27 22.5k | chosen stringlengths 27 28.2k | rejected stringlengths 19 24.9k | __index_level_0__ int64 0 10k |
|---|---|---|---|
<p>I am new to C# and am doing some work in an existing application. I have a DirectX viewport that has components in it that I want to be able to position using arrow keys.</p>
<p>Currently I am overriding ProcessCmdKey and catching arrow input and send an OnKeyPress event. This works, but I want to be able to use mo... | <p>Within your overridden ProcessCmdKey how are you determining which key has been pressed?</p>
<p>The value of keyData (the second parameter) will change dependant on the key pressed and any modifier keys, so, for example, pressing the left arrow will return code 37, shift-left will return 65573, ctrl-left 131109 and... | <p>I upvoted <a href="https://stackoverflow.com/questions/4850/c-and-arrow-keys/5026#5026">Tokabi's answer</a>, but for comparing keys there is some additional advice on <a href="https://stackoverflow.com/questions/1369312/c-keys-enumeration-confused-keys-alt-or-keys-rbutton-keys-shiftkey-keys-alt/2033796#2033796">Stac... | 2,683 |
<p>I quite like the drag and drop pluggable programming blocks in scratch ( <a href="http://scratch.mit.edu/" rel="nofollow noreferrer">http://scratch.mit.edu/</a> )</p>
<p>I'd like to be able to get users to create their own mini scripts using the same kind of technique...</p>
<p>just wondering if anyone knows of ... | <p>Maybe <a href="http://msdn.microsoft.com/en-us/netframework/aa663328.aspx" rel="nofollow noreferrer">Windows Workflow Foundation</a> is something for you. You can <a href="http://msdn.microsoft.com/nl-be/library/cc835242(en-us).aspx" rel="nofollow noreferrer">host the designer</a> in your own application. So end-use... | <p>It's not .NET, but have you looked at Alice? (<a href="http://www.alice.org/" rel="nofollow noreferrer">http://www.alice.org/</a>)</p>
| 9,441 |
<p>Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop?</p>
<p>For instance, I currently do something like this depending on the circumstances:</p>
<pre><code>int i = 0;
forea... | <p>The <code>foreach</code> is for iterating over collections that implement <a href="http://msdn.microsoft.com/en-us/library/9eekhta0%28v=vs.110%29.aspx" rel="noreferrer"><code>IEnumerable</code></a>. It does this by calling <a href="http://msdn.microsoft.com/en-us/library/s793z9y2(v=vs.110).aspx" rel="noreferrer"><co... | <p>i want to discuss this question more theoretically (since it has already enough practical answers)</p>
<p>.net has a very nice abstraction model for groups of data (a.k.a. collections) </p>
<ul>
<li>At the very top, and the most abstract, you have an <code>IEnumerable</code> it's just a group of data that you can ... | 6,466 |
<p>After successfully building dblink on solaris 10 using Sun C 5.9
SunOS_sparc 2007/05/03 and gmake.</p>
<p>I ran gmake installcheck and got the following output:</p>
<pre><code>========== running regression test queries ==========
test dblink ... FAILED
======================
1 of 1 tests f... | <p>To solve this issue I tried using the 8.2 dblink sources, instead of the latest version.</p>
<p>You also need to make sure you use gnu make not the sun make.</p>
| <p>Does the file it is looking for actually exist? Is it in that location?</p>
<p>It may be one of a few things I can think of:
1) The thing did not compile, and therefore does not exist.
2) It exists, but somewhere else, and the environment variable that tells it where to find it is set wrong.
3) The permissions... | 9,539 |
<p>We are custom building a Cartesian 3D printer to be used in a production 3D printing environment, with the following requirements:</p>
<ul>
<li>Intended Z resolution 0.13mm;</li>
<li>Dual extruders (primary + support material);</li>
<li>Four spools (two per material with y connector, perhaps add auto switch-over fu... | <p>Your choice of firmware depends on a lot of factors, but to name a few important ones: features, your driver board (RAMPS vs Sanguinololu vs Gen..etc), and G-code support.</p>
<p>Smooth/quiet operation is dependent on the motors and the driver chip's micro-stepping capabilities. The way the firmware interfaces with... | <blockquote>
<p>Given that this printer will have the Pi3 to control "higher functions", is it worth considering a compact firmware like Teacup?</p>
</blockquote>
<p>A few days ago I came across <a href="https://github.com/KevinOConnor/klipper" rel="noreferrer">klipper</a>.</p>
<p>It seems to do exactly that functi... | 430 |
<p>I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doi... | <p>Since you can access your database remotely, you can use mysqldump from your windows machine to fetch the remote database. From commandline:</p>
<pre><code>cd "into mysql directory"
mysqldump -u USERNAME -p -h YOUR_HOST_IP DATABASE_TO_MIRROR >c:\backup\database.sql
</code></pre>
<p>The program will ask you for ... | <p>I would create a (Ruby) script to do a <code>SELECT * FROM ...</code> on all the databases on the server and then do a <code>DROP DATABASE ...</code> followed by a series of new <code>INSERT</code>s on the local copy. You can do a <code>SHOW DATABASES</code> query to list the databases dynamically. Now, this assumes... | 6,062 |
<p>As a programmer I have no idea how one would go about programming menus for a DVD, I have heard that this is possible, and even seen basic games using DVD menus - although it may very well be a closed-system. Is it even possible and if so, what language, compilers etc exist for this?</p>
| <p>There are a couple of open source projects that can create DVDs plus menus. I recently used <a href="https://web.archive.org/web/20201109023628/http://dvd-slideshow.sourceforge.net/wiki/Main_Page" rel="nofollow noreferrer">dvd-slideshow</a> to create a simple dvd with menus etc. Another one is <a href="http://www.dv... | <p>Looks like <a href="http://dvdauthor.sourceforge.net/" rel="nofollow">http://dvdauthor.sourceforge.net/</a> is able to help here since you can use command line interface and feed xml files. </p>
<p>You may need to write a framework which can generate xml files (and other content) from your game authoring tool.</p>
| 8,930 |
<p>I own a spool of PETG and I have been having major print quality issues: layer offsets, chunks of 3d print strewn across the buildplate and other things. I traced these effects to a single culprit: rough layers. I don't know how to fix this. I haven't had this issue at all with all of my other PETG filament colors. ... | <h2>Make sure to set the scale properly for your use case!</h2>
<p>In CAD, you define your measurement space in either Inch or in Millimeter units, and that is your grid. In blender, the native unit is the meter.</p>
<p>This can be easily converted in exporting (remember to set it to scale!), but it is best to just set... | <p>It doesn't matter, you scale it in the slicer or elsewhere. You're not going to slice the STL file in Blender. You'll probably need to do more work to get things print ready outside blender anyway.</p>
<p>So when I use blender I don't even bother checking what units it's using. I don't use it for parts design or tec... | 2,124 |
<p>I'm using <a href="http://en.wikipedia.org/wiki/Windows_Script_Host#Usage" rel="noreferrer">WScript</a> to automate some tasks, by using WScript.Shell to call external programs.</p>
<p>However, right now it does not wait for the external program to finish, and instead moves on. This causes issues because I have som... | <p>Turns out, that while loop is severe CPU hog :P</p>
<p>I found a better way:</p>
<pre><code>ZipCommand = "7za.exe a -r -y " & ZipDest & BuildLabel & ".zip " & buildSourceDir
Set wshShell = WScript.CreateObject("Wscript.Shell")
wshShell.Run ZipCommand,1,1
</code></pre>
<p>The last two arguments a... | <p>If you use the "Exec" method, it returns a reference, so you can poll the "Status" property to determine when it is complete. Here is a sample from <a href="http://msdn.microsoft.com/en-us/library/ateytk4a(VS.85).aspx" rel="noreferrer">msdn</a>:</p>
<pre><code>Dim WshShell, oExec
Set WshShell = CreateObject("WScri... | 7,315 |
<p>Is <em>CompileAssemblyFromDom</em> faster than <em>CompileAssemblyFromSource</em>?</p>
<p>It <em>should</em> be as it presumably bypasses the compiler front-end.</p>
| <p>CompileAssemblyFromDom compiles to a .cs file which is then run through the normal C# compiler.</p>
<p>Example:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.CSharp;
using System.CodeDom;
using System.IO;
using System.CodeDom.Compiler;
using Syst... | <p>I've tried finding the ultimate compiler call earlier and I gave up. There's quite a number of layers of interfaces and virtual classes for my patience.</p>
<p>I don't think the source reader part of the compiler ends up with a DOM tree, but intuitively I would agree with you. The work necessary to transform the DO... | 2,659 |
<p>I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply have a better one then please submit an answer... | <pre><code>(public|protected|private|static|\s) +[\w\<\>\[\]]+\s+(\w+) *\([^\)]*\) *(\{?|[^;])
</code></pre>
<p>I think that the above regexp can match almost all possible combinations of Java method declarations, even those including generics and arrays are return arguments, which the regexp provided by the ori... | <p>I built a vim regex to do this for <a href="https://github.com/pydave/ctrlp-funky/blob/master/autoload/ctrlp/funky/java.vim" rel="nofollow">ctrlp/funky</a> based on Georgios Gousios's answer.</p>
<pre><code> let regex = '\v^\s+' " preamble
let regex .= '%(<\w+>\s+){0,3}' " visibility... | 9,418 |
<p>I've heard of a few ways to implement tagging; using a mapping table between TagID and ItemID (makes sense to me, but does it scale?), adding a fixed number of possible TagID columns to ItemID (seems like a bad idea), Keeping tags in a text column that's comma separated (sounds crazy but could work). I've even heard... | <p>Three tables (one for storing all items, one for all tags, and one for the relation between the two), properly indexed, with foreign keys set running on a proper database, should work well and scale properly. </p>
<pre><code>Table: Item
Columns: ItemID, Title, Content
Table: Tag
Columns: TagID, Title
Table: ItemT... | <p>I would suggest following design :
Item Table:
Itemid, taglist1, taglist2<br>
this will be fast and make easy saving and retrieving the data at item level. </p>
<p>In parallel build another table:
Tags
tag
do not make tag unique identifier and if you run out of space in 2nd column which contains lets say 10... | 4,123 |
<p>My wife wants me to use an FFM 3d printer to make custom stamps for her to use on paper (scrap books, letters, etc.). She is convinced, however, that they will be too rigid to make good stamps. A quick google search showed ones made from <a href="https://3dprint.com/110918/3d-printed-stamp-collection/" rel="norefer... | <p>I see three options...</p>
<p><strong>1. Print with a flexible filament:</strong></p>
<ul>
<li>Many options: TPU as you pointed out, the flexible PLA that Tom mentioned, and others. Here's an article with a few options from <a href="https://3dprintingindustry.com/news/which-flexible-3d-printing-filament-should-yo... | <p>Recently I've experimented with printing some <a href="http://rads.stackoverflow.com/amzn/click/B00TOOBPNO" rel="nofollow">Nylon 618 filament</a> after <a href="http://www.matterhackers.com/articles/printing-with-nylon" rel="nofollow">reading stuff online</a> about it. I'm using a Craftbot original with the stock h... | 389 |
<p><strong>Given the emissions that 3d printing gives off (ABS = styrene and other chemicals, PLA give some off, etc), what options are there to filter the air in the enclosure other than venting the air out of a window?</strong></p>
<p>More information on the chemicals 3d printing emit:</p>
<ul>
<li><a href="http://bu... | <p>My residential materials expert referred me to these links (<a href="http://www.bofaamericas.com/3D-printing-fume-extraction.asp" rel="noreferrer">3D Printing Fume Extraction Solutions</a>, and <a href="http://www.3dprintfilemarket.com/140629194058.html" rel="noreferrer">ABS 3d Printer Nanoparticle and Chemical Exha... | <p>Anybody consider using a Grow Box Fan and filter inside an enclosure. They come cheap with 180 cfm fan and / carbon filters.</p>
<p><a href="https://i.stack.imgur.com/16XP7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/16XP7.jpg" alt="https://www.amazon.com/iPower-Inline-Variable-Controller-Ven... | 188 |
<p>I have recently been doing a bit of investigation into the different types of Model View architectures, and need to decide which one to pursue for future in-house development. As I'm currently working in a Microsoft shop that has ASP.NET skills, it seems my options are between ASP.NET MVC and WCSF (Monorail is proba... | <blockquote>
<p>ASP.NET MVC cannot use web controls that rely on postbacks, whereas WCSF can.</p>
</blockquote>
<p>You should think of WCSF as guidance about how to use the existing WebForms infrastructure, especially introducing Model-View-Presenter to help enforce separation of concerns. It also increases the test... | <p>Why not attach both to Northwind and see which fits best for you and your situation?</p>
| 7,694 |
<p>I need to print a thin piece.
Theoretically, it could work, but Cura prints the walls as single lines.
In my case, it is just this line that breaks apart as you can see here.</p>
<p>Is there a setting that would instruct Cura to avoid creating such a line as the outer wall, or how else could I resolve this problem?<... | <p>The raft still needs to fit on the bed, and it counts as a print, because, it is printed. You want the raft for better adhesion, so that means that you need more contact with the bed. If you’re not, your basically wasting filament. Its kinda logical actually.</p>
| <h2>Adjusted model Dimensions</h2>
<p>The model has the size determined by the base area of the bounding box, in this case, <span class="math-container">$\pu{190 \times 200 mm }$</span>. The raft as told by OP adds 15mm on <strong>all</strong> sides of the model, and thus adds 30 mm in total on both the X and Y dimensi... | 2,224 |
<p>I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with <a href="http://www.shoooes.net/" rel="noreferrer">Shoes</a> as a graphical front-end. My question to you, kind-sirs, what do I need to become fam... | <p>An earlier post mentioned RFC1459. While it is a very good introduction to IRC, it has actually been superseded by RFCs 2810-2813. Here is a more complete list of documentation you need to program anything IRC-related:</p>
<ul>
<li><a href="https://www.rfc-editor.org/rfc/rfc1459" rel="nofollow noreferrer">RFC1459</a... | <p>Not exactly an answer to your question, but it may be helpful. If you are using Ruby, I have found the Autumn Leaves project to be a great way to build an IRC bot using Ruby:</p>
<p><a href="http://github.com/RISCfuture/autumn/tree/master" rel="nofollow noreferrer">http://github.com/RISCfuture/autumn/tree/master</a... | 4,403 |
<p>Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script?</p>
<p>What sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive to the library in question bec... | <p>Using a batch file, you can both log on to the resource and copy the file: </p>
<p>The Batch File would contain the following: </p>
<pre><code>net use \\{dest-machine}\{destfolder} {password} /user:{username}
copy {file} \\{dest-machine}\{destfolder}
</code></pre>
<p>e.g.</p>
<pre><code>net use \\Development\myf... | <p>Yes you can. I suggest using a tool like robocopy.</p>
| 3,154 |
<p>I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared more towards the average consumer than the professional. Is an i... | <p>Any modern Mac will be fine. I work on a two year old MacBook (2GHz) with 2Gb of memory and its perfectly usable. The biggest constraint I find it screen real-estate. I am <em>way</em> more productive on my 22" external screen. Go big if you get an iMac or consider adding an external monitor to the base model.</p>
| <p>As with all development, screen size is paramount so I would suggest the 24" iMac if your golden ticket stretches that far or a mac mini with a large (probably non-Apple) monitor if it doesn't.</p>
| 4,250 |
<p>I like the status email sent by TFS's alerts mechanism when a build breaks.
However I would like to send such an email to the entire team and not rely on the team to subscribe to the alert...</p>
<p>Having a hard time producing a nice and detailed enough message by myself when overriding the "OnBuildBreak" and usin... | <p>You could try.</p>
<p><a href="http://www.woodwardweb.com/gadgets/000434.html" rel="nofollow noreferrer">Brian the build bunny</a></p>
<p>:-)</p>
| <p>In my mind, a open source project named 'Web Deployment Projects' can do this. your can search for it.</p>
| 5,886 |
<p>I need to display some interactive (attaching with DOM listeners etc. and event handling) vector graphics in web site I am working on. There is a W3C recommendation for SVG though this format is still not recognized by Internet Explorer support of which is a must (for a public website). IE handles VML though and the... | <p>Safari, Opera and Firefox all support SVG natively (eg. without plugins) to varying degrees of completeness and correctness, including the ability to script the svg from javascript.</p>
<p>There's also the canvas element which is now being standardised in html5, and is already supported in the above browsers as wel... | <p>Go for SVG - and just tell the users to get the ADOBE SVG plug in for IE.</p>
<p>See this excellent site - which is a UK Government Site (public service)</p>
<p><a href="http://www.elgin.gov.uk" rel="nofollow noreferrer">ELGIN</a></p>
| 3,100 |
<p>I recently changed filament and for starters it worked perfectly well, but quickly I got some problems with my first layer. It's like droplets are forming on the surface (finished item + 3 undersides):</p>
<p><a href="https://i.stack.imgur.com/qgPyl.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/qgPyl.jp... | <p>Mine is more of an educated guess than a definitive diagnosis, but <strong>it looks to me like if your printer may be overextruding</strong> (it's difficult to say with certainty with this particular picture, but your top layers too do not look as good as they should).</p>
<p><strong>I wonder if you have <a href="h... | <p>Mine is more of an educated guess than a definitive diagnosis, but <strong>it looks to me like if your printer may be overextruding</strong> (it's difficult to say with certainty with this particular picture, but your top layers too do not look as good as they should).</p>
<p><strong>I wonder if you have <a href="h... | 804 |
<p>The Python docs say:</p>
<blockquote>
<p>re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string...</p>
</blockquote>
<p>So what's going on ... | <p>Look at the definition of <a href="http://docs.python.org/library/re.html#re.sub" rel="noreferrer"><code>re.sub</code></a>:</p>
<pre><code>re.sub(pattern, repl, string[, count, flags])
</code></pre>
<p>The 4th argument is the count, you are using <code>re.MULTILINE</code> (which is 8) as the count, not as a flag.<... | <p>The full definition of <a href="http://docs.python.org/library/re.html#re.sub" rel="noreferrer"><code>re.sub</code></a> is:</p>
<pre><code>re.sub(pattern, repl, string[, count, flags])
</code></pre>
<p>Which means that if you tell Python what the parameters are, then you can pass <code>flags</code> without passing... | 6,413 |
<p><strong>Is there a way in PHP to overwrite a method declared by one interface in an interface extending that interface?</strong></p>
<p>The Example:</p>
<p>I'm probably doing something wrong, but here is what I have:</p>
<pre><code>interface iVendor{
public function __construct($vendors_no = null);
public... | <p><a href="https://stackoverflow.com/questions/16155/making-one-interface-overwrite-a-method-it-inherits-from-another-interface-in-p#16196">@cmcculloh</a> Yeah, in Java you don't define constructors in Interfaces. This allows you to both extend interfaces and also have a class that implements multiple interfaces (bot... | <p>You could drop off the constructor and just put them in each individual class. Then what you have is each class has its own __construct, which is probably the same depending on if it is a shipper or vendor. If you want to only have those constructs defined once I don't think you want to go down that route. </p>
<p>... | 3,689 |
<p>Sadly, I am not able to "repair" my 3D printer. Every time, I want to print something that takes a bit longer to print, the extrusion stops at some point during the print (the first few layers are great), no under-extrusion whatsoever before that critical point.</p>
<p>I already tried temperature variation (185-220... | <p>To fight heat creep, you must understand why this is happening.</p>
<p>Heat creeps up the hotend assembly (into the cold end) as a result of incorrect settings or hardware setup causing the filament to prematurely soften and swell.</p>
<p>It is important to reduce the heat travelling upwards in the first place rathe... | <p>Cooling the hot-end heat sink may be the key. My first step would be to try ducting so the all the air from the fan flows through the fins of the heatsink. To keep it easy and be a quick experiment, use cardboard (or business cards) and tape. Check the controls to be sure the fan is running at full power. You sh... | 1,211 |
<p>I'm making an example for someone who hasn't yet realized that controls like <code>ListBox</code> don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the <code>ListBox</code> and I'd like to show him there's a better way.</p>
... | <p>BindingList handles updating the bindings by itself.</p>
<pre><code>using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace TestBindingList
{
public class Employee
{
public string Name { get; set; }
public int Id { get; set; }
}
public partial class Form1 :... | <p>I don't know much about vb.net but in C# you should use datasource and then bind it by calling <code>listbox.bind()</code> would do the trick.</p>
| 8,665 |
<p>I have a Linq query that I want to call from multiple places:</p>
<pre><code>var myData = from a in db.MyTable
where a.MyValue == "A"
select new {
a.Key,
a.MyValue
};
</code></pre>
<p>How can I create a met... | <p>IQueryable and IEnumerable both work. But you want to use a type specific version, IQueryable<code><</code>T<code>></code> or IEnumerable <code><</code>T<code>></code>.</p>
<p>So you'll want to create a type to keep the data.</p>
<pre><code>var myData = from a in db.MyTable
where a.MyValue... | <p>If you want to return, you need a type.</p>
<p>Instead of <code>var</code>, declare using <code>IEnumerable<></code> and return that variable. Iterating through it actually executes the query.</p>
| 7,883 |
<p>If I'm working with standard PLA, and I want to print a box that I can stand on without any risk of it breaking, is there any good way to calculate the appropriate print settings?</p>
<p>I know that structural strength comes from the infill. Knowing this, and knowing the dimensions of the box, the weight of my bod... | <p>Strictly speaking, it is difficult to do calculations on these materials, but not impossible (I've heard about a few commercial analysis tools that do that). The FDM process (Fused Deposition Modeling) creates a product based of fused slices of material causing an anisotropic material (this means that the properties... | <p>A fast way to do this is by using SolidWorks. </p>
<p>You can draw the box in it and run a simulation test with the max load expected. </p>
<p>Here is a link on how to make dynamic load simulations work in SolidWorks, <a href="https://forum.solidworks.com/thread/72005" rel="nofollow noreferrer">How to apply dynami... | 932 |
<p>I'm tasked with building a .NET client app to detect silence in a WAV files.</p>
<p>Is this possible with the built-in Windows APIs? Or alternately, any good libraries out there to help with this?</p>
| <p>Audio analysis is a difficult thing requiring a lot of complex math (think Fourier Transforms). The question you have to ask is "what is silence". If the audio that you are trying to edit is captured from an analog source, the chances are that there isn't any silence... they will only be areas of soft noise (line hu... | <p>See code below from <a href="http://alvas.net/alvas.audio,tips.aspx#tip117" rel="nofollow">Detecting audio silence in WAV files using C#</a></p>
<pre><code>private static void SkipSilent(string fileName, short silentLevel)
{
WaveReader wr = new WaveReader(File.OpenRead(fileName));
IntPtr format = wr.ReadFor... | 3,979 |
<p>What would be the best way to do an <code>scp</code> or <code>sftp</code> copy in a Unix environment using C?</p>
<p>I'm interested in knowing the best library to use and an example if at all possible. I'm working on a <a href="https://en.wikipedia.org/wiki/Solaris_%28operating_system%29" rel="nofollow noreferrer">S... | <p>Try <a href="http://curl.haxx.se/libcurl/" rel="nofollow noreferrer">Libcurl</a></p>
<blockquote>
<p>libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, > FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TF... | <p>In the past, I've simply called a shell script that contained the file transfer code.</p>
<pre><code>int transferFile()
{
// Declare the transfer command
char transferCommand[50] = "/home/tyler/transferFile.shl";
// Execute the command
return system(transferCommand);
}
</code></pre>
<p>This will re... | 6,422 |
<p>I want to create a Java program that can be extended with plugins. How can I do that and where should I look for?</p>
<p>I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow.</p>
... | <p>I've done this for software I've written in the past, it's very handy. I did it by first creating an Interface that all my 'plugin' classes needed to implement. I then used the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html" rel="noreferrer">ClassLoader</a> to load those classes an... | <p>Have you considered building on top of Eclipse's Rich Client Platform, and then exposing the Eclipse extension framework?</p>
<p>Also, depending on your needs, the Spring Framework might help with that and other things you might want to do: <a href="http://www.springframework.org/" rel="nofollow noreferrer">http:/... | 4,506 |
<p>Why do concrete 3D printers lay the concrete in a zigzag shape? I know pouring it in a straight line makes it unstable, but the zigzag shape reduces the contact of the top layer to the layer below. What is the advantage?</p>
| <p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can ... | <p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p>
<ul>
<li>2-Phase stepping motor peak current of 2A</li>
<li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li>
<li>Internal 256 micro steps</li>
<li>Quiet mode</li>
<li>Fast mode</li>
<li>HS Rdson 0.29 Ω... | 2,072 |
<p>I am looking for a solution to export Shared Outlook Calendars (yes, I'm using exchange server and yes I can copy calendar to my local folders, which would allow me to export. However, what if there are more than 50 calendars, which I need to export? Is there a way of automating the process?). </p>
<p>I am interest... | <p><a href="http://msdn.microsoft.com/en-us/library/bb204119(EXCHG.80).aspx" rel="nofollow noreferrer">Exchange Web Services (EWS)</a> allows you to do this</p>
| <p><a href="http://sourceforge.net/projects/outlook2ical/" rel="nofollow noreferrer"><H2>outlook2ical</h2></a> has a VBMacro to export outlook calendar to iCal format.</p>
<p>You might check if its worth the time to port to C#.</p>
| 7,710 |
<p>What would cause this effect, and how can it be avoided? </p>
<p>This is a PLA print, and it should look like <a href="http://www.thingiverse.com/thing:1560347" rel="noreferrer">this</a>. I tried 215 and 225°C and both had the same effect. An earlier similar print at 220°C was not as bad but it still had some catc... | <p>I think that you should first verify that you have the latest firmware and a newer version of MakerWare. I experienced similar issues around that version of MakerWare and remember a lot of print errors came with it.</p>
<p>I believe the MakerBot Dual firmware is somewhere around 7.? and is no longer in development.... | <p>As pointed out in the comments, what you are seeing could very well be related to <em>lack of cooling</em>: </p>
<p>You may notice that the irregularity in the print become more and more pronounced the further up you see. I believe this happens because <em>the area that is printed is reduced gradually closer to the... | 433 |
<p>I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?</p>
| <p>IDLE provides Emacs keybindings without having to install other software. </p>
<ol>
<li>Open up the menu item Options -> Configure IDLE...</li>
<li>Go to Keys tab</li>
<li>In the drop down menu on the right
side of the dialog change the select
to "IDLE Classic Unix"</li>
</ol>
<p>It's not the true emacs key bindin... | <p><a href="http://www.python.org/doc/2.5/lib/module-readline.html" rel="nofollow noreferrer">'readline' module</a> supposedly provides Emacs like key bindings and even functionality. However, it is not available on Windows but on Unix. Therefore, this might be a viable solution if you are not using Windows.</p>
<pre>... | 7,910 |
<p>The turntable support part in my microwave has broken. It is a three armed part, with small wheels at the end of each arm. </p>
<p><a href="https://i.stack.imgur.com/qza6i.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/qza6i.jpg" alt="support part"></a></p>
<p>I'm confident I could print a replacement, ... | <p>I would say PLA itself should not be heated up by microwave. It's because microwave oven creates oscilations which excites water particles <a href="https://en.wikipedia.org/wiki/Microwave_oven" rel="nofollow">(see microwave explanation here)</a> <s>so assuming PLA doesn't contain water, it won't heat up.</s> <em>(re... | <p>Yes. You can.
I would think ABS would be a better idea, as it melts at a higher temp.
<a href="http://www.thingiverse.com/thing:385288" rel="nofollow">http://www.thingiverse.com/thing:385288</a></p>
| 368 |
<p>Do you know of any differences in handling HTML tags/properties in different browsers? For example, I once saw a page with a input tag with a maxlength field set to "2o". Firefox and Opera ignore the "o", and set the max length to 2, while Internet Explorer ignores the field altogether. Do you know of any more?</p>
... | <p>Check out <a href="http://www.quirksmode.org/" rel="nofollow noreferrer">http://www.quirksmode.org/</a></p>
| <p>The one that really annoys me is IE's broken document.getElementById javascript function - in most browsers this will give you something that has the id you specify, IE is happy to give you something that has the value in the name attribute, even if there is something later in the document with the id you asked for.... | 3,454 |
<p>I know that CoreXY kinematics is very complex and hard to calculate for the firmware making it better to use a 32-bit board. For some reason, I can't use any 32-bit board. What problems will occur if I use an 8-bit board like Arduino Mega with a CoreXY 3D printer?</p>
<p>Everything that I wrote in this question abou... | <p>The tradeoffs in these systems are all about quality achievable at particular speed and acceleration profiles. If you really don't care about speed at all and want maximum accuracy, you probably want some type of Cartesian setup with no belts, only rigid lead screws which you can take to as fine a pitch as you like,... | <p>The tradeoffs in these systems are all about quality achievable at particular speed and acceleration profiles. If you really don't care about speed at all and want maximum accuracy, you probably want some type of Cartesian setup with no belts, only rigid lead screws which you can take to as fine a pitch as you like,... | 1,718 |
<p>What are the available libraries for creating pretty charts and graphs in a Python application?</p>
| <p>I'm the one supporting CairoPlot and I'm very proud it came up here.
Surely matplotlib is great, but I believe CairoPlot is better looking.
So, for presentations and websites, it's a very good choice.</p>
<p>Today I released version 1.1. If interested, check it out at <a href="http://linil.wordpress.com/2008/09/16/... | <p>You could also consider <a href="http://code.google.com/apis/chart/" rel="nofollow noreferrer">google charts</a>.</p>
<p>Not technically a python API, but you can use it from python, it's reasonably fast to code for, and the results tend to look nice. If you happen to be using your plots online, then this would be... | 7,589 |
<p>I'm looking for a library to handle <a href="http://en.wikipedia.org/wiki/ICalendar" rel="noreferrer">iCalendar</a> data in Java.</p>
<p>Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have.</p>
<p>Does anyo... | <p>I had limited success with <a href="https://github.com/ical4j/ical4j" rel="noreferrer">iCal4j</a> (<a href="http://ical4j.sourceforge.net/introduction.html" rel="noreferrer">intro</a>) on a project last year.</p>
<p>It seems to be a fairly popular choice for ical work in the java community. </p>
<p>If I remember c... | <p>A challenger appears! Please give <a href="https://github.com/mangstadt/biweekly">biweekly</a> a try. I'm looking for lots of feedback on how it can be improved.</p>
| 5,402 |
<p>I'm working on a WinForm .Net application with the basic UI that includes toolbar buttons, menu items and keystrokes that all initiate the same underlying code. Right now the event handlers for each of these call a common method to perform the function.</p>
<p>From what I've read this type of action could be handle... | <p>Let's first make sure we know what the Command pattern is:</p>
<blockquote>
<p>Command pattern encapsulates a request
as an object and gives it a known
public interface. Command Pattern
ensures that every object receives its
own commands and provides a decoupling
between sender and receiver. A sender
... | <p>I can't help you with example link, but can provide example by myself.</p>
<p>1) Define ICommand interface:</p>
<pre><code>public interface ICommand {
void Do();
void Undo();
}
</code></pre>
<p>2) Do your ICommand implementations for concrete commands, but also define abstract base class for them:</p>
<pre... | 3,582 |
<p>Is there a good way to adjust the size of a <code>UITextView</code> to conform to its content? Say for instance I have a <code>UITextView</code> that contains one line of text:</p>
<pre><code>"Hello world"
</code></pre>
<p>I then add another line of text:</p>
<pre><code>"Goodbye world"
</code></pre>
<p>Is there ... | <p>This works for both iOS 6.1 and iOS 7:</p>
<pre><code>- (void)textViewDidChange:(UITextView *)textView
{
CGFloat fixedWidth = textView.frame.size.width;
CGSize newSize = [textView sizeThatFits:CGSizeMake(fixedWidth, MAXFLOAT)];
CGRect newFrame = textView.frame;
newFrame.size = CGSizeMake(fmaxf(newSi... | <p>Not sure why people always over complicate things:
here it is :</p>
<pre><code>- (void)textViewDidChange:(UITextView *)textView{ CGRect frame = textView.frame;
CGFloat height = [self measureHeightOfUITextView:textView];
CGFloat insets = textView.textContainerInset.top + textView.textContainerInset.bottom;
height +=... | 7,325 |
<p>Is it possible to to take a screenshot of a webpage with JavaScript and then submit that back to the server?</p>
<p>I'm not so concerned with browser security issues. etc. as the implementation would be for <a href="http://msdn.microsoft.com/en-us/library/ms536471(vs.85).aspx" rel="noreferrer">HTA</a>. But is it po... | <p>Google is doing this in Google+ and a talented developer reverse engineered it and produced <a href="http://html2canvas.hertzen.com/" rel="noreferrer">http://html2canvas.hertzen.com/</a> . To work in IE you'll need a canvas support library such as <a href="http://excanvas.sourceforge.net/" rel="noreferrer">http://e... | <p>A great solution for screenshot taking in Javascript is the one by <a href="https://grabz.it" rel="nofollow noreferrer">https://grabz.it</a>. </p>
<p>They have a flexible and simple-to-use screenshot API which can be used by any type of JS application.</p>
<p>If you want to try it, at first you should get the auth... | 8,532 |
<p>Is there a way to access file system info via some type of Windows API? If not what other methods are available to a user mode developer?</p>
| <p>Not very clean, but you can use <code>DeviceIoControl()</code>
Open volume as a file, pass resulting handle to <code>DeviceIoControl()</code> together with control code. Check MSDN for control codes, there is something like "read journal record".</p>
| <p>In another post, someone recommended this : <a href="http://www.microsoft.com/msj/0999/journal/journal.aspx" rel="nofollow noreferrer">Keeping an Eye on Your NTFS Drives: the Windows 2000 Change Journal Explained</a>.</p>
<p>It explains how to use the NTFS Filesystem with C++ through Windows 2000.
The implementatio... | 8,082 |
<p>When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.</p>
<p>Why don't sites use java applets anymore?</p>
<p>I'm also curious: histo... | <p>I think Java applets were overshadowed by Flash and ActionScript (pun unintended), being much easier to use for what Java Applets were being used at the time (animations + stateful applications). </p>
<p>Flash's success in this respect in turn owes to its much smaller file sizes, as well as benefiting from the Sun ... | <p>The JVM is very widespread, especially in the coorporate world, at least where I've worked, there was always a JVM installed.</p>
<p>I'm currently working on a Java Applet, but in general, I would never an applet unless I had to. But then again, I wouldn't use Flash or Silverlight, either. Applets have a slow load ... | 7,444 |
<p>I'm having trouble reading a "chunked" response when using a StreamReader to read the stream returned by GetResponseStream() of a HttpWebResponse:</p>
<pre><code>// response is an HttpWebResponse
StreamReader reader = new StreamReader(response.GetResponseStream());
string output = reader.ReadToEnd(); // throws exce... | <p>Haven't tried it this with a "chunked" response but would something like this work? </p>
<pre><code>StringBuilder sb = new StringBuilder();
Byte[] buf = new byte[8192];
Stream resStream = response.GetResponseStream();
string tmpString = null;
int count = 0;
do
{
count = resStream.Read(buf, 0, buf.Length);
... | <p>I've had the same problem (which is how I ended up here :-). Eventually tracked it down to the fact that the chunked stream wasn't valid - the final zero length chunk was missing. I came up with the following code which handles both valid and invalid chunked streams.</p>
<pre><code>using (StreamReader sr = new St... | 3,771 |
<p>This is an open-ended question. What approaches should I consider?</p>
| <p>There are some parallel extensions to .NET that are currently in testing and available at Microsoft's <a href="http://msdn.microsoft.com/en-us/concurrency/default.aspx" rel="noreferrer">Parallel Computing Developer Center</a>. They have a few interesting items that you would expect like Parallel foreach and a parall... | <p>There are many options and the best solution will depend on the nature of the problem you are trying to solve. If you are trying to solve an <a href="http://en.wikipedia.org/wiki/Embarrassingly_parallel" rel="nofollow noreferrer">embarassingly parallel</a> problem then dividing and parallelising the tasks will be t... | 2,378 |
<p>You should be able to create a generic form:</p>
<pre><code>public partial class MyGenericForm<T> :
Form where T : class
{
/* form code */
public List<T> TypedList { get; set; }
}
</code></pre>
<p>Is valid C#, and compiles. However the designer won't work and the form will throw a runtime ... | <p>Yes you can! Here's a blog post I made a while ago with the trick:</p>
<p><a href="http://www.madprops.org/blog/designing-generic-forms/" rel="noreferrer">Designing Generic Forms</a></p>
<p>Edit: Looks like you're already doing it this way. This method works fine so I wouldn't consider it too hacky.</p>
| <p>I have a hack to workaround this, which works but isn't ideal:</p>
<p>Add a new class to the project that inherits the form with its simple name.</p>
<pre><code>internal class MyGenericForm:
MyGenericForm<object> { }
</code></pre>
<p>This means that although the designer is still wrong the expected simp... | 3,210 |
<p>I have a JavaScript method that I need to run on one of my pages, in particular, the <code>onresize</code> event. </p>
<p>However, I don't see how I can set that event from my content page. I wish I could just put it on my master page, but I don't have the need for the method to be called on all pages that use th... | <p>Place the following in your content page:</p>
<pre><code><script type="text/javascript">
// here is a cross-browser compatible way of connecting
// handlers to events, in case you don't have one
function attachEventHandler(element, eventToHandle, eventHandler) {
if(element.attachEvent) {
element.... | <p>How about use code like the following in your Content Page (C#)?</p>
<pre><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "resizeMyPage", "window.onresize=function(){ resizeMyPage();}", true);
</code></pre>
<p>Thus, you could have a <code>resizeMyPage</code> function defined somewhere in the Javascri... | 5,334 |
<p>I have a self referencing Categories table. Each Category has a CategoryID, ParentCategoryID, CategoryName, etc. And each category can have any number of sub categories, and each of those sub categories can have any number of sub categories, and so and and so forth. So basically the tree can be X levels deep.</p>
<... | <p>I don't think linq-to-sql has a good answer to this problem. Since you are using sql server 2005 you can use CTEs to do hierarchical queries. Either a stored procedure or an inline query (using DataContext.ExecuteQuery) will do the trick. </p>
| <p>The performant approach is to create an insert/modify/delete trigger which maintains an entirely different table which contains node-ancestor pairs for all ancestors of all nodes. This way, the lookup is O(N).</p>
<p>To use it for getting all products belonging to a node and all of its descendants, you can just sel... | 6,470 |
<p>I've got a menu in Python. That part was easy. I'm using <code>raw_input()</code> to get the selection from the user. </p>
<p>The problem is that <code>raw_input</code> (and input) require the user to press <kbd>Enter</kbd> after they make a selection. Is there any way to make the program act immediately upon a key... | <p><strong>On Windows:</strong></p>
<pre><code>import msvcrt
answer=msvcrt.getch()
</code></pre>
| <p>The reason msvcrt fails in IDLE is because IDLE is not accessing the library that runs msvcrt. Whereas when you run the program natively in cmd.exe it works nicely. For the same reason that your program blows up on Mac and Linux terminals.</p>
<p>But I guess if you're going to be using this specifically for window... | 2,409 |
<p>I'm building a C++/MFC program in a multilingual environment. I have one main (national) language and three international languages. Every time I add a feature to the program I have to keep the international languages up-to-date with the national one. The resource editor in Visual Studio is not very helpful because ... | <p>In my experience, internationalization requires a little more than translating strings. Many strings when translated, require more space on a dialog. Because of this it's useful to be able to customize the dialogs for each language. Otherwise you have to create dialogs with extra space for the translated strings whi... | <p><a href="http://resxcrunch.com" rel="nofollow noreferrer">ResxCrunch</a> will be out soon, it will edit multiple resource files in multiple languages in one single table.</p>
| 7,517 |
<p>On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine. </p>
| <p>My understanding is that it is approximately the following from another <a href="https://stackoverflow.com/questions/24066/what-formula-should-be-used-to-determine-hot-questions">Jeff Atwood</a> post</p>
<pre><code>t = (time of entry post) - (Dec 8, 2005)
x = upvotes - downvotes
y = {1 if x > 0, 0 if x = 0, -1 ... | <p><a href="http://www.mt-soft.com.ar/wordpress/wp-content/plugins/wp-o-matic/cache/0ad4d_reddit_cf_algorithm.png">alt text http://www.mt-soft.com.ar/wordpress/wp-content/plugins/wp-o-matic/cache/0ad4d_reddit_cf_algorithm.png</a></p>
| 5,232 |
<p>I would like to have a reference for the pros and cons of using include <strong>files vs objects(classes)</strong> when developing PHP applications.</p>
<p>I know I would benefit from having one place to go for this answer...I have a few opinions of my own but I look forward to hearing others.</p>
<p><strong>A Sim... | <p>These are not really opposite choices. You will have to include the checking code anyway. I read your question as procedural programming vs. OO programming.</p>
<p>Writing a few lines of code, or a function, and including it in your page header was how things were done in PHP3 or PHP4. It's simple, it works (that's... | <p>Can you be a bit more specific? For the example you give you need to use include in both ways.
In case 1 you only include a file, in case 2 you need to include the class file (for instance user.class.php) to allow instantiation of the User class.</p>
<p>It depends how the rest of the application is built, is it OO?... | 4,258 |
<p>What Windows code editors allow the use of <a href="https://en.wikipedia.org/wiki/Tab_stop#Elastic_tabstops" rel="nofollow noreferrer">elastic tabstops</a>, either natively or through a plugin?</p>
<p>I know about a gedit plugin, but it only works on Linux.</p>
| <p><a href="http://code-browser.sourceforge.net/news.html#link" rel="noreferrer">Code Browser</a> may be the first for windows. I would love to see this feature as a plugin for other editors as well.</p>
| <p>The problem is that only a few toolkits/platforms have text widgets that offer the ability to set non-uniform tabstops on different lines. To my knowledge, those toolkits/platforms are Java Swing (used by the demo on the elastic tabstops page), GTK (used by Gedit and the Gedit plugin), and apparently the new version... | 4,826 |
<p>What would be the best algorithm for finding a number that occurs only once in a list which has all other numbers occurring exactly twice.</p>
<p>So, in the list of integers (lets take it as an array) each integer repeats exactly twice, except one. To find that one, what is the best algorithm.</p>
| <p>The fastest (O(n)) and most memory efficient (O(1)) way is with the XOR operation.</p>
<p>In C:</p>
<pre><code>int arr[] = {3, 2, 5, 2, 1, 5, 3};
int num = 0, i;
for (i=0; i < 7; i++)
num ^= arr[i];
printf("%i\n", num);
</code></pre>
<p>This prints "1", which is the only one that occurs once.</p>
<p>Th... | <p>You could simply put the elements in the set into a hash until you find a collision. In ruby, this is a one-liner.</p>
<pre><code>def find_dupe(array)
h={}
array.detect { |e| h[e]||(h[e]=true; false) }
end
</code></pre>
<p>So, <code>find_dupe([1,2,3,4,5,1])</code> would return 1. </p>
<p>This is actually a c... | 5,561 |
<p>I found this in Handbook of Compliant Mechanisms (2013), page 162, or at the start of "Chapter 11, Elements of Mechanisms," subsection 11.1.2 Revolute</p>
<p>I don't understand how it's supposed to go from 1 to 2 when b rotates around c.</p>
<p>The description reads:</p>
<blockquote>
<p>This element is a r... | <p>The picture looks as if there is a printed back surface to which the central part is attached. This can not be the case, since otherwise the curved members would not be able to flex. Everything inside the outer ring must be detached from the back shell.</p>
<p>Like all couplers, especially flexible couplers, there... | <p>I would try and print it in PLA because it is quite flexible.
ABS is harder in my experience and breaks more easily.
If you are able to print PET, you should also try that for the same reasons.
There might also be better materials I've never heard of, also please leave a comment if I'm wrong with anything.</p>
| 1,711 |
<p>What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:</p>
<pre><code>git log $(git merge-base HEAD branch)..branch
</code></pre>
<p>The documentation for <a href="http://git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> indica... | <p>In the context of a revision list, <code>A...B</code> is how <code>git-rev-parse</code> defines it. git-log takes a revision list. <code>git-diff</code> does not take a list of revisions - it takes one or two revisions, and has defined the <code>A...B</code> syntax to mean how it's defined in the <code>git-diff</cod... | <p>With Git 2.30 (Q1 2021), "git diff A...B(man)" learned "git diff --merge-base A B(man), which is a longer short-hand to say the same thing.</p>
<p>Thus you can do this using <code>git diff --merge-base <branch> HEAD</code>. This should be equivalent to <code>git diff <branch>...HEAD</code>... | 7,708 |
<p>When I create a new project (or even when I edit the Sample Project) there is no way to add Description to the project.</p>
<p>Or am I blind to the obvious?</p>
| <p>There's no such thing as a project description, really. There's a column in the Projects page which is used so you can see which project is the default, built-in inbox, and we couldn't think of anything better to put as the column header for that column.</p>
| <p>The description is mostly for system projects, like e-mail inbox.</p>
<p>You might be able to set one in the underlying DB table.</p>
| 3,545 |
<p>I'm working on an app that grabs and installs a bunch of updates off an an external server, and need some help with threading. The user follows this process:</p>
<ul>
<li>Clicks button</li>
<li>Method checks for updates, count is returned.</li>
<li>If greater than 0, then ask the user if they want to install using ... | <p>Your UI isn't updating because all the work is happening in the user interface thread.
Your call to: </p>
<pre><code>this.BeginInvoke((MethodInvoker)delegate() {update.Action.Run(); })
</code></pre>
<p>is saying invoke update.Action.Run() on the thread that created "this" (your form), which is the user interface ... | <p>Have you tried putting a </p>
<pre><code>Application.DoEvents()
</code></pre>
<p>in here</p>
<pre><code>if (dlgRes == DialogResult.Yes)
{
Application.DoEvents();
ProcessAllUpdates(um2);
}
</code></pre>
| 3,134 |
<p>I was asked this question during an interview. They're both O(nlogn) and yet most people use Quicksort instead of Mergesort. Why is that?</p>
| <p>Quicksort has O(<i>n</i><sup>2</sup>) worst-case runtime and O(<i>n</i>log<i>n</i>) average case runtime. However, it’s superior to merge sort in many scenarios because many factors influence an algorithm’s runtime, and, when taking them all together, quicksort wins out.</p>
<p>In particular, the often-quoted runti... | <p>In c/c++ land, when not using stl containers, I tend to use quicksort, because it is built
into the run time, while mergesort is not.</p>
<p>So I believe that in many cases, it is simply the path of least resistance.</p>
<p>In addition performance can be much higher with quick sort, for cases where the entire data... | 9,579 |
<p>I am currently in an operating systems class and my teacher spent half of the class period talking about PIDs. She mentioned, as many know, that processes know their parent's ID.</p>
<p>My question is this:</p>
<p>Does a process's PCB know its child's ID? If so, what is the way to go about it obtaining it?</p>
| <p>As far as I know a process doesn't have an explicit list of its children's PIDs, but it can easily be built, since a process should know which child processes it spawns. For example the UNIX fork() call returns the child PID in the parent process and 0 in the child process, CreateProcess() on Windows returns (IIRC) ... | <p>Process's PCB know its child's ID.</p>
<p>As we know the Fork() is used to create processes.It takes no arguments and returns a process ID.After a new child process is created both parent and child will execute the next instruction following the fork().
There we have to distinguish the parent from the child.This ca... | 8,487 |
<p>I already found this article:</p>
<p><a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=181&AspxAutoDetectCookieSupport=1" rel="nofollow noreferrer">http://www.dotnetcurry.com/ShowArticle.aspx?ID=181&AspxAutoDetectCookieSupport=1</a></p>
<p>But I've got a different situation. I am embedding some hidde... | <p>Rather than storing the position information in a hidden field, store it in a cookie. The information is small, so it will have minimal effect on the page load performance.</p>
| <p>ok so I got the drag stuff to work, saves in a database and all, brings up cool on my one monitor 1600X1050 all good, fine and dandy! BUT WAIT! I bring up the same page on my other monitor 1366x768 and the panels are all off.</p>
<p>The save function saves in pixels, so when you move over to another "resolution" th... | 7,906 |
<p>I'm using the Repeater control on my site to display data from the database. I need to do pagination ("now displaying page 1 of 10", 10 items per page, etc) but I'm not sure I'm going about it the best way possible.</p>
<p>I know the Repeater control doesn't have any built-in pagination, so I'll have to make my own... | <p>This isn't a way to page the data, but have you looked into the <a href="http://msdn.microsoft.com/en-us/library/bb398790.aspx" rel="nofollow noreferrer">ListView</a> control? It gives the flexibility of repeater / data list but with built in paging like the grid view.</p>
<p>And for paging in sql, you would want t... | <p>This was answered <a href="https://stackoverflow.com/questions/2840/paging-sql-server-2005-results">here</a>.</p>
| 4,298 |
<p>The e3D volcano features an extended heater block of length 20 mm with the cartridge heater running parallel to the filament.</p>
<p>The purpose of this is to increase the speeds at which filament can be printed (of course the extruder and other factors may still be limiting factors).</p>
<p>My question is ho... | <p>Speaking from first hand experience running a Volcano hotend, mostly using a 0.6 mm nozzle, but I have used 0.4 mm as well. I can't really complain about any lower printing speed limit (low speeds are usually a solution to high speeds problems for me).</p>
<p>Just for completeness: I am using a DaVinci 1.... | <p>The worry must be about oozing and stringing. In general, no worries! Nothing a bit of tuning would not fix.</p>
<p>I have experience printing with Volcano with 0.4, 0.6, 0.8, and 1.0 mm diameter.
PLA, PETG, Nylon, TPE, and TPU. (Volcano nozzles have been my default style for several years now. I don't even o... | 1,582 |
<p>I'm trying to access a data source that is defined within a web container (JBoss) from a fat client outside the container.</p>
<p>I've decided to look up the data source through JNDI. Actually, my persistence framework (Ibatis) does this.</p>
<p>When performing queries I always end up getting this error:</p>
<pre... | <p>Not sure if this is the same issue?</p>
<p><a href="http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Connectors_on_JBoss-Configuring_JDBC_DataSources.html" rel="nofollow noreferrer">JBoss DataSource config</a></p>
<blockquote>
<p>DataSource wrappers are not usable outside of ... | <p>I think the exception indicates that the SQLConnection object you're trying to retrieve doesn't implement the Serializable interface, so it can't be passed to you the way you asked for it.</p>
<p>From the limited work I've done with JDNI, if you're asking for an object via JNDI it must be serializable. As far as I ... | 6,006 |
<p>Suppose we have two stacks and no other temporary variable.</p>
<p>Is to possible to "construct" a queue data structure using only the two stacks?</p>
| <p>Keep 2 stacks, let's call them <code>inbox</code> and <code>outbox</code>.</p>
<p><strong>Enqueue</strong>:</p>
<ul>
<li>Push the new element onto <code>inbox</code></li>
</ul>
<p><strong>Dequeue</strong>:</p>
<ul>
<li><p>If <code>outbox</code> is empty, refill it by popping each element from <code>inbox</code> ... | <pre class="lang-java prettyprint-override"><code>public class QueueUsingStacks<T>
{
private LinkedListStack<T> stack1;
private LinkedListStack<T> stack2;
public QueueUsingStacks()
{
stack1=new LinkedListStack<T>();
stack2 = new LinkedListStack<T>();
}... | 9,463 |
<p>A number of forms in my project inherit from a base form. It is easy to get at the Controls collection of the derived forms, but I have not found a simple way to access the Components collection, since VS marks this as private. </p>
<p>I assume this could be done with reflection, but I'm not really sure how best to... | <p>If you set the Modifiers property of your components to strict protected makes them accessible without the use of a components collection. </p>
<p>Edit:
Discoverability could be done using reflection to walk over each field. Although that might be suboptimal in your case.</p>
| <p>If you're worried about forgetting to override the function, then make it abstract.</p>
| 5,104 |
<p>I have some code that modifies a value that several controls in other update panels are bound to. When this event handler fires, I'd like it to force the other update panels to refresh as well, so they can rebind.</p>
<p>Is this possible?</p>
<p>Edit: </p>
<p>To clarify, I have an update panel in one user control... | <p>You can set triggers on the events in the update panel you want updated or you can explicitly say updatepanel.update() in the code behind.</p>
| <p>This is a good technique if you want to refresh updatepanel from <a href="http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/" rel="nofollow noreferrer">client side Javascript</a>.</p>
| 7,898 |
<p>I understand the main function of the lock key word from MSDN</p>
<blockquote>
<p>lock Statement (C# Reference)</p>
<p>The lock keyword marks a statement
block as a critical section by
obtaining the mutual-exclusion lock
for a given object, executing a
statement, and then releasing the
lock.</p>
</... | <blockquote>
<p>When should the lock be used?</p>
</blockquote>
<p>A lock should be used to protect shared resources in multithreaded code. Not for anything else.</p>
<blockquote>
<p>But is it necessary when the application does not spin off any other threads?</p>
</blockquote>
<p>Absolutely not. It's just a t... | <p>There is no point in having locks in the app if there is only one thread and yes, it is a performance hit although it does take a fair number of calls for that hit to stack up into something significant. </p>
| 8,422 |
<p>In a follow-up to a <a href="https://stackoverflow.com/questions/54789/what-is-the-correct-net-exception-to-throw-when-try-to-insert-a-duplicate-objec">previous question</a> regarding exceptions, what are best practices for creating a custom exception in .NET? </p>
<p>More specifically should you inherit from Syst... | <p>Inherit from <code>System.Exception</code>. <code>System.ApplicationException</code> is useless and the design guidelines say "<strong>Do not</strong> throw or derive from <code>System.ApplicationException</code>." </p>
<p>See <a href="http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx" rel="nofollow nor... | <p>I think the single most important thing to remember when dealing with exceptions at any level (making custom, throwing, catching) is that exceptions are only for exceptional conditions.</p>
| 7,848 |
<p>The following code illustrates an object literal being assigned, but with no semicolon afterwards:</p>
<pre><code>var literal = {
say: function(msg) { alert(msg); }
}
literal.say("hello world!");
</code></pre>
<p>This appears to be legal, and doesn't issue a warning (at least in Firefox 3). Is this comple... | <p>Not technically, JavaScript has semicolons as optional in many situations. </p>
<p>But, as a general rule, use them at the end of any statement. Why? Because if you ever want to compress the script, it will save you from countless hours of frustration.</p>
<p>Automatic semicolon insertion is performed by the inter... | <p>This is not valid (see clarification below) JavaScript code, since the assignment is just a regular statement, no different from</p>
<pre><code>var foo = "bar";
</code></pre>
<p>The semicolon can be left out since JavaScript interpreters attempt to add a semicolon to fix syntax errors, but this is an extra and unn... | 6,368 |
<p>In Ultimaker Cura, is there a setting to slow down just the first layer (or two layers) covering over the infill? </p>
<p>I'm not talking about the top layers, since you may have infill covered over during a lower section of the print. And I'm not talking about bridging, since this isn't a true bridge, and quick te... | <p>Cura can do this. It's a bit convoluted though. Here's what you need to do:</p>
<ul>
<li>Load your model / scene in the build plate.</li>
<li>Load an additional cube and make it as big as the entire build plate so that it overlaps with everything (in the preferences you may need to disable "Ensure that models are k... | <p>As far as I know, Cura has no option to do this. Conceptually Cura treats the model as a solid, so that the material over infill is not "overhang". However, you may be able to hack it by using the "magic mesh surface mode" feature under "special modes", to treat the model as a surface rather than a solid, then enabl... | 1,355 |
<p>Does anyone know how to achieve the cover-flow effect using JavaScript to scroll through a bunch of images. I'm not talking about the 3D rotating <em>itunes</em> cover-art, but the effect that happens when you hit the space bar in a folder of documents, allowing you to preview them in a <em>lightbox</em> fashion.</... | <p><a href="http://www.jacksasylum.eu/ContentFlow/" rel="noreferrer">http://www.jacksasylum.eu/ContentFlow/</a></p>
<ul>
<li>is the best I ever found.
a true 'CoverFlow', highly configurable, cross-browser, very smooth action, has relections and supports scroll wheel + keyboard control. - has to be what your looking ... | <p>This one looks really promising, and closer to the actual Apple coverflow effect than the other examples:</p>
<p><a href="http://www.blarnee.com/projects/cflow/" rel="nofollow noreferrer">blarnee.com/projects/cflow</a></p>
| 9,279 |
<p>I am completely new to 3D Printing. I got my first printer a Creality Ender 5 Pro yesterday.</p>
<h3>My problem</h3>
<p>I did shutdown the printer without the axis being in home position (<strong>X: 0, Y: 0, Z: 320</strong> instead of <strong>X: 0, Y: 0, Z: 0</strong>). I thought this should be no problem but after ... | <p>Once you pull the plug or disable power to the stepper motors, the printer forgets its location. That is perfectly normal and exactly how it is supposed to work.</p>
<p>The printer knows where the printer volume is once you have "homed" the printer. Homing is done prior to printing with G-code <a href="htt... | <p>Slightly unscrew the motor. Manually rig the Z-axis above its lowest point. Rescrew the motor back into place tightly. Then auto home it.</p>
| 1,700 |
<p>SVN in Eclipse is spread into two camps. The SVN people have developed a plugin called <a href="http://subclipse.tigris.org/" rel="noreferrer">Subclipse</a>. The Eclipse people have a plugin called <a href="http://www.eclipse.org/subversive/" rel="noreferrer">Subversive</a>. Broadly speaking they both do the same th... | <p>Both are very similar but Subversive is the "eclipse svn provider". I primarily use Subversive because of a few convenient features:</p>
<p><strong>Grouping of history</strong></p>
<p>When I'm browsing the history of a branch instead of just seeing a bunch of rows for every commit it can group commits by today, we... | <p>If you are using Zend Studio 9, Zend's implementation of Eclipse, I recommend using Subclipse instead of Subversive which comes shipped with Zend Studio be default.</p>
<p>I have posted a problem with Subversive and Zend Studio 9 and <a href="http://forums.zend.com/viewtopic.php?f=59&t=42373&p=98993#p98733"... | 8,648 |
<p>We have an application with a good amount of jQuery JSON calls to server side code. Because of this, we have a large amount of binding code to parse responses and bind the appropriate values to the form. This is a two part question.</p>
<ol>
<li><p>What is the reccomended approach for dealing with a large number of... | <p>Not 100% sure example what you are asking, but personally, and I use MochiKit, I create JavaScript "classes" (or widgets, if you prefer) for every significant client-side UI structure. These know, of course, how to populate themselves with data.</p>
<p>I don't know what more there is to say - writing UI code for th... | <p>I think there are multiple challanges for you. The first question is how to structure javascript code, i.e. how to build namespaces so that you don't fight name clashes or have to name your functions like </p>
<pre><code>form1validate
form1aftersubmit
form2validate
form2aftersubmit
</code></pre>
<p>One of the prov... | 5,503 |
<p>In a macro for Visual Studio 6, I wanted to run an external program, so I typed:</p>
<pre><code>shell("p4 open " + ActiveDocument.FullName)
</code></pre>
<p>Which gave me a type mismatch runtime error. What I ended up having to type was this:</p>
<pre><code>Dim wshShell
Set wshShell = CreateObject("WScript.Shell"... | <p>As <a href="https://stackoverflow.com/questions/20272/why-doesnt-shell-work-in-vbscript-in-vs6#20304">lassevk</a> pointed out, VBScript is not Visual Basic.</p>
<p>I believe the only built in object in VBScript is the WScript object.</p>
<pre><code>WScript.Echo "Hello, World!"
</code></pre>
<p>From the docs</p>
... | <p>VB6 uses & to concatenate strings rather than +, and you'll want to make sure the file name is encased in quotes in case of spaces. Try it like this: </p>
<pre><code>Shell "p4 open """ & ActiveDocument.FullName & """"
</code></pre>
| 4,064 |
<p>We have a toy with some broken parts, an Executivity Gear Master. I don't think it's made anymore. Some tiny parts were easy to break and we'd like to 3d print some replacement parts. We don't have CAD or any other 3D drawings file, just a few of the unbroken parts. What's the best way to get some of these printed? ... | <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... | 515 |
<p>I'm using the Infragistics grid and I'm having a difficult time using a drop-down list as the value selector for one of my columns.</p>
<p>I tried reading the documentation but Infragistics' documentation is not so good. I've also taken a look at this <a href="http://news.infragistics.com/forums/p/9063/45792.aspx" ... | <p>Here's an example from one of my pages:</p>
<pre><code>UltraWebGrid uwgMyGrid = new UltraWebGrid();
uwgMyGrid.Columns.Add("colTest", "Test Dropdown");
uwgMyGrid.Columns.FromKey("colTest").Type = ColumnType.DropDownList;
uwgMyGrid.Columns.FromKey("colTest").ValueList.ValueListItems.Insert(0, "ONE", "Choice 1");
uwgM... | <pre><code> public void MakeCellValueListDropDownList(UltraWebGrid grid, string columnName, string valueListName, string[] listArray)
{
//Set the column to be a dropdownlist
UltraGridColumn Col = grid.Columns.FromKey(columnName);
Col.Type = ColumnType.DropDownList;
Col... | 3,602 |
<p>I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. </p>
<p>We've had some success by getting th... | <p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p>
<p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.micros... | <p>If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.</p>
<p><a href="http://support.microsoft.com/kb/303650" rel="nofollow noreferrer">http://support.micros... | 4,229 |
<p>What issues / pitfalls must be considered when overriding <code>equals</code> and <code>hashCode</code>?</p>
| <h3>The theory (for the language lawyers and the mathematically inclined):</h3>
<p><code>equals()</code> (<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)" rel="noreferrer">javadoc</a>) must define an equivalence relation (it must be <em>reflexive</em>, <em>symmetric</em... | <p>One gotcha I have found is where two objects contain references to each other (one example being a parent/child relationship with a convenience method on the parent to get all children).<br>
These sorts of things are fairly common when doing Hibernate mappings for example.</p>
<p>If you include both ends of the rel... | 4,721 |
<p>I am using a Flash Forge Creator, and when I print big parts (only in this case) I have about 25% of the bottom of the printed object sticking very hard to its support layer. And I spend a lot of time removing it with a cutter.</p>
<p>Is there any clue or good practice to avoid that?</p>
<p>I use ReplicatorG for m... | <p>I finally found out two causes:</p>
<ol>
<li><p>The 3D printer has default settings for ABS, and since there is no printer bed settings in ReplicatorG, the bed temperature was set to 110 °C instead of 60°C. I fixed the setting directly on the printer itself.</p></li>
<li><p>It seems that one side of the ... | <p>According to the manufacturer:</p>
<blockquote>
<p>... you are able to choose your favorite software such as
FlashPrint, Simplify3D, Cura and more.</p>
</blockquote>
<p>Not being familiar with ReplicatorG, I know that other slicer software can set the distance between supports and print (in terms of the amount... | 1,234 |
<p>I am trying to improve the performance of a web application. I have metrics that I can use to optimize the time taken to return the main HTML page, but I'm concerned about the external CSS and JavaScript files that are included from these HTML pages. These are served statically, with HTTP Expires headers, but are ... | <p><strong>Context:</strong> While it's true that HTTP overhead is more significant than parsing JS and CSS, ignoring the impact of parsing on browser performance (even if you have less than a meg of JS) is a good way to get yourself in trouble.</p>
<p>YSlow, Fiddler, and Firebug are not the best tools to monitor pars... | <p>I believe <a href="http://developer.yahoo.com/yslow/" rel="nofollow noreferrer">YSlow</a> does, but be aware that unless all requests are over a loopback connection you shouldn't worry. The HTTP overhead of split-up files will impact performance <em>far</em> more than parsing, unless your CSS/JS files exceed several... | 6,916 |
<p>When I purchased my China made Anet A8 printer, it came with the ball bearing style linear bearings for the 8mm guide rods. While pulling parts out of the box and putting them together, I noticed several of the small ball bearings fell out of their respective holders. At the time, I really didn't know what to think ... | <p>According to <a href="https://www.igus.eu/wpck/19864/drylin_plasticvsmetal" rel="noreferrer">igus commercial documentation</a>, these bushings:</p>
<ul>
<li>do not need any kind of lubrication,</li>
<li>are not susceptible to humidity (but your steel rods might) </li>
<li>work seamlessly in presence of dust (it get... | <p>In addition to <a href="https://3dprinting.stackexchange.com/a/6741/5740">this answer</a> and addressing <code>Anything else I'm not thinking of to worry about?</code> I would like to add that you should take care in installing the plastic bearings in suitable housings. It is best to lower the mass of the carriages ... | 1,013 |
<p>In a <a href="https://stackoverflow.com/questions/21848/switch-branch-names-in-git">previous Git question</a>, Daniel Benamy was talking about a workflow in Git:</p>
<blockquote>
<p>I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and t... | <p>'stash' takes the uncommitted, "<em>dirty</em>" stuff on your working copy, and stashes it away, leaving you with a clean working copy.</p>
<p>It doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do:</p>
<pre><code>git stash branch <branchname> ... | <p>If you look for a workflow that may be more fitting than git stash, you may want to look at <a href="https://github.com/da-x/git-bottle" rel="nofollow" title="git-bottle">git-bottle</a>. It's a utility for the purpose of saving and restoring the various git working states as normal git commits, effectively snapshott... | 6,075 |
<p>Is there an automatic way in SQL Server 2005 to create a database from several tables in another database? I need to work on a project and I only need a few tables to run it locally, and I don't want to make a backup of a 50 gig DB.</p>
<p><strong>UPDATE</strong></p>
<p>I tried the Tasks -> Export Data in Manageme... | <p>You can use the <a href="http://www.codeplex.com/sqlhost/wiki/view.aspx?title=database%20publishing%20wizard" rel="nofollow noreferrer">Database Publishing Wizard</a> for this. It will let you select a set of tables with or without the data and export it into a .sql script file that you can then run against your oth... | <ol>
<li>Create new database</li>
<li>Right click on it,</li>
<li>Tasks -> Import Data</li>
<li>Follow instructions</li>
</ol>
| 4,415 |
<p>I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to access a model from inside another mode, or a better way to handle authentication i... | <p>In general, you don't want to create objects inside an object. That's a bad habit, instead, write a clear API and inject a model into your model.</p>
<pre><code><?php
// in your controller
$model1 = new Model1();
$model2 = new Model2();
$model2->setWhatever($model1);
?>
</code></pre>
| <p>Don't handle authentication in your model. Only use models to interface with your database, or ldap or whatever.</p>
<p>I created an Auth library that I use to manage authentication and authorization. You can access a library like this from your controllers.</p>
| 6,842 |
<p>All of my Visio experience is with LAN/WAN documentation. I recently had a desire to visualize the relationship between <a href="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html" rel="nofollow noreferrer">objects</a> in the <a href="http://www.nagios.org/" rel="nofollow noreferrer">Nagios</a> configura... | <p>I just built a quad core - 8 GB of RAM and run Server 2008 with Hyper-V on it. I have VMs for my build server, dev platform, and deployment options (XP, Vista, Server 2003/2008) with snapshots at the various service pack levels. What's nice is you can spin up a VM whenever you need it, and re-allocate the resource... | <p>People are probably going to yell at me...but I've found that Vista 64 is mostly worth it. The main reason for me though is that I'm always maxing out my memory and having a 64bit OS allows me to go past the <4GB limit of 32bit.</p>
<p>But even if you don't get 64bit, just buy 2 2GB RAM cards anyways....you wil... | 3,636 |
<p>I haven't been able to find an understandable explanation of how to actually use Python's <code>itertools.groupby()</code> function. What I'm trying to do is this:</p>
<ul>
<li>Take a list - in this case, the children of an objectified <code>lxml</code> element</li>
<li>Divide it into groups based on some criteria<... | <p><strong>IMPORTANT NOTE:</strong> You have to <strong>sort your data</strong> first.</p>
<hr />
<p>The part I didn't get is that in the example construction</p>
<pre><code>groups = []
uniquekeys = []
for k, g in groupby(data, keyfunc):
groups.append(list(g)) # Store group iterator as a list
uniquekeys.append... | <p>One useful example that I came across may be helpful:</p>
<pre><code>from itertools import groupby
#user input
myinput = input()
#creating empty list to store output
myoutput = []
for k,g in groupby(myinput):
myoutput.append((len(list(g)),int(k)))
print(*myoutput)
</code></pre>
<p>Sample input: 14445221... | 2,321 |
<p>I was asked this question in a job interview. The interviewer and I disagreed on what the correct answer was. I'm wondering if anyone has any data on this.</p>
<p>Update: I should have mentioned that the use of shuffle() was strictly forbidden... sorry.</p>
| <p>You could use the <a href="http://en.wikipedia.org/wiki/Knuth_shuffle" rel="nofollow noreferrer">Fisher-Yates shuffle</a>.</p>
| <p>The "correct" way is pretty vague. The best (fastest / easiest / most elegant) to sort an array would be to just use the built-in shuffle() function.</p>
| 9,161 |
<p>What kind of programming problems are state machines most suited for?</p>
<p>I have read about parsers being implemented using state machines, but would like to find out about problems that scream out to be implemented as a state machine.</p>
| <p>The easiest answer is probably that they are suited for practically any problem. Don't forget that a computer itself is also a state machine.</p>
<p>Regardless of that, state machines are typically used for problems where there is some stream of input and the activity that needs to be done at a given moment depends... | <p>Things that comes to mind are:</p>
<blockquote>
<ul>
<li>Robot/Machine manipulation... those robot arms in factories</li>
<li>Simulation Games, (SimCity, Racing Game etc..)</li>
</ul>
</blockquote>
<p>Generalizing: When you have a string of inputs that when interacting with anyone of them, requires the kno... | 6,182 |
<p>Suppose I have <code>fileA.h</code> which declares a class <code>classA</code> with template function <code>SomeFunc<T>()</code>. This function is implemented directly in the header file (as is usual for template functions). Now I add a specialized implementation of <code>SomeFunc()</code> (like for <code>Some... | <p>It is <strong>an error</strong> to have a specialization for a template which is not visible at the point of call. Unfortunately, compilers are not required to diagnose this error, and can then do what they like with your code (in standardese it is "ill formed, no diagnostic required").</p>
<p>Technically, you need... | <p>Unless the specialized template function is also listed in the header file, the other application will have no knowledge of the specialized version. The solution is the add <code>SomeFunc<int>()</code> to the header as well.</p>
| 8,391 |
<p><a href="http://www.5axismaker.com/5axis/" rel="nofollow noreferrer">5AxisMaker</a> has a 5 axis CNC/3D printer combo machine. I understand what the benefits of 5 axis are for CNC machines, but are there any benefits for 3D printing. In this <a href="https://youtu.be/w8Fl8L4yk8M" rel="nofollow noreferrer">video</a... | <p>One aspect of having this level of control with 3d printing of a model is the removal of the need for supports and the attendant post-processing. In the case of the model shown in the video, some effects are created by printing the continents in a conformal manner that would otherwise be impossible with conventional... | <p>Slicing prints for printing in 5 Axis is not going to be simple with the current software. If you look at the web site for the 5AxisMaker you can see they are using Algorithmic modeling software (Grasshopper). You would probably need to buy this as well and then spend a decent amount of time learning how to use this... | 428 |
<p>I am using git on a project, that generates lots of data-files (simulation-results).
I am "forced" to version and track all those results in the same repository. (This is a hard requirement and can not be changed)</p>
<p>However I don't need them. We have about 50 MB for the project and 5 GB results in the reposit... | <p>If you were to make a branch and delete the result files from the branch, then merging your branch back into master would also try to delete the results from master. A file delete is a change just like any other.</p>
<p>Perhaps you could use the git submodule support to manage your code changes as a submodule of th... | <p>Besides git cherry-pick, another alternative is to run git-revert on the file delete change just before merging.</p>
| 9,680 |
<p>Is there a way to use sql-server like analytic functions in Hibernate?</p>
<p>Something like </p>
<pre><code>select foo from Foo foo where f.x = max(f.x) over (partition by f.y)
</code></pre>
| <p>You are after a native SQL query.</p>
<p>If you are using JPA the syntax is:</p>
<pre><code>Query q = em.createNativeQuery("select foo.* from Foo foo " +
"where f.x = max(f.x) over " +
"(partition by f.y)", Foo.class);
</code></pre>
<p>If you need to r... | <p>Another approach would be to use the mapping. Please see this article: <a href="https://forums.hibernate.org/viewtopic.php?f=1&t=998482" rel="nofollow noreferrer">https://forums.hibernate.org/viewtopic.php?f=1&t=998482</a></p>
<p>I am against the usage of native SQL queries in Hibernate... you lose the bene... | 9,976 |
<p>I'm sure you have all been there, you take on a project where there is a creaky old code base which is barely fit for purpose and you have to make the decision to either re-write it from scratch or repair what already exists. </p>
<p>Conventional wisdom tends to suggest that you should never attempt a re-write fro... | <p>It really depends on how bad it is.</p>
<p>If it's a small system, and you fully understand it, then a rewrite is not crazy.</p>
<p>On the other hand, if it's a giant legacy monster with ten million lines of undocumented mystery code, then you're really going to have a hard time with a full rewrite.</p>
<p>Points... | <p>It's not so black and white... it really depends on a lot of factors (the more important being "what does the person paying you want you to do")</p>
<p>Where I work we re-wrote a development framework, and on the other hand, we keep modifying some old systems that cannot be migrated (because of the client's technol... | 5,568 |
<p>My G29 command reports</p>
<pre><code>+0.178 +0.281 +0.830
-0.614 -0.012 +0.371
-1.208 -0.849 -0.351
</code></pre>
<p>So should I tighten up the screw of the bed, close to 0,0 position or loosen it?</p>
<p>I have a feeling that when I loosen it, it gets away from zero and I expect the opposite to happen.</p>
<p>... | <p>Using Repetier Host V2.1.2 and slicing with Slic3r (or with CuraEngine), there is an "edit Gcode" button under the Print Preview tab. It is located at the top right of the screen. With that button you can access, examine and change the Gcode of the project you are working on.</p>
| <p>After you use the Slice Now button (and the slicing progress bar shows completed), select the preview tab. To the right of the window you will see a pair of vertical sliders. Each slider changes the start and finish locations for the filament layers.</p>
<p>You can slide the left one to the bottom, which will "empt... | 944 |
<p>I know there is a 3d printing technique, where sheet of papers are cut and glued. Like the ones <a href="http://www.gizmag.com/staples-mcor-easy-3d-printing/25284/" rel="nofollow">Staples</a> has in their stores. But this sort of paper isnt recyclable, because of the heavy use of glue.</p>
<p>Is anywhere filament a... | <p>Filament made of Polylactic acid (<a href="http://reprap.org/wiki/PLA" rel="nofollow">PLA</a>) is usually made of biological materials (such as corn), and can therefore be considered bio-degradable in most cases.</p>
<p>Whether the filament is 100% bio-degradable (and non-toxic for the surroundings) will depend on ... | <p>Check Green-TEC by <a href="http://extrudr.eu/collections/bdp" rel="nofollow">extrudr.eu</a> is made from lignin (wood)
or perhaps Algix Dura. They are both bio degradeable.
Green-TEC ist my favorite because of less warping and <a href="https://www.youtube.com/watch?v=Oqx170kPmg4" rel="nofollow">fast printing</a>.</... | 284 |
<p>What is the difference, what is the official terms, are any terms obsolete in ASP.NET 3.5?</p>
| <p><strong>UserControl</strong>: A custom control, ending in .ascx, that is composed of other web controls. Its almost like a small version of an aspx webpage. It consists of a UI (the ascx) and codebehind. Cannot be reused in other projects by referencing a DLL.</p>
<p><strong>WebControl</strong>: A control host... | <p>Since I don't have enough reputation yet to comment, I'll add this as an answer, but it refers to Will's answer above.</p>
<p>From the <a href="http://msdn.microsoft.com/en-us/library/aa479016.aspx" rel="nofollow noreferrer">link</a> you included:</p>
<blockquote>
<p>Composite controls are the right tool to arch... | 9,653 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.