instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have this code:</p> <pre><code> Dim pathString As String = HttpContext.Current.Request.MapPath("Banking.mdb") Dim odbconBanking As New OleDbConnection _ ("Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _ "Data Source=" + pathString) Dim sql As String sql = "UPDATE tblAccounts ba...
<p>I think the missing is SET.</p> <p>Try: UPDATE table SET field = newvalue WHERE criteria;</p> <p>Just modify:</p> <pre><code>sql = "UPDATE tblAccounts SET balance = " &amp; CDbl(balance + value) &amp; " WHERE(accountID = " &amp; accountID &amp; ")" </code></pre> <p><a href="http://office.microsoft.com/en-us/acce...
<p>You are missing SET as part of UPDATE.</p> <p>It should be UPDATE tablename SET fieldname = ... WHERE [criteria].</p> <p>On a side note, you are using classic asp style code inside asp.net. I will suggest reading some docs on ASP.net and how to design applications in a layered manner.</p>
45,029
<p>I bought a 32 GB SDHC (Sandisk) I'd like to use for my Monoprice 3D printer.<br> I have downloaded Partition Wizard and partitioned a 2GB primary partition formatted as FAT and it still does not show any files. </p> <p>What am I doing wrong?</p>
<p>For an SD card to work with the printer firmware <a href="https://monopricesupport.kayako.com/article/59-why-is-my-printer-not-reading-my-sd-card" rel="noreferrer">Monoprice suggests to format the SD card to FAT32</a>.</p> <p>However, the Monoprice Select Mini V2 is not able to read SDHC memory cards, it is advised...
<p>I was having problems formatting micro SD cards for my Monoprice Mini v2. I have some 256 MB cards tried formatting them FAT FAT32 etc, no luck.</p> <p>Then I downloaded a program called <a href="https://www.sdcard.org/downloads/formatter/" rel="nofollow noreferrer">SD Memory Card Formatter</a> did the format on th...
1,160
<p>I'm looking for a methodology to easily measure/evaluate Z positioning accuracy, using equipment on hand or easily obtainable such as a high-precision digital caliper. In particular I want to be able to evaluate whether steps (actual motor steps, or some other chosen unit of increment) are uniformly the nominal step...
<p>In the world of hobbyist milling machines, a DRO accessory is extremely valuable for improving work flow and accuracy of project builds. The Digital Read Out devices run the gamut from affordable to astonishingly expensive and cover one, two and three axis readouts.</p> <p>For single axis purposes, some hobbyists wi...
<p>What you ask is probably not easily doable: you want to measure distances with no more than 1 micron error!</p> <p>1 micron because assuming 2 mm leadscrew pitch and full steps only, you have 100 full steps per mm (10 microns per step). With 10% error at most you need to measure 1 micron.</p> <p>What you can do is a...
1,774
<p>I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself wil...
<p>You can use <a href="http://doc.trolltech.com/4.4/qgraphicsview.html" rel="nofollow noreferrer">QGraphicsView</a> in PyQt. Each state is a new <code>QGraphicsItem</code>, which is either a bitmap or a path object. You just need to provide the outlines (or bitmaps) and the positions of the states. </p> <p>If you hav...
<p>Quick tip, if you color each state differently you can identify which one to pick from the color under mouse cursor rather than doing a complex point in polygon routine.</p>
13,755
<p>I have a treeview with nodes like this: "Foo (1234)", and want to allow the user to rename the nodes, but only the Foo part, without (1234). I first tried to change the node text in <code>BeforeLabelEdit</code> like this:</p> <pre><code>private void treeView1_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e)...
<p>Finally I have found a <a href="http://www.codeproject.com/KB/tree/CustomizedLabelEdit.aspx" rel="noreferrer">solution</a> to this on <a href="http://www.codeproject.com" rel="noreferrer">CodeProject</a>. Among the comments at the bottom, you will also find a portable solution.</p>
<p>Heh - I struck that one a few years back. I even left a <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94140" rel="nofollow noreferrer">suggestion on Connect</a> (vote for it!) to allow the label to be changed in BeforeLabelEdit.</p> <p>One option (in WinForms - it's a dif...
21,974
<p>In Visual C# 2008, I have a solution with two projects.</p> <p>First project contains Form1 that displays one Label with Text set to a string from Properties.Resources, like this:</p> <pre><code>label1.Text = Properties.Resources.MY_TEXT; </code></pre> <p>In the second project, I "Add as link" this Form1 from the...
<p>Yes that is the right approach (referencing one project from another). A pattern you may like to apply is to have one project that has all your reference/lookup/settings in it. Then you don't need to work out dependencies between your UI projects.</p> <p>Your approach of making the resources public is the correct.<...
<p>You should add "using MyOtherProjectNamespace" so that you can access its properties</p>
37,383
<p>On Linq to SQL's DataContext I am able to call SubmitChanges() to submit all changes.</p> <p>What I want is to somehow reject all changes in the datacontext and rollback all changes (preferable without going to the database).</p> <p>Is this possible?</p>
<p>Why not discard the data context and simply replace it with a new instance?</p>
<p>//This works for me, 13 years later using Dotnet (Core) 6:</p> <p>dbContext.ChangeTracker.Clear();</p>
32,379
<p>This came up from <a href="https://stackoverflow.com/questions/55093/how-to-deal-with-arrays-declared-on-the-stack-in-c#55183">this answer to a previous question of mine</a>. Is it guaranteed for the compiler to treat <code>array[4][4]</code> the same as <code>array[16]</code>?</p> <p>For instance, would either of ...
<p>From the C++ standard, referring to the <code>sizeof</code> operator:</p> <blockquote> <p>When applied to an array, the result is the total number of bytes in the array. This implies that the size of an array of <code>n</code> elements is <code>n</code> times the size of an element.</p> </blockquote> <p>From thi...
<p>I would be worried about padding being added for things like Matrix[5][5] to make each row word aligned, but that could be simply my own superstition.</p>
7,934
<p>I have the in my opinion odd request to close a wizard form as Done or OK if Enter was pressed on the keyboard even if the OK/DONE button is not focused.</p> <p>In my opinion that would be a usability mistake. For example: In the wizard you may have multiple controls, buttons, check boxes, multiple line controls an...
<p>Well, here's the thing: there are two kinds of users you have to take into account here.</p> <p>First kind of users are the Baby Boomers and Gen Xers (e.g., people who have been using computers in the 70s/80s) who are accustomed to pressing Enter to move to the next field. These are the ones who learned how to use ...
<p>I would be of the same opinion, perhaps mention it to the client and let them use the final version in both modes. I guess you have to give them what they ask for when they are paying. </p>
19,536
<p>Is there a (Unix) shell script to format JSON in human-readable form?</p> <p>Basically, I want it to transform the following:</p> <pre class="lang-json prettyprint-override"><code>{ &quot;foo&quot;: &quot;lorem&quot;, &quot;bar&quot;: &quot;ipsum&quot; } </code></pre> <p>... into something like this:</p> <pre class=...
<p>With Python 2.6+ you can do:</p> <pre class="lang-sh prettyprint-override"><code>echo '{&quot;foo&quot;: &quot;lorem&quot;, &quot;bar&quot;: &quot;ipsum&quot;}' | python -m json.tool </code></pre> <p>or, if the JSON is in a file, you can do:</p> <pre class="lang-sh prettyprint-override"><code>python -m json.tool my...
<p>I know that the original post asked for a shell script, but there are so many useful and irrelevant answers that probably did not help the original author. Adding on to irrelevance :)</p> <p>BTW I could not get any command line tools to work.</p> <p>If somebody want simple JSON JavaScript code, they could do:</p> ...
45,850
<p>Has anyone experienced problems with Kaspersky anti-virus stopping browsers from displaying imagemaps created in an ASP.NET app? And if so, is there a way round this?</p> <p>Many thanks, Nick</p>
<p>Try turning off the firewall. Generally its the firewall which created the problem.</p> <p>A firewall may prevent some content of your website from being accessible, so if you have problems with accessing content then check that your firewall is not rejecting content form your site.</p> <p>The easiest way to ensur...
<p>It looks like my question was invalid after all. The problem was with the specific png file that was being used on the imagemap. Kaspersky wouldn't display it under any circumstances (although I couldn't find anything wrong with it). When I converted it to a jpeg everything worked as it should.</p>
46,376
<p>Could anyboby help me with the alternative solution in C# regarding <strong>AddressOf operator in VB6</strong>? AddressOf returns a long value. What way can I get the output in C#?</p>
<p>Expanding on Harper Shelby's answer, yes it can be done, but it's generally a code smell to do so in .NET.</p> <p>To get the address of a variable in C#, you can use C-style pointer (*) /address (&amp;) / dereference (->) syntax. In order to do this, you will have to compile the app with the /unsafe compiler switch...
<pre><code>EventHandler handler1 = this.button1_Click; EventHandler handler2 = new EventHandler( this.button1_Click ); ... ... ... void button1_Click( object sender, EventArgs e ){ // .... } </code></pre> <p>Both notation are equivalent.</p>
35,542
<p>I've installed .NET Framework 3.5 SP1 on web server (Server 2008 Enterprise), so running IIS 7.0.</p> <p>I want to change the version of .NET Framework used by an existing site. So I right-click on appropriate Application Pool and selected Edit Application Pool. The .NET Framework dropdown does not include an exp...
<p>The 3.5 framework still runs on top of the 2.0 CLR so what you are seeing is correct.</p> <p>Scott Hanselman has a nice <a href="http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx" rel="nofollow noreferrer">blog post</a> about the details of this:</p> <blockquote> <p>Th...
<p>You do not need to do anything more, other than have a properly configured web.config</p>
19,211
<p>I’m looking for some advice on separating projects in .NET. I’m building a large windows form app (80 tables) and I’ve only got a couple of projects. They’re becoming quite big. I noticed the problem when I saw the list of references the other day. This is the first time I’ve create an application this big, so the n...
<p>One thing that I like to separate out as a separate assembly from those you have already mentioned is a 'proxy' project. </p> <p>Let's assume you are consuming one of your webservices in your presentation tier. Instead of directly referencing the service (wcf/.asmx) in the presentation tier, I like to have a separa...
<p>use folders within the projects to further separate your classes from eachother based on domain. Also, you can create solution folders in Visual Studio, these are virtual folders that can be used to group projects within you solution. Right click on the solution in the solution explorer, and create a tests folder,...
49,819
<p>The option to target another version of the .Net Framework is disabled on a particular test system we are using on a current project.</p> <p>I have tried the following without success:<br/></p> <ul><li>Killing all W3WP.EXE processes</li><li>Restarting the IIS service</li><li>Remote Debugging has been removed from ...
<p>Try re<a href="http://community.versionone.com/KnowledgeBase/FAQs/Q10089.aspx" rel="nofollow noreferrer">Registering ASP.NET on IIS</a>.</p>
<p>Do you have ASP.net Serveice (Allowed) in IIS</p> <p>In anyway, you can use some vbscript to change the .net version.</p>
41,959
<p>How can i check to see if a static class has been declared? ex Given the class</p> <pre><code>class bob { function yippie() { echo "skippie"; } } </code></pre> <p>later in code how do i check:</p> <pre><code>if(is_a_valid_static_object(bob)) { bob::yippie(); } </code></pre> <p>so i don't get:...
<p>You can also check for existence of a specific method, even without instantiating the class</p> <pre><code>echo method_exists( bob, 'yippie' ) ? 'yes' : 'no'; </code></pre> <p>If you want to go one step further and verify that "yippie" is actually static, use the <a href="http://us3.php.net/language.oop5.reflectio...
<p><a href="http://us2.php.net/class_exists" rel="nofollow noreferrer"><code>bool class_exists( string $class_name [, bool $autoload ]</code>)</a></p> <blockquote> <p>This function checks whether or not the given class has been defined.</p> </blockquote>
15,048
<p>Does anyone know of any C container libraries? I am looking for something which gives standard implementations of linked lists, arrays, hash tables etc, much in the same way as the C++ STL does. Key concerns are:</p> <ol> <li>Client code should be able to create containers for multiple different data types without ...
<p>I just came across SGLIB while looking for a C implementation of a map/dictionary container. Unfortunately, no map but it seems to include the containers you asked about. I have no idea how good it is.</p> <p><a href="http://sglib.sourceforge.net/" rel="noreferrer"><a href="http://sglib.sourceforge.net" rel="noref...
<p><code>#include "queue.h"</code> to get access to the implementations of singly-linked lists, singly-linked tail queues, lists and tail queues.</p> <p>I found a generic cache for storing arbitrary objects in memory by D. J. Bernstein (<a href="http://cr.yp.to/djbdns.html" rel="nofollow noreferrer">http://cr.yp.to/dj...
39,314
<p>Recently got an Anycubic I3 Mega Printer and I've been playing with what it can do, but after a model is done it leaves residue on the build plate behind that is bugging me. Do I NEED to remove it? If so, how? Thanks! (I'm using PLA if that matters)</p> <p>My Problem: </p> <p><a href="https://i.stack.imgur.com/pup...
<p>You should remove it because it can and will affect the quality of future prints. Residue can mix up with new filament and create a ugly of colors and also prevent adhesion in places, thus potentially ruining your next print.</p> <p>You have several solutions to clean up the bed:</p> <ul> <li>Scrape it off: usuall...
<p>I have had moderate success with a product called <a href="https://googone.com" rel="nofollow noreferrer">Goo Gone</a> (don't laugh). It quite remarkably lifts off any number of "sticky" items from various surfaces.</p> <p>I work with PLA filament that is very hard and stubborn to remove from any surface.</p> <p>I...
1,157
<p>What are the main/best Maven repositories to use that will include the majority of your open source Java package dependencies.</p> <p>Also in what order should these be included? Does it matter?</p>
<p>This is the current setup in the project we are building:</p> <ul> <li>MavenCentral</li> <li>ObjectWeb</li> <li>JBoss Maven2</li> <li><p>and some snapshots (see below)</p> <pre><code>&lt;repository&gt; &lt;id&gt;MavenCentral&lt;/id&gt; &lt;name&gt;Maven repository&lt;/name&gt; &lt;url&gt;http://repo1.m...
<p>I would suggest using a Maven proxy like Archiva, Artifactory or Nexus and defining your repo list on the server side. The order matters only to the extent that the proxy server tries the proxied repos one by one and specifying a fringe repository as first will slow down the resolution of uncached artifacts (Artifac...
19,567
<p>What is the best way to validate a crontab entry with PHP? Should I be using a regex, or an external library? I've got a PHP script that adds/removes entries from a crontab file, but want to have some way to verify that the time interval portion is in a valid format.</p>
<p>Who said regular expressions can't do that?</p> <p>Courtesy of my employer, <a href="http://www.salir.com" rel="noreferrer">Salir.com</a>, here's a PHPUnit test which does such validation. Feel free to modify &amp; distribute. I'll appreciate if you keep the @author notice &amp; link to web site.</p> <pre><code>&l...
<p>Thanks to Jordi Salvat i Alabart and ph4r05.</p> <p>I have small modified existing solution posted on php. Perl alternative to generate regex:</p> <pre><code>sub _BuildRegex { my $number = { 'min' =&gt; '[0-5]?\d', 'hour' =&gt; '[01]?\d|2[0-3]', 'day' =&gt; ...
29,155
<p>I'm new to TDD. So any help would be appreciated. I'm using NUnit and Rhino mocks. How can I set the ID value to 1 in my mock object?</p> <p>I had a look at this: <a href="http://www.iamnotmyself.com/2008/06/26/RhinoMocksAndReadOnlyPropertyInjectionPart2.aspx" rel="nofollow noreferrer">http://www.iamnotmyself.com/2...
<p>For what it's worth, I do not see the behavior you are seeing in issue #1, "Each buffer visiting a python file gets its own inferior interactive python shell."</p> <p>This is what I did using python.el from Emacs 22.2.</p> <p>C-x C-f foo.py [insert: print "foo"]</p> <p>C-x C-f bar.py [insert: print "bar"]</p> <p...
<p>Debian has deleted the python-mode package, alas, so I felt compelled to try python.el. I loaded it and ran &quot;describe-bindings&quot;. It appeared to be designed for elisp coders who think <code>c-X ;</code> is the intuitive binding for commenting a line of Python code. (Wow.) Also, I found no way at all to ...
47,319
<p>I have been up and down this site and found a lot of info on the Screen class and how to count the number of monitors and such but how do I determine which montitor a form is currently in?</p>
<p>A simpler method than using the bounds is to use the Screen.FromControl() method. This is the same functionality that Windows uses.</p> <pre><code>Screen.FromControl(this) </code></pre> <p>will return the screen object for the screen that contains most of the form that you call it from.</p>
<p>Each Screen object has a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.bounds.aspx" rel="nofollow noreferrer">Bounds</a> property you can use to find the coordinates the screen occupies, just check where the form is.</p>
43,437
<p>I have been attempting to create a new directory for my apache server. As I tried to access the new directory, I type:</p> <p>sudo /etc/init.d/apache2 restart</p> <p>But I obtain this error in the Ubuntu Terminal:</p> <p>Syntax Error on line 1 of /etc/apache2/conf.d/fqdn.save: ServerName takes one argument, the H...
<p>You've got sudo; I'm going to assume that's the standard Ubuntu "blanket" sudo that lets you do anything.</p> <p>Check out what's in the file by doing:</p> <pre><code>sudo cat /etc/apache2/conf.d/fqdn.save </code></pre> <p>Make a backup of the file, just in case:</p> <pre><code>sudo cp /etc/apache2/conf.d/fqdn.s...
<p>You need to be inside the group that has permissons to write that file and that would be probably apache and root (both user and group), im not quite sure about the group name of apache in ubuntu but if you are a regular user im afraid you would not be able to just delete the file, ask the system administrator or so...
42,381
<p>It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files.</p> <p>I want a tool where I can:</p> <ul> <li>type a search string</li> <li>type a replace string</li> <li>select a directory and file extension</li> </...
<p>I think <a href="http://regexxer.sourceforge.net/" rel="noreferrer">regexxer</a> is exactly what you're looking for:</p> <h3><a href="http://regexxer.sourceforge.net/" rel="noreferrer">Regexxer</a></h3> <blockquote> <p>regexxer is a nifty GUI search/replace tool featuring Perl-style regular expressions. If you need...
<p>I use gVim for this task all the time. I open up all the files at once, then use the commands to perform a subsitution on each file, asking for confirmation. Generally I use &lt; 20 files, so I open them as tabs and use this:</p> <pre><code>:tabdo %s/foo/bar/gc </code></pre> <p>gVim works fine on Windows :) My ...
22,942
<p>The <a href="http://en.wikipedia.org/wiki/ANSI_C" rel="noreferrer">Wikipedia article on ANSI C</a> says:</p> <blockquote> <p>One of the aims of the ANSI C standardization process was to produce a superset of K&amp;R C (the first published standard), incorporating many of the unofficial features subsequently intro...
<p>There may be some confusion here about what "K&amp;R C" is. The term refers to the language as documented in the first edition of "The C Programming Language." Roughly speaking: the input language of the Bell Labs C compiler circa 1978.</p> <p>Kernighan and Ritchie were involved in the ANSI standardization process....
<p>Despite all the claims to the contary K&amp;R was and is quite capable of providing any sort of stuff from low down close to the hardware on up. The problem now is to find a compiler (preferably free) that can give a clean compile on a couple of millions of lines of K&amp;R C without out having to mess with it.And r...
4,253
<p>I know that we shouldn't being using the registry to store Application Data anymore, but in updating a Legacy application (and wanting to do the fewest changes), what Registry Hives are non-administrators allowed to use? </p> <p>Can I access all of <code>HKEY_CURRENT_USER</code> (the application currently access <...
<p>In general, a non-administrator user has this access to the registry:</p> <p>Read/Write to:</p> <ul> <li><code>HKEY_CURRENT_USER</code></li> </ul> <p>Read Only:</p> <ul> <li><code>HKEY_LOCAL_MACHINE</code></li> <li><code>HKEY_CLASSES_ROOT</code> (which is just a <em>link</em> to <code>HKEY_LOCAL_MACHINE\Software...
<p>Yes, you should be able to write to any place under HKEY_CURRENT_USER without having Administrator privileges. But this is effectively a private store that no other user on this machine will be able to access, so you can't put any shared configuration there.</p>
7,656
<p>I'm sure many readers on SO have used <a href="https://www.lutzroeder.com/dotnet/" rel="nofollow noreferrer">Lutz Roeder</a>'s <a href="http://www.reflector.net/" rel="nofollow noreferrer">.NET reflector</a> to decompile their .NET code. I was amazed just how accurately our source code could be recontructed from ou...
<p>I wouldn't worry about it too much. I'd rather focus on putting out an awesome product, getting a good user base, and treating your customers right than worry about the minimal percentage of users concerned with stealing your code or looking at the source.</p>
<p>Obsfucation is limited in it's effectiveness, it might keep the casual guy away. The most effective obsfucation is making only the smallest amount of code available to the user. If you can, make your app run depend heavily on a fat server.</p>
3,316
<p>I'm trying to center a page and then make it <code>100%</code> in height. I have a div called "content" as the parent element of all elements in the HTML page. What do I need to do next? I'd like to stay away from any CSS-hacks. This is currently working in IE7, but not in Firefox 3.</p> <p><strong>EDIT:</strong> I...
<p>To center content, put it inside of an element that has a fixed width (important!) and has <code>margin: auto;</code></p> <p>There is no cross-browser was to make your div have 100% height unless you use javascript. If you are desperate for this functionality and are willing to use javascript, you can dynamically s...
<p>For centering the page, I typically just put the content div in the center tag, because margin-left/right:auto really doesn't work in all versions of IE.</p> <p>For making the page the whole height, you can fake it a couple of ways. My favorite is to create a background image for the body tag that is centered hori...
48,863
<p>I'm new to RhinoMocks, and trying to get a grasp on the syntax in addition to what is happening under the hood.</p> <p>I have a user object, we'll call it User, which has a property called IsAdministrator. The value for IsAdministrator is evaluated via another class that checks the User's security permissions, and ...
<p>One quick note before I jump into this. Typically you want to avoid the use of a "Strict" mock because it makes for a brittle test. A strict mock will throw an exception if anything occurs that you do not explicitly tell Rhino will happen. Also I think you may be misunderstanding exactly what Rhino is doing when you...
<p>_mocks.ReplayAll() will do nothing. It is just because you use SetupResult.For() that does not count. Use Expect.Call() to be sure that your code do everything correct.</p>
10,382
<p>I need to backup the original data from a table so I can fill it with test data, then restore it again after deving / testing etc.. Anyone know any quick ways to achieve this? I'm on SQL Server 2005.</p> <p>Thanks.</p>
<p>There is no "best" framework... Indeed, "best" really depends on your needs, on your knwoledges (it can cost a lot of time to learn a new framework)...</p>
<p>I personally like <a href="http://tapestry.apache.org/" rel="nofollow noreferrer">Tapestry</a>. I've only used version 4.1 but development time is way faster than JSP or JSF. It allows you to simply refresh pages to immediately see the changes you made without doing a deployment and uses actual HTML for the template...
33,208
<p>I'm not sure about what's the difference between opening a JS script with </p> <pre><code>&lt;SCRIPT language='JavaScript'&gt; </code></pre> <p>or with:</p> <pre><code>&lt;SCRIPT type="text/JavaScript"&gt; </code></pre> <p>Should JavaScript always be quoted (either with " " or with ' ') or that's not really impo...
<p>The language attribute was used in HTML 3.2. HTML 4.0 introduced type (which is consistent with other elements that refer to external media, such as <code>&lt;style></code>) and made it required. It also <a href="http://www.w3.org/TR/html401/conform.html#deprecated" rel="nofollow noreferrer">deprecated</a> language....
<p>Use both:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; </code></pre>
14,124
<p>I'm looking for a way to change the CSS rules for pseudo-class selectors (such as :link, :hover, etc.) from JavaScript.</p> <p>So an analogue of the CSS code: <code>a:hover { color: red }</code> in JS.</p> <p>I couldn't find the answer anywhere else; if anyone knows that this is something browsers do not support, ...
<p>You can't style a pseudo-class on a particular element alone, in the same way that you can't have a pseudo-class in an inline style="..." attribute (as there is no selector).</p> <p>You can do it by altering the stylesheet, for example by adding the rule:</p> <pre><code>#elid:hover { background: red; } </code></pr...
<p>In jquery you can easily set hover pseudo classes.</p> <pre><code>$("p").hover(function(){ $(this).css("background-color", "yellow"); }, function(){ $(this).css("background-color", "pink"); }); </code></pre>
40,080
<p>How to I get the Fixnum returned by the following:</p> <pre><code>"abc"[2] </code></pre> <p>Back into a character?</p>
<p>This will do it (if n is an integer):</p> <pre><code>n.chr </code></pre>
<p>Be careful because Ruby 1.9 and later will return a single-character string for <code>"abc"[2]</code>, which will not respond to the <code>chr</code> method. You could do this instead:</p> <pre><code>"abc"[2,1] </code></pre> <p>Be sure to read up on the powerful and multifaceted <a href="http://ruby-doc.org/core/c...
20,650
<p>I am wondering how the JBoss ExceptionSorter classes are able to check for database errors.</p> <p>The application (the EJB or persistence framework) is holding the reference to the database Connection, so SQLExceptions are caught by the application. How is JBoss able to see the contents of the exception?</p> <p>D...
<p>If you have ever run a debugger against code running inside JBoss, while that that has an open database connection, you will notice that the connection is actually a JBoss-specific class that wraps the real database connection.</p> <p>In some cases, you can see this wrapper as a line in the stack trace when an exce...
<p>JBoss uses a connection pool for its datasources (org.jboss.resource.adapter.jdbc.local.LocalTxDataSource). The ExceptionSorter takes an SQLException as a parameter which it then just checks for certain strings which map to certain errors. If the errors represent a physical connection problem then they will look som...
26,926
<p>We have a website that uses <code>#include file</code> command to roll info into some web pages. The authors can access the text files to update things like the occasional class or contact information for the department.</p> <p>My question is this, I don't <em>see</em> anyone using this method and wonder if it is ...
<p>I've had to interview people for a few C# positions and this is my general advice for VB.Net developers interviewing for a C# position:</p> <ul> <li>Make sure you are clear that you have been working VB.Net. This seems obvious but is something that apparently isn't (in my experience).</li> <li>Try to give a code s...
<p>VB or C# both are syntax only diffrent but if you are applying way of logic is same.</p>
3,558
<p>I want to copy and paste text from a Office 2007 document (docx) into a textarea. On Window, using Firefox 3, there is additional jiberish that gets put into the field:</p> <pre><code>...Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Normal 0 false false false EN-US X-NONE X-NONE Micros...
<p>Similar to Lincoln's idea, you can use <a href="http://www.stevemiller.net/puretext/" rel="nofollow noreferrer">PureText</a> to automate the process. Basically, you press its hotkey instead of <kbd>Ctrl</kbd>+<kbd>V</kbd> (I have mine set to <kbd>Win</kbd>+<kbd>V</kbd>), and it pastes the plain text version of whate...
<p>I find the easiest way to eliminate this random jibberish is to copy the text you want, paste it into notepad or a similar plaintext editor, copy it from notepad, then paste it into the field.</p> <p>Also, running it through a script or application that strips out the "smart" quotes and em/en dashes isn't a bad ide...
16,518
<p>This is a question for anyone who has the pleasure to work in both Java and C#.</p> <p>Do you find that you have to make a mental context switch of some kind when you move from one to the other?</p> <p>I'm working in both at the moment and because the syntax and libraries are so similar and yet subtly different I'...
<p>Yes, I have to make a mental context switch - because LINQ isn't available in Java :(</p> <p>Beyond that, there are little things like <code>foreach (X x in y)</code> vs <code>for (X x : y)</code> which often trip me up, but not a <em>huge</em> amount otherwise.</p> <p>As for a tip to make your brain work differen...
<p>I find that most difficult switches are around generics (which C# does better), delegates (which Java sort of hacks with anonymous inner classes) and the events (which Java doesn't have)</p> <p>I find that making sure you are using the idioms of the language (i.e. using delegates instead of creating an interface in...
22,090
<p>Today I ran XtUnit at a part of my unit testing framework to to rollback database changes created while running a test case. This is a skeleton of how I have used it. The Test case ran successfully but the database state changed as a result. </p> <pre><code>using NUnit.Framework; using TeamAgile.ApplicationBlocks....
<p>I think your test fixture needs to extend <code>ExtensibleFixture</code>, not <code>InterceptableObject</code>. In the XtUnit source, <code>ExtensibleFixture</code> itself inherits from <code>InterceptableObject</code>. The comments in ExtensibleFixture.cs state:</p> <blockquote> <p>This is the base class for a...
<p>Database and your program must be run under WindowsXP SP2 oder Server 2003.</p>
40,062
<p>I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month. </p> <p>Are there any guidelines to how how big your transaction log should be relative to your database file...
<p>Er... excuse the bleeding obvious, but do you have scheduled backups with "BACKUP LOG"</p> <p>If the recovery model is FULL then this needs to happen.</p> <p>There are other, rare options that I'll include (not exhaustive):</p> <ul> <li>Large table index rebuild/maintenance. However, backup log will clear this.</...
<p>If you have code that does a lot of transactions (relative to the actual size of the database), it certainly bloat the log.</p> <p>If you don't have one now, I'd definitely recommend setting up a Database Maintenance Plan to do nightly backups (and perhaps more frequent transaction log backups). Typically the back...
37,960
<p>I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table (stack unwinding, etc.), but it seems to break a lot of the OO model in the process.</p> <p>Anyway, here's the problem:</p> <p>Let's say you have some class which wraps or includes net...
<p>This looks like an excellent opportunity to have a look at Aspect Oriented Programming. Here is a good article on <a href="https://learn.microsoft.com/en-us/archive/blogs/simonince/aspect-oriented-interception" rel="nofollow noreferrer">AOP in .NET</a>. The general idea is that you'd extract the cross-functional con...
<p>Just wondering, what do you feel your method leaves to be desired? You could replace the anonymous delegate with a.. named? delegate, something like</p> <pre><code> public delegate void IoOperation(params string[] parameters); public void FileDeleteOperation(params string[] fileName) { File.Del...
2,389
<p>How do I ignore all files within a folder under source control?</p> <p><code>/project/published/</code> is a folder I want to keep</p> <p><code>/project/published/some_file(s)</code> are files/folders I don't want</p> <p>More Details: Currently when I go to commit changes for my project I see a lot of files that ...
<p>You just right click on the <code>published/</code> folder, select TortoiseSVN -> Properties, click New -> Advanced with the following:</p> <ul> <li>Property name: <code>svn:ignore</code> </li> <li>Property value: <code>*</code></li> </ul> <p>Then it would work fine.</p>
<p>Perhaps this can help you: in the Commit dialog there's a check box to "Show unversioned files". It's not the same as telling Tortoise/SVN to ignore them but might just do the trick. HTH</p>
36,678
<p>What is a <code>DOCVARIABLE</code> in Microsoft Word 2003? How do I set it? How do I make it display in my Word document?</p>
<blockquote> <p>You can use the Microsoft Visual Basic for Applications Variables collection to set and retrieve the contents of a string variable in a Word document or template.</p> <p>Also, you can use the DocVariable field to retrieve the value of a document variable after it has been set to display within a Word do...
<p>I was also looking for an answer to this question. Created a small script to display all ActiveDocument.Variables</p> <p>Here is it:</p> <pre><code>Sub GetVariables() ' Declaration of output variavle, which is a string Dim output As String output = "" For Each Variable In ActiveDocument.Variables ...
25,135
<p>Let me begin with an illustrative example (assume the implementation is in a statically typed language such as Java or C#).</p> <p>Assume that you are building a content management system (CMS) or something similar. The data is hierarchically organised into <code>Folder</code>s. Each folder has a collection of chil...
<p>I don't know what kind of API you are trying to build, but your suggestion #1 sounds like it is close to what is recommended for REST style services and APIs. Basically, a <code>Folder</code> object would contain a list of URLs to its children.</p>
<p>Suppose You model the whole tree with every element being a Node, specialisations of Node being Folder and, umm, Leaf. You have a "root" Node. Nodes have a methods </p> <pre><code>canHaveChildren() getChildren() </code></pre> <p>Leaf nodes have the obvious behaviours (never even need to hit the network)</p> <p>...
28,460
<ul> <li>OpenId is open source and can be implemented by anyone. </li> <li>In both cases my credentials are held on a third party server.</li> <li>The only advantage I can think of for using Microsoft Passport is the reliability of Microsoft.</li> </ul>
<p>OpenID is a decentralized authentication system while Passport is centralized.</p> <p>If you use OpenID, you'll not relying on any single third party provider which can shut down services or act as a big brother or ... because you are <i>using a distributed authentication mechanism</i>.</p> <p>And you can have muc...
<p>Microsoft Passport only supports username/password authentication. Lots of OpenID Providers support Cardspace login, X509, or other phishing resistant means. That means that your OpenID can actually be <em>more</em> secure than MS Passport.</p>
46,077
<p>I understand that, if <code>S</code> is a child class of <code>T</code>, then a <code>List&lt;S&gt;</code> is <strong>not</strong> a child of <code>List&lt;T&gt;</code>. Fine. But interfaces have a different paradigm: if <code>Foo</code> implements <code>IFoo</code>, then why is a <code>List&lt;Foo&gt;</code> not (a...
<p>Your <code>List&lt;Foo&gt;</code> is not a subclass if <code>List&lt;IFoo&gt;</code> because you cannot store an <code>MyOwnFoo</code> object in it, which also happens to be an <code>IFoo</code> implementation. (<a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" rel="nofollow noreferrer">Liskov su...
<p>The simple answer is that <code>List&lt;Foo&gt;</code> is a different type to <code>List&lt;IFoo&gt;</code>, in the same way that <code>DateTime</code> is different to <code>IPAddress</code>, for example.</p> <p>However, the fact that you have <code>IFoo</code> implies that collections of <code>IFoo</code> are expe...
40,989
<p>I was investigating the rapid growth of a SQL Server 2005 transaction log when I found that transaction logs will only truncate correctly - if the sys.databases "log_reuse_wait" column is set to 0 - meaning that nothing is keeping the transaction log from reusing existing space. </p> <p>One day when I was intend...
<p>I still don't know why I was seeing the ACTIVE_TRANSACTION in the sys.databases log_reuse_wait_desc column - when there were no transactions running, but my subsequent experience indicates that the log_reuse_wait column for the tempdb changes for reasons that are not very clear, and for my purposes, not very relevan...
<p>Hm, tricky. Could it be that the question it self to sys.databases is causing the ACTIVE_TRANSACTION? In that case though, it should be in the MASTER and not the TEMPDB.</p>
11,572
<p>When should I continue to make derived classes, and when should I just add conditionals to my code? eg for a missile</p> <pre><code>class Object; class Projectile : public Object; class Missile : public Projectile; class MissileGuided : public Missile; </code></pre> <p>Or should I implement that last one in the m...
<p>You may want to consider using <strong>strategy pattern</strong> instead of both approaches and encapsulate behaviours within external classes. Then the behaviours can be injected into the Missile class to make it GuidedMissile or SpaceRocket or whatever else you need. </p> <p>This way excessive branching of logic ...
<p>Just ask yourself, how it would be easier to:</p> <ol> <li>read and understand the code (the small project part and the whole project)</li> <li>change the code in the future (be very careful when predicting future needs, usually it's better not to adapt your code for "may-be" changes in advance)</li> </ol> <p>Also...
26,579
<p>we are maintaing a database of image media in a large scale webapplication. The high resolution jpgs are big (> 15MB) and must not be made available for download in any way. Now we need to provide access to the details (crops) of the images to the clients (like a zoom-in function). The client should see a downskaled...
<p>First thing you will need to do is compress and watermark the images before uploading them to the server. Then present those to the user. This will take the least CPU resources since they images will be static.</p> <p>I personally would then crop the images for the full size versions and put them up along side the ...
<p>I'd use <a href="http://aws.amazon.com/resources/" rel="nofollow noreferrer">S3</a> for storage. Create two buckets (public protected), give out url to the protected bucket's images once you have authorized the user to download them. S3 Urls can be made restful with an expiration date.</p> <p>With 15Mb images you...
48,963
<p>I have a Delphi 2009 program that handles a lot of data and needs to be as fast as possible and not use too much memory.</p> <p>What <strong>small simple</strong> changes have you made to your Delphi code that had the biggest impact on the performance of your program by noticeably reducing execution time or memory ...
<p>.BeginUpdate;</p> <p>.EndUpdate;</p> <p>;)</p>
<p>Take advantage of some of <a href="http://www.fastcode.dk/fastcodeproject/fastcodeproject/index.htm" rel="nofollow noreferrer">the FastCode project</a> code. Parts of it were incorporated into VCL/RTL proper (like FastMM was), but there is more out there you can use!</p> <p>Note, they have a <a href="http://www.fa...
48,842
<p>I have a website that is deployed between 3 different environments - Dev, Stage, and Prod. For Stage and Prod, the site can resolve local paths to images with just the base url to the file, such as /SiteImages/banner.png. However, on the Dev server I have to hard code the full URL of the image path for the image to ...
<p>here:</p> <pre><code>// matches "test=, test" (\S+?)= or // matches "test=, test" too (\S[^=]+)= </code></pre> <p>you should consider using the second version over the first. given your string <code>"test=this=that=more text follows"</code>, version 1 will match <code>test=this=that=</code> then continue parsing...
<p>if you want only "text=", I think that a simply:</p> <pre><code>^(\w+=) </code></pre> <p>should be fine if you are shure about that the string "text=" will always start the line.</p> <p>the real problem is when the string is like this:</p> <blockquote> <p>this=that= more test= text follows</p> </blockquote> <...
25,786
<p>Been creating a simple program using VBA that I can use to review vocabulary in Chinese.</p> <p>I've gotten a fair bit working so far, but have run into a huge problem with inputting a macron-character such as "ā" (unicode 257). The specific application I am working on right now involves changing the contents of t...
<p>You can use ChrW to generate Unicode characters:</p> <pre><code>Mid(strclip, markloc, 1) = ChrW(257) </code></pre>
<p>I don't have ms-office installed on my machine to try it.<br> However, you can use StrConv function with parameter for Unicode (alongwith LCID) to put the unicode content into the textbox.</p> <p>Note that VB6 style controls dont accept unicode values. <br> If you are creating forms inside VBA editor, it should wor...
24,947
<ol> <li><p>New class is a subclass of the original object</p></li> <li><p>It needs to be php4 compatible</p></li> </ol>
<p>You could have your classes instantiated empty and then loaded by any number of methods. One of these methods could accept an instance of the parent class as an argument, and then copy its data from there</p> <pre><code>class childClass extends parentClass { function childClass() { //do nothing ...
<p>I would imagine you would have to invent some sort of a "copy constructor". Then you would just create a new subclass object whilst passing in the original object.</p>
14,507
<p>We need to get data out of an older accounting system. We have received a dll that gives us access to the data we need. It includes a type library that we have imported.</p> <p>If we run our test application from the same directory as the accounting system, everything works fine. If we try to run our application fr...
<p>If it works from the accounting app's directory, but not a different one, the first thing I'd try is adding that directory to your path.</p>
<p>Unless it is already loaded into memory, Windows looks for DLL's that a program is requesting in every location listed in its PATH environment variable, and also in the directory the application is located within.</p>
46,349
<p>I am writing the results of certain checks on access table to a excel file. Sometimes the results exceed 65k that is more than excel can handle( excel 2002). How do i check the end of the file and open a new sheet for the continuation</p> <p>Thanks</p>
<p>You have at least two options.</p> <p>The first is simply count the rows as you're outputting them (if the write doesn't happen all at once, keep a secondary file with the count of rows in the primary file). As the row count approaches the limit (i.e 65k) start a new worksheet.</p> <p>Depending on how flexable you...
<p>I should ask how you're outputting these to a file. </p> <p>If it's procedurally then Why not have a running counter that goes to 65535. When it exceeds that, start a new worksheet.</p>
45,482
<p>Can I, using an address found in a map file, use windbg to alter a variable in memory while the app is running?</p> <p>I'm really interested in turning on/off functionality in run-time maybe with a variable.</p> <p>How would you do this? Does it require breaking the app through the debugger?</p>
<p>If you have the address, you can use the any of the e* (Enter Value) commands.</p> <p>You can attach to any running process if you know the process id, or you can launch the exe directly with cdb. You do have to break the process to make any modifications. In CDB, you can use Ctrl+C, and the it will inject a Debu...
<p>I'm not sure what exactly you trying to achieve, but debugger should be activated on some event (exception, break point or something), after it's activated, for example you can have a thread that create an exception and after get control back check the variable.<br> In debugger you can set a break point with comman...
19,638
<p>I've just finished building a new printer and I wanted to take advantage of a 32 bits board I ordered some time ago. The board is an MKS SBase 1.3</p> <p>I've been researching the Smoothiware firmware but somehow I'm not convinced by it yet. One of the things pulling me off is the Z-Probe behavior. On my Arduino-Ma...
<p>So, low-teck, old-style investigative work from my side.... I contacted <a href="http://www.filright.com" rel="nofollow noreferrer">a company</a> selling HDPLA and they got back to me with the following reply.</p> <blockquote> <p>We created HDPLA as an industrial PLA with special additives. As a result, our so ca...
<p>I doubt that it means very much at all. Filament manufacturers are very tight-lipped about the co-polymers that they add to their base stock in order to improve handling and performance characteristics, so it is impossible to say. The only common attribute that I can see is an advertised diameter tolerance of &plusm...
791
<p>Hopefully an easy question, but I'd quite like a technical answer to this!</p> <p>What's the difference between:</p> <pre><code>i = 4 </code></pre> <p>and</p> <pre><code>Set i = 4 </code></pre> <p>in VBA? I know that the latter will throw an error, but I don't fully understand why.</p>
<p><code>set</code> is used to assign a reference to an object. The C equivalent would be </p> <pre><code> int i; int* ref_i; i = 4; // Assigning a value (in VBA: i = 4) ref_i = &amp;i; //assigning a reference (in VBA: set ref_i = i) </code></pre>
<p>Set is an Keyword and it is used to assign a reference to an Object in VBA.</p> <p>For E.g., *Below example shows how to use of Set in VBA.</p> <p>Dim WS As Worksheet</p> <p>Set WS = ActiveWorkbook.Worksheets("Sheet1")</p> <p>WS.Name = "Amit"</p>
45,487
<p><strong>First of all i am doing a Windows application. Not a web application.</strong></p> <p>Now i am doing on application to send SMS (Short message) from System to Mobile.</p> <p>Here, i am using a http URL to push the message having parameters To (number) and Msg (test message).</p> <p>after forming the URL, ...
<p>Using .NET , see <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx" rel="nofollow noreferrer">WebClient Class</a> - Provides common methods for sending data to and receiving data from a resource identified by a URI.</p> <p>Seen here a few times, e.g. <a href="https://stackoverflow.c...
<p>Here's a code from Microsoft's <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx" rel="nofollow noreferrer">WebClient Class</a>.</p> <pre><code>using System; using System.Net; using System.IO; public class Test { public static void Main (string[] args) { if (args == null ||...
48,887
<p>I have a menu of product brands that I want to split over 4 columns. So if I have 39 brands, then I want the maximum item count for each column to be 10 (with a single gap in the last column. Here's how I'm calculating the item count for a column (using C#):</p> <pre><code>int ItemCount = Convert.ToInt32(Math.Cei...
<p>You can cast:</p> <pre><code>int ItemCount = (int) Math.Ceiling( (decimal)BrandCount / 4m ); </code></pre> <p>Also, because <code>int</code>/<code>decimal</code> results in a <code>decimal</code> you can remove one of the casts:</p> <pre><code>int ItemCount = (int) Math.Ceiling( BrandCount / 4m ); </code></pre>
<p>Perhaps try something like this ... Assuming <code>BrandCount</code> is an integer. You still have the same casts, but it might be clearer:</p> <pre><code>int ItemCount = (int)(Math.Ceiling(BrandCount / 4m)); </code></pre> <p>I'm not a huge fan of the <code>Convert</code> class, and I avoid it whenever possible. I...
31,121
<p>I'm using the Infragistics WinForms UltaGrid control and I'm setting the RegexPattern property. How do I get the grid cell I'm setting the RegEx for to actually use that pattern to restrict entry? Or am I misunderstanding how the RegexPattern property works.</p> <p>Jeff</p>
<p>RegexPattern property for the column is used for cell value validation. So if you set this property and your user tries to edit a value in the column, it will be validated against this Regex, after he is done.</p>
<p>Which version of NetAdvantage are you using? There is no RegexPattern property of the UltraGridCell class in NetAdvantage 2008. </p> <p>However, if you are refering to the RegexPattern property of the UltraGridColumn class it will do what you want. The value of the cell must give <strong>exactly one match</strong> ...
28,975
<p>When extracting files from a ZIP file I was using the following.</p> <pre><code>Sub Unzip(strFile) ' This routine unzips a file. NOTE: The files are extracted to a folder ' ' in the same location using the name of the file minus the extension. ' ' EX. C:\Test.zip will be extracted to C:\Test ' 'strFile (String) = ...
<p>All above solutions are accurate, but they are not definitive. </p> <p>If you are trying to extract a <em>zipped file</em> into a temporary folder, a folder that displays "Temporary Folder For YOURFILE.zip" will immediately be created (in <code>C:\Documents</code> and <code>Settings\USERNAME\Local Settings\Temp</co...
<p><a href="http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23022290.html" rel="nofollow noreferrer">http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23022290.html</a></p> <p>Check your temp directory. If you have 99 folders associated with this unzipping pr...
37,164
<p>I have a custom Jabber IM client and I'm having a problem with links. When something like <a href="http://something.com" rel="noreferrer">http://something.com</a> is entered I want it to show up as a link in the message window. The message window is a standard c# textbox. Is there a way to mark it as a link so th...
<p>A RichTextBox can detect URL's, I don't think a regular TextBox can detect them. However you can always use a Single line RichTextBox for your input. </p> <p><a href="http://msdn.microsoft.com/en-us/library/f591a55w.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/f591a55w.aspx</a></p>
<p>The solution provided by Mr Jamie Garcia is a great one, referenced by the supplied MSDN article link. However, given that this solution was proposed so long ago, I would like to propose an updated one.</p> <p>The <a href="https://msdn.microsoft.com/en-us/library/f591a55w.aspx" rel="noreferrer">MSDN solution</a> l...
41,535
<p>I am hearing a lot of rumours that Linq2Sql is not going to be supported any more in the next version of .net. I like Linq2Sql a lot and find it very easy / lightweight to work with. I can understand some of the problems people have had with it (ppl used to nhibernate...) but used correctly I think most problems can...
<p>If there were another version of Linq to SQL, here's my feature wishlist:</p> <p>Things I actually wanted whilst building my last Linq-to-SQL project (and had to work around manually in most cases)</p> <ol> <li>Many-many associations </li> <li>Better visual designer (including a "refresh table" feature)</li> <li>C...
<p>First and foremost, people are losing interest in it since it will not be developed any further, and Entity Framework will go forward instead.</p> <p>LinqToSQl works and is pleasant to use, but EF will overtake it sooner or later.</p> <p>The ORM purists would prefer if it was easier to set up LINQ to Sql to use an...
44,131
<p>I and two others are working on a project at the university. </p> <p>In the project we are making a prototype of a MMORPG.</p> <p>We have decided to use PostgreSQL as our database. The other databases we considered were MS SQL-server and MySQL. Does somebody have a good reference which will justify our choice? (pr...
<p>Someone recently recommended me <a href="http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL" rel="nofollow noreferrer">wikivs.com: MySQL vs. PostgreSQL</a> - it is a quite detailed comparison of those two, and might be of help to you.</p>
<p>Postgresql has a page of <a href="http://www.postgresql.org/about/casestudies/" rel="nofollow noreferrer">case studies</a> that you can quote and link to.</p> <p>Really, any of the above would have worked for you. I personally like PostgreSQL. One solid advantage it has over MSSQL (even assuming you can get it for ...
23,730
<p>How do I expose the <code>ActualWidth</code> property of one of the components of my user control to users?</p> <p>I have found plenty of examples of how to expose a normal property by creating a new dependency property and binding, but none on how to expose a read-only property like <code>ActualWidth</code>.</p>
<p>What you need is a ReadOnly dependency property. The first thing you need to do is to tap into the change notification of the <code>ActualWidthProperty</code> dependency on the control that you need to expose. You can do that by using the <code>DependencyPropertyDescriptor</code> like this:</p> <pre><code>// Need t...
<p><code>ActualWidth</code> is a public readonly property (coming from <code>FrameworkElement</code>) and is exposed by default. What is the case that you are trying to achieve?</p>
40,361
<p>Microsoft WPF? Adobe AIR/Flex? Adobe Flash? Curl programming language?</p> <p>How does AJAX fit in?</p> <p>Given a server written in C++ .NET.</p>
<p>The answer does depend really on what your application actually does and your platform requirements. </p> <p>If its a regular web application like gmail and you want it to work on lots of browsers and platforms; then I'd recommend a combination of HTML, CSS and <a href="http://code.google.com/webtoolkit/" rel="nofo...
<p>Using WPF you can build desktop and then almost 1:1 port it to silverlight and target the web</p>
10,592
<p>Is it best practice to wrap a web service method/call into a try/catch block?</p> <p>I don't web service requests tend to be the reason why the .NET desktop applications crash? So I was thinking all calls should be wrapped in try/catch to prevent this.</p> <p>Good idea?</p> <p>Also, should it throw an exception o...
<p>I am assuming you are using WCF, since your question is tagged with it. A good practice in exception handling with WFC is not allowing exceptions to bubble across the wire to your consumer, but throw meaningful FaultExceptions instead.</p> <p>You should always have a try...catch block in your operation if there is...
<p>this is a case that could result in an exception being thrown, so yes it should be wrapped on a try catch block.</p> <p>What to do with the exception handler it depends on the program logic...</p>
46,913
<p>I have a process in Linux that's getting a segmentation fault. How can I tell it to generate a core dump when it fails?</p>
<p>This depends on what shell you are using. If you are using bash, then the ulimit command controls several settings relating to program execution, such as whether you should dump core. If you type</p> <pre><code>ulimit -c unlimited </code></pre> <p>then that will tell bash that its programs can dump cores of any ...
<p>By default you will get a core file. Check to see that the current directory of the process is writable, or no core file will be created.</p>
3,859
<p>On a project I'm working on, we use subversion, with tortoiseSVN as a client, under windows XP.</p> <p>As we enter in production and continue development in parallel, many branches are created.</p> <p>Often, we have to backport modifications made on the branch to the trunk, or to older branches. Backporting is a v...
<p>You might assume C and C++ are being "phased out" and that Java/.Net/Python/whatever is an "advance" or the "next stop".</p> <p>They are all used heavily (see the number C or C++ of tags on this site). The difference is that neither one is the lingua-franca of the programming world anymore. It used to be that the m...
<p>On the short term, I expect high level languages to become more powerful and more used. Perl 6 and Javascript 2.0 are good examples of what awaits us.</p> <p>On the long term, functional languages might make it into the mainstream, but I expect that will not happen any time soon.</p>
19,679
<p>I need to match (case insensitive) "abcd" and an optional trademark symbol</p> <p>Regex: <code>/abcd(™)?/gi</code></p> <p>See example:</p> <pre><code>preg_match("/abcd(™)?/gi","AbCd™ U9+",$matches); print_r($matches); </code></pre> <p>When I run this, <code>$matches</code> isn't populated with anything... Not e...
<p>How is your file encoded? PHP has got issues when it comes to unicode. In your case, try using the escape sequence <code>\x99</code> instead of directly embedding the TM symbol.</p>
<p>I suspect it has something to do with the literal trademark symbol.</p> <p>You'll probably want to check out how to use <a href="http://www.regular-expressions.info/unicode.html" rel="nofollow noreferrer">Unicode with your regular expressions</a>, and then embed the escape sequence for the <a href="http://www.filef...
28,671
<p>I'm looking for people who have had experiences scaling WebMethods ESB to large traffic volumes (both size and number of messages). How has that gone? Were there any issues and how did you solve them?</p>
<p>From the environments I've dealt with (from 4 to 1000 servers) it scales pretty well.</p> <p>It depends wildly on the type of information transport technology you are managing.</p> <p>Fastest <B>is</B> the proprietary webMethods Broker, which, on a well configured server, can easily handle millions of >100kb messa...
<p>AFAIK, people get some nice numbers with webMethods (but they do not use webMethods clustering). The webMethods flows can scale, with the downside that they are not persisted through each stage. If you don't use processes, you should be ok with the scaling. </p>
16,653
<p>When moving my .Net Compact Framework application to the SD-card of a Windows CE device, the program executes slower then running it from the internal memory.</p> <p>I thought, the start-up might be slower, but it is the whole program. There is no IO to the storage card.</p> <p>Why is my application so slow and ho...
<p>It has to do with demand-paging. Your app cannot be run directly from the SD-card, as SD is not executable media so it has to be pulled into RAM to run. Windows CE doesn't typically have a whole lot of RAM, so the loader doesn't pull your entire application into RAM to run. Sure, your heaps and stacks will be in R...
<p>Some device will crash your program if application is on sd-card. It happens while suspend-power-on device.</p>
43,767
<p>Is there a way to set repository config variables through the gitosis conf instead of going into each repository and editing the conf values directly?</p>
<p>I don't think it's possible. On the other hand, it's quite simple to build "porcelain" script that analyzes your gitosis.conf for some special comments encoding the conf values. Then putting such script in a post-commit hook should do the trick.</p>
<p>Note (10 years later, 2018), gitosis has long been replaced by <strong><a href="http://gitolite.com/gitolite/" rel="nofollow noreferrer">gitolite</a></strong>.</p> <p>And gitolite offers a way to <a href="http://gitolite.com/gitolite/git-config/" rel="nofollow noreferrer">specify config variables through gitolite c...
32,920
<p>Back in 2000 (when .NET was unleashed upon us IIRC) it was an innovative cutting edge language (last time I used it was 2003).</p> <p>From what I read though, Sun has only evolved the language exceedingly slowly. I've even read that where the language has evolved, such as the addition of Generics, developers have c...
<p>Most languages have one strong hand involved in their origin and evolution. Think: Larry Wall/Perl, Guido/Python, Matz/Ruby, Odersky/Scala, Hickey/Clojure, etc. These guys are all brilliant language dudes. I'd give my left arm to be half as smart as any of them.</p> <p>Java has actually had the distinction of hav...
<p>I think that Sun are now being conservative and ensuring they make the right decisions after making a few poor ones.</p> <p>In addition there was a lot of politicking and messing around before Java 1.5 came out. Many companies were using third party hacks like Generic Java, because these core language features were...
39,392
<p>Can we somehow extend the RuleSetDialog class and host in our windows application?</p>
<p>You can not extend the RuleSetDialog class (since it is sealed), but you can host it in your app:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/system.workflow.activities.rules.design.rulesetdialog.aspx" rel="nofollow noreferrer">RuleSetDialog Class</a></li> <li><a href="http://melgrubb.spaces.live....
<p>While it's true that extending the dialog isn't exactly supported, you <em>can</em> get away with some customizations. On a previous project, I was able to hide and rearrange some of the dialog controls at runtime.</p> <pre><code>var dialog = new RuleSetDialog(activityType, null, ruleset); dialog.Controls["headerT...
25,443
<p>What's the difference between \n and \r (I know it has something to do with OS), and what's the best way to echo a line break that will work cross platform?</p> <p><strong>EDIT:</strong> In response to Jarod, I'll be using ths to echo a line break in a .txt log file, though I'm sure I'll be using it in the future f...
<ul> <li><code>\n</code> is a Linux/Unix line break.</li> <li><code>\r</code> is a classic Mac OS (non-OS X) line break. Mac OS X uses the above unix <code>\n</code>.</li> <li><code>\r\n</code> is a Windows line break.</li> </ul> <p>I usually just use <code>\n</code> on our Linux systems and most Windows apps deal wit...
<p>No backwards compatibility necessary for PHP_EOL on PHP4. </p> <p>Need to correct Moore's statement on constant PHP_EOL availability: "... is declared since PHP 5.0.2.".</p> <p>No, it has been around since PHP 4.3.10. Anyone who is still running anything lesser than that should not be in biz anyhow. As of today no...
31,880
<p>I have a gridview control that can get loaded with multiple pages worth of data. When I switch pages, the columns widths will change to accommodate the largest value in the column for <em>that page</em>.</p> <p>If possible, I would like to set the widths of each column to the widest necessary width for the entire ...
<p>You can set the ItemStyle-Width property on each TemplateField, BoundField, etc. in your gridview to whatever you want. That should hold across paging. You will want to either not set the gridview width, or be sure you don't use a percentage if you do.</p> <p>If you want to figure this out dynamically, you will h...
<p>Tring things, in the edit colum menu of your grid you should try the auto size mode, I configure my to cell and it work pretty well for my needs..</p> <p>This is available when you are not autogenerating the columns.</p> <p>Try it.</p>
47,069
<p>I have generated linq to sql entites but cannot figure out how to assign null to a nullable column. whenever i try to assign null to it it says "there is no implicit type conversion between int and ". BTW the type of the field is int? and the database column is also nullable.</p>
<p>Try to assign it System.DBNull instead</p>
<p>It seems as though the column isn't really nullable. Check the properties of the column and see that it really is marked as nullable. If it isn't, check your database model and try to recreate the <em>LINQ to SQL</em> model if it's nullable in the database.</p> <p>Mind that you can't simply mark it as nullable in t...
27,505
<p>I'm working on a social networking system that will have comments coming from several different locations. One could be friends, one could be events, one could be groups--much like Facebook. What I'm wondering is, from a practical standpoint, what would be the simplest way to write a comments table? Should I do i...
<p>A single comments table is the more elegant design, I think. Rather than multiple FKs though, consider an intermediate table - CommentedItem. So Friend, Event, Group, etc all have FKs to CommentedItem, and you create a CommentedItem row for each new row in each of those tables. Now Comments only needs one FK, to C...
<p>This is an equivalent question to <a href="https://stackoverflow.com/questions/307748/news-feed-database-design-as-in-facebook">this one</a>.</p> <p>EDIT: Based on a comment, it isn't clear that this is an equivalent question, so I spell it out below.</p> <p>Both questions ask about projects (both happen to be Soc...
42,071
<p>For a web application I'm developing, I need to store a large number of records. Each record will consist of a primary key and a single (short-ish) string value. I expect to have about 100GB storage available and would like to be able to use it all.</p> <p>The records will be inserted, deleted and read frequently a...
<p>Whatever solution you use, since you say your database will be write-heavy you need to make sure the whole table doesn't get locked on writes. This rules out MyISAM, which some have suggested. MyISAM will lock the table on an update,delete or insert. That means any client who wants to read from the table will hav...
<p>You definitely want to use MyISAM for the storage engine. But you say you expect 100 GB and it will only contain a short-ish string value. You definitely want to use a 64-bit int for your identity/primary key.</p> <p>But my real question is. Are you using this to store session information from the web site? If ...
46,113
<p>Extended Backus–Naur Form: <strong>EBNF</strong> </p> <p>I'm very new to parsing concepts. Where can I get sufficiently easy to read and follow material for writing a grammar for the boost::spirit library, which uses a grammar similar to EBNF?</p> <p>Currently I am looking into <a href="http://en.wikipedia.org/wik...
<p>The Wikipedia article is accurate. If you have access, definitely read <a href="http://portal.acm.org/citation.cfm?id=359883" rel="noreferrer">Wirth's original article</a> on EBNF.</p> <p>The other thing to know is that EBNF was designed to make it <strong>easy to hand-write recursive-descent parsers</strong> for ...
<p>Well, I think that Wikipedia is the simplest way for two reasons:</p> <ul> <li>It states the most relevant points on the article</li> <li>It has links for further reading at the bottom of the page</li> </ul> <p>Also I would suggest reading of <a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form" rel="nof...
47,650
<p>Is there any way to get a specific error condition when a C++ stream open fails? That is, whether it failed because the file didn't exist, or permissions were wrong, or etc. Basically I'm looking for functionality equivalent to errno for fopen() in plain C.</p> <p>GCC seems to set errno properly, but that doesn't s...
<p>You can look at the ios flags (badbit, eofbit, failbit, goodbit) for general reasons. Testing will is easier using ios::bad(), ios::fail(), ios::eof(), or ios::good(). The stream can also be set to generate exceptions on error, using ios::exceptions().</p> <p>Detailed I/O Error Reporting may be available in some im...
<p>In Visual Studio fopen and the like set the last-error code value. It can be retrieved with <a href="http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx" rel="nofollow noreferrer">GetLastError()</a>. The result will be one of <a href="http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx" rel="nofol...
39,057
<p>I have a PHP script that uses the <code>system()</code> call to execute other (potentially long-running) programs (for interest: NCBI BLAST, phrap, primer3 and other programs for doing DNA sequence analysis and assembly).</p> <p>I'm running under Windows XP, using the CLI version of PHP from a command prompt, or as...
<p>I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; <a href="http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm" rel="noreferrer">archive of XML</a>, see <a href="http://en.wikipedia.org/wiki/Postcodes_in_...
<p>I needed a version that would work in SAS with the <code>PRXMATCH</code> and related functions, so I came up with this:</p> <pre><code>^[A-PR-UWYZ](([A-HK-Y]?\d\d?)|(\d[A-HJKPSTUW])|([A-HK-Y]\d[ABEHMNPRV-Y]))\s?\d[ABD-HJLNP-UW-Z]{2}$ </code></pre> <p>Test cases and notes:</p> <pre><code>/* Notes The letters QVX ...
19,940
<p>I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like:</p> <pre><code>jQuery.get(callUrl, function(data) { console.log(typeof data); jQuery.each(data.items, function(i, item) { console.log(i); }); }, 'json'); </code></pre> ...
<p>The JSON needs to have brackets around it, so it should be:</p> <pre><code>({"items":[ { "src": "gallery_item_data_Jc4EaLP6vlwd_large.jpg", "id": "83", "gallery_id": "30", "username": "admin" }] }) </code></pre> <p>You should then be able to use getJSON, as this is the easiest way to ge...
<p>Have you tried building an object of that string by calling the JavaScript eval() function? If you first call eval(data) in your callback function it should give you an object.</p>
49,094
<p>A pattern that's started to show up a lot in one of the web apps I'm working are links that used to just be a regular a-tag link now need a popup box asking "are you sure?" before the link will go. (If the user hits cancel, nothing happens.)</p> <p>We've got a solution that works, but somehow we're a web app shop ...
<p><strong>Unobtrusive Javascript</strong></p> <p>The best practice is to add event handler methods to the links.</p> <p>The <em>confirm()</em> function produces the dialog box you described, and returns true or false depending on the user's choice.</p> <p>Event handler methods on links have a special behavior, whic...
<p>A class-binding version (no need for inline onclick attributes): link this external &lt; script> after all confirmable controls:</p> <pre><code>// dangerous - warnings on potentially harmful actions // usage: add class="dangerous" to &lt;a&gt;, &lt;input&gt; or &lt;button&gt; // Optionally add custom confirmation m...
33,392
<p>So, from my experience, masterpages sometimes can lag when you do updates. This is not a new occurance, you make a change, you build, you go to test and the MasterPage is still looking for the old control. </p> <p>Anyone have any tips/tricks they use when this happens? Usually it goes away after a while, but I don'...
<p>The three main options for forcing IIS to reload everything are</p> <ul> <li>If running from Visual Studio, close out the ASP.NET Development Server, which forces it to re-open with the next run</li> <li>Change the web.config file (forces an IISReset)</li> <li>Call IISRESET directly from the command line</li> </ul>...
<p>Sounds like a caching issue. Do you restart IIS after you build? Are you building in place or publishing? Is this a web app? </p> <p>Try making a small change to the web.config file when you build and see if that helps. It will reset the server for you and basically make things new again. :)</p>
28,070
<p>I just saw a <a href="https://stackoverflow.com/questions/5516/what-happened-to-all-of-the-java-developers-how-can-i-get-started-in-net#5522">comment of suggesting J#</a>, and it made me wonder... is there a real, beneficial use of J# over Java? So, my feeling is that the only reason you would even consider using J...
<p>J# is no longer included in VS2008. Unless you already have J# code, you should probably stay away.</p> <p>From <a href="http://msdn.microsoft.com/en-us/vjsharp/default.aspx" rel="noreferrer">j# product page:</a></p> <blockquote> <p>Since customers have told us that the existing J# feature set largely meets ...
<p>Strongly agree that syntactically C# beats Java hands down, so there is really no reason to lament the demise of j#. Now trying to get c# compiling to Java bytecode might be an interesting move as Sun's hotspot jvm is great software.</p> <p>Or, for a bit of fun with what might well become the next generation of Ja...
2,743
<p>I am making a site that publishes articles in issues each month. It is straightforward, and I think using a Markdown editor (like the <a href="http://code.google.com/p/wmd/" rel="noreferrer">WMD</a> one here in Stack&nbsp;Overflow) would be perfect.</p> <p>However, <strong>they do need the ability to have images ri...
<p>You can embed HTML in Markdown, so you can do something like this:</p> <pre><code>&lt;img style="float: right;" src="whatever.jpg"&gt; Continue markdown text... </code></pre>
<p>Simplest is to wrap the image in a center tag, like so ...</p> <pre><code>&lt;center&gt;![Alt test](http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png)&lt;/center&gt; </code></pre> <p>Anything to do with Markdown can be tested here - <a href="http://daringfireball.net/projects/markdown/dingus" rel="nofollow">h...
31,838
<p>I'm currently attempting to create a tabbed interface in a web application, and based on my search, there aren't any 'built in' tab controls in ASP.NET. There are some in the <a href="http://www.asp.net/ajax/" rel="nofollow noreferrer">ASP.NET AJAX</a> downloadable toolkit, as well as a wealth of 'pay for use' thir...
<p>You can use MultiView/Views and your own navigation to get tabs in ASP.NET. </p>
<p>We use multiviews most of the time, or, in some cases, we build our own tab controls out of a combination of link buttons and overlapping panels and swap their visibilities based on what link button has been pressed (this may seem primative, but it works well). </p>
27,385
<p>I have a .NET DLL and application. The DLL is written in C++/CLI and it's "mixed", i.e., partially managed code and partially native. </p> <p>I have two goals:<br/> 1. Obfuscate all the managed code so it can't be disassembled<br/> 2. Obfuscate the public methods/classes of the mixed DLL so no one can use the DLL ...
<p>I have tried several solutions for the same problem. There isn't a great solution out there for you for this problem. <a href="https://github.com/MiloszKrajewski/LibZ" rel="nofollow noreferrer">LibZ</a> is a decent alternative to ILMerge. You can probably get cute with just packing the assemblies into the resourc...
<p>I've use {smartassembly} to merge SlimDX and DirectShow.Net together with my .net program. Both of that is wrtten using C++/CLI. They merged fine on my side. Where did you get the indication that it doesn't support mixed assemblies?</p> <p>EDIT: I'm not 100% sure, as I myself never use C++\CLI before, but I've writ...
48,377
<p>In an application that I am currently working on, a requirement is to bring a window of an external application to the foreground. Making Win32 API calls such as BringWindowToTop and SetForeground window do not work all the time. This is due to some restrictions within Windows XP. What I would like to do instead ...
<p>Check out the section "How to steal focus on 2K/XP" at <a href="http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx" rel="noreferrer">http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx</a>, as this is exactly what you need. I wouldn't go the taskbar route as the taskbar could be hidden or simply not there.</p...
<p>I used this in a program where I needed to simulate clicks and mouse movements; </p> <p><a href="http://www.codeproject.com/KB/system/globalmousekeyboardlib.aspx" rel="nofollow noreferrer">Global Mouse and Keyboard Library</a></p>
3,907
<p>How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?</p>
<p>The following lines will do the trick:</p> <pre><code>ActiveSheet.EnableCalculation = False ActiveSheet.EnableCalculation = True </code></pre> <p><strong>Edit:</strong> The <code>.Calculate()</code> method will not work for all functions. I tested it on a sheet with add-in array functions. The production she...
<p>After a data connection update, some UDF's were not executing. Using a subroutine, I was trying to recalcuate a single column with:</p> <pre><code>Sheets("mysheet").Columns("D").Calculate </code></pre> <p>But above statement had no effect. None of above solutions helped, except kambeeks suggestion to replace for...
18,664
<p>I've been developing a site over the past few weeks using CodeIgniter as the framework. I've been thinking of the best way to accomplish something, which in a lot of other frameworks in other languages is relatively simple: sortable tables. CodeIgniter switches off query strings by default, because your URLs contain...
<p>If you're OK with sorting on the client side, <a href="http://tablesorter.com/docs" rel="nofollow noreferrer">the Tablesorter plugin for jQuery</a> is pretty nice.</p>
<p>I recently added this <a href="http://tetlaw.id.au/view/blog/table-sorting-with-prototype/" rel="nofollow noreferrer">Table sorter</a> (which uses Prototype) to a bunch of my pages. It's fast and pretty easy to implement.</p>
14,046
<p>I am looking into game programming in Java to see if it is feasible. When googling for it I find several old references to Java2D, Project Darkstar (Sun's MMO-server) and some books on Java game programming. But alot of the information seems to be several years old.</p> <p>So the question I am asking, is anyone cre...
<p>there is the excellent open source 3d engine called jMonkey (<a href="http://www.jmonkeyengine.com" rel="noreferrer">http://www.jmonkeyengine.com</a>) which is being used for a few commercial projects as well as hobby developers... there is also at a lower level the lwjgl library which jmonkeyengine is built on whic...
<p>I've made a <a href="http://www.java-gaming.org/index.php/topic,23958.msg199708.html#msg199708" rel="nofollow noreferrer">list of a bunch of tutorials</a> that should be of help</p>
8,992
<p>I have to have my website stored in a subfolder of my domain root. Is there a way to rewrite the URLs so that it doesn't appear to be stored in a subfolder? It doesn't matter to me if this is done at the IIS level or in the web.config.</p>
<p>Have you looked at the routing engine that came out of the MVC project but is now a stand-alone feature of the .NET Framework?</p>
<p>You can presumably get the behavior you want by using an ISAPI filter. </p> <p>Google for: rewrite ISAPI filter and you will find some prebuilt examples to try and see what works best for you.</p>
35,256
<p>How do I read the Response Headers that are being sent down in a page ? I want to be able to read the header values and modify some of them. This is for an ASP.NET 1.1 application but I would be curious to know if it can done in any version of ASP.NET. The reason for doing this is someone may have added custom head...
<p>HttpContext.Current.Response (Its a HTTPResponse), exposed ClearHeaders(), AddHeaders() and AppendHeaders().</p> <p>Not as direct as it is now in later version of ASP.NET, but should be enough to let you modify the headers you wanted to modify.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.htt...
<p>AFAIK it cannot be done in ASP.NET 1.1. There is no way for you to get at the response headers - request headers are available but not response headers. I am not sure if you can do this in other stacks like Java, LAMP though and I am curious to find out...</p>
15,979
<p>How do I use the jQuery Datepicker with a textbox input:</p> <pre><code>$("#my_txtbox").datepicker({ // options }); </code></pre> <p>that doesn't allow the user to input random text in the textbox. I want the Datepicker to pop up when the textbox gains focus or the user clicks on it, but I want the textbox to ig...
<p>You should be able to use the <strong>readonly</strong> attribute on the text input, and jQuery will still be able to edit its contents.</p> <pre><code>&lt;input type='text' id='foo' readonly='true'&gt; </code></pre>
<p>Or you could, for example, use a hidden field to store the value...</p> <pre><code> &lt;asp:HiddenField ID="hfDay" runat="server" /&gt; </code></pre> <p>and in the $("#my_txtbox").datepicker({ options:</p> <pre><code> onSelect: function (dateText, inst) { $("#&lt;% =hfDay.ClientID %&gt;"...
18,567
<p>I wanted to create my own Python exception class, like this:</p> <pre><code>class MyException(BaseException): def __init__(self, errno, address): if errno == 10048: mess = str(address) + ' is already in use' else: mess = 'Unable to open ' + str(address) BaseExcept...
<p>You have to call the method of the base class with the instance as the first argument:</p> <pre><code>BaseException.__init__(self, mess) </code></pre> <p>To quote from the <a href="http://docs.python.org/tutorial/classes.html#inheritance" rel="noreferrer">tutorial</a>:</p> <blockquote> <p>An overriding method i...
<p>hop has it right.</p> <p>As a side note, you really should not subclass BaseException, you should be subclassing Exception instead. (Unless you really really know what you're doing)</p>
49,575
<p>I'm working on a JIRA implementation and need to make use of the API. </p> <p>Does anyone know of an existing .NET wrapper for the JIRA SOAP API? </p>
<p>In a Visual Studio .NET project, right click the project references and choose 'Add Service Reference', enter the URL of JIRA's WSDL descriptor (<a href="http://your_installation/rpc/soap/jiraservice-v1.wsdl" rel="noreferrer">http://your_installation/rpc/soap/jiraservice-v1.wsdl</a>), and Visual Studio will auto-gen...
<p>As per this page <a href="https://developer.atlassian.com/jiradev/support/archive/jira-rpc-services/creating-a-jira-soap-client/remote-api-soap-examples" rel="nofollow">https://developer.atlassian.com/jiradev/support/archive/jira-rpc-services/creating-a-jira-soap-client/remote-api-soap-examples</a>, JIRA SOAP API ha...
44,009
<p>I'm trying to iterate all the controls on a form and enable ClearType font smoothing. Something like this:</p> <pre><code>procedure TForm4.UpdateControls(AParent: TWinControl); var I: Integer; ACtrl: TControl; tagLOGFONT: TLogFont; begin for I := 0 to AParent.ControlCount-1 do begin ACtrl:= AParent.Co...
<p>You use TypInfo unit, more specifically methods IsPublishedProp and GetOrdProp.</p> <p>In your case, it would be something like:</p> <pre><code>if IsPublishedProp(ACtrl, 'Font') then ModifyFont(TFont(GetOrdProp(ACtrl, 'Font'))) </code></pre> <p>A fragment from one of my libraries that should put you on the righ...
<p>One other thing worth mentioning. Every control has a ParentFont property, which - if set - allows the Form's font choice to ripple down to every control. I tend to make sure ParentFont is set true wherever possible, which also makes it easier to theme forms according to the current OS. </p> <p>Anyway, surely you s...
19,208