instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am working on an If statement and I want to satisfy two conditions to ignore the loop. This seemed easy at first, but now... I don't know. this is my dilemma...</p> <pre><code>if((radButton1.checked == false)&amp;&amp;(radButton2.checked == false)) { txtTitle.Text = "go to work"; } </code></pre> <p>The dil...
<p>No, it requires them to both be false to <em>execute</em> the statement.</p>
<p>No. It requires one of those statements to be false to skip. Look at your if:</p> <pre><code>if (condition1 &amp;&amp; condition2) { doSomething(); } </code></pre> <p>So if condition1 OR condition2 is not true then it won't execute.</p>
41,092
<p>I have a simple grammar, and have produced a pair of c# classes using antlr 2.7.7. When the parser finds an error with a token, it throws an exception; I want to find out how many characters into a parsed stream the token came. How do I do that?</p>
<p>We use <a href="http://www.browsercam.com/" rel="noreferrer">BrowserCam</a> for exactly that.</p>
<p>Check out the <a href="http://wiki.osx86project.org/wiki/index.php/Vmware_how_to" rel="nofollow noreferrer">OSx86 Project</a>. I've used this before, it works quite well and is pretty easy to understand.</p>
21,487
<p>I'm developing a site in Visual Web Dev Express, and when I run/debug, I'd like to be able to set my application's document root so that I can use safer paths, like "/css/style.css' instead of "css/style.css". How would I accomplish this?</p>
<ul> <li>Click on the web site node in the solution explorer.</li> <li>Press F4 to see the properties window.</li> <li>Change the virtual path from <strong>/projectname</strong> to <strong>/</strong></li> </ul> <p>Bear in mind that this has an impact on how you expect the application/web site to be deployed. If it is ...
<p>I have been looking for the virtual path field in the properties window but haven't been able to find it... it only shows me the following options</p> <ul> <li>aperture directory URL</li> <li>complete access route</li> <li>policy file</li> <li>port</li> <li>use dynamic port</li> </ul> <p>Do you know of some place ...
4,147
<p>Both the jQuery and Prototpye JavaScript libraries refuse to allow me to use a variable to select an list item element by index number although they accept a hard coded number. </p> <p>For example, in Prototype this works:</p> <pre><code>$$('li')[5].addClassName('active'); </code></pre> <p>But this will not work ...
<p>Are you certain that <code>currentPage</code> is an integer? Try something like:</p> <pre><code>var currentPage = 5; jQuery('li').eq(currentPage); </code></pre> <p>as a simple sanity check. If that works, you should try casting to <code>Integer</code>.</p>
<p>Make sure that the currentPage variable is correctly scoped in the code where it is being accessed. Could the variable be changed somewhere else in the code before you are accessing it? Tools like <a href="https://addons.mozilla.org/firefox/addon/1843" rel="nofollow noreferrer">Firebug</a> can help you to add a brea...
6,181
<p>I would like to be able to fetch a web page's html and save it to a <code>String</code>, so I can do some processing on it. Also, how could I handle various types of compression.</p> <p>How would I go about doing that using Java?</p>
<p>Here's some tested code using Java's <a href="http://java.sun.com/javase/6/docs/api/java/net/URL.html" rel="noreferrer">URL</a> class. I'd recommend do a better job than I do here of handling the exceptions or passing them up the call stack, though.</p> <pre><code>public static void main(String[] args) { URL u...
<blockquote> <p>I used the actual answer to this post (<a href="https://stackoverflow.com/a/238634/2683452">url</a>) and writing the output into a file.</p> </blockquote> <pre><code>package test; import java.net.*; import java.io.*; public class PDFTest { public static void main(String[] args) throws Excepti...
29,507
<p>I've got shared hosting on a LAMP set up. Obviously the fewer calls to the Db per page the better. But how many is too many? Two? Ten? A hundred? Curious what people think.</p>
<p>That really depends on your (db)servers setup. Try to cache most of information as possible and reduce db calls to a minimum. A database will (almost in every case) be the bottleneck of your service - the higher the usage of your site. So whatever you do try to avoid fireing a query as if not really necessary.</p> ...
<p>One or less is always best. Two is usually one too many. </p> <p>If you can return multiple result sets in a single query, then do it. If the information is fairly static, then cache it and pull from cache. </p> <p>10 separate database calls is not good, but its not going to kill a low usage site. </p>
48,499
<p>I have an ASP.net website ( <a href="http://www.erate.co.za" rel="nofollow noreferrer">http://www.erate.co.za</a> ) version 2.0. When someone opens my website in Firefox everything looks different.</p> <p>Why is that and how can I make it compatible?</p> <p>Please help!</p> <p>Etienne</p>
<p>The problems don't have anything to do with ASP.NET / C# Specifically.</p> <p>They have to do with your understanding of web design / HTML / CSS and how you can make a cross-browser compatible UI.</p> <p>I'd suggest you look at <a href="http://www.w3schools.com/" rel="noreferrer">http://www.w3schools.com/</a> for ...
<p>Per se, ASP.NET produce vanilla HTML/Javascript, so there's nothing wrong with the technology.</p> <p>Focus on the html, try to be as close as possible to the <a href="http://validator.w3.org/" rel="nofollow noreferrer">w3c standards</a>, it should help a lot.</p> <p><a href="http://getfirebug.com/" rel="nofollow ...
33,168
<p>I just did a <strong>delete from table</strong></p> <p>How do I roll back or undelete the rows??</p>
<p>if you called <code>begin transaction</code> before you did it, and have not yet called <code>commit</code>, then you can call <code>rollback</code>, otherwise... you're gonna have to restore</p>
<p>if you prefaced the delete with a begin tran you just use rollback tran</p> <p>if not, start looking for your backups.</p>
17,144
<p>I'm struggling to understand Dependency Properties in Silverlight 2. Does anybody have a good explanation or link that clearly explains the DependencyObject and/or DependencyProperty?</p>
<pre><code>Dictionary&lt;object, object&gt; list = new Dictionary&lt;object, object&gt;(); foreach (object o in enumerable) if (!list.ContainsKey(o)) { // Do the actual work. list[o] = null; } </code></pre> <p>Dictionary will use a hash table to hold keys therefore lookup is efficient.</p> ...
<p>Another alternative is to use HashSet&lt;T&gt; - a HashSet doesn't allow duplicate items to be used and doesn't require a key/value pair.</p>
44,815
<p>How do you implement autocomplete on ASP.Net Gridview? Can anyone point me where to go to achieve this? I'm willing to use non-.Net ajax controls if that what it takes.</p>
<p>You will need to utilise an AJAX framework (<a href="http://www.jquery.com/" rel="nofollow noreferrer">JQuery</a> is one i often recommend) which will provide the functionality to display the drop down box. You will then need to create a separate page (or web service) to return all the possible values to display in ...
<p>The AJAX Control Toolkit provides an <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx" rel="nofollow noreferrer">autocomplete</a> but requires a web service to work. You could always write your own asmx if there isn't one you can use.</p> <p>Otherwise, there are all sorts ...
11,473
<p>Are there any 3D printing services or something similar to 3D print or injection mold light reflectors? </p> <p>I'm trying to find something that is similar to PCB printing that allows you to upload a 3D design of a reflector and they will produce this reflector and coat it with mirror surface.</p>
<p>I would not recommend extrusion printers for this, because they are unlikely to produce a smooth enough surface. To get a clean surface, the irregularities have to be a fraction of visible wavelengths, which is to say on the order of 0.01 micron.<br> Without knowing what sort of reflector you're thinking of (flat? ...
<p>I would not recommend extrusion printers for this, because they are unlikely to produce a smooth enough surface. To get a clean surface, the irregularities have to be a fraction of visible wavelengths, which is to say on the order of 0.01 micron.<br> Without knowing what sort of reflector you're thinking of (flat? ...
415
<p>Where can I set it? I need files to be encoded in UTF-8 by default... there is nothing in Tools -> Options or any other menu as far as I know :( </p> <p>P.S. I don't need to set default encoding for Project or so, I need it to be default for any files I create. Thanks for your help :)</p>
<p>Instead of clicking save click save as. Then click the little down arrow by save to save with encoding. Once this is done it will bring you to the advanced save options which appear in full VS studio. You can then pick UTF-8 as the encoding.</p>
<p>IIRC, source files in visual studio are already encoded as UTF-8. </p> <p>However, if I'm wrong or if you just want to force any specific coding, you can do it by choosing the <code>Save As...</code> option for the file and checking the pull down options under the save button from there.</p>
38,054
<p>I have been trying to determine a best case solution for registering a COM server using WiX to create a Windows Installer package and am struggling.</p> <p>In this post <a href="http://blog.deploymentengineering.com/2008/09/howto-use-regsvr32exe-with-wix.html" rel="nofollow noreferrer">Deployment Engineering Archiv...
<p>Read "Do not use the SelfReg and TypeLib tables" at:</p> <p><a href="https://msdn.microsoft.com/en-us/library/bb204770#no_selfreg" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/bb204770#no_selfreg</a></p> <p>For WiX, take a look at the <em>Component</em> element in the schema reference at:</p>...
<p>There is just one drawback to this: WiX Com registration with heat.exe does not work for .exe COM servers. InstallShield and its tools seem to support it, but RegSpyUI is just a UI tool, not one which I can run on my build machine.</p>
19,614
<p>Can anyone suggest a good source control system that interfaces with VB2005 Express? As the Express editions of Visual Studio do not allow add-ins does this mean that I will not be able to integrate source control into the IDE? I'm used to the check-in/check-out process of SourceSafe integrated into VB6. Can anyone ...
<p>TortoiseSVN is a good choice. Although it won't integrate into the IDE (because of the plug-in problem you mentioned), it's really solid in the Explorer right-button menu.</p> <p>Also consider <a href="http://www.sourcegear.com/vault/" rel="nofollow noreferrer">Vault</a> from SourceGear. If you're used to SourceS...
<p>No, Source Control systems can't be integrated with the VS Express IDEs by design.</p> <p>If you want to continue using your existing VSS, you're best option is to upgrade to Visual Studio Standard. Otherwise, check out TortoiseSVN. Here's a good quick start:</p> <p><a href="http://www.polymorphicpodcast.com/sho...
13,708
<p>I was considering creating a separate SQLite database for certain apps on a Django project.<br> However, I did not want to use direct SQLite access if possible. Django-style ORM access to these database would be ideal.<br> Is this possible?</p> <p>Thank you.</p>
<p>Yes - the low-level API for this is in place, it's just missing a convenient high-level API at the moment. These quotes are from <a href="http://www.reddit.com/r/programming/comments/6zinj/django_10_released/" rel="nofollow noreferrer">James Bennett (Django's release manager) on programming reddit</a>:</p> <blockquo...
<p>This isn't possible yet, but there is some talk of it on the wiki, <a href="http://code.djangoproject.com/wiki/MultipleDatabaseSupport" rel="nofollow noreferrer">Multiple Database Support in Django</a>. It was also brought up during the <a href="http://www.youtube.com/watch?v=M1Qr9rSBGBE" rel="nofollow noreferrer">k...
20,314
<p>I've been reading that some devs/dbas recommend using transactions in all database calls, even read-only calls. While I understand inserting/updating within a transaction what is the benefit of reading within a transaction?</p>
<p>So you get a consistent view of the database. Imagine you have two tables that link to each other, but for some reason you do 2 selects... in pseuodocode:</p> <pre><code>myRows = query(SELECT * FROM A) moreRows = query(SELECT * FROM B WHERE a_id IN myRows[id]) </code></pre> <p>If between the two queries, someone ...
<p>Another good reason holding multiple transaction for read and for insert is the case you wish to insert record base on the data that you get from select query and you also want to commit every X row inserted. </p> <p>Two transaction: </p> <ol> <li>for the read\select. </li> <li>for the insert and commit every X ro...
39,799
<p>Has anyone been able to get a variable record length text file (CSV) into SQL Server via SSIS?</p> <p>I have tried time and again to get a CSV file into a SQL Server table, using SSIS, where the input file has varying record lengths. For this question, the two different record lengths are 63 and 326 bytes. All r...
<p>I had a similar problem, and used custom code (Script Task), and a Script Component under the Data Flow tab.</p> <p>I have a Flat File Source feeding into a Script Component. Inside there I use code to manipulate the incomming data and fix it up for the destination.</p> <p>My issue was the provider was using '0000...
<p>Why can't you just import it as a test file and set the column delimeter to "," and the row delimeter to CRLF?</p>
11,492
<p>What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?</p>
<p>Directly from the source:</p> <p><em><a href="http://support.microsoft.com/kb/318785" rel="nofollow noreferrer">How to determine which versions and service pack levels of the Microsoft .NET Framework are installed</a></em></p>
<p><a href="http://www.hanselman.com/smallestdotnet/" rel="nofollow noreferrer">Get the smallest .NET Framework download possible</a> that will tell you based on the headers you are sending. It only works on Internet Explorer or if you have the Firefox extension installed. More info in <a href="http://www.hanselman.com...
7,564
<p>I want to build into mt ASP.NET application the ability for users to fill up forms, but the forms are not something I can hard-code into my (Enterprise) software.</p> <p>So I need one screen that lets end users create the forms. Doing it the 2.0 way, I just love what PollDaddy did in their survey editor (great job ...
<p>The <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/" rel="nofollow noreferrer">AJAX control toolkit</a> is free and would work for some of this items shown in the video. However, JQuery has tons of plugins it is easy to extend and even easier to use. I would suggest starting there and extending it where...
<p>You could build it yourself using an AJAX framework like ASP.NET AJAX or even telerik controls. You could use jQuery but ASP.NET AJAX is free and embeds well with ASP.NET pages. You could buy something, but I've yet to encounter packages as such.</p>
48,187
<p>When trying to kill a buffer that contains changes in Emacs, the message: " Buffer [buffer] modified; kill anyway? (yes or no)" is displayed. </p> <p>Instead of this I'd like to have Emacs ask me if I want to: 1. View a diff of what changed, 2. Save the buffer, 3. Kill the buffer.</p> <p>How?</p>
<p>The answer lies in using <a href="http://www.delorie.com/gnu/docs/elisp-manual-21/elisp_212.html" rel="noreferrer" title="advice">advice</a>, because the hooks normally run when killing buffers run <strong>after</strong> the "buffer modified" prompt you want to change.</p> <p>The following advice does what you want...
<p>You'll want to write some code to put in the <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Kill-Buffer.html" rel="noreferrer">kill-buffer-hooks</a> and <a href="http://www.gnu.org/software/emacs/elisp/html_node/Saving-Buffers.html" rel="noreferrer">write-file-functions</a> lists. Conceptually, ...
42,962
<p>I'm trying to bind one of my model objects to the fields of a form, using Spring-MVC. Everything works fine, except that one of the attributes of the model object is an unordered collection. Doing something like</p> <pre><code> &lt;c:forEach items="${m.items}" var="i" varStatus="itemsRow"&gt; &lt;form:inpu...
<p>I think it has to be an ordered collection. For example,there's <a href="http://static.springframework.org/spring/docs/2.5.x/reference/validation.html" rel="noreferrer">a chart</a> in the Spring reference that talks about how to reference properties. It says:</p> <blockquote> <p>account[2] Indicates the thir...
<p>You can use a semi-colon-delimited list if you're using numeric references to the IDs of objects, and an appropriate Converter implementation registered.</p> <p>POST data leaderboards=1,2</p> <p>Converter implementation (ignore the JSON stuff)</p> <pre><code> public final class LeaderboardConverter extends...
36,075
<p>So I am sold on the concept of attempting to collect data automatically from a program - i.e., popping up a dialog box that asks the user to send the report when something goes wrong.</p> <p>I'm working in MS Visual Studio C#.</p> <p>From an implementation point of view, does it make sense to put a try/catch loop ...
<p>I think you are right, you would not know what's going to go wrong, which is the point.</p> <p>However, you might as well consider adding a handler to the <a href="http://www.digcode.com/default.aspx?page=ed51cde3-d979-4daf-afae-fa6192562ea9&amp;article=5c26d313-2435-442f-91e8-a73e9aff021b" rel="noreferrer">ThreadE...
<p>The best approach is to sing up for <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx" rel="nofollow noreferrer">AppDomain.UnhandledException</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx" rel="nofollow noreferr...
47,863
<p>What's the difference between JavaScript and Java?</p>
<p>Java and Javascript are similar like Car and Carpet are similar.</p>
<p><a href="https://developer.mozilla.org/en/a_re-introduction_to_javascript" rel="nofollow noreferrer">A Re-Introduction to Javascript</a> by the Mozilla team (they make Firefox) should explain it.</p>
30,402
<p>This is a continuation of my question about <a href="https://stackoverflow.com/questions/339795/reading-the-superblock">reading the superblock</a>.</p> <p>Let's say I want to target the HFS+ file system in Mac OS X. How could I read sector 2 of the boot disk? As far as I know Unix only provides system calls to read...
<p>In Linux, you can read from the special device file <code>/dev/sda</code>, assuming the hard drive you want to read is the first one. You need to be root to read this file. To read sector 2, you just seek to offset <code>2*SECTOR_SIZE</code> and read in <code>SECTOR_SIZE</code> bytes.</p> <p>I don't know if this ...
<p>How does this work in terms of permissions? Wouldn't reading from /dev/... be insecure since if you read far enough you would be able to read files for which you do not have read access?</p>
44,459
<p>How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs.</p> <p><strong>EDIT</strong>: <a href="http://java.sun.com/docs/books/tutorial/uiswing/dnd/index.html" rel="noreferrer">The Java Tutorials - Drag an...
<p>Curses! Beaten to the punch by a Google search. Unfortunately it's true there is no easy way to create draggable tab panes (or any other components) in Swing. So whilst the example above is complete this one I've just written is a bit simpler. So it will hopefully demonstrate the more advanced techniques involved ...
<p>Add this to isDragAcceptable to avoid Exceptions:</p> <pre><code>boolean transferDataFlavorFound = false; for (DataFlavor transferDataFlavor : t.getTransferDataFlavors()) { if (FLAVOR.equals(transferDataFlavor)) { transferDataFlavorFound = true; break; } } if (transferDataFlavorFound == fals...
8,511
<p>I have an object in C# on which I need to execute a method on a regular basis. I would like this method to be executed only when other people are using my object, as soon as people stop using my object I would like this background operation to stop. </p> <p>So here is a simple example is this (which is broken): </p...
<p>Here is my proposed solution to this problem: </p> <pre><code>class Fish : IDisposable { class Swimmer { Thread t; WeakReference fishRef; public ManualResetEvent terminate = new ManualResetEvent(false); public Swimmer(Fish3 fish) { this.fishRef = new We...
<p>I think the IDisposable solution is the correct one. </p> <p>If the users of your class don't follow the guidelines for using classes that implement IDisposable it's their fault - and you can make sure that the documentation explicitly mentions how the class should be used.</p> <p>Another, much messier, option wou...
46,264
<p>I always thought Java uses <strong>pass-by-reference</strong>.</p> <p>However, I've seen <a href="http://javadude.com/articles/passbyvalue.htm" rel="noreferrer">a blog post</a> that claims that Java uses <strong>pass-by-value</strong>.</p> <p>I don't think I understand the distinction they're making.</p> <p>What is ...
<p>The terms &quot;pass-by-value&quot; and &quot;pass-by-reference&quot; have special, <a href="https://en.wikipedia.org/w/index.php?title=Pass-by-value" rel="noreferrer">precisely defined</a> meanings in computer science. These meanings differ from the intuition many people have when first hearing the terms. Much of t...
<p>Every single answer here is tying to take pass pointer by reference from other languages and show how it is impossible to do in Java. For whatever reason nobody is attempting to show how to implement pass-object-by-value from other languages.</p> <p>This code shows how something like this can be done:</p> <pre><code...
6,171
<p>I am writing a set of database-driven applications in PHP. These applications will run on a Linux server as its own user. Other users will likely be on the system at times, but have very controlled access. Other servers they will not have access to at all. I will also expose a limit stored procedure API to devel...
<p>If the machine really is being administered in the traditional Unix fashion, where J. Random user isn't off su-ing to root all the time, I'd say that filesystem permissions are your best bet. If someone gets unauthorized root access, no amount of encryption silliness is going to "secure" the connection string.</p> ...
<p>My best solution so far has been to store config files in an encrypted partition so that people with direct access to the machine can't pull the passwords off by connecting the drive to another PC, and with file system permissions so people can't read the file from inside the OS itself.</p> <p>You need to understan...
43,413
<p>How do you add a page break into a document with XSL-FO? I'm using <a href="http://xmlgraphics.apache.org/fop/" rel="noreferrer">Apache FOP</a> to create PDFs, if that makes a difference.</p>
<p>The <a href="http://xmlgraphics.apache.org/fop/compliance.html" rel="nofollow noreferrer">FOP compliance page</a> says that it supports <code>page-break-after</code>, <code>page-break-before</code>, and <code>page-break-inside</code> in the later versions, plus partial support for <code>keep-together</code>, <code>...
<p>This worked for me. But this is Elite Design Gallery syntax.</p> <pre><code>&lt;w:p &gt;&lt;w:r&gt;&lt;w:br w:type="page"/&gt;&lt;/w:r&gt;&lt;/w:p&gt; </code></pre>
27,896
<p>I am making an expand/collapse call rates table for the company I work for. I currently have a table with a button under it to expand it, the button says "Expand". It is functional except I need the button to change to "Collapse" when it is clicked and then of course back to "Expand" when it is clicked again. The wr...
<pre><code>$('#divID').css("background-image", "url(/myimage.jpg)"); </code></pre> <p>Should do the trick, just hook it up in a click event on the element</p> <pre><code>$('#divID').click(function() { // do my image switching logic here. }); </code></pre>
<p>I've found a solution in a forum, <em><a href="http://www.dynamicdrive.com/forums/showthread.php?t=5967&amp;page=2" rel="nofollow noreferrer">Toggle Background Img</a></em>.</p>
31,621
<p>When designing a collection class, is there any reason not to implement locking privately to make it thread safe? Or should I leave that responsibility up to the consumer of the collection?</p>
<blockquote> <p>is there any reason not to implement locking privately to make it thread safe? </p> </blockquote> <p>It depends. Is your goal to write a collection class which is accessed by multiple threads? If so, make it thread safe. If not, don't waste your time. This kind of thing is what people refer to when t...
<p>This would make it impossible to simultaneously access a collection from several threads even if you know that the element you touch is not used by anyone else.</p> <p>An example would be a collection with an integer based index accessor. Each thread might know from its id which index values it can access without w...
19,833
<p>I want to develop a plug-in that does this:</p> <p><em>A button, when clicked, opens the new mail window but has a certain phrase in the subject line, for e.g. when I click a button called 'PROJ123', the new mail window opens with the subject line "[PROJ123]"</em></p> <p>Other functionality it would need:</p> <ul...
<p>To create a plugin for Outlook, I'd read these resources:</p> <ul> <li><a href="https://www.codeproject.com/Articles/1112815/How-to-Create-an-Add-in-for-Microsoft-Outlook" rel="nofollow noreferrer">CodeProject: How to Create Plugin for Outlook</a></li> <li>MSDN: <a href="http://social.msdn.microsoft.com/Forums/en-U...
<p>You can use VBA and a UserForm, or a Custom Menu. Here is an example of the code:</p> <pre><code>Private Sub cmdCommand_Click() Dim eml As MailItem Set eml = Application.CreateItem(olMailItem) eml.Subject = "Proj1" UserForm1.Hide eml.Display End Sub </code></pre>
48,590
<p>I would like to access a class everywhere in my application, how can I do this?</p> <p>To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in both place by using something. In php I would j...
<p>The concept of global classes in C# is really just a simple matter of referencing the appropriate assembly containing the class. Once you have reference the needed assembly, you can refer to the class of choice either by it's fully qualified Type name, or by importing the namespace that contains the class. (<strong>...
<p>The other answers that you've been given about using a static class or a singleton pattern are correct.</p> <p>Please consider, however, the fact that doing so does compromise your ability to test. In general, if you can, prefer dependency injection over globally accessed classes. I know this isn't always possible ...
22,407
<p>I need a VB.NET Forms application that processes a queue. It basically needs to ping a web service every 30 seconds and then load documents into a document management system, if there are any to load.</p> <p>How would I implement this? Using a loop? Do I need to look into threads?</p> <p>Thanks</p>
<p>If you are already using web services then you may want to stay with the thread-like behavior of services with less complications.</p> <p>Otherwise, just use a Timer object, or if possible, a FileSystemWatcher for your triggers.</p>
<p>How did you define the queue. You can do it with mutlithreading (that is create a threadpool instance) and let the threadpool pop the objects in the queue.</p> <p>However if you have something like file searching in the queue objects then obvsiouly you'd want the first que objec to finish before starting the second...
46,142
<p>A couple of years ago, we had a graphic designer revamp our website. His results looked great, but he unfortunately introduced a new unsupported font by the web browser. </p> <p>At first I was like, "What!?!"... since most of our content is dynamic and there was no real way to pre-make all of the images. There was ...
<p>You should only need to generate each image once, and then save it on the hard disk. The load on your site shouldn't increase the amount of processing you have to do. That being said, it almost sounds like you are using images for things you shouldn't be. If there are so many different images that you can't keep ...
<p>Because of caching, I'd rather add only the image url into the resx. Caching is much better for static content (i-e plain files ) than for generated content.</p>
42,873
<p>I'm trying to print a small box with 1 mm thick walls. The box has rounded corners.</p> <p>Cura slices the rounded corners with straight internal lines instead of rounded lines:</p> <p><a href="https://i.stack.imgur.com/5Kw87.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Kw87.jpg" alt="Rounded ...
<p>I found the solution : It was the option &quot;avoid crossing perimeters&quot; that seems to do exactly the contrary of what it means. Thank you all for your answers.</p>
<p>Enable Z-Hop. I don't know what the actual parameter is called but it should say something like &quot;Z-Hop&quot;.</p>
1,760
<p>Is there a way (reliable and preferably not commercial) to prevent from Reflector to reflect my source code???</p> <p>Thanks, Adi</p>
<p>No. Reflector looks at your assembly just like the .NET runtime would in order to generate native code to execute. The best you could hope for would be to <a href="https://stackoverflow.com/questions/2525/best-net-obfuscation-toolsstrategy">obfuscate</a> your code and make it (somewhat) harder for the reader to unde...
<p>If you are looking for a good Obfuscator, give <a href="http://www.remotesoft.com" rel="nofollow noreferrer">RemoteSoft</a> a try. </p>
48,065
<p>I'm writing a JPA connector to a legacy sistem. The problem is, DB design in the system is.. well.. horrible.</p> <p>I need to implement an entity that maps to three tables. I can do it using named sql queries, but the probem is, I have to use this entity in a OneToMany relation (this entity is on the many side). S...
<p>I haven't actually found a way to do this with JPA. To solve problems like this I ended up using a named query.</p> <p>As far as documentation, I have been using <a href="http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html" rel="nofollow noreferrer">TopLink's</a> and <a ...
<p>Could you make a database view and then create an entity that maps onto that view? I don't know if this is possible, just a thought.</p>
33,675
<p>My i3 MK3 is printing very well for solid parts of an object, but it messes up with infill.</p> <p><a href="https://i.stack.imgur.com/dc5BL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dc5BL.jpg" alt="Infill rough"></a></p> <p>As you can see in the image, the infill is broken into pieces and ...
<p>From your comments can be read that you print infill at 200&nbsp;mm/s. </p> <p>Know that 200&nbsp;mm/s is ridiculously fast (like high travelling speed), close to the limits of printing on certain machines (<a href="/a/8108">for an AtMega</a>)! It is hard for the filament to keep up at this speed. A value of 60&nbs...
<p>I have dealt with this on infill as well on multiple MK3s.</p> <p>However, it was not the speed itself, but the hot end having difficulty extruding enough to keep up with the infill. </p> <p>Some things to try:</p> <ul> <li>Raise hot end temperature 5 degrees (melt filament faster)</li> <li>Lower infill speed, i...
1,217
<p>There might be applications that are not suited for Core Data - image manipulation programs like Photoshop or Gimp for example. But for applications that are suited for Core Data, say Address Book or iCal, what is the criteria to choose Core Data over a custom model?</p>
<p>I recently started a project where I decided to use Core Data for the first time in a real world application. My application is actually version 2.0 of an older app that uses a custom data model, so I spent a lot of time debating this question. Here are some of the things I asked myself.</p> <ul> <li><p>The time to...
<p>Kick :)</p> <p>For me the biggest question you need to ask yourself is: Are you going to store critical data in there (user created content) or data that can easily be reproduced (content downloaded from internet). If you have the first (user created data) i would steer away from Core Data ASAP or make sure you hav...
40,676
<p>What would be the best practice way to handle the caching of images using PHP.</p> <p>The filename is currently stored in a MySQL database which is renamed to a GUID on upload, along with the original filename and alt tag.</p> <p>When the image is put into the HTML pages it is done so using a url such as '/images/...
<p>I would do it in a different manner.</p> <p>Problems: 1. Having PHP serve the files out is less efficient than it could be. 2. PHP has to check the existence of files every time an image is requested 3. Apache is far better at this than PHP will ever be.</p> <p>There are a few solutions here.</p> <p>You can use <...
<p>Your approach seems quite reasonable - I would add that some mechanism should be put into place to check that the date the cached version was generated was after the last modified timestamp of the original (source) image file and if not regenerate the cached/resized version. This will ensure that if an image is chan...
17,009
<p>I'm working on a small app where I can generate a list of barcodes. I have the correct fonts installed on my computer. Right now I am printing them directly to a webpage and it works properly in Chrome and IE 7, but not Firefox. Does anyone know what Firefox would be doing differently than IE and Chrome?</p> <p>Her...
<p>A simpler solution might be to generate images server side to generate the bar codes. That way you don't have to rely on the user having a font installed and you don't have to access the font in your html.</p>
<p>Just do this: <a href="http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/" rel="nofollow">http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/</a> David created a super-simple way to implement bar codes. You will need the GD library running in MySQL. (MAMP &amp; LAMP should already ...
29,818
<p>Some of the requirements (restrictions) for such a ui framework/toolkit are:</p> <ul> <li>No single vendor lock down</li> <li>Ability for real time data visualization</li> <li>Good initial widgets</li> <li>Good dash boarding capabilities</li> <li>cross platform</li> <li>Good development/debug environment</li> <li>N...
<p>It's a pity you can't/won't use Flash. Else I could really recommend Adobe AIR. It has a good editor (Flex Builder built on Eclipse), a good component framework with many out of the box components, charting components set, ability to communicate with many different protocols (and you could write your own protocol im...
<p>There's also Java of course. It satifies all your requirements AFAICS. Plenty of custom charting controls, which are things you will struggle to find for GTK/WxWindows/$other_small_userbase_framework.</p> <p>If you dont like Swing(its come a long way - Metal is dead, long live SystemDefault L&amp;F!), there are op...
23,704
<p>I have an MDI application that allows me to open different types of child windows. I can open multiple (but different) instances of the same type of child window. (Example: I can open 3 instances of child window type A and 2 instances of child window type B. All 5 windows are distinct entities and do not share da...
<p>This feels like a hack, but it works (kind of) (sorry, vb.net not c#):</p> <pre><code>Public Class UserControl2 Private Sub tsMainMenu_BeginDrag(ByVal sender As Object, ByVal e As System.EventArgs) Handles tsMainMenu.BeginDrag tsMainMenu.Tag = tsMainMenu.Parent End Sub Private Sub ToolStrip1...
<p>Have you tried to use the DragEnter and DragLeave Events of the ToolStripContainer to identify a ToolStrip dragged over the container an accept or deny it?</p>
38,118
<p>I have to implement a homemade Trie and I'm stuck on the Iterator part. I can't seem to figure out the increment method for the trie.</p> <p>I hope someone can help me clear things out.</p> <p>Here's the code for the Iterator:</p> <pre><code>template &lt;typename T&gt; class Trie&lt;T&gt;::IteratorPrefixe{ friend...
<p>I'm glad to see Tries are still taught, they're an important data structure that is often neglected.</p> <p>There may be a design problem in your code since you should probably have a Trie class and a Node class. The way you wrote it it looks like each node in your Trie is it's own trie, which can work, but will ma...
<p>For one thing, the code shown does not actually describe a trie. Rather, it appears to be a tree containing a pair of elements in each node (<code>T*</code> and <code>unsigned</code>). You can <em>by discipline</em> use a tree of tuples as a trie, but it's only by convention, not enforcement. This is part of why ...
45,733
<p>And why would I use one over the other in my code?</p>
<blockquote> <p><strong>Caution: This answer appears to be out of date.</strong> It was posted before .NET 4 became available, which apparently introduced some optimizations regarding <code>Type</code> and thus rendered the information in this answer obsolete. See <a href="https://stackoverflow.com/a/1438443/240733">...
<p>In .NET 4.0 Beta 1 <code>RuntimeTypeHandle</code> just wraps <code>RuntimeType</code>. It seems all benefits of using it as a cheap <code>Type</code> proxy have gone.</p> <h3>Evidence for the above claim:</h3> <ul> <li>Microsoft's <a href="https://referencesource.microsoft.com/#mscorlib/system/runtimehandles.cs" ...
6,158
<p>Story: The user uploads an image that will be added to a photo gallery. As part of the upload process, we need to A) store the image on the web server's hard drive and B) store a thumbnail of the image on the web server's hard drive.</p> <p>"Best" here is defined as </p> <ul> <li>Relatively easy to implement, un...
<p>I suppose your best solution would be using the <a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx" rel="noreferrer">GetThumbnailImage </a> from the .NET <a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx" rel="noreferrer">Image</a> class.</p> <pre><...
<p>You can use the Image.GetThumbnailImage function to do it for you.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx</a> (.NET 3.5)</p> <p><a href="http:/...
4,759
<p>I want to connect to DB using the iSeries Client Access driver. I use the following connection string:</p> <p>DRIVER=Client Access ODBC Driver (32-bit);QUERYTIMEOUT=0;PKG=QGPL/DEFAULT(IBM),2,0,1,0,512;LANGUAGEID=ENU;DFTPKGLIB=QGPL;DBQ=QGPL XXXXXXXX;SYSTEM=XXX.XXXXXXX.XXX;Signon=2</p> <p>I get an exception when co...
<p>This is closely related to your other question about Haskell and quicksort. I think you probably need to read at least the <em>introduction</em> of a book about Haskell. It sounds as if you haven't yet grasped the key point about it which is that it bans you from modifying the values of existing variables.</p> <p>S...
<p>After reading enough in a Haskell book to really understand Earwicker's answer I'd suggest you also read about type classes. I'm not sure what “partial specialization” means, but it sounds like they could come close.</p>
49,372
<p>Has anybody out there used the <a href="http://www.swig.org/exec.html" rel="noreferrer">SWIG</a> library with C#? If you have, what pitfalls did you find and what is the best way to use the library? I am thinking about using it as a wrapper for a program that was written in C and I want to wrap the header files wh...
<p>I think the mistake the earlier posters did was read the docs and not look at the examples. </p> <p>A few hours ago I needed to interface some C++ classes to C#. I looked in my Swig dir (I already had it for other work), found the directory <code>Examples/csharp/class</code>, browsed the code, loaded the solution, ...
<p>I did attempt to use SWIG to wrap a project C++ for using in .NET a few years ago.</p> <p>I didn't get very far as it was a massive giant pain to produce the configuration that SWIG required. At the time I just wanted a solution, not to learn another language/api/etc. SWIG may be easier to use these days, I couldn'...
4,491
<p>Is user profiles an appropriate place to store things like number of items per page in a custom grid user selected? (I you can store it in the view, but it won't be per user this way).</p> <p>My first though was to store these settings in user profiles, but there are problems with access permissions for programmati...
<p>Given that the information is not sensitive a simple database with values stored against AD login should suffice.</p> <p>And as you have the ASP.Net user database already, storing the information there would be the best option.</p>
<p>Maybe a Global List, that is only accessible for the SHAREPOINT\SYSTEM User and that you can then Query in a SPSecurity.RunWithElevatedPrivileges Function.</p> <p>Disadvantage: You require Custom code to read/write to that list.</p>
31,559
<p>I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete.</p> <p>Any suggestions would be much appreciated.</p>
<p>Assuming this is running on a Linux machine, I've always handled it like this:</p> <pre><code>exec(sprintf("%s &gt; %s 2&gt;&amp;1 &amp; echo $! &gt;&gt; %s", $cmd, $outputfile, $pidfile)); </code></pre> <p>This launches the command <code>$cmd</code>, redirects the command output to <code>$outputfile</code>, and w...
<p>I know it is a 100 year old post, but anyway, thought it might be useful to someone. You can put an invisible image somewhere on the page pointing to the url that needs to run in the background, like this:</p> <p><code>&lt;img src="run-in-background.php" border="0" alt="" width="1" height="1" /&gt;</code></p>
6,797
<p>I have an Array Collection with any number of Objects. I know each Object has a given property. Is there an easy (aka "built-in") way to get an Array of all the values of that property in the Collection?</p> <p>For instance, let's say I have the following Collection:</p> <pre><code>var myArrayCollection:ArrayColle...
<p>Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, but I used another example of mine to build this.</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { Bench[] benchList; FoodIntake[] foodIntakeList; Panel panelChartHolder; ...
<p>I have updated the MS chart samples for .NET 4.0 and added two additional projects -- ChartsWithMVC and ChartsWithoutWebForms. You might find my sample code helpful, as I have a very basic implementation of a dynamic chart system using the asp.net chart control:</p> <p><a href="http://develocity.blogspot.com/2010/...
43,456
<p>I have a paradox table from a legacy system I need to run a single query on. The field names have spaces in them - i.e. "Street 1". When I try and formulate a query in delphi for only the "Street 1" field, I get an error - Invalid use of keyword. Token: 1, Line Number: 1</p> <p>Delphi V7 - object pascal, standard...
<p>You need to prefix the string with the table name in the query.</p> <p>For example: field name is 'Street 1', table is called customers the select is:</p> <pre><code>SELECT customers."Street 1" FROM customers WHERE ... </code></pre>
<p>I think you must use [ and ] instead of ":</p> <pre><code>SELECT customers.[Street 1] FROM customers WHERE ... </code></pre>
14,156
<p>I'm trying to set the width and height of an element with javascript to cover the entire browser viewport, and I'm successful using <pre>document.body.clientHeight</pre> but in IE6 it seems that I always get horizontal and vertical scrollbars because the element must be slightly too big. </p> <p>Now, I really don't...
<p>have you considered using <a href="http://jquery.com" rel="nofollow noreferrer">jQuery</a>? it abstracts most of the browser specific functionality away into a common interface.</p> <pre><code>var width = $(document).width(); var height = $(document.height(); $('#mySpecialElement').width(width).height(height); </c...
<p>Ah ha! I forgot about <pre>document.documentElement.clientLeft</pre> and <pre>document.documentElement.clientTop</pre>.</p> <p>They were 2 in IE and 0 in the good browsers. So using <pre>var WIDTH = ((document.documentElement.clientWidth - document.documentElement.clientLeft) || document.body.clientWidth);</pre> e...
20,680
<p>I would like to move items from one list to another on a page, and I'm pretty flexible about what type of a list it is. What's the best way to do that? ASP.NET Ajax? jQuery? Anything else?</p>
<p>There's a nice tutorial on CodeProject that covers dragging with ASP.NET and jQuery:</p> <p><a href="http://www.codeproject.com/KB/webforms/JQueryPersistantDragDrop.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/webforms/JQueryPersistantDragDrop.aspx</a></p>
<p>if you want to do this and PostBack instead of using AJAX to update your data based on from fields you'll need to get creative about what types of controls you use. Page validation will complain about ASP controls like dropdownlists, listboxes, etc. if they contain selected items that weren't in the list when it wa...
27,795
<p>I have a class with a string property that's actually several strings joined with a separator.</p> <p>I'm wondering if it is good form to have a proxy property like this:</p> <pre><code>public string ActualProperty { get { return actualProperty; } set { actualProperty = value; } } public string[] Individu...
<p>Linking two settable properties together is bad juju in my opinion. Switch to using explicit get / set methods instead of a property if this is really what you want. Code which has non-obvious side-effects will almost always bite you later on. Keep things simple and straightforward as much as possible.</p> <p>Also,...
<p>Well I'd say your "set" is high risk, what if somebody didn't know they had to pass an already joined sequence of values or your example above was maybe missing that. What if the string already contained the separator - you'd break.</p> <p>I'm sure performance isn't great depending on how often this property is use...
11,305
<pre><code> ArrayList filters = new ArrayList(); filters.Add(new string[] { "Name", "Equals", "John" }); ObjectDataSource1.SelectParameters.Add("AppliedFilters", string.Join(",",(string[])filters.ToArray(typeof(string)))); </code></pre> <p>Am trying to add a parameter to my object data source which ...
<p>A somewhat obvious one: always redefine <code>respond_to?</code> if you redefine <code>method_missing</code>. If <code>method_missing(:sym)</code> works, <code>respond_to?(:sym)</code> should always return true. There are many libraries that rely on this.</p> <p><em>Later:</em></p> <p>An example:</p> <pre><code...
<p>Another gotcha:</p> <p><code>method_missing</code> behaves differently between <code>obj.call_method</code> and <code>obj.send(:call_method)</code>. Essentially the former one miss all private and non-defined methods, while later one doesn't miss private methods.</p> <p>So you <code>method_missing</code> will neve...
37,128
<p>I haven´t experience in making setup, but I all ready make mine but now I need help because when I made a new version I want that the user double click the shortcut and it do the update if there are any.</p> <p>The application is in <code>c#</code>.</p> <p>Could you help?</p>
<p>Here's how I have implemented an updater program I wrote earlier.</p> <p>First off, you grab an ini file off of your server. This file will contain information about the latest version and where the setup file is. Getting that file isn't too hard.</p> <pre><code> WebClient wc = new WebClient(); ...
<p>Sounds like you might be able to use <a href="http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx" rel="nofollow noreferrer">ClickOnce</a></p>
30,652
<p>I'm looking for a query which will return me an extra column at the end of my current query which is the count of all columns within the return set which contain a null column. For example:</p> <pre><code>Col 1 - Col 2 - Col 3 A B 0 A NULL 1 NULL NULL 2 </code></pre> <p>Is there a simple...
<p>Ugly solution:</p> <pre><code>select Col1, Col2, case when Col1 is null then 1 else 0 end + case when Col2 is null then 1 else 0 end as Col3 from ( select 'A' as Col1, 'B' as Col2 union select 'A', NULL union select NULL, NULL ) z </code></pre> <p>This returns</p> <pre><code>Col1 Col2 Col3 NULL...
<p>If there isnt a very good reason you need to do this in the SQL, you should just do a for loop through the result set and count the NULL vlues then. </p> <p>The cost goes from n^n to n..</p>
20,934
<p>I use <a href="http://msdn.microsoft.com/en-us/library/system.web.services.webmethodattribute.aspx" rel="nofollow noreferrer">System.Web.Services.WebMethodAttribute</a> to make a public static method of an ASP.NET page callable from a client-side script:</p> <p><strong><em>test.aspx.cs</em></strong></p> <pre><code...
<p>You have a problem here and that is the limited capabilities of JPA when it comes to handling enums. With enums you have two choices:</p> <ol> <li>Store them as a number equalling <code>Enum.ordinal()</code>, which is a terrible idea (imho); or</li> <li>Store them as a string equalling <code>Enum.name()</code>. <...
<p>use this annotation</p> <pre><code>@Column(columnDefinition="ENUM('User', 'Admin')") </code></pre>
45,916
<p>After multiple jams from bulging filaments on two spools I'm getting frustrated. One, right before a job was done.</p> <p>Is there something I can do to prevent these bulges in filaments from ruining jobs?</p> <p>What can I do to prevent this from happening in the future before it's a disaster?</p> <p>He's a pic...
<p>How to catch <em>and</em> fix these on the fly? That would be difficult..</p> <p>But this is an issue you really should not have.</p> <p><a href="https://3dprinting.stackexchange.com/q/84/47">Could it be an issue with filament storage?</a></p> <p>Or is it coming from the manufacturer with these bulges? If so, I w...
<p><strong>Bottom line: <em>The easiest way to prevent this is to avoid cheap filament.</em></strong></p> <p>You can get mid-grade filament for a few dollars more than the ultra cheap stuff. </p> <p>In other words I tried out some 10$ stuff from ebay, and while it might print for a little while it notoriously clogged...
137
<p>I tried to override the settings in the default stlyesheet that comes with the simplemodal jquery plugin with containerCSS which is working fine in IE7 but not Firefox or Chrome. Not sure if this is a bug or I am doing something wrong.</p> <p><strong>jQuery code:</strong></p> <pre><code>$(document).ready(function(...
<p>Gecko and WebKit based browsers really like their units. Make sure you always tell it how to measure your values.</p> <p>Also as a note, if you want to override inline styles from a css file, you can do so by adding !important to the end of the value.</p> <p>height: 300px !important;</p> <p>will override the inli...
<p>I would have a look at jqModal instead. </p>
29,504
<p>I am using Windows, and I have two monitors.</p> <p>Some applications will <em>always</em> start on my primary monitor, no matter where they were when I closed them.</p> <p>Others will always start on the <em>secondary</em> monitor, no matter where they were when I closed them.</p> <p>Is there a registry setting ...
<p>Correctly written Windows apps that want to save their location from run to run will save the results of <a href="http://msdn.microsoft.com/ru-ru/library/windows/desktop/ms633518%28v=vs.85%29.aspx" rel="noreferrer"><code>GetWindowPlacement()</code></a> before shutting down, then use <code>SetWindowPlacement()</code>...
<p>Right click the shortcut and select properties. Make sure you are on the "Shortcut" Tab. Select the RUN drop down box and change it to Maximized. </p> <p>This may assist in launching the program in full screen on the primary monitor. </p>
7,606
<p>I know WCF supports many WS-* protocols but WS-Eventing does seem to be listed.</p> <p>I do know that WCF has a pub/sub model, but is it WS-Eventing compliant?</p>
<p>I seem to remember reading about this on CodeProject a while ago. </p> <p>Sorry I can't help more, but <a href="http://www.codeproject.com/KB/WCF/WSEventing.aspx" rel="nofollow noreferrer">this is the article</a> by Roman Kiss.</p>
<p>There is no native pub/sub model in WCF 3.0, however there are a few options.<br> - The Roman Kiss article Ash found.<br> - There is a lot of other patterns you could implement (covered in <a href="http://msdn.microsoft.com/msdnmag/issues/06/10/WCFEssentials/" rel="nofollow noreferrer">MSDN Mag</a>)<br> - Juval Lowy...
13,264
<p>What is the best way to convert a UTC datetime into local datetime. It isn't as simple as a getutcdate() and getdate() difference because the difference changes depending on what the date is.</p> <p>CLR integration isn't an option for me either.</p> <p>The solution that I had come up with for this problem a few mo...
<p>Create two tables and then join to them to convert stored GMT dates to local time:</p> <pre><code>TimeZones e.g. --------- ---- TimeZoneId 19 Name Eastern (GMT -5) Offset -5 </code></pre> <p>Create the daylight savings table and populate it with as much information as you can (local laws...
<p>Maintain a TimeZone table, or shell out with an extended stored proc (xp_cmdshell or a COM component, or your own) and ask the OS to do it. If you go the xp route, you'd probably want to cache the offset for a day.</p>
4,442
<p>I have an array of 1000 strings to load into a combo box. What is the fastest way to load the array of strings into the combo box?</p> <p>Is there some way other than iterating over the list of strings, putting each string into the combo box one at a time?</p> <p>And how to copy the combo box data once loaded to s...
<p>If you have 1,000 strings repeated in 10 comboboxes, you may want to consider using an owner drawn combobox, which draws the strings on the fly based on indices into your array, rather than storing them in the combobox at all. Way faster, way more memory efficient. Check out the <strong>DrawItem</strong> method an...
<p>I will consider using a pick list instead of a combo box for performance.</p> <p>A general rule of thumb to improve performance when inserting many item in a UI list is to call before the insertion and setting it back to true after.</p> <p>Here's the correct syntax</p> <pre><code>#define NB_ITEM 1000 #define ITEM...
28,395
<p>I wrote a program which includes writing and reading from database. When I run the app and try to perform writing I call the following method:</p> <pre><code>public static void AddMessage(string callID, string content) { string select = "INSERT INTO Sporocilo (oznaka_klica, smer, vsebina, pr...
<p>Are you performing a commit after this? It might be running your statement but then not committing the changes and doing an implicit rollback.</p> <p>I think the exception handling looks dodgy. There is no point catching something unless you can actually handle it in some way. The top level of your framework is ...
<p>Have you tried setting the return value of the ExecuteScalar method to an int and then checking value against the table?</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx" rel="nofollow noreferrer">ExecuteScalar</a> -</p> <p><em>Executes the query, and retu...
26,588
<p>Background: I have a kubuntu laptop right now that I can't use wirelessly, i.e. I haven't got wireless assistant installed. But I have a windows laptop that I can download the debian packages seperately on a USB memory stick.</p> <p>How do I install a debian package on the computer locally?</p>
<p>Once you have the USB stick mounted:</p> <pre><code>dpkg --install /path/to/foo_VVV-RRR.deb </code></pre> <p>(where fooVVV-RRR.deb is the package's file name)</p> <p>You can find more commands at the <a href="http://www.debian.org/doc/FAQ/ch-pkgtools.en.html" rel="nofollow noreferrer">Debian GNU/Linux FAQ</a>.</p...
<p>If you're not a command line fan, double-clicking on the .deb files in the file manager should launch a package installer. Has exactly the same effect as <code>dpkg -i</code> of course.</p>
34,216
<p>I'm still working with this huge list of URLs, all the help I have received has been great.</p> <p>At the moment I have the list looking like this (17000 URLs though):</p> <ul> <li><code>http://www.example.com/page?CONTENT_ITEM_ID=1</code></li> <li><code>http://www.example.com/page?CONTENT_ITEM_ID=3</code></li> <li>...
<p>This is probably as fast as you can get without writing code.</p> <pre> $ cat foo.txt http://www.example.com/page?CONTENT_ITEM_ID=1 http://www.example.com/page?CONTENT_ITEM_ID=3 http://www.example.com/page?CONTENT_ITEM_ID=2 http://www.example.com/page?CONTENT_ITEM_ID=1 http://www.example.com/...
<p>Here is another version in Python:</p> <pre><code>import fileinput, itertools urls = sorted(fileinput.input()) for url, sameurls in itertools.groupby(urls): print url.rstrip(), &quot;|&quot;, sum(1 for _ in sameurls) </code></pre> <p>Example:</p> <pre><code>$ cat foo.txt http://www.example.com/page?CONTENT_ITEM...
33,197
<p>I am working on an ASP.Net web application that must print dynamically created labels on standard Avery-style label sheets (one particular size, so only one overall layout). The labels have a variable number of lines (3-6) and may contain either lines of text or a graphic barcode image.</p> <p>Our first cut, that I...
<p>Forget HTML and make a PDF. HTML printing is extremely variable - not just across browsers but across different versions of the same browser. PDF is a lot easier.</p> <p>Even if you get it exactly right with one browser / font setup / printer / phase of the moon, it will be the most fragile thing you've ever had to...
<p>Add a few options to your app that let users adjust spacing for their particular configuration. You could include this right on the label if you want, and style it away via media selectors, but you'll probably want to persist them somewhere, too.</p>
19,851
<p>Forgive me for a potentially silly question here, but in other programming languages (scripting ones like PHP or Perl) it is often easy to dump everything contained within a variable.</p> <p>For instance, in PHP there are the <code>var_dump()</code> or <code>print_r()</code> functions. Perl has the <code>Data::Dump...
<p>In Cocoa, there is no "dump" like PHP's print_r or python's <strong>repr</strong> since there is no textual format that "represents" an object as in those languages. If you use</p> <pre><code>NSLog(@"%@", myObj); </code></pre> <p>or</p> <pre><code>NSString *stringRep = [NSString stringWithFormat:@"%@",myObj]; </c...
<p>Be careful with NSLog logging -> you most likely don't want it in production code.</p> <p>You may want to use an alternate logging function that calls NSLog when your product is running in debug mode.</p>
36,827
<p>What's going on here?</p> <p>printf.sh:</p> <pre><code>#! /bin/sh NAME="George W. Bush" printf "Hello, %s\n" $NAME </code></pre> <p>Command line session:</p> <pre><code>$ ./printf.sh Hello, George Hello, W. Hello, Bush </code></pre> <p>UPDATE: <code>printf "Hello, %s\n" "$NAME"</code> works. For why I'm not usi...
<p>Your NAME variable is being substituted like this:</p> <pre><code>printf "Hello, %s\n" George W. Bush </code></pre> <p>Use this:</p> <pre><code>#! /bin/sh NAME="George W. Bush" printf "Hello, %s\n" "$NAME" </code></pre>
<p>If you want all of those words to be printed out on their own, use <strong>print</strong> instead of <strong>printf</strong> </p> <p><strong>printf</strong> takes the formatting specification and applies it to each argument that you pass in. Since you have three arguments {George, W., Bush}, it outputs the string t...
6,346
<p>I'm looking at adding Visual Studio Database Edition (aka. VSDE) to my version of VS2008.</p> <p>Q1. What's the order of install of these products? is this ok?</p> <p><em>Update: Fixed the ordering of the install, based on feedback.</em></p> <ul> <li>VS2008 (c# [no sub options], web dev, ts tools. nothing else).<...
<p>Q1 - the GDR has a pre-requisite of VS2008 SP1, so switch those last two around.</p> <p>Q2 - I believe that each dev should be working with their own sandboxed database instance, yes. If you don't want to install instances of SQL Server on your workstations, then using multiple instances of SQL on a development ser...
<p>I would put the DB on the development machine. You can change the service so that it doesn't start by default and start it manually whenever you want to use it, if you don't want it running all the time. I prefer this so that I'm not dependent on the availability of another system while developing. If you go thi...
47,770
<p>I have an Air application with a main window. I would like to have a new window fly out from the side of the main window when the user clicks on a button in the main window. The window that appears needs to display information based on value passed from the main form. How can I achieve this with Flex Builder 3?</p> ...
<p>For C++, a better than static is to put it in an unnamed (anonymous) namespace. This is the preferred way to prevent pollution of the Global namespace.</p> <pre><code>namespace { void myLocalFunction() { // stuff } } </code></pre>
<p>If by 'module' you just mean a CPP file, you could just place the declaration and the definition right in the CPP file.</p>
40,599
<p>Sometimes supports are very difficult to remove (physically) when I print with ABS. The image below, from <a href="https://www.thingiverse.com/thing:1613957" rel="nofollow noreferrer">Thingiverse - MOF-5 unit cell</a>, is after significant effort to remove the yellow ABS supports from a black ABS model.</p> <p><a h...
<p>I've had great success printing with HIPS (high-impact polystyrene) as a support for both PLA and ABS. Most sites recommend it for use with ABS because the materials melt at similar temperatures and work best with heated beds, but I've had good luck using it as a support material with PLA on a bed at 60°C. It doesn'...
<p>While I haven't used PVA yet, think of it this way, it may be 4x the cost but you use significantly less material for support structures even if you have a lot of support.</p>
606
<p>I am trying to create a MATLAB class with a member variable that's being updated as a result of a method invocation, but when I try to change the property within the class it (apperently, from what I understood from MATLAB's memory management) creates a copy of the object and then modifies it, leaving the original o...
<h3>Using a Value (Vanilla) Class</h3> <p>When using a value class you need to tell Matlab to store a modified copy of the object to save the changes in the property value. So,</p> <pre><code>&gt;&gt; a=testprop &gt;&gt; a.Request(5); % will NOT change the value of a.numRequests. 5 &gt;&gt; a.Request(5) 5 &gt;&gt; ...
<p>You have to remember that syntactically in Matlab, you're probably closer to C, than C++ or Java, at least with respect to objects. So, of you want to change the "contents" of a value object (really just a special <code>struct</code>), you need to return the object from the function. </p> <p>Azim was correct to p...
25,642
<p>Is there a way to detect if a mouse button is currently down in JavaScript?</p> <p>I know about the "mousedown" event, but that's not what I need. Some time AFTER the mouse button is pressed, I want to be able to detect if it is still pressed down.</p> <p>Is this possible?</p>
<p>Regarding <a href="https://stackoverflow.com/a/322650/2750743">Pax' solution</a>: it doesn't work if user clicks more than one button intentionally or accidentally. Don't ask me how I know :-(.</p> <p>The correct code should be like that:</p> <pre><code>var mouseDown = 0; document.body.onmousedown = function() { ...
<p>Well, you can't check if it's down after the event, but you can check if it's Up... If it's up.. it means that no longer is down :P lol</p> <p>So the user presses the button down (onMouseDown event) ... and after that, you check if is up (onMouseUp). While it's not up, you can do what you need.</p>
41,729
<p>Say I want to design a database for a community site with blogs, photos, forums etc., one way to do this is to single out the concept of a "post", as a blog entry, a blog comment, a photo, a photo comment, a forum post all can be thought as a post. So, I could potentially have one table named Post [PostID, PostType...
<p>Let me ask you this:</p> <p>What happens if two years from now you decide to add a 'music post' as a blog type? Do you have to create a new table for MusicPost, and then re-code your application to integrate it? Or would you rather log on to your blog admin panel, add a blog type in a drop-down box called 'Music'...
<p>The problem is similar to the question of how deep your hierarchy should be in an OO design.</p> <p>A simple approach in OO terms would be to have a base class <code>Post</code> and children for <code>BlogPost</code>, <code>ForumPost</code> and so on. <code>Comment</code> could either be a child of <code>Post</code...
48,169
<p>On an 8-bit micro controller I would like to do the following:</p> <pre><code>16bit_integer = another_16bit_integer * 0.997;</code></pre> <p>with the least possible number of instructions.</p>
<p>How about integer arithmetic in 32 bits?</p> <pre><code>16bit_integer = (int16_t) (another_16bit_integer * (int32_t) 997 / 1000); </code></pre> <p>32 bits will be enough to store (INT16_MAX × 997), do the sum on values 1000 times larger then divide back to your 16 bit scale.</p>
<p>Precomputed lookup table:</p> <pre><code>16bit_integer = products[another_16bit_integer]; </code></pre>
4,701
<p>We are developing automated regression tests using VMWare and NUnit. We have divided tests into steps and now I would like to see each step be examined for performance regression. Simply timing the tests, as NUnit does, does not seem reliable. I have figured in a acceptance factor of about 15% but our steps can diff...
<p>For this sort of performance testing, there's no such thing as a system that will give you a simple pass/fail result. In real life, changing your system is likely to make some things faster and some other things slower, so it's usually not a choice between "better" and "not better", it's a choice between different ...
<p>You might look into the features available with a tool such as Ants Profiler as it does give method executing/run times, but I'm not sure what it offers in terms of repeated testing.</p>
10,309
<p>I am designing a class for log entries of my mail server. I have parsed the log entries and created the class hierarchy. Now I need to save the in memory representation to the disk. I need to save it to multiple destinations like mysql and disk files. I am at a loss to find out the proper way to design the persisten...
<p>Personally I'd break things out a bit - the object representing a log entry really shouldn't be worrying about how it should save it, so I'd probably create a MySQLObjectStore, and FileObjectStore, which you can configure separately, and gets passed the object to save. You could give your Object class a class variab...
<p>Unless I completely misunstood your question, I would recommend using the Strategy pattern. Instead of having this one class try to write to all of those different sources, delegate that responsibility to another class. Have a bunch of LogWriter classes, each one with the responsibility of persiting the object to a ...
21,466
<p>A friend of mine claims that in a typical database, using (for example) <code>nvarchar[256]</code> will give marginally better performance than <code>nvarchar[200]</code> or <code>nvarchar[250]</code> because of the granularity of page allocations.</p> <p>Is there any truth to this whatsoever?</p> <p>Thanks!</p>
<p>This is not true. Tables are allocated on disk in 8k pages. When a table is read from disk, the entire page is read in one IO operation and stored in memory. Therefore, the length of a column will not affect memory alignment at all. In fact, with non-variable length data types, shorter is definitely better: an nchar...
<p>I wonder if the friend of yours somehow arrived at his conclusion on his/her own or if this was a case of myth-propagation.</p> <p>There's a great presentation by Tom Kyte on "Things you know" that pretty much everyone should watch before making claims like the one above: <a href="http://www.ioug.org/services/webca...
26,102
<p>I didn't have any printer-related problem for the past 6 months, but now all of a sudden my Prusa MK3S stopped extruding during printing.</p> <p>This is very strange as I can easily load\unload filament and control the step motor via Settings\Move axis\Extruder. When I did so, the filament got extruded normally.</p>...
<ol> <li><p>It doesn't seem to be heat creep. See <a href="https://3dprinting.stackexchange.com/questions/15629/what-are-ways-to-avoid-heat-creep">What are ways to avoid heat creep?</a></p> </li> <li><p>Have you measured the actually temperature of the heater block? You may have a failing sensor (thermistor) or sensor...
<p>As it turned out, rebuilding the extruder actually helped. I took it apart to the point where both fans were loose as well as the extruder motor and the hotend. I didn't find anything wrong after a quick look so I put it all back together.</p> <p>Then i ran the first layer calibration and for some reason it worked. ...
1,976
<p>What <strong>exactly</strong> are the Python scoping rules?</p> <p>If I have some code:</p> <pre><code>code1 class Foo: code2 def spam..... code3 for code4..: code5 x() </code></pre> <p>Where is <code>x</code> found? Some possible choices include the list below:</p> <ol> <li>In t...
<p>Actually, a concise rule for Python Scope resolution, from <a href="https://rads.stackoverflow.com/amzn/click/com/0596513984" rel="noreferrer" rel="nofollow noreferrer">Learning Python, 3rd. Ed.</a>. (These rules are specific to variable names, not attributes. If you reference it without a period, these rules apply....
<p>In Python, </p> <blockquote> <p>any variable that is assigned a value is local to the block in which the assignment appears.</p> </blockquote> <p>If a variable can't be found in the current scope, please refer to the LEGB order.</p>
37,252
<p>I get this message:</p> <blockquote> <p>Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectDistinguishedName', FindValue 'CN=HighBall'.</p> </blockquote> <p>My web.config setup looks like this;</p> <p>Authentication is set ...
<p>Check the other post about the tool that you asked about. Verify your "my" storage and check if the CN="HighBall". I guess your CN is not just "HighBall", probably it has a top level domain. I think it's easier to look for the certificate serial number, i think it's faster than for it's canonical name and error pron...
<p>Try to use Certificate Manager (with MMC) to see installed certificates. Instructions for XP: <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sag_cmprocsfind.mspx?mfr=true" rel="nofollow">manage certificates for a computer</a>, probably similar with Vista and 7 as well.</p> <...
26,568
<p>I have a GridView control that I am dynamically creating at runtime. I am creating all the columns like this.</p> <pre><code>foreach (GridColumnConfig column in columns) { BoundField boundField = new BoundField(); boundField.HeaderText = column.Title; boundField.DataField = column.FieldName; boundFi...
<p>The word-wrap CSS style works for me when I want to control wrapping. Here's a discussion that pretty well covers it.</p> <p><a href="http://bytes.com/forum/thread627827.html" rel="nofollow noreferrer">http://bytes.com/forum/thread627827.html</a></p>
<p>you can add this to the gridview - Style="white-space: nowrap" </p> <p>Gridview doesnt have a property called style, but you can add it and it will work.</p> <p>Or you can declare a CSS class and assign it to the gridview</p>
30,901
<p>I am doing .net programming in addition to c and c++ development and want more flexibility on my home machine. I want to be able to have both Linux (probably Ubuntu) and Windows Vista on my home computer. Is there a way I can install both and on boot be prompted for which one to start? Is there a way to set Windo...
<p>The latest versions of Ubuntu include an installer called <a href="http://wubi-installer.org/" rel="noreferrer">Wubi</a>, which installs Ubuntu as a windows application (ie: it can be uninstalled from Add/Remove programs) and sets up the dual boot for you! It's great for those who want to give Linux a try without a ...
<p>What you're looking for is called 'Dual booting'. it allows one to choose which operating system to boot at the start. It's well supported in Linux, especially Ubuntu. Just install Ubuntu and it will set up dual booting by default.</p>
22,076
<p>I realize that parameterized SQL queries is the optimal way to sanitize user input when building queries that contain user input, but I'm wondering what is wrong with taking user input and escaping any single quotes and surrounding the whole string with single quotes. Here's the code:</p> <pre><code>sSanitizedInput...
<p>First of all, it's just bad practice. Input validation is always necessary, but it's also always iffy.<br> Worse yet, blacklist validation is always problematic, it's much better to explicitly and strictly define what values/formats you accept. Admittedly, this is not always possible - but to some extent it must alw...
<p>It might work, but it seems a little hokey to me. I'd recommend verifing that each string is valid by testing it against a regular expression instead.</p>
16,843
<p>I'm writing code in Java, using the NetBeans IDE. I keep getting a couple of "Incompatible Type" errors. I declare a variable as String and then assign to it the value from a method that returns a String too. The error says that there was expected a type of "String" but instead found "..." where "..." the name of th...
<p>Make sure that the other method is returning also a "java.lang.String", not a user defined object "string".</p>
<p>Perhaps you could post a more complete code snippet? </p> <p>It looks like your method argument <code>string</code> isn't a <code>java.lang.String</code>?</p>
37,865
<p>I have been using Eclipse as an IDE for a short amount of time (about 3 months of full use) and almost every day I learn about some shortcut or feature that I had absolutely no idea about. For instance, just today I learned that <kbd>Ctrl</kbd>+<kbd>3</kbd> was the shortcut for a Quick Access window.</p> <p>I was ...
<p>My most commonly used features are</p> <p><kbd>ctrl</kbd>+<kbd>1</kbd> quick-fix / spell-checker</p> <p>opening files</p> <ul> <li><kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>t</kbd> load class file by classname</li> <li><kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>r</kbd> load any file by filename</li> </ul> <p>matches are ...
<p>I find the project-specific settings useful in Eclipse 3.3.</p> <p>For example, if you have several developers working on a project who have different code styles for curly braces, line spacing, number of imports etc. then you can specify the style settings for the project. Then you can configure the save actions ...
4,088
<p>Is there a good way in C++ to implement (or fake) a type for a generic vector of vectors?</p> <p>Ignore the issue of when a vector of vectors is a good idea (unless there's something equivalent which is always better). Assume that it does accurately model the problem, and that a matrix does not accurately model the...
<p>You want to have template-typedefs. That is <em>not</em> yet supported in the current C++. A workaround is to do</p> <pre><code>template&lt;typename T&gt; struct vecvec { typedef std::vector&lt; std::vector&lt;T&gt; &gt; type; }; int main() { vecvec&lt;int&gt;::type intSequences; vecvec&lt;std::string...
<p>You can implement basic vector-of-vector type using <code>std::vector</code> as a basis:</p> <pre><code>#include &lt;iostream&gt; #include &lt;ostream&gt; #include &lt;vector&gt; using namespace std; template &lt;typename T&gt; struct vecvec { typedef vector&lt;T&gt; value_type; typedef vector&lt;value_typ...
37,531
<p>On a file path field, I want to capture the directory path like:</p> <pre><code>textbox1.Text = directory path </code></pre> <p>Anyone?</p>
<p>There is a FolderBrowserDialog class that you can use if you want the user to select a folder.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx</a></p...
<p>If you don't want a terrible, non-user friendly dialog*, try <a href="http://www.ookii.org/software/dialogs/" rel="nofollow noreferrer">Ookii.Dialogs</a> or see other answers to <a href="https://stackoverflow.com/questions/31059/how-do-you-configure-an-openfiledialog-to-select-folders">How do you configure an OpenFi...
10,637
<p>I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked the image should be displayed. This functionality works 100% in Inter...
<p>This is the default Firefox behavior designed for security .The assumption is probably that most web sites don't know what and where are you local files (including UNC paths).</p> <p>This could be turned off in firefox:</p> <ul> <li>type "about:config" in the address bar and accept "i'll be careful"</li> <li>find ...
<p><code>file://localhost///servername/share/file.txt</code> works for me on FF11 </p> <p>(from a local html file: <code>file:///C:/index.html</code>)</p>
23,338
<p>I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time.</p> <p>Now, my first idea was <a href="http://www.microsoft.com/sql/editions/compact/default.mspx" rel=...
<p><a href="http://www.sqlite.org/" rel="noreferrer">SQLite</a> came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive <em>if</em> you keep yourself to the constraint of 1 user at a time.</p> <p><a href="http://web.archive.org/web/20100208133236/www.mikedun...
<p>This question is now ancient, and a lot has changed. For my specific purposes, <a href="https://www.litedb.org/" rel="nofollow noreferrer">LiteDB</a> is the option of choice. It's open source and has a <a href="https://github.com/mbdavid/LiteDB" rel="nofollow noreferrer">GitHub Repository</a>.</p> <p>Apart from tha...
2,312
<p>If I have two variables:</p> <pre><code>Object obj; String methodName = "getName"; </code></pre> <p>Without knowing the class of <code>obj</code>, how can I call the method identified by <code>methodName</code> on it?</p> <p>The method being called has no parameters, and a <code>String</code> return value. It's <...
<p>Coding from the hip, it would be something like:</p> <pre><code>java.lang.reflect.Method method; try { method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..); } catch (SecurityException e) { ... } catch (NoSuchMethodException e) { ... } </code></pre> <p>The parameters identify the very s...
<p>for me a pretty simple and fool proof way would be to simply make a method caller method like so:</p> <pre><code>public static object methodCaller(String methodName) { if(methodName.equals("getName")) return className.getName(); } </code></pre> <p>then when you need to call the method simply put someth...
19,454
<p>How can you enumerate an <code>enum</code> in C#?</p> <p>E.g. the following code does not compile:</p> <pre class="lang-cs prettyprint-override"><code>public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { foreach (Suit suit in Suit) { DoSo...
<pre><code>foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } </code></pre> <p><strong>Note</strong>: The cast to <code>(Suit[])</code> is not strictly necessary, <a href="https://gist.github.com/bartoszkp/9e059c3edccc07a5e588#gistcomment-2625454" rel="noreferrer">but it does make the code 0.5 ns faster<...
<p><a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="nofollow noreferrer">LINQ</a> Generic Way:</p> <pre><code> public static Dictionary&lt;int, string&gt; ToList&lt;T&gt;() where T : struct =&gt; ((IEnumerable&lt;T&gt;)Enum.GetValues(typeof(T))).ToDictionary(value =&gt; Convert.ToInt32(...
13,087
<p>What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?</p>
<p>This can be done via SQL Enterprise Manager or like this: </p> <pre><code>ALTER DATABASE &lt;database&gt; SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 } </code></pre> <p>Use 90 for 2005 compatibility. </p> <p>This replaces the functionality used for previous releases, the stored procedure <em>sp_dbcmptlevel</em>....
<p>Don't forget that there are also behavioral differences between the two versions, and something on 2008 may perform differently (and insufficiently) than 2005 all other things equal - this will obviously depend on a lot of factors about your data and application.</p> <p>You're better off developing against the lowe...
2,907
<p>I've been looking into the viability of manufacturing a replacement part for a kitchen blender that has a broken part. I found <a href="https://all3dp.com/1/food-safe-3d-printing-abs-pla-food-safe-filament/" rel="nofollow noreferrer">this page that talks about what makes a print food safe</a>. One of the items menti...
<p>Food packaging needs to comply with regulations. One certification agency informing about these (and their service to certify for them) is <a href="https://www.tuv-sud.com/home-com/resource-centre/publications/e-ssentials-newsletter/food-health-e-ssentials/e-ssentials-3-2015/regulations-for-food-packaging-products-a...
<p>Yes you have to change brass nozzle it contains lead. If you are planning to print in PLA don't do that because PLA filament we are using in 3D printer are not food safe it contains some nasty colour dyes which are not food safe. Consider some special food safe filaments available in market. I think extruder gears ...
1,041
<p>What good profilers do you know? </p> <p>What is a good way to measure and tweak the performance of a C++ MFC application?</p> <p>Is Analysis of algorithms really neccesary? <a href="http://en.wikipedia.org/wiki/Algorithm_analysis" rel="noreferrer">http://en.wikipedia.org/wiki/Algorithm_analysis</a></p>
<p>I strongly recommend <a href="http://www.automatedqa.com" rel="nofollow noreferrer">AQTime</a> if you are staying on the Windows platform. It comes with a load of profilers, including static code analysis, and works with most important Windows compilers and systems, including Visual C++, .NET, Delphi, Borland C++, I...
<p><a href="http://www.glowcode.com/" rel="nofollow noreferrer">Glowcode</a> is a very nice profiler (when it works). It can attach to a running program and requires only symbol files - you don't need to rebuild.</p>
18,336
<p>Ok sorry this might seem like a dumb question but I cannot figure this thing out :</p> <p>I am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '</p> <p>I have tried many things but just can't get to figure out the right regex to use!</p> <pre><c...
<p>Try this: </p> <pre><code>@"^[0-9dD+ ]+$" </code></pre> <p>The <code>^</code> and <code>$</code> at the beginning and end signify the beginning and end of the input string respectively. Thus between the beginning and then end only the stated characters are allowed. In your example, the regex matches if the string ...
<p>Another option is to invert everything, so it matches on characters you don't want to allow:</p> <pre><code>Regex oReg = new Regex(@"[^0-9dD+]"); !oReg.IsMatch("e4"); </code></pre>
23,201