Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>Doug McCune had created something that was exactly what I needed (<a href="http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/" rel="nofollow noreferrer">http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/</a>) but alas - it was for AIR be...
<p>There is a Code Metrics Explorer in the Enterprise Flex Plug-in below:</p> <p><a href="http://www.deitte.com/archives/2008/09/flex_builder_pl.htm" rel="nofollow noreferrer">http://www.deitte.com/archives/2008/09/flex_builder_pl.htm</a></p>
<p>To get a rough estimate, you could always run <code>find . -type f -exec cat {} \; | wc -l</code> in the project directory if you're using Mac OS X. </p>
5,607
<p>Does anybody have experience working with PHP accelerators such as <a href="http://turck-mmcache.sourceforge.net/" rel="noreferrer">MMCache</a> or <a href="http://www.zend.com/en/" rel="noreferrer">Zend Accelerator</a>? I'd like to know if using either of these makes PHP comparable to <em>faster</em> web-technologi...
<p>Note that Zend Optimizer and MMCache (or similar applications) are totally different things. While Zend Optimizer tries to optimize the program opcode MMCache will cache the scripts in memory and reuse the precompiled code.</p> <p>I did some benchmarks some time ago and you can find the <a href="http://blogs.interd...
<p>Have you checked out Phalanger? It compiles PHP to .NET code. Here are <a href="http://web.archive.org/web/20101126094453/http://php-compiler.net/doku.php?id=core%3abenchmarks" rel="nofollow noreferrer">some benchmarks</a> which show that it can dramatically improve performance.</p>
3,402
<p>In Tomcat 5.5 the server.xml can have many connectors, typically port only 8080, but for my application a user might configure their servlet.xml to also have other ports open (say 8081-8088). I would like for my servlet to figure out what socket connections ports will be vaild (During the Servlet.init() tomcat has ...
<p>In Tomcat 6.0 it should be something like:</p> <pre><code>org.apache.catalina.ServerFactory.getServer().getServices </code></pre> <p>to get the services. After that you might use </p> <pre><code>Service.findConnectors </code></pre> <p>which returns a Connector which finally has the method</p> <pre><code>Connec...
<p>Why?</p> <p>If you need during page generation for a image or css file URL, what's wrong with <a href="http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getLocalPort()" rel="nofollow noreferrer">ServletRequest.getLocalPort()</a> or, better yet, <a href="http://java.sun.com/javaee/5/docs/api/ja...
9,128
<p>I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns.</p> <p>So with MVP, the Presenter handles events raised by the View. Here's some code that I have in place to deal with the creation...
<p>That sounds just right to me. Exceptions are preferable as they can be thrown up to the top of the service layer from anywhere inside the service layer, no matter how deeply nested inside the service method implementation it is. This keeps the service code clean as you know the calling presenter will always get noti...
<p>In reply to the follow-up question:</p> <p>As for creating exceptions becoming tedious, you kinda get used to it. Use of a good code generator or template can create the exception class with minimal hand editing within about 5 or 10 seconds. </p> <p>However, in many real world applications, error handling can be 7...
4,181
<p>I have CruiseControl.NET Version 1.4 set up on my development server. Whenever a developer checks in code, it makes a compile. </p> <p>Now we're at a place where we can start giving our application to the testers. We'd like to use ClickOnce to distribute the application, with the idea being that when a tester go...
<p>We've done this and can give you some pointers to start.</p> <p>2 things you should be aware of:</p> <ul> <li>MSBuild can generate the necessary deployment files for you.</li> <li>MSBuild won't deploy the files to the FTP or UNC share. You'll need a separate step for this.</li> </ul> <p>To use MSBuild to generate...
<p>You want to use the ClickOnce manifest generation tasks in msbuild. The process is a little long winded, so I am just going to point you to a couple of links. Here is the <a href="http://msdn.microsoft.com/en-us/library/6wc2ccdc.aspx" rel="nofollow noreferrer">reference on msdn</a> and a <a href="http://windowscli...
3,349
<p>I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs of some assets along with their specifications. Currently the images are stored in an MS-Access table as an OLE Object (and copy-n-pasted into the field by the users).</p> <p>For various reasons, I would like to do is st...
<p>Another option is to put an image control on your form. There is a property of that control (Picture) that is simply the path to the image. Here is a short example in VBA of how you might use it.</p> <p>txtPhoto would be a text box bound to the database field with the path to the image imgPicture is the image con...
<p>The easiest way is probably to plop an Internet Explorer onto one of your forms. Check out this site: <a href="http://www.acky.net/tutorials/vb/wbrowser/" rel="nofollow noreferrer">http://www.acky.net/tutorials/vb/wbrowser/</a></p> <p>Since you can reference that object in Access, you will only need to point the we...
6,130
<p>I have a class with a bunch of properties that look like this:</p> <pre><code>public string Name { get { return _name; } set { IsDirty = true; _name = value; } } </code></pre> <p>It would be a lot easier if I could rely on C# 3.0 to generate the backing store for these, but is there any way to factor out t...
<p><strong>No. Not without writing considerably more (arcane?) code than the original version</strong> (You'd have to use reflection to check for the attribute on the property and what not.. did I mention it being 'slower').. This is the kind of duplication I can live with.</p> <p>MS has the same need for <a href="htt...
<p>The other alternative might be a code generator such as codesmith to automate creating the properties. This would be especially useful if the properties you are creating are columns in a database table</p>
8,899
<p>Is there a risk of legal trouble if you include GPL or LGPL licensed icons in a closed source software? </p> <p>Would it force it to become open source just to include the icon?</p> <p>Does it matter if the icon is compiled as a resource?</p> <p>Are the creative common licensed icons safe to use if you follow t...
<p>For GPL, yes. Any GPL Code/Content that's compiled into your Application or the Package will make it GPL. (Edit: What could be safe is if the Icon is a separate file and is used. That could be a grey area, as you are not using GPL Code to access it. But any attempt to embed it will force your program to GPL, it's on...
<p>It's a tricky area, at a minimum you should probably arrange for the icons to be loaded at run time so that they can be replaced with other versions, this is at least the spirit of the GPL. </p> <p>An article discusses this at <a href="http://www.linux.com/feature/119212" rel="nofollow noreferrer">http://www.linux....
7,035
<p>My current view is no, prefer Transact SQL stored procedures because they are a lighter weight and (possibly) higher performing option, while CLR procedures allow developers to get up to all sorts of mischief.</p> <p>However recently I have needed to debug some very poorly written TSQL stored procs. As usual I fou...
<p>There are places for both well-written, well-thought-out T-SQL and CLR. If some function is not called frequently and if it required extended procedures in SQL Server 2000, CLR may be an option. Also running things like calculation right next to the data may be appealing. But solving bad programmers by throwing in n...
<p>I would add a couple of reasons to use CLR that may not have been mentioned.</p> <ul> <li>Replace and extend basic query, non-query, and scalar sql functions.<br> A) Error reporting and alerts can be integrated based upon defined requirements. B) Easily define debugging levels. C) Enable an easier way to interact w...
8,259
<p>Hopefully, I can get answers for each database server.</p> <p>For an outline of how indexing works check out: <a href="https://stackoverflow.com/questions/1108/how-does-database-indexing-work">How does database indexing work?</a></p>
<p>The following is SQL92 standard so should be supported by the majority of RDMBS that use SQL:</p> <pre><code>CREATE INDEX [index name] ON [table name] ( [column name] ) </code></pre>
<p>Since most of the answers are given for SQL databases, I am writing this for NOSQL databases, specifically for MongoDB.</p> <p>Below is the syntax to create an index in the MongoDB using mongo shell.</p> <pre><code>db.collection.createIndex( &lt;key and index type specification&gt;, &lt;options&gt; ) </code></pre>...
2,357
<p>If you were to self-fund a software project which tools, frameworks, components would you employ to ensure maximum productivity for the dev team and that the "real" problem is being worked on.</p> <p>What I'm looking for are low friction tools which get the job done with a minimum of fuss. Tools I'd characterize as...
<ul> <li><strong>Versioning.</strong> <em>Subversion</em> is the popular choice. If you can afford it, <em>Team Foundation Server</em> offers some benefits. If you want to be super-modern, consider a distributed versioning system, such as <em>git</em>, <em>bazaar</em> or <em>Mercurial</em>. Whatever you do, don't use S...
<p>I'd definitely recommend Coderush+Refactor or Resharper (Coderush being my personal favourite), these tools dramatically reduce the time to go from code in your head to code on the page.</p> <p>For quick development the UI component sets from the likes of Telerik/DevExpress/Infragistics can be good, but in my exper...
8,633
<p>How do you back up your development machine so that in the event of a catastrophic hardware malfunction, you are up and running in the least amount of time possible?</p>
<p>There's an important distinction between backing up your development machine and backing up your work.</p> <p>For a development machine your best bet is an imaging solution that offers as near a "one-click-restore" process as possible. TimeMachine (Mac) and Windows Home Server (Windows) are both excellent for this ...
<p>Maybe just a simple hardware hard disk raid would be a good start. This way if one drive fails, you still have the other drive in the raid. If something other than the drives fail you can pop these drives into another system and get your files quickly.</p>
4,638
<p>Are there any <strong>tools</strong> to facilitate a migration from <a href="http://www.sourcegear.com/vault/index.html" rel="noreferrer">Sourcegear's Vault</a> to <a href="http://subversion.tigris.org/" rel="noreferrer">Subversion</a>?</p> <p>I'd really prefer an existing tool or project (I'll buy!).</p> <p><stro...
<p>We are thinking about migrating from vault to git. I wrote vault2git converter that takes care of history and removes vault bindings from *.sln, *.csproj files.</p> <p>Once you have git repo, there is git2svn.</p> <p>I know it sounds like going rounds, but it might be faster than writing vault2svn from scratch.</p...
<p>Free. The vault user license costs have tripled since we went to it.</p>
8,181
<p>I am writing a Java utility that helps me to generate loads of data for performance testing. It would be <em>really</em> cool to be able to specify a regex for Strings so that my generator spits out things that match this.</p> <p>Is something out there already baked that I can use to do this? Or is there a library ...
<p><strong>Edit:</strong></p> <p>Complete list of suggested libraries on this question:</p> <ol> <li><a href="https://code.google.com/archive/p/xeger/" rel="noreferrer">Xeger</a>* - Java</li> <li><a href="https://github.com/mifmif/Generex" rel="noreferrer">Generex</a>* - Java</li> <li><a href="https://github.com/curiou...
<p>If you want to generate "critical" strings, you may want to consider:</p> <p>EGRET <a href="http://elarson.pythonanywhere.com/" rel="nofollow noreferrer">http://elarson.pythonanywhere.com/</a> that generates "evil" strings covering your regular expressions</p> <p>MUTREX <a href="http://cs.unibg.it/mutrex/" rel="no...
4,211
<p>Laboratory centrifuges have buckets that hold the sample tubes in inserts.</p> <p>The buckets are the black things on the rotor in the upper left corner holding the bottles. Examples of inserts are shown below (the colorful containers with slots for tubes). These fit into the buckets and I'd like to print them sinc...
<p>It's difficult to determine if the buckets are fully enclosed, but I suspect that they are. The enclosure into which the inserts are placed will provide some structural support. </p> <p>3D printed objects have relatively low torsion strength, but a reasonable compression strength, especially with high infill levels...
<p>The primary printer I use is a makerbot, and my gut is saying no. </p> <p>150G's of loading even in the XY axis seems pretty excessive for a part made on a Makerbot. Also, given that this is a rotational, the weight and balance will need to be held to a pretty high tolerance otherwise you'll end up having an off-ba...
551
<p>I'm not sure whether I'm asking the question correctly, but I've been told SQL Server cannot run on a Novell server. Is this true? If yes, why not?</p>
<p>NOW I see your problem! Sorry dude!</p> <p>Yes, VERY easy. Kinda.</p> <p>SQL Server used to be able to talk IPX (the netware protocol) but I think Netware will now talk TCPIP, and you can run IPX and TCP/IP on the same network without an issue - windows clients can run both at the same time, 99% of routers handle ...
<p>The core issue is how are you authenticating to the SQL database. If you have an Active Directory tree, and an eDirectory you can easily link the two via Novell Identity Manager, which will synchronize users, groups, etc (any object you care to map between the two systems) as well as passwords.</p> <p>Thus the sam...
5,206
<p>Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly.</p>
<p>If you have access to GCC/G++, then the <a href="http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options" rel="noreferrer"><code>-M</code> option</a> will output the dependency list. It doesn't do any of the extra stuff that the other tools do, but since it is coming from the compiler, ther...
<p><a href="http://www.scitools.com/products/understand/" rel="nofollow noreferrer">Understand for C++</a> should be able to help you: it builds a database that you can access from Perl.</p>
6,375
<p>I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this:</p> <blockquote> <p>[======>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs...
<p>There are two ways I know of to do this:</p> <ul> <li>Use the backspace escape character ('\b') to erase your line</li> <li>Use the <code>curses</code> package, if your programming language of choice has bindings for it.</li> </ul> <p>And a Google revealed <a href="http://en.wikipedia.org/wiki/ANSI_escape_code" re...
<p>If your using a scripting language you could use the "tput cup" command to get this done... P.S. This is a Linux/Unix thing only as far as I know...</p>
8,506
<p>I'm trying to serialize a Type object in the following way:</p> <pre><code>Type myType = typeof (StringBuilder); var serializer = new XmlSerializer(typeof(Type)); TextWriter writer = new StringWriter(); serializer.Serialize(writer, myType); </code></pre> <p>When I do this, the call to Serialize throws the followin...
<p>I wasn't aware that a Type object could be created with only a string containing the fully-qualified name. To get the fully qualified name, you can use the following:</p> <pre><code>string typeName = typeof (StringBuilder).FullName; </code></pre> <p>You can then persist this string however needed, then reconstruc...
<p>Just looked at its definition, it is not marked as Serializable. If you really need this data to be serialize, then you may have to convert it to a custom class that is marked as such.</p> <pre><code>public abstract class Type : System.Reflection.MemberInfo Member of System Summary: Represents type declaration...
3,336
<p>I have a new Creality Ender 3.</p> <p>I suspect that I have not adjusted the eccentric nuts correctly, on the X-axis head carriage mounts. </p> <p>Even after a glass bed upgrade, using the Level Corners routine of the TH3D firmware, I can get the head to scrape a sheet of paper all 4 corners but that same sheet o...
<p>This seems to be a common problem with ender-3 and cr-10 printers from Creality. Mine is the same way but not enough to keep prints from adhering. </p> <p>Typically the aluminum bed is not perfectly flat. If it’s not the glass may be able to flex enough that it can make a difference. There are a few ways to try to ...
<p>I had the same exact issue, you have to make sure all of your printer is leveled, start with the base, than the poles that hold your x axis gantry. there are numerous youtube videos on how to do that.. make sure it's all leveled and try again.. this tip helped a few people already</p>
1,317
<p>I drew a fairly simple model in Google SketchUp. I exported it as an STL. I imported it into Cura and exported as gcode. Then I printed the model.</p> <p>All of the bottom layers of the model cover the entire space instead of leaving the two open gaps that should exist. I don't know why it's happening. Do I have so...
<p>I suspect, as I am wont to do, that your problem lies in the STL created by SketchUp. It's an unfortunate aspect of that program that it creates non-manifold models which creates troubles such as this. </p> <p>Consider to load your STL file into a program suitable for showing flaws (and repairing them) to determine...
<p>You have a problem with your STL file. Check the orientation of the faces of your 3D model, if that is not the problem, search for a software to fix your stl file. Just a tip, give Fusion360 a try, it is the best!</p>
758
<p>Given the following:</p> <pre><code>List&lt;List&lt;Option&gt;&gt; optionLists; </code></pre> <p>what would be a quick way to determine the subset of Option objects that appear in all N lists? Equality is determined through some string property such as option1.Value == option2.Value.</p> <p>So we should end up wi...
<p>Ok, this will find the list of Option objects that have a Value appearing in <em>every</em> list.</p> <pre><code>var x = from list in optionLists from option in list where optionLists.All(l =&gt; l.Any(o =&gt; o.Value == option.Value)) orderby option.Value select option; </code></pre...
<p>Sort, then do something akin to a merge-sort.</p> <p>Basically you would do this:</p> <ol> <li>Retrieve the first item from each list</li> <li>Compare the items, if equal, output</li> <li>If any of the items are before the others, sort-wise, retrieve a new item from the corresponding list to replace it, otherwise,...
6,242
<p>Say I have:</p> <pre><code>&lt;ul&gt; &lt;li id="x"&gt; &lt;a href="x"&gt;x&lt;/a&gt; &lt;/li&gt; &lt;li id="y"&gt; &lt;a href="y"&gt;y&lt;/a&gt; &lt;ul&gt; &lt;li id="z"&gt; &lt;a href="z"&gt;z&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; ...
<p>I would use XSLT. You can specify to search for nodes that are ancestors of z .</p>
<p>I suggest you parse it into a DOM and recurse backwards like you were thinking. Regular expressions don't work very well for nested structures with arbitrary nesting levels.</p>
8,110
<p>Things like <code>$log$</code> and <code>$version$</code> which add data upon check-in to the file. I'm interested in seeing the other ones and what information they can provide, but I can't get much info unless I know what they are called.</p>
<p>Both Subversion and CVS call them <code>Keywords</code>.</p> <p><a href="http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3" rel="nofollow noreferrer">Have a look in the SVN manual here</a> (scroll down to <strong>svn:keywords</strong>) or <a href="http://badgertronics.com/writings/cvs/keywords.html"...
<p>These are Keyword substitutions. The link to SVNBook 1.8 is here: <a href="http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.keywords.html" rel="nofollow noreferrer" title="Subversion Keywords">http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.keywords.html</a>.</p> <p>Subversion's built-in ...
6,092
<p>I found some informations about controlling IIS 5.1 from command line via adsutil.vbs (<a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Libra...
<p>The microsoft official way is just to copy them into the relevant folders (as seen by downloading their template packs). However, you could also create your own site definition and add the items to the correct libraries and lists in the same way that the master pages are added.</p> <p>If you are going to deploy CS...
<p>Consider uploading them to "Style Library" in the root of the site collection. <p>If you don't have a "Style Library" at the root, consider making one -- it's just a document library. <p>Make sure the permissions are set correctly so everyone who needs to read it can. <p>You can reference them using "/Style%20Librar...
7,713
<p>For a typical business application, should the focus be on client processing via AJAX i.e. pull the data from the server and process it on the client or would you suggest a more classic ASP.Net approach with the server being responsible for handling most of the UI events? I find it hard to come up with a good 'defau...
<p>It really depends on the application and the situation, but just keep in mind that every hit to the server is costly, both in adding load (perhaps minimally), but also in terms of UI responsiveness. I am of the mind that doing things in JavaScript when possible is a good idea, if it can make your UI feel snappier.<...
<p>Do you need to trust the data? If so, be aware that it's trivial to tamper with client-processed data in nasty and malicious ways. If that's the case, you'll want to process info on the server.</p> <p>Also, be aware that it can be a lot harder to code javascript apps so they are stable, reliable, and bug free. Can ...
6,198
<p>I am using xampp on Windows, but I would like to use something closer to my server setup.</p> <p><a href="http://phpimpact.wordpress.com/2008/05/24/virtual-appliances-lamp-development-made-easy/" rel="nofollow noreferrer">Federico Cargnelutti tutorial</a> explains how to setup LAMP VMWARE appliance; it is a great i...
<p>This is my install scrpt, I use it on debian servers, but it will work in Ubuntu (Ubuntu is built on Debian)</p> <pre><code>apt-get -yq update apt-get -yq upgrade apt-get -yq install sudo apt-get -yq install gcc apt-get -yq install g++ apt-get -yq install make apt-get -yq install apache2 apt-get -yq install php5 ap...
<p>I don't really understand your question because i really didn't see one. But i'll do my best to infer two: to change your keyboard layout, check this <a href="http://ubuntuforums.org/showthread.php?t=884533&amp;highlight=change+keyboard+layout" rel="nofollow noreferrer">forum post</a> on ubuntu forums and to change ...
3,581
<p>Since the keyboard is <strong>the</strong> interface we use to the computer, I've always thought touch typing should be something I should learn, but I've always been, well, lazy is the word. So, anyone recommend any good touch typing software?</p> <p>It's easy enough to google, but I'ld like to hear recommendation...
<p><a href="http://en.wikipedia.org/wiki/Typing_of_the_Dead" rel="nofollow noreferrer">Typing of the Dead!</a></p> <p>It's a good few years old so you may have to hunt around, but it's a lot of fun and as well as the main game there are numerous minigames to practice specific areas you may be weak on.</p> <p><img src...
<p>I've been using <a href="http://www.typefastertypingtutor.com/" rel="nofollow noreferrer">TypeFaster</a>. It's not pretty, but one nice feature is that it can load lessons in different keyboard layouts, like Colemak (<a href="http://colemak.com/Learn" rel="nofollow noreferrer">layout files here</a>) or Dvorak.</p>
3,165
<p>I've heard that using hairspray is useful for keeping the 3D objects from peeling off of the bed, but every example I have seen where someone uses hairspray, they use it on a glass bed.</p> <p>Is it okay to use it on a metal bed as well?</p>
<p>I have been using a sort of a very strong hairspray called 3DLAC for about 2 years directly onto the aluminium heat bed of the Anet A8 printer I have.</p> <p>Basically, all those sprays contain copolymer constituents, PVA (PolyVinyl Alcohol), Vinyl or Acetate. These are also found in certain glue sticks or wood g...
<p>Do you mean bare metal or metal with some film on top? You can apply hair spray to bare metal, but you will have troubles cleaning it off. Solvents do not evaporate hair spray, they only turn it into thick sticky goo you will need to clean off. I recommend that you try glue stick or even beer (seriously) before hair...
541
<p>We need to build an administration portal website to support our client/server application. Since we're a .Net shop the obvious traditional way would be to do that in ASP.Net. But Silverlight 2 will be coming out of beta a good while before our release date. Should we consider building the whole website in silverlig...
<p>I would recommend against building a pure Silverlight site.</p> <p>Silverlight suffers from the same issues as Flash does: Unintuitive Bookmarking, issues with printing, accessibility issues, not working back buttons and so on.</p> <p>Also, you would require your users to have Silverlight installed or at least to ...
<p>There are some <a href="https://stackoverflow.com/questions/56266/using-silverlight-for-an-entire-website#56302">downsides</a> with developing a site completely in Flash / Silverlight, but if those downsides won't matter to you or won't have an impact then there is nothing stopping you. Choose whatever tool you thin...
8,015
<p>Is there a way to hide radio buttons inside a RadioButtonList control programmatically?</p>
<p>Under the hood, you can access the attributes of the item and assign it a CSS style.</p> <p>So you should be able to then programmatically assign it by specifying:</p> <pre><code>RadioButtonList.Items(1).CssClass.Add("visibility", "hidden") </code></pre> <p>and get the job done.</p>
<p>If you mean with JavaScript, and if I remember correctly, you've got to dig out the ClientID properties of each &lt;input type="radio" ...&gt; tag.</p>
5,338
<p>Is there a one statement or one line way to accomplish something like this, where the string s is declared AND assigned the first non-null value in the expression?</p> <pre><code>//pseudo-codeish string s = Coalesce(string1, string2, string3); </code></pre> <p>or, more generally,</p> <pre><code>object obj = Coale...
<p>As Darren Kopp said.</p> <p>Your statement</p> <pre><code>object obj = Coalesce(obj1, obj2, obj3, ...objx); </code></pre> <p>Can be written like this:</p> <pre><code>object obj = obj1 ?? obj2 ?? obj3 ?? ... objx; </code></pre> <p>to put it in other words:</p> <pre><code>var a = b ?? c; </code></pre> <p>is equ...
<p>the <strong>??</strong> operator.</p> <pre><code>string a = nullstring ?? "empty!"; </code></pre>
6,383
<p>Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system.</p> <pre><code>private Boolean is64BitOperatingSystem() { RegistryKey localEnvironment = Registr...
<p>Take a look at Raymond Chens solution:</p> <p><a href="http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx" rel="nofollow noreferrer">How to detect programmatically whether you are running on 64-bit Windows</a></p> <p>and here's the PINVOKE for .NET:</p> <p><a href="http://www.pinvoke.net/default.asp...
<p>Looking into the registry is perfectly valid, so long as you can be sure that the user of the application will always have access to what you need.</p>
2,595
<p>I have a site, which contains several ashx handlers, on a couple of the handlers I want to reject non-SSL requests. Is there a way that I can do this in code?</p>
<p>If you must do it programmatically, a way I've done it in the past is to inspect the url and look for "https" in it. Redirect if you don't see that. Request.IsSecureConnection should be the preferred method, however. You may have to add additional logic to handle a loopback address.</p>
<p>I think the proper way is to check the Request.IsSecureConnection property and redirect or throw if it's false</p>
8,345
<p>I have a table with a structure like the following:</p> <hr /> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>LocationID</th> <th>AccountNumber</th> </tr> </thead> <tbody> <tr> <td>long-guid-here</td> <td>12345</td> </tr> <tr> <td>long-guid-here</td> <td>54321</td> </tr> </tbody> </table> <...
<p>try</p> <pre><code>SELECT 1 AS Tag, 0 AS Parent, AccountNumber AS [Root!1!AccountNumber!element] FROM Location.LocationMDAccount WHERE LocationID = 'long-guid-here' FOR XML EXPLICIT </code></pre>
<p>Try this, Chris:</p> <pre><code>SELECT AccountNumber as [clientId] FROM Location.Location root WHERE LocationId = 'long-guid-here' FOR XML AUTO, ELEMENTS </code></pre> <p>TERRIBLY SORRY! I mixed up what you were asking for. I prefer the XML AUTO just for ease of maintainance, but I believe either o...
2,496
<p>In what scenarios is it better to use a <code>struct</code> vs a <code>class</code> in C++?</p>
<p>The differences between a <code>class</code> and a <code>struct</code> in C++ are:</p> <ul> <li><code>struct</code> members and base classes/structs are <code>public</code> by default.</li> <li><code>class</code> members and base classes/structs are <code>private</code> by default.</li> </ul> <p>Both classes and st...
<p>I never use "struct" in C++. </p> <p>I can't ever imagine a scenario where you would use a struct when you want private members, unless you're willfully trying to be confusing. </p> <p>It seems that using structs is more of a syntactic indication of how the data will be used, but I'd rather just make a class and t...
7,821
<p>I'm new to 3D printing and I noticed some problems with my print.</p> <p>I've printed it 3 times and releveled the bed. Now, I found that the right lower corner always has holes,</p> <p><a href="https://i.stack.imgur.com/ZK0WA.jpg" rel="nofollow noreferrer" title="Printed model on bed shows incomplete coverage durin...
<p>Anycubic 4Max Pro appears to be a direct drive printer (extruder motor is right on top of hotend). The 6.5 mm retraction on in your slicer settings is more typical of a Bowden setup, where the extruder motor lives off of the moving carriage, and has to move extra to compensate for slack in the tube to the hotend. Di...
<p>From the wispy horizontal lines within the perimeters in your second image, it appears that the nozzle is still oozing material during the travel moves. This is likely causing the hole in the corner and the wispy perimeters too. When the extruder reinserts the filament into the hotend after a travel move, it expects...
1,667
<ol> <li>Video podcast</li> <li>???</li> <li>Audio only mp3 player</li> </ol> <p>I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast.</p> <p>I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something lik...
<p>You could automate this using the open source command line tool ffmpeg. Parse the RSS to get the video files, fetch them over the net if needed, then spit each one out to a command line like this:</p> <pre><code>ffmpeg -i episode1.mov -ab 128000 episode1.mp3 </code></pre> <p>The -ab switch sets the output bit rate...
<p>How to extract audio from video to MP3:</p> <p><a href="http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm" rel="nofollow noreferrer">http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm</a></p> <p>How to Convert a Video Podcast to Audio Only:</p> <p><a href="http://w...
6,781
<p>What could be the problem with reversing the array of DOM objects as in the following code:</p> <pre><code>var imagesArr = new Array(); imagesArr = document.getElementById("myDivHolderId").getElementsByTagName("img"); imagesArr.reverse(); </code></pre> <p>In Firefox 3, when I call the <code>reverse()</code> method...
<p>Because getElementsByTag name actually returns a NodeList structure. It has similar array like indexing properties for syntactic convenience, but it is <em>not</em> an array. For example, the set of entries is actually constantly being dynamically updated - if you add a new img tag under myDivHolderId, it will autom...
<p>This worked for me, I did a reverse for loop and allocated the nodes to an array</p> <pre><code>var Slides = document.getElementById(&quot;slideshow&quot;).querySelectorAll('li'); var TempArr = []; for (var x = Slides.length; x--;) { TempArr.push(Slides[x]); } Slides = TempArr; </code></pre>
6,755
<p>I'm building a basic search functionality, using LIKE (I'd be using fulltext but can't at the moment) and I'm wondering if MySQL can, on searching for a keyword (e.g. WHERE field LIKE '%word%') return 20 words either side of the keyword, as well?</p>
<p>You can do it all in the query using SUBSTRING_INDEX</p> <pre><code>CONCAT_WS( ' ', -- 20 words before TRIM( SUBSTRING_INDEX( SUBSTRING(field, 1, INSTR(field, 'word') - 1 ), ' ', -20 ) ), -- your word 'word', -- 20 words after TRIM( SUBSTRING_INDEX( SUBSTRING(field, INSTR...
<p>Use the INSTR() function to find the position of the word in the string, and then use SUBSTRING() function to select a portion of characters before and after the position.</p> <p>You'd have to look out that your SUBSTRING instruction don't use negative values or you'll get weird results.</p> <p>Try that, and repor...
5,895
<p>I recently bought a 3d printer and right now i am printing a normal cube just to try it out. However I was wondering, when it has the last part left of the printing where it needs to create the roof, how will the filament stay there and not just fall down as there is nothing underneath?</p> <p>Will I need to check ...
<p>If you are printing a solid cube with infill, then the infill will support the "roof".</p> <p>If you are printing a hollow cube, then indeed, you should enable "support" to print a support structure under any overhangs.</p> <p>Depending on the angle, you may not need supports. Generally, FDM printers can print ove...
<p>If you are printing a solid cube with infill, then the infill will support the "roof".</p> <p>If you are printing a hollow cube, then indeed, you should enable "support" to print a support structure under any overhangs.</p> <p>Depending on the angle, you may not need supports. Generally, FDM printers can print ove...
543
<p>We have a 42U rack which is getting a load of new 1U and 2U servers real soon. One of the guys here reckons that you need to leave a gap between the servers (of 1U) to aid cooling.</p> <p>Question is, do you? When looking around the datacenter, no-one else seems to be, and it also diminishes how much we can fit i...
<p>Simply NO, the servers and switches, and KVMs, and PSUs are all designed to be on the rack stacked on top of eachother. I'm basing this on a few years building, COs and Data centers for AT&amp;T.</p>
<p>The last two places I worked have large datacenters and they stack all their servers and appliances with no gaps. The servers have plenty of cooling with their internal fans. It is also recommended to run the rack on a raised floor with perforated tiles in the front of the rack and A/C air return above the rear of...
8,088
<p>I have a situation where I might have multiple instances of a program running at once, and it's important that just one specific function not be executing in more than one of these instances at once.</p> <p>Is this the proper way to use a mutex to prevent this from happening?</p> <pre><code>lock (this.GetType()) {...
<p>You said multiple instances of one application, so we're talking about two program.exe's running, right? The lock statement won't lock across multiple programs, just within the program. If you want a true Mutex, look at the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.threading.mutex" rel="nofollow n...
<p>TheSeeker is correct.</p> <p>Jeff Richter's advice in <a href="http://books.google.com/books?id=C-V_AAAACAAJ&amp;dq=clr+via+c%23&amp;ei=k6TBSPjYOomUzATIs8WIDg" rel="nofollow noreferrer">Clr Via C#</a> (p638-9) on locking is to create a private object specifically for the purpose of being locked.</p> <pre><code>pri...
6,908
<p>Programming languages had several (r)evolutionary steps in their history. Some people argue that model-driven approaches will be The Next Big Thing. There are tools like openArchitectureWare, AndroMDA, Sculptor/Fornax Platform etc. that promise incredible productivity boosts. However, I made the experience that it i...
<p>I think, it will take time, till the tools get more refined, more people gain experience with MDD. At the moment if you want to get something out of MDD you have to invest quite a lot, so its use remains limited.</p> <p>Looking at openArchitectureWare for example: While it is quite robust and basic documentation ex...
<p>This is a very late reply, but I am currently searching for MDD tools to replace Rose RT, which is unfortunately being supplanted by Rhapsody. We are in the real-time, embedded and distributed C++ space and we get a LOT out of MDD. We are trying to move on to a better tool and get more widespread use of the tool i...
4,141
<p>I don't know how to say this but during the print, the printer will randomly have difficulty extruding the filament. I will have to give the filament a <em>boost</em> for it to keep going. Once I done the <em>boost</em>, the extruder keeps going perfectly fine for a while.</p> <p>I am using a Prusa I3 clone bought ...
<p>If you have <a href="http://www.openscad.org" rel="noreferrer">OpenSCAD</a> installed, this shell script will generate 100x100 pixel PNG images for each STL file in your current directory.</p> <pre><code>for i in *.stl; do T=__tmp__<span class="math-container">$i b=`basename $</span>i` echo import\(\"<span cl...
<p>You can use OpenSCAD, as stated in the accepted answer. Here is a version of that script that works for Windows for anyone who needs it, as I did.</p> <pre><code># Change height and width to the desired output image dimensions, in pixels. # The path to openscad.exe may also have to be adjusted based on your instal...
916
<p>I want to merge two dictionaries into a new dictionary.</p> <pre><code>x = {'a': 1, 'b': 2} y = {'b': 3, 'c': 4} z = merge(x, y) &gt;&gt;&gt; z {'a': 1, 'b': 3, 'c': 4} </code></pre> <p>Whenever a key <code>k</code> is present in both dictionaries, only the value <code>y[k]</code> should be kept.</p>
<h2>How can I merge two Python dictionaries in a single expression?</h2> <p>For dictionaries <code>x</code> and <code>y</code>, their shallowly-merged dictionary <code>z</code> takes values from <code>y</code>, replacing those from <code>x</code>.</p> <ul> <li><p>In Python 3.9.0 or greater (released 17 October 2020, <a...
<p>The question is tagged <code>python-3x</code> but, taking into account that it's a relatively recent addition and that the most voted, accepted answer deals extensively with a Python 2.x solution, I dare add a one liner that draws on an irritating feature of Python 2.x list comprehension, that is <em>name leaking</e...
5,999
<p>For some reason, I can't seem to get CruiseControl.net to checkout code to anywhere but the starteam working folder for a specificed view.</p> <p>I've tried both overrideViewWorkingDir and overrideFolderWorkingDir, and neither seem to work.</p> <p>Has anyone been able to do this?</p>
<p>Are you looking for the project's <a href="http://confluence.public.thoughtworks.org/display/CCNET/Project+Configuration+Block" rel="nofollow noreferrer">workingDirectory element</a> instead of the <a href="http://confluence.public.thoughtworks.org/display/CCNET/StarTeam+Source+Control+Block" rel="nofollow noreferre...
<pre><code>&lt;sourcecontrol type="starteam"&gt; &lt;executable&gt;C:\Program Files\starbase\StarTeam 5.4\stcmd.exe&lt;/executable&gt; &lt;project&gt;ProjectName/ViewName&lt;/project&gt; &lt;username&gt;UserName&lt;/username&gt; &lt;password&gt;Password&lt;/password&gt; &lt;host&gt;127.0.0.1&lt;/hos...
6,428
<p>This is an adapted version of a question from someone in my office. She's trying to determine how to tell what ports MSDE is running on for an application we have in the field.</p> <p>Answers to that narrower question would be greatly appreciated. I'm also interested in a broader answer that could be applied to a...
<pre><code>netstat -b </code></pre> <p>from the command line will display the application name, process owner, address, and port number used for all running applications.</p>
<p>Download currports from <a href="http://www.nirsoft.net/utils/cports.html" rel="nofollow noreferrer">here</a>.</p> <p>It will show you which ports are open and which processes are associated with each port.</p> <p>Scroll down to: Download CurrPorts</p>
6,354
<p>I got this error today when trying to open a Visual Studio 2008 <strong>project</strong> in Visual Studio 2005:</p> <blockquote> <p>The imported project "C:\Microsoft.CSharp.targets" was not found.</p> </blockquote>
<p>Open your csproj file in notepad (or notepad++) Find the line: </p> <pre><code>&lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&gt; </code></pre> <p>and change it to</p> <pre><code>&lt;Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /&gt; </code></pre>
<p>I deleted the obj folder and then the project loaded as expected.</p>
2,755
<p>I hope this qualifies as a programming question, as in any programming tutorial, you eventually come across 'foo' in the code examples. (yeah, right?)</p> <p>what does 'foo' really mean?</p> <p>If it is meant to mean <strong>nothing</strong>, when did it begin to be used so?</p>
<p>See: <a href="https://www.rfc-editor.org/rfc/rfc3092" rel="nofollow noreferrer">RFC 3092: Etymology of &quot;Foo&quot;, D. Eastlake 3rd et al.</a></p> <p>Quoting only the relevant definitions from that RFC for brevity:</p> <blockquote> <ol start="2"> <li>Used very generally as a sample name for absolutely anything, ...
<p>In my opinion every programmer has his or her own "words" that is used every time you need an arbitrary word when programming. For some people it's the first words from a childs song, for other it's names and for other its something completely different. Now for the programmer community there are these "words" as w...
7,711
<p>I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page.</p> <p>My question is: how can I edit the theme's css so it changes the way that block of static content is displayed?</p> <p>For reference, <a href="http://www.histor...
<p>The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file: /aroda/roda/files/color/garland-d3985506/s...
<p>It looks like most of your CSS info is in some *.css files. There is also some inline Style info on the page. Your style for the static info comes from the in-line stuff. I am not sure how Drupal generates the page but the place to start looking is for any properties for "ultima-edicao". That is what the surroun...
5,584
<p>I've been making my way through <em>The Little Schemer</em> and I was wondering what environment, IDE or interpreter would be best to use in order to test any of the Scheme code I jot down for myself.</p>
<p><a href="http://racket-lang.org/" rel="noreferrer">Racket</a> (<a href="http://racket-lang.org/new-name.html" rel="noreferrer">formerly Dr Scheme</a>) has a nice editor, several different Scheme dialects, an attempt at visual debugging, lots of libraries, and can run on most platforms. It even has some modes specifi...
<p>LispMe works on a Palm Pilot, take it anywhere, and scheme on the go. GREAT way to learn scheme.</p>
8,402
<p>I'm trying to write a query that extracts and transforms data from a table and then insert those data into another table. Yes, this is a data warehousing query and I'm doing it in MS Access. So basically I want some query like this:</p> <pre><code>INSERT INTO Table2(LongIntColumn2, CurrencyColumn2) VALUES (SELECT...
<p>No "VALUES", no parenthesis:</p> <pre><code>INSERT INTO Table2(LongIntColumn2, CurrencyColumn2) SELECT LongIntColumn1, Avg(CurrencyColumn) as CurrencyColumn1 FROM Table1 GROUP BY LongIntColumn1; </code></pre>
<p>Do you want to insert extraction in an existing table? </p> <p>If it does not matter then you can try the below query:</p> <pre><code>SELECT LongIntColumn1, Avg(CurrencyColumn) as CurrencyColumn1 INTO T1 FROM Table1 GROUP BY LongIntColumn1); </code></pre> <p>It will create a new table -> T1 with the extracted in...
9,985
<p>Does anybody have useful example of <code>this</code> assignment inside a C# method? I have been asked for it once during job interview, and I am still interested in answer myself. </p>
<p>The other answers are incorrect when they say you cannot assign to 'this'. True, you can't for a class type, but you <em>can</em> for a struct type:</p> <pre><code>public struct MyValueType { public int Id; public void Swap(ref MyValueType other) { MyValueType temp = this; this = other;...
<p>You cannot overwrite "this". It points to the current object instance.</p>
9,524
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2213205/configure-eclipse-to-use-vs-net-shortcuts">Configure Eclipse to use VS.Net shortcuts?</a> </p> </blockquote> <p>I mostly work in VS2008 but I need to do some java work in Eclipse. Is there an easy and f...
<p>How are the Eclipse settings saved? Perhaps you could simply adapt <a href="http://xona.com/2005/08/02.html" rel="nofollow noreferrer">this macro</a> and load the resulting file into Eclipse?</p>
<p>Doesn't Eclipse have a predefined keyboard setup for Visual Studio?</p>
3,740
<p>I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like:</p> <pre class="lang-jsp prettyprint-override"><code>&lt;p&gt; &lt;bean:message key="alert" /&gt; &lt;/p&gt; </code></pre> <p>and the properties files look like:</p> <pre><code>messages.prop...
<blockquote> <p>Avoid creating links within long blocks of text. Prefer shorter text that can act as a logically complete and independent link.</p> </blockquote> <p>Generally, it will lead to fewer problems. Sometimes you have to compromise your UI design to accommodate localization; sometimes you need to comp...
<p>Perhaps:</p> <pre><code># alert=Please update your {0}address{1} and {2}contact information{3}. </code></pre>
3,423
<p>I've been having trouble getting my ASP.NET application to automatically log users into the Intranet site I'm building. No matter the googling or the experimentation I applied, there is always a login box displayed by IE7.</p> <p>I've got Windows authentication mode set in the Web.config, disabled anonymous access...
<p>It sounds like you've covered all the server-side bases--maybe it's a client issue? I assume your users have integrated authentication enabled in IE7? (Tools -> Internet Options -> Advanced -> Security). This is enabled by default.</p> <p>Also, is your site correctly recognized by IE7 as being in the Local Intra...
<p>In IIS, enable annonymous access and allow the web.config to handle user authentication.</p>
2,308
<p>I am running a number of SSL-encrypted websites, and need to generate certificates to run on these. They are all internal applications, so I don't need to purchase a certificate, I can create my own.</p> <p>I have found it quite tedious to do everything using openssl all the time, and figure this is the kind of thi...
<p>An option that doesn't require your own CA is to get certificates from <a href="http://www.cacert.org/" rel="noreferrer">CAcert</a> (they're free).</p> <p>I find it convenient to add the two CAcert root certificates to my client machines, then I can manage all the SSL certificates through CAcert.</p>
<p>I created <a href="https://github.com/brianclements/pkictl" rel="nofollow">a wrapper script</a>, written in Bash, for OpenSSL that might be useful to you here. To me, the easiest sources of user error when using OpenSSL were:</p> <ol> <li>Keeping a consistent and logical naming scheme for configuration/certs/keys s...
3,836
<p>How to restrict the maximum number of characters that can be entered into an HTML <code>&lt;textarea&gt;</code>? I'm looking for a cross-browser solution.</p>
<p>The <code>TEXTAREA</code> tag does not have a <code>MAXLENGTH</code> attribute the way that an <code>INPUT</code> tag does, at least not in most standard browsers. A very simple and effective way to limit the number of characters that can be <em>typed</em> into a <code>TEXTAREA</code> tag is:</p> <pre><code>&lt;tex...
<pre><code>$(function(){ $("#id").keypress(function() { var maxlen = 100; if ($(this).val().length &gt; maxlen) { return false; } }) }); </code></pre> <p>Reference <a href="https://stackoverflow.com/questions/4459610/set-maxlength-in-html-textarea">Set maxlength in Html Textarea</a></p>
6,517
<p>We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation.</p> <p>Therefore, we've been looking at some alternative memor...
<p>First, I agree with the other posters who suggested a resource leak. You really want to rule that out first.</p> <p>Hopefully, the heap manager you are currently using has a way to dump out the actual total free space available in the heap (across all <strong>free</strong> blocks) and also the total number of block...
<p>if you talking about Win32 - you can try to squeeze something by using LARGEADDRESSAWARE. You'll have ~1Gb extra defragmented memory so your application will fragment it longer.</p>
8,591
<p>For a while now, I have been thinking about designing things such as small bedside tables, game/dvd/bluray racks for 3d printing. I've always thought that making them modular would be a good way to go about doing this as well.</p> <p>Modular design would help to create an end result that is vastly larger than the p...
<p>All printers are designed with an idea of <a href="https://en.wikipedia.org/wiki/WYSIWYG" rel="nofollow">WYSIWYG</a> for sure. Depending on:</p> <ul> <li>printer - type/quality/settings/configuration/assembly precission</li> <li>filament - type/quality/shrinkage</li> <li>user skills - manual/using app proficiency</...
<p>A book you would benefit from reading is "Functional Design for 3D Printing...Designing 3D Printed things for everyday use - 2nd Edition" by Clifford Smyth. </p> <p>It deals with FDM printing only. It deals with considerations of orientation of the parts being printed to address required strength in the 3 direct...
369
<p>I am building a web page to show a customer what software they purchased and to give them a link to download said software. Unfortunately, the data on what was purchased and the download information are in separate databases so I can't just take care of it with joins in an SQL query.</p> <p>The common item is SKU....
<p>As long as the two databases are on the same physical server (assuming MSSQL) and the username/password being used in the connection string has rights to both DBs, then you should be able to perform a join across the two databases. Example: </p> <pre><code>select p.Date, p.Amount, d.SoftwareName, ...
<p>I am thinking off the top of my head here. If you load both as Data Tables in the same Data Sets, and define a relation between the two over SKU, and then run a query on the Data Set which produces the desired result.</p>
2,445
<p>I was reading a research paper about Haskell and how HList is implemented and wondering when the techniques described are and are not decidable for the type checker. Also, because you can do similar things with GADTs, I was wondering if GADT type checking is always decidable.</p> <p>I would prefer citations if you...
<p>I believe GADT type checking is always decidable; it's inference which is undecidable, as it requires higher order unification. But a GADT type checker is a restricted form of the proof checkers you see in eg. Coq, where the constructors build up the proof term. For example, the classic example of embedding lambda...
<p>You've probably already seen this but there are a collection of papers on this issue at Microsoft research: <a href="http://research.microsoft.com/~simonpj/papers/assoc-types/" rel="nofollow noreferrer">Type Checking papers</a>. The first one describes the decidable algorithm actually used in the Glasgow Haskell com...
7,131
<p>We have a requirement in project to store all the revisions(Change History) for the entities in the database. Currently we have 2 designed proposals for this:</p> <p>e.g. for "Employee" Entity</p> <p><strong>Design 1:</strong></p> <pre><code>-- Holds Employee Entity "Employees (EmployeeId, FirstName, LastName, De...
<p>I think the key question to ask here is 'Who / What is going to be using the history'?</p> <p>If it's going to be mostly for reporting / human readable history, we've implemented this scheme in the past...</p> <p>Create a table called 'AuditTrail' or something that has the following fields...</p> <pre><code>[ID] ...
<p>It sounds like you want to track changes to specific entities over time, e.g. ID 3, "bob", "123 main street", then another ID 3, "bob" "234 elm st", and so on, in essence being able to puke out a revision history showing every address "bob" has been at.</p> <p>The best way to do this is to have an "is current" fiel...
6,033
<p>I'm used to the Vi(m) editor and am using MS Visual Studio 2005 at work. I couldn't find a free Vi add-in (there's only one for the 2003 version). I googled a bit, saw that there was a 'Google summer of code' project this year to write such an add-in, and am eagerly awaiting the result. I've also heard of ViEmu (not...
<p>ViEmu works great with Visual Studio. I used Vi(m) strictly in Linux, but I was turned on to bringing the Vi(m) editing process into the Windows world by <a href="http://www.jpboodhoo.com/" rel="noreferrer">JP Boodhoo</a>. JP <a href="http://blog.jpboodhoo.com/HookedOnVIM.aspx" rel="noreferrer">praises</a> about i...
<p><a href="http://www.viemu.com/" rel="nofollow noreferrer">ViEmu</a> works great. I've been using it for about a year now and couldn't imagine coding in Visual Studio without it.</p> <p>Why can't you test it at work? It has a 30 day free trial.</p>
4,425
<p>Does anyone know of a way to force a nolock hint on all transactions issued by a certain user? I'd like to provide a login for a support team to query the production system, but I want to protect it by forcing a nolock on everything they do. I'm using SQL Server 2005.</p>
<p>You could configure your support staff's SQL Management Studio to set the default transaction isolation level to READ UNCOMMITTED (Tools->Options->Query Execution->SQL Server->Advanced). This is functionally the same as having NOLOCK hints on everything.</p> <p>The downsides are that you'd have to do this for each...
<p>You could create a limited user for the support team, and then either write stored procedures or views with the nolock-hint. Then only give access to those and not direct table select access.</p>
8,971
<p>TL;DR - For a given Kossel frame size (w.r.t. the vertical and horizontal frame lengths of the aluminium extrusion), what would the length of the carbon fibre rods be?</p> <hr> <p>A case in point, from <a href="http://reprap.org/wiki/Kossel" rel="nofollow noreferrer">RepRapWiki - Kossel</a>, there is an intriguing...
<p>I had the same problem, and I solved it by changing the <em>Z-Axis Feed Rate</em> to a much higher value (1000 mm/min.) in Repetier Host via <em>Config -> Printer Settings -> Printer</em>.</p>
<p>Try changing the travel speed in you r slicer, if that doesn't work , try changing out the motors for newer ones.</p>
589
<p>I have the following <code>textarea</code> in a <code>table</code>:</p> <pre><code>&lt;table width="300"&gt;&lt;tr&gt;&lt;td&gt; &lt;textarea style="width:100%"&gt; longstringlongstringlongstringlongstringlongstringlongstringlongstringlongstringlongstringlongstringlongstringlongstringlongstring &lt;/textarea&gt; ...
<p>Apply the width to the <code>td</code>, not the <code>table</code>.</p> <p>EDIT: @Emmett - the width could just as easily be applied via CSS.</p> <pre class="lang-css prettyprint-override"><code>td { width: 300px; } </code></pre> <p>produces the desired result. Or, if you're using jQuery, you could add the wi...
<p>did you try...</p> <p><code>overflow: hidden;</code></p> <p>??</p> <p>I'm not sure if it should be in the table of the textarea... experiment a bit</p>
5,406
<p>What is the best full text search alternative to Microsoft SQL? (which works with MS SQL)</p> <p>I'm looking for something similar to <a href="http://lucene.apache.org/java/docs/index.html" rel="nofollow noreferrer">Lucene</a> and <a href="http://incubator.apache.org/lucene.net/" rel="nofollow noreferrer">Lucene.N...
<p>Take a look at <a href="http://clucene.wiki.sourceforge.net/" rel="nofollow noreferrer">CLucene</a> - It's a well maintained C++ port of java Lucene. It's currently licenced under LGPL and we use it in our commercial application.</p> <p>Performance is incredible, however you do have to get your head around some of ...
<p>I second Sphinx, but <a href="http://lucene.apache.org/" rel="nofollow noreferrer">Lucene</a> is also not so bad despite the Java. :) If you are not dealing with too much data spread out etc., then also look into MySQL's <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html" rel="nofollow noreferrer">...
5,979
<p>I was wondering if there is any good and clean object-oriented programming (OOP) implementation of Bayesian filtering for spam and text classification? This is just for learning purposes.</p>
<p>I definitely recommend <a href="http://www.cs.waikato.ac.nz/ml/weka/" rel="noreferrer">Weka</a> which is an <em>Open Source Data Mining Software</em> written in Java:</p> <blockquote> <p>Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a d...
<p>In French, but you should be able to find the download link :) <a href="http://xhtml.net/scripts/PHPNaiveBayesianFilter" rel="nofollow noreferrer">PHP Naive Bayesian Filter</a></p>
2,352
<p>As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.:</p> <pre><code>if @version &lt;&gt; @expects begin declare @error varchar(100); set @error = 'Invalid version....
<p>Here's what I came up with:</p> <p>Wrap it in an EXEC(), like so:</p> <pre><code>if @version &lt;&gt; @expects begin ...snip... end else begin exec('CREATE PROC MyProc AS SELECT ''Victory!'''); end </code></pre> <p>Works like a charm!</p>
<pre><code>IF NOT EXISTS(SELECT * FROM sys.procedures WHERE name = 'pr_MyStoredProc') BEGIN CREATE PROCEDURE pr_MyStoredProc AS ..... SET NOCOUNT ON END ALTER PROC pr_MyStoredProc AS SELECT * FROM tb_MyTable </code></pre>
7,930
<p>At work, we have multiple branches that we may be working on at any time. Our solution so far as been to create multiple web-sites but you can only run one web-site at a time. This makes switching between branches more of a pain that in should be. </p> <p>I just want to go to the URL, mapped in my hosts file, for ...
<p>Yes, it is a restriction and this one website can have only 10 simultanious connections.</p> <p>Buy a Windows 2003 or 2008 Small Business Edition, it is quite cost-effective in this scenario.</p>
<p>One way you could solve this without reinstalling your computer is to create each branch in a virtual subdirectory under you current web-root. Then at the top-level website, create a default.asp(x) the reads <code>Request.ServerVariables["SERVER-NAME"]</code> (should be underscore) and redirects the browser to whate...
5,450
<p>I read something the other day about a guy who found a way to knock over completed prints with the printer head itself, then slide them to the edge of the build plate, where they fall into a box/basket. This allows printing several Eiffel Towers while you sleep for example. It doesn't work with skirts (duh), and the...
<p>You could cool down the heated bed (with e.g. <code>[M109][1] R28</code>) and cool down the hotend (with e.g. <code>[M190][1] R40</code>). This will usually release the print from the plate, perform the actions to move the head (e.g. go to the largest X, Y position <code>G1 X{max} Y{max}</code>, move down <code>G1 Z...
<p>For fun, from Thingiverse - <a href="https://www.thingiverse.com/thing:872617" rel="nofollow noreferrer">Automatic Print Ejector - The Punching Machine</a>. </p> <p>There's even a video: <a href="https://www.youtube.com/watch?v=Viy928RLsdU" rel="nofollow noreferrer">MatterHackers Punch-Out!</a></p> <p><sub>Hover ...
961
<p>Stack exchange isn't a good platform for product recommendations in general, but a few sites allow it with a tight focus and control. Some that have allowed it in the past have decided to discontinue it for a variety of reasons.</p> <p>I expect at the start we are going to get a lot of "What specific machine shoul...
<p>I agree with Jeff's blog post: <a href="https://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/">https://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/</a></p> <blockquote> <p>don't ask us what you should buy -- ask us <em>what you need to learn</em> to tell what you should buy.</p> </blo...
<p>I think that hardware recommendations are ok, but in a <strong>limited</strong> and <strong>specific</strong> scope:</p> <p>Bad:</p> <blockquote> <p>Can you recommend a cheap printer with a heated bed that's at least 8&quot;*8&quot;*8&quot;.</p> <p>Which is better? Printer X or printer Y?</p> </blockquote> <p>Good:<...
2
<p>I'm working on moving a client/server application created with C# and WinForms into the SOA/WPF/Silverlight world. One of the big hurdles is the design of the UI. My current UI is MDI driven and users rely heavily on child windows, having many open at the same time and toggling back and forth between them. </p> <p>...
<p>I think the answer is really going to be up to your users -- I'd set up some prototypes with multiple paradigms and let them provide some input. The last thing you want to do is introduce a new UI paradigm without having any end-user input.</p> <p>Tabs are really popular now, but don't allow side-by-side viewing, ...
<p>Did you try <a href="http://www.netikatech.com/products/default.aspx" rel="nofollow noreferrer">GOA WinForms</a>?</p>
7,328
<p>Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques.</p> <hr> <p>I'm developing a tool in <strong>PHP</strong> that could attain quite a lot of ...
<p>No two sites are alike. You really need to get a tool like <a href="http://jakarta.apache.org/jmeter/" rel="noreferrer">jmeter</a> and benchmark to see where your problem points will be. You can spend a lot of time guessing and improving, but you won't see real results until you measure and compare your changes. </p...
<p>@<a href="https://stackoverflow.com/questions/24675/tactics-for-using-php-in-a-high-load-site#24689">Gary</a></p> <blockquote> <p>Don't use MySQLi -- PDO is the 'modern' OO database access layer. The most important feature to use is placeholders in your queries. It's smart enough to use server side prepares and o...
4,432
<p>I'm using an Ubuntu 8.04 (x86_64) machine to connect to my employer's Cisco VPN. (The client didn't compile out of the box, but I found <a href="http://projects.tuxx-home.at/?id=cisco_vpn_client" rel="nofollow noreferrer">patches to update the client to compile on kernels released in the last two years</a>.) This al...
<p>If you are running without NetworkManager handling the connections, use the resolvconf package to act as an intermediary to programs tweaking /etc/resolv.conf: <strong><code>sudo apt-get install resolvconf</code></strong></p> <p>If you are using NetworkManager it will handle this for you, so get rid of the resolvco...
<p>vpnc seems to be doing the right thing for my employer's cisco concentrator. I jump on and off the vpn, and it seems to update everything smoothly.</p>
7,047
<p>Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions:</p> <ol> <li>Should table names be plural?</li> <li>Should column names be singular?</li> <li>Should I prefix tables or columns?</li> <li>Should I use any case in ...
<p>I recommend checking out Microsoft's SQL Server sample databases: <a href="https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks" rel="noreferrer">https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks</a></p> <p>The AdventureWorks sample uses a very clear and consistent n...
<pre><code> --Example SQL CREATE TABLE D001_Students ( StudentID INTEGER CONSTRAINT nnD001_STID NOT NULL, ChristianName NVARCHAR(255) CONSTRAINT nnD001_CHNA NOT NULL, Surname NVARCHAR(255) CONSTRAINT nnD001_SURN NOT NULL, CONSTRAINT pkD001 PRIMARY KEY(StudentID) ); CREATE INDEX idxD001_STID on D001_St...
2,923
<p>How do you pass <code>$_POST</code> values to a page using <code>cURL</code>?</p>
<p>Should work fine.</p> <pre><code>$data = array('name' =&gt; 'Ross', 'php_master' =&gt; true); // You can POST a file by prefixing with an @ (for &lt;input type="file"&gt; fields) $data['file'] = '@/home/user/world.jpg'; $handle = curl_init($url); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURL...
<pre><code>&lt;?php function executeCurl($arrOptions) { $mixCH = curl_init(); foreach ($arrOptions as $strCurlOpt =&gt; $mixCurlOptValue) { curl_setopt($mixCH, $strCurlOpt, $mixCurlOptValue); } $mixResponse = curl_exec($mixCH); curl_close($mixCH); retur...
4,806
<p>I'd like to convert a Parallels Virtual Machine image on my mac into an image usable by Virtual PC 2007. Does anyone know how to do that, or if it is possible?</p>
<p>It looks like qemu-img from <a href="http://bellard.org/qemu/" rel="nofollow noreferrer">qemu</a> can do this, at least looking at its commandline help on a Ubuntu 8.04 machine where it claims support for, among others, the "parallels" and the "vpc" format.</p> <p>Have not tried myself, though. Hope this helps.</p>...
<p>If it's a Windows image, I would mount the VM using a tool like <a href="http://www.prowesscorp.com/support/help/smartdeploy_vdc/Welcome_to_SmartVDK_v1.0.htm" rel="nofollow noreferrer">SmartVDK</a>, then capture the VM with ImageX to a WIM file. You can then mount a blank VHD with SmartVDK and apply the image using...
8,998
<p>I am looking for any strategies people use when implementing server applications that service client TCP (or UDP) requests: design patterns, implementation techniques, best practices, etc.</p> <p>Let's assume for the purposes of this question that the requests are relatively long-lived (several minutes) and that th...
<p>The modern approach is to make use of the operating system to multiplex many network sockets for you, freeing your application to only processing active connections with traffic.</p> <p>Whenever you open a socket it's associated it with a selector. You use a single thread to poll that selector. Whenever data arrive...
<p>G'day,</p> <p>I'd start by looking at the metaphor you want to use for your thread framework.</p> <p>Maybe "leader follower" where a thread is listening for incoming requests and when a new request comes in it does the work and the next thread in the pool starts listening for incoming requests.</p> <p>Or thread p...
5,213
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
3