instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm running an application (web service) in tomcat with TLS enabled (with certificates both for the client and the server).</p> <p>I want that my application will be able to send audit message (logging) when TLS handshake fails. For example I want to log when:</p> <ul> <li>the client certificate is expired,</li> <...
<p>I'm not aware of anything you can add to Tomcat.</p> <p>Put an Apache HTTPD in front and use a separate, configured, SSL log.</p>
<p>Since I spent the past week debugging Tomcat's SSL configuration, I am pretty sure catching <code>javax.net.ssl.SSLHandshakeException</code> in your code and logging it should take care of all three of those errors.</p> <p>When you instantiate a new webservice connection in your application, that is when the except...
33,425
<p>I'm debugging a production application that has a rash of empty catch blocks <em>sigh</em>:</p> <pre><code>try {*SOME CODE*} catch{} </code></pre> <p>Is there a way of seeing what the exception is when the debugger hits the catch in the IDE?</p>
<p>In VS, if you look in the Locals area of your IDE while inside the catch block, you will have something to the effect of $EXCEPTION which will have all of the information for the exception that was just caught.</p>
<p>Can't you just add an Exception at that point and inspect it?</p>
6,097
<p>When running an integration test (Web Service talking to JDBC, in this case) how do you force the database to throw an error so that the resulting soap fault can be inspected?</p> <p>I'm using Spring's Transactional Test Framework, so would be unreasonable to just issue a <code>DROP TABLE whatever;</code> to break ...
<p>In my experience, this is an excellent use for mock objects. Specifically cases where you need to cause a specific failure in order to test how your object, in the case of a unit test, or set of objects, in the case of integration tests, will handle a particular failure. It is better to be in complete control of the...
<p>Would unplugging the database server's network cord be to much? That simulates "database dying" pretty well.</p>
33,134
<p>I am constantly learning new tools, even old fashioned ones, because I like to use the right solution for the problem.</p> <p>Nevertheless, I wonder if there is still any reason to learn some of them. <code>awk</code> for example is interesting to me, but for simple text processing, I can use <code>grep</code>, <co...
<p>I think it depends on the environment you find yourself in. If you are a *nix person, then knowing <code>awk</code> is a Good Thing. The only other scripting environment that can be found on virtually every *nix is <code>sh</code>. So while <code>grep</code>, <code>sed,</code> etc can surely replace <code>awk</code>...
<p>Now that PERL is ported to pretty much every significant platform, I'd say it's not worth it. It's more versatile than sed and awk together. As for auto-splitting, you can do it in perl like this:</p> <pre><code>perl -F':' -ane 'print $F[3],"\n";' /etc/passwd </code></pre> <p>EDIT: you might still want to get <e...
13,304
<p>Trying to print a 3D model for my mobile phone, but I see that when printing the sides, being thin, increases the retraction and the recoil seems a little abrupt and makes a coarse sound.</p> <p>I would like to know if it is possible to know what speed and temperature is recommended to print a model.</p> <p>In my ...
<p>The first indication for print speed and temperature should be taken from the box the filament comes in. Generally it specifies temperature ranges for the hotend and the heated bed. Sometime, mostly online, more parameters can be found amongst which is the printing speed. </p> <p>Do note that temperature and printi...
<p>So as someone else on here mention, those settings shouldn't be for the model but for the filament. Sadly, you will need to test 99% of filaments to really figure this out. I have a modify tester, and on the description it tells you how to set your temp. <a href="https://www.thingiverse.com/thing:3347967" rel="nofol...
1,298
<p>Is there any good bug tracker based on .NET which is free?</p>
<p>Two bug trackers I know:</p> <ul> <li><a href="http://www.ifdefined.com/bugtrackernet.html" rel="noreferrer">BugTracker.NET</a></li> </ul> <blockquote> <p>BugTracker.NET is a free, open-source, web-based bug tracker or customer support issue tracker written using ASP.NET, C#, and Microsoft SQL Server (or...
<p>Some commercial ones will let you use them for free if you're just one developer. <a href="http://www.axosoft.com" rel="nofollow noreferrer">Axosoft</a> will give you a free single user license to their OnTime software. (Although I found it to be overkill for me personally.) <a href="http://www.sourcegear.com/fortre...
23,970
<p>There seems to be no built-in support for case preserving find/replace in VisualStudio (see also a respective <a href="https://developercommunity.visualstudio.com/t/case-preserving-search-replace/580810" rel="nofollow noreferrer">feature request</a>).</p> <p>What I mean is: searching for 'BadJob' and replacing with ...
<p>It's <strong>not possible</strong> in Visual Studio at the moment.</p> <p>You can vote for this feature:</p> <p><a href="https://developercommunity.visualstudio.com/content/idea/580810/case-preserving-search-replace.html" rel="noreferrer">https://developercommunity.visualstudio.com/content/idea/580810/case-preserv...
<p>I know this doesn't answer your question exactly as you asked it, but for renaming variables and method names you can avoid the whole problem by right clicking on the identifier and using the rename option on the shortcut menu. That will update any references to that variable or method name.</p> <p>Caveats: <br/> I...
47,911
<p>I'm having some trouble with this code:</p> <p>CSS: </p> <pre><code>div#header { width: 100%; background-color: #252525; padding: 10px 0px 10px 15px; position: relative; } div#login { float: right; position: absolute; right: 10px; top: 5px; } </code></pre> <p>HTML:</p> <pre><code...
<p>Try removing the 100% width of the header. Since divs are line elements, thats not needed.</p>
<p>Would 'overflow:hidden' on a properly sized container div work?</p>
48,655
<p>During printing, my printer occasionally makes some mystery moves: it will very slowly move either the X or Y axis all the way to the left/front, before very slowly moving back to its original position and resuming the print as normal. I've checked my G-code files, and the moves are definitely not part of the G-code...
<p>The issue was due to a corrupt SD-card, which was occasionally having some garbage read from it. It turns out that Marlin will try interpret a corrupt move command like <code>G0 X1q3.54</code> and still read as many numbers as it can. In this example, it would be interpreted as <code>G0 X1</code> rather than (as mig...
<p>Beides a corrupt SD card that stores worng bits, leading to absurd commands, it's also possible that ithers parts in the Creatin of the file are compromised:</p> <p>This can for example happen if the card is removed during writing - but in this case it should be mostly an incomplete file on importing into an interp...
251
<p>I'm looking to convert a small .NET console application into a Windows Service. I'd like to build two versions, one using .NET 2.0 and another with .NET 3.5 .</p> <p>Are there radically different approaches that need to be taken, or will the 2.0 version be roughly equivalent to the 3.5 version? Where's a good sou...
<p>Actually, .NET 3.5 <em>does</em> change the C# code a <em>little</em>. For example, you can use the var keyword, and you can use the hidden private variables for properties. It is still based on CLR 2.0. </p> <p>There is a pretty good article <a href="http://msdn.microsoft.com/en-us/library/d56de412(VS.80).aspx" ...
<p>Here is <a href="http://tech.pro/tutorial/895/creating-a-simple-windows-service-in-csharp" rel="nofollow">guide</a> to learn about <code>windows service</code>.</p>
33,871
<p>One of my biggest typographical frustrations about HTML is the way that it mangles conjoined whitespace. For example if I have:</p> <pre><code>&lt;span&gt;Following punctuation rules. With two spaces after the period. &lt;/span&gt; </code></pre> <p>One of the two spaces following the period will be considered t...
<p>For your specific example, there is no need to worry about it. Web browsers perform typographical rendering and place the correct amount of space between periods and whatever character follows (and it's different depending on the next character, according to kerning rules.)</p> <p>If you want line breaks, &lt;br/&g...
<p>You'd better use white-space: pre-wrap than white-space: pre or &amp;nbsp; With your example, the latter solutions can start a new line on "rules.&amp;nbsp;" just because your <strong>n</strong>on-<strong>b</strong>reakable <strong>sp</strong>ace hit the end of the line.</p>
3,710
<p>What is the reason for the following warning in some C++ compilers?</p> <blockquote> <p>No newline at end of file</p> </blockquote> <p>Why should I have an empty line at the end of a source/header file?</p>
<p>Think of some of the problems that can occur if there is no newline. According to the ANSI standard the <code>#include</code> of a file at the beginning inserts the file exactly as it is to the front of the file and does not insert the new line after the <code>#include &lt;foo.h&gt;</code> after the contents of the ...
<p>That's not an error. It's just a warning.</p> <p>Open the file in an editor, go to the last line of the file, and hit enter to add a blank line to the end of the file.</p> <p>Though, besides that, you should be using <code>#include &lt;iostream&gt;</code> instead of <code>&lt;iostream.h&gt;</code>. Then put in a <...
9,790
<p>I posted the code below to the Sun developers forum since I thought it was erroring (the true error was before this code was even hit). One of the responses I got said it would not work and to throw it away. But it is actually working. It might not be the best code (I am new to Java) but is there something inhere...
<p>The literal answer is no - there is never anything "inherently wrong" with code, it's a matter of whether it meets the requirements - which may or may not include being maintainable, secure, robust or fast.</p> <p>The code you are running is actually a JET query purely within Access - the Java code is doing nothing...
<p>Question to Joshua McKinnon:</p> <p>Can you provide a citation about MS's plans to never introduce 64-bit ODBC drivers for Jet? This sounds reasonable, so I'm not doubting you at all, I would just like to know if you have a source for it that you can point to.</p> <p>Surely MS <em>is</em> providing access to Jet o...
5,056
<p>I'm trying to create a Users table that only has OpenId registrations, exactly like StackOverflow.</p> <p>I'm storing in the table</p> <ul> <li>OpenId Identifier (their login name)</li> <li>Alias (which is the display name to show to the public)</li> <li>Some other openId stuff</li> </ul> <p>So... I want to make ...
<p>Firefox employs a cache like all modern browsers, so it doesn't load everything on refresh. Different browser engines handle caching somewhat differently, but it mostly depends on the headers you are sending.</p> <p>You should check the w3 page on <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html" rel...
<p>Ctrl-F5 is reload without cache, in IE.<br/>F5 should reload images too, as long as the browser detects that they're changed.</p>
45,213
<p>I include myself in a group of thinkers in this "small" company. In order to gather suggestions and improvement ideas from my development team members, I was put in charge of mounting an Idea/Suggestion Management system.</p> <p>Some of the enjoyable features are:</p> <ul> <li>provide user based (possible anonymou...
<p>Check out <a href="https://www.uservoice.com/" rel="nofollow noreferrer">uservoice.com</a>.</p> <p>Stackoverflow uses it. Try it out for yourself.</p> <p><a href="https://web.archive.org/web/20090219112537/http://stackoverflow.uservoice.com:80/" rel="nofollow noreferrer">http://stackoverflow.uservoice.com</a></p>
<p>I have been using many different software for capturing ideas, uservoice, getsatisfaction e.t.c ... Have you tried <a href="http://hunchbuzz.com/idea-management-software-tools/free/" rel="nofollow">http://hunchbuzz.com/idea-management-software-tools/free/</a> ?</p>
42,174
<p>GNU/Linux text console, X11 not involved, indeed not even installed. Keyboard is US layout, keymap US default. Kernel version 2.20.x or later.</p> <p>An application written in C is getting keyboard input in translation mode, i.e. <code>XLATE</code> or <code>UNICODE</code>. When a key is pressed, the application rec...
<p>Chances are that you are issuing the ioctl commands on the wrong file descriptor, check for error codes coming back from ioctl and tcsetattr.</p> <p>You should be opening the console device, and then issuing your keyboard translation commands on that device. You would have to basically mimic what the X server is ...
<p>At a terminal I entered </p> <pre><code>dumpkeys -f &gt; test.txt </code></pre> <p>and there was a great deal of detailed information, including:</p> <blockquote> <p>keycode 29 = Control<br/> ...<br/> string F1 = "\033[[A"<br/> string F2 = "\033[[B"<br/> string F3 = "\033[[C"<br/> string F4 = "\033[[...
11,605
<p>What is the best way to read an HTTP response from GetResponseStream ?</p> <p>Currently I'm using the following approach.</p> <pre><code>Using SReader As StreamReader = New StreamReader(HttpRes.GetResponseStream) SourceCode = SReader.ReadToEnd() End Using </code></pre> <p>I'm not quite sure if this is the most...
<p>I use something like this to download a file from a URL:</p> <pre><code>if (!Directory.Exists(localFolder)) { Directory.CreateDirectory(localFolder); } try { HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(Path.Combine(uri, filename)); httpRequest.Method = "GET"; // if the URI d...
<p>I faced a similar situation:</p> <p>I was trying to read raw response in case of an HTTP error consuming a SOAP service, using BasicHTTPBinding.</p> <p>However, when reading the response using <code>GetResponseStream()</code>, got the error:</p> <blockquote> <p>Stream not readable</p> </blockquote> <p>So, this...
16,606
<p>ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location.</p> <p>The workaround I'm using is to add the keys from the non-standard location to the agent:</p> <pre><code>ssh-agent ssh-add /path/to/where/keys/really/are/id_rsa </code></pre> <p>(on Linux and ...
<p>If you are only looking to point to a different location for you identity file, the you can modify your ~/.ssh/config file with the following entry:</p> <pre><code>IdentityFile ~/.foo/identity </code></pre> <p><code>man ssh_config</code> to find other config options.</p>
<p>Update for <strong>Git Bash on Windows 10</strong>: on my system, git bash app will work over the ssh layer (brought by <strong>OpenSSH</strong>) look for an environment variable called <strong>HOME</strong> (To Windows key and type in &quot;env&quot; to edit env vars). If this variable points to a place that doesn'...
10,961
<p>I have a table in my database which stores a tree structure. Here are the relevant fields:</p> <pre><code>mytree (id, parentid, otherfields...) </code></pre> <p>I want to find all the leaf nodes (that is, any record whose <code>id</code> is not another record's <code>parentid</code>)</p> <p>I've tried this:</p> ...
<p>Your query didn't work because the sub-query includes <code>NULL</code>. The following slight modification works for me:</p> <pre><code>SELECT * FROM `mytree` WHERE `id` NOT IN ( SELECT DISTINCT `parentid` FROM `mytree` WHERE `parentid` IS NOT NULL) </code></pre>
<p>my table structure is</p> <pre><code>memberid MemberID joiningposition packagetype RPM00000 NULL Root free RPM71572 RPM00000 Left Royal RPM323768 RPM00000 Right Royal RPM715790 RPM71572 Left free RPM323769 RPM71572 Ri...
24,874
<p>Here's a question that's been haunting me for a year now. The root question is how do I set the size of an element relative to its parent so that it is inset by N pixels from every edge? Setting the width would be nice, but you don't know the width of the parent, and you want the elements to resize with the window. ...
<p>The <a href="http://www.hicksdesign.co.uk/journal/3d-css-box-model" rel="nofollow noreferrer">The CSS Box model</a> might provide insight for you, but my guess is that you're not going to achieve pixel-perfect layout with CSS alone.</p> <p>If I understand correctly, you want the parent to be 25% wide and exactly th...
<p>Simply apply some padding to the parent element, and no width on the child element. Assuming they're both <code>display:block</code>, that should work fine.</p>
15,601
<p>I'm generating some xml files that needs to conform to an xsd file that was given to me. How should I verify they conform?</p>
<p>The Java runtime library supports validation. Last time I checked this was the Apache Xerces parser under the covers. You should probably use a <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/Validator.html" rel="noreferrer">javax.xml.validation.Validator</a>.</p> <pre><code>import javax.xml.X...
<p>I had to validate an XML against XSD just one time, so I tried XMLFox. I found it to be very confusing and weird. The help instructions didn't seem to match the interface.</p> <p>I ended up using LiquidXML Studio 2008 (v6) which was much easier to use and more immediately familiar (the UI is very similar to Visual ...
3,656
<p>Is it possible to use oracle instant client for application that use oraoledb driver for connecting to oracle 9i DB.</p>
<p>I don't believe so. The <a href="http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html#A3661" rel="nofollow noreferrer">Instant Client FAQ</a> states</p> <blockquote> <p>What can Instant Client be used for? Instant Client can be used to run your OCI, OCCI, Pro<em>C, JDBC, and ODBC applications wi...
<p>I think it is possible. Look for <a href="http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html" rel="nofollow noreferrer">Oracle Data Access Components (ODAC)</a>. I've downloaded the <em>ODAC XCopy version</em>, then:</p> <ol> <li>unzip on some tmp folder</li> <li>open cmd as administr...
20,079
<p>What are the key differences between Microsoft's SQL Server 2005 and SQL Server 2008? </p> <p>Are there any compelling reasons for upgrading (any edition, as I have a customer with multiple editions)? Or is there a website with either a chart or bullet point comparison of the two servers?</p> <p>Also, is there an...
<ul> <li>Transparent Data Encryption. The ability to encrypt an entire database.</li> <li>Backup Encryption. Executed at backup time to prevent tampering.</li> <li>External Key Management. Storing Keys separate from the data.</li> <li>Auditing. Monitoring of data access.</li> <li>Data Compression. Fact Table size reduc...
<p>There are new <a href="http://www.microsoft.com/sqlserver/2008/en/us/overview.aspx" rel="nofollow noreferrer">features added</a>. But, you will have to see if it is worth the upgrade. Some good <a href="http://www.simple-talk.com/sql/learn-sql-server/management-studio-improvements-in-sql-server-2008/" rel="nofollow ...
24,178
<p>Does anyone know of any gotachs or problems when writing multithreaded Perl applications using the Oracle DBI? Each thread would have it's own connection to Oracle.</p> <p>For the longest time I was told multithreading was not supported in Perl with Oracle.</p>
<p>The Perl DBI enforces single-threading through its interior, so the drivers will only be active on one session (<code>$dbh</code>) at a time. Regardless of how many CPUs you have. So, multi-threading is not supported (because everything inside DBI is single-threaded), but it is safe to use DBI (and hence DBD::Orac...
<p>Yes, using threads in Perl is an extremely bad idea, regardless of whether you use Oracle or not.</p> <p>While in theory, provided each uses its own connection, it should work, <a href="http://www.perlmonks.org/index.pl?node_id=288022" rel="nofollow noreferrer">perl 5.8 threads are fundamentally flawed</a>.</p> <p...
48,390
<p>More than decade passed since first publication of Date's and Darwen's <a href="http://en.wikipedia.org/wiki/The_Third_Manifesto" rel="nofollow noreferrer">"The Third Manifesto"</a> in 1995.</p> <p>What is the place of relational school of thought in today's database world? Is there any evidence that Manifesto's id...
<p>I've seen many discussions over the years about how OODs are supposed to overtake Relational Databases "anytime soon"; that the Relational model is the way of the past; that inertia from the huge installed basis (ehm... <em>legacy</em>) is what holds back progress on OODs. "It's just a matter of time before a 'good-...
<p>I've always dealt with data sets too large to seriously consider the classic "object" model of rendering the data as class with data elements containing all the information and methods to access / manipulate them.</p> <p>I have however found a simple compromise model with .NET datasets. Since they "self buffer" to...
17,236
<p>We have a Java listener that reads text messages off of a queue in JBossMQ. If we have to reboot JBoss, the listener will not reconnect and start reading messages again. We just get messages in the listener's log file every 2 minutes saying it can't connect. Is there something we're not setting in our code or in JBo...
<p>You should implement in your client code javax.jms.ExceptionListener. You will need a method called onException. When the client's connection is lost, you should get a JMSException, and this method will be called automatically. The only thing you have to look out for is if you are intentionally disconnecting from...
<p>Piece of advice from personal experience. <strong>Upgrade to <a href="http://www.jboss.org/jbossmessaging/" rel="nofollow noreferrer">JBoss Messaging</a>.</strong> I've seen it in production for 4 months without problems. It has fully transparent failover - amongst many other features.</p> <p>Also, if you do go ...
6,993
<p>I want in an application with a simple text input, enriched with some marks to include formatting or semantic labeling. I want the syntax as easy as possible and I want to include self-defined labels.</p> <p>Example: [bold]Stackoverflow[/bold] is a [tag]good[/tag] resource for programmers.</p> <p>Tables would be n...
<p>Definitely do NOT invent your own. There are plenty of simple markup languages already, and users HATE learning new ones. Trust me on this!</p> <p>I would suggest using one of the following:</p> <ul> <li><a href="http://www.textism.com/tools/textile/" rel="nofollow noreferrer">Textile</a></li> <li><a href="http:...
<p>Let me add <strong><a href="http://docutils.sourceforge.net/rst.html" rel="nofollow noreferrer">ReStructuredText</a></strong> to the list.</p> <p>An additional benefit of using it is given by the availability of <strong><a href="http://rst2a.com/" rel="nofollow noreferrer">ReStructuredText to Anything</a></strong> ...
35,116
<p>You should be able to create a generic form:</p> <pre><code>public partial class MyGenericForm&lt;T&gt; : Form where T : class { /* form code */ public List&lt;T&gt; TypedList { get; set; } } </code></pre> <p>Is valid C#, and compiles. However the designer won't work and the form will throw a runtime ...
<p>Yes you can! Here's a blog post I made a while ago with the trick:</p> <p><a href="http://www.madprops.org/blog/designing-generic-forms/" rel="noreferrer">Designing Generic Forms</a></p> <p>Edit: Looks like you're already doing it this way. This method works fine so I wouldn't consider it too hacky.</p>
<p>I have a hack to workaround this, which works but isn't ideal:</p> <p>Add a new class to the project that inherits the form with its simple name.</p> <pre><code>internal class MyGenericForm: MyGenericForm&lt;object&gt; { } </code></pre> <p>This means that although the designer is still wrong the expected simp...
3,210
<p>Was this an oversight? Or is it to do with the JVM?</p>
<p>Java does indeed have pointers--pointers on which you cannot perform pointer arithmetic.</p> <p>From the venerable <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.1" rel="noreferrer">JLS</a>:</p> <blockquote> <p>There are two kinds of types in the Java programming language: primitive t...
<p>I guess it has to do with the fact that the JVM is coded in C++. Apart from that, pointers and references are nearly similar. You could say that the reference mechanism in Java is implemented using C++ pointers and the name 'NullPointerException' allows that implementation detail to shine through.</p>
12,644
<p>I'm writing javascript code that is read in as a string and executed via eval() by a firefox extension. Firebug does "see" my script so I am not able to use breakpoints, see objects, etc. </p> <p>I am currently using Firefox's error console which I'm starting to find limiting. What are my other options? Ideally, I ...
<p>I've created an interactive console for debugging Greasemonkey scripts. It requires Google Gears, but it includes a persistent history of commands that were typed.</p> <p><strong>UPDATE</strong>: <a href="http://strd6.com/?p=211" rel="nofollow noreferrer">Here's a link</a> to a blog post describing using GreasyThug...
<p>As far as I know, Firebug supports <code>eval()</code> debugging since 1.1, specifically for GreaseMonkey, you can use <a href="http://wiki.greasespot.net/GM_log" rel="nofollow noreferrer">GM_log</a> for basic logging, you might find useful this tools also:</p> <ul> <li><a href="http://chrispederick.com/work/web-de...
28,723
<p>I have just started migrating my homegrown persistence framework to JPA.</p> <p>Given that the persistence frameworks hide a lot of the plumbing, I'm interested in knowing if NOT closing EntityManagers will create a resource leak, or if the frameworks will collect and close them for me.</p> <p>I intend in all plac...
<p>It depends how you obtained it. </p> <p>If you created it using EntityManagerFactory you will have to close it no matter what framework you use. </p> <p>If you obtained it using dependency injection (eg using EJB and @PersistenceContext annotation) you should not close it by hand (AFAIK it will cause RuntimeExcept...
<p>Justo to give my 5 cents you must remember to close your EntityManagerFactory. I was just using it to create my EntityManager and it opened and kept opend a new conection pool every time.</p>
27,135
<p>I have a model being populated by my data layer and then I have a partial view which is rendering an instance of that model.</p> <pre><code>&lt;li class="&lt;%= td.Active ? "youarehere" : string.Empty %&gt; &lt;%= i == ViewData.Model.Count() - 1 ? "last" : string.Empty %&gt;"&gt; </code></pre> <p>The problem is th...
<p>I'd probably implement the code to render that class attribute in a helper method. Either one specific to this view, or one slightly more generic. That way you have less code in your view and it could handle whether or not to even render the class attribute in the case there's nothing to render.</p>
<p>Alright, so based on Phil's input this is what I have done. It works. Please add a comment if there is any useful feedback that anyone has.</p> <ol> <li><p>I created a HtmlHelper extension method called GenerateAttribute. </p> <pre><code>public static string GenerateAttribute(this HtmlHelper hh, ...
33,034
<p>I have a ComboBox inside of a cell of a DataGridView Row on a Windows form. I need the following to happen: </p> <ol> <li>click on the ComboBox</li> <li>pick a value</li> <li>recalculate a total &amp; display inside of a lable that is sitting outside of the DataGridView.</li> </ol> <p>Currently, the followin...
<p>Add a handler to the CellClick event of the DataGridView that looks a bit like:</p> <pre><code>private void vehicleTypeGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if ( e.RowIndex == - 1 ) return; //Header Cell clicked -&gt; ignore it. vehicleTypeGridView.BeginEdit ( true ); var cont...
<p>First, set your datagridview editmode:</p> <pre><code>datagridview.EditMode = Windows.Forms.DataGridViewEditMode.EditOnEnter </code></pre> <p>Next, set the sendkey to F4 for the combobox:</p> <pre><code>Private Sub datagridview_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGrid...
41,030
<p>I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with the average of 7-8 lettets, alphabet includes 26 latin letters plus "@","$" and "_". ...
<p>If it mattered, assume that your library did it already. Don't mess up your code this way for micro-optimisations unless it really matters.</p>
<p>fire your implementation of STL. It should not matter</p>
22,564
<p>I'm using SimpleDateFormat with the pattern <code>EEE MM/dd hh:mma</code>, passing in the date String <code>Thu 10/9 08:15PM</code> and it's throwing an Unparseable date exception. Why? I've used various patterns with <code>SimpleDateFormat</code> before so I'm fairly familiar with its usage. Maybe I'm missing som...
<p>To test if it's the date format, write a test class to prove it out. For these types of things, I like to use bsh (beanshell). Here was my test:</p> <pre><code>sdf = new java.text.SimpleDateFormat("EEE MM/dd hh:mma"); System.out.println(sdf.format(sdf.parse("Thu 10/9 08:15PM"))); </code></pre> <p>Which outputted...
<p>Try this instead for your pattern:</p> <pre><code>EEE MM/d hh:mma </code></pre> <p>The difference is the single <code>d</code> instead of double <code>dd</code>, since your date is for 10/9 instead of 10/09.</p>
22,334
<p>Coding test-first, I find that perhaps 3/4 of my code is unit tests; if I were truly extreme, and didn't write a line of code except to fix a failing unit test, this ratio would be even higher. Maintaining all these unit tests adds a huge amount of inertia to code changes. Early on, I suck it up and fix them. As ...
<p>I think you've got it the other way around. When implementing a change which could break the unit test you should update the unit tests first. This way you will never get a broken unit test and a working code. You will either have a failing unit test because the code is not ready yet or both parts will work fine.</p...
<p>I guess the idea is to throw unit tests that don't test appropriate behavior anymore away and write new ones. It's also good to write unit-tests in a way that they reflect behavior rather than implementation. So they will be more independent from the design.</p> <p>Generally I'm not an advocate of TDD anyway. :)</p...
25,552
<p>After years of programming it's still some of the simple things that keep tripping me up.</p> <p>Is there a commonly agreed definition of filename ?</p> <p>Even the <a href="http://en.wikipedia.org/wiki/Filename" rel="noreferrer">wikipedia article</a> confuses the two interpretations.</p> <p>It starts by defining...
<p>No references, just vernacular from experience. When I'm being specific I tend to use:</p> <p><code>path</code> or <code>filespec</code> (or file specification): all of the characters needed to identify a file on a filesystem. The path may be <em>absolute</em> (starting from the <em>root</em>, or topmost, direct...
<p><a href="http://java.sun.com/javase/6/docs/api/java/io/File.html#getName()" rel="nofollow noreferrer">Javadoc for File.getName() method</a></p>
35,512
<p>what is a baseline and what is a benchmark? what is the best definition for these and how do you baseline a set of numbers and benchmark another set?</p>
<p>HI Gagneet, I'm on the Windows performance team: here is how we use these terms.</p> <p>A <strong>baseline</strong> is a measurement of a known configuration that is used as a reference for subsequent measurements. For base line, we characterize the thing being measured: lets take cold boot time for example. ...
<p>Correct me if I'm wrong, but I believe "baseline" refers to a known good state, while "benchmark" refers to the current state. You would do a benchmark and compare it to the baseline.</p>
45,122
<p>is it possible to include a servlet in a jsp page? if so how?</p>
<p>To really only copy the data-*, this is quite straightforward:</p> <pre><code>$(destination).data( $(source).data() ); </code></pre> <p>This is because using .data() no arguments will return a key-value object of all pieces of data and vice versa you can also update multiple pieces data at once using a key-value o...
<p>To give another alternative, i.e. instead of cloning the whole object you can copy the data object to a new array containing name/value pairs followingly:</p> <pre><code> function getOriginalElementData(domElementJQueryObject){ var originalElementData = new Array(); $.each(domElementJQueryObject.data(),func...
21,436
<p>I have an ASHX handler that returns an XML response (FileStructureXML.ashx).</p> <p>Now I need to get the XML response from the ASHX handler and use it as a data source for my ASPX page.</p> <p>If I point the XMLDataSource to a static XML file on the server, the treeview populates as expected. However, if I point...
<p>I think that the XmlDataSource only works with an actual file, not a URL. You might be able to work around this by not specifying a DataFile property and loading the Data property dynamically in your code behind. I think the FirstChild.OuterXml selection is correct, but you may need to experiment. I'm not in a pla...
<pre> Dim oDataSet As New DataSet Public Sub PopulateTree(ByVal ParentId As String, ByVal TVNode As TreeNode) Dim oDataView As New DataView(oDataSet.Tables(0), "ParentID='" & ParentId & "'", "DATA", DataViewRowState.OriginalRows) Dim oDataRow As DataRowView For Each oDataRow In oDat...
30,445
<p>I'm working with a support person who is supposed to be able to install SSL certs on a web server he maintains. He has local admin rights to the server via a domain security group. He also has permissions on our internal CA running Windows 2003 Server Certificate Authority: "Request cert" and "Issue and Manage cer...
<p>I had this exact same issue a few months ago when I was setting up a cert for a client.</p> <p>There's a MachineKeys folder that the Administrator need rights -</p> <pre><code>\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys </code></pre> <p>give <strong>Administrator</strong> (...
<p>If you're renewing a certificate, then it's possible that you imported your new intermediate certificate (.pb7) before removing your existing (expired) certificate from IIS. You would get an access denied error because both the old and new certificates are for the same domain.</p> <p>So by the time you get this ac...
9,067
<p>I have a program in Perl I'm working on where I would need multiple keys, and a way of giving each key multiple values and follow that by being able to both read them in and write them out to an external file depending on if the key matches what the person enters into standard input. I've looked across several sites...
<p>Check out <a href="http://search.cpan.org/~ilyam/Data-Dumper-2.121/" rel="noreferrer">Data::Dumper</a>.</p> <p>For instance, this microscopic script:</p> <pre><code>#!/bin/perl -w use strict; use Data::Dumper; my(%hash); $hash{key1} = [ 1, "b", "c" ]; $hash{key2} = [ 4.56, "g", "2008-12-16 19:10 -08:00" ]; prin...
<p>Check out the module <a href="http://search.cpan.org/dist/XML-Simple/lib/XML/Simple.pm" rel="nofollow noreferrer">XML::Simple</a>. It has functions XMLout that turn a hash of arbitrary items into XML and then a function XMLin that does the reverse.</p>
48,850
<p>I have two functions, <code>f</code> and <code>g</code>, which call each other recursively. Unfortunately, when <code>f</code> calls <code>g</code>, it has not yet been declared, so I get an "unbound variable" error. How can I prototype (or whatever the equivalent vocabulary is) this function in SML/NJ?</p>
<p>Use <code>and</code>:</p> <pre><code>fun f x = ... and g x = ... </code></pre> <p>More info <a href="http://www.dcs.napier.ac.uk/~cs66/course-notes/sml/lesson8.htm" rel="noreferrer">here</a>.</p>
<p>Mutual Recursion. Use <strong><code>and</code></strong> instead of <strong><code>fun</code></strong> between the two functions.</p>
16,936
<p>I've been running into a peculiar issue with certain Java applications in the HP-UX environment. </p> <p>The heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA region. Grows quite rapidly ov...
<p>Consider what makes up a Java process.</p> <p>You have:</p> <ul> <li>the JVM (a C program) </li> <li>JNI Data</li> <li>Java byte codes</li> <li>Java data </li> </ul> <p>Notably, they ALL live in the C heap (the JVM Heap is part of the C heap, naturally).</p> <p>In the Java heap is simply Java byte codes and the ...
<p>My only guess with the figures you have given is a memory leak in the Java VM. You might want to try one of the other VMs they listed in the paper you referred. Another (much more difficult) alternative might be to compile the open java on the HP platform.</p> <p>Sun's Java isn't 100% open yet, they are working o...
10,380
<p>I work a lot with network and serial communications software, so it is often necessary for me to have code to display or log hex dumps of data packets.</p> <p>Every time I do this, I write yet another hex-dump routine from scratch. I'm about to do so again, but figured I'd ask here: Is there any good free hex dum...
<p>I often use this little snippet I've written long time ago. It's short and easy to add anywhere when debugging etc...</p> <pre><code>#include &lt;ctype.h&gt; #include &lt;stdio.h&gt; void hexdump(void *ptr, int buflen) { unsigned char *buf = (unsigned char*)ptr; int i, j; for (i=0; i&lt;buflen; i+=16) { ...
<p><a href="http://gd.tuwien.ac.at/linuxcommand.org/man_pages/xxd1.html" rel="nofollow noreferrer">xxd</a> is the 'standard' hex dump util and looks like it should solve your problems</p>
4,889
<p>How would I accomplish displaying a line as the one below in a console window by writing it into a variable during design time then just calling Console.WriteLine(sDescription) to display it?</p> <pre><code> Options: -t Description of -t argument. -b Description of -...
<p>If I understand your question right, what you need is the @ sign in front of your string. This will make the compiler take in your string literally (including newlines etc)</p> <p>In your case I would write the following:</p> <pre><code>String sDescription = @"Options: -t Description of -t argument.";...
<p>The "best" answer depends on where the information you're displaying comes from.</p> <p>If you want to hard code it, using an "@" string is very effective, though you'll find that getting it to display right plays merry hell with your code formatting.</p> <p>For a more substantial piece of text (more than a couple...
40,894
<p>I m using a dropdown to display "Location" field of a table. I want to set first item of dropdowm as "-Select Location-". I can't set tables first record as "Select" because table is stroed in xml format. And table file is generated dynamicaly. I am currentaly using as</p> <pre><code> ddlLocationName.Dispose(); ...
<p>After you have databound, then call ddlLocationName.Items.Insert(0, "Select Location");</p> <p>Example:</p> <pre><code>ddlLocationName.Items.Clear(); ddlLocationName.DataSource = _section.GetLocations(); ddlLocationName.DataBind(); ddlLocationName.Items.Insert(0, "Select Location"); // Adds the item in the first p...
<p>Access the items in the form of ListItems:</p> <pre><code>ListItem li = new ListItem("Select Location","-1"); ddlLocationName.Items.Add(li); </code></pre> <p>After you have bound your other data, use:</p> <pre><code>ddlLocationName.SelectedValue = "-1"; </code></pre> <p>Also, you can add the values of your table...
47,662
<p>Is it possible to create an XML Schema which imposes a co-occurrence constraint to an attribute/element pair?</p> <pre><code>&lt;primitive-list&gt; &lt;primitive name="P1"&gt; &lt;definition&gt;&lt;!-- primitive specification --&gt;&lt;/definition&gt; &lt;/primitive&gt; &lt;primitive name="P2"&g...
<p>After searching on the Internet and digging in some books I figured out how to implement that.</p> <p>First of all we need to define a generic type which accommodates all attributes and elements from both kinds of the <b>primitive</b> element. It is assumed that the <b>definition</b> element is defined somewhere el...
<p>Yes, this is possible. When creating your XML Schema, you will be creating a complex type for each scenario, based on where in the XML tree the element is defined.</p> <p>If I get a moment later on i can try to actually get an example out here for you, I just don't have the time to get it all formatted perfectly f...
41,489
<p>I'm not entirely sure if this is possible, but does anyone know how, or if you can make calls to a SOAP web service from SQL Server? Seems like it might be good performance-wise in the area of data sync applications. I feel like this might be a long shot though.</p> <p>Thanks.</p>
<p>You may want to refer to this stackoverflow question: <a href="https://stackoverflow.com/questions/180046/sql-server-using-clr-integration-to-consume-a-web-service">SQL Server - Using CLR integration to consume a Web Service</a></p>
<p>If you're using SQL Server 2005 or higher, you can call a Web service by creating a CLR Procedure that does the task.</p>
44,897
<p>Can JQuery and YUI live together w/o any conflicts?</p>
<p>Yes. They live in different namespaces, plus jQuery has a <a href="http://docs.jquery.com/Core/jQuery.noConflict" rel="noreferrer">noConflict option</a>.</p>
<p><a href="https://stackoverflow.com/questions/201768/mixing-jquery-and-yui-together-in-an-app-is-it-easily-possible">See also</a></p>
29,114
<p>What's the best way to remove a page frame automatically?</p> <p>I've used this type of code before:</p> <pre><code>&lt;script language="JavaScript"&gt; setTimeout ("changePage()", 3000); function changePage() { if (self.parent.frames.length != 0) self.parent.location="http://www.example.com"; } &lt;/script&gt; </...
<p>Do you mean if someone has put a frame around your content? If so, you need the following any where in your HTML page to jump out of the iframe:</p> <pre><code>&lt;script type="text/javascript"&gt; if (window.top.location != window.location) { window.top.location = window.location; } &lt;/script&gt; </code></pre...
<p>Do it this way if you want the frame-breaking step to not appear in the history</p> <pre><code>if ( self.location !== top.location ) { top.location.replace( self.location ); } </code></pre>
25,112
<p>I have an edit page to edit some info. the page fills a complex object. one of the properties of this object is a generic list.</p> <p>If I just edit information and save, updatemodel works fine. if i remove (I do this using jquery to remove the form elements client side) something from the list the updatemodel fai...
<p>The model binder will try to map your complex object properties retrieving data from:<br> 1) values from the RouteData<br> 2) URI query string<br> 3) request form submission<br> Check this places to see why your property is null. If you're deleting your form elements your property will not receive any data. Some in...
<p>The model binder will try to map your complex object properties retrieving data from:<br> 1) values from the RouteData<br> 2) URI query string<br> 3) request form submission<br> Check this places to see why your property is null. If you're deleting your form elements your property will not receive any data. Some in...
47,391
<p>One of my custom developed <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> sites was hacked today: "Hacked By Swan (Please Stop Wars !.. )" It is using ASP.NET and SQL Server 2005 and IIS 6.0 and Windows 2003 server. I am not using Ajax and I think I am using stored procedures e...
<p>It appears that the attack on your website was part of a mass defacement carried out by SWAN on 21 November, 2008 against Windows 2003 and Windows 2000 boxes running IIS 6.0. Others here have suggested a number of things. I would only add that whenever you decide to bring up the website, please format the box and re...
<p>The first thing you should do is check your log files. You could paste them here,and we'll tell you if we recognize an attack .</p>
39,726
<p>After installing the VSTS Database GDR and importing a SQL Server 2005 database that includes the ASP.NET provider schema tables, I get the following warnings:</p> <p>TSD04151: Procedure: [dbo].[aspnet_Users_DeleteUser] has an unresolved reference to object [dbo].[sysobjects].[name].</p> <p>TSD04151: Procedure: [d...
<p>I'm not sure, but a quick look seems to reveal the following. The offending line in the script seems to be:</p> <p>Line 42 in procedure [dbo].[aspnet_Users_DeleteUser] <strike>(how do you do underscores here?)</strike> <em>(like this: \_ )</em></p> <p>(EXISTS (SELECT name FROM <strong>sysobjects</strong> WHERE (n...
<p>Kim's answer above works perfectly for the situation I asked for. But, I also found out that you can filter the build warnings per file. Look at <a href="http://blogs.msdn.com/gertd/archive/2009/01/11/file-level-build-warning-suppression-in-the-gdr.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/gertd/archiv...
42,979
<p>I have spent lot of time doing research on VIM. I am Windows guy since last 6 yrs and was using VS. Now started working on Linux. I want to make VIM as close as possible to VS. I want features like Project Navigation Files in Different Tabs Search in Project AutoCompletion</p> <p>I have found plugins for the above...
<p>Vim is a very different tool than Visual Studio. Plugins may help you get certain bits of functionality you desire, but do not expect them to work exactly like VS, work well together, or even work at all. </p> <p>If you are looking for a programming environment more like Visual Studio, there are many good graphical...
<p>These plugins used to exist long before vim had tabs. I'd be quite surprised there isn't a way to tune these plugins to split windows instead of opening tabs. Now I can't help you much as I don't use these specific plugins but other ones. You should look at their help (:h project, :h taglist, etc)</p> <p>PS: in vim...
41,381
<p>What is the Worst Case Time Complexity t(n) :- I'm reading this book about algorithms and as an example how to get the T(n) for .... like the selection Sort Algorithm</p> <hr> <p>Like if I'm dealing with the selectionSort(A[0..n-1])</p> <pre><code>//sorts a given array by selection sort //input: An array A[0..n -...
<p>That would be O(n^2).</p> <p>The reason is you have a single for loop nested in another for loop. The run time for the inner for loop, O(n), happens for each iteration of the outer for loop, which again is O(n). The reason each of these individually are O(n) is because they take a linear amount of time given the si...
<p>write pseudo codes to search, insert and remove student information from the hash table. calculate the best and the worst case time complexities</p>
42,919
<p>Can anyone point me in the right direction how to configure Visual Studio 2005 with our C++ console project how we can include a 'File Version' in the details section of the file properties.</p> <p>I've tried resource files without any luck. This is with a C++ project just for clarification, and big thank you for t...
<p>If you are talking about unmanaged c++, you need to add a version resource to the project.</p> <p>right-click on the project, choose add - Resource.... Choose Version and press new. There you can enter all info you need.</p>
<p>Unless you have a good reason for your file version to be different than the version of the assembly inside, I think it is a better idea to provide the <strong>AssemblyVersion</strong> alone. If you do not specify an <strong>AssemblyFileVersion</strong>, it will automatically get the same value, so you can see your ...
39,712
<p>I am having a problem with the speed of accessing an association property with a large number of records.</p> <p>I have an XAF app with a parent class called <code>MyParent</code>.</p> <p>There are 230 records in <code>MyParent</code>.</p> <p><code>MyParent</code> has a child class called <code>MyChild</code>.</p...
<p>Firstly you are right to be sceptical that this operation should take this long, XPO on read operations should add only between 30 - 70% overhead, and on this tiny amount of data we should be talking milli-seconds not seconds.</p> <p>Some general perf tips are available in the DevExpress forums, and centre around o...
<p>Thanks for the answer. I created a separate solution and was able to get good performance, as you suggest.</p> <p>My SQL connection is OK and works with other features in the app.</p> <p>Given that I'm using XAF and not doing anything extra/fancy, aren't my sessions managed by XAF?</p> <p>The session I use is re...
8,786
<p>What are the differences between pipes in Windows and Linux?</p>
<p>One difference that I know of, is that named pipes under Linux are actual entries in the filesystem (you'll see it in a directory listing, they have a special type), whereas on Windows they are stored in some magical repository somewhere (they are all accessed via the path "\\.\pipe\".</p> <p>Secondly, in Linux you...
<p>See also the previous thread:</p> <p><a href="https://stackoverflow.com/questions/175579/what-are-named-pipes#176140">What are named pipes?</a></p> <p>Which contains my take and several other peoples'</p>
23,335
<p>I'd like to take some RTF input and clean it to remove all RTF formatting except \ul \b \i to paste it into Word with minor format information.</p> <p>The command used to paste into Word will be something like: oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0) (with some RTF text already in the Clipboar...
<p>I would use a hidden RichTextBox, set the Rtf member, then retrieve the Text member to sanitize the RTF in a well-supported way. Then I would use manually inject the desired formatting afterwards.</p>
<p>Regex it, it wont parse absolutely everything correctly (tables for example) but does the job in most cases.</p> <pre><code>string unformatted = Regex.Replace(rtfString, @"\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?", ""); </code></pre> <p>Magic =)</p>
4,081
<p>What is the best way to configure Tomcat 5.5 or later to authenticate users from Windows Active Directory?</p>
<p><strong>From <a href="http://www.jspwiki.org" rel="nofollow noreferrer">www.jspwiki.org</a></strong></p> <p>See : <a href="https://web.archive.org/web/20130526124801/http://www.jspwiki.org/wiki/ActiveDirectoryIntegration" rel="nofollow noreferrer">ActiveDirectoryIntegration</a></p> <p>Try this in the server.xml with...
<p>"Welcome to the SPNEGO SourceForge project Integrated Windows Authentication in Java</p> <p>The intent of this project is to provide an alternative library (.jar file) that application servers (like Tomcat) can use as the means for authenticating clients (like web browsers).</p> <p>If your organization is running ...
33,604
<p>I have a bit of code that I need to run in a different thread than the GUI as it currently causes the form to freeze whilst the code runs (10 seconds or so). </p> <p>Assume I have never created a new thread before; what's a simple/basic example of how to do this in C# and using .NET Framework 2.0 or later? </p>
<p>Good place to start reading is <a href="http://www.albahari.com/threading/" rel="noreferrer">Joe Albahari</a>.</p> <p>If you want to create your own thread, this is as simple as it gets:</p> <pre><code>using System.Threading; new Thread(() =&gt; { Thread.CurrentThread.IsBackground = true; /* run your cod...
<p><a href="http://msdn.microsoft.com/en-us/library/3s8xdz5c.aspx" rel="nofollow noreferrer">How to: Use a Background Thread to Search for Files</a></p> <p>You have to be very carefull with access from other threads to GUI specific stuff (it is common for many GUI toolkits). If you want to update something in GUI from...
47,450
<p>I need to find out the position of the TR.</p> <p>Actually, I got the index of the TD which is 291, But I need to get the index of the TR contains the TD.</p> <p>We can get the <code>innerHTML</code> by</p> <pre><code>document.getElementsByTagName(&quot;td&quot;)[291].parentNode.innerHTML.. </code></pre> <p>How to g...
<pre><code>var parent = document.getElementsByTagName("td")[291].parentNode; var index = -1; for (var i = 0; i &lt; parent.childNodes.length; i++) { if (parent.childNodes.item(i) == tr) { index = i; break; } } </code></pre>
<p>I am wondering why you need the index of that node ? </p> <p>You can assign </p> <p>var trNode = document.getElementsByTagName("td")[291].parentNode;</p>
38,729
<p>I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be:</p> <ul> <li>Python is installed in the standard location</li> <li>the package and its dependencies are installed in a separate directory (possibly site-packages)</li> <li>the instal...
<p>Kind of a dup of this question about <a href="https://stackoverflow.com/questions/2933/an-executable-python-app"> how to make a python into an executable</a>. </p> <p>It boils down to: </p> <p><a href="http://www.py2exe.org/" rel="noreferrer">py2exe</a> on windows, <a href="http://wiki.python.org/moin/Freeze" rel=...
<p>py2exe is the best way to do this. It's a bit of a PITA to use, but the end result works very well.</p>
13,232
<p>I have to choose a server pages technology for a few server components that are written in Java and hosted by Tomcat, like Lucene search service and a flex BlazeDS graphic component.</p> <p>Not sure whether to use JSP or PHP.</p> <p>On one hand JSP can integrate with the components Java API easily while PHP will r...
<p>JSP all the way in this situation. Firstly you can choose from myriad different frameworks - Struts and Tiles, Spring, Hibernate, etc, to aid in development.</p> <p>Secondly the speed of development is not that much slower, if at all. In addition many of the frameworks enforce decent MVC coding practices.</p> <p>I...
<p>Given your situation, I would choose for JSP.</p> <p>PHP-applications might be slightly faster to develop, but only if your not used to Java. Intergrating existing components wirtten in Java, are easily intergrated with JSP.</p> <p>PHP is supported more by web-hosting companies, if you're looking for cheap low req...
42,167
<p>Several times in my career, I have worked in a software group that determined that <br><br> a) We needed a build/test system<br> b) We should write our own<br> c) We can have a developer spend a week, get it done and they shouldn't have to touch it again</p> <p>Every time, this has resulted in a system that only se...
<p>Adam,</p> <p>I noticed the Anthill response, and as an Anthiller, I have to say he was right. One of the things that Anthill does real well is let you define dependencies between projects. The open source version is Java focused, while the commercial tool is language agnostic despite the name.</p> <p>It would allo...
<p>Here is a short list of tools that work with .NET and other languages: <a href="http://wewillrulethegalaxytogether.blogspot.com/2008/07/automated-build-tools.html" rel="nofollow noreferrer">Automated Build Tools</a></p>
37,141
<p>Looking for a tool to calculate the # of lines of code in an asp.net (vb.net) application.</p> <p>The tricky part is that it needs to figure out the inline code in aspx files also.</p> <p>So it will be lines of code in vb files (minus comments) plus the inline code in aspx files (not all the lines of aspx files, j...
<p><a href="http://www.slickedit.com/content/view/441" rel="nofollow noreferrer">SlickEdit</a> has some feature for that. I am not sure if it counts inline code. Worth giving it a try. If it does not work, let me know so that I can update my post.</p> <p>The SLOC Report The SLOC Report tool provides an easy way to cou...
<p>I've not tried it myself but <a href="http://www.codeproject.com/KB/macros/LineCounterAddin.aspx" rel="nofollow noreferrer">LineCounterAddin</a> is visual studio plugin that includes the step-by-step guide to it's creation. It supports the formats you're asking about (VB and ASPX) as well as heaps more (e.g. XML, X...
13,820
<p>I am trying to implement string unescaping with Python regex and backreferences, and it doesn't seem to want to work very well. I'm sure it's something I'm doing wrong but I can't figure out what...</p> <pre><code>&gt;&gt;&gt; import re &gt;&gt;&gt; mystring = r"This is \n a test \r" &gt;&gt;&gt; p = re.compile( "\...
<p>Isn't that what Anders' second example does?</p> <p>In 2.5 there's also a <code>string-escape</code> encoding you can apply:</p> <pre><code>&gt;&gt;&gt; mystring = r"This is \n a test \r" &gt;&gt;&gt; mystring.decode('string-escape') 'This is \n a test \r' &gt;&gt;&gt; print mystring.decode('string-escape') This i...
<p>You are being tricked by Python's representation of the result string. The Python expression:</p> <pre><code>'This is \\n a test \\r' </code></pre> <p>represents the string</p> <pre><code>This is \n a test \r </code></pre> <p>which is I think what you wanted. Try adding 'print' in front of each of your p.sub() c...
3,474
<p>I am using a makefile system with the pvcs compiler (using Microsoft Visual C++, 2008 compiler) and I am getting several link errors of the form:</p> <blockquote> <p><code>error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main</code></p> </blockquote> <p>This is happening ...
<p>The <code>__imp_</code> prefix indicates that the linker expects this function to be imported from a DLL.</p> <p>Is the clrdump library from <a href="http://www.debuginfo.com/tools/clrdump.html" rel="noreferrer">this page</a>? If so, note that <code>extern "C"</code> is not used in the header file supplied with the...
<p><strong>Using a .DEF File</strong></p> <p>If you choose to use __declspec(dllimport) along with a .DEF file, you should change the .DEF file to use DATA or CONSTANT to reduce the likelihood that incorrect coding will cause a problem:</p> <pre><code>// project.def LIBRARY project EXPORTS ulDataInDll CONSTANT <...
43,432
<p>I have a 3rd-party library which for various reasons I don't wish to link against yet. I don't want to butcher my code though to remove all reference to its API, so I'd like to generate a dummy implementation of it.</p> <p>Is there any tool I can use which spits out empty definitions of classes given their header ...
<p>This is a harder problem than you might like, as parsing C++ can quickly become a difficult task. Your best bet would be to pick an existing parser with a nice interface.</p> <p>A quick search found <a href="http://compilers.iecc.com/comparch/article/06-09-169" rel="nofollow noreferrer">this thread</a> which has ma...
<p>Create one test application which reads the header file and creates the source file. Test application should parse the header file to know the function names.</p>
27,840
<p>I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions.</p> <p>Note that I am only interested in uploading a single file at a time.</p> <p>Ideally no browser plugin would be required (Flash/Java), althoug...
<h1>File Upload Tutorial</h1> <h2>HTML</h2> <pre><code>&lt;form enctype="multipart/form-data" action="action.php" method="POST"&gt; &lt;input type="hidden" name="MAX_FILE_SIZE" value="1000000" /&gt; &lt;input name="userfile" type="file" /&gt; &lt;input type="submit" value="Go" /&gt; &lt;/form&gt; </code></pre> ...
<p>The main benefit of Flash is it allows you to upload multiple files. The main benefit of Java is it allows drag-and-drop from the file system. Sorry for not answering the central question, but I thought I'd throw that in as it's fairly simple.</p>
24,160
<p>As web based designer who has designed web sites using tables but never with css, how can a novice get started with css?</p> <p><hr/> <strong>Related SO posts</strong></p> <p><a href="https://stackoverflow.com/questions/2084/can-you-recommend-a-good-css-online-resource-or-book">SO - Css Book &amp; website for CSS<...
<p>Get started by reading tutorial web site first. This way, he will see how to create simple CSS and see the benefits.</p> <ul> <li><a href="http://www.w3schools.com/css/" rel="nofollow noreferrer">http://www.w3schools.com/css/</a></li> <li><a href="http://www.echoecho.com/css.htm" rel="nofollow noreferrer">http://ww...
<p>SitePoint have a large amount of tutorials and reference on this. They even have a book that sound like it would answer your question directly!</p> <p>HTML Utopia: Designing Without Tables Using CSS, 2nd Edition</p> <p><a href="http://www.sitepoint.com/books/css2/" rel="nofollow noreferrer">http://www.sitepoint.co...
26,841
<p>I'm trying to find a way to validate a large XML file against an XSD. I saw the question <a href="https://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file">...best way to validate an XML...</a> but the answers all pointed to using the Xerces library for validation. The...
<p>Instead of using a DOMParser, use a SAXParser. This reads from an input stream or reader so you can keep the XML on disk instead of loading it all into memory.</p> <pre><code>SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SAXParser parser =...
<p>SAX and libXML will help, as already mentioned. You could also try increasing the maximum heap size for the JVM using the -Xmx option. E.g. to set the maximum heap size to 512MB: <code>java -Xmx512m com.foo.MyClass</code></p>
6,189
<p>How can I check the version of my script against an online file to see if it's the latest version?</p> <p><em>For clarification, I'm talking about a script I wrote, not the version of PHP. I'd like to incorporate a way for the end user to tell when I've updated the script.</em></p>
<p>To specify the second (more simple) solution <a href="https://stackoverflow.com/questions/236070/php-version-checking#236098">phjr</a> proposed:</p> <p>Have a file <code>version.txt</code> on your own public server and include the following function into your deployed project/script:</p> <pre><code>define('REMOTE_...
<p>Change</p> <pre><code>if($version == $script) </code></pre> <p>to</p> <pre><code>if($version &gt;= $script)` </code></pre>
29,211
<p>Looking for free/opensource code or description of algorithms to code (simple) and decode (hard) the 2D barcode <a href="http://en.wikipedia.org/wiki/QR_Code" rel="noreferrer">QR code</a>.</p> <p>It doesn't seem like a trivial problem, but it's so popular in Japan that there must be something already available...</...
<p>I have a colleague who worked on <a href="http://code.google.com/p/zxing/" rel="noreferrer">ZXing</a> ("Zebra Crossing").</p> <p>That's got a fair variety of platform support.</p>
<p>You can try python-qrtools: <a href="https://launchpad.net/qr-tools" rel="nofollow">https://launchpad.net/qr-tools</a> It uses qrencode for generating and zbar for decoding (from webcam or a file ;-)</p>
28,687
<p>Which tools do you use to convert between C# and VB.NET?</p>
<p>Check out <a href="http://converter.telerik.com/" rel="noreferrer">Code Converter</a> by Telerik.</p>
<p>Tangible has C++ &lt;> C#, Java &lt;> C#, VB &lt;> C# etc. I'm not sure how to quantify which is "best" but their support is responsive if there's a bug.</p>
12,855
<p>I broke one of the blades of the fan and that's making the x-box vibrate. Other than that it works fine and I can still print at a very low flow rate and a lot of noise. Will replacing the blades, not the whole fan work?</p> <p>Found this and how to replace on thingyverse:</p> <p><a href="https://www.thingiverse.c...
<p>It will work, but likely with reduced performances: designing blades is not an easy task and the ones you can print will not be as good as the ones designed for that specific fan.</p> <p>Overall, do it for fun before you replace the fan anyway.</p> <p>IF your fan has symmetrical blades (unlikely), another option i...
<p>If you want to <strong>play</strong> then print new blades; if you want to <strong>print</strong> then swap the fan - but pay attention to: Voltage, current draw, rpm, fan thickness, etc. </p> <p>Note: most fans are built to be disposable/replaceable. They are never built to be repaired, and as yet, nobody has succ...
1,682
<p>This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check:</p> <p>Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order.</p> <p>ADDED: I indeed had the wrong version of cocoAspell. But installing the right version ...
<p>I believe you have the wrong version of the coco interface to Aspell for your mac.</p> <p>Check this site and download the appropriate version (PowerPC/Intel): <a href="http://people.ict.usc.edu/~leuski/cocoaspell/" rel="nofollow noreferrer">http://people.ict.usc.edu/~leuski/cocoaspell/</a></p>
<p>I'm not sure, but this page seems similar: <a href="http://www.emacswiki.org/cgi-bin/wiki/AquamacsFAQ" rel="nofollow noreferrer"><a href="http://www.emacswiki.org/cgi-bin/wiki/AquamacsFAQ" rel="nofollow noreferrer">http://www.emacswiki.org/cgi-bin/wiki/AquamacsFAQ</a></a> (search for "format" on that page to find th...
16,655
<p>I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow the user to select a particular value. ...
<p>You can also make a 'widget' interface for the drop down. I'll give you an easy example of a some working code for a TextBox widget so you get the idea.</p> <pre><code>public interface ITextWidget { event EventHandler TextChanged; string Text { get; set; } } public abstract class TextWidget&lt;T&gt; : ITex...
<p>When controller-view interation get's too complex I usually split them up into subcontrollers and subviews.</p> <p>You can have the items in the repeater be user-controls that have their own views and controllers. Your main view can then have a list of subviews(usercontrols) that have their own controllers that are...
33,761
<p>I am launching a child process with ProcessBuilder, and need the child process to exit if the parent process does. Under normal circumstances, my code is stopping the child properly. However, if I cause the OS to kill the parent, the child will continue running.</p> <p>Is there any way to "tie" the child process ...
<p>There is no tie between a child process and its parent. They may know each others process ID, but there's no hard connection between them. What you're talking about a <a href="http://en.wikipedia.org/wiki/Orphan_process" rel="noreferrer">orphan process</a>. And it's an OS level concern. Meaning any solution is proba...
<p>As I tested, if the parent is killed, then the ppid of a child will become 1. So probably we can kill any processes that have ppid = 1.</p>
33,853
<p>I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet.</p> <p>The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The problem is that the code...
<p>You should really use a fixed-width field for your length.</p> <ul> <li>When the program on the receiving end has to read the length field of your packet, how does it know where the length stops?</li> <li>If the length of a packet can potentially reach 4 GB, does a 1-3 byte overhead really matter?</li> <li>Do you s...
<p>Try this loop:</p> <pre><code>{ extern char byte_stream[]; int bytes = offset_in_packet; int n = length_of_packet; /* Under 4 billion, so this can be represented in 32 bits. */ int t; /* 32-bit number used for temporary storage. */ int i; unsigned char curByte; for (i = 0; i &lt; 4; i+...
5,538
<p>I am trying to encrypt the "system.web.membership" element within the Web.Config of our .Net application to secure username and password to Active Directory. I am using the aspnet_regiis command to encrypt, and have tried several different strings for the value of the "pe" option with no success. I have successfully...
<p>The configuration section is identified by "<code>system.web/membership</code>", not "<code>membership</code>" nor "<code>system.web.membership</code>".</p>
<p>I know that your issue has already been solved, but for other people getting this error message, it seems that only certain sections of the web.config can be encrypted. I was trying to encrypt the SMTP settings in my web config:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;system.net&gt; ...
16,304
<p>So essentially does margin collapsing occur when you don't set any margin or padding or border to a given div element?</p>
<p>No. When you have two adjacent vertical margins, the greater of the two is used and the other is ignored.</p> <p>So, for instance, if you have two block-display elements, A, followed by B beneath it, and A has a bottom-margin of 3em, while B has a top-margin of 2em, then the distance between them will be 3em.</p> ...
<blockquote> <p>"the expression collapsing margins means that adjoining margins (no non-empty content, padding or border areas or clearance separate them) of two or more boxes (which may be next to one another or nested) combine to form a single margin."</p> </blockquote> <p>Source: <a href="http://www.w3.org/TR/CSS...
12,827
<p>I'm trying to open a new browser tab with the results of a POST request. I'm trying to do so using a function containing the following code:</p> <pre><code>var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interface s.nsIWindowMediator); var browserWindow ...
<p>Something which is less Mozilla specific and should work reasonably well with most of the browsers:</p> <ul> <li>Create a hidden form with the fields set up the way you need them</li> <li>Make sure that the "target" attribute of the form is set to "_BLANK"</li> <li>Submit the form programatically</li> </ul>
<p>try with addTab instead of loadOneTab, and remove the last parameter. </p> <p>Check out <a href="http://developer.mozilla.org/en/Code_snippets/Tabbed_browser" rel="nofollow noreferrer">this page</a> over at the Mozilla Development Center for information on how to open tabs. </p> <p>You could use this function, for...
5,684
<p>I have a problem most likely very similar to some reported by other users: extruder stepper is visually skipping a step from time to time. It rapidly rotates in the direction opposite to the one it is supposed to rotate.</p> <p>I noticed the following:</p> <ul> <li>The extruder stepper jumps totally randomly - there...
<p>In agreement with what Akriss said, pretty much all &quot;super&quot; glue is CA (cyanoacrylate) glue, which is soluble in acetone. PLA itself is does not dissolve in or react with acetone, but the pigments, additives, etc. likely do, so you should wipe with a paper towel or cloth (the latter might be better to avoi...
<p>I've used Acetone before. However that said I've not had the need to remove it from PLA. Not sure how PLA reacts to Acetone.</p> <p>A link that may be of use. <a href="https://www.art-us.com/how-to-get-super-glue-off-almost-anything/" rel="nofollow noreferrer">https://www.art-us.com/how-to-get-super-glue-off-almost-...
1,800
<p>I'm introducing Subversion into our web shop. I want to want the checked in files to be uploaded into the server via FTP (and as they get use to Subversion, via SFTP). The files are sent to a release candidate page for testing purposes. A script can be called to move the files into production.</p> <p>My question is...
<p>If you have shell access to your sever, and SVN installed on it (or the ability to install SVN), then your best bet may be just to bypass FTP entirely.</p> <p>How we deploy our apps is (simplified)</p> <ul> <li>Developers write code and check it into trunk</li> <li>Periodically, when trunk is stable, we will take ...
<p>I second Orion's idea. If you've got shell access to the server, it's actually extremely easy to use Subversion itself as the deployment tool. Just make sure you have some web server rules set up so that you don't accidentally expose the .svn directories.</p>
3,496
<p>Below are lines from "the c++ programming language"</p> <pre><code>template&lt;class T &gt; T sqrt(T ); template&lt;class T &gt; complex&lt;T&gt; sqrt(complex&lt;T&gt;); double sqrt(double); void f(complex&lt;double&gt; z ) { s q r t (2 ); // sqrt&lt;int&gt;(int) sqrt(2.0) ; // sqrt(double) sqrt(z) ; // sqrt&lt;dou...
<p>Well, the function used is the one you are talking about <code>sqrt&lt;double&gt;(complex&lt;double&gt;)</code> is an instance of the template <code>template &lt;class T&gt; complex&lt;T&gt; sqrt(complex&lt;T&gt;)</code>.</p> <p>Your misunderstanding was in the signification of the template instance and not in the ...
<p>Well, the function used is the one you are talking about <code>sqrt&lt;double&gt;(complex&lt;double&gt;)</code> is an instance of the template <code>template &lt;class T&gt; complex&lt;T&gt; sqrt(complex&lt;T&gt;)</code>.</p> <p>Your misunderstanding was in the signification of the template instance and not in the ...
26,788
<p>After reading <a href="https://stackoverflow.com/questions/28832/java-and-manually-executing-finalize">this question</a>, I was reminded of when I was taught Java and told never to call finalize() or run the garbage collector because "it's a big black box that you never need to worry about". Can someone boil the rea...
<p>The short answer: Java garbage collection is a very finely tuned tool. System.gc() is a sledge-hammer.</p> <p>Java's heap is divided into different generations, each of which is collected using a different strategy. If you attach a profiler to a healthy app, you'll see that it very rarely has to run the most expens...
<p>The GC does a lot of optimization on when to properly finalize things.</p> <p>So unless you're familiar with how the GC actually works and how it tags generations, manually calling finalize or start GC'ing will probably hurt performance than help.</p>
4,860
<p>How can I access the WCF Service through JavaScript? My problem is, I have to access the operation contracts through the JavaScript (my website is not Ajax enabled).<br> Previously for calling .asmx web services, I am using the following code snippet</p> <pre><code>var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")...
<p>By using XMLHTTP you ARE using ajax.</p> <p>There's a full example here:</p> <p><a href="http://www.west-wind.com/weblog/posts/324917.aspx" rel="nofollow noreferrer">jQuery AJAX calls to a WCF REST Service</a></p>
<p>Look at the code on the link that I have sent before. Sure U can implement it yourself but it well be a huge effort duplication.</p> <p>First, your WCF service must have:</p> <pre><code>[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] </code></pre> <p>Then, on the ...
36,006
<p>as it is currently, there are several <a href="https://3dprinting.stackexchange.com/questions/tagged/diy-3d-printer" class="post-tag" title="show questions tagged &#39;diy-3d-printer&#39;" rel="tag">diy-3d-printer</a> questions that gave info about a specific printer. While I tried to add the appropriate names for t...
<p>To me, the dividing line between "DIY" and "not DIY" is who you deal with if a part is defective when you get it.</p> <p>If you're contacting different vendors for a jammed bearing, a miswired stepper motor, or a dead controller board, it's DIY. If you talk to the same person regardless of which part is defective ...
<p>It got too long to fit in a comment:</p> <p>That does seem sort of reasonable. A DIY printer should be one that has been sourced from various parts. Or should that also include (or be exclusively) DIY designs? I mean, DIY means Do It Yourself, so a commercial kit, is literally a DIY printer, even though it is follo...
50
<p>I'd like my program to read the cache line size of the CPU it's running on in C++.</p> <p>I know that this can't be done portably, so I will need a solution for Linux and another for Windows (Solutions for other systems could be usefull to others, so post them if you know them).</p> <p>For Linux I could read the c...
<p>On Win32, <a href="http://msdn.microsoft.com/en-us/library/ms683194.aspx" rel="noreferrer"><code>GetLogicalProcessorInformation</code></a> will give you back a <a href="http://msdn.microsoft.com/en-us/library/ms686694.aspx" rel="noreferrer"><code>SYSTEM_LOGICAL_PROCESSOR_INFORMATION</code></a> which contains a <a hr...
<p>I think you need <a href="http://msdn.microsoft.com/en-us/library/ms724509(VS.85).aspx" rel="nofollow noreferrer"><code>NtQuerySystemInformation</code></a> from <code>ntdll.dll</code>.</p>
18,110
<p>I broke up my electronics and now the output for X is not working. The stepper is OK. </p> <p>There is any simple solution to remap the output pins? I want the E1 output to act as the X output.</p>
<p>When using <a href="http://marlinfw.org/" rel="noreferrer">Marlin firmware</a> you could easily change the pin layout of the extra extruder (E1) with the broken X stepper pins by changing the <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/pins_RAMPS.h" rel="noreferrer">pins_RAMPS.h</a> file.</p>...
<p>you can find pin.h in marlin directory and in pin.h file change # define pinout of z motor and extruder motor</p>
581
<p>I'm preparing to deploy my Django app and I noticed that when I change the "DEBUG" setting to False, all references to static files (i.e., JavaScript, CSS, etc..) result in <code>HTTP 500</code> errors.</p> <p>Any idea what's causing that issue (and how to fix it)?</p>
<p>I would highly recommend letting your web server handle the static requests, without getting to Django. In my <code>urls.py</code>, I only add the static request handler when debug is set to True.</p> <p>Technically, Django serving the static works fine though. Definitely read the short docs page, <a href="http://d...
<p>You must also check your URLs all over the place. When the DEBUG is set to False, all URLs without trailing "/" are treated as a bug, unlike when you have DEBUG = True, in which case Django will append "/" everywhere it is missing. So, in short, make sure all links end with a slash EVERYWHERE.</p>
14,823
<p>I'm having trouble with the following two items:</p> <ul> <li>How to retrieve all of the subkey values in ClassesRoot\Typelib, and;</li> <li>How to find a match for a known value (path/dll name) in the array of subkey values.</li> </ul> <p>As background info, I'm trying to find a way to check if a DLL has been reg...
<p>I've not tested it extensively and it has very little error handling code, but this should help you start.</p> <pre><code>public static bool IsRegistered(string name, string dllPath) { RegistryKey typeLibKey = Registry.ClassesRoot.OpenSubKey("TypeLib"); foreach (string libIdKeyName in typeLibKey.GetSubKeyNa...
<p>Have a look at Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey.</p> <pre><code>public void Foo() { foreach (string s in Microsoft.Win32.Registry.CurrentUser.GetSubKeyNames()) { Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(s); // check here for the dll v...
48,079
<p>An example of what I'm talking about:</p> <pre><code>class Person &lt; ActiveRecord::Base def name=(name) super(name.capitalize) end def name super().downcase # not sure why you'd do this; this is just an example end end </code></pre> <p>This seems to work, but I was just read the section on overr...
<p>Echoing Gareth's comments... your code will not work as written. It should be rewritten this way:</p> <pre><code>def name=(name) write_attribute(:name, name.capitalize) end def name read_attribute(:name).downcase # No test for nil? end </code></pre>
<p>I have a rails plugin that makes attribute overriding work with super as you would expect. You can find it on <a href="http://github.com/chriseppstein/has_overrides" rel="nofollow noreferrer">github</a>.</p> <p>To install:</p> <pre><code>./script/plugin install git://github.com/chriseppstein/has_overrides.git </co...
48,871
<p>Does my question make sense? Using either Vim or Emacs, you come to understand that the interface exposes the code's representation of the state of the file you are editing in the buffer, the file is the on-disk storage you can fill a buffer from or write a buffer to. All these things a programmer would know, but wh...
<p>For starters, Emacs uses plenty of buffers that aren't associated with any file. Any time you open a directory, read your mail, open a terminal, compile a program, launch an interactive Python session, or connect to a database, you get a buffer. Hence, Emacs's basic unit of work is a buffer and not a file, and the...
<p>Because developers of those editors didn't care to hide implementation details from users. </p>
23,749
<p>Is there a command-line approach for having VS 2008 remove TFS source control bindings from a solution file and the constituent project files? I need something that I can run from a batch file so that I don't have to open the solution and click the 2 prompts to permanently remove the bindings.</p> <p>Edit: After d...
<p>A colleague wrote this NAnt task to do it</p> <p><a href="http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/21/2custom-nant-task-for-removing-tfs-bindings.aspx" rel="nofollow noreferrer">http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/21/2custom-nant-task-for-removing-tfs-bindings.aspx</a></p>
<p>Try deleting the *.vspscc file.</p>
19,403
<p>I'll simplify the problem as much as possible:</p> <p>I have an oracle table:</p> <pre><code>row_priority, col1, col2, col3 0, .1, 100, {null} 12, {null}, {null}, 3 24, .2, {null}, {null} </code></pre> <p>Desired result:</p> <pre><code>col1, col2, col3 .2, 100, 3 </code></pre> <p>So according to the priority of...
<p>You need to put rownum = 1 OUTSIDE the analytical query</p> <pre><code>SELECT * FROM ( select last_value(col1 ignore nulls) over () col1, last_value(col2 ignore nulls) over () col2, last_value(col3 ignore nulls) over () col3 from (se...
<p>The COALESCE function may be of help to you here. Perhaps like ...</p> <pre><code>select first_value(coalesce(col1,0) ignore nulls) over () col1, first_value(coalesce(col2,0) ignore nulls) over () col2, first_value(coalesce(col3,0) ignore nulls) over () col3 from THE_TABLE </code></pre>
32,762
<p>If I have 2 DataTables (dtOne and dtTwo) and I want to merge them and put them in another DataTable (dtAll). How can I do this in C#? I tried the Merge statement on the datatable, but this returns void. Does Merge preserve the data? For example, if I do:</p> <pre><code> dtOne.Merge(dtTwo); </code></pre> <p>Doe...
<p>The <code>Merge</code> method takes the values from the second table and merges them in with the first table, so the first will now hold the values from both.</p> <p>If you want to preserve both of the original tables, you could copy the original first, then merge:</p> <pre><code>dtAll = dtOne.Copy(); dtAll.Merge(...
<p>This is what i did for merging two datatables and bind the final result to the gridview</p> <pre><code> DataTable dtTemp=new DataTable(); for (int k = 0; k &lt; GridView2.Rows.Count; k++) { string roomno = GridView2.Rows[k].Cells[1].Text; DataTable dtx = GetRoomDetails...
36,239
<p>I'm trying to test if a given default constraint exists. I don't want to use the sysobjects table, but the more standard INFORMATION_SCHEMA.</p> <p>I've used this to check for tables and primary key constraints before, but I don't see default constraints anywhere.</p> <p>Are they not there? (I'm using MS SQL Serve...
<p>As I understand it, default value constraints aren't part of the ISO standard, so they don't appear in INFORMATION_SCHEMA. INFORMATION_SCHEMA seems like the best choice for this kind of task because it is cross-platform, but if the information isn't available one should use the object catalog views (sys.*) instead o...
<p>I don't think it's in the INFORMATION_SCHEMA - you'll probably have to use sysobjects or related deprecated tables/views.</p> <p>You would think there would be a type for this in INFORMATION_SCHEMA.TABLE_CONSTRAINTS, but I don't see one.</p>
17,126