instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>How would I remove the border from an iframe embedded in my web app? An example of the iframe is:</p> <pre><code>&lt;iframe src="myURL" width="300" height="300"&gt;Browser not compatible.&lt;/iframe&gt; </code></pre> <p>I would like the transition from the content on my page to the contents of the iframe to be sea...
<p>Add the <code>frameBorder</code> attribute (note the <strong>capital ‘B’</strong>).</p> <p>So it would look like:</p> <pre><code>&lt;iframe src="myURL" width="300" height="300" frameBorder="0"&gt;Browser not compatible.&lt;/iframe&gt; </code></pre>
<pre><code>iframe src="XXXXXXXXXXXXXXX" marginwidth="0" marginheight="0" width="xxx" height="xxx" </code></pre> <p>Works with Firefox ;)</p>
9,073
<p>I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though there is a type for it?). </p> <p>I coul...
<p>Are the two partial classes in the same namespace? That could be an explanation.</p>
<p>Just for reference (VS 2020)... Error CS0103 =&gt; All same but different folder.</p> <p>But classes should have same namespace AND ALSO BE in same folder !!!</p> <p>Although they could be defined in the same namespace, both files should be in the same folder. I know that the folder structure should reflect the name...
22,369
<p>How do I iterate over a timespan after days, hours, weeks or months?</p> <p>Something like:</p> <pre><code>for date in foo(from_date, to_date, delta=HOURS): print date </code></pre> <p>Where foo is a function, returning an iterator. I've been looking at the calendar module, but that only works for one specifi...
<p>Use <a href="http://labix.org/python-dateutil" rel="noreferrer">dateutil</a> and its rrule implementation, like so:</p> <pre><code>from dateutil import rrule from datetime import datetime, timedelta now = datetime.now() hundredDaysLater = now + timedelta(days=100) for dt in rrule.rrule(rrule.MONTHLY, dtstart=now,...
<p>This library provides a handy calendar tool: <a href="http://www.egenix.com/products/python/mxBase/mxDateTime/" rel="nofollow noreferrer">mxDateTime</a>, that should be enough :)</p>
18,542
<p>I've got an <code>RSA</code> private key in <code>PEM</code> format, is there a straight forward way to read that from .NET and instantiate an <code>RSACryptoServiceProvider</code> to decrypt data encrypted with the corresponding public key?</p>
<h3>Update 03/03/2021</h3> <p>.NET 5 now supports this out of the box.</p> <p>To try the code snippet below, generate a keypair and encrypt some text at <a href="http://travistidwell.com/jsencrypt/demo/" rel="noreferrer">http://travistidwell.com/jsencrypt/demo/</a></p> <pre><code>var privateKey = @&quot;-----BEGIN RSA ...
<p>Check <a href="http://msdn.microsoft.com/en-us/library/dd203099.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/dd203099.aspx</a></p> <p>under Cryptography Application Block.</p> <p>Don't know if you will get your answer, but it's worth a try.</p> <p><strong>Edit after Comment</strong>.</p...
30,182
<p>I know the answer is not going to be simple, and I already use a couple of (I think ugly) cludges. I am simply looking for some elegant answers.</p> <p>Abstract class:</p> <pre><code>public interface IOtherObjects; public abstract class MyObjects&lt;T&gt; where T : IOtherObjects { ... public List&lt;T&gt; ...
<p>In your case MyObjectsA and MyObjectsB don't have common predecessor. Generic class is template for <em>different</em> classes not a common base class. If you want to have common properties in different classes use interfaces. You can't call <em>ToList</em> in a loop cause it has different signature in different cla...
<p>Generics are used for static time type checks <strong>not</strong> runtime dispatch. Use inheritance/interfaces for runtime dispatch, use generics for compile-time type guarantees.</p> <pre><code>interface IMyObjects : IEnumerable&lt;IOtherObjects&gt; {} abstract class MyObjects&lt;T&gt; : IMyObjects where T : IOth...
7,682
<p>I do web site debugging with Internet&nbsp;Explorer (as well as other browsers), but my problem is with Internet&nbsp;Explorer, as it is the browser I usually use for regular browsing.</p> <p>In order to debug you need to turn on debug mode in the advanced options. OK, fine. It's turned on. But the issue I have, th...
<p>The quickest way I can think of would be to write a small utility to:</p> <ul> <li>Close all IE windows</li> <li>Toggle the REG_SZ registry value HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger (from "yes" to "no" or vice versa)</li> <li>Optionally restart IE</li> </ul> <p>As fa...
<p>Have a look at <a href="http://www.debugbar.com/" rel="nofollow noreferrer">debugbar</a>. It's free for personal use, and it has a 60 days trial for commercial. It works a bit like fireug for Firefox, but obviously it's going to cost to use.</p>
23,728
<p>Fun with enums in C#. Take one generic list that is created to store some Enum that you had defined previously and add few items in it. Iterate with foreach or <code>GetEnumerator&lt;T&gt;()</code> but specify some other enum then the original and see what happens. I was expecting InvalidCastException or something l...
<p>Enum types are distinct, but you're being confused by an implicit cast which is in foreach.</p> <p>Let's rewrite your loop a bit:</p> <pre><code>public static void Main() { List&lt;Cars&gt; cars = new List&lt;Cars&gt;(); List&lt;Animals&gt; animals = new List&lt;Animals&gt;(); cars.Add(Cars.Chevrolet);...
<p>You can also derive an enum from a specific type.</p> <pre><code>public enum Cats : byte { ... } public enum Dogs : int { ... } </code></pre>
45,859
<p>I need to convert a bundle of static HTML documents into a single PDF file programmatically on the server side on a Java/J2EE platform using a batch process preferably. The pdf files would be distributed to site users for offline browsing of the web pages. </p> <p>The major points of the requirements are:</p> <ol>...
<p>Try <a href="http://xmlgraphics.apache.org/fop/" rel="nofollow noreferrer">Apache FOP</a>. I just used it to <a href="https://stackoverflow.com/questions/212577/how-do-you-create-a-pdf-from-xml-in-java">convert XML to PDF</a> and I think you can do the same with HTML/DOM. The website has <a href="http://xmlgraphics....
<p>You can try <a href="http://www.lowagie.com/iText" rel="nofollow noreferrer">iText</a> - but I am not sure whether it handles all that you require. </p> <p>Moreover, it is always better if you explore many options and then decide what you can and cannot do. In many cases there won't be any library/API that will out...
29,606
<p>I'm looking for a clean C++ way to parse a string containing expressions wrapped in ${} and build a result string from the programmatically evaluated expressions.</p> <p>Example: "Hi ${user} from ${host}" will be evaluated to "Hi foo from bar" if I implement the program to let "user" evaluate to "foo", etc.</p> <...
<pre><code>#include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;string&gt; #include &lt;map&gt; using namespace std; struct Token { enum E { Replace, Literal, Eos }; }; class ParseExp { private: enum State { State_Begin, State_Literal, St...
<p>How many evaluation expressions do intend to have? If it's small enough, you might just want to use brute force.</p> <p>For instance, if you have a <code>std::map&lt;string, string&gt;</code> that goes from your <code>key</code> to its <code>value</code>, for instance <code>user</code> to <code>Matt Cruikshank</co...
32,965
<p>We're testing WYSIWYG editors, and we cannot see to make them work with asynchronous postbacks. We put the TextBox(/textarea) in the UpdatePanel and call a simple save to the DB, and all of our WYSIWYG toolbars disappear, leaving us with a bunch of HTML in textboxes.</p> <p>This is the one we've been working to im...
<p>This is mostly (independent upon your WYSIWYG control) due to two problems. Either the WYSIWG editor runs JS on the "onLoad" event (which you cannot fix easily) or your WYSIWYG editor includes JavaScript upon becoming Visible (which won't be rendered back to client in an Ajax Request without taking special actions)<...
<p>From what I remember from TinyMCE, you need to turn off the editor before your POST.</p> <p>I've also had success with <a href="http://www.innovastudio.com/" rel="nofollow noreferrer">InnovaStudio</a>, but you have to pay for it ($59.99).</p> <p>I'm waiting for <a href="http://www.37signals.com/svn/posts/1330-intr...
31,328
<p>I'm looking for some software that allows me to control a server based application, that is, there are bunch of interdependent processes that I'd like to be able to start up, shut down and monitor in a controller manner.</p> <p>I've come across programs like Autosys, but that's expensive and very much over the top ...
<p>Try Supervise, which is what qmail uses to keep track of it's services/startup applications:</p> <p><a href="http://cr.yp.to/daemontools/supervise.html" rel="nofollow noreferrer">http://cr.yp.to/daemontools/supervise.html</a></p>
<p>Solaris-only as far as I know, but wouldn't Solaris 10's <a href="http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.jsp" rel="nofollow noreferrer">SMF</a> do what you want?</p>
5,871
<p>Is there something similar to <code>sprintf()</code> in C#?</p> <p>I would for instance like to convert an integer to a 2-byte byte-array.</p> <p>Something like:</p> <pre><code>int number = 17; byte[] s = sprintf("%2c", number); </code></pre>
<pre><code>string s = string.Format("{0:00}", number) </code></pre> <p>The first 0 means "the first argument" (i.e. number); the 00 after the colon is the format specifier (2 numeric digits).</p> <p>However, note that .NET strings are UTF-16, so a 2-character string is 4 bytes, not 2</p> <p>(edit: question changed f...
<p>EDIT: I'm assuming that you want to convert the value of an integer to a byte array and not the value converted to a string first and then to a byte array (check marc's answer for the latter.)</p> <p>To convert an int to a byte array you can use:</p> <pre><code>byte[] array = BitConverter.GetBytes(17); </code></pr...
40,345
<p>I am currently printing PLA infused with 80% copper powder. So far I mainly used it because it looks and feels really nice and post-processing is almost limitless, however recently I have thought that metal-like filaments might actually be a good idea for gears (in case I don't want to use polycarbonate or carbon fi...
<p>With the right material, you could print the gear and then sinter it, resulting in actual metal gears. However, 80 % metal-filled PLA is at the lowest border to achieve this, and a lot of that technology is patented.</p> <h2>Filamet<sup>TM</sup></h2> <p>Filamet<sup>TM</sup> is a <a href="https://shop.thevirtualfound...
<p>At a guess, copper really isn't that strong so you're likely to see minimal improvements, if any.</p> <p>The PLA carrier plastic is still PLA, with a low melting point.</p> <p>The copper won't &quot;fuse&quot; with the PLA, it will still be flakes of metal embedded in a tiny pocket inside of a plastic structure.</p>...
2,088
<p>Say I have a method that needs to pull 8 values from a map with 100 elements in it. Which do you think would be preferable:</p> <p>Walk in a for loop from begin to end once, pulling the elements out by switching on the key?</p> <p>Or using find 8 times to get those values?</p>
<p>Walking the list will take you O(n) time to find a random element.</p> <p>Map is a balanced binary tree, so doing a find is O(log n). </p> <p>Thus doing 8 finds results in 8*log2(n) and walking the list is (n). The larger the list, the larger the gains, but in all <em>random</em> cases doing finds will be faster...
<p>Let's assume "find" bails when it finds the key.</p> <p>Let's further assume that you code the "switch" sensibly, and it quits checking after it finds a match. We will also assume you <em>don't</em> bother to code it to bail on the whole process once all 8 have been found (that would probably be a pain to code up)....
36,764
<p>I have a collection of data stored in XDocuments and DataTables, and I'd like to address both as a single unified data space with XPath queries. So, for example, "/Root/Tables/Orders/FirstName" would fetch the value of the Firstname column in every row of the DataTable named "Orders". </p> <p>Is there a way to do t...
<p>I eventually figured out the answer to this myself. I discovered a class in System.Xml.LINQ called XStreamingElement that can create an XML structure on-the-fly from a LINQ expression. Here's an example of casting a DataTable into an XML-space.</p> <pre><code>Dictionary&lt;string,DataTable&gt; Tables = new Dictiona...
<p>You would have to merge your documents, or at lest perform the same transformations on all of your documents. You may consider moving your documents to a single DataTable, then filtering the DataTable if the XPath / XSLT is not do-able.</p>
18,086
<p>If I want to check for the null string I would do</p> <pre><code>[ -z $mystr ] </code></pre> <p>but what if I want to check whether the variable has been defined at all? Or is there no distinction in Bash scripting?</p>
<p>I think the answer you are after is implied (if not stated) by <a href="https://stackoverflow.com/users/5190/vinko-vrsalovic">Vinko</a>'s <a href="https://stackoverflow.com/a/228552/15168">answer</a>, though it is not spelled out simply. To distinguish whether VAR is set but empty or not set, you can use:</p> <pre>...
<p>Call <em><a href="https://ss64.com/bash/set.html" rel="nofollow noreferrer">set</a></em> without any arguments... it outputs all the defined variables.</p> <p>The last ones on the list would be the ones defined in your script.</p> <p>So you could pipe its output to something that could figure out what things are def...
28,279
<p><B>This came out being incomprehensible. I will rephrase</B></p> <p>Is there an algorithm or approach that will allow sorting an array in such a way that it minimizes the differences between successive elements? </p> <pre><code>struct element { uint32 positions[8]; } </code></pre> <p>These records are order-ins...
<h2>Your problem</h2> <p>I think this question should really be tagged with 'compression'.</p> <p>As I understand it, you have unordered records which consist of eight 4-byte integers: 32 bytes in total. You want to store these records with a minimum file size, and have decided to use some form of <a href="http://en....
<p>You're looking at a pair of subproblems, defining the difference between structures, then the sort.</p> <p>I'm not terribly clear on your description of the structure, nor on the precedence of differences, but I'll assume you can work that out and compute a difference score between two instances. For files, there ...
41,338
<p>I need to test a web form that takes a file upload. The filesize in each upload will be about 10 MB. I want to test if the server can handle over 100 simultaneous uploads, and still remain responsive for the rest of the site.</p> <p>Repeated form submissions from our office will be limited by our local DSL line. Th...
<p>Use the <a href="http://httpd.apache.org/docs/2.0/programs/ab.html" rel="noreferrer">ab (ApacheBench)</a> command-line tool that is bundled with Apache (I have just discovered this great little tool). Unlike cURL or wget, ApacheBench was designed for performing stress tests on web servers (any type of web server!). ...
<p>I would perhaps guide you towards using cURL and submitting just random stuff (like, read 10MB out of <code>/dev/urandom</code> and encode it into base32), through a POST-request and manually fabricate the body to be a file upload (it's not rocket science).</p> <p>Fork that script 100 times, perhaps over a few serv...
28,350
<p>I have an application which is fully unicode compatible in Delphi 2006. I had replaced all AnsiStrings with WideStrings, replaced all VCL controls with TNT controls, and changed all string functions from AnsiStrings to WideStrings. It looks like all that work was for nothing, because I'm going to have to reverse it ...
<p>No, there really isn't. But you won't regret the work to truly Unicode enable your application.</p> <p>The TNT controls can easily be replaced with the regular VCL controls. You can do that pretty simply using the wizard from GExperts (<a href="http://www.gexperts.org" rel="nofollow noreferrer">http://www.gexperts...
<p>Main advantage of TNT Controls is only that It can work as Ansi program in Windows 9x. It is not full unicode. If you want full unicode support everywhere (such as Stringlist.LoadFromFile, Form.OnKeyPress) it's good to move to Delphi 2009.</p>
38,512
<p>Given:</p> <pre><code>DateTime.UtcNow </code></pre> <p>How do I get a string which represents the same value in an <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">ISO 8601</a>-compliant format?</p> <p>Note that ISO 8601 defines a number of similar formats. The specific format I am looking for is:...
<blockquote> <p><strong>Note to readers:</strong> Several commenters have pointed out some problems in this answer (related particularly to the first suggestion). Refer to the comments section for more information.</p> </blockquote> <pre><code>DateTime.UtcNow.ToString(&quot;yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz&quot;, Cul...
<p>As mentioned in other answer, <code>DateTime</code> has issues by design.</p> <h2>NodaTime</h2> <p>I suggest to use <a href="https://nodatime.org/" rel="nofollow noreferrer">NodaTime</a> to manage date/time values:</p> <ul> <li>Local time, date, datetime</li> <li>Global time</li> <li>Time with timezone</li> <li>P...
14,028
<p>Many times we find ourselves working on a problem, only to figure out the solution being created is far more complex than the problem requires. Are there controls, best practices, techniques, etc that help you control over complication in your workplace?</p>
<p>Getting someone new to look at it. </p>
<p>It is inevitable once you have been a programmer that this will happen. If you seriously have unestimated the effort or hit a problem where your solution just doesn't work then stop coding and get talking to your project manager. I always like to take the solutions with me to the meeting, problem is A, you can do x ...
11,183
<p>How does the SQL Server JDBC Trusted Connection Authentication work? (ie how does the trusted connection authenticate the logged in AD user in such a transparent and elegant fashion and how can I implement a similar authentication solution for my client-server applications in Java without a database connection or an...
<p>It depends on the client. For example if you have a Web Browser, it can use the NTLM Authentication to pass the domain authentication of your current client to the server. In this case the browser like IE or FF supports this, and you web server needs the support for NTLM. For example here for Tomcat: <a href="http:/...
<p>Have you looked at <a href="https://stackoverflow.com/questions/167464/can-i-connect-to-sql-server-using-windows-authentication-from-java-ee-webapp">this question</a>? The situation seems to be similar to yours (connecting to a SQL Server database using Windows authentication).</p>
27,244
<p>When setting up a Home Directory on IIS6 properties for a web site there's an option to "Index this resource" which is checked on by default.</p> <p>Microsoft's site says: </p> <blockquote> <p>Grant this permission to allow Microsoft Indexing Service to include this folder in a full-text index of the Web s...
<p>Windows index service continuously extracts contents from files (for which an appropriate IFilter is installed) under a specified directory and constructs an indexed catalog to facilitate efficient and rapid searching.</p> <p>When you set "Index this resource" on IIS 6 and Windows Index Service is running, the serv...
<p>This is for using the indexing service which used to drive the Search. I don't think anyone uses this anymore. It's pretty intensive against the HD. Check to see if the indexing service is even enabled on your server. We would disable by default.</p> <p>If you open the indexing service mmc there will be a system an...
21,205
<p>I am printing small mechanical pieces in ABS:</p> <ul> <li>100 ºC bed temperature</li> <li>70 ºC Room temperature</li> <li>250 ºC nozzle temperature</li> <li>0.4 mm nozzle, at 0.15 mm per layer.</li> <li>100.8 % scale to compensate ABS dimensional innacuracy.</li> </ul> <p>The first layer is printed correctly, but l...
<p>The up-curling of overhangs is frequently seen when printing PLA or PETG when the just deposited layer hasn't been cooled enough. The residual heat will allow the curling as the plastic has not been fully set (above the so called glass temperature) because of insufficient part cooling.</p> <p>Knowing that ABS doesn'...
<p>We usually stick the masking tape on the printer's bottom plate, so that the model is formed on the side of the masking tape which without glue, which looks good. When there is no masking tape, we sometimes manually adjust the height of the bottom plate to make the nozzle appress to the bottom plate when printing th...
1,719
<p>If you have two applications residing on the same server, can you use Server.Transfer to load a page in a different AppDomain/Application?</p> <p>My guess is no, because Server.Transfer() copies HttpContext.Items, among other things. To copy this data between AppDomains, would cause threading and memory sharing con...
<p>Nope, it's not possible.</p> <p><code>Server.Transfer</code> and <code>Server.Execute</code> cannot be used in these scenarios.</p> <p>It does not, however, copy the <code>HttpContext.Items</code>. It's not copied. The same <code>HttpContext</code> is reused.</p>
<p>You can't use Server.Transfer() across web apps. The reason being that it actually just changes the page that the HttpHandler was going to return, rather than finishing the request and making a new one. It causes an extra trip to the browser, but Response.Redirect() is really the way to do it.</p> <p><a href="htt...
49,641
<p>After attending a recent Alt.NET group on IoC, I got to thinking about the tools available and how they might work. <code>StructureMap</code> in particular uses both attributes and bootstrapper concepts to map requests for <code>IThing</code> to <code>ConcreteThing</code>. Attributes automatically throw up flags f...
<p>I can't say much for other IoC toolkits but I use Spring.Net and have found that there is a one off initial performance penalty at startup. Once the container has been configured the application runs unaffected.</p>
<p>They major problem is that code becomes hard to understand. It might become <em>pure magical</em> if one overuse IoC. Another problem is performance. In most cases performance lost is not noticeable. But when you start creating most of your objects via IoC container, it can suddenly drop below ocean level.</p>
8,243
<p>I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it.</p> <p>I didn't want to just dump a bunch of code in the question so I've posted the code for the class on <code>refactormycode</code>.</p> <p><strong><a href="http://www.refactormycode.com...
<p>The way I do it is the following:</p> <pre><code>class test { protected $x=''; protected $y=''; function set_y ($y) { print "specific function set_y\n"; $this-&gt;y = $y; } function __call($function , $args) { print "generic function $function\n"; list ($name , ...
<p>I've always handled this issue in a similar with a __call which ends up pretty much as boiler plate code in many of my classes. However, it's compact, and uses the reflection classes to only add getters / setters for properties you have already set (won't add new ones). Simply adding the getter / setter explicitly w...
5,207
<p>I see iframe/p3p trick is the most popular one around, but I personally don't like it because javascript + hidden fields + frame really make it look like a hack job. I've also come across a master-slave approach using web service to communicate (<a href="http://www.15seconds.com/issue/971108.htm" rel="noreferrer">ht...
<p>My approach designates one domain as the 'central' domain and any others as 'satellite' domains.</p> <p>When someone clicks a 'sign in' link (or presents a persistent login cookie), the sign in form ultimately sends its data to a URL that is on the central domain, along with a hidden form element saying which domain...
<p>What you do is on the domain receiving the variables you check the referrer address as well so you can confirm the link was from your own domain and not someone simply typing the link into the address bar. This approach works well. </p>
32,923
<p>I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overview. Some of the features (to me at least) would be nice if they had m...
<p>There's been a string of articles in <a href="http://perltraining.com.au/tips/" rel="nofollow noreferrer">Perl Tips</a> about Perl 5.10:</p> <ul> <li><a href="http://perltraining.com.au/tips/2008-02-08.html" rel="nofollow noreferrer">Regular Expressions in Perl 5.10</a></li> <li><a href="http://perltraining.com.au/...
<p>See Ricardo Signes' slides for his excellent "Perl 5.10 For People Who Aren't Totally Insane."</p> <p><a href="http://www.slideshare.net/rjbs/perl-510-for-people-who-arent-totally-insane" rel="nofollow noreferrer">http://www.slideshare.net/rjbs/perl-510-for-people-who-arent-totally-insane</a></p>
20,345
<p>I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info.</p>
<p>Look for the commands <code>du</code> (disk usage) and <code>df</code> (disk free)</p>
<p>du -sm * => RULLLLLEZ</p>
28,525
<p>Where would the physical files be?</p>
<p>It depends on the OS and whether or not roaming user profiles are enabled.</p> <p>For example, on XP, with non-roaming profiles, the location is</p> <pre><code>&lt;SYSTEMDRIVE&gt;\Documents and Settings\&lt;user&gt;\Local Settings\Application Data\Microsoft\IsolatedStorage </code></pre> <p>On Vista with roaming ...
<p>When accessed/created by a system account, I found the folder here:</p> <pre><code>C:\Windows\SysWOW64\config\systemprofile\AppData\Local\IsolatedStorage </code></pre>
34,728
<p>I have a question about locking. This doesn't have to be only about record locking, but anyway.</p> <p>Let's say I'm writing a web accessible CMS. I am struggling with some ideas.</p> <p>I could, on the moment when a user opens an article for editing, flag the article as being 'in use'. so far so good.</p> <p>but...
<p>Why not use timestamps? Don't actually worry about locking anything, just react to the event where the record (article) has changed.</p> <p>Basically, before you save the article, check if your version (timestamp) is the same as what is on disk. If same, then you still have latest copy so write it, if not then .....
<p>Use rowversion for mssql 2005 and up, timestamp for mssql 2000 and below. Use the hidden xmin field for postgresql.</p> <p>Let all other users open the record. Along with saving the record, tag who saved it, and with the aid of rowversion, on catch(DbConcurrencyException) re-throw an error which indicate to other ...
20,025
<p>I am a big fan of the Lightbox2 library, and have used it in the past just not on an MVC project. In the past I remember that Lightbox2 was picky about the paths it scripts, css, and images resided in. I remember specifically have to put everything in subdirectories of the page's path, else it wouldn't work.</p> <p...
<p>I believe Lightbox assumes you have a structure as follows:</p> <pre> /images prevlabel.gif nextlabel.gif loading.gif closelabel.gif /css lightbox.css lightbox.js </pre> <p>You can just open lightbox.js and find:</p> <pre><code>fileLoadingImage: 'images/loading.gif', fileBottomNavC...
<p>Which MVC framework are we talking about here? While I'm not familiar with that particular lightbox library, I'd highly recommend you figure out the proper way to reference the javascript files via an absolute path at the root of your site:</p> <pre> <code> &lt;script type="text/javascript" src="/js/prototype.js"> ...
26,718
<p>Can you provide examples of applications today that are procedural and maintain a high level of integrity and efficiency? Are there any books, tutorials or links that provide examples of how to successfully build and maintain an imperative system? If you were to give guidance in this area, what tips would you give o...
<p>Examples of successful procedural applications??</p> <p>You mean like, say, the Linux kernel? BSD kernel? Apache web server? The vast bulk of the Unix userland utilities? Applications like that?</p> <p>Of course OOP techniques have value in the organization, maintainability, and abstractions within software, but e...
<p>While I cant point toward any existing system directly, there are massive amounts of legacy enterprise systems written pre-OO COBOL. Many classic 4GL programs are procedural and are aimed at high integrity systems engineering. Some are well written, others not so much.</p> <p>Books include "COBOL from Micro to Main...
32,183
<p>I'm having an unusual problem with an IE document with contentEditable set to true. Calling select() on a range that is positioned at the end of a text node that immediately precedes a block element causes the selection to be shifted to the right one character and appear where it shouldn't. I've submitted a bug to...
<p>I've figured out a few methods for dealing with IE ranges like this.</p> <p>If all you want to do is save where the cursor is, and then restore it, you can use the pasteHTML method to insert an empty span at the current position of the cursor, and then use the moveToElementText method to put it back at that positio...
<p>I recently worked at a site which used Microsoft CMS with the "MSIB+ pack" of controls which included a WYSIWYG editor which ran in Internet Explorer.</p> <p>I seem to remember some comments in the editor client-side Javascript which were specifically related to this bug in IE and the Range.Select() method.</p> <p...
15,808
<p>I have an application that I have to run as Administrator.</p> <p>One small part of that application is to start other applications with Process.Start</p> <p>The started applications will also be run as administrators, but I'd rather see them run as the 'normal' user.</p> <p>How do I accomplish that?</p> <p>/joh...
<p>The WinSafer API's allow a process to be launched as a limited, normal, or elevated user.</p> <p><strong>Sample Usage:</strong></p> <pre><code>CreateSaferProcess(@"calc.exe", "", SaferLevel.NormalUser); </code></pre> <p><strong>Source code:</strong></p> <pre><code>//http://odetocode.com/Blogs/scott/archive/2004/...
<p>I had the same requirement and I come to the solution to use the task scheduler service from Windows.</p> <p>So, first add <a href="https://taskscheduler.codeplex.com/" rel="nofollow">the <code>Task Scheduler Managed Wrapper</code></a> <a href="https://www.nuget.org/packages/TaskScheduler/" rel="nofollow">library t...
23,938
<p>Will IE6 negotiate a 256 bit AES SSL connection if the server is capable?</p>
<p>Sometimes there is just a plain and simple way of finding out. If you look at the internet explorer help > about internet explorer, it will tell you the max cipher bits that it supports, and on IE6 its 128.</p>
<p>The about dialog in Internet Explorer 6 on Windows XP with SP3 states cipher support as 128-bit.</p>
12,290
<p>What is the idiomatic Python equivalent of this C/C++ code?</p> <pre class="lang-cpp prettyprint-override"><code>void foo() { static int counter = 0; counter++; printf("counter is %d\n", counter); } </code></pre> <p>specifically, how does one implement the static member at the function level, as oppose...
<p>A bit reversed, but this should work:</p> <pre><code>def foo(): foo.counter += 1 print "Counter is %d" % foo.counter foo.counter = 0 </code></pre> <p>If you want the counter initialization code at the top instead of the bottom, you can create a decorator:</p> <pre><code>def static_vars(**kwargs): def ...
<p>Sure this is an old question but I think I might provide some update.</p> <p>It seems that the performance argument is obsolete. The same test suite appears to give similar results for siInt_try and isInt_re2. Of course results vary, but this is one session on my computer with python 3.4.4 on kernel 4.3.01 with Xe...
35,339
<p>I am trying to process files one at a time that are stored over a network. Reading the files is fast due to buffering is not the issue. The problem I have is just listing the directories in a folder. I have at least 10k files per folder over many folders.</p> <p>Performance is super slow since File.list() return...
<p>Although it's not pretty, I solved this kind of problem once by piping the output of dir/ls to a file before starting my app, and passing in the filename.</p> <p>If you needed to do it within the app, you could just use system.exec(), but it would create some nastiness.</p> <p>You asked. The first form is going t...
<p>I wonder why there are 10k files in a directory. Some file systems do not work well with so many files. There are specifics limitations for file systems like max amount of files per directory and max amount of levels of subdirectory.</p> <p>I solve a similar problem with an iterator solution. </p> <p>I needed to ...
46,213
<p>I have a SharePoint site that is locked down through standard Windows permissions.</p> <p>I keep getting an repeated login box prompt, and it appears that it has to do with the Themes images and the CSS style sheets.</p> <p><a href="https://i.stack.imgur.com/dXRS0.png" rel="nofollow noreferrer"><img src="https://i...
<p>Using <a href="http://www.fiddler2.com/fiddler2/" rel="nofollow noreferrer">Fiddler</a> which is a web inspection tool, you can actually determine which <em>domains</em> the rejected requests are attempting to access. As <a href="https://stackoverflow.com/questions/375498/sharepoint-permissions-repeated-login-boxes/...
<p>If your running Windows XP the following should solve your problem.</p> <p>Try setting your network passwords using Stored User Names and Passwords app.</p> <p><a href="http://support.microsoft.com/kb/306992" rel="nofollow noreferrer">http://support.microsoft.com/kb/306992</a></p>
49,140
<p>I would like to make a 24&nbsp;V (3D printer board and shield) setup, as opposed to the usual 12&nbsp;V, and to do so I had been considering using the Taurino Power board, or the clone Eruduino. However, I just found this board:</p> <p><a href="https://i.stack.imgur.com/FoUYh.jpg" rel="nofollow noreferrer" title="R...
<p>Given that the capacitor near the input is quite clearly marked 35&nbsp;V, a 36&nbsp;V rating seems questionable.</p> <p>The (buck) regulator used on the (genuine version of the) board is the <a href="http://www.aosmd.com/res/data_sheets/AOZ1282CI.pdf" rel="nofollow noreferrer">AOZ1282CI</a> which supports up to 36...
<p>For completion, I've just seen this, <a href="https://www.reddit.com/r/3Dprinting/comments/9wfrmk/can_a_ramps_16_support_24v/" rel="nofollow noreferrer">Can a ramps 1.6 support 24v?</a> (which basically confirms the 24&nbsp;V support of the Re-ARM board) although it isn't particularly useful w.r.t. the RAMPS 1.6 sid...
1,412
<p>Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net?</p>
<p><strong>Update</strong>: Since I wrote this answer two years ago, we productized Mono to run on Android. The work included a few steps: porting Mono to Android, integrating it with Visual Studio, building plugins for MonoDevelop on Mac and Windows and exposing the Java Android APIs to .NET languages. This is now...
<p>.NET for Android seems like a real possibility to me. There is news that Microsoft will release proper Silverlight for Android- Never underestimate the advantages to Microsoft for putting the boot into Apple. A smartphone that is faster, more feature rich, faster development lifecycle, impressive hardware, Flash &am...
26,379
<p>What does <code>STRAIGHT_JOIN</code> do in this code ?</p> <pre><code>SELECT STRAIGHT_JOIN ClosingBalance FROM Accounts WHERE idAccounts = FidDebit; </code></pre>
<p>STRAIGHT_JOIN is intended as an instruction to the MySQL query optimiser that the tables must be joined from left to right in the order they are listed in the query.</p> <p><a href="http://dev.mysql.com/doc/refman/5.0/en/join.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/join.html</a></p> <p>As you...
<p>From <a href="http://dev.mysql.com/doc/refman/5.0/en/join.html" rel="nofollow noreferrer">here</a>:</p> <blockquote> <p>STRAIGHT_JOIN is similar to JOIN, except that the left table is always read before the right table. This can be used for those (few) cases for which the join optimizer puts the tables in the wro...
40,454
<p>So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET".</p> <p>I've seen some examples/helpers out on the nets, but some ar...
<p>Using MoQ it looks something like this:</p> <pre><code>var request = new Mock&lt;HttpRequestBase&gt;(); request.Expect(r =&gt; r.HttpMethod).Returns("GET"); var mockHttpContext = new Mock&lt;HttpContextBase&gt;(); mockHttpContext.Expect(c =&gt; c.Request).Returns(request.Object); var controllerContext = new Control...
<p>I find that long mocking procedure to be too much friction.</p> <p>The best way we have found - using ASP.NET MVC on a real project - is to abstract the HttpContext to an IWebContext interface that simply passes through. Then you can mock the IWebContext with no pain.</p> <p>Here is an <a href="http://code.google....
5,261
<p>I have run into a bit of a tricky problem in some C++ code, which is most easily described using code. I have classes that are something like:</p> <pre><code>class MyVarBase { } class MyVar : public MyVarBase { int Foo(); } class MyBase { public: MyBase(MyVarBase* v) : m_var(v) {} virtual MyVarBase* ...
<p>The correct way to do this is to have the variable only in the base class. As the derived class knows it must be of dynamic type <code>MyVar</code>, this is totally reasonable:</p> <pre><code>class MyClass : public MyBase { public: MyClass(MyVar* v) : MyBase(v) {} MyVar* GetVar() { return static_cast&lt;MyV...
<p>I think your mention of templates may be a good option, so something like:</p> <pre><code>class MyVarBase { }; class MyVar : public MyVarBase { int Foo(); }; template &lt;class T&gt; class MyBase { public: MyBase(T* v) : m_var(v) {} T* GetVar() { return m_var; } private: T* m_var; }; class MyClass : pu...
38,230
<p>XML, granted, is very useful, but can be quite verbose. What alternatives are there and are they specialised for any particular purpose? Library support to interrogate the contents easily is a big plus point.</p>
<p>There seems to be a lot of multi-platform support for <a href="http://www.json.org/" rel="noreferrer">JSON</a>.</p>
<p>If you're asking in the perspective of a DSL, <a href="http://www.gnu.org/software/guile/guile.html" rel="nofollow noreferrer">Guile Scheme</a> could help, as already suggested with the S-expressions.</p> <p>Personally I also use JSON for AJAX transactions.</p>
6,592
<p>We're currently in the process of setting up a source control/build/and more-server for .NET development and we're thinking about either utilizing the Team Foundation Server (which costs a lot of dough) or combining several open source options, such as SourceForge Enterprise/GForge and Subversion and CruiseControl.n...
<p>My work is currently using a mostly OSS build process with Cruise Control as the engine and it is great. I would suggest that if you don't know why you would need TFS, it's probably not worth the cost.</p> <p>The thing you have to keep in mind with the OSS stuff is that the software has either been in use by the Ja...
<p>I've seen both in action (though I'm a Java developer). The upsides from a pick and mix approach is that you can choose the best bits for everything (e.g. I'd check out Hudson for CI - its excellent for Java, works for .Net too and has <em>loads</em> of plugins and is really simple to use). The downside is that yo...
8,729
<p>Every time I have to build a form with a <code>DateTime</code> field I try to find a decent free custom control - I always fail.</p> <p>I cannot figure out why it isn't built in the .NET but let's forget about for a minute and concentrate on my question :D</p> <p>Anyone got one?</p>
<p>Just combine these two</p> <p><a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/" rel="nofollow noreferrer">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/</a></p> <p><a href="http://keith-wood.name/timeEntry.html" rel="nofollow noreferrer">http://keith-wood.name/timeEntry.html</a></p...
<p>I just did a quick Google and came across this one...</p> <p><a href="http://www.softcomplex.com/products/tigra_calendar/demo1.html" rel="nofollow noreferrer">http://www.softcomplex.com/products/tigra_calendar/demo1.html</a></p> <p>Looks like it supports dates and times, and it appears to be free.</p>
36,584
<p>Scanner can only get input from system console? not be able to get from any dialog window?</p> <p>Thanks.</p>
<p>A <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html" rel="nofollow noreferrer">Scanner</a> can read text from any object which implements the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Readable.html" rel="nofollow noreferrer">Readable</a> interface. </p> <p>That includes <code...
<p>Well, I tried with the example given at <a href="https://stackoverflow.com/questions/277143/best-way-to-determine-the-total-number-of-words-of-a-file-in-java#277190" title="Scanner example">Best way to determine the total number of words of a file in Java?</a>: just replace <code>new File("my-text-file.txt")</code> ...
34,937
<p>It's not uncommon for me to record a patch, pull it into my staging branch and then realize I've done something small and silly like a typo in a logging message, or something similarly trivial which doesn't require (to my mind) a whole new patch.</p> <p>In these instances, I've been using:</p> <pre><code>darcs ame...
<p>You could try first running darcs unpull on the staging branch then pulling in the amended patch.</p>
<p>You could try first running darcs unpull on the staging branch then pulling in the amended patch.</p>
43,409
<p>I'm looking for an implementation of the <a href="http://en.wikipedia.org/wiki/Logo_programming_language" rel="nofollow noreferrer">LOGO</a> programming language that supports 'dynaturtles' - animated turtles that can programmatically change shape, speed and direction as well as detect collisions with each other or ...
<p>Digging around a bit online, I've found <a href="http://education.mit.edu/openstarlogo/" rel="nofollow noreferrer">OpenStarLogo</a>. Though they don't specifically mention "dynaturtles" the docs do mention collision detection. The site has code and documentation downloads.</p> <p>From this <a href="http://en.wikip...
<p>Check out the turtle python package. It is in the standard python distribution and it supports a graphical turtle interface.</p>
38,342
<p>I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them?</p> <p>Thank you for your time.</p>
<p>If you create a new class, you can use code snippets to create encapsulated fields instead of first creating field and then encapsulating it. In C#, the shortcuts are prop and propg (for private set).</p>
<p>Looks like the refactoring built into studio only supports a single field at a time for the Encapsulate Field refactoring. Refactor Pro! (<a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Refactoring/" rel="nofollow noreferrer">http://www.devexpress.com/Products/Visual_Studio_Add-in/Refactoring/</a>)...
15,439
<p>What are the <code>access.log.*</code> files?</p>
<p>Apache, I believe, does log rotation. So these would be the older log files with the access.log file being the current one.</p>
<p>Apache / apache2 itself doesn't do its own log rotation. On *nix systems, logs (including logs by Apache) are usually rotated via <a href="https://en.wikipedia.org/wiki/Log_rotation" rel="nofollow noreferrer">logrotate</a>, a command which looks like a service but is actually only a script triggered by cron in defin...
20,845
<p>I'm looking for advice on how to dynamically create content in flash based on a database. Initially I was thinking that we would export the database to an XML file and use the built in Actionscript XML parser to take care of that, however the size of the XML file may prove prohibitive. </p> <p>I have read about u...
<p>If you plan to deploy your flash content to a website, you should use some sort of backend - otherwise you would have a potential security problem. I use remoting with <a href="http://www.amfphp.org/" rel="noreferrer">AMFPHP</a>, it has worked out really well.</p>
<p>The general practice that I've experienced is that if it's something like a config file or just a really small amount of data then you could probably get away with just having an XML file on the server with your SWF files.</p> <p>If you want the data to be more dynamic or you anticipate changing it quite often I wo...
8,838
<p>I have a PHP form (mortgage app) that is about 400 fields, traffic on the site will be low.</p> <p>What is the ideal Session size for 400 fields going into a MySQL db?</p> <p>In <code>php.ini</code> what do I set?</p> <p>Anything I should set that I am missing?</p>
<p>Well, personally I have had very large sessions before with very little problems. Probably the largest size I've had before is ~10MB. It's not optimal, but I haven't had a problem with slow scripts even with that size. I wouldn't worry about sessions getting to large, but I would try to keep it under control. My the...
<p>You should also check, post_max_size, max_input_vars (1000 default so you are ok)</p>
26,719
<p>Classes that use other classes (as members, or as arguments to methods) need instances that behave properly for unit test. If you have these classes available and they introduce no additional dependencies, isn't it better to use the real thing instead of a mock? </p>
<p>I say use real classes whenever you can.</p> <p>I'm a big believer in expanding the boundaries of "unit" tests as much as possible. At this point they aren't really unit tests in the traditional sense, but rather just an automated regression suite for your application. I still practice TDD and write all my tests ...
<p>If you write your code in terms of interfaces, then unit testing becomes a joy because you can simply inject a fake version of any class into the class you are testing. </p> <p>For example, if your database server is down for whatever reason, you can still conduct unit testing by writing a fake data access class th...
21,766
<p>I have the following two models:</p> <pre><code>class Activity(models.Model): name = models.CharField(max_length=50, help_text='Some help.') entity = models.ForeignKey(CancellationEntity) ... class Cancellation(models.Model): activity = models.ForeignKey(Activity) date = models.DateField(defau...
<p>What you want to look into is <a href="http://docs.djangoproject.com/en/dev/ref/signals/" rel="noreferrer">Django's signals</a> (check out <a href="http://docs.djangoproject.com/en/dev/topics/signals/" rel="noreferrer">this page</a> too), specifically the model signals--more specifically, the <strong>post_save</stro...
<p>What's wrong with the following?</p> <pre><code>class Cancellation( models.Model ): blah blah def save( self, **kw ): for a in self.activity_set.all(): a.somethingChanged( self ) super( Cancellation, self ).save( **kw ) </code></pre> <p>It would allow you to to control the n...
23,379
<p><code>termios.h</code> defines:</p> <pre><code>#define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 </code></pre> <p>But what are the flags good for?</p>
<p>I believe this will produce the right results where it returns anything, but may reject valid integers. I dare say that can be worked around with a bit of effort though... (Oh, and it will also fail for negative numbers at the moment.)</p> <pre><code>static string ConvertToHex(decimal d) { int[] bits = decimal....
<p>I've got to agree with James - do it manually - but don't use base-16. Use base 2^32, and print 8 hex digits at a time.</p>
27,246
<p>Several times, while perusing the Boost library's documentation, I've run across return values that are marked "<a href="http://www.boost.org/doc/libs/1_36_0/libs/utility/Collection.html" rel="noreferrer">convertible to <code>bool</code></a>" (search that page for the phrase "convertible to bool", it's about a third...
<p>“convertible to bool” simply means anything which can meaningfully be used in a boolean context (e.g. in an <code>if</code> condition). This makes sense in implicit conversions. Imagine an object which you want to use in a boolean context, e.g. <code>std::fstream</code>:</p> <pre><code>ifstream ifs("filename"); whi...
<p>Maybe for performance? In C/C++ you can do an if statement on numbers (0 is false, anything else is true). Converting to a strict bool is an extra operation, which in many cases wouldn't be required.</p> <p>I haven't actually used boost, so that's just a guess, but it seems like a reasonable one to me.</p>
32,948
<p>I 'm exploring for a browser solution / API that has the following features:</p> <ul> <li>Must support the nowadays default web technologies</li> <li>Must support client side XSLT</li> <li>Must support executing arbitrary Javascript on the pages it loads</li> <li>Must be able to catch events from the web page targe...
<p>If you know a way how to catch the event in javascript an prevent the native dialog from showing, you can use the method shown in this <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet303.java?view=co" rel="nofollow noreferrer">snippet</a> to catch the ev...
<p>FWIW there's another approach for doing this with Mozilla-based SWT Browsers at <a href="http://www.eclipse.org/forums/index.php?t=msg&amp;th=166869&amp;start=0&amp;" rel="nofollow noreferrer">http://www.eclipse.org/forums/index.php?t=msg&amp;th=166869&amp;start=0&amp;</a> .</p>
28,066
<p>I am writing picture editing windows forms application using vb.net/c#. i have a client requirement to capture the photo from digital still camera attached to computer. </p> <p>how can i capture a photo from USB connected digital still camera device in my windows application ?</p>
<p>If you use the Windows Image Acquisition Library, you'll see events there for capturing camera new picture events. I had a similar requirement and wrote a test rig; we went down to the local camera store and tried every camera they had. The only cameras we could find that supported this functionality were the Nikon ...
<p>This depends on your camera.</p> <p>Many cameras will simply mount as USB mass storage devices. If this is the case, then you can just copy the file from the visible file system like you would any other file on an external disk.</p> <p>If the camera doesn't make its contents available in this way, you'll need to l...
10,128
<p>I know the so-called textbook definition of unit tests and integration tests. What I am curious about is when it is time to write unit tests... I will write them to cover as many sets of classes as possible.</p> <p>For example, if I have a <code>Word</code> class, I will write some unit tests for the <code>Word</c...
<p>The key difference, to me, is that <strong>integration tests</strong> reveal if a feature is working or is broken, since they stress the code in a scenario close to reality. They invoke one or more software methods or features and test if they act as expected.</p> <p>On the opposite, a <strong>Unit test</strong> te...
<p>If you're a TDD purist, you write the tests before you write production code. Of course, the tests won't compile, so you first make the tests compile, then make the tests pass.</p> <p>You can do this with unit tests, but you can't with integration or acceptance tests. If you tried with an integration test, nothing ...
3,192
<p>I am trying to make a Kiosk application more accessible by increasing the size of fonts.<br> No problem on the main Form.<br> I'm having a problem replacing MessageBoxes (for which I believe there is no way to increase the font size) with small forms with the same message.</p> <p>This is where I'm running into the ...
<p>You cannot access the ErrorForm as if it was static. That is just the class definition, you need to set the property on an instance of the ErrorForm.</p> <p>Somewhere in your app, you created a new ErrorForm. You need to take that variable and set your LblNotCheckedInBecause property on that.</p> <p>Look for code ...
<p>One thing to always keep in mind is how easy it is for another developer to read your code and understand. The best option I see is this</p> <p>ErrorForm form = new ErrorForm(); form.SetErrorLableMessageTo("Error Text"); form.Show();</p> <p>this is very readable. Passing the args in constructor doesn't show the i...
43,411
<p>We use a base entity with properties such as version (datetime needed for NHibernate) and guid (as key).</p> <p>It also has an Id (int) field with two functions. Firstly to relate to legacy application key if there is one. Secondly as a shorthand code: for instance files are sometimes created based on these which...
<p>Well, int64 uses 8 byte of memory storage, while int uses 4 byte... however, you pointed out most of the disadvantages already. Of course calculations performed will also be slower on many systems (a 64 bit system running in 64 bit mode can perform operations on 64 bit as fast as on 32 bit, but a 32 bit system needs...
<p>Portability... though C# isn't really know as lingua franca if you're going for portable, so this might be moot for your perspective?</p>
30,086
<p>My organization has a form to allow users to update their email address with us. It's suggested that we have two input boxes for email: the second as an email confirmation.</p> <p>I always copy/paste my email address when faced with the confirmation. I'm assuming most of our users are not so savvy.</p> <p>Regardle...
<p>I would just use one input box. The "Confirm" input is a remnant form the "Confirm Password" method. </p> <p>With passwords, this is useful because they are usually typed as little circles. So, you can't just look at it to make sure that you typed it correctly. </p> <p>With a regular text box, you can visually che...
<p>I'd say that this is ok but should only be reserved for forms where the email is essential. If you mistype your email for your flight booking then you have severed the two-way link between yourself and the other party and risk not getting the confirmation number, here on StackOverflow it would only mean your Gravata...
2,686
<p>I currently have a print job that is about 50% done, been running for 2 hours with 2 hours remaining. One side is curling/warping pretty bad, and I'm afraid there's no possible way this is going to finish without serious problems if I don't intervene.</p> <p>So what I'm doing is either brilliant or idiotic, I'm no...
<p>Three thoughts:</p> <ol> <li>bed temperature</li> <li>rim width</li> <li>bonding agent</li> </ol> <p>Bed Temperature:</p> <p>Often the edges of a heated bed are not as hot as the center. Making the heat pass through an insulator (the glass) makes the temperature profile on the corners more relatively cool compar...
<p>More glue to hold it down and lower in-fill percentage will reduce the warping. Or adding more cut-outs to the design like you have further up the shaft. </p>
724
<p>Obviously the <a href="http://java.sun.com/j2se/1.5.0/docs/api/" rel="nofollow noreferrer">Java API</a> reference, but what else is there that you all use? </p> <p>I've been doing web development my entire career. Lately I've been messing around a lot with <a href="http://groovy.codehaus.org" rel="nofollow norefe...
<p><a href="http://java.sun.com/docs/books/tutorial/uiswing/" rel="noreferrer">The Swing Tutorial</a> is very good. Apart from that, the Swing API is obviously <i>the</i> reference, however it's also a treasure trove of fairly good source code! Add the API source to your IDE and you can jump directly to the implementat...
<p>When it comes to developing java desktop applications, I would highly recommend using the IDE environment <a href="http://www.netbeans.org" rel="nofollow noreferrer">Netbeans</a>. Especially when it comes to the development of Swing based applications.</p>
12,483
<p>If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?</p> <p>If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?</p> <p>sorry if this...
<p>You will still need locks if you share state between threads. The GIL only protects the interpreter internally. You can still have inconsistent updates in your own code.</p> <p>For example:</p> <pre><code>#!/usr/bin/env python import threading shared_balance = 0 class Deposit(threading.Thread): def run(self)...
<p>A little bit of update from Will Harris's example:</p> <pre><code>class Withdraw(threading.Thread): def run(self): for _ in xrange(1000000): global shared_balance if shared_balance &gt;= 100: balance = shared_balance balance -= 100 shared_balance...
13,068
<p>I'm trying to get a case-insensitive search with two strings in JavaScript working.</p> <p>Normally it would be like this:</p> <pre><code>var string="Stackoverflow is the BEST"; var result= string.search(/best/i); alert(result); </code></pre> <p>The <code>/i</code> flag would be for case-insensitive.</p> <p>But ...
<p>Yeah, use <code>.match</code>, rather than <code>.search</code>. The result from the <code>.match</code> call will return the actual string that was matched itself, but it can still be used as a boolean value.</p> <pre><code>var string = "Stackoverflow is the BEST"; var result = string.match(/best/i); // result == ...
<p>I noticed that if the user enters a string of text but leaves the input without selecting any of the autocomplete options no value is set in the hidden input, even if the string coincides with one in the array. So, with help of the other answers I made this:</p> <pre><code>var $local_source = [{ value: 1, ...
21,412
<p>Building a client-side swing application what should be notified on a bus (application-wide message system, similar in concept to JMS but much simpler) and what should be notified using direct listeners?</p> <p>When using a bus, I always have an unescapable feeling of "I have no idea who uses that and where". Also,...
<p>Event buses are very, very useful tools for providing decoupling in certain architectures. Listeners are easy to implement, but they have significant limitations when your object and dependency graph gets large. Listeners tend to run into problems with cyclic dependencies (events can 'bounce' in odd ways, and you ...
<p>Well, I can imagine the approach where models are updated using BUS like system and events from models are delegated using listeners. Simple scenario: I got server side which represents producer of data. Then on client side a got consumer interface which consumes all incoming messages and transform them into my inte...
28,158
<p>I have a 3D model that I'd like to print. This is my first project, so I'm trying to decide if I'm getting in over my head. Here's the model rendered with Blender:</p> <p><a href="https://i.stack.imgur.com/N1cVF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N1cVF.png" alt="enter image description here">...
<p>Here is a set of options you can get:</p> <ol> <li>print the object on multi color printer</li> </ol> <p>Unfortunately we got some limitations here (on the market). Printers have limited set of heads which are in fact printing in one color at a time. So we usually have 2 colors, there are also 4 color heads. If th...
<p>You would need to ask around shops to see what they think about this 3d file. What I have heard is that colors of prints end up blended together, and that the print resolution is low. How many colors are you using? You could probably get a quality print, but it would come with a high price. Print quality is dependen...
289
<p>Please consider this example class:</p> <pre><code>[Serializable] public class SomeClass { private DateTime _SomeDateTime; public DateTime SomeDateTime { get { return _SomeDateTime; } set { _SomeDateTime = value; } } } </code></pre> <p>I would like to alter the serialization of any...
<p>look at the OnSerializing and OnDeserializing attributes to call custom methods when your objects are serialized. you can impelment some custom logic in there and decouple the serializing process from the actual datatypes.</p>
<p>Well, you can use a "bool ShouldSerializeSomeDateTime()" method to enable/disable serialization of individual members, but I don't think that is quite what you need. Another common option is to add a member that does the format itself:</p> <p>public string SomeDateTimeFormatted { get { return theField == DateTi...
20,958
<p>In ASP.NET MVC it's possible to choice between having a typed view were you define in the codebehind what kind of data the view can should expect. But it's also possible to not define this and just pass any kind of data to view in a ViewData container.</p> <p>What would the best model here or should I mix depending...
<p>I would recommend always using the strongly typed ViewData... that way you have compile time checking, intellisense, you don't have to do casting in your view, and the ability to refactor your code much easier.</p>
<p>I had this thought too in the past. In my site, I used to strong-type the view, when the view is almost a 1:1 model of the class you are showing. Like showing a list of all users, I type to List, this way I don't need to cast anytime to have the right datatype.</p> <p>In none specific views, I just strong-type to t...
16,692
<p>Earlier I asked this question <a href="https://stackoverflow.com/questions/309708/how-to-correctly-unit-test-my-dal">How to correctly unit test my DAL?</a>, one thing left unanswered for me is if to really test my DAL is to have a Test DB, then what is the role of mocking vs. a testing DB?</p> <p>To add on this, an...
<p>I think you'll probably want to do some integration testing to check logic that is enforced by your database structure, for example constraints, triggers, autoincrement columns, etc. You should, however, for unit testing mock out whatever framework components that your DAL relies upon as you want (in your unit test...
<p>The problem could very well be in the original question. Some of the more popular examples of MVC use a shortcut by returning a <code>DbSet</code> such as:</p> <pre><code>public class MusicStoreEntities : DbContext { public DbSet&lt;Album&gt; Albums { get; set; } public DbSet&lt;Genre&gt; Genre...
39,982
<p>Do programmers like to create deadlines? Im a web developer, and schedules/deadlines are all over the place in my field. But I've worked with some software engineers/programmers who hate deadlines, is there a way around that?</p>
<p>Firstly, you need to distinguish between deadlines and estimates.</p> <ul> <li>Deadlines come from external sources, eg, "Feature X needs to be ready for the trade show".</li> <li>Estimates come from internal sources, eg, "Feature X will take N weeks to complete".</li> </ul> <p>Generally, programmers should create...
<p>Well, I'm quite happy with a deadline <strong>if</strong> that deadline has been determined through well thought-out estimate process with input from both managers and engineers <strong>and</strong> the requirements for what is supposed to be delivered on said deadline are well defined.</p>
49,948
<p>How do you capture the mouse events, move and click over top of a Shockwave Director Object (not flash) in Firefox, via JavaScript. The code works in IE but not in FF. </p> <p>The script works on the document body of both IE and Moz, but mouse events do not fire when mouse is over a shockwave director object embed....
<p>You could also catch the mouse event within Director (That never fails) and then call your JS functions from there, using gotoNetPage "javascript:function('" &amp; argument &amp; "')"</p> <p>ej:</p> <pre><code>on mouseDown me gotoNetPage "javascript:function('" &amp; argument &amp; "')" end </code></pre> <p>Th...
<p>Just an idea.</p> <p>Try overlaying the shockwave object with a div with opacity 0, then you can capture events on the div itself.</p>
7,341
<p>On my VPS server (Fedora 9), mingetty keeps respawning itself because of a "permission denied" error on tty[1-6], even though:</p> <pre> root# ls -la /dev/tty1 crw------- 1 root root 4, 1 Sep 19 14:22 /dev/tty1 </pre> <p>Even weirder, this doesn't work:</p> <pre> root# cat &lt;/dev/tty1 bash: /dev/tty1: Permissio...
<p>I suspect that SELinux may be the problem. Try temporarily disabling it to see if it works.</p>
<p>Go into your /etc/inittab and comment out the following lines (or others like it). You may need to reboot to stop the re-spawns</p> <pre><code>c1:12345:respawn:/sbin/agetty 38400 tty1 linux c2:2345:respawn:/sbin/agetty 38400 tty2 linux c3:2345:respawn:/sbin/agetty 38400 tty3 linux c4:2345:respawn:/sbin/agetty 38400...
13,361
<p>I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window.</p> <p>How can I accomplish that in C++?</p> <p><strong>Update.</strong></p> <p>I would be more than happy to have a solution for Windows, MacOS, and U...
<p>For Windows, another way to get the top-level windows (besides EnumWindows, which uses a callback) is to get the first child of the desktop and then retrieve all its siblings:</p> <pre><code>HWND wnd = GetWindow(GetDesktopWindow(), GW_CHILD); while (wnd) { // handle 'wnd' here // ... wnd = GetNextWindow...
<p>You can use <a href="http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx" rel="nofollow noreferrer">EnumWindows()</a> to enumerate top level Windows.</p> <p>I don't have a specific answer for the second part of your question, but if you subclass the window, I imagine you can modify the system menu.</p> <p...
16,790
<p>Can it be done and if so, how? </p>
<p>You can use Merge Replication. Theres a tutorial here <a href="http://msdn.microsoft.com/en-us/sqlserver/bb219480.aspx" rel="nofollow noreferrer">SQL Server Compact 3.5 How-to Tutorials</a> (Number 5).</p>
<p>Because of budget constraints I think it will have to beta-tester's approch,i tried following the guide and cant seem to get it working. Before I spend time getting it to work, I just confrim, Replicating between SqlServer 2005 and Compact Edition is something that can be done?</p>
2,927
<p>We have an application that generates simulated data for one of our services for testing purposes. Each data item has a unique Guid. However, when we ran a test after some minor code changes to the simulator all of the objects generated by it had the same Guid.</p> <p>There was a single data object created, then ...
<p>Does Submit do an async call, or does the ticket object go into another thread at any stage.</p> <p>In the code example you are reusing the same object. What if Submit sends the ticket in a background thread after a short delay (and does not take a copy). When you change the CacheId you are actually updating all th...
<p>My gut is telling me something along these lines is going on...</p> <pre><code>class OrderTicket { Guid CacheId {set {_guid = new Guid("00000000-0000-0000-0000-");} } </code></pre> <p>Log the value of CacheId into a log file every time its called with a stack trace ... Maybe someone else is setting it. </p>
38,571
<p>I'm on a project which is trying to write what amounts to a Mailing List app in Django, and we're running into a couple of problems/questions.</p> <p>The code we have so far doesn't set various List headers, and re-sets the To header to be the person we're sending it to, instead of the list address.</p> <p>Now, we...
<p><a href="http://www.apps.ietf.org/rfc/rfc2919.html" rel="nofollow noreferrer">RFC 2919</a> has some info and more references on this.</p>
<p>Did you take a look at <a href="http://www.greatcircle.com/majordomo/" rel="nofollow noreferrer">majordomo</a>, or <a href="http://www.gnu.org/software/mailman/index.html" rel="nofollow noreferrer">mailman</a>?</p>
33,763
<p>I use codeigniter as my main install on the main domain. I have created a subdomain and a folder called live e.g. live.domain.com maps to public/live . However in public I use codeigniter.</p> <p>I now have the dynamic codeigniter url: </p> <pre>http://domain.com/api/</pre> <p>which I want to map to my subdomain:...
<p>How about something like the following:</p> <pre> RewriteEngine On RewriteCond %{HTTP_HOST} ^live\.domain\.com$ [NC] RewriteRule (.+)$ "https://domain.com/api/$1" [L,P] </pre>
<p>Just add index.php, see below</p> <pre><code>RewriteEngine On RewriteCond %{HTTP_HOST} ^live\.domain\.com$ [NC] RewriteRule (.+)$ "https://domain.com/index.php/api/$1" [L,P] </code></pre>
47,842
<p>I've been using user controls extensively but never use a HttpHandler and was wondering if I am doing something suboptimal or wrong</p>
<p>Unfortunately your question is a little like "Should I use a sandwich or a cement mixer". HttpHandlers and User controls are completely different things.</p> <p>HttpHandlers are used to process HTTP requests. For example, if you wanted to dynamically create an RSS feed, you could write an HTTP handler that handle...
<p>Even an <code>Asp.Net</code> page is an <code>HttpHandler</code>.</p> <pre><code>public class Page : TemplateControl, IHttpHandler </code></pre> <p>A user control actually resides within the asp.net aspx page.</p>
4,216
<p>On the web page, it looks like there is no current development in the old style .doc.</p> <ul> <li>Is it good enough to create complex documents? </li> <li>Can it read all .docs without crashing?</li> <li>What features do (not) work?</li> </ul> <p>I am not currently interested in the XML based formats, as I don't ...
<p>If you are looking for programmatically reading or writing doc files, I believe you're better of with remoting OpenOffice or StarOffice. We've done this at a former company, even though it's a pretty heavy solution, it worked quite well. OpenOffice has (right after Word) a very good doc-Support. For remoting it's a ...
<p>I have used the Apache POI For reading and writing Excel files (.xls) and it works like a charm. There were a few issues but I found easy workarounds so I assume it would be the same for the word documents. The only issue you would have is with reading and writing the .docx (.xlsx in my case) format since Apache POI...
46,975
<p>What are the best practices for modeling inheritance in databases?</p> <p>What are the trade-offs (e.g. queriability)?</p> <p>(I'm most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.)</p>
<p>There are several ways to model inheritance in a database. Which you choose depends on your needs. Here are a few options:</p> <p><strong>Table-Per-Type (TPT)</strong></p> <p>Each class has its own table. The base class has all the base class elements in it, and each class which derives from it has its own table, ...
<p>You would normalize of your database and that would actually mirror your inheritance. It might have performance degradance, but that's how it is with normalizing. You probably will have to use good common sense to find the balance.</p>
23,094
<p>Could anyone recommend to me a good online guide to PowerPoint VBA? Also, does anyone has advice on how to record a macro in PowerPoint? </p>
<p>To record a powerpoint macro:</p> <ol> <li>In the menu bar, click on Tools</li> <li>Mouse over Macro > and the submenu will be displayed</li> <li>Click the Record button - a new toolbar will be displayed</li> <li>Do your thing</li> <li>Click the stop button on the new macro toolbar</li> </ol> <p>Click on Tools->M...
<p>To record a powerpoint macro:</p> <ol> <li>In the menu bar, click on Tools</li> <li>Mouse over Macro > and the submenu will be displayed</li> <li>Click the Record button - a new toolbar will be displayed</li> <li>Do your thing</li> <li>Click the stop button on the new macro toolbar</li> </ol> <p>Click on Tools->M...
15,455
<p>Our company has thousands of PDF documents. How do we create a simple search engine using Lucene, Solr or Nutch? We'll provide a basic Java/JSP web page were people can type in words and perform basic and/or queries then show them the document links of all matching PDF's.</p>
<p>I have had good luck with lucene, but it is not click, install and search, it does require a bit of work.<br> If you need something that yo can download and install and be searching within 10 minutes, look at the free Ominifind Yahoo Edition <a href="http://omnifind.ibm.yahoo.net/" rel="nofollow noreferrer">http://o...
<p>Having the (imho) distinct advantage of being on a Mac, I use <a href="http://www.gravityapps.com/searchlight/overview/" rel="nofollow noreferrer">SearchLight</a> on a somewhat older G5. nice web interface to spotlight, the Mac OS' built-in indexing service.</p>
27,603
<p>I admit that I am not a guru of Visual Studio products at all. I am using Visual Web Developer 2005 Express Edition and I'm trying to load someone else's project.</p> <p>This project happens to be a website with many pages.</p> <p>After loading VWD, it asks for a project to open and I select the solution file. It ...
<p>The fundemental problem is the impact of Response.Codepage on Form Posts.</p> <p>When you send a form to a client specifying that the content is encoded as UTF-8, the browser will assume that the content of form posts should be sent encoded as UTF-8.</p> <p>Now the action page that receives the post will (somewhat...
<p>® is what ® looks like if it's stored as UTF-8, but displayed as ASCII/ISO-8859-1/Windows-1252. Using the <code>meta</code> tag is not enough to make sure your page is being served as UTF-8. You will also need to set the encoding in the Content-Type HTTP header. This header is typically set either with some server-...
45,615
<p>What does it mean when it gives a backtrace with the following output?</p> <pre><code>#0 0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2 #1 0x00000008009b8120 in sigaction () from /lib/libpthread.so.2 #2 0x00000008009c211a in pthread_mutexattr_init () from /lib/libpthread.so.2 #3 0x0000000...
<p>gdb wasn't able to extract the proper return address from pthread_mutexattr_init; it got an address of 0. The "??" is the result of looking up address 0 in the symbol table. It cannot find a symbolic name, so it prints a default "??"</p> <p>Unfortunately right offhand I don't know why it could not extract the corre...
<p>Maybe the bug that caused the crash has broken the stack (overwritten parts of the stack)? In that case, the backtrace might be useless; no idea what to do in that case...</p>
14,760
<p>I'm currently designing a brand new database. In school, we always learned to put a primary key in each table.</p> <p>I read a lot of articles/discussions/newsgroups posts saying that it's better to use unique constraint (aka unique index for some db) instead of PK.</p> <p>What's your point of view?</p>
<p>Can you provide references to these articles?</p> <p>I see no reason to change the tried and true methods. After all, Primary Keys are a fundamental design feature of relational databases.</p> <p>Using UNIQUE to serve the same purpose sounds really hackish to me. What is their rationale?</p> <p>Edit: My attenti...
<p>If you plan on using LINQ-to-SQL, your tables will require Primary Keys if you plan on performing updates, and they will require a <code>timestamp</code> column if you plan on working in a disconnected environment (such as passing an object through a WCF service application).</p> <p>If you like .NET, PK's and FK's ...
19,156
<p>I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box).</p> <p>How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to...
<p>First, for Qt4, the simplest way is to create an action to reset the data, and add it the the widget using the <code>addAction</code> method (or use the designer). Then, set the <code>contextMenuPolicy</code> attribute to <code>Qt::ActionsContextMenu</code>. The context menu will appear and the action will be trigge...
<p>For Qt4, you can do this for an editable QComboBox by using your own QLineEdit. Create a derived QLineEdit class which implements the contextMenuEvent</p> <pre><code>class MyLineEdit : public QLineEdit { Q_OBJECT public: MyLineEdit(QWidget* parent = 0) : QLineEdit(parent){} void contextMenuEvent(QCont...
23,173
<p>I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes selected item in one of dropdowns, ASP.Net doesn't seem to handle SelectedIndexChanged event until form is submitted with a 'Submit' button click. How do I make my dropdowns handle SelectedIndexChanged instantly?</p> <p>P.S. It'...
<p>Setting the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback(VS.71).aspx" rel="noreferrer">AutoPostback</a> property to true will cause it to postback when the selection is changed. Please note that this requires javascript to be enabled.</p>
<p>Set the AutoPostBack property of DropDownList to true.</p>
9,551
<p>I am extremely new at php and I was wondering if someone could help me use either a <code>for()</code> or <code>while()</code> loop to create an array of 10 elements.</p>
<pre><code>$array = array(); $array2 = array(); // for example for ($i = 0; $i &lt; 10; ++$i) { $array[] = 'new element'; } // while example while (count($array2) &lt; 10 ) { $array2[] = 'new element'; } print "For: ".count($array)."&lt;br /&gt;"; print "While: ".count($array2)."&lt;br /&gt;"; </code></pre>
<p>The simplest way is to use <a href="http://www.php.net/array_fill" rel="nofollow noreferrer"><code>array_fill()</code></a>:</p> <pre><code>$array = array_fill(0, 10, 'Hello World'); </code></pre> <p>But you should know that PHP arrays can be resized whenever you want anyway, I've never needed to create an array of...
35,846
<p>How does Google's API make cross-domain requests back to Google, when it's on your website?</p>
<p>They get around it by dynamically injecting script tags into the head of the document. The javascript that is sent down via this injection has a callback function in it that tells the script running in the page that it has loaded and the payload (data). </p> <p>The script can then remove the dynamically injected sc...
<p>Another possibility is to use the <code>window.name</code> transport as described for the dojo framework <a href="http://www.sitepen.com/blog/2008/07/22/windowname-transport/" rel="nofollow noreferrer">here</a></p>
15,693
<p>Is there any way to throw errors or warnings in a KornShell (ksh) script to prevent the use of unset variables? Let's assume I have a temporary folder that I want to remove.</p> <pre><code>TEMP_FILES_DIR='/app/myapp/tmp' rm -Rf $TEMP_FILE_DIR #notice the misspelling </code></pre> <p>How to prevent this kind of mi...
<p>The command</p> <pre>set -u</pre> <p>Will cause POSIX <i>sh</i>(1) and its derivatives to grouse when an attempt to expand an unset variable is made.</p> <p>Example:</p> <pre> $ echo $foo $ set -u $ echo $foo sh: foo: parameter not set </pre>
<p>You could check the variable for having content, ie not being '', and print-out a message like "the variable is empty".</p> <p>However, that's still not going to fix PEBCAK errors like this - all you'd know is that nothing happened.</p>
42,140
<p>I have a <code>MultipleChoiceField</code> on a form holding car makes. I want to filter my database of cars to the makes that were checked but this causes a problem. How do I get all the <code>Q(make=...)</code> statements in dynamically?</p> <p>How I start: <code>['value1', 'value2', ...]</code></p> <p>How I want...
<p>Have you tried: <code>Model.objects.filter(make__in=list_of_makes)</code> ?</p> <p>The list_of_makes is what is returned by the <code>MultipleChoiceField</code></p> <p>See <a href="http://docs.djangoproject.com/en/dev/ref/models/querysets/#in" rel="noreferrer">the query set reference</a> about the <code>__in</code...
<p>There was another method provided in #django:</p> <pre><code>reduce(lambda x,y: x | y, [Q1, Q2, Q3, ...]) </code></pre> <p><a href="https://stackoverflow.com/questions/352178/django-dynamic-or-queries#352208">Ber's method</a> is great for this instance but if you need to filter on dynamic columns, mapping looks li...
45,860
<p>I have a class that looks like this:</p> <pre><code>public class TextField : TextBox { public bool Required { get; set; } RequiredFieldValidator _validator; protected override void CreateChildControls() { base.CreateChildControls(); _validator = new RequiredFieldValidator(); _valida...
<p>The CreateChildControls is basically for the controls that have childs. RequiredFieldValidator is like a sibling to TextBox. </p> <p>Here is the code that works for me: </p> <pre><code>public class RequiredTextBox : TextBox { private RequiredFieldValidator _req; private string _errorMessage; ...
<p>Validators have to inherit from BaseValidator.</p>
38,807
<p>I am working on a ASP.net application written in C# with Sql Server 2000 database. We have several PDF reports which clients use for their business needs. The problem is these reports take a while to generate (> 3 minutes). What usually ends up happening is when the user requests the report the request timeout kills...
<p>Using the filesystem here is probably a good bet. Have a request that immediately returns a url to the report pdf location. Your server can then either kick off an external process or send a request to itself to perform the reporting. The client can poll the server (using http HEAD) for the PDF at the supplied url. ...
<p>What about emailing the report to the user. All the asp page should do is send the request to generate the report and return a message that the report will be emailed after is has finished running.</p>
19,059
<p>I need to generate a CTL for use with IIS7.</p> <p>I generated a CTL file using MakeCTL (on Win2k3 SDK) and put only my own RootCA certificate in the CTL.</p> <p>However, when I then use adsutil.vbs to set my website to use this CTL, I get:</p> <p>ErrNumber: -2147023584 (0x80070520) Error Trying To SET the Proper...
<p>I'm experiencing exactly the same problem and am having the same trouble finding an answer.</p> <p>There appears to be no documented way to create a friendly name for Certificate Trust Lists using MakeCTL. And the only documented way to add a CTL to IIS7 uses the adsutil script Neil references above, yet it require...
<p>The question is about IIS7, but for anyone looking for this information - from <strong>IIS8</strong> you no longer need to use CTLs, but rather use "Client Authentication Issuers" in the certificate store. </p> <p>This is documented in more detail: <a href="http://technet.microsoft.com/en-us/library/hh831771.aspx" ...
42,206
<p>I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time...</p>
<p>Yes you can have your webforms pages and MVC views mixed in a single web application project. This could be useful if you have an application that is already built and you want to migrate your app from webforms to mvc.</p> <p>You need to make sure that none of your webforms pages go in the 'Views' directory in a st...
<p>If you're mixing MVC with other methodologies you're not really getting the benefit out of it. The point of MVC is to allow you to decrease coupling and increase cohesion, and if only half of your code is doing that, then the other half is inevitably going to restrain your development cycle.</p> <p>So, I guess whi...
16,085