instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have a page that is generated which inserts an HTML comment near the top of the page. Inside the comment is a *nix-style command.</p>
<pre><code><!-- command --option value --option2 value2 --option3 -->
</code></pre>
<p>This comment breaks the page completely. What is wrong with the comment to cause thi... | <p>Comments in the <a href="http://www.w3.org/TR/REC-xml/#sec-comments" rel="noreferrer">XML Spec from the w3.org</a> :</p>
<blockquote>
<p>For compatibility, the string "--"
(double-hyphen) MUST NOT occur within
comments.</p>
</blockquote>
| <p>Comments at the top of the page before <code><html></code> will throw IE into quirks mode, which could explain why the page breaks, if that's where your comment appears.</p>
<p>For more information, check out the "Triggering different rendering modes" on <a href="http://en.wikipedia.org/wiki/Quirks_mode" rel=... | 2,733 |
<p>In Google Chrome, I can provide the command-line argument --user-data-dir="..." to have Chrome use a different directory for state like cookies, cache, and so forth. This makes it possible to trivially load web pages from a "fresh" browser and simulate multiple independent users.</p>
<p>How can I do the same thing... | <p>One suggestion I can think of would be to create multiple user accounts on the box, and then create shortcuts to Internet Explorer with the <a href="http://technet.microsoft.com/en-us/library/cc781769.aspx" rel="nofollow noreferrer">RunAs command</a> or use the Run As... <a href="http://technet.microsoft.com/en-us/l... | <p>Heh.</p>
<p>With Chrome, FF, etc. I can actually have multiple <em>versions</em> on a single machine and test them without interference. IE requires me to set up VMs. Hence, the bulk of the code i churn out only gets tested rigorously on IE6 (since that's the install on the host OS). IE, if you'll pardon my slang, ... | 24,788 |
<p>Why does the following behave unexpectedly in Python?</p>
<pre><code>>>> a = 256
>>> b = 256
>>> a is b
True # This is an expected result
>>> a = 257
>>> b = 257
>>> a is b
False # What happened here? Why is this False?
>>> 257 is 257... | <p>Take a look at this:</p>
<pre><code>>>> a = 256
>>> b = 256
>>> id(a)
9987148
>>> id(b)
9987148
>>> a = 257
>>> b = 257
>>> id(a)
11662816
>>> id(b)
11662828
</code></pre>
<p>Here's what I found in the documentation for <a href="https://docs.pyt... | <p>It also happens with strings:</p>
<pre><code>>>> s = b = 'somestr'
>>> s == b, s is b, id(s), id(b)
(True, True, 4555519392, 4555519392)
</code></pre>
<p>Now everything seems fine.</p>
<pre><code>>>> s = 'somestr'
>>> b = 'somestr'
>>> s == b, s is b, id(s), id(b)
(Tru... | 39,405 |
<p>I just installed a SSL certificate. This certificate is encrypted with 2048 bit encryption.</p>
<p>However, the cypher is 128 bit encryption(or 40, or some other variation depending on the browser.)</p>
<p>It seems that there are two different types of encryption here. The "handshake" encryption of 2048 and the "o... | <p>It is true that symmetric encryption typically uses much fewer bits for its key length. The reason is because symmetric encryption is much stronger at a given number of bits.</p>
<p>Asymmetric encryption (where each side has a different key) is much harder to pull off. It is more computationally intensive and there... | <p>It is true that symmetric encryption typically uses much fewer bits for its key length. The reason is because symmetric encryption is much stronger at a given number of bits.</p>
<p>Asymmetric encryption (where each side has a different key) is much harder to pull off. It is more computationally intensive and there... | 23,370 |
<p>I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too.</p>
<p>Given that situation, I can't see a reason why I would ever choose to use shell scripting, vb ... | <p>Whatever you think will be most efficient for you!</p>
<p>I had a co-worker who seemed to use a different language for every task; Perl for quick text processing, PHP for small internal web applications, .NET for our main product, cygwin for filesystem stuff. He preferred to use the technology which was most specif... | <p>Weigh the importance of the tool against popping open a text editor for a quick edit vs. opening IDE, recompiling, redeploying, etc.</p>
| 7,829 |
<p>I am searching for a Linux software to control the 3000 mW laser engraver depicted below. It's a common model you'd find on AliExpress, Banggood, etc. under different brand names.</p>
<p>I have already tried <a href="https://github.com/AxelTB/nejePrint" rel="noreferrer">nejePrint</a>, <a href="https://github.com/La... | <p>A program that lists as functional with Linux is <a href="https://lightburnsoftware.com/" rel="noreferrer">Lightburn</a>. It's new to the laser engraving world and supports GRBL type controllers as well as Ruida brand and possibly a few others. If you can determine your controller, you're a step ahead of the game.</... | <p>I also have one, when you plug it on your linux computer, there is a CH340G usb-serial chip inside, a serial port should be available at /dev/ttyUSB0, and you can send a right BMP file via this serial port.</p>
<p>Maybe EzGraver would work?</p>
<p><a href="https://github.com/camrein/EzGraver" rel="nofollow norefer... | 1,350 |
<p>I have an ASP.NET 1.1 application, and on my local machine the submit button on my page works fine, but when I deploy it to our development application server, I click on Submit and nothing happens.. I'm assuming that the Page_Validate() function is failing and disabling the POSTBACK, but how do I debug this and det... | <p>Here's what happened... in ASP.NET 1.1, there was an error in the WebUIValidation.js file (supplied by microsoft and created when you run aspnet_regiis.exe), in function ValidatorCommonOnSubmit. It seems the method was missing a return statement!! If you modify this file and insert "return event.returnValue" at the... | <p>I remember back in the day with 1.1 Visual Studio used to destroy my event handler hookups occasionally.</p>
<p>If you are using Visual Studio 2003, make certain that the "generated" code still contains the event handler wireup for your control.</p>
| 11,033 |
<p>Is there a good reason why there is no <code>Pair<L,R></code> in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own.</p>
<p>It seems that <strong>1.6</strong> is providing something similar (<code>AbstractMap.SimpleEntry<K,V></code>), but this looks quit... | <p>In <a href="http://groups.google.com/group/comp.lang.java.help/browse_thread/thread/f8b63fc645c1b487/1d94be050cfc249b" rel="noreferrer">a thread on <code>comp.lang.java.help</code></a>, Hunter Gratzner gives some arguments against the presence of a <code>Pair</code> construct in Java. The main argument is that a cla... | <pre><code>public class Pair<K, V> {
private final K element0;
private final V element1;
public static <K, V> Pair<K, V> createPair(K key, V value) {
return new Pair<K, V>(key, value);
}
public Pair(K element0, V element1) {
this.element0 = element0;
... | 18,900 |
<p>I'm looking for a good way to run a Apache Derby server in network mode. I'm using the NetworkServerControl to start the server and it's working great.</p>
<p>I start the server like this:</p>
<pre><code>/**
* starts the network server
* @return true if sucessfull
*/
public boolean start()
{
try
{
... | <p>I did a project awhile ago with derby (including running in network mode), and I seem to remember that there is some SQL you can execute on the server which shuts derby down.</p>
<p>So, assuming that's the case (no time to google for it atm sorry) you could, on start up, look for your network instance. If it exists... | <p>The other solution I raised does not interact with your JAR, which you may not enjoy.</p>
<p>An alternative is to have your JAR that starts the derby instance open a TCP port that it monitors when it starts derby. You can then send your own shutdown commands to that from your new JAR instance (obviously before open... | 33,887 |
<p>Depending on my mood I seem to waffle back and forth between wanting a Lisp-1 and a Lisp-2. Unfortunately beyond the obvious name space differences, this leaves all kinds of amusing function name/etc problems you run into. Case in point, trying to write some code tonight I tried to do (map #'function listvar) whic... | <p><a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_map.htm" rel="nofollow noreferrer">Map</a> is more general than mapcar, for example you could do the following rather than using mapcar:</p>
<pre><code>(map 'list #'function listvar)
</code></pre>
<p>How do I keep scheme and CL separate in my head? I... | <p>I'm definitely aware that there are syntactic differences, though I'm certainly not fluent enough yet to automatically use them, making the code look much more similar currently ;-).</p>
<p>And I had a feeling your answer would be the case, but can always hope for a shortcut <_<.</p>
| 5,151 |
<p>I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.</p>
<p>Should I use OpenGL or Direct3D for my graphics backend? Why?</p>
<p>Or should I use a ready-made graphics engine such as <a href="http://www.ogre3d.org/" rel="nofollow norefe... | <p>Start with OpenGL because there are good textbooks and other online references on it. Once you get the hang of writing 3D game, you would be able to make the judgment for yourself.</p>
<p>Finishing a game, even if it's really stupid and simple just to get you going, is more important than picking the right library.... | <p>Ogre3D is great if you want to do cross platform coding and if you want to leave all the rendering to the engine. OpenGL is also great for cross platform coding, but it also makes you do all the boring parts -- however it provides greater control.</p>
<p>I would avoid DirectX in case you want to port your game to o... | 6,014 |
<p>I understand the mantra of "don't roll your own" when it comes to site security frameworks.</p>
<p>For most cases anyway.</p>
<p>I'm going to be collaborating on a site that integrates text-messaging into the system.</p>
<p>I'd like to use an existing, well-tested security framework to protect the users data, but... | <p>Note that techniques applied to passwords aren't applicable here. You can store a password salted and hashed (although the value of doing so can be disputed), but that doesn't work for phone numbers.</p>
<p>If someone jacks your server, they can do anything the server can. This must include recovering the phone num... | <p>Since you need to be able to retrieve the phone numbers, the only thing you can really do to protect them (beyond the normal things you would do to protecting your db) is encrypt them. This means that you need to:</p>
<ul>
<li>Make sure the key doesn't leak when you inadvertently leak a database dump.</li>
<li>Make... | 14,718 |
<p>At work, we're using ClearCase right now. However, there's a lot of overhead required, especially when someone does something stupid (like erase a view with multiple reserved check-outs on the trunk...). Since we're trying to lower our overhead and be as lightweight as possible, we've through about the possibility... | <p>From my experience, ClearCase has indeed a lot of overhead and we managed greatly with SVN.</p>
<p>I vote, "downgrade" (actually its an UPGRADE). ;)</p>
| <p>I'd be interested to hear about how your branch structure is set up. </p>
<p>Why are users working on the 'trunk' of your product? (I assume this means your main branch). Wouldn't development branches prevent your developers from affecting the main trunk?</p>
<p>Why couldn't you introduce a trigger on the rmview s... | 20,738 |
<p>I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance:</p>
<p><strong>Matches</strong></p>
<ul>
<li>CW3 9SS</li>
<li>SE5 0EG</li>
<li>SE50EG</li>
<li>se5 0eg</li>
<li>WC2H 7LT</li>
</ul>
<p... | <p>I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; <a href="http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm" rel="noreferrer">archive of XML</a>, see <a href="http://en.wikipedia.org/wiki/Postcodes_in_... | <p>I needed a version that would work in SAS with the <code>PRXMATCH</code> and related functions, so I came up with this:</p>
<pre><code>^[A-PR-UWYZ](([A-HK-Y]?\d\d?)|(\d[A-HJKPSTUW])|([A-HK-Y]\d[ABEHMNPRV-Y]))\s?\d[ABD-HJLNP-UW-Z]{2}$
</code></pre>
<p>Test cases and notes:</p>
<pre><code>/*
Notes
The letters QVX ... | 19,939 |
<p>Aspell-net is a port of the GNU Aspell for .Net Framework. The library itself is open source, and is under the LGPL license, but the english dictionary for aspell is mentioned as copyrighted on the sourceforge.net project home page at <a href="http://aspell-net.sourceforge.net/" rel="nofollow noreferrer">http://aspe... | <p>This needs some indentation to clarify</p>
<pre><code>((lambda (x y) (x y))
(lambda (x) (* x x))
(* 3 3))
</code></pre>
<ul>
<li><code>(lambda (x y) (x y))</code>; call <code>x</code> with <code>y</code> as only parameter.</li>
<li><code>(lambda (x) (* x x))</code>; evaluate to the square of its parameter.</li>
... | <p>The answers posted so far are good, so rather than duplicating what they already said, perhaps here is another way you could look at the program:</p>
<pre><code>(define (square x) (* x x))
(define (call-with arg fun) (fun arg))
(call-with (* 3 3) square)
</code></pre>
<p>Does it still look strange?</p>
| 27,594 |
<p>In the vxWorks RTOS, there is a shell that allows you to issue command to your embedded system.<br>
The documentation refers to kernel shell, host shell and target shell. What is the difference between the three?</p>
| <p>The target shell and kernel shell are the same. They refer to a shell that runs on the target. You can connect to the shell using either a serial port, or a telnet session.
A task runs on the target and parses all the commands received and acts on them, outputting data back to the port.</p>
<p>The host shell is a ... | <p>There are some differences between host shell and target shell, you can use h command to get the actual commands the two shell support.</p>
<p>The host shell support more command line edit functions like auto complement and symbol lookup etc.</p>
| 10,512 |
<p>We have simple web-based data entry internal business app.
Now business wants to be able to attach a document to a row in the database that represents business entity. Document can be Word, Excel, PDF.</p>
<p>How can we do that?</p>
<p>I think creating yet another home grown document management system is not a goo... | <p>I think any document management system can do what you are requesting. At one time we did something similar with Sharepoint. The systems expose an API that allows you to query documents that are stored. Exactly how the integration happens depends on the solution you go for.</p>
<p>You need to consider the platform ... | <p>I agree with the other commenters, EDRMS systems tend to be monsters.</p>
<p>I have integrated an internal system with a major EDRMS product, and if I was doing it again I would look for the following things:</p>
<ol>
<li>Well (and accurately!) documented API, preferably with some code examples.</li>
<li>A fairly ... | 33,362 |
<p>This is one of those meta-programming questions that may or may not belong on SO, but here goes...</p>
<p>Have any other programmers out there noticed that their ability to communicate with people (technical or otherwise) almost disappears during and after a period of intense programming?</p>
<p>I normally think o... | <p>This happens to me, to some extent, basically every workday. My girlfriend knows that when I'm in "robot mode" I'll be much less responsive to her subtle body-language cues and take longer to make spoken responses.</p>
<p>Some of it is just intense concentration, and fatigue caused by it, I'm sure; but it also make... | <pre><code>SYN
</code></pre>
<p>leads to...</p>
<pre><code>ACK
</code></pre>
<p>Or, maybe...</p>
<pre><code>NACK
</code></pre>
<p>That!</p>
<p>Is the question!</p>
| 28,690 |
<p>I can see people asking all the time whether multiple inheritance should be included into the next version of C# or Java. C++ folks, who are fortunate enough to have this ability, say that this is like giving someone a rope to eventually hang themselves. </p>
<p>What’s the matter with multiple inheritance? Are ther... | <p>The most obvious problem is with function overriding.</p>
<p>Let's say have two classes <code>A</code> and <code>B</code>, both of which define a method <code>doSomething</code>. Now you define a third class <code>C</code>, which inherits from both <code>A</code> and <code>B</code>, but you don't override the <code... | <p>There is nothing wrong in multiple inheritance itself. The problem is to add multiple inheritance to a language that was not designed with multiple inheritance in mind from the start.</p>
<p>The Eiffel language is supporting multiple inheritance without restrictions in a very efficient and productive way but the la... | 27,930 |
<p>I have writtent some Oracle storedprocedures in these there are more then 20 input parameters and from them morethen 10 parameters are required , I want all with some value and do not want to accept null values for that , Is there anything that I can declare in the Procedure defination itself which can restrict null... | <p>In PL/SQL I don't know of a way around checking each one.</p>
<p>If you are calling the stored procedure from an external library, that library might have that functionality. This is probably not likely because frequently NULL input parameters are required.</p>
<p>You could make a helper PL/SQL procedure that, giv... | <p>In PL/SQL I don't know of a way around checking each one.</p>
<p>If you are calling the stored procedure from an external library, that library might have that functionality. This is probably not likely because frequently NULL input parameters are required.</p>
<p>You could make a helper PL/SQL procedure that, giv... | 14,192 |
<p>I have a collection of STL files, each containing a separate moving part of an object I want to print. (Imagine a set of gears, or similar, that prints as a single object with multiple moving parts.)</p>
<p>My plan was to import them all into Cura, then hit print, then take my fully assembled object off the build p... | <p>What you try to do is called "Print in Place". However, it is not done by importing several STLs one after another as cura does remove the origin and recenters each imported object upon importing. However, an STL file can contain more than one body.</p>
<p>To generate a PiP model, you need to export your whole proj... | <p>Import them to Tinkercad and then output your combined file from there. You can go into Tinkercad and on the top right side you will see "import", click that to import your file (you can repeat the process as desired) and it will put the files on the workspace .. on the screen. When you have your workspace all set t... | 1,485 |
<p>I am debugging some code and have encountered the following SQL query (simplified version):</p>
<pre><code>SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND ads.county_id = 2
OR ads.county_id = 5
OR ads.county_id = 7
OR ads.c... | <p>Put parentheses around the "OR"s:</p>
<pre><code>SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND
(
ads.county_id = 2
OR ads.county_id = 5
OR ads.county_id = 7
OR ads.county_id = 9
)
</code></pre>
<p>Or even... | <p>And even simpler using IN:</p>
<pre><code>SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND ads.county_id IN (2,5,7,9)
</code></pre>
| 32,744 |
<p>Has anyone found a way to save a FlowDocument as BAML or other compressed format? I can import XML with images to create a new FlowDocument:</p>
<pre><code><TextRange class instance>.Load(fs, DataFormats.Rtf)
</code></pre>
<p>However, I haven't found a good way to save it in a 'native' compressed format. U... | <p>I do not think it is possible... The BamlWriter is marked as internal, this will hopefully open up soon!</p>
<p>I unfortunatly do not know of any XAML compilers</p>
| <p>Well, it turns out you can run Visual C# 2008 Express w/o the GUI. And you can modify the final program name via code before you compile as well. I'm sure you can do it via APIs, but here's the hack I found:</p>
<ol>
<li>The program's is name determined in .csproj, in the xml tag.</li>
<li>Run via code or batch ... | 21,186 |
<p>Is it possible to put the results from more than one query on more than one table into a TClientDataset?</p>
<p>Just something like</p>
<pre><code>SELECT * from t1;
SELECT * from t2;
SELECT * from t3;
</code></pre>
<p>I can't seem to figure out a way to get a data provider (SetProvider) to pull in results from mo... | <p><code>ClientDatasets</code> can contain fields that are themselves other datasets. So if you want to create three tables in a single dataset, create three <code>ClientDatasets</code> holding the three result sets that you want, and then you can put them into a single <code>ClientDataSet</code>.</p>
<p>This article... | <p>There is not a way to have multiple table data in the same TClientDataSet like you referenced. The TClientDataSet holds a single cursor for a single dataset.</p>
| 13,643 |
<p>Hashtables have a syncroot property but generic dictionaries don't. If I have code that does this:</p>
<pre><code>lock (hashtable.Syncroot)
{
....
}
</code></pre>
<p>How do I replicate this if I am removing the hashtable and changing to generic dictionaries?</p>
| <p>If you are going strictly for compatability then Bryan is correct. This is the best way to maintain your current semantics on top of a Dictionary. </p>
<p>Expanding on it though. The reason the SyncRoot property was not directly added to the generic dictionary is that it's a dangerous way to do synchronization. ... | <p>If the hashtable/dictionary isn't public, you could just lock the dictionary object itself.</p>
| 42,467 |
<p>I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally.</p>
<p>However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session... | <p>John,</p>
<p>I'm assuming you're using an ashx handler for the handler. If so, be sure to derive from IRequiresSessionState for example:</p>
<pre><code>public class Images : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{ }
</code></pre>
<p>If you're not using an ashx can you describe what you mean ... | <p>yes you are right This happens because the object dependancy might conficts in case of other page transferance parallel which may break down the firewall between sessions</p>
| 37,429 |
<p>Are the .net classes relating to DbProviderFactory thread safe?</p>
| <p>from msdn:
Thread Safety</p>
<p>Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.</p>
| <p>When you say "These instances are generated once at run time, and used for the rest of the service's life", do you mean the connection object? Also, do you mean you're keeping the connection object open through out the life of your service? If your service is multi-threaded and you only have one instance of the con... | 27,128 |
<p>I am trying to override the DataGridViewTextBoxCell's paint method in a derived class so that I can indent the foreground text by some variable amount of pixels. I would like it if the width of the column adjusts so that its total width is the length of my cells text plus the "buffer" indent. Does anyone know of a... | <p>You can just hook up to the CellFormattingEvent in the datagridview and do your formatting there. Or, if you're inherting from the DataGridView, you can just override the OnCellFormatting method. The code would look something like this:</p>
<pre><code> if (e.ColumnIndex == 1)
{
... | <p>You can just hook up to the CellFormattingEvent in the datagridview and do your formatting there. Or, if you're inherting from the DataGridView, you can just override the OnCellFormatting method. The code would look something like this:</p>
<pre><code> if (e.ColumnIndex == 1)
{
... | 21,334 |
<p>I need to determine the highest .NET framework version installed on a desktop machine from C\C++ code. Looks like I can iterate the folders under <code>%systemroot%\Microsoft.NET\Framework</code>, but that seems kind of error prone. Is there a better way? Perhaps a registry key I can inspect? Thanks.</p>
| <p>Use the <a href="http://en.wikipedia.org/wiki/Windows_Registry" rel="nofollow noreferrer">Windows Registry</a> location <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP</code>.</p>
| <p>The following is supposed to give you the answer, but it seems horribly broken :(</p>
<pre><code>c:\Program Files>clrver
Versions installed on the machine:
v2.0.50727
</code></pre>
| 22,102 |
<p>If I'm writing unit tests in Python (using the unittest module), is it possible to output data from a failed test, so I can examine it to help deduce what caused the error?</p>
<p>I am aware of the ability to create a customized message, which can carry some information, but sometimes you might deal with more comple... | <p>We use the logging module for this.</p>
<p>For example:</p>
<pre><code>import logging
class SomeTest( unittest.TestCase ):
def testSomething( self ):
log= logging.getLogger( "SomeTest.testSomething" )
log.debug( "this= %r", self.this )
log.debug( "that= %r", ... | <p>Expanding on <a href="https://stackoverflow.com/questions/284043/outputting-data-from-unit-test-in-python/13688397#13688397">Facundo Casco's answer</a>, this works quite well for me:</p>
<pre><code>class MyTest(unittest.TestCase):
def messenger(self, message):
try:
self.assertEqual(1, 2, msg=... | 36,028 |
<p>what are advantages & disadvantages of connected & disconnected Architecture (database) over one another in asp.net ?</p>
| <p>In disconnected architecture a <strong>DataSet</strong> is used for retrieving data from the database. Then no need for maintaining the connection also. All the operations can be performed with the data once retrieved. It won't cause traffic problems while working with the data.</p>
<p>In connected architecture a <... | <p>asp.net is a server side technology designed for a server to process requests for pages. The very nature of ASP.NET requires a connected model.</p>
<p>Could you clarify what you mean by "disconnected"?</p>
| 35,861 |
<p>In C#, how do I get the name of the drive that the Operating System is installed on?</p>
| <p>This should do it for you:</p>
<pre><code>Path.GetPathRoot(Environment.SystemDirectory)
</code></pre>
| <p>There is an enum "SpecialFolder" in Environment where we can select the folder we are looking for..</p>
<p>Environment.GetFolderPath(Environment.SpecialFolder.Desktop);</p>
| 24,395 |
<p>is it legal for a thread to call this.start() inside its own constructor? and if so what potential issues can this cause? I understand that the object wont have fully initialized until the constructor has run to completion but aside from this are there any other issues? </p>
| <p>For memory-safety reasons, you shouldn't expose a reference to an object or that object's fields to another thread from within its constructor. Assuming that your custom thread has instance variables, by starting it from within the constructor, you are guaranteed to violate the Java Memory Model guidelines. See <a... | <p>It's legal, but not wise. The Thread part of the instance will be completely initialised, but your constructor may not. There is very little reason to extend Thread, and to pull tricks like this isn't going to help your code.</p>
| 10,984 |
<p>Our system (exotic commodity derivative trade capture and risk management) is being redeveloped shortly. One proposal that I have heard is that a rule engine will be incorporated to make it easier for the end-users (commodities traders, so fairly sophisticated) to make certain changes to the business logic.</p>
<p>... | <p>I've seen two applications that used the Blaze Rete engine from Fair Issac.</p>
<p>One application slammed thousands of rules into a single knowledge base, had terrible memory problems, has become a black box that few understand. I would not call that a success, but it is running in production.</p>
<p>Another app... | <p>For a while I worked for the PEATE distributed computing project which was developing a system for calculation of large scale, high volume atmospheric data. The system had three parts to it: the data manager, the scheduler, and the algorithm execution component. There could be any number of any of these components, ... | 25,288 |
<p>What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions if the user is not connected to the Internet.</p>
| <p>The following will determine if you are connected to a network, however, that doesn't necessarily mean that you are connected to the Internet:</p>
<pre><code>NetworkInterface.GetIsNetworkAvailable()
</code></pre>
<p>Here is a C# translation of Steve's code that seems to be pretty good:</p>
<pre><code>private sta... | <p><a href="http://www.csharphelp.com/archives3/archive499.html" rel="nofollow noreferrer">http://www.csharphelp.com/archives3/archive499.html</a></p>
<p>Also, scroll past the experts-exchange links at: <a href="http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=13045" rel="nofollow noreferrer">http://www.csharp... | 23,663 |
<p>I have a servlet that I would like to run within ColdFusion MX 7. I would like to make use of an existing ColdFusion DSN as a javax.sql.DataSource, if possible.</p>
<p>I thought something like </p>
<pre><code>coldfusion.server.ServiceFactory.getDataSourceService().getDatasource(dsname);
</code></pre>
<p>would wor... | <p>That code will work fine, you just don't have ServiceFactory in your classpath. Ie, Java can't load that class. Try including a dependency on cfusion.jar from C:\CFusionMX7\lib.</p>
| <p>That code will work fine, you just don't have ServiceFactory in your classpath. Ie, Java can't load that class. Try including a dependency on cfusion.jar from C:\CFusionMX7\lib.</p>
| 33,743 |
<p>From the first days the .NET framework came out there was a minimum OS support:</p>
<ul>
<li>.NET 1.0 - Windows NT or higher (Windows 98/ME are also supported)</li>
<li>.NET 2.0 - Windows 2000 or higher (Windows 98/ME are also supported)</li>
<li>.NET 3.0 - Windows XP or higher</li>
<li>.NET 3.5 - Windows XP or hig... | <p>A minimum OS support means that the product was tested on particular platform and above. It does not guarantee that all the features (or classes/APIs in the case of a dev platform like .Net) will work on all the supported platforms.</p>
<p>There are Vista specific native APIs which do not exist in XP. .Net 3.5 adds... | <p>Platform support has always varied by type. Many types are not supported by the Compact Framework, for example. </p>
| 18,659 |
<p>What would you recommend to search a sql server table (varchar(max) column) for a term?</p>
<p>Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND NEW WII FIT GAME + BALANCE BOARD".</p>
<p>I think it basical... | <p>You are looking for fulltext indexing, it allows you to do more advanced querying than regular expressions or like.</p>
<p>Check <a href="http://www.developer.com/db/article.php/3446891" rel="noreferrer">this</a> article for a quick introduction, the instructions are for SQL Server 2000, where it is a little harder... | <p>Depends on what you are trying to do. For a simple search, you could just do
<code>select * from table where field like '%word%'</code>. But if this is some sort of application feature, you want to look into a full tet search application. It can store words that appear in that field as indexes and then search ac... | 24,004 |
<p>I am trying to make our SQL Server Integration Services packages as portable as possible and the one thing that is preventing that is that the path to the config is always an absolute path, which makes testing and deployment a headache. Are there any suggestions for making this more manageble?</p>
<p>Another issue ... | <p>If you are trying to execute your packages using Visual Studio then the configuration file path will be hardcoded in there. So if you move your project around you'll need to change the path in the package settings. To avoid this you could use the Environment variable option to store the configuration file path. Then... | <p>My stock standard trick for these sorts of problems are mapping drives.</p>
<p>Either by using a <a href="http://windows.microsoft.com/en-au/windows-vista/create-a-shortcut-to-map-a-network-drive" rel="nofollow">mapped network drive</a> or by using <a href="http://www.microsoft.com/resources/documentation/windows/x... | 28,893 |
<p>I want to open a file dialog box in user control. I used <code>using System.Windows.Forms</code>, but still I can't access SaveFileDialog class. Can anybody tell me how to do this? Thanks.</p>
| <p>You cannot use SaveFileDialog in asp.net (if I look at the tags of the question).</p>
<p>It seems you want to let the uset click on some button to download a file and prompt the user to save it.</p>
<p>If that is a correct assumption, see the accepted answer at <a href="https://stackoverflow.com/questions/338616/w... | <pre><code><input type=file>
</code></pre>
<p>or</p>
<pre><code><asp:FileUpLoad id="FileUpLoad1" runat="server" />
</code></pre>
<p>might be what you have in mind. It will let the user upload a file as part of the POST.</p>
| 45,013 |
<p>I'm looking for a simple way to encrypt my soap communication in my C# Web-Service.</p>
<p>I was looking into <a href="http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.microsoft.com%2Fdownloads%2Fdetails.aspx%3Ffamilyid%3D018a09fd-3a74-43c5-8ec1-8d789091255d&ei=x1isSPTUO4bS0QXsjIzWAw&... | <p>I think this can help; last year we used this to compress the webservices and it performed very well, I believe it could be enhanced with encryption classes;</p>
<p><a href="http://www.mastercsharp.com/article.aspx?ArticleID=86&&TopicID=7" rel="noreferrer">Creating Custom SOAP Extensions - Compression Exten... | <p>Perhaps I'm being naive, but would forcing the communication to be via https be acceptable?
I develop web services that run on 2.0 and have had success with just getting IIS to enforce https on the virtual directory. </p>
<p>Alternatively, or in addition, you can check the <a href="http://msdn.microsoft.com/en-us/l... | 3,902 |
<p>Since debate without meaningful terms is <a href="https://stackoverflow.com/questions/24270/whats-the-point-of-oop">meaningless</a>, I figured I would point at the elephant in the room and ask: What exactly makes a language "object-oriented"? I'm not looking for a textbook answer here, but one based on your experien... | <p><a href="http://C2.Com/cgi/wiki?DefinitionsForOo" rel="noreferrer" title="Definitions for OO on Ward's WikiWikiWeb">Definitions for Object-Orientation</a> are of course a <a href="http://C2.Com/cgi/wiki?OoBestFeatures" rel="noreferrer" title="OO Best Features on Ward's WikiWikiWeb">huge can of worms</a>, but... | <p><strong>Archetype</strong></p>
<p>The ability to express real-world scenarios in code.</p>
<pre><code>foreach(House house in location.Houses)
{
foreach(Deliverable mail in new Mailbag(new Deliverable[]
{
GetLetters(),
GetPackages(),
GetAdvertisingJunk()
... | 4,876 |
<p>On some Microsoft Access queries, I get the following message: Operation must use an updatable query. (Error 3073). I work around it by using temporary tables, but I'm wondering if there's a better way. All the tables involved have a primary key. Here's the code:</p>
<pre><code>UPDATE CLOG SET CLOG.NEXTDUE = (
... | <p>Since Jet 4, all queries that have a join to a SQL statement that summarizes data will be non-updatable. You aren't using a JOIN, but the WHERE clause is exactly equivalent to a join, and thus, the Jet query optimizer treats it the same way it treats a join.</p>
<p>I'm afraid you're out of luck without a temp table... | <p>In essence, while your SQL looks perfectly reasonable, Jet has never supported the SQL standard syntax for <code>UPDATE</code>. Instead, it uses its own proprietary syntax (different again from SQL Server's proprietary <code>UPDATE</code> syntax) which is <em>very</em> limited. Often, the only workarounds "Operation... | 20,578 |
<p>I have an object, and I want to list all the selectors to which it responds. It feels like this should be perfectly possible, but I'm having trouble finding the APIs.</p>
| <p>This is a solution based on the runtime C functions:</p>
<p>class_copyMethodList returns a list of class methods given a Class object obtainable from an object.</p>
<pre><code>#import <objc/runtime.h>
</code></pre>
<p>[..]</p>
<pre><code>SomeClass * t = [[SomeClass alloc] init];
int i=0;
unsigned int mc =... | <p>Something like this should work (just put it in the object you're curious about). For example if you have an object that's a delegate and want to know what 'hooks' are available this will print out messages to give you that clue:</p>
<pre><code>-(BOOL) respondsToSelector:(SEL)aSelector {
printf("Selector: %s\n"... | 42,754 |
<p>Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own?</p>
<p>To be clear - I don't want to <em>call</em> assembly code from C# - I just want to be able to assemble code from... | <p>As part of some early prototyping I did on a personal project, I wrote quite a bit of code to do something like this. It doesn't take strings -- x86 opcodes are methods on an X86Writer class. Its not documented at all, and has nowhere near complete coverage, but if it would be of interest, I would be willing to op... | <p>Take a look at this: <a href="http://www.codeproject.com/KB/cs/unmanage.aspx" rel="nofollow noreferrer">CodeProject: Using unmanaged code and assembly in C#</a>.</p>
| 16,637 |
<p>I'm learning how to make a firefox extension.
I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simp... | <p>You should be able to access active tab window context in the following way:</p>
<pre>
function loadURL(url) {
content.wrappedJSObject.location = url;
}
</pre>
| <p>This another method!</p>
<pre><code>document.getElementById('1').loadURI('http://tridz.com')
</code></pre>
| 24,154 |
<p>I am making an app that scrolls information on the desktop. The window is transparent. I am starting out simple, trying to find the lowest CPU use for animating things and I am starting with a simple TextBlock.</p>
<p>On my development machine, I get a very smooth animation across the screen setting the Canvas.Le... | <p>If you are using the AllowsTransparency property you will have performance and compatibility problems.</p>
<p>The technical explanation is here:</p>
<p><a href="http://blogs.msdn.com/dwayneneed/archive/2008/09/08/transparent-windows-in-wpf.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/dwayneneed/archive/20... | <p>I am having a very similar issue with a program I recently created using the WPF. It works fine on the build machine I am using which is running windows server 2003, but when I switch it to an XP machine with more than sufficient resources to run the program, it becomes extremely choppy. Basically it gets one frame ... | 40,343 |
<p>I'm currently looping through a datareader and calling the System.Net.Mail.SmtpClient's Send() method. The problem with this is that it's slow. Each email takes about 5-10 seconds to send (it's possible this is just an issue with my host). I had to override the executionTimeout default in my web.config file (it defa... | <p>You could send the mail asynchronous. That way the timeout should not interrupt your sending.</p>
<p>This article should help you get started with that: <a href="http://www.eggheadcafe.com/articles/20030720.asp" rel="nofollow noreferrer">Sending Emails Asynchronously in C#</a>.</p>
<p>There is another approach her... | <p>Definitely spawn it off on a background worker process so they go out asynchronously. </p>
<p>BTW, 5-10 seconds per e-mail seems way slow to me. On my server it takes just fractions of a second per e-mail. </p>
| 8,117 |
<p>This code produces a FileNotFoundException, but ultimately runs without issue:</p>
<pre><code>void ReadXml()
{
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
//...
}
</code></pre>
<p>Here is the exception:</p>
<hr>
<p>A first chance exception of type 'System.IO.FileNotFoundException' occu... | <p>This is how I managed to do it by modifying the MSBUILD script in my .CSPROJ file:</p>
<p>First, open your .CSPROJ file as a file rather than as a project. Scroll to the bottom of the file until you find this commented out code, just before the close of the Project tag: </p>
<pre><code><!-- To modify your build... | <p>For anyone interested in doing so for <strong>.NET Core</strong> - please refer to this MS article: <a href="https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator</a></... | 16,248 |
<p>There is a list of projects <a href="http://www.marketing-ninja.com/old-stuff/list-of-facebook-sdks-for-net/" rel="noreferrer">here</a>, mainly the <a href="http://www.codeplex.com/FacebookToolkit" rel="noreferrer">Facebook Developer Toolkit</a> and <a href="http://www.nikhilk.net/FacebookNET.aspx" rel="noreferrer">... | <p>I also started experimenting with Facebook Developer Toolkit (FDT) but dropped it for Facebook.NET. There is a fork of the latter at <a href="http://www.codeplex.com/fbnet" rel="nofollow noreferrer">http://www.codeplex.com/fbnet</a> which slowly covers recent changes in Facebook API. Have a look at this post since i... | <p>Another option that I just came across is the <a href="http://azurecoding.net/blogs/icbtw/archive/2009/01/22/silverlight-facebook-api.aspx" rel="nofollow noreferrer">Silverlight Facebook Client Side API v0.001</a>. Still in the demo/poc phase but looks pretty promising.</p>
| 22,364 |
<p>The compiler usually chokes when an event doesn't appear beside a <code>+=</code> or a <code>-=</code>, so I'm not sure if this is possible.</p>
<p>I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax would look something like this:</p>
<pre><c... | <p><strong>Edit:</strong> As <a href="https://stackoverflow.com/questions/35211/identify-an-event-via-a-linq-expression-tree#36255">Curt</a> has pointed out, my implementation is rather flawed in that it can only be used from within the class that declares the event :) Instead of "<code>x => x.MyEvent</code>" return... | <p>While Emperor XLII already gave the answer for this, I thought it was worth while to share my rewrite of this. Sadly, no ability to get the Event via Expression Tree, I'm using the name of the Event.</p>
<pre><code>public sealed class EventWatcher : IDisposable {
private readonly object _target;
private ... | 5,565 |
<p>I can´t find a way to restyle the IsChecked indicator of a checkbox. As I can see from the checkbox template there´s no possibilities to restyle the indicator, just the "box" of the checkbox. Does anyone knows if it´s possibly to restyle the IsChecked indicator?</p>
| <p>You will have to replace the entire CheckBox control template.</p>
<p>Start with the ChekcBox ControlTemplate MSDN example at <a href="http://msdn.microsoft.com/en-us/library/ms752319.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms752319.aspx</a></p>
<p>In the example you'll see this element:</p>... | <p>You might find the following discussion helpful:</p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f8e3c903-5c82-46ec-a065-9a75d9f79b75/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f8e3c903-5c82-46ec-a065-9a75d9f79b75/</a></p>
<p>People describe variou... | 39,248 |
<p>I want to find records on a combination of created_on >= some date AND name IN some list of names.</p>
<p>For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names.</p>
<p>Is there a way to combine the two?</p>
| <p>You can use named scopes in rails 2.1 and above</p>
<pre><code>Class Test < ActiveRecord::Base
named_scope :created_after_2005, :conditions => "created_on > 2005-01-01"
named_scope :named_fred, :conditions => { :name => "fred"}
end
</code></pre>
<p>then you can do</p>
<pre><code>Test.created_af... | <p>I think I'm either going to use simple AR finders or <a href="http://www.binarylogic.com/2008/9/1/searchgasm-released" rel="nofollow noreferrer">Searchgasm</a>.</p>
| 10,923 |
<p>I have a function that checks if a cookie (by name) exists or not:</p>
<pre><code>Private Function cookieExists(ByVal cName As String) As Boolean
For Each c As HttpCookie In Response.Cookies
If c.Name = cName Then Return True
Next
Return False
End Function
</code></pre>
<p>I have a class that h... | <pre><code>HttpContext.Current.Response
HttpContext.Current.Request
</code></pre>
| <p>HttpContext.Current uses the Ambient Context design pattern, so you should be able to access the Response object from just about anywhere in your code. It is very useful.</p>
<p>For those wondering, the Ambient Context pattern is very cool, and is detailed here:</p>
<p><a href="http://aabs.wordpress.com/2007/12/31... | 35,676 |
<p>I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? </p>
<p>In TortoiseSVN this is called "Check for modifications" and shows all difference between local copy and what we have in the repo.</p>
| <p>I'm not sure about Clear Case's own possibilities, but you always can make a view of that stream and compare your original view with created one using any file/folder comparison tool. I use <a href="http://www.araxis.com/merge/index.html" rel="nofollow noreferrer">Araxis Merge</a> for that. There is also an open sou... | <p>Have you tried the '<a href="http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m1/topic/com.ibm.rational.clearcase.doc/topics/u_ccvtree.htm" rel="nofollow noreferrer">version-tree</a>' feature? </p>
| 20,143 |
<p>I have a 2D character array:<br>
<code>char nm[MAX1][MAX2] = { "john", "bob", "david" };</code><br>
I want to swap two of these elements (without <code>std::swap</code>) by simply writing<br>
<code>swapPointers(nm[0], nm[1]);</code><br>
where <code>swapPointers</code> looks like this </p>
<pre><code>void swapPoint... | <p>Zan is close, but his problem is that his 'swap' function can take any pointer to characters. This can cause problems if misused. Here is a safer version:</p>
<pre><code>void swap(char (&x)[MAX2], char (&y)[MAX2])
{
char temp[MAX2];
memcpy(temp, x, MAX2);
memcpy(x, y, MAX2);
memcpy(y, tem... | <pre><code>void swapPointers(char** ppa, char** ppb)
{
char* ptemp = *ppa;
*ppb = *ppa;
*ppa = ptemp;
}
swapPointers(&nm[0], &nm[1]);
</code></pre>
| 15,203 |
<p>How can I add the reboot action to a vdproj?</p>
<p>I need an <a href="http://en.wikipedia.org/wiki/Windows_Installer" rel="nofollow noreferrer">MSI</a> file which restart the PC at the end of the installation.</p>
| <p>Just add the "REBOOT" property with the value "Force" which will prompt the user to reboot once setup is complete, or automatically reboot if there is no user interface.</p>
<p>If you cannot do this in the vdjproj then just use Orca to edit the Property table of the MSI once the setup is built.</p>
<p>If you want ... | <p>If you need to reboot, Windows Installer should detect it automatically. If you want to reboot as you are too lazy to start services manually, you will need to find some other way (I do not know of any easy way).</p>
| 44,182 |
<p>Is the asp.net membership system used over wcf (transport security turned on) enough for high security internet scenarios with thousands of clients spread all over the internet?</p>
<p>I'm just evaluating possible solutions and wanted to know if this might fit in this category.</p>
<p>If not, what would be the bes... | <p>Yes it will work; and with SSL/transport security the authentication will be protected by the transport. Will it scale? That's harder to say; it depends on too many factors.</p>
<p>OK so by high security you're looking for non-repudiation? That's trickier; because of course people can share usernames and passwords.... | <p>high security means some of the information is "very confident". there may be several thousand clients that may contact the service maybe one or two times a day, so i guess scaling won't be the problem as the sessions are quite short lived.</p>
| 26,440 |
<p>What tools do you know, other than those in Visual Studio, to analyze performance bottlenecks in a Windows CE/Mobile application? I'm looking for something like AQTime for CE/Mobile, to profile C/C++ applications compiled to native code.</p>
| <p>I haven't found any such tools for WindowsMobile for native development.</p>
<p>The closest I've found is the EnTrek toolset (CodeSnitch / ProcMan), but they aren't really profiling tools.
<a href="http://www.entrek.com/products.htm" rel="noreferrer">http://www.entrek.com/products.htm</a></p>
<p>What we did do is ... | <p>If you're doing .NET CF development, check out the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c8174c14-a27d-4148-bf01-86c2e0953eab&displaylang=en" rel="nofollow noreferrer">Power Toys for .NET CF 3.5</a> for utilities that can help you pinpoint bottlenecks, especially memory-related ones. ... | 31,982 |
<p>I have a unique situation where I need to implement client certificate authentication over HTTPS between IE browser and IIS 6. The browser and IIS are separated by a firewall that only allows the browser to connect to IIS on the SSL port.</p>
<p>We have an internal certificate server on the same network as IIS. I... | <p>Use the certreq command on your client as follows</p>
<p>certreq -new -f filein c:\certrequest.req</p>
<p>Here is and example of the filein</p>
<p>[Version]
Signature="$Windows NT$"</p>
<p>[NewRequest]<br/>
Subject="CN=dc1.extranet.frbrikam.com"<br/>
EncipherOnly = False<br/>
Exportable = False<br/>
KeyLength = ... | <p>You sound like you have already tried a couple of things so my guess is that you are already aware of these, but I'm going to post them anyway, just in case: <a href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/distrib/dscj_mcs_ooiy.mspx?mfr=true" rel="nofollow noreferrer" title="Certificate ... | 33,969 |
<p>suppose that I have this RDBM table (<a href="http://en.wikipedia.org/wiki/Entity-attribute-value_model" rel="nofollow noreferrer">Entity-attribute-value_model</a>):</p>
<pre><code>col1: entityID
col2: attributeName
col3: value
</code></pre>
<p>and I want to use HBase due to scaling issues.</p>
<p>I know that the... | <p>Secondary indexes would indeed be useful for many potential applications of HBase, and I believe the developers are in fact looking at it. Checkout <a href="http://www.mail-archive.com/hbase-dev@hadoop.apache.org/msg04801.html" rel="nofollow noreferrer">http://www.mail-archive.com/hbase-dev@hadoop.apache.org/msg0480... | <p>I recommend having two different flat tables: one for looking up attributes+values given entityID, and one for looking up the entityID given attributes+values.</p>
<p>Table 1 would look like this:</p>
<pre><code>entityID1 {
attribute1: value1;
attribute2: value2;
...
}
</code></pre>
<p>and Table 2:</p>
<pr... | 49,092 |
<p>It has always bothered me that the only way to copy a file in Java involves opening streams, declaring a buffer, reading in one file, looping through it, and writing it out to the other steam. The web is littered with similar, yet still slightly different implementations of this type of solution.</p>
<p>Is there a... | <p>As toolkit mentions above, Apache Commons IO is the way to go, specifically <a href="https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/FileUtils.html" rel="noreferrer">FileUtils</a>.<a href="https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/... | <p>A little late to the party, but here is a comparison of the time taken to copy a file using various file copy methods. I looped in through the methods for 10 times and took an average. File transfer using IO streams seem to be the worst candidate:</p>
<p><a href="https://i.stack.imgur.com/yM0GV.png" rel="nofollow n... | 13,236 |
<p>My current process for debugging stored procedures is very simple. I create a table called "debug" where I insert variable values from the stored procedure as it runs. This allows me to see the value of any variable at a given point in the script, but is there a better way to debug MySQL stored procedures?</p>
| <p>I do something very similar to you. </p>
<p>I'll usually include a DEBUG param that defaults to false and I can set to true at run time. Then wrap the debug statements into an "If DEBUG" block.</p>
<p>I also use a logging table with many of my jobs so that I can review processes and timing. My Debug code gets ... | <p>Answer corresponding to <a href="https://stackoverflow.com/questions/273437/how-do-you-debug-mysql-stored-procedures#15687954">this</a> by @Brad Parks
Not sure about the MySQL version, but mine was 5.6, hence a little bit tweaking works:</p>
<p>I created a function <code>debug_msg</code> which is function (not proc... | 34,445 |
<p>I have a 3D printer that is going crazy with x-axis shift, and I need a tension gauge belt to measure the tension.</p>
<p>I've never used one before, and looking online, I can't tell which one would be the right fit.</p>
<p>Any ideas? What things should I look for?</p>
| <p>It's extremely unlikely that belt tension is actually your problem. I've never heard of anyone using a gauge to measure their belt tension. Typically you just pull your belt tight by hand so that it produces a low note when plucked. It's far more likely that you're experiencing shifts due to too high or too low step... | <p>People are using this
<a href="https://i.stack.imgur.com/zA3d9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zA3d9.png" alt="Clothpin springs repurposed into a makeshift belt tensioner" /></a>
to tighten the belt but I would totally agree with @Tom - there is no need to use such devices or gauge... | 253 |
<p>If you have two versions of the same report (.rpt) and you want to establish what the exact differences are, what is the best way to go about this? I've seen some commercial tools to do this, but I'm not too interested in forking out cash for something that should be relatively straight forward. Can I hook into the ... | <blockquote>
<p>Can I hook into the Crystal API and
simply list all of the properties of
every field or something? Please
someone tell me that there's an Open
Source project somewhere that does
this... @:-)</p>
</blockquote>
<p>There is in fact, such an API. I wrote a VB6 application to do just what you a... | <p>One helpful technique is to output both versions of the report to plain text, then diff those outputs.</p>
<p>You could write something using the crystal report component to describe every property of the report, like you described. Then you could output <em>that</em> to text, and diff <em>those</em>. I'm not aw... | 4,030 |
<p>What are some effective strategies for preventing the use of my proprietary images?</p>
<p>I'm talking about saving them, direct linking to them etc...</p>
<p>Presently I have a watermark on the image, but I'd rather not.</p>
<p>.NET platform preferred, but if there's a strategy that's on another platform that in... | <p>It's not possible to make it "impossible" to download. When a user visits your site you're sending them the pictures. The user will have a copy of that image in the browsers cache and he'd be able to access it even after he leaves the site ( depending on the browser, of course ). Your only real option is to watermar... | <p>Anything you send to the client is, like, on the client. Not much you can do about it besides making somewhere between "sorta hard" and "quite hard" to save the image.</p>
| 4,159 |
<p>How are people unit testing code that uses Linq to SQL? </p>
| <p>Update:</p>
<p>Fredrik has put an example solution on how to do unit test linq2sql applications over at his blog. You can download it at:</p>
<p><a href="http://web.archive.org/web/20120415022448/http://iridescence.no/post/DataContext-Repository-Pattern-Example-Code.aspx" rel="nofollow noreferrer">http://web.archi... | <p>LINQ to SQL is actually really nice to unit test as it has the ability to create databases on the fly from what is defined in your DBML.</p>
<p>It makes it really nice to test a ORM layer by creating the DB through the DataContext and having it empty to begin with.</p>
<p>I cover it on my blog here: <a href="http:... | 7,590 |
<p>My team has been using SVN for a few years. We now have the option of switching to Perforce.</p>
<p>What would be the benefits (and pitfalls) of making such a switch?</p>
| <ul>
<li>P4 keeps track of your working copy on the server. This means that
<ol>
<li>Large working copies are processed much faster. I used to have a large SVN project and a simple update took 15 minutes because it had to create a tree of the local working copy (thousands of folders). File access is slow. P4 stores th... | <p>The main benefit of using <em>subversion</em> over Perforce is in my opinion <strong>ability to edit things off-line</strong> and simultaneously with your colleagues.</p>
<p>If the data infrastructure is loosely bonded (there is off-line time), svn rocks. You can do a lot even if the server would not be reachable. ... | 19,044 |
<p>I have a co-worker that swears by</p>
<pre><code>//in a singleton "Constants" class
public static final String EMPTY_STRING = "";
</code></pre>
<p>in a constants class available throughout the project. That way, we can write something like</p>
<pre><code>if (Constants.EMPTY_STRING.equals(otherString)) {
...
}... | <p>String literals are interned by default, so no matter how many times you refer to <strong>""</strong> in code, there will only be one empty String object. I don't see any benefit in declaring EMPTY_STRING. Otherwise, you might as well declare ONE, TWO, THREE, FOUR, etc. for integer literals.</p>
<p>Of course, if ... | <p>Hmm, the rules are right but are being taken in a different sense! Lets look at the cause, firstly all object references in java are checked by equals(). Earlier on, in some languages it was done using '==' operator, if by accident someone used '=' for '==', a catastrophe. Now the question of magic numbers/constants... | 26,306 |
<p>Is the real benefit in <code>TDD</code> the actual testing of the application, or the benefits that writing a testable application brings to the table? I ask because I feel too often the conversation revolves so much around testing, and not the total benefits package.</p>
| <p>TDD helps you design your software. The tests becomes the design. By writing the test first you think about your code from a consumer perspective, making a more user friendly and more compact software design.</p>
<p>Also, by applying TDD you typically end up writing your code in a way where you can supply test mock... | <p>Automated testing keeps humans from doing a machine's job.</p>
<p>Test-driven development maximizes the amount of automated testing.</p>
<p>Beyond a certain point, of course, a human is still required. You reach diminishing returns when you try to apply TDD beyond that point.</p>
| 7,376 |
<p>I have some HTML that includes bolding, italics, small tag, big tag, blockquote tag, bullets, and numbered items. I need to convert it to PDF via PHP. I tried FPDF, but it was entirely too complex. I tried the html2pdf PHP library, which uses FPDF, but it was very buggy and unreliable. What do you recommend?</p>
<p... | <p>Take a look at <a href="http://www.fpdf.org/" rel="nofollow noreferrer">FPDF</a> </p>
| <p>I've had a lot of success with <a href="http://www.digitaljunkies.ca/dompdf/" rel="nofollow noreferrer">dompdf</a>.</p>
<p>Make sure you have valid HTML though, or it can get into a loop.
It's very simple to use - about 4 lines to convert an HTML file to a PDF.</p>
| 41,840 |
<p>Curious if others feel the same as me. To me, controls such as datagrid/gridview/formview/etc. are great for presentations or demo's only. To take the time and tweak this controls, override their default behavior (hooking into their silly events etc.) is a big headache. The only control that I use is the repeater,... | <p>Anyone that thinks nobody uses *Grid controls has clearly never worked on an internal corporate webapp.</p>
| <p>i am a moderate level developer i can say without these controls i couldn,t ever learn developing.just you have to admit yourself to it for a while till you find your way to customize it and the end result will be great</p>
| 3,766 |
<p>I have a lot of XML files and I'd like to generate a report from them. The report should provide information such as:</p>
<pre><code>root 100%
a*1 90%
b*1 80%
c*5 40%
</code></pre>
<p>meaning that all documents have a root element, 90% have one <strong>a</strong> element in the root, 80% have one <strong>b</st... | <p>Here's an XSLT 2.0 method.</p>
<p>Assuming that <code>$docs</code> contains a sequence of document nodes that you want to scan, you want to create one line for each element that appears in the documents. You can use <code><xsl:for-each-group></code> to do that:</p>
<pre><code><xsl:for-each-group select="$... | <p>[community post, here: no karma involved;) ]<br>
I propose a <strong><a href="https://stackoverflow.com/questions/172184">code-challenge</a></strong> here:</p>
<p><strong>parse all xml find in xmlfiles.com/examples and try to come up with the following output:</strong></p>
<pre><code>Analyzing plant_catalog.xml:
... | 19,802 |
<p>I don't mind learning xaml and I'm sure I need to be familiar somewhat, but when I was first trying out Silverlight 1 with javascript it looked like a tremendous amount of overhead. I decided to wait until tools matured and asp.net was added. Well, asp.net has been added with Silverlight 2.0, and now I want to loo... | <p>Just as a profressional web developer can't lean on Dreamweaver's drag-and-drop to avoid learning HTML, you should climb the XAML learning curve. </p>
<p>Blend will still help, however- just as many started up the HTML curve by doing some drag-and-drop and studying the resulting HTML code. I did some prototyping ... | <p>Microsoft Expression Blend takes care of a lot of XAML for you and helps you create animations and setting up triggers (XAML triggers). I would hate to have to do all that by hand coded XAML. I have not used Blend with Visual Studio Express but I believe it will work just fine. Microsoft Expression Blend 2 uses the ... | 49,060 |
<p>In <code>.NET</code> (at least in the 2008 version, and maybe in 2005 as well), changing the <code>BackColor</code> property of a <code>DateTimePicker</code> has absolutely no affect on the appearance. How do I change the background color of the text area, not of the drop-down calendar?</p>
<p><strong><em>Edit:</em... | <p>According to <a href="http://msdn.microsoft.com/en-us/library/0625h0ta.aspx" rel="nofollow noreferrer">MSDN</a> : </p>
<blockquote>
<p>Setting the <code>BackColor</code> has no effect on
the appearance of the <code>DateTimePicker</code>.</p>
</blockquote>
<p>You need to write a custom control that extends <cod... | <p>There is a free implementation derived from <code>DateTimePicker</code> that allows you to change <code>BackColor</code> property on change.</p>
<p>See the CodeProject website: <a href="http://www.codeproject.com/KB/selection/DateTimePicker_With_BackC.aspx" rel="nofollow noreferrer"><code>DateTimePicker</code> with... | 24,186 |
<p>For most production sites, you want to know when there has been an error as soon as possible. My question is how best to get this information.</p>
<p>Usually, it's probably best to get the errors in an email as I'm not going to sit every day and watch error logs until there is an error--this would be impossible sin... | <p>Instead of setting a custom error handler, I let the errors go to the error log as usual. I set up a cron that runs periodically and monitors changes in the error log - if it changed, it sends me an email with the changes only. You can improve this process and parse the changes to better suit your needs - for exampl... | <p>Anacron, a cron job that emails changes to the error log* and an error log file should suffice.
The cron job can do all the processing required before sending the email.</p>
| 41,636 |
<p>This is pretty trivial, but I noticed on SO that instead of an offset they are using page numbers. I know the difference is minor (multiply the page number by rows on a page or divide offset by rows on a page), but I'm wondering if one is recommended over the other.</p>
<p>Some sites, like Google, of course use a m... | <p>Use offsets. If you choose to allow variable (or user-defined) number of results per page, the coding is easy.</p>
| <p>Offsets are also useful for optimization when the result set you are paginating is very large.</p>
<p>This is because in some cases it allows you to do a</p>
<pre><code>WHERE my_sortorder >= (some offset)
LIMIT 10
</code></pre>
<p>rather than a</p>
<pre><code>LIMIT 10 OFFSET 880
</code></pre>
<p>which is les... | 40,084 |
<p>What is the difference between this:</p>
<pre><code>this.btnOk.Click += new System.EventHandler(this.btnOK_Click);
</code></pre>
<p>and this?</p>
<pre><code>this.btnOk.Click += this.btnOK_Click;
</code></pre>
<p>They both work. The former is what Visual Studio defaults to when you use the snippets. But it seem... | <p>No difference. Omitting the delegate instantiation is just syntax candy; the C# compiler will generate the delegate instantiation for you under the hood.</p>
| <p>I believe that C# since 3.0 has implicitly added the delegate handler. However, it can help to be more explicit, especially when there are multiple possible delegate types.</p>
| 14,495 |
<p>I've heard the advice that you should avoid try catch blocks if possible since they're expensive.</p>
<p>My question is specifically about the .NET platform: Why are try blocks expensive?</p>
<p><strong>Summary of Responses:</strong></p>
<p>There are clearly two camps on this issue: those that say that try blocks ar... | <p>It's not the block itself that's expensive, and it's not even <em>catching</em> an exception, per se, that's expensive, it's the runtime unwinding the call stack until it finds a stack frame that can handle the exception. Throwing an exception is pretty light weight, but if the runtime has to walk up six stack frame... | <p>Slightly O/T, but...</p>
<p>There is fairly good design concept that says you should never require exception handling. This means simply that you should be able to query any object for any conditions that might throw an exception before that exception would be thrown.</p>
<p>Like being able to say "writable()" be... | 19,899 |
<p>Given a method signature:</p>
<pre><code>public bool AreTheSame<T>(Expression<Func<T, object>> exp1, Expression<Func<T, object>> exp2)
</code></pre>
<p>What would be the most efficient way to say if the two expressions are the same? This only needs to work for simple expressions, by t... | <p>Hmmm... I guess you'd have to parse the tree, checking the node-type and member of each. I'll knock up an example...</p>
<pre><code>using System;
using System.Linq.Expressions;
class Test {
public string Foo { get; set; }
public string Bar { get; set; }
static void Main()
{
bool test1 = Func... | <p>I think most efficiency out of <code>Lambdas</code> you getting when you will use <em>lambda-efficient collection</em> - what I mean is <em>column-based collection</em> that can be enumerated by only one or more selected columns achieving this by implementing <code>IEnumerable</code> on each column separately - let... | 35,953 |
<p>This is my first time using joomla. I don't know if I'm using the concept of a Contact in the wrong way, but I have a Contact Us menu that I've created and I've added the contact details in. I'm looking to add a sentence or two of text above the contact details & the e-mail contact form. There doesn't seem to... | <p>If you really want it above the contact details you have to work with a layout-override. There is no way to do this through the admin backend. In Joomla 1.0 it was only possible with a hack, now in Joomla 1.5 there is the possibility of layout override.</p>
<p><a href="http://docs.joomla.org/How_to_override_the_out... | <p>You can try making your own custom contact form.
You must make the Custom HTML Contact Form and while using sendmail() function of PHP. You will find many PHP based contact forms available online.
Use 'Jumi' Plugin to link the send button with the php code.
Everything works perfectly like it should. I used it to ma... | 44,197 |
<pre><code>var A = {
x : function () { }
};
var b = function (method) {
//want to know method's "parent" here
};
b(A.x);
</code></pre>
<p>I want to know that x is defined in A when I call the b(A.x). Is this possible?</p>
| <p>There's no nice built-in way to do this, because actually there are no methods in Javascript. They are independent Function objects that just happen to be assigned somewhere.</p>
<p>If you create new instance of function every time (e.g. closure) <em>[thanks Matthew Crumley for pointing that out]</em>, then you can... | <p><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function" rel="nofollow noreferrer">Every function in JavaScript is actually a Function object.</a></p>
<pre><code><html>
<body>
<script>
var A = {
x: function (a_a, a_b) { alert(a_a + a_b); }
};
var b = f... | 40,154 |
<p>Is there a way to detect if a flash movie contains any sound or is playing any music?<br>
It would be nice if this could be done inside a webbrowser (actionscript <strong>from another flash object</strong>, javascript,..) and could be done <em>before</em> the flash movie starts playing.</p>
<p>However, I have my do... | <p>Yes, on the server side for sure. Client side? I don't know. (I'm a serverside kind of guy.) </p>
<p>On the server side, one would have to parse the file, read the header and/or look for audio frames. (I've ported a haskel FLV parser to Java for indexing purposes myself, and there are other parsing utilities ou... | <p>With the <a href="https://web.archive.org/web/20080917191415/http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html" rel="nofollow noreferrer">ByteArray</a> you can do pretty much what you want. Before starting playback you can analyze the bytes of the FLV header (use byteArray.readByte... | 6,508 |
<p>Attended an interesting demo on REST today, however, I couldn't think of a single reason (nor was one presented) why REST is in anyway better or simpler to use and implement than a SOAP based Services stack.</p>
<p>What are some of the reasons Why anyone in the "real world" use REST instead of the SOAP based Servic... | <p>Less overhead (no SOAP envelope to wrap every call in)</p>
<p>Less duplication (HTTP already represents operations like DELETE, PUT, GET, etc. that have to otherwise be represented in a SOAP envelope).</p>
<p>More standardized - HTTP operations are well understood and operate consistently. Some SOAP implementatio... | <p>It is super simple and slim. You could do it with browser via http verb: GET.
I haven't find a browser can manually do generic http POST request easily</p>
| 11,582 |
<p>I am trying to make a library that wraps libpurple (you shouldn't need to know anything about libpurple to help here). Libpurple in turn loads "plugins" which are just .so's accessed via something like dlopen. Those plugins in turn call back to functions in libpurple.</p>
<p>I can build my library just fine, but wh... | <p>We see a similar issue with Visual Studio 2005 projects that we want to build both for a Win32 configuration and for a number of distinct smart device platform/configuration combinations.</p>
<p>At arbitrary times, every configuration gets auto-generated for every platform, whether it's valid or not, exploding the ... | <p>You could filter your .sln files in a commit hook of your source control. So that if you check it in the .sln file and possibly the project files get fixed. The open source Chromium project has such a filter implemented.</p>
| 25,436 |
<p>I need to produce a calculation trace file containing tabular data showing intermediate results. I am currently using a combination of the standard ascii pipe symbols (|) and dashes (-) to draw the table lines:</p>
<p>E.g. </p>
<pre><code>Numerator | Denominator | Result
----------|-------------|-------
6 ... | <p>There are <a href="http://www.unicode.org/charts/symbols.html" rel="nofollow noreferrer">Unicode box drawing characters</a> (look for Box Drawing under Geometrical Symbols - the <a href="http://www.unicode.org/charts/PDF/U2500.pdf" rel="nofollow noreferrer">chart itself</a> is a PDF). I don't have any idea how widel... | <p>You should look at this <a href="https://marklodato.github.io/js-boxdrawing/" rel="nofollow noreferrer"><strong>Javascript Box Drawing Demo</strong></a>. This is a JavaScript Unicode box drawing tool whose purpose is to make it easy for users to draw <strong>Unicode box art in HTML textareas</strong>. There you will... | 5,635 |
<p>Like many companies that require all access be through stored procedures, we seem to have a lot of business logic locked away in sprocs. These things are just plain hard to test, and some of them have become silly long. Does anyone out there have a set of best practices that can make it a little easier to confiden... | <p>A colleague swears by the <a href="https://github.com/aevdokimenko/tsqlunit" rel="nofollow noreferrer">TSQLUnit testing framework</a>. May be worth a look for your needs.</p>
| <p>That seems like a terrible policy. Perhaps you can write a stored procedure that executes SQL and begin to transition your code to run through there.</p>
<p>In any case, I would test calling the stored procedures via a traditional automation framework. As the gateway between the application and the data, these sho... | 17,739 |
<p>I am working on an app with an NSTextView. When I paste random bytes into it (say, from a compiled C program) it displays gibberish, as it should. However, when I -setShowsControlCharacters:YES, the same causes a crash and gives the following error multiple times:</p>
<p><code>2008-11-22 00:27:22.671 MyAppName[61... | <p>Another set of useful breakpoints to set when your debugging Cocoa apps are <code>objc_exception_throw</code> and <code>-[NSException raise]</code>. In 10.5, all exceptions travel through <code>objc_exception_throw</code> but if you're targetting Tiger you should set a breakpoint on both.</p>
<p>There are more debu... | <p>It's not really clear how much you know so I'm going to try a very basic approach, please don't be offended.</p>
<p>I'm assuming the NSTextView is in a external nib/xib and is not created programatically.<br />
If so open up your nib/xib in Interface builder and click on the offending NSTextView element.</p>
<p>Then... | 40,088 |
<p>I've got in an ASP.NET application this process :</p>
<ul>
<li>Start a connection</li>
<li>Start a transaction</li>
<li>Insert into a table "LoadData" a lot of values with the SqlBulkCopy class with a column that contains a specific LoadId.</li>
<li>Call a stored procedure that :
<ul>
<li>read the table "LoadData"... | <p>If you mean fields, then no. The compiler injects "this" (<a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.ldarg_0(VS.95).aspx" rel="nofollow noreferrer">ldarg.0</a>) whether you use it explicitly (this.foo) or implicitly (foo).</p>
<p>It does, however, take 5 more characters in your ... | <p>I do not know, if it uses more memory, but I don't think so, its only a clear reference, something that would be done under the hood as well by the compiler.</p>
| 45,940 |
<p>After having looked at each of these two projects, it seems that both are VERY similar. Both run on top of the CLI, both have python style syntax, both use .NET instead of the standard python libraries.</p>
<p>So, what are the differences between them and advantages of each?</p>
| <p>The main difference as I see it is that Boo is statically typed, meaning the type of a variable is inferred on its first assignment and is fixed from there - while IronPython has the "real" dynamic behaviour of normal Python code.</p>
<p>IronPython <strike>is officially maintained by Microsoft now and</strike> targ... | <p>The main difference, in my opinion, is that <a href="http://www.codeplex.com/IronPython" rel="nofollow noreferrer">IronPython</a> is an implementation of a mature language - while <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">Boo</a> is younger and less known. </p>
| 23,562 |
<p>I want to alert the user in a Swing application of certain events with an old fashioned PC Speaker beep (NOT the soundcard), since not on every PC there is a soundcard with an attached speaker, or volume might be turned to zero, or a headphone might be connected... How can I do this?</p>
<p>UPDATE:
java.awt.Toolkit... | <p><code>Toolkit.getDefaultToolkit().beep();</code></p>
| <pre><code> {
If (whatever you named the file) = true
Then
Process.Start ("C:\Windows\Media\{whatever you named the file})
}
</code></pre>
<p>I use that in C#. It's late for me the code is not exactly accurate before people bash this post. Put a write directory to name a folder and declare it th... | 33,878 |
<p>I'd like to calculate the age of the messages in an Exchange mailbox to make sure they sit there for at least a minute before our program (C++, MAPI) processes them. This way the <a href="http://www.cloudmark.com/server/" rel="nofollow noreferrer">spam filter we use</a> should have enough time to do its job.</p>
<p... | <p>I presume you are getting a MAPI event notification when the message arrives in the Exchange mailbox. I would suggest pushing these messages into a queue and waiting <code>n</code> seconds (e.g. 60s) before processing the message. Since the time is relative to the notification event there will be no issue with respe... | <p>You can use <code>PR_MESSAGE_DELIVERY_TIME</code>.</p>
<p>As per <a href="http://msdn.microsoft.com/en-us/library/ms528590(EXCHG.10).aspx" rel="nofollow noreferrer" title="MSDN">MSDN</a>:</p>
<blockquote>
<p>The <code>PR_MESSAGE_DELIVERY_TIME</code> property describes the time the message was stored at the serve... | 21,465 |
<p>Is there anything which can help with msmq monitoring? I'd like to get some event/monit when a message appears in queue and the same on leave.</p>
| <p>Check out the Windows Management Performance counters.</p>
<p>If you look in your Administrative Tools and find "Performance Counters", you will be able to dig through there and find detailed metrics on what is happening on each message queue. This can also work for remote servers.</p>
<p>Should you wish to create... | <p>You can achieve this by using <a href="https://msdn.microsoft.com/en-us/library/ms703197%28v=vs.85%29.aspx" rel="nofollow"><strong>MSMQ</strong> triggers</a></p>
| 5,864 |
<p>Is is possible to configure a server to allow using links with and without using the .aspx extention. </p>
<p>If yes, how could I go about setting this up.</p>
<p>I'm working on a client site who is using umbraco. I know it has built in friendly URL capibility. Unfortunatly the site is already live and turning the... | <p>Scott Guthrie has a good post on this.</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx</a></p>
| <p>Half way down under the section <strong>Completely Controlling the URI</strong> provides links and a number of methods of accomplishing this:
<a href="http://blogs.msdn.com/bags/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/bags/archive/2008/08/22/re... | 17,650 |
<p>I have a SQL script that creates a package with a comment containing an ampersand (&). When I run the script from SQL Plus, I am prompted to enter a substitute value for the string starting with &. How do I disable this feature so that SQL Plus ignores the ampersand?</p>
| <p>This may work for you:</p>
<pre><code>set define off
</code></pre>
<p>Otherwise the ampersand needs to be at the end of a string, </p>
<pre><code>'StackOverflow &' || ' you'
</code></pre>
<p>EDIT: I was click-happy when saving... This was referenced from a <a href="http://blog.andrewbeacock.com/2008/09/usi... | <p>I had a CASE statement with WHEN column = 'sometext & more text' THEN ....</p>
<p>I replaced it with
WHEN column = 'sometext ' || CHR(38) || ' more text' THEN ...</p>
<p>you could also use
WHEN column LIKE 'sometext _ more text' THEN ...</p>
<p>(_ is the wildcard for a single character)</p>
| 14,385 |
<p>i have a windows client and i want to upgrade subversion from 1.5.3 to 1.5.4. are there installation steps. . do i just copy the zip and extract and override the existing directoies .. i can't find any clear upgrade instructions . . </p>
| <p>Which windows client are you using?</p>
<p>TortoiseSVN's upgrade path for me so far has been pretty flawless. You just download the latest installer, run it, and get back to work.</p>
<p>The only time I had an issue was upgrading from 1.4x to 1.5x, you <em>do</em> have to restart the computer after this installati... | <p>I assume you are trying to upgrade the windows commandline client. As far as I know there are 5 major versions of those binaries</p>
<ul>
<li><a href="http://www.collab.net/downloads/subversion/" rel="nofollow noreferrer">Collabnet Subversion downloads</a> [Registration required]</li>
<li><a href="http://subversion... | 41,328 |
<p>Is it possible to get a thread dump of a Java Web Start application? And if so, how?</p>
<p>It would be nice if there were a simple solution, which would enable a non-developer (customer) to create a thread dump. Alternatively, is it possible to create a thread dump programmatically?</p>
<p>In the Java Web Start C... | <p>In the console, press V rather than T:</p>
<pre><code>t: dump thread list
v: dump thread stack
</code></pre>
<p>This works under JDK6. Don't know about others.</p>
<p>Alternative, under JDK5 (and possibly earlier) you can send a full stack trace of all threads to standard out:</p>
<p><em>Under Windows:</em> ... | <p>Since Java 5 you have the getStackTrace() method of Thread class. For prior versions you can do:</p>
<pre><code>Thread.currentThread().dumpStack();
</code></pre>
<p>This will print the stack trace to System.out</p>
| 11,601 |
<p>Is there a way (hacky will do) to allow a user to go back to a previous version of a <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="noreferrer">ClickOnce</a> network deployed application?</p>
<p>I've looked in the docs and API and there seems to be no way. You <b>can</b> selectively choose if you would like ... | <p>You can revert back to an older version on the server side by changing the server manifest file. When the client restarts the application, it will see that it has a different version than what the server says is the 'current' version, and it will download the new one. This server manifest file usually always points ... | <p>I just had to do one of these on my live production server, and it was nice to have all these notes. My solution was a bit different, and I wanted to add this as a fix as well. Before I do a production deployment I always backup the entire containing folder beforehand. I was able to copy my entire folder structure b... | 24,298 |
<p>I'm creating a simple form for a site I manage. I use jQuery for my JavaScript. I noticed a large amount of plugins for jQuery and forms. Does anybody have any favorites that they find especially useful? In particular, plugins to help with validation would be the most useful.</p>
| <p>The jQuery <a href="http://malsup.com/jquery/form/" rel="nofollow noreferrer">Form Plugin</a> is pretty much standard. It handles serializing form fields and AJAX submission.</p>
| <p><a href="http://plugins.jquery.com/project/validate" rel="nofollow noreferrer">Form Validation</a> is one that comes to my mind. I think is being used here in SO.</p>
| 10,496 |
<p>I'm trying to find a way to automate some exception logging code to add to the stack information already available.</p>
<p>Is there any way to use reflection to retrieve the values of all variables on the stack (locals and parameters) - I sincerely doubt the names of the variables are available, but in many cases i... | <p>Not really. For this level of digging you'd probably need something like WinDbg.</p>
<p>If a <em>specific</em> variable is of interest, you can add it to the exception yourself (although even this introduces issues with duplicate keys, re-entrancy, etc):</p>
<pre><code> string dir = ...todo...
try
{
... | <p>You might check out John Robbins' SUPERASSERT (<a href="http://msdn.microsoft.com/en-us/magazine/cc188701.aspx" rel="nofollow noreferrer">SUPERASSERT Goes .Net</a>), his book gives a great walkthrough of one way to do what you are after (plus a WHOLE lot more).</p>
| 32,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.