instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there a way to start an instance of eclipse, passing it some sort of parameter telling it to use a specific workspace?</p>
<p>The problem I'm trying to solve is that I have a workspace for work projects and one for personal projects. I'd like to be able to tie these to workspaces to separate shortcuts that I cou... | <p>From <a href="http://help.eclipse.org/help21/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm" rel="noreferrer">http://help.eclipse.org/help21/topic/org.eclipse.platform.doc.user/tasks/running_eclipse.htm</a>:</p>
<p>Use the following command-line argument:</p>
<pre><code>-data your_workspace_location... | <p>I wish people would give an actual example, i learn better with examples rather than syntax.
so here it goes...</p>
<pre><code>"C:\MyEclipse Blue Edition\MyEclipse Blue Edition 10\myeclipse-blue.exe" -showlocation -data "C:\EclipseWork\WorkSpace"
</code></pre>
<p>this command will open eclipse with the specified w... | 25,750 |
<p>Here's the deal. I have an XML document with a lot of records. Something like this:</p>
<pre><code>print("<?xml version="1.0" encoding="utf-8" ?>
<Orders>
<Order>
<Phone>1254</Phone>
<City>City1</City>
<State>State</State>
... | <p>If the data maps fairly cleanly to an object model, you could try using xsd.exe to generate some classes from the .xsd, and process the classes into your DAL of choice. The problem is that if the volume is high (you mention thousands of records), you will most likely have a <em>lot</em> of round-trips.</p>
<p>Anoth... | <p>A lot of that depends on what "validation" means in your scenario. I assume, since you're using an .xsd, you are already validating that the data is syntactically correct.
So, validation probably means you'll be calling other services or procedures to determine if an order is valid?</p>
<p>You might want to look ... | 27,918 |
<p>I need to be able to logoff any user from his windows session from a program. </p>
<p>I know I could log in as an admin and force a remote logoff. Is there any other way to force a logoff without logging in? </p>
<p>The tool will run as admin so that's not a problem, being able to remote logoff without logging in ... | <p>Perhaps with Sysinternals' <a href="http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx" rel="nofollow noreferrer" title="PsTools">PsTools</a>, particularly <a href="http://technet.microsoft.com/en-us/sysinternals/bb897541.aspx" rel="nofollow noreferrer" title="PsShutdown">PsShutdown</a>?</p>
| <p>You may use simple command line to logoff forcefully from any remote user as below</p>
<pre><code>C:\>psexec \\remotepc shutdown /f /l
</code></pre>
| 27,288 |
<p>On our intranet site, we have various MS Office documents linked. When I click on a Word, Excel or PowerPoint file, Firefox gives me the option to Open, Save or Cancel. When I click on Open, the appropriate app is launched and the file is loaded. This is perfect. But for some reason, when I click on a linked Visio f... | <p>@Dean</p>
<blockquote>
<p>There are only two buttons in the dialog box: "Save File" and "Cancel". The "Open with" option is not there at all.</p>
<p>But I think I know what you mean. Sometimes, the "Open with" option is grayed out and only becomes available a moment later. Unf... | <p>Go under Tools, Options.. in firefox, then when the options box comes up go to applications, there you can set all extensions and launch conditions. Actually it's termed "Content Type" and "Action" there...</p>
| 14,259 |
<p>How can I test my website in multiple versions of firefox?
I have v2 installed. Now no matter where or how many times I install FF3, it always executes ff2..</p>
<p>I checked the interweb and it seems there used to be a MultiFireFox tool that could run several versions. It was for apple and I'm on windows. Furtherm... | <p>What you need to do is set up two profiles, one for Firefox3 and on for Firefox 2. It's a pretty simple process; I've got them both running and I love it!</p>
<p><a href="http://blog.codefront.net/2007/08/20/how-to-have-firefox-3-and-firefox-2-running-at-the-same-time/" rel="nofollow noreferrer">Here's one way to s... | <p>The general case of running two separate Firefox processes is described in <a href="http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile" rel="nofollow noreferrer">this Mozillazine article</a>. There's also <a href="http://kb.mozillazine.org/Testing_pre-release_versions" rel="nofollow no... | 49,951 |
<p>I use OctoPrint on an Ubuntu system with a M3D printer.</p>
<p>Midway through a recent print, the filament just stopped extruding although the motor-functions of the printer were proceeding fine. Since then, every print I attempt has trouble extruding proper amounts of filament. It's always not enough. The output i... | <p>Depends on the glue and on your tolerance for messy undersides on your prints. It's fairly common for some of the glue to come off with the print. Or you may have marks from scrapers or rafts. Do you want to touch up that spot and have some artifacts on the bottom of the next print, or clean and redo the bed to get ... | <p>As noted in the answer to the other question you asked, the Flux Delta steel plate bed will handle multiple layers of glue. The determining factor regarding this particular printer and specific glue is how many ripples, bumps and/or lines you are willing to tolerate on the first layer of your prints. </p>
<p>You'll... | 312 |
<p>I'm duty-bound by policy to use CVS in this certain project, so even though I'd really to switch to something else, like Git, I cannot.</p>
<p>So, my real question goes like this: We have a convention that we create a new branch in CVS every time we make a release (we also tag, but that is besides the point). We ca... | <p>If you are the only one developing on the feature-branch, you could simply use Git as your "sandbox development" system and then once you have the changes done, merge them into your CVS repository.</p>
<p>You still gain the benefit of source control for your intermediate work product.</p>
| <p>One thing to consider is to actually <strong>close</strong> the feature-branch when you are done with it, once you have merged it back with the main trunk. In this context, close simply means abandon the branch, not a real deletion. </p>
<p>Once the work is merged, there really is no need for the branch to "exist"... | 16,794 |
<p>I am writing a unit test to check that a private method will close a stream.</p>
<p>The unit test calls methodB and the variable something is null</p>
<p>The unit test doesn't mock the class on test</p>
<p>The private method is within a public method that I am calling.</p>
<p>Using emma in eclipse (via the eclem... | <p>I have found that the eclipse plugin for EMMA is quite buggy, and have had similar experiences to the one you describe. Better to just use EMMA on its own (via ANT if required). Make sure you always regenerate the metadata files produced by EMMA, to avoid merging confusion (which I suspect is the problem with the ... | <p>I assume when you say 'the unit test calls <code>methodB()</code>', you mean not directly and via <code>methodA()</code>. </p>
<p>So, is it possible <code>methodB()</code> is being called elsewhere, by another unit test or <code>methodC()</code> maybe?</p>
| 8,029 |
<p>Can anyone recommend monitoring software for a windows environment?</p>
<p>We already have monitoring in the sense of resources and availability. I want to know who logged in and changed settings, added files etc.</p>
<p>We have outsourced IT and I want to be able to track down all the changes to the system.</p>
<p... | <p>You may want to look at zabbix www.zabbix.com.
Open source
does the utilization/resource thing, but also has customizable agents and the ability to do event notification.</p>
| <p>you can also use the free service <a href="http://www.owlerts.com" rel="nofollow">http://www.owlerts.com</a></p>
| 45,796 |
<p>I am experimenting with the new multiprocessing module in Python 2.6. I am creating several processes each with its own multiprocessor.JoinableQueue instance. Each process spawns one or more worker threads (subclasses of threading.Thread) which share the JoinableQueue instance (passed in through each Thread's <cod... | <p>You should pass Queue objects as target's arguments.</p>
<p>Example from <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow noreferrer">multiprocessing's documentation</a>:</p>
<pre><code>from multiprocessing import Process, Queue
def f(q):
q.put([42, None, 'hello'])
if __name__ == ... | <p>Thanks for the quick response. I am passing the multiprocessing.Queue instances as arguments to each Process as you illustrate. The failure seems to occur in the threads. I am creating them by subclassing threading.Thread and passing the queue to the '<strong>init</strong>' method of each thread instance. This se... | 44,537 |
<p>I have the following </p>
<pre><code>var id='123';
newDiv.innerHTML = "<a href=\"#\" onclick=\" TestFunction('"+id+"', false);\"></a>";
</code></pre>
<p>Which renders <code><a href="#" onclick="return Testfunction('123',false);"></a></code> in my HTML.</p>
<p>The problem I have is that I ... | <p>Try using &quot; instead of \"</p>
<p>newDiv.innerHTML = "<a href=&quot;#&quot;...</p>
| <p>You could create the a element and attach to the click event using DOM Methods.</p>
<p>A Javascript Framework (like the ubiquitous jQuery) would make this a lot easier.</p>
| 32,768 |
<p>I have a WCF service that I have to reference from a .net 2.0 project.</p>
<p>I have tried to reference it using the "<strong>add web reference</strong>" method but it messes up the params. </p>
<p>For example, I have a method in the service that expects a <code>char[]</code> to be passed in, but when I add the w... | <p>One of those instances that you need to edit the WSDL. For a start a useful tool</p>
<p><a href="http://codeplex.com/storm" rel="nofollow noreferrer">http://codeplex.com/storm</a></p>
| <p>Thanks for the resource. It certainly helped me test out the webservice, but it didn't much help with using the WCF service in my .net 2.0 application.</p>
<p>What I eventually ended up doing was going back to the architects and explaining that the 3.0 dll's that I needed to reference got compiled back to run on th... | 3,088 |
<p>I've got a TDbGrid in my project, and I'm trying to have an event go off every time I change the selected row. Any change in row already updates all the data-aware controls linked to the same DataSource, but there are other changes to be made too, that I need an event handler for.</p>
<p>I thought OnColEnter would... | <p>Have you tried OnDataChange event of DataSource?</p>
| <p>I would only use AfterScroll on the dataset, it is fired when you first open the dataset, and every time you move in it. In a DBGrid, that would be on every click on a row, or the scrollbar, or using the keyboard (Home, Edn, Up, Down, PgUp,PgDown) ...etc. </p>
<p>You could even dynamically assign it if you use the ... | 37,627 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5436139/when-will-c0x-be-finished">When will C++0x be finished?</a> </p>
</blockquote>
<p>What are the latest news about C++0X? (or should I say C++1X) Any release date decided yet?</p>
| <h2>UPDATE : years later...</h2>
<p>The last Draft have been officially finalized few weeks ago, in Mars 2011 and will be officially out around July 2011. The name of the new standard would be C++2011 : <a href="http://herbsutter.com/2011/03/25/we-have-fdis-trip-report-march-2011-c-standards-meeting/" rel="nofollow no... | <p>The committee recently issued a Committee Draft, which will become a Final Committee Draft, which will become a Final Draft International Standard, which will become ISO 14882:20xx, giving an expected publication date of sometime at the end of 2010.</p>
<p>However, GCC 4.3 and later implement increasingly larger su... | 27,946 |
<p>Below is a list of locks that SQL Server 2000 is meant to support. I am a bit confused as to what the "intent" locks actually mean. I've looked around on the Web and the answers seem to be a bit cryptic. </p>
<p>Further to getting an answer to my specific question, I am hoping to use this question as a Wiki for wha... | <p>The <a href="http://msdn.microsoft.com/en-us/library/aa213039(SQL.80).aspx?ppud=4" rel="noreferrer">SQL server MSDN page</a> has a reasonable explanation:</p>
<blockquote>
<p>An intent lock indicates that SQL Server wants to acquire a shared (S) lock or exclusive (X) lock on some of the resources lower down in th... | <p>Another important feature of the Intent locks is you don't place them from the code explicitly, they are requested implicitly when you place a non-intent lock.</p>
| 12,607 |
<p>I saw this cool <a href="http://www.thingiverse.com/thing:1231999" rel="nofollow noreferrer">Nuka-Cola bottle opener</a>. I made it:</p>
<p><a href="https://i.stack.imgur.com/ysVvW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ysVvW.jpg" alt="3D print of Nuka-Cola bottle opener"></a> </p>
<p>... | <p>I had a similar issue as described in <a href="https://3dprinting.stackexchange.com/questions/3461/why-does-my-domed-print-have-a-thin-shell">this question</a>. Curiously, yours is almost opposite as my raised lettering was OK, but the surrounding areas were poorly filled.</p>
<p>I came to the conclusion that Slic3... | <p>The proper term here is Under Extrusion.</p>
<p>There are a lot of reasons this can happen. For my Ultimaker, over time it developed very bad underextrusion due to the build up of carbon. I had to do atomic pulls / increase the extrusion multiplier. </p>
<p>I would ...</p>
<ol>
<li><p>verify that you move exactly... | 516 |
<p>If you have multiple, unrelated projects, is it a good idea to put them in the same repository?</p>
<pre><code>myRepo/projectA/trunk
myRepo/projectA/tags
myRepo/projectA/branches
myRepo/projectB/trunk
myRepo/projectB/tags
myRepo/projectB/branches
</code></pre>
<p>or would you create new repositories for each?</p>
... | <p>The single vs. multiple issue comes down to personal or organizational preference.</p>
<p>Management of multiple vs. single mainly comes down to access control and maintenance.</p>
<p>Access control for a single repository can be contained in a single file; Multiple repositories are may require multiple files. M... | <p>My suggestion is one. Unless you have different users accessing each one, then I'd say use multiple.</p>
<p>But again, even that's not a good reason to use multiple.</p>
| 31,452 |
<p>I'd like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I want to restrict this user as much as possible. (Authentication will be with public/private keypair).</p>
<p>I know I need to edit the relevant ~/.ssh/authorized_keys file, but I'm not sure exactly what ... | <p>On Ubuntu 11.10, I found I could block ssh commands, sent with and without -T, and block scp copying, while allowing port forwarding to go through. </p>
<p>Specifically I have a redis-server on "somehost" bound to localhost:6379 that I wish to share securely via ssh tunnels to other hosts that have a keyfile and wi... | <p>See <a href="http://www.networknewz.com/networknewz-10-20030707AuthenticatingbyPublicKeyOpenSSH.html" rel="nofollow noreferrer">this post on authenticating public keys</a>.</p>
<p>The two main things you need to remember are:</p>
<ol>
<li>Make sure you <code>chmod 700 ~/.ssh</code></li>
<li>Append the public key b... | 2,956 |
<p>I know I can update a single record like this - but then how to I get access to the id of the record that was updated? (I'm using MSSQL so I can't use Oracles RowId)</p>
<pre><code>update myTable
set myCol = 'foo'
where itemId in (select top 1 itemId from myTable )
</code></pre>
<p>If I was peforming an Insert I ... | <p>This example works really well in MSSQL 2005...</p>
<pre><code>SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP TABLE [dbo].[TEST_TABLE]
GO
CREATE TABLE [dbo].[TEST_TABLE](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_TEST_TA... | <p>For insert MSQSQL server has the <code>@@Identity</code> parameter which has the ID of the last inserted record.</p>
| 45,930 |
<p>Our company runs a web site (oursite.com) with affiliate partners who send us traffic. In some cases, we set up our affiliates with their own subdomain (affiliate.oursite.com), and they display selected content from our site on their site (affiliate.com) using an iframe.</p>
<p>Example of a page on their site:</p>
... | <ol>
<li><p>You have to append the Google Analytics tracking code to the end of <code>example_page.html</code>. The content between the <code><iframe></code> - <code></iframe></code> tag only displays for browsers, which do not support that specific tag.</p></li>
<li><p>Should you need to merge the results ... | <p>I found this <a href="https://youtu.be/yIWkcMvrpC0" rel="nofollow noreferrer">YouTube</a> for Google Analytic <strong>very</strong> helpful.<br />
The web page can be found here:
<a href="https://measureschool.com/iframe-tracking/" rel="nofollow noreferrer">How to Track Conversions in Iframes with Google Tag Manager... | 18,281 |
<p>I want to programmatically create a SHA1 checksum of audio files (MP3, Ogg Vorbis, Flac).
The requirement is that the checksum should be stable <strong>even if the header (eg. ID3) changes</strong>.<br/>
<em>Note: The audio files don't have CRCs</em></p>
<p>This is what I tried by now:</p>
<h3>1) Reading + Hashing... | <p>If you are looking for stable hashes for the actual music you might want to look at <a href="http://code.google.com/p/musicip-libofa/" rel="nofollow noreferrer">libOFA</a>. Your current methods will give you different results because the formats can have embedded tags. Also if you want two different files with the s... | <p>Bene, If I were you, (And I am in the process of working on something very similar to what you want to do), I would hash the mp3 data block. (Extract it to raw data first, and write it out to disk, so you know what you are dealing with). Then, modify the ID3 tag. Hash your data again. Now, if it changes, compare... | 45,732 |
<p>I'm just meddling in the ways of the RESTful web service in C# using ASP.Net 2.0 and have managed (via a class library, a reference to dll produced by the former and some adjustment of my web.config) to coax out a URI format like so:</p>
<p>http: //localhost/DevelopmentProject/testhandler/?input=thisismyinput</p>
... | <p>One solution is to use UrlRewriting to rewrite the Url to what you need.</p>
<p>I use <a href="http://urlrewriter.net/" rel="nofollow noreferrer">http://urlrewriter.net/</a> to do all my rewriting, and you could setup something like this in your scenario</p>
<pre><code><rewriter>
<rewrite
url="De... | <p>You could implement URL rewriting, using something like <a href="http://www.urlrewriter.net/" rel="nofollow noreferrer">URLRewriter.net</a>
That would let you use the syntax you've mentioned.</p>
| 16,804 |
<p>Suppose you're developing a software product that has periodic releases. What are the best practices with regard to branching and merging? Slicing off periodic release branches to the public (or whomever your customer is) and then continuing development on the trunk, or considering the trunk the stable version, tagg... | <p>I have tried both methods with a large commercial application. </p>
<p>The answer to which method is better is highly dependent on your exact situation, but I will write what my overall experience has shown so far. </p>
<p><strong>The better method overall (in my experience): The trunk should be always stable.</s... | <p>There's no one-size-fits-all answer for the subversion convention question IMHO.</p>
<p>It really depends on the dynamics of the project and company using it. In a very fast-paced environment, when a release might happen as often as every few days, if you try to religiously tag and branch, you'll end up with an unm... | 5,619 |
<p>Here's my situation - I want to create a resized jpeg image from a user uploaded image, and then send it to S3 for storage, but am looking to avoid writing the resized jpeg to the disk and then reloading it for the S3 request.</p>
<p>Is there a way to do this completely in memory, with the image data JPEG formatted... | <p>Most people using PHP choose either <a href="http://www.php.net/manual/en/book.imagick.php" rel="nofollow noreferrer">ImageMagick</a> or <a href="http://www.php.net/manual/en/ref.image.php" rel="nofollow noreferrer">Gd2</a></p>
<p>I've never used Imagemagick; the Gd2 method:</p>
<pre><code><?php
// assuming y... | <p>Maye by using the <a href="http://www.php.net/manual/en/book.image.php" rel="nofollow noreferrer">GD library</a>.</p>
<p>There is a function to copy out a part of an image and resize it. Of course the part could be the whole image, that way you would only resize it.</p>
<p>see <a href="http://www.php.net/manual/en... | 22,966 |
<p>I need to receive the key press events during cell editing in <code>DataGridView</code> control.</p>
<p>From what I have found on the net the <code>DataGridView</code> is designed to pass all key events from <code>DataGridView</code> to the cell editing control and you cannot get these events easily.</p>
<p>I foun... | <p>Finally figured out.
There are two parts of this puzzle - getting keys from cell editing control and getting keys from the DataGridView itself. Here's my code. To use it, you just need to subscribe to the custom event: <strong>keyPressHook</strong>.</p>
<pre><code>class KeyPressAwareDataGridView : DataGridView
{
... | <p>you have to override the DataGridViewCell/DataGridViewTextBoxCell/otherTypes and handle key* events in the derived class.</p>
| 42,185 |
<p>Ok, I am new to JQuery, I have a modal that has a asp:Literal control in it. The literal is controled by whatever link is clicked to activate the modal. So, I had hoped it would be as easy as giving the literal value onClick of the link but that's not it. </p>
<p>I'm hoping: the value of the literal is set on the p... | <p>Okay so you have a literal in your <code><p></code>. That means you have no direct selector/handle to it, like you would when it was a label with an ID.</p>
<p>But you can say it is the <code><p></code> inside the <code><div class="modal-content"></code>, all part of the element with ID <code>land... | <p>If you want the modal to change client-side when the link is clicked, you will need to set it in the onClick handler for the link. I'll assume that the modal text is based on the anchor tag that is clicked. <code>litModal</code> is going to turn into a span on the client side so we find it that way. </p>
<pre><... | 40,432 |
<p>The explorer control in Windows Vista is very handy and I would like to be able to incorporate it in an application written in WPF. I've been unable to find a <em>stock control</em> that is part of the Framework. This application is being specifically developed for Windows Vista and therefore, having the same look a... | <p><a href="http://blog.actiprosoftware.com/post/First-Look-Breadcrumb-for-WPF.aspx" rel="noreferrer">Actipro</a> makes a really good WPF breadcrumb control. There's also an <a href="http://www.codeproject.com/KB/tree/WPFBreadcrumbBar.aspx" rel="noreferrer">open source WPF breadcrumb control</a> that I might actually g... | <p>If you are coding for the .net Framework 3.5, calling for the common dialog should display the correct Vista era dialog.</p>
<hr>
<p>Sorry, appears I was mistaken. In previous projects, I was using <a href="http://www.ookii.org/download.ashx?id=VistaDialogs" rel="nofollow noreferrer">this library</a> to call the V... | 25,211 |
<p>I find myself drawn to the Parsing Expression Grammar formalism for describing domain specific languages, but so far the implementation code I've found has been written in languages like Java and Haskell that aren't web server friendly in the shared hosting environment that my organization has to live with.</p>
<p>... | <p>I have recently written <a href="http://pegjs.majda.cz/" rel="noreferrer">PEG.js</a>, PEG-based parser generator for JavaScript. It can be used from a command-line or you can try it from your browser.</p>
| <p><strong>Have you looked at <a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a>?</strong> It produces lexer and parser code, handles abstract syntax trees, lets you insert code the grammar to be injected into the lexer/parser code, and <strong>its available for a variety of languages!</strong></p>
| 10,499 |
<p>I can't find a definitive answer. Since C# 2.0 you've been able to declare</p>
<pre><code>int? i = 125;
</code></pre>
<p>as shorthand for</p>
<pre><code>Nullable<int> i = Nullable<int>(123);
</code></pre>
<p>I recall reading somewhere that VB.NET did not allow this shortcut. But low and behold, I t... | <p>System.Nullable was introduced in .Net 2.0 and is available to VB <em>as a generic type</em>. You just cannot use the nullable syntax. So in VS 2005 you can do:</p>
<pre><code>Dim x as Nullable(of Integer)
</code></pre>
<p>I don't know if null equivalence and boxing works for nullables in VB 2005, but I would su... | <p>I don't know the history, but yes it was a VS 2008 enhancement.</p>
| 27,648 |
<p>For some reason my code won't work.</p>
<pre><code> from tan in TANS
where tan.ID.ToString().Count() != 1
select tan
</code></pre>
<p>I want to select all IDs that are duplicates in a table so I am using the count != 1 and I get this error.</p>
<p>NotSupportedException: Sequence operators not supported... | <p><code>tan.ID.ToString()</code> is a string, not a collection so you can't apply Count().</p>
<p>I believe you want something like: (This syntax is wrong, but close)</p>
<pre><code>from tan in TANS
group tan by tan.ID into dups
where dups.Count() > 1
select dups.Key;
</code></pre>
<p>Update (after 5 years minu... | <p>James' answer is close to what I think you are wanting, if you just want the value of the ID itself go with his. If you want the object the ID is assigned to try this.</p>
<pre><code>var dupes = (from tan in TANS
group tan by tan.ID.ToString() into duplicates
where duplicates.Count() >... | 41,072 |
<p>I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It had me head-scratching for more than an hour, so I decided to post the question here.</p>
| <p>Due to the piping the <code>read</code> is executed in its own subshell.</p>
<pre><code>echo foo | while read a; do echo $a; done
</code></pre>
<p>will do what you expect it to.</p>
| <p>read expects input on a new line</p>
<pre>
while read a; do echo $a; done
foo
bar
^D
</pre>
<p>is more or less what you wanted</p>
| 49,010 |
<p>Earlier today a question was asked regarding <a href="https://stackoverflow.com/questions/110458/what-percentage-of-my-time-will-be-spent-in-user-input-verfication-during-web-d">input validation strategies in web apps</a>.</p>
<p>The top answer, at time of writing, suggests in <code>PHP</code> just using <code>html... | <p>When it comes to database queries, always try and use prepared parameterised queries. The <code>mysqli</code> and <code>PDO</code> libraries support this. This is infinitely safer than using escaping functions such as <code>mysql_real_escape_string</code>.</p>
<p>Yes, <code>mysql_real_escape_string</code> is effect... | <p>why, oh WHY, would you <strong>not</strong> include quotes around user input in your sql statement? seems quite silly not to! including quotes in your sql statement would render "1 or 1=1" a fruitless attempt, no?</p>
<p>so now, you'll say, "what if the user includes a quote (or double quotes) in the input?"</p>
... | 13,583 |
<p>In my application, there are 10-20 classes that are instantiated once[*]. Here's an example:</p>
<pre><code>class SomeOtherManager;
class SomeManagerClass {
public:
SomeManagerClass(SomeOtherManager*);
virtual void someMethod1();
virtual void someMethod2();
};
</code></pre>
<p>Instances of the classes... | <p>Assuming a class (plugin1) which inherits from SomeManagerClass, you need a class hierarchy to build your types:</p>
<pre><code>class factory
{
public:
virtual SomeManagerClass* create() = 0;
};
class plugin1_factory : public factory
{
public:
SomeManagerClass* create() { return new plugin1(); }
};
</code>... | <p>Mh I don't understand a hundred percent, and I am not really into factory stuff from books and articles.</p>
<hr>
<p>If all your managers share a similar interface you could derive from a base class, and use this base class in your program.
Depending on where the decision which class will be created will be made, ... | 43,214 |
<p>I have seen examples of printing from a windows application but I have not been able to find a good example of any way of doing this. </p>
| <p>I've used the print style sheet</p>
<p>here's and article <a href="http://alistapart.com/stories/goingtoprint/" rel="nofollow noreferrer">http://alistapart.com/stories/goingtoprint/</a> that will go through the way to set that up. Rather than setting up a special page that would need to be maintained as well.</p>
| <p>If you just need to print your web page from the client-side use <code>window.print()</code>. Sample could be found here: <a href="http://www.javascriptkit.com/howto/newtech2.shtml" rel="nofollow noreferrer">http://www.javascriptkit.com/howto/newtech2.shtml</a>. I would suggest preparing a special version of your pa... | 10,835 |
<p>What is the difference between them? <br /></p>
<p>When would I opt for one over the other?</p>
| <p>This answer is based on an article that no longer exists:</p>
<p>Summary of article:</p>
<p>"Basically, WCF is a service layer that allows you to build applications that can communicate using a variety of communication mechanisms. With it, you can communicate using Peer to Peer, Named Pipes, Web Services and so on... | <p>The major difference is time-out, WCF Service has timed-out when there is no response, but web-service does not have this property.</p>
| 45,736 |
<p>Consider the following method signatures:</p>
<pre><code>public fooMethod (Foo[] foos) { /*...*/ }
</code></pre>
<p>and</p>
<pre><code>public fooMethod (Foo... foos) { /*...*/ }
</code></pre>
<p><em>Explanation: The former takes an array of Foo-objects as an argument - <code>fooMethod(new Foo[]{..})</code> - whi... | <p>These methods are actually the same.</p>
<p>This feature is called varargs and it is a compiler feature. Behind the scenes is is translates to the former version.</p>
<p>There is a pitfall if you define a method that accepts Object... and you sent one parameter of type Object[]!</p>
| <p>There are certainly no performance issues or things like that to consider, so it comes down to semantics.</p>
<p>Do you expect the caller of your method to have an array of Foo's ready at hand? Then use the Foo[] version. Use the varargs variant to emphasize the possibility of having a "bunch" of Foo's instead of a... | 20,971 |
<p>I develop and maintain small intranet web apps written in JSP and Java.
They run on a Resin web server, without dedicated httpd like Apache.</p>
<p>Before performing maintenance, I activate a very simple Ajax message to urge users to logout.</p>
<p>What I want is, while I do maintenance, a user trying to log in to... | <p>Setup an alternate site on your webserver with the outage message. Then when doing maintenance, redirect your website to the maintenance site while up update it. That way if users have pages other than the default page bookmarked, they will still get the outage message. Otherwise, a simple approach is to just swap... | <p>I just swap out the first page of the web app with a linkless page containing the message you mentioned.</p>
| 26,539 |
<p>I'm writing an app with an image upload feature. Right now I'm using NSURL POST like: <a href="https://stackoverflow.com/questions/125306">125306</a>.</p>
<p>When the app is closed as far as I can tell all of the uploads abort and the threads die. Is there<br></p>
<p>1) a way to make these upload threads persist ... | <p>EDIT: This is an old answer from 2009. Current iOS (2016) has background URL tasks. See NSURLSessionUploadTask.</p>
<p>Original answer follows:</p>
<p>You aren't allowed to run in the background on an iPhone (as per Apple's Guidelines). Your app will be rejected from the AppStore if you do.</p>
| <p>After app suspending you only have ~10 mins to do the job.
You should make a background process thread when app is suspended.
And you have no garanties that os will keep app alive. It depends on process complexity.</p>
| 35,101 |
<p>I'm trying to compress different 3D files, but find it difficult to find the right software to compress the file.</p>
<p>What are the most suitable 3D file compressors to compress 3D files like STL, OBJ and STEP?</p>
<p>I have tried Draco, and mac zip compressor.</p>
| <p>3D files differ greatly in size and what they contain:</p>
<h1>STL</h1>
<p>STL Stereolithography files were invented by 3D Systems to store surfaces. Originally it used ASCII text to store information by naming triplets of vertex positions for each triangle (facet). Since that got too large, newer STL are Binary, wh... | <p>If a general-purpose compression tool using a good compression algorithm, such as 7zip or gzip (for linux and command line enthusiasts) is not providing good compression it is not likely that your files <em>can</em> be compressed very much. </p>
<p>This applies to a wide variety of binary files beyond just 3D print... | 1,662 |
<p>Does anyone know the full list of C# compiler number literal modifiers?</p>
<p>By default declaring '0' makes it an Int32 and '0.0' makes it a 'Double'. I can use the literal modifier 'f' at the end to ensure something is treated as a 'Single' instead. For example like this...</p>
<pre><code>var x = 0; // x is ... | <pre><code>var y = 0f; // y is single
var z = 0d; // z is double
var r = 0m; // r is decimal
var i = 0U; // i is unsigned int
var j = 0L; // j is long (note capital L for clarity)
var k = 0UL; // k is unsigned long (note capital L for clarity)
</code></pre>
<p>From the <a href="https://stackoverflow.com/questions/1277... | <p>You might want to start by <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx" rel="noreferrer">looking at the C# language spec</a>. Most of the types are listed in there, and have a suffix:</p>
<ul>
<li>L = long</li>
<li>F = float</li>
<li>U = uint</li>
<li>ulong's are a <a href="http://msdn.microsoft.... | 20,142 |
<p>I have a Page with a UserControl on it. If the user presses Esc while anywhere on Page I want to handle.</p>
<p>I thought this would be as easy as hooking up the PreviewKeyDown event, testing for the Esc key, and then handling it. However, when I placed I breakpoint in the event handler I found it was never getti... | <p>I believe that the PreviewKeyDown event is a tunneling routed event, rather than a bubbling one. If that is the case, then if your Page isn't getting the event, the UserControl shouldn't be either since it is below the Page in the visual tree. Maybe try handling it at the top level of your app (Window perhaps?) and ... | <p>This is tested and defintiely works.</p>
<pre><code> Private Sub textbox1_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles textbox1_input.PreviewKeyDown
If (e.Key = Key.Down) Then
MessageBox.Show("It works.")
End If
End Sub
'detect key state directly with something like ... | 45,255 |
<p>In an app I'm working on, I have a plain style UITableView that can contain a section containing zero rows. I want to be able to scroll to this section using scrollToRowAtIndexPath:atScrollPosition:animated: but I get an error when I try to scroll to this section due to the lack of child rows.</p>
<p>Apple's calend... | <p>UPDATE: Looks like this bug is fixed in iOS 3.0. You can use the following <code>NSIndexPath</code> to scroll to a section containing 0 rows:</p>
<pre><code>[NSIndexPath indexPathForRow:NSNotFound inSection:section]
</code></pre>
<p>I'll leave my original workaround here for anyone still maintaining a project usin... | <p>I think a blank row is probably the only way to go there. Is it possible to redesign the UI such that the "empty" row can display something useful?</p>
<p>I say try it out, and see what the performance is like. They give pretty dire warnings about using transparent sub-views in your list items, and I didn't find th... | 19,326 |
<p>Is there a programmatic way to extract equations (and possibly images) from an MS Word document? I've googled all over, but have yet to find anything that I can sink my teeth into and work from. If possible, I'd like to be able to do this with VB.NET or C#, but I can pick up enough of any language to hack out a DL... | <p>I don't know if any of this will help, but the object model in Word 2000/2003 has an <code>InlineShapes</code> collection as part of the <code>Document</code> object which represents embedded images and possibly similar objects like equations.</p>
<p>Some VBA code to copy the first item onto the clipboard, which mi... | <p>Try looking at the <a href="http://kebrt.webz.cz/programs/word-to-latex/" rel="nofollow noreferrer">Word-to-latex</a> converter. It requires the .Net framework and although the source isn't opened yet the author does invite questions about this.</p>
| 45,541 |
<p>If you provide <code>0</code> as the <code>dayValue</code> in <code>Date.setFullYear</code> you get the last day of the previous month:</p>
<pre><code>d = new Date(); d.setFullYear(2008, 11, 0); // Sun Nov 30 2008
</code></pre>
<p>There is reference to this behaviour at <a href="http://developer.mozilla.org/en/Co... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var month = 0; // January
var d = new Date(2008, month + 1, 0);
console.log(d.toString()); // last day in January</code></pre>
</... | <pre><code>function getLastDay(y, m) {
return 30 + (m <= 7 ? ((m % 2) ? 1 : 0) : (!(m % 2) ? 1 : 0)) - (m == 2) - (m == 2 && y % 4 != 0 || !(y % 100 == 0 && y % 400 == 0));
}
</code></pre>
| 27,423 |
<p>After upgrading a rails 1.2 website to 2.1, the <a href="http://agilewebdevelopment.com/plugins/exception_notifier" rel="noreferrer">ExceptionNotifier plugin</a> no longer works, complaining about this error:</p>
<blockquote>
<p>ActionView::TemplateFinder::InvalidViewPath: Unprocessed view path
found:
"/path... | <p>This was caused by a change in rails 2.1 which prevents rails from loading views from any arbitrary path for security reasons.</p>
<p>There is now an updated version of the plugin on github, so the solution is to use that.</p>
<hr>
<p>The old solution here for posterity</p>
<p>To work around it, edit <code>init.... | <p>You ought to upgrade to the newest Exception Notification plugin which is in <a href="http://github.com/rails/exception_notification/tree/master" rel="nofollow noreferrer">its new home at GitHub</a>.</p>
| 2,342 |
<p>C# has the keyword called <a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0(VS.80).aspx" rel="noreferrer">yield</a>. VB.NET lacks this keyword. How have the Visual Basic programmers gotten around the lack of this keyword? Do they implement they own iterator class? Or do they try and code to avoid the need o... | <h2>Note: This answer is old now. Iterator blocks have since been added to <a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET" rel="noreferrer">VB.NET</a></h2>
<p>C# translates the yield keyword into a state machine at compile time. VB.NET does not have the yield keyword, but it does have its own mechanism for saf... | <p>The below code gives the output</p>
<p>2, 4, 8, 16, 32</p>
<p>In VB.NET,</p>
<pre><code>Public Shared Function setofNumbers() As Integer()
Dim counter As Integer = 0
Dim results As New List(Of Integer)
Dim result As Integer = 1
While counter < 5
result = result * 2
results.Add(r... | 12,285 |
<p>In the past we experienced some problems using a DLL library created with Visual Studio 2005 in our Visual Studio 6.0 application (VS2005 DLL was C++ unmanaged, of course). In your opinion can we fall in the same kind of problem if the library is static (*.lib) and not dynamic?</p>
| <p>It seems like the problem area would be the runtime libraries -- if the VS2005 DLL is using the DLL versions of the runtime libraries, then you would need both sets of runtimes installed when the application is installed. If your VS2005 DLL is statically linked to the VS2005 runtime, then it should be OK.</p>
| <p>It depends on what kind of problems of course. There are some conflicts that are more likely to occur in DLLs and some that are more likely to occur in static libs. If you are building against the same version of the Microsoft SDK it will minimize the problems. </p>
| 22,107 |
<p>I have a Creatorbot 3D printer made by 3D PrinterWorks. Their website appears to be down, as well as their Facebook page. To me it appears they are no longer around.</p>
<p>I've installed Slic3r as 3D PrinterWorks has recommended in the handbook but cannot download the settings for this from the 3D PrinterWorks we... | <p>Looks like 3dprinterworks.net went down sometime after March 2018 and 3dprinterworks.com went down in January 2019. Luckily the Wayback Machine still has the <a href="https://web.archive.org/web/20161209084908/https://www.3dprinterworks.com/products/creatorbot-3d-pro-series-ii" rel="nofollow noreferrer">machine's sp... | <p>The configuration files were on a flash drive that came with the printer. That being said, here is the file that was located on my flash drive for Slic3r (denoted as deprecated on March 1, 2017).</p>
<p>This is for a Creatorbot Pro II.</p>
<p><a href="https://pastebin.com/j1dkSt8f" rel="nofollow noreferrer">https... | 1,209 |
<p>I have an application where a Hilbert R-Tree <a href="http://en.wikipedia.org/wiki/Hilbert_R-tree" rel="noreferrer">(wikipedia)</a> <a href="http://citeseer.comp.nus.edu.sg/84580.html" rel="noreferrer">(citeseer)</a> would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial q... | <p>Fun question! </p>
<p>I did a bit of googling, and the good news is, I've found an implementation of Hilbert Value.</p>
<p>The potentially bad news is, it's in Haskell...</p>
<p><a href="http://www.serpentine.com/blog/2007/01/11/two-dimensional-spatial-hashing-with-space-filling-curves/" rel="noreferrer">http://... | <p>Suggestion: A good simple efficient data structure for spatial queries is a multidimensional binary tree.</p>
<p>In a traditional binary tree, there is one "discriminant"; the value that's used to determine whether you take the left branch or the right branch. This can be considered to be the one-dimensional case.... | 13,171 |
<p>I am looking for a <em>private</em> online source control system. Basically what I want is a private version of <a href="http://code.google.com/hosting/" rel="noreferrer">Google Code</a> or <a href="http://sourceforge.net/" rel="noreferrer">SourceForge</a>. Private in the sense that only me and the person I invite c... | <p>Atlassian's BitBucket just announced Git repositories last week. Bit bucket allows unlimited private repositories for free. You need to pay if you want more than 5 users.</p>
| <p>For Subversion I use <a href="http://www.devjavu.com/" rel="nofollow noreferrer">DevjaVu</a>.</p>
| 26,599 |
<p>I have an application I am writing in PHP5, using the CodeIgniter framework.
I have it running on both Windows (using Xampp) and Ubuntu (using standard Apache, PHP, MySQL stack).</p>
<p>I have a form, that takes XML, parses it (using simpleXML) and posts the results into a database.</p>
<p>On Windows - no problem,... | <p>It seems like you're running the <a href="http://www.hardened-php.net/suhosin/" rel="nofollow noreferrer">Suhosin</a> PHP extension.
Please have a look at the configuration documentation at: <a href="http://www.hardened-php.net/suhosin/configuration.html" rel="nofollow noreferrer">http://www.hardened-php.net/suhosin... | <p>You may already have tried this approach but did you check the line endings? \r\n (DOS) as opposed to \n (UNIX)? It might be that the regular expressions that simpleXML uses might be confused by them on different platforms...</p>
| 32,704 |
<p>I currently have a web app that has 3 front ends (depending on what URL you go to) that shares very little code between the 3 front ends. My directory structure looks like this:</p>
<pre><code>\app1
\includes
\html
\app2
\includes
\html
\app3
\includes
\html
\crons
\libs
\logs
\setup
\db... | <p>What do you mean by 'loading Dojo'?<br>
If you mean opening a page with a clean cache, and the site takes a long time to load, then it may be because you're using a non-minified version of the library.</p>
<p>If you mean loading some Dijits, or <a href="http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/theme... | <p>What do you mean by 'loading Dojo'?<br>
If you mean opening a page with a clean cache, and the site takes a long time to load, then it may be because you're using a non-minified version of the library.</p>
<p>If you mean loading some Dijits, or <a href="http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/theme... | 25,671 |
<p>I've been looking for a component that would allow me to pass an arbitrary C# object to an XSL transform.</p>
<p>The naive way of doing this is to serialise the object graph using an XmlSerializer; however, if you have a large object graph, this could cause problems as far as performance is concerned. Issues such a... | <p>There's a (very) old MSDN article titled <a href="http://msdn.microsoft.com/en-us/library/ms950764.aspx" rel="noreferrer">XPath Querying Over Objects with ObjectXPathNavigator </a> that implements a similar class (Also called ObjectXPathNavigator, interestingly enough). I used this ages ago to query some data from ... | <p>Since the object graph may be cyclic, you cannot possibly make a Tree-based structure out of it. Your best bet is to represent the object graph by it's simplest components: nodes and vectors. </p>
<p>More specifically, make each node (object) an element with a unique ID (perhaps provided by C#'s GetHashCode() metho... | 48,599 |
<p>I'm sure this is easy but I can't figure it out:</p>
<p>I have an ASP.NET page with some UpdatePanels on it. I want the page to <em>completely</em> load with some 'Please wait' text in the UpdatePanels. Then once the page is <em>completely loaded</em> I want to call a code-behind function to update the UpdatePane... | <p>I fiddled around with the ScriptManager suggestions - which I reckon I would have eventually got working but it seems to me that the Timer idea is easier to implement and not really(!) that much of a hack?!</p>
<p>Here's how I got my panel updated <em>after</em> the initial page render was complete...</p>
<p>defau... | <p>The ScriptManager.RegisterStartupScript allows a script to run on startup inside of an update panel. if you use the old ClientScript.RegisterStartupScript then the script you render will be outside the bounds of the udpate panel, and thus won't be executed during async page loads.</p>
| 5,191 |
<p>I'm thinking it would be smart to setup the Entity object context in Application_BeginRequest, store it in Request.items, use it throughout the request and dispose it in Application_EndRequest. That way the context is always available and I can navigate the Entity Framework object graph in my views, lazy loading wha... | <p>The object context in EF, like the data context in L2S, is designed as a "unit of work", They're not thread-safe, and they're not designed to be long lived.</p>
<p>In MVC, the best strategy is to create one in the controller's constructor (implicitly or explicitly, doesn't matter) and then dispose it in the Dispose... | <p>The object context in EF, like the data context in L2S, is designed as a "unit of work", They're not thread-safe, and they're not designed to be long lived.</p>
<p>In MVC, the best strategy is to create one in the controller's constructor (implicitly or explicitly, doesn't matter) and then dispose it in the Dispose... | 35,430 |
<p>We have an SEO team at my office, and one of their dictums is that having lots of <script> blocks inline with the HTML is apocalypticly bad. As a developer that makes no sense to me at all. Surely the Google search engineers, who are the smartest people on the planet, know how to skip over such blocks? <br />
... | <p>It's been ages since I've played the reading google's tea leafs game, but there are a few reasons your SEO expert might be saying this</p>
<ol>
<li><p>Three or four years back there was a bit of conventional wisdom floating around that the search engine algorithms would give more weight to search terms that happene... | <p>I've spent some time working on search engines (not Google), but have never really done much from an SEO perspective.</p>
<p>Anyway, here are some factors which Google could reasonably use to penalise the page which should be increased by including big blocks of javascript inline.</p>
<ul>
<li>Overall page size.</... | 7,022 |
<p>I would like to setup a portal for my development team to share the ideas, reports, documents, images, etc. Something similar to MS SharePoint but free/open source.</p>
<p>Can you please share what do you guys use for the same?</p>
| <p>There is a lot of excellent material available on the web once you get in the groove, but the links below are (IMO) good starting points (the ones I used).</p>
<p><a href="https://people.eng.unimelb.edu.au/pstuckey/book/course.html" rel="nofollow noreferrer">Programming with Constraints: An Introduction - (Course w... | <p>The <a href="http://books.google.com.au/books?id=Kjap9ZWcKOoC" rel="nofollow noreferrer">handbook of constraint programming</a> is well thought of. </p>
<p>In trivia, <a href="http://portal.acm.org/author_page.cfm?id=81100589552" rel="nofollow noreferrer">my supervisor from fourth year</a> university (which was ... | 41,621 |
<p>How do I tell the 2 versions apart by looking only at their installations?</p>
| <p>If you open up the properties of the BTSNTSvc.exe file (by default located in C:\Program Files\Microsoft BizTalk Server 2006), go to the version tab and look at the Product Name. If it's R2, it will say so there. If not, it will just say Microsoft BizTalk Server 2006.</p>
<p>Hope that helps!</p>
| <p>There is a table in the BizTalkMgmtDB - BizTalkDBVersion. If the value is v3.6.x then it is BTS2006R2, else v3.5.x is BTS2006. </p>
<p>Or you can use the registry - in HKLM\SOFTWARE\Microsoft\BizTalk Server\3.0, there is a ProductVersionKey. Again, a value of v3.6.x tells us it is BTS2006R2. </p>
<p>Note: The vers... | 44,346 |
<p>What is the best way to refresh a <code>DataGridView</code> when you update an underlying data source?</p>
<p>I'm updating the datasource frequently and wanted to display the outcome to the user as it happens.</p>
<p>I've got something like this (and it works), but setting the <code>DataGridView.DataSource</code> ... | <p>Well, it doesn't get much better than that. Officially, you should use</p>
<pre><code>dataGridView1.DataSource = typeof(List);
dataGridView1.DataSource = itemStates;
</code></pre>
<p>It's still a "clear/reset source" kind of solution, but I have yet to find anything else that would reliably refresh the DGV data s... | <p>Try this Code</p>
<pre><code>List itemStates = new List();
for (int i = 0; i < 10; i++)
{
itemStates.Add(new ItemState { Id = i.ToString() });
dataGridView1.DataSource = itemStates;
dataGridView1.DataBind();
System.Threading.Thread.Sleep(500);
}
</code></pre>
| 31,649 |
<p>Does anyone here has any experience on how to send HTML emails that renders correctly on a Lotus Notes Client 7?</p>
<p>My email has a couple of complex CSS files and I tried embedding them on <style> tags, but it doesn't seem to work. The thing is that the email renders perfectly in version 8 and on other email... | <p>Lotus Notes 7 has a terrible HTML engine. Really awful. It's not you.</p>
<p>Here's <a href="http://web.archive.org/web/20120422155811/http://www.templatekit.com/lotusnotes1.php" rel="nofollow noreferrer">some old advice</a> about dealing with it. I also suggest signing up for an email testing service like <a href=... | <p>Here's a good chart for various email clients. Unfortunately only Notes 6 is covered at this point, but it gives you a starting point.</p>
<p><a href="http://www.campaignmonitor.com/css/" rel="nofollow noreferrer">http://www.campaignmonitor.com/css/</a></p>
| 48,121 |
<p>If you were a programming teacher and you had to choose one sorting algorithm to teach your students which one would it be? I am asking for only one because I just want to introduce the concept of sorting. Should it be the bubble sort or the selection sort? I have noticed that these two are taught most often. Is the... | <p>I'm not sure I could be a computer science teacher and only teach one sorting algorithm. </p>
<p>At a bare minimum the students should be taught at least one of each of the <a href="http://en.wikipedia.org/wiki/Sorting_algorithm#List_of_sorting_algorithms" rel="noreferrer">major sorting types</a>, namely an exchang... | <p>best lecture I ever attended on algorithms demonstrated <em>all</em> of them as bar-graphs drawn via java applets. You could then see the pattern of sorting as well as the O(N) characteristics as well... </p>
<p>Teach bubble because its incredibly simple and show the rest as animations maybe?</p>
| 26,059 |
<p>I've been working on a project where I need to iterate through a collection of data and remove entries where the "primary key" is duplicated. I have tried using a</p>
<pre><code>List<int>
</code></pre>
<p>and </p>
<pre><code>Dictionary<int, bool>
</code></pre>
<p>With the dictionary I found slightly ... | <p>They have added the HashSet class in .NET 3.5. But I guess it will be on par with the Dictionary. If you have less than say a 100 elements a List will probably perform better.</p>
| <p>I don't really get what you are asking.</p>
<p>Firstly is just the opposite of what you say. The dictionary has indexed access (is a hash table) while de List hasn't.</p>
<p>If you already have the data in a dictionary then all keys are unique, there can be no duplicates.</p>
<p>I susspect you have the data store... | 11,740 |
<p>I would like to know how to modify the below code to strip <code>=20</code> characters at the end of many lines, and mainly to sort the messages chronologically from first received or sent to last. I am not sure if this would be an internal Perl routine or not. </p>
<pre><code>#!/usr/bin/perl
use warnings;
use stri... | <p>I guess that those instances of <code>=20</code> are in the body of the message. Reading just a bit of the <a href="http://search.cpan.org/~markov/Mail-Box/lib/Mail/Message.pod" rel="nofollow noreferrer">documentation for Mail::Message</a> will reveal this helpful note: </p>
<blockquote>
<p>BE WARNED that this re... | <p>I'd suggest to look at the <a href="http://search.cpan.org/~gaas/MIME-Base64-Perl-1.00/" rel="nofollow noreferrer">MIME::Base64</a> module which includes MIME::QuotedPrint::Perl module to decode QP bodies.</p>
| 48,076 |
<p>I have been given two different Microsoft Word document that my virus scanner has warned me contains macros. These should be simple text files, and the person who sent them doesn't even know what a macro is; they may be a mistake on his part, but they might be signs of a malicious infection. My installation of OpenO... | <p>Just to expound on top of these previous posts - </p>
<p>Here is the process I followed - </p>
<ol>
<li>Open file</li>
<li>Enable <strong>Editing</strong> to get out of protected view</li>
<li><kbd>Alt</kbd><kbd>F11</kbd> to open the Visual Basic editor
<ul>
<li>Sometimes you can apparently view the macros here, ... | <p>Just open the document without activating macros, then open the code editor to see what they do.</p>
| 33,560 |
<p>I’ve got several Perl modules installed on my hosting machine in <code>~/perl</code>, how do I add them to Perl module path? Setting <code>PERL5LIB</code> or <code>unshift</code>ing the paths to <code>@INC</code> surely works, but the environment variable does not help when running as a CGI script and the <code>@INC... | <p>PERL5LIB works just fine for CGI scripts. You just have to set the variable in the right place, such as the server configuration. Which webserver are you using? For Apache, I use the <a href="http://httpd.apache.org/docs/1.3/mod/mod_env.html" rel="nofollow noreferrer">SetEnv</a> directive from mod_env.</p>
<p>@INC ... | <p>A cleaner way to do it imo is :</p>
<pre><code>use lib "/path/" ;
</code></pre>
<p>there are other interesting and good ways to do it that can be found here: </p>
<p><a href="http://www.slideshare.net/pfig/cpan-training-presentation/" rel="noreferrer">http://www.slideshare.net/pfig/cpan-training-presentation/</... | 46,303 |
<p>Is there any plans for Microsoft to support LINQ to SQL beyond MS SQL server?</p>
| <p>Microsoft has no plans to extend LINQ to SQL beyond SQL Server and it wouldn't make much sense to do so. The majority of code in LINQ to SQL is in the implementation of the SQL Provider.</p>
<p>Microsoft offers Entity Framework as its cross-database-platform ORM solution and other ORM solutions are implementing LIN... | <p>I do not know whether Microsoft plans to do so, but it is probably unlikely. However, if you want to use something similar, you could probably use <a href="http://www.ohloh.net/projects/dblinq" rel="nofollow noreferrer">DbLinq</a> meanwhile.</p>
| 27,885 |
<p><a href="http://www.springsource.org/extensions/se-workflow" rel="noreferrer">Spring Workflow</a> has now been published.</p>
<ul>
<li>Have you tried it yet? For what kind of scenario?</li>
<li>What is your impression? How do you find it stacks up against other workflow libs?</li>
<li>Found any good docs or tutoria... | <p>OK, ignoring my beliefs shown in my previous post I did try spring workflow, only to find out that I was right. Getting the sources and building is not that hard, they use svn, ant and ivy as repository manager.</p>
<p>Making it work is another story. I took the sample sources, an placed them in a new project. At t... | <p>I don't think it's a good idea to try it yet, it's just a release to proove the concept. First of all you have to manually build your library, after that, leran how to use it with no example or documentation, just using the scarcely documented code and test code. And when you have an idea about it you realise it can... | 33,223 |
<p>We use a simple object model for our low level networking code at work where struct pointers are passed around to functions which are pretending to be methods. I've inherited most of this code which was written by consultants with passable C/C++ experience at best and I've spent many late nights trying to refactor c... | <p>You can use macro to redefine <code>tcp_socket_send</code> to <code>tcp_socket_send_moc</code> and link with real <code>tcp_socket_send</code> and dummy implementation for <code>tcp_socket_send_moc</code>.<br>
you will need to carefully select the proper place for : </p>
<pre><code>#define tcp_socket_send tcp_socke... | <p>Not sure what you want to achieve.</p>
<p>You can add all foo_* functions as function pointer members to <code>struct Foo_s</code> but you still need to explicitly pass pointer to your object as there is no implicit <code>this</code> in C. But it will give you encapsulation and polymorphism.</p>
| 31,532 |
<p>I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying?</p>
<pre><code><html>
<script ... | <p>I haven't tried this but the "Dupli Find" available at <a href="http://www.rlvision.com/dupli/about.asp" rel="nofollow noreferrer">http://www.rlvision.com/dupli/about.asp</a> may be of help to you.</p>
<p>The windows powershell script outlined in
<a href="http://secretgeek.net/ps_duplicates.asp" rel="nofollow nore... | <pre><code>cat file.js | grep -o "function\([[:space:]]\+[a-zA-Z0-9_]\+\)\?[[:space:]]*(" | sort | uniq -c | sort -n
</code></pre>
<p>Which reads:</p>
<ul>
<li>Cat file</li>
<li>Look for function definitions (function-ws-name-ws-paren)
the -o extract only matching parts of lines (ie only the definitions themselves)</... | 41,935 |
<p>I have a rails template (.rhtml file) generating a Javascript object. It looks something like the following:</p>
<pre><code>var volumes = {
<% for volume in @volumes %>
<%= volume.id %> : <%= volume.data %>
<%= ',' unless volume === @volumes.last %>
<% end %>
};
</code></p... | <p>I don't see why not, but generally if you find yourself conditionalizing a comma on the last member, you probably want to use <code>join</code> instead:</p>
<pre><code><%= @volumes.map {|v| "#{v.id} : #{v.data}"}.join "," %>
</code></pre>
| <p>Or even:</p>
<pre><code><%= @volumes.map { |v| "#{v.id} : #{v.data}"}.to_sentence -%>
</code></pre>
<p>To get "a: something, b: something else, c: anything, and d: another thing."</p>
| 34,379 |
<p>Suppose there were several projects mostly maintained by smart interns, who eventually leave after a period of time. Scripts are used here and there in key parts, for example, to back up a database, rename it, zip it, move it over ssh, unzip it, and then to restore it with different settings. You know, the scripting... | <p>PowerShell - designed from the ground up to be a Windows scripting language, and it can hook into the CLR for advanced functionality.</p>
<p>(yes, I realize this doesn't run under cygwin... but why is that a requirement?)</p>
| <p>For your particular description, PowerShell sounds like a good way to go ... but I would make a strong case for JScript under WSH (or JavaScript under Rhino/etc.). Sounds like you like CYGWIN, but Powershell does not currently have support for other platforms (too much native stuff I think -- that's a separate discu... | 42,333 |
<p>What are some really useful but esoteric language features in Perl that you've actually been able to employ to do useful work?</p>
<p>Guidelines:</p>
<ul>
<li>Try to limit answers to the Perl core and not CPAN</li>
<li>Please give an example and a short description</li>
</ul>
<hr>
<h2>Hidden Features also found ... | <p>The flip-flop operator is useful for skipping the first iteration when looping through the records (usually lines) returned by a file handle, without using a flag variable:</p>
<pre><code>while(<$fh>)
{
next if 1..1; # skip first record
...
}
</code></pre>
<p>Run <code>perldoc perlop</code> and search fo... | <p>I like the way we can insert a element in any place in the array, such as</p>
<p>=> Insert $x in position $i in array @a</p>
<pre><code>@a = ( 11, 22, 33, 44, 55, 66, 77 );
$x = 10;
$i = 3;
@a = ( @a[0..$i-1], $x, @a[$i..$#a] );
</code></pre>
| 19,573 |
<p>When I press the standard Ctrl + E, C (an other variants) in VS2008 whilst editing a CSS file, it says that command is not available. How do I setup a shortcut to apply a plain old /* */ comment to selected text in VS? Thanks</p>
| <p>Within Visual Studio, hit Alt-F11 to open the Macro IDE and add a new module by right-clicking on MyMacros and selecting Add|Add Module...</p>
<p>Paste the following in the source editor:</p>
<pre><code>Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module Commen... | <p>here's an even simpler solution:</p>
<pre><code>Sub CommentCSS()
DTE.ActiveDocument.Selection.StartOfLine(VsStartOfLineOptions.VsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.Text = "/*"
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.Text = "*/"
End Sub
</code></pr... | 30,932 |
<p>I'm looking into the idea of rolling out the web-based SSRS Report Builder to our end users to allow them to create their own reports against our production application databases. From what I have seen so far, this tool is easier to use than the VS Biz Intel Studio report designer, plus it is easier to install, and... | <p>Some tips for report model design:</p>
<p><strong>1. Build a data mart</strong></p>
<p>There are several tools like Report Builder: Business Objects, Oracle Discoverer to name a couple. They all have metadata layers that get you some of the way to an end-user reporting tool, however they still really need to be s... |
Just a few comments on the previous answer:<br/>
1. The semantic query model used by SQL Server Reporting Services Report Builder was designed with the explicit intent of preventing Fan Traps/incorrect totals on m:m relationships. No extra effort is required to enable this functionality; it is inherent in the structur... | 38,764 |
<p>I need to create a rectangle bubble with rounded corners with text inside, like a cartoon speech bubble. I need the bubble to expand horizontally and vertically depending on the size of the text it contain. I would like the speech arrow and the radius of the rounded corners to remain constant.</p>
<p>I could simpl... | <p>Use this XAML, You can create a PopUp or a ContentControl and can give this Grid as the control template on it to get a consistent look</p>
<pre><code><Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefi... | <p>The rounded corners can just be a Border with Corner Aliasing set.</p>
<p>The constant / speech arrow can be a path that is positioned in a grid along with the border.</p>
<p>Take a look at the control template for the GroupBox and see how the "Header" content is positioned to float over the Border of the group bo... | 43,749 |
<p>I am very familiar with the Command pattern, but I don't yet understand the difference in theory between a Functor and a command. In particular, I am thinking of Java implementations. Both are basically programming "verbs" represented as objects. However, in the case of functors, as I have seen from some examples an... | <p>A functor is an implementation, a way of making an object behave like a function.</p>
<p>The 'Command Pattern' is a design pattern.<br>
The functor is one way to implement the 'Command Pattern'.</p>
| <p>I think of a functor as being a component of the command pattern, which also involves other infrastructure such as the invoker and command recipients.</p>
| 32,251 |
<p>This code is not working on IE8 at all. FF3 is executing but the page is blank and seems loading not ending.</p>
<p>My code is:</p>
<pre><code>$("#leaderBoard").html("<script2 language=\"javascript2\"> document.write('<scr'+'ipt language=\"javascript21.1\">alert(1)</scri'+'pt>'); </script2>... | <p>This works for me in FF3 and IE7:</p>
<pre><code>$("#leaderBoard").html('<sc'+'ript language="javascript1.1">alert(1);</sc'+'ript>');
</code></pre>
<p>When you use document.write after the page has loaded, it replaces the entire document (<a href="http://javascript.about.com/library/blwrite.htm" rel="n... | <p>try wrapping your code in</p>
<pre><code>$(document).ready(function() {
// your code here
});
</code></pre>
| 43,684 |
<p>I'm making an example for someone who hasn't yet realized that controls like <code>ListBox</code> don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the <code>ListBox</code> and I'd like to show him there's a better way.</p>
... | <p>BindingList handles updating the bindings by itself.</p>
<pre><code>using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace TestBindingList
{
public class Employee
{
public string Name { get; set; }
public int Id { get; set; }
}
public partial class Form1 :... | <p>I don't know much about vb.net but in C# you should use datasource and then bind it by calling <code>listbox.bind()</code> would do the trick.</p>
| 8,665 |
<p>We're working with a fixed transaction log size on our databases, and I'd like to put together an application to monitor the log sizes so we can see when things are getting too tight and we need to grow the fixed trn log. </p>
<p>Is there any TSQL command that I can run which will tell me the current size of the tr... | <p>I used your code but, there was an error converting to an int.
"Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int." So wherever there was an "*8" I changed it to *8.0 and the code works perfectly.</p>
<pre><code>SELECT (size * 8.0)/1024.0 AS size_in_mb
, CASE... | <p>If you really need to stick to a fixed size transaction log, I'd suggest to set it to a reasonable size, allowing some margin, and then do one of the following two:</p>
<ul>
<li>Set database recovery mode to SIMPLE, if you don't need point in time recovery. In simple words, it will allow transaction log to "self-re... | 24,159 |
<p>When I switch tabs with the following code</p>
<pre><code>tabControl1.SelectTab("MyNextTab");
</code></pre>
<p>It calls the tabPage_Enter for the tab it is switching from and the tab it is switching to. I want it to be called for the tab it is switching to, but not the tab it is switching from. How would I turn th... | <p>Yes, I repro if I use a button to change the selected tab. TabControl forces the focus onto itself before it changes SelectedIndex. This appears to have been done to avoid problems with the Validating event. The focus change produces the first Enter event, for the active tab, the tab change then produces the seco... | <p>Can you check the index of the active tab and workaround using that?</p>
| 43,092 |
<p>We've embedded an OSGi runtime (Equinox) into out custom client-server application to facilitate plugin development and so far things are going great. We've been using Eclipse to build plugins due to the built-in manifest editor, dependency management, and export wizard. Using Eclipse to manager builds isn't very co... | <p>Maven2 all the way; has an Eclipse plugin called <a href="http://m2eclipse.codehaus.org/" rel="nofollow noreferrer">m2eclipse</a> to help with managing it, solves exactly the dependency problem and then some. Has a <a href="http://www.sonatype.com/community/definitive_guide.html" rel="nofollow noreferrer">free onlin... | <p>Can you please elaborate where the problem occurs? You mention OSGi bundle dependencies. Is this during runtime? Or during compile-time? In the first case you should consider Declarative Services (see OSGi Spec).</p>
| 4,747 |
<p>I have to create the sin function from scratch in my Comp Sci class, and I am getting close to a solution. However, I am still having a few problems. If I put in a value of .5PI or less it works, but otherwise I get the incorrect result. Here is the code I have so far:</p>
<pre><code>double i=1;
double sinSoFar = 0... | <p>Like Federico pointed, the problem probably is in your factorial() or pow(). I ran a test that worked fine replacing your functions with the pow() function provided in the Math class, and this factorial():</p>
<pre><code>public static long factorial(long n) {
if (n < 0) throw new RuntimeException("... | <p>As far as values outside of 0 - 1/2PI, they can all be computed from values inside the range.</p>
<pre><code>// First, normalize argument angle (ang) to -PI to PI,
// by adding/subtracting 2*PI until it's within range
if ( ang > 1/2PI ) {
sin = sin ( PI - ang );
}
else if ( ang < 0 ) {
sin = -1 * sin... | 29,798 |
<p>Frequently I come across the following statements in C/C++ source code:</p>
<pre><code>$Id: lzio.c,v 1.24 2003/03/20 16:00:56 roberto Exp $
$Id: file name, version, timestamp, creator Exp $
</code></pre>
<p>Have you got any idea which software produces those "signatures"?</p>
| <p>Version control systems such as CVS can produce such tags.</p>
| <p><a href="http://www.perforce.com" rel="nofollow noreferrer">Perforce</a> supports some (not sure about all) of those key words.</p>
| 45,060 |
<p>When using <code>divs</code> when is it best to use a <code>class</code> vs <code>id</code>? </p>
<p>Is it best to use <code>class</code>, on say font variant or elements within the html? Then use <code>id</code> for the structure/containers? </p>
<p>This is something I've always been a little uncertain on, any he... | <p>Use <code>id</code> to identify elements that there will only be a single instance of on a page. For instance, if you have a single navigation bar that you are placing in a specific location, use <code>id="navigation"</code>.</p>
<p>Use <code>class</code> to group elements that all behave a certain way. For instan... | <p>If it's a style you want to use in multiple places on a page, use a class. If you want a lot of customization for a single object, say a nav bar on the side of the page, then an id is best, because you're not likely to need that combination of styles anywhere else.</p>
| 10,998 |
<p>I'm trying to direct a browser to a different page. If I wanted a GET request, I might say</p>
<pre><code>document.location.href = 'http://example.com/q=a';
</code></pre>
<p>But the resource I'm trying to access won't respond properly unless I use a POST request. If this were not dynamically generated, I might use... | <h2>Dynamically create <code><input></code>s in a form and submit it</h2>
<pre class="lang-js prettyprint-override"><code>/**
* sends a request to the specified url from a form. this will change the window location.
* @param {string} path the path to send the post request to
* @param {object} params the parame... | <p>You could make an AJAX call (likely using a library such as using Prototype.js or JQuery). AJAX can handle both GET and POST options.</p>
| 16,205 |
<p>I'm looking for some programming guides to C# GUI design. I come from the Java camp (where I can happily hand-code Swing/AWT GUIs) and thus don't have a clue where to start :(</p>
<p>Also, what difference (if any) is there between the Windows Presentation Foundation and WinForms?</p>
| <p><strong>Windows Presentation Foundation</strong> is a vector-based system that is part of .NET 3.0. It allows you to define your UI in XAML, and can do all sorts of animation, 3D, etc. very easily. It's much newer and still being evalulated by a lot of folks.</p>
<p><strong>Windows Forms</strong> is a wrapper ove... | <p>No mention of GUI design would be complete without mention of <a href="http://en.wikipedia.org/wiki/Alan_Cooper" rel="nofollow noreferrer">Alan Coopers About Face</a> although at first glance it looks out of date (most of the screenshots are windows 3.1) its content is still valid today</p>
| 14,828 |
<p>In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms.</p>
<p>Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?</p>
| <p>It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better.</p>
<p>Some people like to write up use cases and if they see a lot of the s... | <p>If you're doing something for yourself, or if you're doing just a prototype, or testing an idea... use the free style that script languages gives you. </p>
<p>After that: always think in objects, try to organize your work around the OO paradigm even if you're writing procedural stuff. Then, refactorize, refactorize... | 2,600 |
<p>I'm building a website for a small non-profit org. and I was wondering at what kind of browser marketshare a browser should have before I support it. Chrome looks like a major contender, but it's still less than 5%, as is Opera. </p>
<p>What browsers do you think I should completely support for this kind of project... | <ol>
<li>Firefox, IE7 and IE6 are enough to cover more than 90% of the browser market share.</li>
<li>It is a good idea to read the new web standards and take in account what Microsoft prepares for IE8.</li>
<li>Then you can try to be compatible with Google Chrome.</li>
<li>Finally, there should be a very specific cust... | <p>IMHO the more important thing to do is do a good job of separating your presentation tier from your business logic. Try to be as flexible as possible and allow the users to decide the direction. You might now say, Webkit doesn't have enough users, but a month down the line your client decides to buy iPhones for al... | 21,188 |
<p>I have a few questions about optimizing this type of load.</p>
<p>One builds a new table of data to be loaded into a partitioned table and then builds the indexes on this new table. </p>
<ol>
<li><p>Should you build the index with the COMPUTE STATISTICS option or use the Cascade option of the DBMS_Stats?</p></li>
... | <blockquote>
<p>Should you build the index with the COMPUTE STATISTICS option or use the Cascade option of the DBMS_Stats?</p>
</blockquote>
<p>If this is a data warehouse then first consider not gathering statistics at all, and using dynamic sampling. Second, if you do gather statistics then by all means use comput... | <ol>
<li><p><code>DBMS_STATS</code> is considered the proper way to calculate statistics for this version. Building the index with the <code>COMPUTE STATISTICS</code> is doable, but usually you want to calculate all your stats at one time and take snapshots.</p></li>
<li><p>You want to gather stats after the swap. This... | 20,281 |
<p>I want to validate a set of credentials against the domain controller. e.g.:</p>
<pre><code>Username: STACKOVERFLOW\joel
Password: splotchy
</code></pre>
<h2>Method 1. Query Active Directory with Impersonation</h2>
<p>A lot of people suggest querying the Active Directory for something. If an exception is thrown, ... | <p>C# in .NET 3.5 using <a href="http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.aspx" rel="noreferrer">System.DirectoryServices.AccountManagement</a>.</p>
<pre><code> bool valid = false;
using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
{
valid = con... | <pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices.AccountManagement;
class WindowsCred
{
private const string SPLIT_1 = "\\";
public static bool ValidateW(string UserName, string Password)
{
bool valid = false;
string Domain = "";
... | 42,338 |
<p>Is there a .NET Control Similar to the Access 2007 Split Form?</p>
<p>Or has anyone built such a control?</p>
<p>I upgraded a small personal Name and Address DB to Access 2007 and noticed the Form had a property called “Default View” which can be set to “Split Form”. “Split Form” mode has a GridView and a Form tog... | <p>Not that I know of, but pretty much all you need is:</p>
<ul>
<li>a split container</li>
<li>a user control containing your actual form</li>
<li>a grid view</li>
</ul>
<p>Now you just hook up the grid view's item selection events with a controller that loads data into the user control's child controls.</p>
<p>Fro... | <p>A Flex Grid Control will probably do what you want but you will need to write a bit of VBA code, have a look at my Flex Grid Demo program for some examples.</p>
<p>Go to <a href="http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=180" rel="nofollow noreferrer">http://www.rogersaccesslibrary.com/forum/foru... | 7,043 |
<p>A heap is a list where the following applies:</p>
<pre><code>l[i] <= l[2*i] && l[i] <= [2*i+1]
</code></pre>
<p>for <code>0 <= i < len(list)</code></p>
<p>I'm looking for in-place sorting.</p>
| <p>Well you are half way through a Heap Sort already, by having your data in a heap. You just need to implement the second part of the heap sort algorithm. This should be faster than using quicksort on the heap array.</p>
<p>If you are feeling brave you could have a go at implementing <a href="http://www.cs.utexas.edu... | <p>Read the items off the top of the heap one by one. Basically what you have then is heap sort.</p>
| 13,919 |
<p>I am looking to replace the life cycle tools currently used by my development teams.
Tools that I'm looking for:</p>
<ul>
<li>Version Control</li>
<li>Defect/Issue Tracking</li>
<li>Requirements Tracking</li>
<li>Test Case Management</li>
<li>(potentially) Project Management: Project Status, hours entry</li>
</ul>
... | <p>Svn/Trac plus a few plugins will probably get you most of the way there for free.</p>
<p>If you use the version supplied by visualsvn (they bundle both trac and subversion) its a nice easy setup too. </p>
<p><a href="http://www.visualsvn.com/server/" rel="nofollow noreferrer">http://www.visualsvn.com/server/</a>
<... | <p>Have a look at the tools by Atlassian- <a href="http://www.atlassian.com/" rel="nofollow noreferrer">http://www.atlassian.com/</a> we've used some of their products (Jira/Confluence) and they link together well. Not exactly expensive either.</p>
<p>As an admin / Wiki gardener they are easy to use and manage, which ... | 19,089 |
<p>I have a byte array in memory, read from a file. I would like to split the byte array at a certain point (index) without having to just create a new byte array and copy each byte at a time, increasing the in memory foot print of the operation. What I would like is something like this:</p>
<pre><code>byte[] largeBy... | <p>This is how I would do that:</p>
<pre><code>using System;
using System.Collections;
using System.Collections.Generic;
class ArrayView<T> : IEnumerable<T>
{
private readonly T[] array;
private readonly int offset, count;
public ArrayView(T[] array, int offset, int count)
{
this.... | <p>You can't. What you might want is keep a starting point and number of items; in essence, build iterators. If this is C++, you can just use <code>std::vector<int></code> and use the built-in ones.</p>
<p>In C#, I'd build a small iterator class that holds start index, count and implements <code>IEnumerable<&... | 4,116 |
<p>I am trying to decide whether to learn ASP.NET MVC (or to spend the time learning another technology that interests me). I know that it is an elegant framework, but I am trying to assess my future job opportunities if I invest in this skill. In your estimation, how long is it going to be before demand for ASP.NET MV... | <p>For mainstream adoption, I wouldn't expect it will really take off until after RTM. Initially work will be limited to new projects, which I suspect there may be fewer of with the economy being as it is. The real increase in jobs will come when there are more established projects requiring maintenance. </p>
<p>As fo... | <p>I know for a fact that some companies, including my own, is adapting to asp.net mvc and using it for almost all projects.</p>
<p>Even though it's a Beta, i still see it widely used. This is probably because ASP.NET is such a strong web-language, companies more and more adapt to the better and more evolved technolog... | 45,433 |
<p>I know that CoreXY kinematics is very complex and hard to calculate for the firmware making it better to use a 32-bit board. For some reason, I can't use any 32-bit board. What problems will occur if I use an 8-bit board like Arduino Mega with a CoreXY 3D printer?</p>
<p>Everything that I wrote in this question abou... | <p>The tradeoffs in these systems are all about quality achievable at particular speed and acceleration profiles. If you really don't care about speed at all and want maximum accuracy, you probably want some type of Cartesian setup with no belts, only rigid lead screws which you can take to as fine a pitch as you like,... | <p>The tradeoffs in these systems are all about quality achievable at particular speed and acceleration profiles. If you really don't care about speed at all and want maximum accuracy, you probably want some type of Cartesian setup with no belts, only rigid lead screws which you can take to as fine a pitch as you like,... | 1,718 |
<p>I'm pulling back a Date and a Time from a database. They are stored in separate fields, but I would like to combine them into a java.util.Date object that reflects the date/time appropriately.</p>
<p>Here is my original approach, but it is flawed. I always end up with a Date/Time that is 6 hours off what it should ... | <p>I would put both the Date and the Time into Calendar objects, and then use the various Calendar methods to extract the time values from the second object and put them into the first.</p>
<pre><code> Calendar dCal = Calendar.getInstance();
dCal.setTime(date);
Calendar tCal = Calendar.getInstance();
tCal.setTi... | <p>Assuming you know the time zone of the time being read from the database you need to use the <code>ResultSet.getTime(String, Calendar)</code> method having previously set the time zone on the <code>Calendar</code>. The JDBC driver will make the necessary adjustments to the time.</p>
<p>If all code is running serve... | 44,763 |
<p>Assume somebody has a Monoprice Maker Select and has changed from the original brass extruder gear to a <a href="https://www.wanhaouk.com/products/extruder-drive-gear" rel="nofollow noreferrer">D4 Plus</a> one, which is slightly smaller (10.6 vs 10.9 mm outer diameter).</p>
<p>This person might be wondering if he/s... | <p>If you change the extruder wheel for a different sized wheel, you need to calibrate the extruder to make sure that if you ask to extrude 100 mm it actually extrudes 100 mm. <a href="https://3dprinting.stackexchange.com/a/6484/5740">This answer</a> on the question "<a href="https://3dprinting.stackexchange.com/q/6483... | <p>This will affect your extrusion rate. The best place to change this would be in your E steps located in the firmware but you can also compensate for this by changing the flow percentage in Cura, a setting of 103% (10.9/10.6) should get you close.</p>
| 1,061 |
<p>I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this:</p>
<pre><code>\replace{File,New}
</code></pre>
<p>and that would generate something like</p>
<pre><code>\textbf{File}$\rightarrow$\textbf{New}
</code></pre>
<p>This is a simpl... | <p>The general case is rather more tricky (when you're not using commas as separators), but the example you gave can be coded without too much trouble with some knowledge of the LaTeX internals.</p>
<pre><code>\documentclass[12pt]{article}
\makeatletter
\newcommand\formatnice[1]{%
\let\@formatsep\@formatsepinit
\@... | <p>OK, I withdraw this answer. Thanks for clarifying the question.</p>
<hr>
<p>I suspect this may not be what you want, but here goes anyway:</p>
<pre><code>\newcommand{\replace}[2]{\textbf{#1}$\rightarrow$\textbf{#2}}
\replace{File}{New}
</code></pre>
<p>If this isn't what you're looking for, could you clarify... | 12,134 |
<p>Does a new <code>SessionFactor</code>y and <code>Session</code> object have to be created for each database? I have a data store for my application data, and a separate data store for my employee security, which is used to validate users. Do I have to create a new SessionFactory ans Session object for calls to the 2... | <p>ok so this doesn't answer your question directly but it might offer an insight as to why you should create multiple session objects for each datastore.</p>
<p><a href="http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx" rel="nofollow noreferrer">This article</a> explains how you can implement a... | <h1>General case</h1>
<p>The general case answer is no, you need at least different sessions for the general case.</p>
<p>You may use a single session factory by using the <code>OpenSession</code> overload taking an opened connection as argument, allowing you to switch database for the session requiring it.</p>
<p>T... | 8,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.