instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is there a good user interface for authoring Oracle SQL Loader control files? PL/SQL Developer includes a "Text Importer" feature (that reminds one of the Excel import wizard) to import text files into tables, but uses a proprietary format instead of the SQL Loader format. Something like this for the SQL Loader form...
<p>TOAD has an interface to do SQL*Loads, it can generate the control files too...</p> <p><a href="http://www.toadsoft.com/get2know9/#Loader" rel="nofollow noreferrer">http://www.toadsoft.com/get2know9/#Loader</a></p>
<p>The TOAD answer is probably the best at present. However, in trying out the TOAD SQL Loader wizard, I was disappointed at the level of usability. It assumed that I had a pre-existing table to load the data into. I was looking for something that would let me first</p> <ul> <li>locate columns in the fixed-width input...
14,408
<blockquote> <p>It turns out this whole misunderstanding of the open() versus fopen() stems from a buggy I2C driver in the Linux 2.6.14 kernel on an ARM. Backporting a working bit bashed driver solved the root cause of the problem I was trying to address here.</p> </blockquote> <p>I'm trying to figure out an issue ...
<p>You have two choices:</p> <ol> <li><p>Use <code>fileno()</code> to obtain the file descriptor associated with the <code>stdio</code> stream pointer</p></li> <li><p>Don't use <code>&lt;stdio.h&gt;</code> at all, that way you don't need to worry about flush either - all writes will go to the device immediately, and f...
<p>If you want to go the other way round (associate FILE* with existing file descriptor), use fdopen() :</p> <pre><code> FDOPEN(P) NAME fdopen - associate a stream with a file descriptor SYNOPSIS #include &lt;stdio.h&gt; FILE *fdopen(in...
32,398
<p>In EL expressions, used in a jsp page, strings are taken literally. For example, in the following code snippet</p> <pre><code>&lt;c:when test="${myvar == 'prefix.*'}"&gt; </code></pre> <p>test does not evaluate to true if the value of myvar is 'prefixxxxx.' Does anyone know if there is a way to have the string ...
<p>While this special case can be handled with the JSTL <code>fn:startsWith</code> function, regular expressions in general seem like very likely tests. It's unfortunate that JSTL doesn't include a function for these.</p> <p>On the bright side, it's pretty easy to write an EL function that does what you want. You need...
<p>for using Pattern.matches inside a jsp page in my case it was enough to call java.util.regex.Pattern.matches(regexString,stringToCompare) because you can't import package in jsp</p>
37,886
<p>In Groovy, how do I grab a web page and remove HTML tags, etc., leaving only the document's text? I'd like the results dumped into a collection so I can build a word frequency counter.</p> <p>Finally, let me mention again that I'd like to do this in Groovy.</p>
<p>Assuming you want to do this with Groovy (guessing based on the groovy tag), your approaches are likely to be either heavily shell-script oriented or using Java libraries. In the case of shell-scripting I would agree with moogs, using Lynx or Elinks is probably the easiest way to go about it. Otherwise have a look a...
<p>You can use the <a href="http://en.wikipedia.org/wiki/Lynx_web_browser" rel="nofollow noreferrer">Lynx Web Browser</a> to spit out the document text and save it.</p> <p>Do you want to do this automatically? Do you want a separate application that does this? Or do you want help coding it into your application? What ...
25,413
<p>I have a question about using <code>os.execvp</code> in Python. I have the following bit of code that's used to create a list of arguments:</p> <pre> args = [ "java" , classpath , "-Djava.library.path=" + lib_path() , ea , "-Xmx1000m" , "-server" , "code_swarm" , par...
<p>If your "classpath" variable contains for instance "-classpath foo.jar", it will not work, since it is thinking the option name is "-classpath foo.jar". Split it in two arguments: [..., "-classpath", classpath, ...].</p> <p>The other ways (copy and paste and system()) work because the shell splits the command line ...
<p>Make sure you aren't relying on shell expansion in your classpath. E.g. "~/my.jar" will get expanded by the shell in an os.system call, but not, I believe in an os.execvp call.</p>
25,906
<p>Is it possible to use system.currency. It says system.currency is inaccessible due to its protection level. what is the alternative of currency.</p>
<p>You have to use <a href="http://msdn.microsoft.com/en-us/library/364x0z75.aspx" rel="noreferrer">Decimal</a> data type..</p> <p>The decimal keyword indicates a 128-bit data type. Compared to floating-point types, the decimal type has more precision and a smaller range, which makes it appropriate for financial and m...
<p>You can't actually use Decimal for Currency. You'll face bigger problems later on when you divide. Say if you have $1 split into 3 which is 1/3 = 0.33(rounded), but 3 x 0.33 = 0.99 != 1. It might be small, but when you do that in accounting ans stack up your sheets, it will be a huge figure. Also that's why the defa...
18,235
<p>Is there anything similar to rails' scaffolding for pylons? I've been poking around google, but only found this thing called dbsprockets, which is fine, although probably way too much for my needs. What I really need is a basic CRUD that is based on the SQLAlchemy model.</p>
<p>The question is super old, but hell: <a href="http://code.google.com/p/formalchemy/" rel="noreferrer">http://code.google.com/p/formalchemy/</a></p> <p>Gives you basic crud out of the box, customizable to do even relatively complex things easily, and gives you a drop-in Pylons admin app too (written and customizable...
<p>Just updating an old question. DBSprockets has been replaced by <a href="http://sprox.org/" rel="nofollow noreferrer">sprox</a> which learns a lot of lessons from it and is pretty cool.</p> <p>It isn't quite the throwaway 'scaffolding' that Rails provides, it is more like an agile form generation tool that is highl...
5,529
<p>ASP.NET 2.0 web application, how to implement shortcut key combination of <kbd>CTRL + Letter</kbd>, preferably through JavaScript, to make web application ergonomically better? How to capture multiple-key keyboard events through JavaScript?</p>
<p>Your event listener function, gets passed an Event object. That has a lot of useful information on it, including the properties "altKey", "ctrlKey", "shiftKey" and "metaKey". If any of the modifier keys are being held down when that event fires, the corresponding property is set to true.</p> <p>This applies to keyb...
<p>I know this is not answering the orginal question, but here is my advice: Don't Use Key Combination Shortcuts In A Web Application!</p> <p>Why? Because it might break de the usability, instead of increasing it. While it's generally accepted that "one-key shortcut" are not used in common browsers (Opera remove it as...
9,043
<p>I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's site but all the info about flex, flash, ability to coding in HTML/ActionScript is overwhelming and confusing. I cannot ...
<p>If you needs to access a lot of native libraries, you'll need to stay within your QT environment. Keep in mind that AIR is single-threaded and is run on the Flash Player (something that was originally designed for frame-based animations.) However, depending on the style of application you're building, AIR might su...
<p>I'll second @<a href="https://stackoverflow.com/questions/316826/cqt-vs-adobe-air#316884">Pieter</a>'s comment - if you already know QT, moving to a whole new environment is going to take a LOT longer.</p> <p>QT has the advantage of being cross-platform, and very mature: there are libraries for Windows, Linux, and ...
40,911
<p>My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time. </p> <p>Windows doesn't have a built-in equivalent to the Unix <strong>cron</strong> function. Besides installin...
<pre><code>set WshShell = WScript.CreateObject("WScript.Shell") WScript.Sleep(100) WshShell.Run "%SystemRoot%\system32\sndrec32.exe" WScript.Sleep(100) WshShell.AppActivate "Sound - Sound Recorder" WScript.Sleep(100) WshShell.SendKeys " " WScript.Sleep(100) </code></pre> <p>Save the above text as RunSoundRecorder....
<p>Start-Programs-Accessories-System Tools-Scheduled Tasks</p>
20,044
<p>I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a specific question regarding ActionForms. Some of them have only String properties (even for numbers), some of them use the seemingly appropriate types (Integer, Date, String, etc). What's the best practice here?</p> <p>Also, it seems that if...
<p>For Struts 1.2x, properties where the user enters or selects values on the HTML form and that are populated on the ActionForm instance automatically by the Struts HTML tags must be Strings or booleans. However, there's no reason why your ActionForm can't have getter methods that return the properties as more meaning...
<p>If you want to do some validation yourself (or use the struts validator features that have been refactored out of struts later than 1.2) you'll need String properties for exactly the reason that you cite: Once you store numerical values in Integer or int values, they <em>must</em> be either numbers or "nothing at al...
25,710
<p>I would like to use <code>as</code> and <code>is</code> as members of an enumeration. I know that this is possible in VB.NET to write it like this:</p> <pre><code>Public Enum Test [as] = 1 [is] = 2 End Enum </code></pre> <p>How do I write the equivalent statement in C#? The following code does not compile:...
<p>Prefixing reserved words in C# is done with @.</p> <pre><code>public enum Test { @as = 1, @is = 2 } </code></pre>
<p>It does seem like a bad idea though - like setting FIVE to equal 6.</p> <p>Why not just use a predetermined prefix so that te names are unique and future maintainers of your code understand what you are doing?</p>
4,495
<p>Earlier I asked a question about <a href="https://stackoverflow.com/questions/335682/mvc-examples-use-of-var">why I see so many examples use the <code>var</code>keyword</a> and got the answer that while it is only necessary for anonymous types, that it is used nonetheless to make writing code 'quicker'/easier and 'j...
<p>There's no extra Intermediate language (IL) code for the <code>var</code> keyword: the resulting IL should be identical for non-anonymous types. If the compiler can't create that IL because it can't figure out what type you intended to use, you'll get a compiler error.</p> <p>The only trick is that <code>var</code>...
<p>It's depends of situation, if you try use, this code bellow.</p> <p>The expression is converted to "OBJECT" and decrease so much the performance, but it's a isolated problem.</p> <p>CODE:</p> <pre><code>public class Fruta { dynamic _instance; public Fruta(dynamic obj) { _instance = obj; }...
46,535
<p>I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible.</p>
<p>A little hacky but should work:</p> <pre><code>SELECT DATENAME(month, DATEADD(month, @mydate-1, CAST('2008-01-01' AS datetime))) </code></pre>
<p>Use this statement</p> <pre><code>SELECT TO_CHAR(current_date,'dd MONTH yyyy') FROM dual </code></pre> <p>this will convert the month number to month full string</p>
22,437
<p>I want to parse this XML Document <a href="http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland" rel="nofollow noreferrer">http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland</a> I want to be able to read out condition, temp_c and humidity. All this I want to do inside of JavaScript without us...
<p>Unless you are working on a page hosted on google.de — you can't.</p> <p>The <a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="nofollow noreferrer">same origin policy</a> prevents JS running in a webpage on your site from accessing a document on a remote site.</p> <p>You have to involve a server side ...
<p>I think I found a tutorial (its in german though) <a href="http://www.aboutwebdesign.de/awd/content/1124893836.shtml" rel="nofollow noreferrer">http://www.aboutwebdesign.de/awd/content/1124893836.shtml</a></p>
41,946
<p>Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do.</p>
<p>Configure and build your appliance at <a href="https://elasticserver.com/" rel="nofollow noreferrer">Elastic Server On-Demand</a>.</p>
<p>It might be a little too heavy for your requirements, but all of those items (and a whole lot more) are included in the <a href="http://www.vmware.com/appliances/directory/289" rel="nofollow noreferrer">Python Web Developer Appliance</a>.</p>
17,772
<p>I am creating an appcation on Vista,which include a service and a Console application .Both running in same user account</p> <p>In service i am creating an event and waits for that event.In console application i am opening the same event (problem starts here) and calling <em>SetEvent</em> function. I can not open...
<p>Are the service and the application running as the same user with different integrity levels, or are they running as different users?</p> <p>If it is the former, then this article from MSDN <a href="http://msdn.microsoft.com/en-us/library/bb250462.aspx" rel="nofollow noreferrer">which talks about integrity levels m...
<p>First, it is important to conceptually understand what is required. Once that is understood we can take it from there.</p> <p>On the server, it should look something similar to:</p> <pre><code>{ HANDLE hEvent; hEvent = CreateEvent(null, true, false, TEXT("MyEvent")); while (1) { WaitForSingleObj...
13,916
<p>I want to be able to do:</p> <pre><code>For Each thing In things End For </code></pre> <p>CLASSIC ASP - NOT .NET!</p>
<p>Something like this?</p> <pre><code>dim cars(2),x cars(0)=&quot;Volvo&quot; cars(1)=&quot;Saab&quot; cars(2)=&quot;BMW&quot; For Each x in cars response.write(x &amp; &quot;&lt;br /&gt;&quot;) Next </code></pre> <p>See <a href="http://web.archive.org/web/20140305020029/http://www.w3schools.com/vbscript/vbscript_l...
<p>As Brett said, its better to use a vb component to create collections. Dictionary objects are not very commonly used in ASP unless for specific need based applications. </p>
2,446
<p>I have a C++ template class that gets instantiated with 3 different type parameters. There's a method that the class needs to have for only one of those types and that isn't ever called with the two other types.</p> <p>Will object code for that method be generated thrice (for all types for which the template is ins...
<p>Virtual member functions are instantiated when a class template is instantiated, but non-virtual member functions are instantiated only if they are called.</p> <p>This is covered in [temp.inst] in the C++ standard (In C++11, this is §14.7.1/10. In C++14, it is §14.7.1/11, and in C++17 it is §17.7.1/9. Excerpt from ...
<p>Usually, yes.</p> <p>All the compiler really knows is that your program can create at least one instance of each class. But it doesn't know what you will do with those instances. So the code will almost certain be generated.</p> <p>That said, if the methods in question are <em>not</em> virtual, and are never cal...
22,135
<p>So I'm trying to run my first hello world prog written in C. I compiled it in eclipse and get no errors, but when I try to run it I get:</p> <p>"This application has failed to start because cygwin1.dll was not found."</p> <p>I found <a href="http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg08271.html" re...
<p>The PATH environment variable needs to include the directory containing cygwin1.dll, not the path to cygwin1.dll itself. So just make sure that PATH has the string <code>"C:\cygwin\bin"</code> in it.</p>
<p>I had the same problem... Adam Rosenfield's answer solved it nice. At my Computer the path needs to be <code>"C:\cygwin64\bin"</code></p> <p>First time I didn't recognized that my version of cygwin is the 64bit... But it's quiet clear that these little difference in the path-variable decides if it will work - or no...
43,924
<p>How do I write the CC logo in HTML, is there something like <code>&amp;copy;</code> (which gives &copy;)?</p> <p>(CC stands for Creative Commons).</p>
<p>As far as I know, there is no character for this, so you'll have to use a graphic.</p> <p>There are some nice ones <a href="http://creativecommons.org/about/downloads/" rel="nofollow noreferrer">here</a>. By the way, on this page, there's also a logo font you could use in HTML, but this won't show correctly for oth...
<p>Thanks Nikki! There is also a CC symbol (normal and compact version) that you can place in your HTML page, from the <a href="https://creativecommons.org/choose/" rel="nofollow">Creative Commons website itself</a>.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> ...
35,727
<p>Given a week-day (1-7), how can I calculate what that week-day's last date was?</p> <p><strong>Example:</strong> Today is <strong>Wednesday</strong>, 2008/11/12, and I want to know what last <strong>Friday's</strong> date was.</p>
<p>If <code>today</code> is the current day of the week, then you can use something like:</p> <pre><code>days_since_friday = (((today - 1) + 7) - (6 - 1)) % 7 </code></pre> <p>This assumes that Friday is represented by day number 6 of the week (that is, 1 represents Sunday). Then subtract <code>days_since_friday</cod...
<p>If <code>today</code> is the current day of the week, then you can use something like:</p> <pre><code>days_since_friday = (((today - 1) + 7) - (6 - 1)) % 7 </code></pre> <p>This assumes that Friday is represented by day number 6 of the week (that is, 1 represents Sunday). Then subtract <code>days_since_friday</cod...
36,185
<p>I believe in OO, but not to the point where inappropriate designs/implementations should be used just to be "OO Compliant".</p> <p>So, how to deal with the Serlvet/EJB/DataContainer layered architecture:</p> <ul> <li>Servlets receive requests and call a "business layer" (e.g. session EJBs)</li> <li>The business la...
<p>So I'll address my thoughts on this in a few bullet points:</p> <ol> <li>It seems in a Java EE system at some point you have to deal with the plumbing of Java EE, the plumbing doesn't always benefit from OO concepts, but it certainly can with a bit of creativity and work. For example you could might take advantage...
<p>Crudely, the "We don't want" section has to go. Either you want it to be right, or you want it to stay as it is. There's no point in <em>not</em> creating a class when you need one. "We have plenty" is a bad excuse.</p> <p>Indeed, it <em>is</em> bad to <em>expose</em> all the internal classes, but in my experien...
18,513
<p>I heard that you could right-shift a number by .5 instead of using Math.floor(). I decided to check its limits to make sure that it was a suitable replacement, so I checked the following values and got the following results in Google Chrome:</p> <pre><code> 2.5 >> .5 == 2; 2.9999 >> .5 == 2; 2.999999999999999 >> .5...
<p>Actually, you're simply ending up doing a floor() on the first operand, without any floating point operations going on. Since the left shift and right shift bitwise operations only make sense with integer operands, the JavaScript engine is converting the two operands to integers first:</p> <pre><code>2.999999 &gt;&...
<p>And to add to John's answer, the odds of this being more performant than Math.floor are vanishingly small.</p> <p>I don't know if JavaScript uses floating-point numbers or some kind of infinite-precision library, but either way, you're going to get rounding errors on an operation like this -- even if it's pretty we...
20,853
<p>What open-source / public domain software is there "out there" for conversion between Latitude/Longitude, UTM (Universal Transform Mercator) and MGRS (Military Grid Reference System)? We're using a VB6 library at the moment and would prefer to use something in another language and with a longer pedigree.</p>
<p><a href="http://trac.osgeo.org/proj/" rel="nofollow noreferrer">PROJ.4</a>; I don't know if it does MGRS, but I seem to recall that it did Lat/Lon -> UTM when I last used it.</p>
<p><a href="http://trac.osgeo.org/proj/" rel="nofollow noreferrer">PROJ.4</a>; I don't know if it does MGRS, but I seem to recall that it did Lat/Lon -> UTM when I last used it.</p>
21,590
<p>What are profound advantages that one get when using COM for developing components over the WCF? Is there anything that can be done with COM and not with WCF?</p>
<p>No it's not dead yet, but it's on its death-bed, that's for sure. You see there's still to many legacy systems that use/require COM, that assures us it'll be with us for a few more years, but not in the long-run.</p> <p>As for WCF, there might be some edge cases of stuff COM can do, and WCF can't, but more importan...
<p>If I am not mistaken, .NET is intended to replace tech like COM and WFC. Is there a reason (other than legacy code) that one would chose COM or WFC over .NET?</p>
38,134
<p>Is it possible to get the machine name, or IP, or MAC address (basically client network information) from javascript running Internet Explorer?</p> <p>I found the following code that seems to accomplish this:</p> <pre><code>function Button1_onclick() { var locator = new ActiveXObject("WbemScripting.SWbemLocator"...
<p>Basically, there are two possibilities to get hold of the client name/address that come to mind:</p> <ul> <li>Use MFCOM, namely the <code>MetaFrameSession</code> object.</li> <li>Use WMI, the <code>MetaFrame_ICA_Client</code> class in <code>root\Citrix</code> looks promising.</li> </ul> <p>Mayor drawback of both s...
<p>If a user is logged onto a Terminal Server and visits a page in Internet Explorer in that TS session, then Internet Explorer (and any ActiveX controls it instantiates) are running on the Terminal Server hardware, not the client hardware.</p> <p>From this perspective, the only code running on the client hardware is ...
23,434
<p>I'm working on a WinForms app and I have a user control in it. The buttons in the user control raise events up to the form to be handled by other code. One of the buttons starts some processses that will cause problems if they run simultaneously. I have logic in the code to manage the state so typically a user ca...
<p>Make sure that your button disabling or any other locking that you do is the /first/ thing that you do in your event handler. I would be extremely surprised if you could queue up two click events before even the first instruction fires, but I suppose that's possible if you're on a very slow computer that's bogged do...
<p>Disable the button after the user first clicks it and before starting the task. When task completes, re-enable the button.</p>
31,831
<p>How do I get my Python program to sleep for 50 milliseconds?</p>
<p>Use <a href="https://docs.python.org/library/time.html#time.sleep" rel="noreferrer"><code>time.sleep()</code></a></p> <pre><code>from time import sleep sleep(0.05) </code></pre>
<p>You can also use pyautogui as:</p> <pre class="lang-py prettyprint-override"><code>import pyautogui pyautogui._autoPause(0.05, False) </code></pre> <p>If the first argument is not None, then it will pause for first argument's seconds, in this example: 0.05 seconds</p> <p>If the first argument is None, and the second...
49,426
<p>I am developing a website and for the main navigation, I was thinking it would be a good idea to include the title attribute.</p> <pre><code>&lt;a href="/results/" title="Results"&gt;Results&lt;/a&gt; </code></pre> <p>Is this a good thing to do? Also, is it good for SEO and accessibility?</p>
<p>It is a great thing to do. For accessibility, for SEO, for standards, for good netiquette.<br> You may want to make them slightly more descriptive though: title="Results of your Search" or "Results of Test #2"</p>
<p>Also, to add to the other answers, if you do any automated testing it's nice to have as many attributes as possible to be able to identify the various widgets.</p>
27,902
<p>Does anybody know about an Eclipse plug-in to analyze code coverage for TestNG unit tests?</p>
<p><a href="http://www.eclemma.org/" rel="nofollow noreferrer">EclEmma</a> can be run on TestNG test suites. You can also run a group of test or a given TestNG class with it. It requires the <a href="http://testng.org/doc/eclipse.html" rel="nofollow noreferrer">TestNg plug-in</a></p> <p>On EclEmma plugin, choose "co...
<p>Yes <a href="http://www.eclemma.org/" rel="nofollow noreferrer">EclEmma</a> is the best one. You can also try maven based <a href="http://blogs.codehaus.org/people/brett/archives/001334_test_ng_and_cobertura_in_maven_2.html" rel="nofollow noreferrer">cobertura</a> which is also good enough.</p>
30,558
<p>What is the best technique to improve removing PETG from the print bed?</p> <p>PETG is known for sticking well to the bed; so well that it does not need a heated bed. If it weren’t for printing other materials, I would try printing directly on the glass bed instead of a build surface. However, the build surface may...
<p>Playing around with the nozzle height will help: back it off until just before you have first layer adhesion issues. Don't jam the filament into the bed as you might for ABS. This helps with small prints. However, my experience has been that if you have a large enough continuous contact area (i.e. more than a few...
<p>Correctly level your bed. Seriously, that's the answer. PETG does stick well, but it only gets difficult to remove if you're smashing the first layer against the bed with a nozzle that's way too close. With the bed leveled properly - using feeler gauges or test prints and a sub-0.1-mm-precision caliper - I have no t...
1,776
<p>A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.)</p> <p>But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop.</p> <p>I've ...
<p>You're talking about testing too much at once. If you start trying to attack a testing problem by saying "Let's verify that it modifies its environment correctly", you're doomed to failure. Environments have dozens, maybe even millions of potential variations.</p> <p>Instead, look at the pieces ("units") of your ...
<p>I think you are on the right track. Depending on what you need to do <a href="http://en.wikipedia.org/wiki/Chroot" rel="nofollow noreferrer">chroot</a> may help you set up an environment for your scrpits that 'looks' real, but isn't.</p> <p>If that doesn't work then you could write your scripts to take a 'root' pa...
13,235
<p>Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database.</p> <p>Is there an equivalent I can use?</p>
<p>To build on Ilya's answer try the following query:</p> <pre><code>SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE (((Left([Name],1))&lt;&gt;"~") AND ((Left([Name],4))&lt;&gt;"MSys") AND ((MSysObjects.Type) In (1,4,6))) order by MSysObjects.Name </code></pre> <p>(this one works witho...
<pre><code>SELECT Name FROM MSysObjects WHERE (Left([Name],1)&lt;&gt;"~") AND (Left([Name],4) &lt;&gt; "MSys") AND ([Type] In (1, 4, 6)) ORDER BY Name </code></pre>
24,573
<p>I've got a simple class that inherits from Collection and adds a couple of properties. I need to serialize this class to XML, but the XMLSerializer ignores my additional properties.</p> <p>I assume this is because of the special treatment that XMLSerializer gives ICollection and IEnumerable objects. What's the best...
<p>Collections generally don't make good places for extra properties. Both during serialization and in data-binding, they will be ignored if the item looks like a collection (<code>IList</code>, <code>IEnumerable</code>, etc - depending on the scenario).</p> <p>If it was me, I would encapsulate the collection - i.e.</...
<p>I've been fighting with the same issue Romaroo is (wanting to add properties to the xml serialization of a class that implements ICollection). I have not found any way to expose properties that are in the collection class. I even tried using the XmlAttribute tag and making my properties show up as attributes of th...
49,431
<p>I have a HTML select list with quite a few (1000+) names. I have a javascript in place which will select the first matching name if someone starts typing. This matching looks at the start of the item: </p> <pre><code>var optionsLength = dropdownlist.options.length; for (var n=0; n &lt; optionsLength; n++) { ...
<p>Change</p> <pre><code>if (optionText.indexOf(dropdownlist.keypressBuffer,0) == 0) </code></pre> <p>to</p> <pre><code>if (optionText.indexOf(dropdownlist.keypressBuffer) &gt; 0) </code></pre> <p>To find <code>dropdownlist.keypressBuffer</code> anywhere in the <code>optionText</code>.</p>
<p>Change</p> <pre><code>if (optionText.indexOf(dropdownlist.keypressBuffer,0) == 0) </code></pre> <p>to</p> <pre><code>if (optionText.indexOf(dropdownlist.keypressBuffer) &gt; 0) </code></pre> <p>To find <code>dropdownlist.keypressBuffer</code> anywhere in the <code>optionText</code>.</p>
22,546
<p>In any (non-web) .net project, the compiler automatically declares the DEBUG and TRACE constants, so I can use conditional compiling to, for example, handle exceptions differently in debug vs release mode.</p> <p>For example:</p> <pre><code>#if DEBUG /* re-throw the exception... */ #else /* write something...
<p>Look at <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.getsection.aspx" rel="noreferrer">ConfigurationManager.GetSection()</a> - this should get you most of the way there.. however, I think you're better off just changing between debug and release modes and letting the com...
<p>Personally I don't like the way "#if debug" changes the layout. I do it by creating a conditional method that is only called when in debug mode and pass a boolean by reference.</p> <pre><code>[Conditional("DEBUG")] private void IsDebugCheck(ref bool isDebug) { isDebug = true; } public void SomeCallingMethod() ...
32,270
<p>I'm having some issues with my Prusa i3 prints. I'm trying to print the default beer opener print that came with the Prusa's memory card but the infill will break causing clogging and now allowing the print to finish. I've attached a picture of one of the failed prints.</p> <p><a href="https://i.stack.imgur.com/JNP...
<p>If you carbonize the filament or other particles that are clogging the nozzle, then you will never get them clean. In my experience, it's not worth cleaning the nozzle with anything other than cleaning filament. If that doesn't work then change the nozzle. Heating the metal nozzle with a torch will change the temper...
<p>If you can get the torch hot enough and you carbonise/burn the filament properly, it may work. You still need to do a cold pull to remove as many residues as you can, but if you heated it enough, the residuals maybe won't stick too much to the nozzle.</p> <p>You already have the butane, try and tell us.</p>
1,629
<p>In the Windows Mobile world you can create a so-called Today plugin that adds content to the phone's main screen -- the one where you see the number of missed calls, unread sms and upcoming events. Is it possible to do something similar on the BlackBerry? I'd like to show some important info there, so that they ar...
<p>To provide some information on the Home Screen you can use App Icon:<br> <a href="https://stackoverflow.com/questions/1699369/add-a-notification-icon-at-the-status-bar-in-blackberry-jde-4-5-0">Add a notification icon at the status bar in BlackBerry JDE 4.5.0</a><br> <a href="http://img691.imageshack.us/img691/6459/i...
<p>These things are already displayed on the ribbon depending on the theme. If you want to create/modify a theme, use the Plazmic CDK.</p> <p>There are two ways to put individual icons onto the ribbon (similar to icons like mail, calendar, address book, browser, maps, etc):</p> <ol> <li>channel push: easiest if the u...
42,865
<p>I'm using the standard <code>ConsoleHandler</code> from <code>java.util.logging</code> and by default the console output is directed to the error stream (i.e. <code>System.err</code>).</p> <p>How do I change the console output to the output stream (i.e. <code>System.out</code>)?</p>
<p>I've arrived at</p> <pre><code> SimpleFormatter fmt = new SimpleFormatter(); StreamHandler sh = new StreamHandler(System.out, fmt); logger.addHandler(sh); </code></pre>
<p>Simply extend StreamHandler &amp; in the constructor call Super(System.out,). This will avoid closing System.err - Thanks </p>
23,592
<p>I have a Spring web application which is configured to use JDK proxying for AOP. The AOP annotations (such as @Transactional) are declared on the interfaces, rather than the implementation classes.</p> <p>The application itself works fine, but when I run the unit tests, it seems to be attempting to use CGLIB for th...
<p>Sounds like you're referencing an implementation class instead of an interface. There is an <a href="http://books.google.com/books?id=G4jk-NOpF7gC&amp;pg=PA192&amp;lpg=PA192&amp;dq=spring+cglib+jdk+proxy+interface&amp;source=web&amp;ots=PGqNjejNK9&amp;sig=DhXUwccDLSH6AM4mWWb9mnQlfMs&amp;hl=en&amp;sa=X&amp;oi=book_re...
<p>Hey Jean, CGLib proxies are created by subclassing the class to be proxied -- you're attempting to proxy another proxy which isn't allowed since proxies are themselves final classes. Hence:</p> <p><code>Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy25</code></p>
44,409
<p>In java &lt;1.5, constants would be implemented like this</p> <pre><code>public class MyClass { public static int VERTICAL = 0; public static int HORIZONTAL = 1; private int orientation; public MyClass(int orientation) { this.orientation = orientation; } ... </code></pre> <p>and you w...
<p>You complicated it too much. Let's bring it all together.</p> <p>Post Java 1.5 you should use the Java Enum class:</p> <pre><code>public enum Color { BLACK, WHITE; } </code></pre> <p>Pre Java 1.5 you should use the type-safe Enum pattern:</p> <pre><code>public class Color { public static Color WHITE = ne...
<p>It depends on how many values the enum can take. In your example, with only two, I would just use a boolean. If the enum will only be used by code that you write and won't have to interact with lots of other code, maybe you don't need type safety. But if it's in a 'public' method, I would definitely go for enums, a...
47,917
<p>Seriously. On a 22" monitor, it only covers maybe a quarter of the screen. I need some ammo to axe down this rule.</p> <hr> <p>I'm not saying that there shouldn't be a limit; I'm just saying, 80 characters is very small.</p>
<p>I think the practice of keeping code to 80 (or 79) columns was originally created to support people editing code on 80-column dumb terminals or on 80-column printouts. Those requirement have mostly gone away now, but there are still valid reasons to keep the 80 column rule:</p> <ul> <li>To avoid wrapping when copyi...
<p>I still think that the limit isn't limited on the visual part. Sure, the monitors and resolutions are big enough to show even more characters in one line nowadays, but does it increase the readability? </p> <p>If the limit is really enforced it's also a good reason to re-think the code and <strong>not</strong> to p...
13,613
<p>I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this?</p>
<ol> <li>Use <code>ldd</code> to list shared libraries for each executable.</li> <li>Cleanup the output</li> <li>Sort, compute counts, sort by count</li> </ol> <p>To find the answer for all executables in the "/bin" directory:</p> <pre><code>find /bin -type f -perm /a+x -exec ldd {} \; \ | grep so \ | sed -e '/^[^\t]...
<p>I found this post very helpful as I needed to investigate dependencies from a 3rd party supplied library (32 vs 64 bit execution path(s)).</p> <p>I put together a Q&amp;D recursing bash script based on the 'readelf -d' suggestion on a RHEL 6 distro.</p> <p>It is very basic and will test every dependency every time...
7,286
<p>The picture below explains all:</p> <p><a href="http://img133.imageshack.us/img133/4206/accentar9.png" rel="nofollow noreferrer">alt text http://img133.imageshack.us/img133/4206/accentar9.png</a></p> <p>The variable textInput comes from <code>File.ReadAllText(path);</code> and characters like : ' é è ... do not di...
<p>The .NET classes (<code>System.IO.StreamReader</code> and the likes) take UTF-8 as the default encoding. If you want to read a different encoding you have to pass this explicitly to the appropriate constructor overload.</p> <p>Also note that there's not one single encoding called “ANSI”. You're probably referring t...
<p>I do not know why It works with NUnit, but I open the file with NotePad++ and I see ANSI in the format. Now I converted to UTF-8 and it works.</p> <p>I am still wondering why it was working with NUnit and not in the console? but at least it works now.</p> <p><strong>Update</strong> I do not get why I get down vote...
26,428
<p>I want to consolidate all the loose information of the company I work for into a knowledge base. A wiki seems to be the way to go, but most of the relevant information is buried inside PST files, and it would take ages to convince people to manually translate their emails one by one (including attachments) into wiki...
<p>Both Jotspot and MediaWiki allow you to do this. The latter has support for a lot of plugins, of which this is one. The format is essentially PageTitle@something. Jotspot is a hosted solution where you get your own email address, MediaWiki is self-hosted and you give it a mailbox to monitor for incoming.</p> <p>Art...
<p>I don't know if this is exactly what you're looking for, but I know many of 37 Signals' products support adding data through email. I use Highrise to keep track of some of my business correspondence, and I'm able to CC or forward emails to Highrise and they get added to the appropriate contact.</p>
3,269
<p>This is what I've got. It works. But, is there a simpler or better way?</p> <p>One an ASPX page, I've got the download link...</p> <pre><code>&lt;asp:HyperLink ID="HyperLinkDownload" runat="server" NavigateUrl="~/Download.aspx"&gt;Download as CSV file&lt;/asp:HyperLink&gt; </code></pre> <p>And then I've got the D...
<p>CSV formatting has some gotchas. Have you asked yourself these questions:</p> <ul> <li>Does any of my data have embedded commas?</li> <li>Does any of my data have embedded double-quotes?</li> <li>Does any of my data have have newlines?</li> <li>Do I need to support Unicode strings?</li> </ul> <p>I see several prob...
<p>I use the following method when building a CSV file from a DataTable. ControllerContext is just the reponse stream object where the file is written to. For you it is just going to be the Response object. </p> <pre><code>public override void ExecuteResult(ControllerContext context) { StringBuilde...
6,590
<p>In the iPhone SDK I don't see the same <code>SCDynamicStore</code> used on Mac OS X to get the SSID name that your wireless network is currently connected to isn't available. </p> <p>Is there a way to get the SSID name that the iPhone is currently connected to? </p> <p>I see some apps do it (<a href="http://itune...
<p>This is now possible (iOS 4.1+) via the <a href="http://developer.apple.com/library/ios/#documentation/SystemConfiguration/Reference/CaptiveNetworkRef/Reference/reference.html" rel="nofollow noreferrer">Captive Network API</a>.</p> <p>See <a href="https://stackoverflow.com/questions/5198716/iphone-get-ssid-without-...
<p>Try this code,</p> <pre><code>#import &lt;SystemConfiguration/CaptiveNetwork.h&gt; CFArrayRef myArray = CNCopySupportedInterfaces(); CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0)); NSDictionary *ssidList = (__bridge NSDictionary*)myDict; NSString *SSID = [ssidList valueForKey...
44,031
<p><strong>UPDATE:</strong><br> This is one of my most-visited questions, and yet I still haven't really found a satisfactory solution for my project. One idea I read in an answer to another question is to create a tool which can build solutions 'on the fly' for projects that you pick from a list. I have yet to try tha...
<p><strong>Source Control</strong></p> <p>We have 20 or 30 projects being built into 4 or 5 discrete solutions. We are using Subversion for SCM.</p> <p>1) We have one tree in SVN containing all the projects organised logically by namespace and project name. There is a .sln at the root that will build them all, but th...
<p>We have one gigantic solution on the source control, on the main branch.</p> <p>But, every developer/team working on the smaller part of the project, has its own branch which contains one solution with only few projects which are needed. In that way, that solution is small enough to be easily maintenaced, and do no...
18,335
<p>Does this pattern:</p> <pre><code>setTimeout(function(){ // do stuff }, 0); </code></pre> <p>Actually return control to the UI from within a loop? When are you supposed to use it? Does it work equally well in all browsers?</p>
<p>It runs code asynchronously (not in parallel though). The delay is usually changed to a minimum of 10ms, but that doesn't matter.</p> <p>The main use for this trick is to avoid limit of call stack depth. If you risk reaching limit (walk deep tree structure and plan to do a lot of work on leafs), you can use timeout...
<p>Think of it as setting up an interupt vector back in the old days.</p> <p>It won't parallel process that code, but instead it will jump and execute it when event (in this case, a timer finishing) is fired.</p>
35,775
<p>Is it possible to get a list of control events that are going to fire before they happen, say inside the <code>Page_Load</code> handler?</p> <p>For example if a button was clicked can I figure this out before the <code>button_click</code> event handler is called?</p>
<p>You've picked a really tough question... the reason for this is that there are several ways that events will fire.</p> <p>1) __EVENTTARGET (as mentioned above) 2) If the name of your button is MyButt, then you'll see "MyButt=" in the query string. 3) When each control (like, a TextBox for example) checks the reques...
<p>The following contains the mangled id for a button when clicked.</p> <pre><code>Page.Request.Form["__EVENTTARGET"] </code></pre>
30,113
<p>For those of you familiar with <a href="http://www.gallio.org" rel="noreferrer">Gallio</a>, what Advantages and Disadvantages have you experienced using this tool, a so-called Test Automation Platform?</p>
<p>We're using Gallio/MbUnit for a year now. We're quite happy with it, the Gallio guys keep introducing cool new features and the development is active. If you decide to use it, here are some hints/notes:</p> <ol> <li>Buy yourself a TestDriven.NET license - I think it is a must for Gallio unit tests, since Resharper ...
<p>On the advantages front, integration with everything is quite nice :) Seriously, I'm a huge fan of the experimental integration with Visual Studio Team System (screenshots <a href="http://blog.bits-in-motion.com/2008/05/announcing-gallio-v30-alpha-3.html" rel="nofollow noreferrer">here</a>). I think that really low...
8,177
<p>If I want to split a list of words separated by a delimiter character, I can use</p> <pre><code>&gt;&gt;&gt; 'abc,foo,bar'.split(',') ['abc', 'foo', 'bar'] </code></pre> <p>But how to easily and quickly do the same thing if I also want to handle quoted-strings which can contain the delimiter character ?</p> <pre>...
<pre><code>import csv input = ['abc,"a string, with a comma","another, one"'] parser = csv.reader(input) for fields in parser: for i,f in enumerate(fields): print i,f # in Python 3 and up, print is a function; use: print(i,f) </code></pre> <p>Result:</p> <pre> 0 abc 1 a string, with a comma 2 another, one ...
<p>The <a href="https://docs.python.org/3/library/csv.html" rel="nofollow noreferrer" title="CSV File Reading and Writing">CSV module</a> should be able to do that for you</p>
42,858
<p>Been scouring the net for something like firewatir but for python. I'm trying to automate firefox on linux. Any suggestions?</p>
<p>You could try <a href="http://selenium.openqa.org/" rel="noreferrer">selenium</a>.</p>
<p>The languages of choice of Firefox is Javascript. Unless you have a specific requirement that requires Python, I would advice you to use that.</p>
8,498
<p>Is there a way to debug or trace every JavaScript event in Internet&nbsp;Explorer&nbsp;7?</p> <p>I have a bug that prevents scrolling after text-selecting, and I have no idea which event or action creates the bug. I really want to see which events are being triggered when I move the mouse for example. </p> <p>It's...
<p>Loop through all elements on the page which have an onXYZ function defined and then add the trace to them:</p> <pre><code>var allElements = document.all; // Is this right? Anyway, you get the idea. for (var i in allElements) { if (typeof allElements[i].onblur == "function") { var oldFunc = allElements[...
<p>My suggestion is, use FireFox together with FireBug and use the built-in Debug/Trace objects. They are a charm.</p>
11,681
<p>Ok, so I have VS 2008 and SVN. When I "rebuild all" a handful of my .dll's disappear from my bin folder. </p> <p>I have these .dll's in a library folder and that's where I am referencing them from. </p> <p>When I go to publish the app the publish fails, I think they are related. When I reboot my web.config (change...
<p>I assume that by "Bin" folder you mean the build location where Visual Studio assembles the executable version of your application.</p> <p>Generally, I've found that making manual changes to the Bin folder is a good way to encounter "a new world of pain". My problems went away as soon as I started letting Visual St...
<p>Sounds like the build procedure removes the contents of your bin directory on build. </p> <p>I don't understnad where you say you are referencing them from the library folder- and they also exist in the bin directory.</p> <p>Your publish could be failing for other reasons- it is most helpful to post the errors.</...
36,813
<p>I have a TreeView control showing multiple TreeNodes in an organised heirarchy. I want to stop the user selecting the highest level Nodes (this was achieved by using the BeforeSelect Event). I also want to stop the TreeView from highlighting the top level nodes if the user selects them i.e. stop the TreeView from ch...
<p>In addition to your existing code if you add a handler to the MouseDown event on the TreeView with the code and select the node out using it's location, you can then set the nodes colours.</p> <pre><code>private void treeView1_MouseDown(object sender, MouseEventArgs e) { TreeNode tn = treeView1.GetNodeAt(e.Loca...
<p>If the selecting is cancelled by setting Cancel to true in the BeforeSelect's event args, the node will not be selected and thus the background color won't change.</p>
49,517
<p>I was wondering if it is possible to do something like this:</p> <pre><code> &lt;uc1:TestControl ID="TestControl1" runat="server"&gt; &lt;div&gt;More random HTML, etc...&lt;/div&gt; &lt;/uc1:TestControl&gt; </code></pre> <p>I got an error of "Type 'System.Web.UI.UserControl' does not have a public p...
<p>In a server control, you would create <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.itemplate.aspx" rel="nofollow noreferrer">a property that implements ITemplate</a> to contain that content. I'm not positive whether that is possible in a user control, but it may be.</p>
<p>yeah it is possible</p> <p>check this MSDN Article about creating templated user controls, plus you can add [ParseChildren(false)] to the user control class so you can see them from the page holding them. <a href="http://msdn.microsoft.com/en-us/library/36574bf6.aspx" rel="nofollow noreferrer">http://msdn.microsoft...
30,294
<p>I would like to use Linq to query a bus schedule in my project, so that at any time I can get the next 5 bus arrival times. How can I limit my query to the first 5 results?</p> <p>More generally, how can I take a slice of a list in C#? (In Python I would use <code>mylist[:5]</code> to get the first 5 elements.)</p>...
<pre><code>var firstFiveItems = myList.Take(5); </code></pre> <p>Or to slice:</p> <pre><code>var secondFiveItems = myList.Skip(5).Take(5); </code></pre> <p>And of course often it's convenient to get the first five items according to some kind of order:</p> <pre><code>var firstFiveArrivals = myList.OrderBy(i =&gt; i...
<p>To take first 5 elements better use expression like this one:</p> <p><code>var firstFiveArrivals = myList.Where([EXPRESSION]).Take(5);</code></p> <p>or </p> <p><code>var firstFiveArrivals = myList.Where([EXPRESSION]).Take(5).OrderBy([ORDER EXPR]);</code></p> <p>It will be faster than orderBy variant, because LIN...
41,382
<p>Functional programming seems to be a paradigm in computer science which has more and more echo.</p> <p>I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach.</p> <p>Thank you.</p>
<p>Functional programming is best suited for most kinds of problems, including anything you would normally use object-oriented programming for, except for maybe problems that require the storing of a lot of state or other side effects. Aside from that, FP handles complex problems much more gracefully than OOP, as a lot...
<p>If you're writing C++ templates, you're working in a pure functional language.</p>
24,469
<p>When working on a linx CShell u get the option to press the up / down arrows to select the last command/s typed or the Command Buffer. This even works on Windows.</p> <p>However this is not functional when working on Solaris, to which i recently switched. I am guessing that the shell is also a CShell. </p> <p>Plea...
<p>The default shell in Solaris has command history, but you can also use Bash instead, it's more user friendly. Just type 'bash' (no quotes) at the command line. You can also edit /etc/passwd to make bash your default shell.</p>
<p>It may be that it's the Korn shell in which case try &lt;ESC>k. bash at least will allow you to switch modes with "set -o vi" or "set -o emacs".</p>
12,496
<p>I have several wpf pages with update/delete/add buttons. I want to display to the user messages like "successful delete", etc. How can I best implement this so the message is defined in a single place (similar to an asp.net master page) and I can update this message from anywhere?</p>
<p>You may want to consider doing a publish/subscribe ("Observer" pattern) -- define a "status changed" event on a base page, and create a custom control that sets up a delegate and event handler to listen for status updates.</p> <p>Then you could drop the custom control on any page that inherits from the base, and it...
<p>I don't think you have the ASP.Net master pages translated to the <em>WPF Page</em> world just yet.<br> A workaround till MS gets there, I would probably put a Control at the top of the page (or wherever) that just displays a particular User-level "<a href="http://msdn.microsoft.com/en-us/library/ms171565.aspx" rel=...
7,284
<pre><code>&lt;a id="lblShowTimings" runat="server" title='&lt;%# Eval("SHOW_Name") %&gt;' onclick='PopulateTicketDiv(&lt;%#Eval("SHOW_ID") %&gt;)'&gt; &lt;-- this is the problem %#Eval("SHOW_Time") %&gt; &lt;/a&gt; </code></pre> <p>Can Eval be passed as an argument to a javascript function? If so wh...
<p>Yes. What you want to do is this, though:</p> <pre><code>onclick='&lt;%# "PopulateTicketDiv(" +Eval("SHOW_ID") + " );" %&gt;' </code></pre>
<p>Basically you need to escape the quote</p> <pre><code>&lt;asp:CheckBox onclick='&lt;%# &quot;ToggleByPassValidationRules(&quot; + &quot;\&quot;&quot; + Eval(&quot;Name&quot;) + &quot;\&quot;&quot; + &quot;);&quot; %&gt;' ID=&quot;chkIsRuleActive&quot; runat=&quot;server&quot; Enabled=&quot;false&quot; /&gt; </code><...
31,088
<p>In Jackrabbit I have experienced two ways to save my POJOs into repository nodes for storage in the Jackrabbit JCR: </p> <ol> <li>writing my own layer and </li> <li>using Apache Graffito </li> </ol> <p>Writing my own code has proven time consuming and labor intensive (had to write and run a lot of ugly automated t...
<p>Another alternative is to completely skip an OCM framework and simply use <code>javax.jcr.Node</code> as a very flexible DAO itself. The fundamental reason why OCM frameworks exist is because with RDBMS you need a mapping from objects to the relational model. With JCR, which is already very object-oriented (node ~= ...
<p>There is also the JCROM project at <a href="http://code.google.com/p/jcrom/" rel="nofollow">http://code.google.com/p/jcrom/</a>. That project went dormant for a couple of years, but there have been a few new releases as of summer 2013.</p>
48,411
<p>In a PHP application I am writing, I would like to have users enter in text a mix of HTML and text with pointed-brackets, but when I display this text, I want to let the HTML tags be rendered by the non-HTML tags be shown literary, e.g. a user should be able to enter:</p> <pre><code>&lt;b&gt; 5 &gt; 3 = true&lt;/b&...
<p>I'd recommend having the users enter BBcode style markup which you then replace with the html tags:</p> <pre><code>[b]This is bold[/b] [i]this is italic with a &gt; 'greater than' sign there[/i] </code></pre> <p>This gives you more control over how you parse user's input into html, though I admit it looks like an ...
<p>The best way would be to do the opposite: instead of finding the non-HTML brackets and escaping them, first escape everything and then look for <code>&amp;lt;b&amp;gt;</code> and <code>&amp;lt;/b&amp;gt;</code> and unescape only these special cases. This way you do not risk a user injecting malicious HTML in your pa...
38,660
<p>I have an application that uses many different .NET managed DLL's as objects (each DLL implements a common interface). Each DLL also has a version number in the file name.</p> <p>Suppose I create the object "Shape~01.dll." The application will use that DLL but it can't be replaced while the application is running...
<p>Well, this isn't the best solution (still thinking about it), but you can unload dll files which will allow them to be replaced. That might be a quick stopgap solution until you come up with a better idea.</p>
<p>Instead of polling when creating an object, why not just request notification from the system when the file system changes?</p> <p>The class is <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="nofollow noreferrer">System.IO.FileSystemWatcher</a> in.NET. </p> <p>For native cod...
47,211
<p>If I have a folder structure set up like this:</p> <pre><code>~/Projects emacs package1 package1-helpers package2 package2-helpers package2-more-helpers package3 package3-helpers </code></pre> <p>How do I add these folders:</p> <ul> <li>~...
<pre><code>(let ((base "~/Projects/emacs")) (add-to-list 'load-path base) (dolist (f (directory-files base)) (let ((name (concat base "/" f))) (when (and (file-directory-p name) (not (equal f "..")) (not (equal f "."))) (add-to-list 'load-path name))))) </code></...
<p>This function will map over first level sub-folders and files in BASE-PATH and add it to the LOAD-LIST if it's a directory (excluding directories "." and "..").</p> <pre><code>(defun add-subdirs-to-load-path (base-path) "Adds first level subfolders to LOAD-PATH. BASE-PATH must not end with a '/'" (mapc (lambda ...
27,277
<p>Is there a tool which can be used to analyze log4net logs.</p> <p>Particulary I would like to extract two method calls by thread id and analyze the duration between the two, to create some statistics of call duration.</p> <p>Plus this over multiple (100x10Mb) files.</p> <p>I suppose <em>grep</em> would also do it...
<p>Well this may or may not be a bad answer, but when you use log4j, there's a tool called Chainsaw (written in Java) that you can use to filter and go through your log4j-like log files.</p> <p>Note: You may need to refer to this article to configure chainsaw to read your log file file: </p> <p><a href="http://wiki.a...
<p>If you are using the XML log formatting. You can process the log files. using xpath to extract the details you want. But you would have a write a small app yourself. </p>
46,412
<p>I'd like to log stuff in my Sharepoint Web Parts, but I want it to go into the ULS. Most examples that I've found log into the Event Log or some other file, but I did not really find one yet for logging into the ULS.</p> <p>Annoyingly, Microsoft.SharePoint.Diagnostics Classes are all marked Internal. I did find <a ...
<p>Yes this is possible, see this MSDN article: <a href="http://msdn2.microsoft.com/hi-in/library/aa979595(en-us).aspx" rel="noreferrer">http://msdn2.microsoft.com/hi-in/library/aa979595(en-us).aspx</a></p> <p>And here is some sample code in C#:</p> <pre><code>using System; using System.Runtime.InteropServices; using...
<p>This DID NOT work for me, and hung up my webpart consistently. I had it working for a second and then not. And only, only when I removed the Trace register/unregister/etc statements would it work.</p> <p>So I recommend this excellent article which worked for me: <a href="http://sharepoint.namics.com/2008/05/loggi...
16,537
<p>We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired.</p> <p>Here's the code for the page. The events are button clicks fired from within the...
<p>Did you try an HTML table, with or without runat="server" ?</p> <p>Do you add or remove controls inside the table in the postback?</p>
<p>Your table is probably being populated too late in the page lifecycle. Try creating the table in PreInit.</p>
48,137
<p>I'm using TortoiseHg 0.5 (which includes Mercurial 1.0.2) on Vista64. My understanding from the <a href="http://hgbook.red-bean.com/hgbookch7.html#x11-1530007.7" rel="noreferrer">Mercurial Book</a> is that Mercurial should handle filenames in a case-insensitive manner on a case-insensitive filesystem (such as NTFS, ...
<p>This issue has been resolved in Mercurial 1.1! From the <a href="http://www.selenic.com/mercurial/wiki/index.cgi/WhatsNew#head-b1d1f9a535adb686d6e0a490e049261313f10d7d" rel="noreferrer">release notes</a>: "Improved correctness in the face of casefolding filesystems".</p> <p>On Windows, Mercurial now ignores case in...
<p>I think you misread the hgbook. The intro to section 7.7 is just describing the three different types of case sensitivity that exist in OSs, not saying that mercurial will mirror those semantics.</p> <p>Later in section 7.7.2 'Detecting case conflicts' it says:</p> <blockquote> <p>When operating in the working ...
29,512
<p>I'm using a repeater control and I'm trying to pass a parameter as such:</p> <pre><code>&lt;%# SomeFunction( DataBinder.Eval(Container.DataItem, "Id") ) %&gt; </code></pre> <p>It's basically calling:</p> <pre><code>public string SomeFunction(long id) { return "Hello"; } </code></pre> <p>I'm not abl...
<p>You need to cast the result to a long, so:</p> <pre><code>&lt;%# SomeFunction( (long)DataBinder.Eval(Container.DataItem, "Id") ) %&gt; </code></pre> <p>The alternative is to do something like this:</p> <pre><code>&lt;%# SomeFunction(Container.DataItem) %&gt; </code></pre> <p>and...</p> <pre><code>public string ...
<p>I used this with success. The data source is a List collection.</p> <pre><code>OnClientClick='&lt;%# "return myFunction(\""+ Container.DataItem + "\");" %&gt;' </code></pre> <p>and the javascript function...</p> <pre><code>function myFunction(imgPath) { alert(imgPath); } </code></pre>
36,548
<p>I wrote a class that tests for equality, less than, and greater than with two doubles in Java. My general case is comparing price that can have an accuracy of a half cent. 59.005 compared to 59.395. Is the epsilon I chose adequate for those cases?</p> <pre><code>private final static double EPSILON = 0.00001; /...
<p>You do NOT use double to represent money. Not ever. Use <a href="https://docs.oracle.com/javase/9/docs/api/java/math/BigDecimal.html" rel="noreferrer"><code>java.math.BigDecimal</code></a> instead.</p> <p>Then you can specify how exactly to do rounding (which is sometimes dictated by law in financial applications!)...
<p>Floating point numbers only have so many significant digits, but they can go much higher. If your app will ever handle large numbers, you will notice the epsilon value should be different.</p> <p>0.001+0.001 = 0.002 BUT 12,345,678,900,000,000,000,000+1=12,345,678,900,000,000,000,000 if you are using floating point...
46,526
<p>How to load only the schema of the tables into a dataset.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.fillschema.aspx" rel="noreferrer">SqlDataAdapter.FillSchema</a></p>
<p>Do a query that normaly would return your data and add a where clause so that no rows are returned.</p>
29,660
<p>I want to subclass the built-in DropDownList in ASP.NET so that I can add functionality to it and use it in my pages. I tried doing this with a UserControl but found that it doesn't expose the internal DropDownList (logically, I guess). I've googled for the answer but can't find anything. </p> <p>I've come as far a...
<p>You want to extend DropDownList in a Custom Control... not in a usercontrol.</p> <p>Create a new Class Library Project called MyLibrary.</p> <p>Add a class called MyDropDownList.cs</p> <pre><code>namespace My.Namespace.Controls { [ToolboxData("&lt;{0}:MyDropDownList runat=\"server\"&gt;&lt;/{0}:MyDropDownList&gt;...
<p>In a comment, you clarify your goal: "The only thing I want to do with it is add an InitialValue property that defines the first value that is always present in the DDL."</p> <p>I don't think you need to create a special user control or custom control to accomplish that.</p> <p>I often use this code throughout my ...
28,827
<p>What is the JavaScript to scroll to the top when a button/link/etc. is clicked?</p>
<pre><code>&lt;a href="javascript:scroll(0, 0)"&gt;Top&lt;/a&gt; </code></pre>
<p>actually, this works by itself, no need to define it.</p> <pre><code>&lt;a href="#top"&gt;top&lt;/a&gt; </code></pre> <p>This is a "magic" hashname value that does not need to be defined in browsers.</p> <p>Just like this will "reload" the page.</p> <pre><code>&lt;a href="/"&gt;reload&lt;/a&gt; </code></pre>
7,134
<p>Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?</p> <p>The only other way I can think of doing this is to run a Mac VM image on a <strong>VMWare</strong> server running on Windows, although I'm not too sure how legal this is.</p>
<p>It's certainly possible to develop on a Windows machine, in fact, my first application was exclusively developed on the old Dell Precision I had at the time :)</p> <p>There are three routes;</p> <ol> <li>Install <a href="http://en.wikipedia.org/wiki/OSx86" rel="nofollow noreferrer">OSx86</a> (aka iATKOS / Kalyway) o...
<p>Just make a web app. iOS web apps are:</p> <ol> <li>Reliable. The amount of time it takes to make an update is far shorter than with XCode.</li> <li>Fast. JavaScript on iOS is, by nature, far faster than native apps.</li> <li>Free. You never have to pay Apple a cent, as Apple doesn't have any control over you.</li> ...
4,239
<p>I have a program that I'm porting from one language to another. I'm doing this with a translation program that I'm developing myself. The relevant result of this is that I expect that there are a number of bugs in my system that I am going to need to find and fix. Each bug is likely to manifest in many places and fi...
<p>Engineers are always trained to look for an exponential curve:</p> <blockquote> <p>bugs( <em>t</em> ) = ceil [ c<sub>1</sub><em>e</em><sup> &ndash;c<sub>2</sub> <em>t</em></sup> ] + R( <em>t</em> )</p> </blockquote> <p>Where c<sub>1</sub> and c<sub>2</sub> are constants that depend on the number of test cases an...
<p>In general, the number of <em>new</em> bugs found as a function of time should follow a Poisson-like distribution. Assuming bugs are fixed essentially as they are found, then the number of open bugs should follow the same distribution.</p> <p>I actually used this early in my career to "prove" to my business unit t...
32,575
<p>This came up in one of my groups today. That we could not color bend, or mix 3d printing filaments. I have researched but I am not finding anything talking about Plastic mixing in an extruder.</p> <p>Why is it that we cannot take say a Diamond hotend, or a hotend with 5+ inputs, and mix any color we want? (assuming...
<p>I just started with google and phrase "3d printing color mixing" and on the first place (in fact first two were valueless adverts) I got this <a href="http://www.instructables.com/id/Full-Color-Mixing-3D-Printer/?ALLSTEPS" rel="nofollow noreferrer">Instructables - DIY Full Color Mixing 3D Printer</a>.</p> <p><stron...
<p>If you clearly observe the geometry of the print it has printed in different colours .the part is designed in such a way that it has the small height gap between the each colour but we cannot seen this gap in one projection plane.. We can print only in direct drive extrusion .by changing the filament of different co...
367
<p>I have a Flash movie embedded in some DIV. The trouble is that when I change any property of the enclosing DIV dynamically, Firefox (not other browsers) restarts/reinitializes Flash movie effectively resetting the whole progress (eg: file selection for upload, etc.).</p> <p>Is there some sort of a workaround for th...
<p>Try hiding it with <code>visibility:hidden</code> or if all else fails, <code>position:absolute;left:-9999px</code>.</p> <p>I presume Firefox doesn't want to waste memory and CPU on Flash animation that's invisible, so it kills it.</p>
<p>Yes, it seems like Firefox kills the flashes instances that are not visible. I had the same problem in Firefox 3.6.13 and Flash Player 10.2.152. I tryed with "visibility:hidden" and "position:absolute" but didn't work even with "wmode=opaque".<br/>&nbsp;<br/> For me the solution was setting the <strong>"wmode" to op...
38,187
<p>When I have overhangs in my model, Cura colors them red. However, I noticed if I make layer thickness thinner, the red area is reduced or disappears. </p> <p>This could mean that thinner layer thickness is better for overhang, but it could also mean that a larger ratio of line width to layer thickness is better. It...
<p>A wide line works if there is something below it to squeeze the filament against, but if you don't have a full layer below it, it will stay thinner and it will droop. I would not use extreme ratios on overhangs. Still, do a parametric test: a overhang tower (a compact one) at different line widths and layer heights....
<p>In terms of Cura's model for showing overhangs, I'm nearly sure it's just the ratio - rise over run, or rather run over rise. And indeed that's what makes sense mathematically:</p> <p>At least some portion of the wall extrusion in layer N+1 needs to sit on top of the corresponding wall extrusion in layer N. For a g...
1,663
<p>I am using a popup menu in Delphi. I want to use it in a "radio group" fashion where if the user selects an item it is checked and the other items are not checked. I tried using the AutoCheck property, but this allows multiple items to be checked. Is there a way to set the popup menu so that only one item can be ...
<p>Zartog is right, but if you want to keep the checkbox, assign this event to every item in the popup menu.</p> <p>Note that this code is a little hairy looking because it does not depend on knowing the name of your popup menu (hence, looking it up with "GetParentComponent").</p> <pre><code>procedure TForm2.OnPopupI...
<p>To enlarge on Zartog's post: Popup menus in Delphi (from at least D6) have a GroupIndex property which allow you to have multiple sets of radio items within a menu. Set GroupIndex to 1 for the first group, 2 for a second etc.</p> <p>So: Set AutoCheck = True Set RadioItem = True Set GroupIndex if you need more th...
16,276
<p>I know I once know how to do this but... how do you run a script (bash is OK) on login in unix?</p>
<p>From <a href="http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29" rel="noreferrer">wikipedia Bash</a></p> <blockquote> <p>When Bash starts, it executes the commands in a variety of different scripts.</p> <p>When Bash is invoked as an interactive login shell, it first reads and executes commands from th...
<p>The script <code>~/.bash_profile</code> is run on login.</p>
12,260
<p>In writing some test code I have found that Selector.select() can return without Selector.selectedKeys() containing any keys to process. This is happening in a tight loop when I register an accept()ed channel with</p> <pre>SelectionKey.OP_READ | SelectionKey.OP_CONNECT</pre> <p>as the operations of interest.</p> ...
<p>Short answer: remove <code>OP_CONNECT</code> from the list of operations you are interested in for the accepted connection -- an accepted connection is already connected.</p> <p>I managed to reproduce the issue, which might be exactly what's happening to you:</p> <pre><code>import java.net.*; import java.nio.chann...
<p>You should use <code>OP_CONNECT</code> when you connect to server, not when you are listening for incoming connections. Also make sure to configureBlocking <strong>before</strong> connect:</p> <pre><code> Selector selector = Selector.open(); SocketChannel serverChannel = SocketChannel.open(StandardProtocolFam...
24,984
<p>I am trying to make a php login page that allows users to access multiple .htaccess protected pages (on apache server). So a user would enter a password in a form on page 1 and depending on which login they provided, they would be sent to one directory or another, but I want the login to happen automatically to the...
<p>If you use multiple .htaccess files be sure to set the AuthName the same. This tells the browser that the same cached uid/password should be provided for that "Realm".</p>
<p>If the other pages are in the same directory or below most browsers will keep sending the same credentials for subsequent requests if you have the same .htaccess-rules for all the files/directories.</p> <p>Another alternative to passing ?user=user&amp;pass=pass would be to use POST instead of GET to sendt this requ...
46,090
<p>Right now I have an <a href="http://en.wikipedia.org/wiki/SQL_Server_Integration_Services" rel="nofollow noreferrer">SSIS</a> package that runs every morning and gives me a report on the number of packages that failed or succeeded from the day before. The information for these packages is contained partly within the...
<p>If you're in Server Explorer, you can make them visible this way:</p> <ul> <li>Create a connection to the server you want.</li> <li>Right-click the server and choose Change View > Object Type.</li> <li>You should now see System Tables and User Tables. You should see sysjobs there, and you can easily drag it onto a...
<p>It may not be available in the designer, but why not just add it to the DBML file itself?</p>
7,786
<p>What is a <strong>non recursive</strong> algorithm for deciding whether a passed in amount can be built additively from a set of numbers.<br> In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is...
<p>You have twice stated that the algorithm cannot be recursive, yet that is the natural solution to this problem. One way or another, you will need to perform a search to solve this problem. If recursion is out, you will need to backtrack manually.</p> <p>Pick the largest currency value below the target value. If it'...
<p><strong>Edit:</strong> The following will work <em>some</em> of the time. Think about why it won't work all the time and how you might change it to cover other cases.</p> <p>Build it starting with the largest bill towards the smallest. This will yeild the lowest number of bills.</p> <p>Take the initial amount an...
9,030
<p>I need to be able to compare some month names I have in an array.</p> <p>It would be nice if there were some direct way like:</p> <pre><code>Month.toInt("January") &gt; Month.toInt("May") </code></pre> <p>My Google searching seems to suggest the only way is to write your own method, but this seems like a common e...
<p><code>DateTime.ParseExact(monthName, "MMMM", CultureInfo.CurrentCulture ).Month</code></p> <p>Although, for your purposes, you'll probably be better off just creating a <code>Dictionary&lt;string, int&gt;</code> mapping the month's name to its value.</p>
<p>What I did was to use SimpleDateFormat to create a format string, and parse the text to a date, and then retrieve the month from that. The code is below:</p> <pre><code>int year = 2012 \\or any other year String monthName = "January" \\or any other month SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy")...
32,313
<p>In my question <a href="https://stackoverflow.com/questions/184729/as-a-mockist-tdd-practitioner-should-i-mock-other-methods-in-the-same-class-as">As a “mockist” TDD practitioner, should I mock other methods in the same class as the method under test?</a>, <a href="https://stackoverflow.com/users/20487/avdi">Avdi</a...
<p>3 days later...</p> <p>I found the problem! There were two things I needed to do, first off, there was a problem with one MANIFEST.MF file:</p> <p>I had the following in the MANIFEST.MF for one bundle:</p> <pre><code>Bundle-ClassPath: lib/jena.jar, ., org.apache.log4j-1.2.12.jar, lib/google-collect-snapshot.ja...
<p>This is not an actual answer to your question, but you might find some clues in this <a href="http://ekkescorner.wordpress.com/blog-series/osgi-apps/" rel="nofollow noreferrer">set of articles by ekke</a>.</p> <p>I suppose you read already "<a href="http://www.eclipsezone.com/eclipse/forums/t99588.html" rel="nofoll...
27,651
<p>In our program, each customer gets their own database. We e-mail them a link that connects them to their database. The link contains a GUID that lets the program know which database to connect to.</p> <p>How do I dynamically and programatically connect ActiveRecord to the right db?</p>
<p>You can also do this easily without hardcoding anything and run migrations automatically:</p> <pre><code>customer = CustomerModel.find(id) spec = CustomerModel.configurations[RAILS_ENV] new_spec = spec.clone new_spec["database"] = customer.database_name ActiveRecord::Base.establish_connection(new_spec) ActiveRecord...
<pre><code>class Database def self.development! ActiveRecord::Base.establish_connection(:development) end def self.production! ActiveRecord::Base.establish_connection(ENV['PRODUCTION_DATABASE']) end def self.staging! ActiveRecord::Base.establish_connection(ENV['STAGING_DATABASE']) end end </co...
21,754
<p>I'm using ASP.NET MVC and I have a partial control that needs a particular CSS &amp; JS file included. Is there a way to make the parent page render the <code>script</code> and <code>link</code> tags in the 'head' section of the page, rather than just rendering them inline in the partial contol?</p> <p>To clarify ...
<p>If I have requirements for CSS/Javascript in a partial view, I simply make sure that any page that may include the partial view, either directly or as content retrieved from AJAX, has the CSS/Javascript included in it's headers. If the page has a master page, I add a content placeholder in the master page header an...
<p>Include a place holder in your master template:</p> <pre><code>&lt;head runat="server&gt; &lt;asp:ContentPlaceHolder ID="head" runat="server" /&gt; &lt;/head&gt; </code></pre> <p>and in your control</p> <pre><code>&lt;asp:Content ID="head" runat="server"&gt; &lt;script src="something.js"&gt;&lt;/script&gt...
48,337
<p>In other words, is it correct to use:</p> <pre><code>public class CustomerList : System.Collections.Generic.List&lt;Customer&gt; { /// supposed to be empty } </code></pre> <p>instead of:</p> <pre><code>using CustomerList = System.Collections.Generic.List&lt;Customer&gt; </code></pre> <p>I'd rather use the fi...
<p>well, unless you are adding some functionality to the base class there is no point in creating a wrapper object. I would go with number two if you really need to, but why not just create a variable?</p> <pre><code>List&lt;Customer&gt; customerList = new List&lt;Customer&gt;(); </code></pre>
<p>This is one of those 'It depends' questions.</p> <p>If what you need is a new class that behaves as a List of Customers in addition to your other requirements then the inheritance is the way.</p> <p>If you just want to use a list of customers then use the variable.</p>
17,703
<p>I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I go about debugging my class?</p>
<p>Something that is handy for hard to debug sections of code is</p> <pre><code>System.Diagnostics.Debugger.Break() </code></pre> <p>Will throw a breakpoint caught by any installed debugger (VStudio, WinDbg, Remote debugger etc...).</p> <p>Use it to debug really tricky areas where regular F5+Go or "Attach to Process...
<p>build a VM, install Visual studio, make a copy of it (or create a differencing Virtual HDD) and run the installer under the debugger under the VM.</p> <p>That is what I would do (but I'm no expert).</p>
35,328
<p>I am new to SQL Server, and I have been tasked with setting permissions on a remote server. What I need to do is limit the domain admin from having access to any of the DB's on a particular server. How can I accomplish this?</p>
<p>Remove BUILTIN/Administrators from the SA group.</p>
<p><strong>Important!</strong> Before you do this make absolutley sure you have either:</p> <ul> <li>the password for the "sa" account or</li> <li>your domain account is a member of the sysadmin server role</li> </ul> <p>Otherwise you might find yourself locked out of the server.. not that this has ever happened to m...
46,059
<p>Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there.</p> <p>Like, I had to remove export to excel, an...
<p>There are a lot of properties to set which buttons would you like to see.</p> <p>For example <a href="http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer.showbackbutton(VS.80).aspx" rel="nofollow noreferrer">ShowBackButton</a>, <a href="http://msdn.microsoft.com/en-us/library/microsoft...
<p>Generally you are suppose to create your own toolbar if you want to modify it. Your solution for removing buttons will probably work if that is all you need to do, but if you want to add your own you should probably just bite the bullet and build a replacement.</p>
14,003
<p>I just installed SQL Server 2008 Express on my Vista SP1 machine. I previously had 2005 on here and used it just fine with the old SQL Server Management Studio Express. I was able to connect with no problems to my PC-NAME\SQLEXPRESS instance (no, PC-NAME is not my computer name ;-).</p> <p>I uninstalled 2005 and SQ...
<p>Please check the ServerName which you provided. It should match with the below shown Name in the UserName textbox, and that name should followed with <code>\SQLEXPRESS</code>:</p> <p><img src="https://i.stack.imgur.com/6Dqbk.png" alt="Connect dialog"></p>
<p>For me it was a windows firewall issue. Allow incoming connections. Opening port didn't work but allow programs did.</p> <p><a href="http://technet.microsoft.com/en-us/library/ms345343.aspx" rel="nofollow noreferrer">Link</a></p> <p><a href="https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/how-to-configu...
46,998
<p>Specifically MSSQL 2005.</p>
<p>Here's a solution that gives you the last second of the current month. You can extract the date part or modify it to return just the day. I tested this on SQL Server 2005.</p> <pre><code>select dateadd( s, -1, dateadd( mm, datediff( m, 0, getdate() ) + 1, 0 ) ); </code></pre> <p>To understand how it works we hav...
<p>Some links to possible answers:</p> <ul> <li><p><a href="http://www.extremeexperts.com/sql/Tips/DateTrick.aspx" rel="nofollow noreferrer">http://www.extremeexperts.com/sql/Tips/DateTrick.aspx</a></p></li> <li><p><a href="http://www.devx.com/tips/Tip/14405" rel="nofollow noreferrer">http://www.devx.com/tips/Tip/1440...
22,089
<p>We are investigating using CruiseControl.NET as both a Continues Integration build provider, as well as automating the first part of our deployment process.</p> <p>Has anyone modified CruiseControl.NET's dashboard to add custom login and user roles (IE, Separate out access to forcing a build to only certain individ...
<p>Why do you need to? Do you really need to limit users in the way with an integration server. I think that's why CC.Net doesn't have that sort of support built in.</p> <p>You can always see who forced a build, and control it that way.</p> <p>I find that continuous integration works best with regular builds and regu...
<p>@Keith:</p> <p>We are leveraging CC.NET to both run a CI build, as well as being able to use the Force Build feature to do a Build + Deploy. That is why we want hands off the dashboard.</p> <p>I found this morning that I was able to place CCNET in a virtual directory within another web app, This allowed me to setu...
3,871
<p>I'm guessing I need to implement an <code>NVelocityViewEngine</code> and <code>NVelocityView</code> - but before I do I wanted to check to see if anyone has already done this.</p> <p>I can't see anything in the <a href="http://mvccontrib.googlecode.com/svn/trunk/" rel="nofollow noreferrer">trunk</a> for <a href="htt...
<p>Exponentiation by squaring.</p> <pre><code>int ipow(int base, int exp) { int result = 1; for (;;) { if (exp &amp; 1) result *= base; exp &gt;&gt;= 1; if (!exp) break; base *= base; } return result; } </code></pre> <p>This is the standard ...
<p>My case is a little different, I'm trying to create a mask from a power, but I thought I'd share the solution I found anyway.</p> <p>Obviously, it only works for powers of 2.</p> <pre><code>Mask1 = 1 &lt;&lt; (Exponent - 1); Mask2 = Mask1 - 1; return Mask1 + Mask2; </code></pre>
12,692
<p>Right now I have a few new applications being developed against an Oracle Database, and sometimes they crash or fail to end correctly, etc... anyways the problem is they sometimes seem to leave their connections open, and I need to cleanup after them. My question is if there is a way from the database-side of things...
<p>Here's a page referring to connection timeout parameters you can set in <a href="http://download.oracle.com/docs/cd/B28359_01/java.111/e10788/optimize.htm#sthref181" rel="nofollow noreferrer">Oracle 11g</a>. I think the 'Abandon Connection Timeout' is what you're looking for. </p>
<p>I believe you are looking for the SQLNet.ora parameter <a href="http://download.oracle.com/docs/cd/B19306_01/network.102/b14213/sqlnet.htm#sthref479" rel="nofollow noreferrer">EXPIRE_TIME</a> which tells the database to send a probe to the client every few minutes to verify that the connection is still alive.</p>
38,115