instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Create a file called Valid[File].txt and stick some text in it. Start powershell and go to the directory.<br>
<PRE>
gc Valid[File].txt
</PRE>
should display the value in the file. It returns blank. If you use tab auto-completion it escapes the name:
<PRE>
gc 'Valid<code>[File</code>].txt'
</PRE>
but still returns... | <p>Turns out the key was <code>-literalpath</code>. For details see <a href="http://www.microsoft.com/technet/scriptcenter/resources/pstips/jun08/pstip0620.mspx" rel="nofollow noreferrer">this technet article</a></p>
| <p>You probably need to enclose it in quotation marks: gc "Valid[File].txt"</p>
| 34,753 |
<p>Is it possible to use SQL Server 2008 CROSS APPLY with LINQ-2-SQL? </p>
<p>Example SQL:</p>
<pre><code>select d.dateCol, tvf.descr, tvf.value
from dateTable d
cross apply tvFunction(d.dt, 'anotherParam') tvf
where d.category='someCat'
</code></pre>
<p>CROSS APPLY enables using values from a table (dateTable in th... | <p>The only way to use it would be to wrap the above code in a stored procedure and wrap it with LINQ to SQL.</p>
| <p>Try this:</p>
<pre><code>from d in dateTable
from tvf in tvFunction(d.dt, 'anotherProgram')
where d.category = 'someCat'
</code></pre>
| 25,693 |
<p>I have a really strange problem with an quite simple ASP.NET (.NET 3.5) Site and the IE6.</p>
<p>It seems sometimes and on certain machines, the IE6 crashes while displaying the site. CSS was already eliminated as a reason for the crashes.</p>
<p>After a while of research, I was not able to find a reason for the c... | <p>A couple of things you could try:</p>
<ul>
<li>Check if any IE plug-ins (toolbars, etc) are installed on the machines in question, and try disabling all of them.</li>
<li>Check the Windows Event Log to see if the crash has left any clues.</li>
</ul>
<p>If you want to get really hardcore, you could follow <a href="... | <p>How exactly does IE 6 crash? If you are getting the infamous <a href="http://www.google.co.uk/search?hl=en&rlz=1C1GGLS_en-GBGB291&q=operation+aborted&btnG=Search&meta=" rel="nofollow noreferrer">Operation Aborted</a> error try moving any JavaScript to the foot of the page just above the closing tag ... | 18,974 |
<p>I have an application which extracts data from an XML file using XPath. If a node in that XML source file is missing I want to return the value "N/A" (much like the Oracle NVL function). The trick is that the application doesn't support XSLT; I'd like to do this using XPath and XPath alone.</p>
<p>Is that possible?... | <p>It can be done but only if the return value when the node does exist is <em>the string value of the node, not the node itself</em>. The XPath</p>
<pre><code>substring(concat("N/A", /foo/baz), 4 * number(boolean(/foo/baz)))
</code></pre>
<p>will return the string value of the <code>baz</code> element if it exists, ... | <p>It can be done with XPath 1.0. Say you have</p>
<pre><code><foo>
<bar/>
</foo>
</code></pre>
<p>If you want to test if <code>foo</code> has a <code>baz</code> child,</p>
<pre><code>substring("N/A", 4 * number(boolean(/foo/baz)))
</code></pre>
<p>will return "N/A" if the expression <code>/foo/... | 6,159 |
<p>I want to debug an application in Visual Studio but I ONLY have the source code for 1 class. I only need to step through a single function in that file, but I don't understand what I need to do it. I think the steps are normally something like this:</p>
<ol>
<li>Open a file in VS</li>
<li>Load in the "symbols" (.... | <p>You need *.pdb files (step 2 from your post) These files contain mapping between source code and compiled assembly. So your step are correct. If your source file has differences with original file, set check mark "Allow the source code to be different from the original version" in BP's properties dialog.</p>
<p><a ... | <p>The symbol file is the .pdb file. If you place that next to the exectuable, that will load the symbols, and point to the source file.</p>
| 13,274 |
<p>Has anyone out there hacked up ExpressionEngine (CMS) to work with SQLite? If so, any good tips or guides on how to do so?</p>
| <p>Also, try setting your debugger to Mixed. This will allow debugging of both managed and unmanaged code.</p>
| <p>You sure you enabled all the debugging options? I have seen this happen when 'forgetting' some when trying to navigate the maze of C++ options.</p>
| 43,309 |
<p>I want to create a UITableView with varying row heights, and I'm trying to accomplish this by creating UILabels inside the UITableViewCells.</p>
<p>Here's my code so far:</p>
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyI... | <p>The UITableViewDelegate defines an optional method heightForRowAtIndexPath, which will get you started. You then need to use sizeWithFont.</p>
<p>There is some discussion of your precise problem here:</p>
<p><a href="http://www.v2ex.com/2008/09/18/how-to-make-uitableviewcell-have-variable-height/" rel="nofollow no... | <p>textView.numberOfLines = 2?
numberOflines sets maximum nuber of lines so maybe 2 will owrk for u?</p>
| 15,579 |
<p>I was just wondering if there is an elegant way to set the maximum CPU load for a particular thread doing intensive calculations.
<br/><br/>Right now I have located the most time consuming loop in the thread (it does only compression) and use <code>GetTickCount()</code> and <code>Sleep()</code> with hardcoded values... | <p>I am not aware of any API to do get the OS's scheduler to do what you want (even if your thread is idle-priority, if there are no higher-priority ready threads, yours will run). However, I think you can improvise a fairly elegant throttling function based on what you are already doing. Essentially (I don't have a W... | <p>You may be able to change the priority of a thread, but changing the maximum utilization would either require polling and hacks to limit how many things are occurring, or using OS tools that can set the maximum utilization of a process.
However, I don't see any circumstance where you would want to do this.</p>
| 2,418 |
<p>Anyone know how to turn off code folding in visual studio 2008? Some of my colleagues love it, but I personally always want to see all the code, and never want code folded out of sight. I'd like a setting that means my copy of Visual Studio never folds <code>#regions</code>or function bodies. </p>
| <h1>Edit: <a href="https://stackoverflow.com/questions/115694/how-to-permanently-disable-region-folding-in-visual-studio-2008/6209270#6209270">I recommend this other answer</a></h1>
<p>Go to the Tools->Options menu.
Go to Text Editor->C#->Advanced. Uncheck "Enter outlining mode when files open".</p>
<p>That will dis... | <p>i resolved the problem for me with an environmentevent:</p>
<ol>
<li>start macroeditor (alt+f11)</li>
<li>open macroproject / EnvironmentEvents</li>
<li>paste the follwing code:</li>
</ol>
<pre><code>
Private Sub DocumentEvents_DocumentOpened(ByVal Document As EnvDTE.Document) Handles DocumentEvents.DocumentOp... | 14,104 |
<p>Similar to <a href="https://stackoverflow.com/questions/85978/query-a-tables-foreign-key-relationships">this question</a> but for MySQL....</p>
<p>How can I programmatically determine foreign key references in MySQL (assuming InnoDB)? I can almost get them with:</p>
<pre><code>SHOW TABLE STATUS WHERE Name = 'MyTa... | <p>There are two tables you can query to get this information: <a href="http://dev.mysql.com/doc/refman/5.1/en/table-constraints-table.html" rel="noreferrer"><code>INFORMATION_SCHEMA.TABLE_CONSTRAINTS</code></a> and <a href="http://dev.mysql.com/doc/refman/5.1/en/key-column-usage-table.html" rel="noreferrer"><code>INFO... | <pre><code>SELECT TABLE_NAME,
COLUMN_NAME,
CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,
REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME = 'table_name'
AND TABLE_SCHEMA = 'table_schema';
</code></pre>
| 34,495 |
<p>My attempts to install modperl under the default vanilla Leopard Apache 2 have failed and all I can find online are variations on <a href="http://www.nabble.com/Building-mod_perl2-on-Leopard-td13682685.html" rel="nofollow noreferrer">this</a>:</p>
<p>I would like if possible not to rely on MacPorts or Fink, though ... | <p><a href="http://www.macports.org/" rel="nofollow noreferrer">Macports</a> has it (think apt-get and the likes on linux, but on OS X)</p>
<p>(you can see it listed <a href="http://trac.macports.org/browser/trunk/dports/www/mod_perl2/Portfile" rel="nofollow noreferrer">here</a>)</p>
<p>Haven't installed myself thoug... | <p>I asked a very similar question a few days ago and got some good answers:
<a href="https://stackoverflow.com/questions/79493/how-do-i-use-a-vendor-apache-with-a-self-compiled-perl-and-modperl">"How do I use a vendor Apache with a self-compiled Perl and mod_perl?"</a></p>
| 11,117 |
<p>I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible. How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)? This behavior is very annoying when doing a drag from this control. </p>
<p>Thanks.</p>
... | <p>The items scroll into view because the default behavior on list item click is to call BringIntoView(). You can add an event handler for the RequestBringIntoView event and catch it before it bubbles up from the ListViewItems to the ScrollViewer. In your handler, check the bounds of the sender against the visible re... | <p>have you tried <a href="http://www.codeproject.com/KB/WPF/DraggableListView.aspx" rel="nofollow noreferrer">this approach</a>?</p>
<p>just as an addon, I don't know how much you know about the subject, but <a href="http://www.codeproject.com/KB/WPF/ListViewDragDropManager.aspx" rel="nofollow noreferrer">here is a g... | 25,700 |
<p>My data is such that I want to display values for the Employee and the Supervisor for a particular record. Instead of describing it, I'll show you a rough example:</p>
<pre><code><table><tr>
<th colspan="3">Employee</th>
<th colspan="3">Supervisor</th>
</tr><tr>
<t... | <p>This is probably happening because you're trying to index too many items at once. Make sure you're using <a href="http://www.sphinxsearch.com/docs/current.html#conf-sql-query-range" rel="noreferrer">ranged queries</a>. If you're already using ranged queries, increasing the <code>mem_limit</code>, as it suggests, m... | <blockquote>
<p>In sphinx.conf:</p>
<pre><code>sql_query_range = SELECT MIN(id),MAX(id) FROM documents
sql_range_step = 1000
sql_query = SELECT * FROM documents WHERE id>=$start AND id<=$end
</code></pre>
<p>If the table contains document IDs from 1 to, say, 2345, then
sql_query would be run three tim... | 37,968 |
<p>I've been looking into improving SQLite performance for my site, especially with regard to transactions. In essence what I'm looking for is a way to defer database writes in a process so that they can all be done at once. However, while I'm accumulating update queries, I would like other processes to be able to both... | <p>SQLite supports <a href="http://www.sqlite.org/lang_attach.html" rel="nofollow noreferrer">ATTACH</a> to attach one database to another database. Perhaps you can accumulate your data in a separate database, and when you are ready to merge the accumulated rows, attach the separate database, copy the rows in a single... | <p>Better than to attach a database is to just create a temporary table. (CREATE TEMPORARY ...)</p>
<p>And take a look at the new WAL journal mode, which does exacly what you are trying to do manually and it allows simultanious writes and reads (not simultanious writes though).</p>
<p>#pragma journal_mode=WAL</p>
| 37,240 |
<p>Are there any tools available for calculating Cyclomatic Complexity in Javascript? </p>
<p>I've found it a very helpful metric in the past while working on server side code, and would like to be able to use it for the client side Javascript I write.</p>
| <p>I helped write a tool to perform software complexity analysis on JavaScript projects:</p>
<p><a href="https://github.com/escomplex/complexity-report" rel="noreferrer">complexity-report</a></p>
<p>It reports a bunch of different complexity metrics: lines of code, number of parameters, cyclomatic complexity, cycloma... | <p>You can use the ccm tool from <a href="https://web.archive.org/web/20150219013605/http://www.blunck.info/ccm.html" rel="nofollow noreferrer">ARCHIVE of blunck.info</a> or the github repo <a href="https://github.com/jonasblunck/ccm" rel="nofollow noreferrer">jonasblunck/ccm</a></p>
<p>It supports JavaScript, C/C++ an... | 12,592 |
<p>I can enumerate many features of functional programming, but when my friend asked me Could you define functional programming for me? I couldn't.</p>
| <p>I would say that the defining point of pure functional programming is that all computation is done in functions with <em>no</em> side effects. That is, functions take inputs and return values, but do not change any hidden state, In this paradigm, functions more closely model their mathematical cousins.</p>
<p>This ... | <p>It's like drawing a picture by using vectors instead of bitmaps - tell the painter how to change the picture instead of what the picture looks like at each step.</p>
<p>It's application of functions as opposed to changing the state.</p>
| 26,420 |
<p>I'm trying to build a headrest for my Sayl office chair. For that, I'm designing a 3d-printed part that's going to fit on one of the existing rods of the chair.</p>
<p>Check out this picture:</p>
<p><a href="https://i.stack.imgur.com/PMzGy.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/PMzGy.jpg" alt=""... | <p>In an earlier comment you stated that you cannot take it apart. So without taking it apart, you could try to determine the profile the old-fashion way with a piece of cardboard and a short pencil, just cut the rough shape of the rod and place it onto the rod, then take the short pencil and draw the profile onto the ... | <p>You could pull it apart and have it 3d scanned if you want to know the exact dimensions. There are companies that can do that for you at a certain price. Our company has used such services in scanning various parts before we obtained our own laser scanning device. </p>
<p>The question is whether you want exactly th... | 907 |
<p>I am trying to get the DataGridView to render the "insert new row" row as the first row in the grid instead of the last row. How do I go about doing that, is it even possible in the control?</p>
| <p>I don't think there is any way to move the "new row" row to the top of the data grid.</p>
<p>But, what if you left the top row empty and as the data filled in move the row down as appropriate? In other words, make your own "new row" row, which is just first row in the grid and add new blank rows above when editing... | <p>I'm assuming you mean that when you want to add a new row, you want the row to actually be inserted at the top of the table instead of the bottom of the table like default? Well if this is so, you don't have to deal with sorting or key values; simply do as such with the Insert method:</p>
<blockquote>
<p><strong>... | 33,050 |
<p>I have a server process built in Delphi/C++Builder with RemObjects SDK which claims to support SOAP requests.</p>
<p>What's the quickest and easiest way of testing out the SOAP support? I'd prefer not to have to learn a new language/install a new IDE/spend more than a day...</p>
<p>To clarify this, I'm already con... | <p>I haven't tried it with RemObjects, but if the server already supports SOAP, I can't think of an easier way to test it than to simply consume the web service using Delphi and call each of the methods. It's surprisingly straight forward.</p>
<ul>
<li>Create a new application.</li>
<li>In File|New|Other|WebServices ... | <p>Just publish your service with TROSOAPMessage, like others message formats like TROBinMessage, that it.</p>
<p>Check the RO website tutorials about the subject</p>
| 39,206 |
<p>What are my options for running Java 6 on OS X? </p>
<p>I have an MacBook Pro Intel Core Duo running Mac OS X 10.4. Do I have any options for running Java 6 on this hardware and OS?</p>
<p>Related questions: Which Macs (either current or forthcoming) support 64-bit computing? Are there any Apple laptops (either cu... | <p>Since the Core <strong>2</strong> Duo all available Intel macs are 64-bit capable. If your are an early adopter and have just like me a Core Duo-based Intel mac (note the missing 2), your computer is not 64-bit capable (see <a href="http://en.wikipedia.org/wiki/Core_duo" rel="nofollow noreferrer">http://en.wikipedia... | <p>You can. Honestly, its not that hard too either (as of now, its dead easy). Java apps usually stand out (in a bad way), I would highly consider deploying with a more native language. </p>
| 42,988 |
<p>I have an application which has to live as a service, I create an object which then spawns off a buch of threads.</p>
<p>If I set the only reference to that object to null will all the child threads get cleaned up? or will I suffer from a memory leak.</p>
<p>Do I have to explicitly terminate all the child threads?... | <p>Yes, you need to make sure your other threads stop. The garbage collector is irrelevant to this. You should also do so in an orderly fashion though - don't just abort them.</p>
<p><a href="http://pobox.com/~skeet/csharp/threads/shutdown.shtml" rel="nofollow noreferrer">Here's a pattern in C# for terminating threads... | <p>No matter the theory (or StackOverflow answers), you should also create some test to see if what you intended to do, is really happening. Maybe you have some forgotten pointer preventing garbage collection.</p>
| 31,672 |
<p>As eclipse users know, eclipse captures the output of std out and err by default and dumps it into the console that is integrated with the IDE.</p>
<p>I would like eclipse to just use a standard windows cmd instance to display std:out and std:err by default, the way most other IDE's do. Does anybody know how to se... | <p>I don't know if it's possible to redirect to a proper console window, however it <em>can</em> redirect to a file (which is more useful IMHO) - under Run/Debug settings -> Common -> Standard Input and Output (it can even write to console and file at the same time).</p>
| <p>Since you haven't said why you prefer stdout in a windows cmd window i'll make some assumptions:
- you only want to move the window around outside of Eclipse</p>
<p>In the case above you can drag the console window by the tab outside of Eclispe and you open another window you can move around like a cmd prompt.</p>
| 33,055 |
<p>Try loading <a href="http://www.zodiacwheels.com/images/wheels/blackout_thumb.jpg" rel="noreferrer">this normal .jpg file</a> in Internet Explorer 6.0. I get an error saying the picture won't load. Try it in any other browser and it works fine. What's wrong? The .jpg file is just a normal picture sitting on the web ... | <p>The JPG you uploaded is in <a href="http://en.wikipedia.org/wiki/Cmyk" rel="noreferrer">CMYK</a>, IE and Firefox versions before 3 can't read these. Open it using Photoshop (or anything similar, I'm sure GIMP would work too) and resave it in <a href="http://en.wikipedia.org/wiki/Rgb" rel="noreferrer">RGB</a>.</p>
<... | <p>It is possible for other applications to register themselves as a handler for files with a particular extension. Quicktime has (or at least had) a tendency to do this with .png files, so a .png file would display fine inline in an HTML page, but with an URL referring directly to the .png file, IE would immediately d... | 3,811 |
<p>I have a model of an eye that I custom made in <strong>Blender 2.83</strong> that when printed only creates <strong>roughness</strong> on the printed object near where I had the supports. <strong>The supports are not the cause of the roughness</strong> (at least not completely) since the supports don't even touch t... | <p>While Trish is completely right that the roughness can't be completely eliminated (you can't print a perfect spherical surface with discrete layers), the situation can be improved dramatically. The most telling photo in your question is the one of the removed support structure.</p>
<p>The part of your sphere that's ... | <p>I’ve noticed the best way to get it smooth without support is to make the printer print the inner parts of the model first. That way it gives the hanging layer something to hold on to. I turn my window ac unit up to high aim it at the printer so it cools the filament quickly. Next you’re going to want to mess around... | 1,691 |
<p>I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, <code>Iterators</code> are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods <code>hasNext()</code>, <code>next()</code> ... | <blockquote>
<p>Why is this interface used?</p>
</blockquote>
<p>Because it supports the basic operations that would allow a client programmer to iterate over any kind of collection (note: not necessarily a <code>Collection</code> in the <code>Object</code> sense).</p>
<blockquote>
<p>Why are the methods... not d... | <p>Well it seems like the first bullet point allows for multi-threaded (or single threaded if you screw up) applications to not need to lock the collection for concurrency violations. In .NET for example you cannot enumerate and modify a collection (or list or any IEnumerable) at the same time without locking or inher... | 11,533 |
<p>I have to transform a few hundred images every day in a specific way.</p>
<p>I need the best freeware tool or a piece of C# code that supports batch watermarking, resizing of images and can be automated (old configuration can be reused).</p>
<p>What tool do you suggest?</p>
| <p>Dave Winer of <a href="http://scripting.com/" rel="nofollow noreferrer">scripting.com</a> fame has been posting about his success with <a href="http://www.imagemagick.org/script/index.php" rel="nofollow noreferrer">ImageMagick</a>. I think its free. </p>
| <p>If you want to roll your own solution (and I'm guessing that's why you tagged the question with "C#") the GDI+ stuff built into the framework (System.Drawing and its children) are pretty powerful, more than enough to accomplish what you'd need. The advantage of this approach is that you can define your own transfor... | 46,861 |
<p>I'm trying to determine how I can detect when the user changes the Windows Font Size from Normal to Extra Large Fonts, the font size is selected by executing the following steps on a Windows XP machine:</p>
<ol>
<li>Right-click on the desktop and select Properties.</li>
<li>Click on the Appearance Tab.</li>
<li>Sel... | <p>[EDIT after re-read] I'm almost positive that changing to "Large fonts" does not cause a DPI change, rather it's a theme setting. You should be able to verify by applying the "Large fonts" change and then opening the advanced display properties where the DPI setting lives, it should have remained at 96dpi.</p>
<p><... | <p>I don't think the display DPI changes when the font size changes. Windows is probably just sending the <code>WM_PAINT</code> and <code>WM_NCPAINT</code> messages to all open windows, and they're redrawing themselves using the current (now large) system font.</p>
| 25,861 |
<p>Throughout the history of software development, it sometimes happens that some person (usually unknown, probably unwittingly) made what, at the time, seemed a trivial, short-term decision that changed the world of programming. What events of this nature come to mind, and what have been our industry's response to mit... | <p>Allocating only 2 digits for the year field.</p>
<p>And the mitigation was to spend huge amounts of money and time just before the fields overflowed to extend them and fix the code.</p>
| <p>Re-arranging the letters on the keyboard to slow down typing productivity, back in the original mechanical typewritter days, and carrying that over to digital computers.</p>
<p><a href="http://abckeyboard.co.uk/qwerty.htm" rel="nofollow noreferrer">The History of Qwerty</a></p>
| 49,607 |
<p>After reading a bit more about how Gnutella and other P2P networks function, I wanted to start my own peer-to-peer system. I went in thinking that I would find plenty of tutorials and language-agnostic guidelines which could be applied, however I was met with a vague simplistic overview.</p>
<p>I could only find v... | <p>I had to write a basic Gnutella client in C# using Web Services and I think the class notes on the P2P stuff are still available <a href="http://www.cs.virginia.edu/~humphrey/cs451/ClassNotes/CS451_DisSys_0327.pdf" rel="nofollow noreferrer">here</a> and <a href="http://www.cs.virginia.edu/~humphrey/cs451/ClassNotes/... | <p>You might have better success researching Bittorrent, I believe that the creator has written some papers, and it seems others are as well.</p>
<p><a href="http://bittyrant.cs.washington.edu/#papers" rel="nofollow noreferrer">BitTyrant</a>
<a href="http://bittorrent.org/" rel="nofollow noreferrer">Bittorent.org, see... | 4,360 |
<p>I have a need to use extensionless URLs. I do not have access to IIS (6.0) so I cannot map requests to ASP.NET and handle with a HttpHandler/HttpModule. However, I can set a custom 404 page via web host control panel.</p>
<p>My current plan is to perform necessary logic in the custom 404 page, but it "feels wrong... | <p>Without access to IIS, that would be your only option.</p>
| <p>The 404 page really is your only option if you can't map the requests. I've seen several blog packages that do this to enable magic URLs like .../archive/YYYY/MM/DD and such - there's no such page, so it hits the 404 page and the 404 page does the redirection.</p>
| 12,304 |
<p>Is there an algorithm or some heuristic to decide whether digital audio data is <a href="http://en.wikipedia.org/wiki/Clipping_(audio)#Digital_clipping" rel="nofollow noreferrer">clipping</a>?</p>
| <p>The simple answer is that if any sample has the maximum or minimum value (-32768 and +32767 respectively for 16 bit samples), you can consider it clipping. This isn't stricly true, since that value may actually be the correct value, but there is no way to tell whether +32767 really should have been +33000.</p>
<p>F... | <p>What Adam said. You could also add some logic to detect maximum amplitude values over a period of time and only flag those, but the essence is to determine if/when the signal hits the maximum amplitude.</p>
| 7,637 |
<p>I have a ListBox which displays items of variable height. I want to show as many items as will fit in the available space, without showing a vertical scrollbar. Other than surgery on the ListBox item template, is there a way to only show the number of items which will fit without scrolling?</p>
| <pre><code> <ListBox ScrollViewer.VerticalScrollBarVisibility="Auto" />
</code></pre>
<p>the default is visible </p>
| <p>I don't think the default is "Visible". I think it's "Auto". Jon wanted to set it to "Hidden".</p>
| 21,807 |
<p>I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it'... | <p>You don't know how slow your application is when you don't measure it. I'm using a <a href="http://haacked.com/archive/2008/07/02/httpmodule-for-timing-requests.aspx" rel="nofollow noreferrer">timing http module</a> during development to notice big performance issues fast.
When one of your pages loads slow, you sho... | <p>Assuming you are using a shared hosting environment, it's probably not your app. I've seen perfectly fine code grind to a halt on a shared host. The only solution I know for shared hosting problems is some kind of managed app host, getting a virtual private server (managed or not), or a dedicated server box. This ty... | 43,441 |
<p>I want to limit the number of words a person can enter in a text field. How can I track the number of words (by using a second field) in that field as each word is entered?</p>
| <p>use this js (using jquery):</p>
<pre><code>$('#newKeywords').bind('change', function() {
$('#wordsLong').text($('#newKeywords').val().split(' ').length + 1);
});
</code></pre>
<p>and this html:</p>
<pre><code><textarea id="newKeywords"></textarea>
<div>The text consists of <span id="word... | <p>From <a href="http://www.mediacollege.com" rel="nofollow noreferrer">Media College</a> :</p>
<p><a href="http://www.mediacollege.com/internet/javascript/form/limit-characters.html" rel="nofollow noreferrer">Limit the Number of Characters in a Textarea or Text Field in javaScript </a></p>
| 25,060 |
<p>What is the exact use of an Abstract class? Is not possible to do the same things in an ordinary class as it is an an abstract class? </p>
| <p>Use an abstract class to provide some concrete implementation but not allow instantiation. You can always instantiate an ordinary class which doesn't make sense if it can't stand alone. At the same time, an interface might not be enough if there's a concrete implementation that's identical in all implementing classe... | <p>Unlike regular classes, <code>abstract</code> classes can contain <code>abstract</code> methods. They act much like interface members.</p>
<p>Meanwhile, they can do just about everything else that regular classes can do: they can implement methods, contain fields & nested types, derive from another class, etc.... | 29,583 |
<p>I've been developing a winforms app tied to sql server. I haven't rebooted in a while. Today i rebooted and now I can't log into sql. I used every account I know and their passwords including one that was working just before i rebooted and i get a 'Login failed' . I did take the database I use offline just before st... | <p>:-/ That's a rough place to be ... I wish you luck. Check out this blog post, not sure if you're using sql 2k5 or not, but if so, it may be helpful:</p>
<p><a href="http://blogs.msdn.com/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx" rel="nofoll... | <p>Have you checked to make sure that the service is actually running? Also are you trying to connect using IPC, TCPIP or named pipes? Whichever way make sure it's enabled in the configuration tools.</p>
<p>Since admin's on the box are SQL admins the only thing I can think of is that the service is not running.</p>
| 47,774 |
<p>I have an STL file from thingiverse. The model is of a rectangular lid with an engraving. I would like to print it using two different colors, so that the engraving would be in a different color than the lid base. In the model description, the creator explained that he simply switched the material mid printing.</p>
... | <p>You can also preview the gcode rendering layer by layer (if your software allows this), and insert a toolchange command at the layer where you want to switch colors.</p>
| <p>With OpenScad i would take the stl, and cut half of it off, but subtracting a block. That result I would save to a.stl. Then i would move the block to the other side of the model and subtract that piece off. The result i would save as b.stl.</p>
<p>My slicer is RepG. It has an option for merging two stl files... | 635 |
<p>I have a program that uses save files. It needs to load the newest save file, but fall back on the next newest if that one is unavailable or corrupted. Can I use the windows file creation timestamp to tell the order of when they were created, or is this unreliable? I am asking because the "changed" timestamps seem u... | <p>If you have a directory full of arbitrary and randomly named files and 'time' is the only factor, it may be more pointful to establish a filename that matches the timestamp to eliminate need for using tools to view it. </p>
<pre><code>2008_12_31_24_60_60_1000
</code></pre>
<p>Would be my recommendation for a fla... | <p>try usining this when you want to rename the file </p>
<pre><code>Path.Combine(ArchivedPath, currentDate + " " + fileInfo.Name))
</code></pre>
| 32,158 |
<p>So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause:</p>
<pre><code>CREATE PROCEDURE getSomething @keyList varchar(4096)
AS
SELECT * FROM mytbl WHERE name IN (@keyList)
</code></pre>
<p>How do I call my stored proc with more than... | <p>If you're using Sybase 12.5 or earlier then you can't use functions. A workaround might be to populate a temporary table with the values and read them from there.</p>
| <p>Do you need to use a comma separated list? The last couple of years, I've been taking this type of idea and passing in an XML file. The openxml "function" takes a string and makes it like xml and then if you create a temp table with the data, it is queryable.</p>
<pre><code>DECLARE @idoc int
DECLARE @doc varchar(10... | 2,810 |
<p>Are there any VC++ settings I should know about to generate better PDB files that contain more information? </p>
<p>I have a crash dump analysis system in place based on the project <a href="http://code.google.com/p/crashrpt/" rel="nofollow noreferrer">crashrpt</a>.</p>
<p>Also, my production build server has the ... | <blockquote>
<p>"Are there any VC++ settings I should know about"</p>
</blockquote>
<p>Make sure you turn off Frame pointer ommision. Larry osterman's blog has <a href="http://blogs.msdn.com/larryosterman/archive/2007/03/12/fpo.aspx" rel="noreferrer">the historical details</a> about fpo and the issues it causes wit... | <p>In case anyone is interested, a co-worker replied to this question to me via email:</p>
<p>Artem wrote: </p>
<blockquote>
<p>There is a flag to MiniDumpWriteDump()
that can do better crash dumps that
will allow seeing full program state,
with all global variables, etc. As for
call stacks, I doubt they ca... | 5,681 |
<p>By HTTP Streaming Comet, I mean the "forever iframe" / "forever xhr" variations that don't close the connection after data has been pushed from the server, as opposed to standard polling and long polling which close and resend a new request for every server push event.</p>
<p>I looked at the dojo.io.cometd package ... | <p>According to Wikipedia, HTTP Streaming comet is supposed to be possible in every browser. "Page Layout with Frames that Aren't", Ajax: The Definitive Guide. O'Reilly Media, pp. 320. ISBN 0596528388, is the reference that is quoted for this information, so maybe this book has a suggestion on how to do this.</p>
<p>... | <p>Although this is a old post, I did do some search and find the following articles really helpfull
<a href="http://www.shanison.com/2010/05/10/stop-the-browser-%E2%80%9Cthrobber-of-doom%E2%80%9D-while-loading-comet-forever-iframe/" rel="nofollow noreferrer">http://www.shanison.com/2010/05/10/stop-the-browser-%E2%80%9... | 20,429 |
<p>I want to show a table of fixed width at the center of browser window. Now I use</p>
<pre><code><table width="200" align="center">
</code></pre>
<p>But Visual Studio 2008 gives warning on this line:</p>
<p><em>Attribute 'align' is considered outdated. A newer construct is recommended.</em></p>
<p>What CSS... | <p>Steven is right, in <a href="http://theodorakis.net/tablecentertest.html" rel="noreferrer">theory</a>:</p>
<blockquote>
<p>the “correct” way to center a table using CSS. Conforming browsers ought to center tables if the left and right margins are equal. The simplest way to accomplish this is to set the left and r... | <pre><code>style="text-align:center;"
</code></pre>
<p>(i think)</p>
<p>or you could just ignore it, it still works</p>
| 38,618 |
<p>What is the point of an action returning ActionResult?</p>
| <p>Returning an ActionResult instead of "just doing whatever the ActionResult is doing" (i.e. using Response.Redirect directly or trying to render out a View through the Response OutputStream directly) gives you one really nice advantage: Unit Testing is really easy on that, especially since you normally do not need a ... | <p>ActionResult is the base class for many different types of controller results. By returning the base class, the controller action can return different types of results depending on the outcome of the method -- a ViewResult, a RedirectToActionResult, etc. ActionResult contains all of the data needed by the View or ... | 36,817 |
<p>What is the command to list all triggers in a MySQL database?</p>
| <p>The command for listing all triggers is:</p>
<pre><code>show triggers;
</code></pre>
<p>or you can access the <code>INFORMATION_SCHEMA</code> table directly by:</p>
<pre><code>select trigger_schema, trigger_name, action_statement
from information_schema.triggers
</code></pre>
<ul>
<li>You can do this from versio... | <p>This sentence could contribute to solving the problem:</p>
<pre><code>select LOWER(concat('delimiter |', '\n', 'create trigger %data_base_name%.', TRIGGER_NAME, '\n',
' ', ACTION_TIMING, ' ', EVENT_MANIPULATION, ' on %data_base_name%.', EVENT_OBJECT_TABLE, ' for each row', '\n',
ACTION_STATEMENT, '\n',
'|')) AS ... | 6,957 |
<p>I am using C# 3.0 / .NET 3.5 and planning to build an eCommerce website.</p>
<p>I've seen NHibernate, LLBLGEN, Genome, Linq to SQL, Entity Framework, SubSonic, etc.</p>
<p>I don't want to code everything by hand. If there is some specific bottleneck I'll manage to optimize the database/code.</p>
<p>Which ORM woul... | <p>I've been using nHibernate which is a very good free solution. The one downside is the lack of documentation, which causes a slightly steep rampup time. But once you get the basics down it really speeds up development.</p>
<p>I like Fluent nHibernate for a way to configure without the xml files. The one thing I sug... | <p>I started out using Linq to SQL as the whole linq integration is awesome, but if you want to do Model First rather than Schema First and you want to have a rich domain model then nHibernate\Fluent nHibernate is really the way to go. We switched to this and is far simpler, better supported than l2s. However for stra... | 41,189 |
<p>can anyone explain in the simplest terms please what is the difference between a point cloud and a voxel mesh?</p>
| <p>A point cloud is often derived by sampling. Each point represents an observation. Sometimes, a point cloud is turned into a surface by fitting triangles to the points in the form of an STL file.</p>
<p>A raster is a 2D grid of pixels. It divides the area of an image into constant-sized little squares. Each of t... | <p>I believe a point cloud is just a collection of points, while voxels - "3D pixels" - define location and a cube area. They seem to be pretty equivalent mathematically.</p>
| 678 |
<p>I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is:</p>
<pre><code>�
</code></pre>
<p>However, when using something like Javascript's String.fromCharCode, 199 is:</p>
<pre><code>Ç
</code></pre>
<p>The s... | <p><b>Edited to reflect comments</b></p>
<p><code>Chr(199)</code> returns a 2-byte character, which is being interpreted as 2 separate characters.</p>
<ul>
<li>use <code>ChrW(199)</code> to return a <code>Unicode</code> string.</li>
<li>use <code>ChrB(199)</code> to return it as a single-byte character</li>
</ul>
| <p>Encoding is the problem. Javascript may be interpreting as latin-1; VBScript may be using a different encoding and getting confused.</p>
| 40,758 |
<p>I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. </p>
| <p>Looks like the numbers are in milliseconds. So to convert to seconds, divide by 1000, then divide by 60 to find minutes etc.</p>
| <p>I'm not sure if I completely understand this, but:</p>
<pre><code> 70966 / 70 seconds = 1013.8
</code></pre>
<p>So dividing the "value" by 1013.8 should get the duration, approximately...</p>
<p>Edit: Yes, Ben is right, you should divide by 1000. I got 1013.8 because the 70 seconds was rounded down from 70.966 se... | 5,818 |
<p>I'm needing to access Excel workbooks from .Net. I know all about the different ways of doing it (I've written them up in a <a href="http://blog.functionalfun.net/2008/06/reading-and-writing-excel-files-with.html" rel="noreferrer" title="Reading and Writing Excel files in .Net">blog post</a>), and I know that using ... | <p>I haven't done any proper benchmarks, but I tried out several other components,and found that <a href="http://spreadsheetgear.com/" rel="nofollow noreferrer">SpreadsheetGear</a> was considerably faster than XlsIO which I was using before. I've written up some of my findings in this <a href="http://blog.functionalfun... | <p>Yes but I'm not going to publish them both out of a courtesy to Syncfusion (they ask you not to publish benchmarks), because I'm not an experienced tester so my tests are probably somewhat flawed but mostly because what you actually benchmark makes a huge difference to who wins and by how much. </p>
<p>I took one o... | 3,528 |
<p>Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?</p>
<p>Edit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their 'add' page. I want to be able to... | <p>The code will look something like this: </p>
<pre><code>WebRequest req = WebRequest.Create("http://mysite/myform.aspx");
string postData = "item1=11111&item2=22222&Item3=33333";
byte[] send = Encoding.Default.GetBytes(postData);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
r... | <p>I had a situation where I needed to post free text from a html textarea programmatically and I had issues where I was getting <code><br /></code> in my param list i was building.</p>
<p>My solution was a replace of the br tags with linebreak characters and htmlencoding just to be safe.</p>
<pre><code>Regex.R... | 4,650 |
<p>I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by removing a column or changing its type, for example.</p>
... | <pre><code>SELECT *
FROM ALL_OBJECTS
WHERE OBJECT_NAME = trigger_name
AND OBJECT_TYPE = 'TRIGGER'
AND STATUS <> 'VALID'
</code></pre>
| <p>Have a look at SYS.OBJ$, specifically the STATUS column. </p>
| 14,702 |
<p>Is it possible to do Aspect Oriented Programming in Delphi? I would be interested in native support as well as third party solutions.</p>
<p>I don't have a specific problem I want to solve with AOP, but am simply interested in studying AOP.</p>
| <p>AOP depends on two things:</p>
<ul>
<li>The ability to inject additional code into an existing unit of code</li>
<li>A mechanism to place conditions on where code should be injected.</li>
</ul>
<p>This is commonly referred to as code weaving. It is a specialization within the larger study of program transformation... | <p>ClassHelpers in the later versions of Delphi allow some very limited level of AOP type behavior. You can use ClassHelpers to inject behavior into other classes without descending from them. It allows overriding existing methods and then optionally calling that existing method. </p>
<p>The limitation is you must ... | 24,060 |
<p>Normally it's easy to see unused variables in Netbeans, just a grey squiggly line. </p>
<p>But how would I find all of these unused variables in my project or of a single class?</p>
<p><strong><em>Reason:</em></strong> I'm debugging a code base which had lots of copy and paste, but it wasn't done carefully. There... | <p>You could run something like FindBugs on it.</p>
<p><a href="http://findbugs.sourceforge.net/" rel="noreferrer">FindBugs</a></p>
<p>Looking at the bug list it has </p>
<p>UuF: Unused field (UUF_UNUSED_FIELD)
This field is never used. Consider removing it from the class.</p>
<p>You could filter on just this, but... | <p>In Eclipse, that gray squiggly line is a yellow squiggly line called a Warning. Then the warning is propagated up to the package level, and up to the project level (such that your project is almost <strong>always</strong> underlined in yellow with a warning icon). Anyway it really helps you see which source files ... | 46,460 |
<p>I'm using ADO.NET EF in an MVC application. I'm considering putting the ObjectContext inside HttpContext.Current so that all logic in the same request can access to it without having to open/destroy each time. However, I'm really sure if it's a good way to manage ObjectContext instances. I have 2 questions regard... | <p>Use the <a href="http://www.asp.net/learn/mvc/tutorial-10-cs.aspx" rel="noreferrer">Repository pattern</a>. Override Controller.Dispose to dispose the Repository, which, in turn, disposes the DataContext.</p>
| <p>Thanks for the IoC suggestion. I used Unity and implemented a per-request lifetime manager to store/retrieved objects via HttpContext.Current. Seems to work fine.</p>
| 48,415 |
<p>The webservice on MSDN is now all about the Windows Communication Foundation. Is there any site out there that deal with WebService only? (.Net)</p>
| <p>I did find this section for web services under <a href="http://msdn.microsoft.com/en-us/library/ms950421.aspx" rel="nofollow noreferrer">MSDN</a>.</p>
| <p>Check out <a href="http://www.xml.com/" rel="nofollow noreferrer">http://www.xml.com/</a></p>
| 32,607 |
<p>I recently began to use the <a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=ASP.NET%20QA" rel="nofollow noreferrer">NexusLight</a>, a functional test automation framework.
Are there more frameworks that does a similar job?</p>
<p>Related question: <a href="https://stackoverflow.com/questions/91703/end... | <p>I haven't really looked into NexusLight but I think <a href="http://www.incisif.net/" rel="nofollow noreferrer">InCisif.net</a> is supposed to provide a functional test framework as well. You could look into it.</p>
| <p>Found this one too:</p>
<p><a href="http://www.automatedqa.com/products/testcomplete/index.asp" rel="nofollow noreferrer">http://www.automatedqa.com/products/testcomplete/index.asp</a></p>
<p>Unfortunately it's not free.</p>
| 30,907 |
<p>For our site, Im using a lot of jQuery - right now Im looking at 340 lines of jQuery code on top of the base library. How much is too much? I will be adding more, when do I start trying to condense the code and eventually move to OOP?</p>
| <p>The number of lines doesn't mean anything - what matters is what you're actually doing. You could have 10 lines of supremely inefficient code that would do much more damage than a meticulously crafted 1000 lines of code.</p>
| <p>I wouldn't concern yourself with the length of your JavaScript. You have multiple options available to you like using <a href="http://dean.edwards.name/packer/" rel="nofollow noreferrer">Packer</a> to compress your JavaScript for release (you'll want to practice with it some since it does have a few rules for how it... | 49,186 |
<p>I'm struggling to find the right terminology here, but if you have jQuery object...</p>
<pre><code>$('#MyObject')
</code></pre>
<p>...is it possible to extract the base element? Meaning, the equivalent of this:</p>
<pre><code>document.getElementById('MyObject')
</code></pre>
| <p>Yes, use <code>.get(index)</code>. According to the <a href="https://api.jquery.com/get/#get1" rel="nofollow noreferrer">documentation</a>:</p>
<blockquote>
<p>The <code>.get()</code> method grants access to the DOM nodes underlying each jQuery object.</p>
</blockquote>
| <p>A jQuery object is a set of elements. In your case, a set of one element. This differs from certain other libraries, which wrap single elements and provide alternate syntax for selectors that return multiple matches. </p>
<p><em><a href="https://stackoverflow.com/questions/47837/getting-the-base-element-from-a-jque... | 7,011 |
<p>I would like to be able to emulate the functionality of the "Presenter Tools" in MS Office. This requires the program to be able to detect and use an external/secondary monitor/projector.</p>
<p>Could somebody please point me in the right direction for achieving this.</p>
<p>I would like to use Java 1.5</p>
<p>T... | <p>Through the <a href="http://java.sun.com/javase/6/docs/api/java/awt/GraphicsEnvironment.html" rel="nofollow noreferrer">GraphicsEnvironment</a> class you can get information about the available screens on the computer. In the docs for <a href="http://java.sun.com/javase/6/docs/api/java/awt/GraphicsDevice.html" rel=... | <p>I don't know, as I have only one screen... But I know the <a href="http://code.google.com/p/mostpixelsever/" rel="nofollow noreferrer" title="Most Pixels Ever">Most Pixels Ever</a> library: it is a Java library for <a href="http://processing.org/" rel="nofollow noreferrer" title="Cover">Processing</a>, but I suppose... | 30,677 |
<p>I am working on an application that involves some gis stuff. There would be some .shp files to be read and plotted onto an opengl screen. The current opengl screen is using the orthographic projection as set from <code>glOrtho()</code> and is already displaying a map using coordinates from a simple text file..</p>
... | <ol>
<li><p>Shapefile rendering is quite straight forward in OpenGL. You may require "shapelib",a free shapefile parsing library in C(Google it). Use GL_POINTS for point shapefile,
GL_LINES for line shapefile and GL_LINE_LOOP for polygon shapefile. Set your bounding box coords to the Ortho.</p></li>
<li><p>What you rea... | <p>GDAL/OGR has everything you need to load a vector file, then convert any coordinates. I understand your frustration with GDAL as the documentation is not the greatest. If you want a good intro to using the API, look at gdalinfo.c and ogrinfo.cpp in the GDAL subversion tree. Source can be seen at <a href="https://s... | 44,187 |
<p>I'm working on a product feature that will allow the user to export data from a SQL CE database on one copy of my application and re-import it into SQL CE on the other end. This data is not whole tables, but the result of queries.</p>
<p>I had hoped to take advantage of .net's built-in XML-based serialization like ... | <p>Assuming cmd is your SqlCeCommand....</p>
<pre><code>using(var dr = cmd.ExecuteReader())
{
DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add();
dt.Load(dr);
ds.WriteXML(...);
}
</code></pre>
| <p>I would think you could retrieve the data to a DataSet, call WriteXML on it, and then on the other end declare a new DataSet and call ReadXML on it.</p>
| 10,120 |
<p>In certain unknown situations selenium does not detect that a page has loaded when using the open method. I am using the Java API. For example (This code will not produce this error. I don't know of an externally visible page that will.):</p>
<pre><code>Selenium browser = new DefaultSelenium("localhost", 4444, "*fi... | <p>I faced this problem quite recently.</p>
<p>All JS-based solutions didn't quite fit ICEFaces 2.x + Selenium 2.x/Webdriver combination I have.</p>
<p>What I did and what worked for me is the following:</p>
<p>In the corner of the screen, there's connection activity indicator.</p>
<pre><code> <ice:ou... | <p>Enabling the 'multiWindow' feature solved the issue, though I am not clear why.</p>
<p>SeleniumServer(int port, boolean slowResources, boolean multiWindow)</p>
<pre><code>SeleniumServer server = new SeleniumServer(4444, false, true);
</code></pre>
<p>Any clarification would be helpful.</p>
| 11,386 |
<p>How to create instance of AxHost abstract class</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/sf985hc5(VS.71).aspx" rel="nofollow noreferrer">You cannot create an instance of an abstract class.</a></p>
<p><em>You typically do not use the AxHost class directly. You can use the Windows Forms ActiveX Control Importer (Aximp.exe) to generate the wrappers that ext... | <p><a href="http://www.codeproject.com/KB/dotnet/AxForms.aspx" rel="nofollow noreferrer">Dynamically adding ActiveX controls in managed code</a> -- related, perhaps, along with <a href="http://forums.devx.com/showthread.php?t=56748" rel="nofollow noreferrer">How to Create instance of a class defined in .Net Class Libra... | 26,902 |
<p>Can source code examples be kept in a SQL database <strong>while retaining all formatting</strong> (tabs, newlines, etc.)? If so what data type would be used?</p>
| <p>Yes, use a <code>TEXT</code> type (or <code>MEDIUMTEXT</code> or <code>LONGTEXT</code> - you get the idea)</p>
| <p>You can upload this into a blob data type. SQL 2008 comes with the capability of storing the entire executable file in the database.</p>
| 31,150 |
<p>I am trying to write a simple AI for a "Get four" game.
The basic game principles are done, so I can throw in coins of different color, and they stack on each other and fill a 2D Array and so on and so forth.
until now this is what the method looks like:</p>
<pre><code>public int insert(int x, int color) //0 = emp... | <p>I'm guessing that this is a homework assignment, and that you mean you want to write the evaluation function and don't know what tricks to use?</p>
<p>The game is called "Connect 4" in English, so you can google for
"connect 4 evaluation function".</p>
<p>You can find enough people discussion heuristics.</p>
<p>P... | <p>bollocks. search space is huge. you need to use a predefined table if you want to do that.</p>
| 46,210 |
<p>I wondered if anyone uses virtualized desktop PCs (running WinXP Pro or older) to have some old applications that are seldom used available for some ongoing tasks.</p>
<p>Say you have a really old project that every once in a while needs a document update in a database system or something like that. The database ap... | <p>I use virtualized desktops for:</p>
<ul>
<li>Support that requires VPN software I do not want on my own desktop. This also lets a whole team share the support computer for a specific customer. </li>
<li>A legacy system which we use several different versions of (depending on customer's version) and they're not real... | <p>We use virtualisation to test on a variety of Operating Systems - the server application runs under linux, and we have a production (real) server, and a couple of test servers, which are all VMs.</p>
<p>The client runs under Windows, which, being an OS X user I have to run in a VM, and the other developer I work wi... | 4,000 |
<p>I'm using a <code>java.util.concurrent.ExecutorService</code> that I obtained by calling <code>Executors.newSingleThreadExecutor()</code>. This <code>ExecutorService</code> can sometimes stop processing tasks, even though it has not been shutdown and continues to accept new tasks without throwing exceptions. Eventua... | <p>It sounds like you have two different issues:</p>
<p>1) You're over-feeding the work queue. You can't just keep stuffing new tasks into the queue, with no regard for the consumption rate of the task executors. You need to figure out some logic for knowing when you to block new additions to the work queue.</p>
<p>2... | <p>Although you don't leave enough detail to be sure, the first thing I'd try is to have your tasks catch "Exception" at the top level and log the message.</p>
<p>I know it doesn't seem right, but occasionally (depending on a lot of variables) I've worked on code where stuff happening in a thread throws an exception a... | 44,854 |
<p>I'm looking for a filament that is strong, doesn't crack and doesn't break easily and is impact resistant. I'm currently using PLA and it's strong, but, I'm looking for something that doesn't snap or break when dropped.</p>
| <p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
| <p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
| 1,731 |
<p>Similar to <a href="https://stackoverflow.com/questions/233030/worst-php-practice-found-in-your-experience">this question</a>...</p>
<p>What are the worst practices you actually found in Java code?</p>
<p>Mine are:</p>
<ul>
<li>using instance variables in servlets (it's not just bad practice but bug, actually)</l... | <p>I had to maintain java code, where most of the Exception handling was like:</p>
<pre><code>catch( Exception e ) {}
</code></pre>
| <p>A mistake made by junior programmers: unnecessarily using member variables instead of local variables.</p>
<p>A Java EE example:</p>
<p>Starting threads in servlets or EJBs (for example to start asynchronous processing tasks).</p>
<p>This breaks the scalability of your Java EE app. You're not supposed to mess wit... | 29,458 |
<p>How do I extract a tar (or tar.gz, or tar.bz2) file in Java?</p>
| <p><em>Note:</em> This functionality was later published through a separate project, Apache Commons Compress, as <a href="https://stackoverflow.com/a/7556307/3474">described in another answer.</a> This answer is out of date.</p>
<hr>
<p>I haven't used a tar API directly, but tar and bzip2 are implemented in Ant; you ... | <p>What about using this <a href="http://www.trustice.com/java/tar/" rel="nofollow noreferrer">API</a> for tar files, this <a href="http://www.kohsuke.org/bzip2/" rel="nofollow noreferrer">other one</a> included inside Ant for BZIP2 and the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/GZIPInputStream.... | 40,746 |
<p>When the policy for a disk in Windows XP and Vista is set to enable write caching on the hard disk, is there a way to flush a file that has just been written, and ensure that it has been committed to disk?</p>
<p>I want to do this programmatically in C++.</p>
<p>Closing the file does perform a flush at the applica... | <p>You haven't specified the development environment, so:</p>
<h1>.Net</h1>
<p>IO streams have a <code>.Flush</code> method that does what you want.</p>
<h1>Win32 API</h1>
<p>There is the <code>FlushFileBuffers</code> call, which takes a file handle as argument.</p>
<p>EDIT (based on a comment from the OA): FlushF... | <p>See here: <a href="https://jeffpar.github.io/kbarchive/kb/066/Q66052/" rel="nofollow noreferrer">https://jeffpar.github.io/kbarchive/kb/066/Q66052/</a></p>
<p>When you initially open your file using fopen, include the "c" mode option as the LAST OPTION:</p>
<pre><code>fopen( path, "wc") // w - write mode, c - allo... | 20,910 |
<p>I have these two pieces of code, wich one is more readable?</p>
<ol>
<li><p>foreach</p>
<pre><code>decimal technicalPremium = 0;
foreach (Risk risk in risks)
{
technicalPremium = technicalPremium + risk.TechnicalPremium;
}
return technicalPremium;
</code></pre></li>
<li><p>linq</p>
<pre><code>return risks.Su... | <p>If the team that works on the code knows what the Linq version does and knows its inner workings, then it is more readable.</p>
| <p>I think the second option is better in that it should be more efficient. It is, however, less obvious what is happening (at least to me).</p>
| 24,535 |
<p>I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?</p>
| <p>If you want to load an assembly into your PowerShell session, you can use reflection and load the assembly.</p>
<pre><code>[void][System.Reflection.Assembly]::LoadFrom(PathToYourAssembly)
</code></pre>
<p>After you load your assembly, you can call static methods and create new instances of a class. </p>
<p>A goo... | <p>you can use <code>[]</code> or use <code>add-type -AssemblyName "System.example"</code> to use assembly for example use :</p>
<pre><code>[system.drawing]::class ...
</code></pre>
| 4,571 |
<p>I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.</p>
| <p><strong>Update:</strong> Microsoft now provide virtual machine images for various versions of IE that are ready to use on all of the major OS X virtualisation platforms (<a href="https://www.virtualbox.org" rel="nofollow noreferrer">VirtualBox</a>, <a href="http://www.vmware.com/products/fusion/overview.html" rel="n... | <p>If this is a business web site (or a serious site where it is important that it actually works on IE), then don't take the cheap route - invest in a Windows machine or two. Your customers will thank you.</p>
<p>Otherwise, virtualize.</p>
| 7,939 |
<p>Extreme Programming, Scrum and Test Driven Development definitely seem to be the most popular Agile methods at the moment. But someone recently suggested that I take a look at Feature Driven Development.</p>
<p>Have you ever used this method with any success? What are the advantages of using it?</p>
| <p>FDD is what I like to think of as a wrapper methodology, in that it allows you to apply a method to manage projects at a very high level, but it still allows you to use other methodologies at a lower level. </p>
<p>FDD's focus is on being able to set estimates and schedules and to report on the status of a project... | <p>FDD is an older methodology. It has lot's of the ideas of other agile methodologies and misses some of them. Like Scrum it's a bit management-focussed and I think you need some elements from XP for practical implementations.</p>
<p>FDD is certainly interesting to look into. But just like Scrum and XP I think you ha... | 6,176 |
<p>What's the best way to implement friendly URL in ASP.net?</p>
| <p>The <a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" rel="nofollow noreferrer">ASP.NET Routing Framework</a> provided in .NET 3.5 SP1 is a good one.</p>
<p>Although it is very new, it can handles many URL-related tasks and most frequently used URL-friendly sc... | <p>The <em>best</em> way to do this is to look into the new MVC toolkit from microsoft (<a href="http://www.asp.net/mvc/" rel="nofollow noreferrer">http://www.asp.net/mvc/</a>)</p>
<p>See <a href="http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx" rel="nofollow noreferrer">http://webl... | 35,240 |
<p><code>mysql_real_escape_string</code> and <code>addslashes</code> are both used to escape data before the database query, so what's the difference? (This question is not about parametrized queries/PDO/mysqli)</p>
| <blockquote><p><code>string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] )</code><br />
<code>mysql_real_escape_string()</code> calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.</p></bloc... | <p>It seems that <code>mysql_real_escape_string</code> is binary-safe - the documentation states:</p>
<blockquote>
<p>If binary data is to be inserted, this function must be used. </p>
</blockquote>
<p>I think it's probably safer to always use <code>mysql_real_escape_string</code> than addslashes.</p>
| 11,659 |
<p>I am hoping someone can help me with this. What I have been looking around for but can't seem to find is if there is someway to add an event, or anything else that will allow a visual studio plug-in to watch for an external reference to be added to a currently open solution / project? </p>
<p>Or even better yet wou... | <p>Not exactly what you asked, but I've written a Visual Studio 2008 Integration Package, and if I recall correctly I could override the "add reference" method, as well as inherit the "reference node" and thus change its behavior, for example its constructor.</p>
<p>This functionality might be missing from an add-in (... | <p>I have written a macro that will change a file reference to a project reference if you add the project to the solution (and vice versa), but I don't think that's what you want?</p>
| 21,187 |
<p>How can I <em>programmatically</em> determine if I have access to a server (TCP) with a given IP address and port using C#?</p>
| <p>Assuming you mean through a TCP socket:</p>
<pre><code>IPAddress IP;
if(IPAddress.TryParse("127.0.0.1",out IP)){
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
try{
s.Connect(IPs[0], port);
}
catch(Exception ex){
// something went ... | <p>This should do it </p>
<pre><code>bool ssl;
ssl = false;
int maxWaitMillisec;
maxWaitMillisec = 20000;
int port = 555;
success = socket.Connect("Your ip address",port,ssl,maxWaitMillisec);
if (success != true) {
MessageBox.Show(socket.LastErrorText);
return;
}
</code></pre>
| 16,531 |
<p>Basically we need a custom diagram component in our new WPF based application.<br>
<strong>Needs</strong> to show text/lines, linked 2D Nodes and custom images apart from the other diagramming features like Undo/Redo, Align, Group, etc.. ala Visio.</p>
<p>The initial team did a bit of investigation and settled on t... | <p>My colleague has been using <a href="http://www.mindfusion.org/wpfdiagram.html" rel="nofollow noreferrer">WpfDiagram</a> from MindFusion for the last two weeks and says that it's an excellent product.</p>
| <p>Just remember DO NOT choose Syncfusion. </p>
<p>I've been suffering from it when developing WPF Application. There are so many bugs in it.</p>
| 6,523 |
<p>I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to the new folder, but it seems that if I continued with that practice... | <p>I'd use the find command.</p>
<pre><code>find . -lname /particular/folder
</code></pre>
<p>That will recursively search the current directory for symlinks to <code>/particular/folder</code>. Note that it will only find absolute symlinks. A similar command can be used to search for all symlinks pointing at objects ... | <p>To any programmers looking here (cmdline tool questions probably should instead go to unix.stackexchange.com nowadays):</p>
<p>You should know that the Linux/BSD function <code>fts_open()</code> gives you an easy-to-use iterator for traversing all sub directory contents while also detecting such symlink recursions.<... | 12,536 |
<p>What is the story behind XPath and support for namespaces? Did XPath as a specification precede namespaces? If I have a document where elements have been given a default namespace: </p>
<pre><code><foo xmlns="uri" />
</code></pre>
<p>It appears as though some of the XPath processor libraries won't recognize... | <p>You need local-name():</p>
<p><a href="http://www.w3.org/TR/xpath#function-local-name" rel="nofollow noreferrer">http://www.w3.org/TR/xpath#function-local-name</a></p>
<p>To crib from <a href="http://web.archive.org/web/20100810142303/http://jcooney.net:80/archive/2005/08/09/6517.aspx" rel="nofollow noreferrer">http... | <p>If you are trying to use xslt you can add the namespace in to the stylesheet declaration. If you do that, you must make sure that there is a prefix or it will not work. If the source XML does not have a prefix, that is still fine, you add your own prefix in the stylesheet. </p>
<p><em>Stylesheet</em></p>
<pre><... | 3,251 |
<p>I'm currently using the following code to right-trim all the <code>std::strings</code> in my programs:</p>
<pre><code>std::string s;
s.erase(s.find_last_not_of(" \n\r\t")+1);
</code></pre>
<p>It works fine, but I wonder if there are some end-cases where it might fail?</p>
<p>Of course, answers with elegant altern... | <p><strong>EDIT</strong> Since c++17, some parts of the standard library were removed. Fortunately, starting with c++11, we have lambdas which are a superior solution.</p>
<pre><code>#include <algorithm>
#include <cctype>
#include <locale>
// trim from start (in place)
static inline void ltrim(std::... | <p>It seems I'm really late to the party - I can't believe this was asked 7 years ago! </p>
<p>Here's my take on the problem. I'm working on a project and I didn't want to go through the trouble of using Boost right now. </p>
<pre><code>std::string trim(std::string str) {
if(str.length() == 0) return str;
in... | 26,656 |
<p>I have an xsd like this </p>
<pre><code><xsd:complexType name="A">
<xsd:complexContent>
<xsd:sequence>
<xsd:element name="options">
<xsd:complexType>
<xsd:sequence>
... | <p>Here's the schema I came up with:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<xs:schema id="inheritance"
targetNamespace="http://test.com"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://test.com"
>
<xs:element name="Time">
... | <p>You'll need to create a type for options, which contains hours etc, and then add options instead of hours in csgero's answer.</p>
| 25,092 |
<p>I am looking for an elegant solution for removing content from an ASP.Net page if no data has been set. Let me explain this a little more.</p>
<p>I have some blocks of data on a page that contain some sub-sections with individual values in them. If no data has been set for one of the values I need to hide it (so it... | <p>it may be possible to avoid recursive traversal if you can write functions to return true/false for each group, e.g.</p>
<pre><code><Panel id="block" runat="server" visible="<%=IsBlockVisible%>">
<Panel id="sub1" runat="server" visible="<%=IsSubVisible(1)%>">
<Panel id="value1... | <p>Use recursion. Traverse the control tree in node first order. Use the visible property of the node as appropriate based on control values. Don't visit children if the parent is set to not visible</p>
| 33,801 |
<p>As made clear in update 3 on <a href="https://stackoverflow.com/questions/367440/javascript-associative-array-without-tostring-etc#367454">this answer</a>, this notation:</p>
<pre><code>var hash = {};
hash[X]
</code></pre>
<p>does not actually hash the object <code>X</code>; it actually just converts <code>X</code> ... | <p>Hash your objects yourself manually, and use the resulting strings as keys for a regular JavaScript dictionary. After all, you are in the best position to know what makes your objects unique. That's what I do.</p>
<p>Example:</p>
<pre><code>var key = function(obj){
// Some unique object-dependent key
return obj.... | <p>Yet another map implementation by me. With randomizer, 'generics' and 'iterator' =)</p>
<pre><code>var HashMap = function (TKey, TValue) {
var db = [];
var keyType, valueType;
(function () {
keyType = TKey;
valueType = TValue;
})();
var getIndexOfKey = function (key) {
... | 48,077 |
<p>When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? </p>
<p>Here's what I am working with:</p>
<p>I have a C object that has a destructor method that is more complex that <code>free()</code>... | <p>There are a couple of strategies for reclaiming native resources (objects, file descriptors, etc.)</p>
<ol>
<li><p>Invoke a JNI method during finalize() which frees the resource. Some people <a href="https://stackoverflow.com/questions/158174/why-would-you-ever-implement-finalize">recommend against implementing fin... | <p>The GC would collect your instance, but it will not automatically release the non-java heap memory allocated in the native code. You should have explicit method in your class to release the c_object instance.</p>
<p>This is one of the cases where I'd recommend using a finalizer checking if c_object has been release... | 26,389 |
<p>Could you guys recommend some affordable SQL modeling tool which supports SQL Server, PostgreSQL and MySQL? I'm looking into up to $300 per license range. One tool per answer, please!</p>
<p>Thanks!</p>
| <p>In addition to <a href="http://office.microsoft.com/en-gb/visio/default.aspx" rel="nofollow noreferrer">Microsoft Visio</a> and SQL Server Database Diagrams,
one tool not yet mentioned is <a href="http://www.sparxsystems.com.au/products/ea/index.html" rel="nofollow noreferrer">EA Architect</a> which can be purchased... | <p>Some people I've worked with have had good things to say about <a href="http://www.toadsoft.com/toadmysql/Overview.htm" rel="nofollow noreferrer">TOAD</a> - it works with Mysql, though not PostgreSQL. It is a free download and includes <a href="http://www.toadsoft.com/toaddm/toad_data_modeler.htm" rel="nofollow nor... | 15,905 |
<p>Stored procs in SQL Server sometimes finish with a return code, as opposed to a recordset of data. I've seen ASP code that's able to get this return code, but I can't figure out how to get this code with PHP's mssql driver.</p>
<p>mssql_get_last_message() always returns nothing, and I'm thinking it's because it on... | <p>Are you talking about SQL Server error codes, e.g. RAISERRROR or other failures? If so, last time I checked in PHP you need to ask for @@ERROR (e.g. select @@error) instead.</p>
<p>If it is a return code, you must explicitly catch it, e.g.</p>
<pre><code>DECLARE @return_code INT
EXEC @return_code = your_stored_pro... | <p>To get a numeric error code from mssql you can do a select that looks something like </p>
<pre><code>SELECT @@ERROR AS ErrorCode
</code></pre>
<p>Which SHOULD return the correct error code.</p>
| 16,460 |
<p>I have been doing two projects on Rails which have worked out quite nicely but have in the process reinvented the wheel, running (and hot) water and painkillers which are as I have learned subsequently already present in the framework.</p>
<p>So basically, what is the best way to properly get know all the clever pa... | <p>This is a bit subjective. But if you haven't read <em>Agile Web Development With Rails</em>, I'd definitely recommend that, with the prior understanding that quite a bit of new stuff has been added since then, and the 3rd edition will be coming out very soon to reflect this. Also, <em>Ruby for Rails</em> is great if... | <p>The first good way to get to know Rails is by actually <em>making</em> something in it -- anything really, even just a simple blog or something like that. Doing so will show you <em>what</em> you'll need to know and look up to build a good rails app.</p>
<p>I also have two books I've used to learn Rails: <em>Agile ... | 49,892 |
<p>I have a checkbox list control on my asp.net web form that I am dynamically populating from an arraylist. In javascript I want to be able to iterate through the values in the list and if a particular value has been selected to display other controls on the page. </p>
<p>My issue is that all the values in the checkb... | <p><code>options[i].checked</code> will return true or false.
<code>options[i].value</code> will give you the value attribute of the checkbox tag.</p>
| <p>I think your problem is not with the javascript but with the code that is populating the checkboxes. Are you binding the ArrayList as the CheckBoxList data source or iterating through the ArrayList and adding new ListItems to the CheckBoxList. If the former, consider switching to the latter and make sure that you ... | 25,533 |
<p>I'm trying to draw a polygon using c# and directx</p>
<p>All I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world.</p>
<p>I can load the points and draw a convex shape using a trianglefan and drawuserprimitives.</p>
<p>This obviously leads to incorrect results when the ... | <p>Direct3D can only draw triangles (well, it can draw lines and points as well, but that's besides the point). So if you want to draw any shape that is more complex than a triangle, you have to draw a bunch of touching triangles that equal to that shape.</p>
<p>In your case, it's a concave polygon triangulation probl... | <p>I just had to do this for a project. The simplest algorithm I found is called "Ear Clipping". A great paper on it is here: <a href="http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf" rel="nofollow noreferrer">TriangulationByEarClipping.pdf</a></p>
<p>I took me about 250 lines of c++ code an... | 11,655 |
<p>Part of the install for an app I am responsible for, compiles some C code libraries. This is done in a console using GNU Make.</p>
<p>So, as part of the install, a console window pops open, you see the make file output wiz by as it compiles and links, when finished the console window closes and the installer contin... | <p>this should do the trick:</p>
<p></p>
<pre><code>if not ERRORLEVEL 0 pause
</code></pre>
<p>type <code>help if</code> in DOS for more info on errorlevel usage.</p>
| <p>Have you tried the 'pause' command?</p>
<pre><code>@echo off
echo hello world
pause
</code></pre>
<ul>
<li>more info on 'pause' : <a href="http://technet.microsoft.com/en-us/library/bb490965.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/bb490965.aspx</a></li>
<li>DOS Command Line refer... | 11,664 |
<p>I have an implementation of default handler. When it gets to a in the character data it stops parsing. Is there any reason that it is doing this? Are there additional properties that I need to set in order for it to deal with &nbsp?</p>
| <p>This breaks because the XML entity is not defined. You could add</p>
<pre><code><!DOCTYPE document SYSTEM "document.dtd" [
<!ENTITY nbsp "&#160;">
]>
</code></pre>
<p>Or just use <code>&#160;</code> instead. (Note the ";" at the end)</p>
<p>Also see <a href="http://www.dpawson.co.uk/xsl/cha... | <p><code>&nbsp;</code> is not a valid xml entity. You might try replacing it with <code>&#160;</code> instead, it does the same thing (non-breaking space).</p>
| 36,133 |
<p>I know that you can run almost all Java in <em>Dalvik's VM</em> that you can in <em>Java's VM</em> but the limitations are not very clear. Has anyone run into any major stumbling blocks? Any major libraries having trouble? Any languages that compile to Java byte code (<strong>Scala</strong>, <strong>Jython</stron... | <p>There is a number of things that Dalvik will not handle or will not handle quite the same way as standard Java bytecode, though most of them are quite advanced.</p>
<p>The <strong>most severe example is runtime bytecode generation</strong> and custom class loading. Let's say you would like to create some bytecode an... | <p>Just to add to the conversation, not intended to revive an old thread. I just ran across this in my search, and want to add that Jython does not work out of the box with Dalvik either. Simply trying to do a hello world example will yield the following:</p>
| 28,493 |
<p>I want to setup a cron job to rsync a remote system to a backup partition, something like:</p>
<pre><code>bash -c 'rsync -avz --delete --exclude=proc --exclude=sys root@remote1:/ /mnt/remote1/'
</code></pre>
<p>I would like to be able to "set it and forget it" but what if <code>/mnt/remote1</code> becomes unmounte... | <pre><code>if cut -d' ' -f2 /proc/mounts | grep '^/mnt/remote1$' >/dev/null; then
rsync -avz ...
fi
</code></pre>
<p>Get the list of mounted partitions from <code>/proc/mounts</code>, only match <code>/mnt/remote1</code> (and if it is mounted, send grep's output to <code>/dev/null</code>), then run your <code>r... | <p>I am skimming This but I would think you would rather rsync -e ssh and setup the keys to accept the account.</p>
| 4,699 |
<p>Is that needed?</p>
| <p>I write explicit tests for everything except simple getters and setters. </p>
<p>If the getter or setter only contains a return blah; or this.blah = blah; I don't think there is much value. The majority of times these are generated and I feel the time putting the tests together could be better spent elsewhere. </p>... | <p>No, I don't test POJOs because:</p>
<p>1.- If the POJO contains buseness logic, I extract it from the POJO and, of course, I test it. But that test is already out of the POJO.</p>
<p>2.- If the POJO doesn't containt it, i.e. simple/getters/setters methods, I generate it dynamically, at build-time or at runtime (<a... | 11,513 |
<p>Im trying to squeeze some extra performance from searching through a table with many rows.
My current reasoning is that if I can throw away some of the seldom used member from the searched table thereby reducing rowsize the amount of pagesplits and hence IO should drop giving a benefit when data start to spill from ... | <p>I don't now what else you tried to increase performance, this seems like grasping at straws to me. That doesn't mean that it isn't a valid approach. From my experience the benefit can be significant. It's just that it's usually dwarfed by other kinds of optimization.</p>
<p>However, what you are looking for are ios... | <p>I think you're going to be farther ahead using standard optimization techniques first -- check your execution plan, profiler trace, etc. and see whether you need to adjust your indexes, create statistics etc. -- before looking at the physical structure of your table.</p>
| 21,386 |
<p>How would I go upon detecting input for a console application in C#?</p>
<p>Let's say for example I want the console application to start up by writing:
Welcome To Food Hut
(cursor to type stuff here after the first line)</p>
<p>I would want the console application to detect two commands:</p>
<p>1: /help - which ... | <p>I recommend <a href="http://www.codeproject.com/KB/recipes/command_line.aspx" rel="noreferrer">Richard Lopes' Command Line Arguments Parser</a>. It is powerful and very simple to use. Also, it accepts various ways of specifying the arguments, for example:</p>
<ul>
<li>/name=Stefan</li>
<li>--name=Stefan</li>
<li>--... | <p>What about this case:</p>
<pre><code>mssinp.exe -cf "C:\Temp\config.txt"
</code></pre>
<p>the value for the parameter will be splited as </p>
<pre><code>[0] 'C'
[1] '\Temp\config.txt'
</code></pre>
| 40,864 |
<p>Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea. </p>
<p>Using PHP and/or HTML, create a page that cycles through any number of other pages at a given interval.</p>
<p>For instance, we would load this page and it would take us to... | <pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: n... | <p>There's a bunch of ways you can do this, iv written several scripts and tools with everything from JS to Ruby </p>
<p>In the end It was much easier to use <a href="http://dashboardrotator.com" rel="nofollow">http://dashboardrotator.com</a> . It handled browser restarts, memory allocation and accidental window clos... | 10,968 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.