instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>What tag libraries you know for Java EE - JSP, something like <a href="http://displaytag.sourceforge.net/11/" rel="nofollow noreferrer">displaytag</a> ?</p>
<p>Looking for an alternative to displaytag I came across <a href="http://code.google.com/p/jmesa/" rel="nofollow noreferrer">jmesa</a>. Haven't tried it yet, tough.</p>
<p>There is also the <a href="https://github.com/customweb/jsp-data-grid" rel="nofollow">jsp data grid</a> library. It allows easy styling of all the elements (table, td, tr etc.). It is also integrated with Hibernate and Spring. It has also a AJAX mode.</p>
43,650
<p>Microsoft has chosen to not release a 64-bit version of Jet, their database driver for Access. Does anyone know of a good alternative?</p> <p>Here are the specific features that Jet supports that I need:</p> <ul> <li>Multiple users can connect to database over a network.</li> <li>Users can use Windows Explorer to ...
<p>Luckily, things have changed in the past two years:</p> <p>Since Office 2010 is available in a 64-bit version, Microsoft had to create a 64-bit version of their Jet Engine. According to the <a href="https://learn.microsoft.com/en-us/archive/blogs/psssql/how-to-get-a-x64-version-of-jet" rel="nofollow noreferrer">Micr...
<p>What you're looking for is SQL Server Express with the portable .mdf files. To get around the copying limitation you need to make sure that the software in question doesn't keep connections open (i.e. create a disconnected data access layer).</p>
14,910
<p>I need to layout a html datatable with CSS. </p> <p>The actual content of the table can differ, but there is always one main column and 2 or more other columns. I'd like to make the main column take up as MUCH width as possible, regardless of its contents, while the other columns take up as little width as possible...
<p>I'm far from being a CSS expert but this works for me (in IE, FF, Safari and Chrome):</p> <pre><code>td.zero_width { width: 1%; } </code></pre> <p>Then in your HTML:</p> <pre><code>&lt;td class="zero_width"&gt;...&lt;/td&gt; </code></pre>
<p>I've not had success with <code>width: 100%;</code> as it seems that without a container div that has a fixed width this will not get the intended results. Instead I use something like the following and it seems to give me my best results.</p> <pre><code>.column-fill { min-width: 325px; } </code></pre> <p>This wa...
14,442
<p>I have a Canvas in a Flex application which has items inside it that cover only about 50% of the area of the main canvas.</p> <p>i want the canvas to respond to <code>rollOver</code> events for the full area, and not just the area that is covered by the items inside.</p> <p>I have been setting the following attrib...
<p>What you are doing is perfectly acceptable, although using the arbitrary alpha value of 0.01 is unnecessary, you can set it's backgroundAlpha to a simple 0.</p> <p>I routinely use Canvases for complicated multi layered UI's and set up my default Canvas style via css to have a backgroundAlpha of 0 and a backgroundCo...
<p>You could do this:</p> <pre> <code> import flash.event.MouseEvent; ... canvas.addEventListener(MouseEvent.ROLL_OVER,function(event:MouseEvent):void { ... }); </code> </pre> <p>where "canvas" is the ID of the canvas in your mxml.</p>
37,244
<p>Is there <em>anything</em> available that isn't trivially breakable?</p>
<blockquote> <p><em>This 2008 answer is now dangerously out of date.</em> SHA (all variants) is now trivially breakable, and best practice is now (as of Jan 2013) to use a key-stretching hash (like PBKDF2) or ideally a RAM intensive one (like <a href="https://security.stackexchange.com/questions/4781/do-any-security-ex...
<p>MD5 / SHA1 hashes are both good choices. MD5 is slightly weaker than SHA1.</p>
14,217
<p>this is a question that when programming I always wonder: What to use when we are writing code: </p> <pre><code>var myFiles = Directory.GetFiles(fullPath); </code></pre> <p>or</p> <pre><code>string[] myFiles = Directory.GetFiles(fullPath); </code></pre> <p><strong><em>var</em></strong> is new and is a <em>Implic...
<p>Beyond the obvious use of <code>var</code> with LINQ, I also use it to abbreviate hairy variable declarations for readability, e.g.:</p> <pre><code>var d = new Dictionary&lt;string, Dictionary&lt;string, Queue&lt;SomeClass&gt;&gt;&gt;(); </code></pre> <p>In general, I get a kind of comfort (for want of a better wo...
<p>I think it's interesting to note how this is usually handled in Haskell. Thanks to the <a href="http://en.wikipedia.org/wiki/Curry-Howard_correspondence" rel="nofollow noreferrer">Curry-Howard isomorphism</a>, the (most general) type of any expression in Haskell can be inferred, and thus type declarations are essent...
29,310
<p>I can access my calendar entries as:</p> <pre><code>$folder = $namespace-&gt;Folders("Joe Cool")-&gt;Folders("Calendar"); </code></pre> <p>How do I open "Jane Cool" Calendar? Outlook shows that calendar as:</p> <pre><code>People's Calendar Jane Cool </code></pre>
<p>I believe you are looking for the <a href="http://msdn.microsoft.com/en-us/library/aa220116(office.11).aspx" rel="nofollow noreferrer">GetSharedDefaultFolder</a>() method.</p>
<p>Have you tried looking at the whole $namespace datastructure?</p> <p>Try:</p> <p>use Data::Dumper;print Dumper $namespace;exit;</p> <p>somewhere shortly after $namespace gets created/initialised.</p> <p>Iain</p>
39,128
<p>Assuming I have an open source web server or proxy I can enhance, let's say apache or squid. </p> <p>Is there a way to determine the time each client spends on a web page?</p> <p>HTTP is of course stateless, so it's not trivial, but maybe someone has an idea on how to approach this problem?</p>
<p>Not without having some javascript constantly hit your server on the client side and then checking when it stops (but of course that assumes the user has javascript enabled). There are also various (ugly) ways to detect windows being closed with javascript, but of course these won't always trigger. eg. browser crash...
<p>This kind of metric was actually pretty popular several years ago, before PCs got more powerful and tabbed browsers became popular, and it became harder to measure as accurately. The standard way to do it in the past was to assume people are usually just loading one page at a time, and just use server log data to de...
19,591
<p>I'm thinking about how limiting it is for AJAX apps to have to poll for updates, when what would be ideal is for javascript to be able to set up a real two way connection to the server. I'm wondering if there is some method of integrating javascript with a browser plugin that can make a tcp connection so that I coul...
<p>Here is an implementation with a similar approach: </p> <ul> <li><a href="http://sly.w3m.hu/socketjs" rel="noreferrer">socketjs</a></li> </ul> <p>It uses a Java Applet and bridges its API to JavaScript, interesting...</p> <p>And here another one:</p> <ul> <li><a href="http://code.google.com/p/jsocket/" rel="nore...
<p><a href="http://code.google.com/p/jsocket/wiki/Introduction" rel="nofollow noreferrer">jSocket</a> and <a href="http://stream.stormtide.ca/" rel="nofollow noreferrer">Stream</a> are two options that utilize Flash's built-in XML sockets, though neither appears to be production-ready. I'd lean towards using a Flash-b...
39,584
<p>I have a class with a <code>ToString</code> method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. </p> <p><strong>Should I include the DTD as a string within the unit test to avoid a dependency</strong> on it, or is there a smarter way to do ...
<p>If your program validates the XML against the DTD during normal execution, then you should just get the DTD from wherever your program will get it.</p> <p>If not and the DTD is extremely short (only a few lines), then storing it as a string in your code is probably okay.</p> <p>Otherwise, I'd put it in an external...
<p>Using a DTD in the unit test to test its validity is one thing, testing for the correct content is another.</p> <p>You can use the DTD to check for the validity of the generated xml which I would simply read the way you do in your program. I personally would not include it inline (as a String); there is always a de...
7,496
<p>I can make Firefox not display the ugly dotted focus outlines on <b>links</b> with this:</p> <pre class="lang-css prettyprint-override"><code>a:focus { outline: none; } </code></pre> <p>But how can I do this for <code>&lt;button&gt;</code> tags as well? When I do this:</p> <pre class="lang-css prettyprint-o...
<pre class="lang-css prettyprint-override"><code>button::-moz-focus-inner { border: 0; } </code></pre>
<p>You can try <code>button::-moz-focus-inner {border: 0px solid transparent;}</code> in your CSS.</p>
9,651
<p>When developing WPF UserControls, what is the best way to expose a DependencyProperty of a child control as a DependencyProperty of the UserControl? The following example shows how I would currently expose the Text property of a TextBox inside a UserControl. Surely there is a better / simpler way to accomplish this...
<p>That is how we're doing it in our team, without the RelativeSource search, rather by naming the UserControl and referencing properties by the UserControl's name.</p> <pre><code>&lt;UserControl x:Class="WpfApplication3.UserControl1" x:Name="UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presen...
<p>You can set DataContext to this in UserControl's constructor, then just bind by only path.</p> <p>CS:</p> <pre><code>DataContext = this; </code></pre> <p>XAML:</p> <pre><code>&lt;TextBox Margin="8" Text="{Binding Text} /&gt; </code></pre>
10,205
<p>I'm trying to integrate a NSURLConnection object with UIProgressView, so I can update the user while a file download is happening in the background.</p> <p>I created a separate object to download the file in the background, and I'm having problems figuring out how to update the progress property in the UIProgressVi...
<p>Not sure what I'm missing here, but your <code>filesize</code> being -1 seems to be your problem. The <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLResponse_Class/Reference/Reference.html#//apple_ref/occ/instm/NSURLResponse/expectedContentLength" rel="noreferrer">API docs...
<p>In your code, filesize appears to be an NSNumber object (!). So</p> <p><code> NSLog(@"filesize: %d", self.filesize); </code></p> <p>and</p> <p><code> NSLog(@"content-length: %d bytes", self.filesize); </code></p> <p>will likely report something like the address (id) of that object (or something else). This i...
40,316
<p>I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?</p>
<p>Using <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expressions</a> is probably the best way. You can see a bunch of tests <a href="http://jsfiddle.net/ghvj4gy9/embedded/result,js/" rel="noreferrer">here</a> (taken from <a href="https://cs.chromium.org/chromium/src/third_party/bl...
<p>One of my coworker shared this regex with me. I like it a lot.</p> <pre><code>function isValidEmailAddress (email) { var validEmail = false; if (email) { email = email.trim().toLowerCase(); var pattern = /^[\w-']+(\.[\w-']+)*@([a-zA-Z0-9]+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*?\.[a-zA-Z]{2,6}|(\d{1...
6,822
<p>On Apache/PHP sites if I want to put a senstive file within my website folders, I put a .htaccess file in that folder so users can't download the sensitive file.</p> <p><strong>Is there a similar practice for IIS/ASP.NET sites</strong>, i.e. if I have a shared hosting account and don't have access to IIS server. Ca...
<p>Inside of an ASP.Net web.config you can setup locations to add security to specific files and folders. In addition, you can remove all verbs from those directories:</p> <pre><code>&lt;location path="Secret" allowOverride="false"&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;deny users="*" /&gt; ...
<p>There are some things you can do with web.config like defining security settings etc... Other times you have to use HttpModules or HttpHandlers, look here: <a href="http://msdn.microsoft.com/en-us/library/aa719858(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa719858(VS.71).aspx</a>...
40,965
<p>After staring at <a href="http://maettig.com/code/javascript/3d_dots.html" rel="noreferrer">this 3D cube</a> and <a href="http://www.uselesspickles.com/triangles/demo.html" rel="noreferrer">these triangles</a> for a while I started wondering if there's any good reliable Javascript graphics library with basic 3D supp...
<p>John Resig's port of the Processing library to Javascript:</p> <p><a href="http://ejohn.org/blog/processingjs" rel="noreferrer">http://ejohn.org/blog/processingjs</a></p>
<p>Check out Walter Zorn's library</p> <p><a href="http://www.walterzorn.de/en/jsgraphics/jsgraphics_e.htm" rel="nofollow noreferrer">www.walterzorn.de/en</a></p>
27,334
<p>Alright, so I have a query that looks like this:</p> <pre><code>SELECT `orders`.*, GROUP_CONCAT( CONCAT( `menu_items`.`name`, ' ($', FORMAT(`menu_items`.`price`,2), ')' ) SEPARATOR '&lt;br&gt;' ) as `items`, SUM(`menu_items`.`price`) ...
<p>Have you tried using something like this?</p> <pre><code>CASE WHEN 'menu_items'.'price' = 0 THEN 'menu.items'.'name' ELSE CONCAT (etc) END </code></pre> <p>Replacing the <code>CONCAT</code> statement of course.</p>
<p>Something like this should work (but I didn't test it, sorry):</p> <pre><code>GROUP_CONCAT( CONCAT( `menu_items`.`name`, IF(`menu_items`.`price` &gt; 0, -- &lt;condition&gt; CONCAT(' ($', FORMAT(`menu_items`.`price`,2), ')'), -- &lt;true-expr&gt; '' ...
28,697
<p>I've been getting some OutOfMemory errors lately in my application. Is it possible to detect ahead of time when the virtual machine is running low on memory? In other words to preemptively deal with OutOfMemory errors before they actually occur?</p>
<p>Java (as of Java 5) now has a standard JMX bean that can be used to receive low memory notification. See <code>java.lang.management.MemoryMXBean</code>.</p>
<p>I suggest that a better question is "Why is my application running out of memory?"</p> <p>You may need to increase the memory available to the JVM at startup; You may have a memory leak (objects that aren't getting released when they're no longer needed.)</p> <p>More information on the application might also be he...
29,159
<p>I'm looking for a good, preferably free, test planning and documentation tool. Ideally something that will keep track of which tests have been run against which software version, with reporting ability. There's a whole bunch of tools listed <a href="http://www.opensourcetesting.org/testmgt.php" rel="nofollow norefer...
<p>I've used QualityCenter/TestDirectory for a long time.</p> <p>I'm now using testlink and I must say that I prefer QualityCenter/TestDirectory by far, even if it based on some buggy ActiveX control.</p> <p>QualityCenter/TestDirectory is more easier to use and the interface is quite better.</p> <p>TestLink and Qual...
<p>One thought, and perhaps not a good one, would be to have every test submit a ticket to your ticketing system when it's run indicating the test name, build version, and date, and test results.</p> <p>That would make the results searchable later-on.</p>
12,551
<p>I'm setting up a dedicated SQL Server 2005 box on Windows Server 2008 this week, and would like to pare it down to be as barebones as possible while still being fully functional.</p> <p>To that end, the "Server Core" option sounds appealing, but I'm not clear about whether or not I can run SQL Server on that SKU. ...
<p>Not sure how credible <a href="http://www.builderau.com.au/program/windows/soa/Getting-started-with-Windows-Server-2008-Core-edition/0,339024644,339288700,00.htm" rel="noreferrer">this source is</a>, but:</p> <blockquote> <p>The Windows Server 2008 Core edition can:</p> <ul> <li><p>Run the file server role...
<p>Server Core won't be very useful (to me at least, and I think many others as well) until they get a version of .Net framework on it. Maybe a specialized subset like they have in the Compact Framework on smart phones.</p>
2,379
<pre><code>(function() { //codehere } )(); </code></pre> <p>What is special about this kind of syntax? What does ()(); imply?</p>
<p>The creates an anonymous function, closure and all, and the final () tells it to execute itself.</p> <p>It is basically the same as:</p> <pre><code>function name (){...} name(); </code></pre> <p>So basically there is nothing special about this code, it just a 'shortcut' to creating a method and invoking it withou...
<p>The stuff in the first set of brackets evaluates to a function. The second set of brackets then execute this function. So if you have something that want to run automagically onload, this how you'd cause it to load and execute.</p>
22,505
<p>I'm getting XML like this:</p> <p><code>&lt;Items&gt; &lt;Row attr1="val"&gt;&lt;/Row&gt; &lt;Row attr1="val2"&gt;&lt;/Row&gt; &lt;/Items&gt;</code></p> <p>This is valid XML, as you know, but another library I'm using is busted and it will only accept XML in this format: </p> <p><code>&lt;Items&gt; &lt;Row attr...
<p>Set the <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.isempty.aspx" rel="nofollow noreferrer">IsEmpty</a> property of each XmlElement you want to collapse to true.</p>
<p>If you use System.XML's DOM manipulation objects (XmlElement etc) instead of XmlWriter, you get this for free.</p> <pre><code>XmlElement items = xmlDoc.SelectNodes("items"); XmlElement row = xmlDoc.CreateElement("row"); items[0].appendChild(row); </code></pre> <p>You'll get a "&lt;row/&gt;"</p>
24,168
<p>The full error is - "Value cannot be null. Parameter name: virtualPath". This is occurring in our QA and Training environments (Win 2003 Server &amp; IIS6) but of course defies recreation in a debugger. To make matters worse, despite a reasonable global error handler, no stack trace accompanies the error and nothing...
<p>Follow up - make sure your servers are up to the proper patch level.<br> The root cause of this turned out to be 3 QA VMs that did not have<br> 2.0 .Net Framework SP1 installed.</p>
<p>this might sound silly, but heck i have had this happen to me before.</p> <p>if you copy and pasted your error, i notice it says "virtualPath" (lower case v); whil in your sample code, the property you use has VirtualPath (upper case V). </p> <p>Also, what is the actual exception you are getting? a NullReferenceEx...
46,503
<p>In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners.</p> <p>The code in question is C.</p>
<ol> <li>The meanings of <code>wParam</code> and <code>lParam</code> have changed in many places. I <strong>strongly</strong> encourage you to be paranoid and convert as much as possible to use <a href="http://support.microsoft.com/kb/83456" rel="nofollow noreferrer">message crackers</a>. They will save you no end of...
<p>I agree with Alan that trial and error is probably the best way. </p> <p>Here are some good <a href="http://web.mit.edu/dosathena/doc/www/porting-to-NT.html" rel="nofollow noreferrer">tips</a>.</p>
17,737
<p>Is it possible to 3D print a QR code? or to engrave it using a 3D printer? I tried to convert it to individual boxes but that takes too long and is very inaccurate. Is there a better way?</p>
<p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d...
<p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d...
2,044
<p>I have heard that closures could be introduced in the next Java standard that is scheduled to be released somewhere around next summer. </p> <p>What would this syntax look like?</p> <p>I read somewhere that introducing closures in java is a bigger change than generic was in java 5. Is this true? pros and cons?</p>...
<p>Have a look at <a href="http://www.javac.info/" rel="noreferrer">http://www.javac.info/</a> .</p> <p>It seems like this is how it would look:</p> <pre><code>boolean even = { int x =&gt; x % 2 == 0 }.invoke(15); </code></pre> <p>where the <code>{ int x =&gt; x % 2 == 0 }</code> bit is the closure.</p>
<p>Closures have some serious edge cases. I would say that Closures are a much more significant change than Generics and the later still has a number hairy edge cases. e.g. The Java Collections libraries cannot be written/compiled without warnings.</p>
28,913
<p>We are running our Junit 4 test suite against Weblogic 9 in front of an Oracle 10 database (using Hudson as a continuous integration server) and occasionally we will get an ORA-12519 crash during script teardown. However, the error is very intermittent: </p> <ul> <li>It usually happens for the same Test class </...
<p>Don't know if this will be everybody's answer, but after some digging, here's what we came up with.</p> <p>The error is obviously caused by the fact that the listener was not accepting connections, but why would we get that error when other tests could connect fine (we could also connect no problem through sqlplus)...
<p>I had the similar issue. It happened every time when I run a pack of database (Spring JDBC) tests with <code>SpringJUnit4ClassRunner</code>, so I resolved the issue putting <code>@DirtiesContext</code> annotation for each test in order to cleanup the application context and release all resources thus each test could...
25,133
<p>I am trying to store a large amount of boolean information that is determined at run-time. I was wondering what the best method might be.</p> <p>I have currently been trying to allocate the memory using: </p> <p><code>pStatus = malloc((&lt;number of data points&gt;/8) + 1);</code> </p> <p>thinking that this will...
<pre><code>pStatus = malloc((&lt;number of data points&gt;/8) + 1); </code></pre> <p>This does allocate enough bytes for your bits. However,</p> <pre><code>pStatus[element] </code></pre> <p>This accesses the element'th <em>byte</em>, not bit. So when element is more than one-eighth of the total number of bits, you'r...
<p>You allocation code is correct, see the <code>set_bit()</code> and <code>get_bit()</code> functions given in <a href="https://stackoverflow.com/questions/177054/is-there-a-practical-limit-to-the-size-of-bit-masks#177092">this answer</a> to access the boolean. </p>
36,102
<p>Certainly there's the difference in general syntax, but what other critical distinctions exist? There are <em>some</em> differences, right?</p>
<p>The linked comparisons are very thorough, but as far as the main differences I would note the following:</p> <ul> <li><strike>C# has anonymous methods</strike>VB has these now, too</li> <li><strike>C# has the yield keyword (iterator blocks)</strike>VB11 added this</li> <li>VB supports <a href="http://smartypeeps.bl...
<p>When it gets to IL its all just bits. That case insensitivity is just a precompiler pass. But the general consensus is, vb is more verbose. If you can write c# why not save your eyes and hands and write the smaller amount of code to do the same thing.</p>
3,272
<p>I do not have a clear understanding of what causes resin prints to become brittle. Firstly, it appears excessive cold (in the 40s or even 30s, I am in New England) may be a factor. What else can cause brittleness in resin prints? Is there a difference between resin types?</p>
<p>With the information provided my thought is that your layers are underexposed for their thickness. Each layer is just barely bonding to the layer above it. After being pulled on by layers below eventually one of the layers fails. This is especially likely to happen on a thin part of the print any may need more suppo...
<p><a href="https://3dprinting.stackexchange.com/a/14947/8884">Besides the options of underexposure or bad FEP film</a>, there's also the option of the print being in a bad orientation for printing. Often, the quality gets better if you tilt the model some degrees. You do have to clean up some places, but the stresses ...
1,781
<p>In RoR,how to validate a Chinese or a Japanese word for a posting form with utf8 code.</p> <p>In GBK code, it uses [\u4e00-\u9fa5]+ to validate Chinese words. In Php, it uses /^[\x{4e00}-\x{9fa5}]+$/u for utf-8 pages.</p>
<p>Ruby 1.8 has poor support for UTF-8 strings. You need to write the bytes individually in the regular expression, rather then the full code:</p> <pre><code>&gt;&gt; "acentuação".scan(/\xC3\xA7/) =&gt; ["ç"] </code></pre> <p>To match the range you specified the expression will become a bit complicated:</p> <pre...
<p>activeSupport has a UTF-8 handler</p> <p><a href="http://api.rubyonrails.org/classes/ActiveSupport/Multibyte/Handlers/UTF8Handler.html" rel="nofollow noreferrer">http://api.rubyonrails.org/classes/ActiveSupport/Multibyte/Handlers/UTF8Handler.html</a></p> <hr> <p>otherwise, look in ruby 1.9, encoding method for Re...
32,044
<p>This is a multi-site problem. I have a lot of sites with .htaccess files with multiple line similar to:</p> <pre><code>rewriterule ^(page-one|page-two|page-three)/?$ /index.php?page=$1 [L] </code></pre> <p>This means that both www.domain.com/page-one and www.domain.com/page-one/ will both load www.domain.com/inde...
<p>Here's a snippet to force everything to end with a slash</p> <pre><code>rewritecond %{REQUEST_FILENAME} !-f rewritecond %{REQUEST_URI} !(.*)/$ rewriterule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301] </code></pre>
<p><em>Untested</em>, but can't you just do this?</p> <pre><code>RewriteRule ^(.*[^/])$ $1/ RewriteRule ^(page-one|page-two|page-three)?$ /index.php?page=$1 [L] </code></pre>
42,008
<p>I'm building a data warehouse that includes delivery information for restaurants. The data is stored in SQL Server 2005 and is then put into a SQL Server Analysis Services 2005 cube.</p> <p>The Deliveries information consists of the following tables:</p> <p><strong>FactDeliveres</strong></p> <ul> <li>BranchKey</l...
<p>I would have Quantity, UnitCode, InvoiceNumber, DeliveryID all in the fact table. Both InvoiceNumber and DeliveryID are degenerate dimensions, because they will change with every fact (or very few facts). It is possible that you could put them in their own dimension if you have a large number of items on each orde...
<p>Fact table PK's are almost always surrogate keys. Each fact is part of several dimensions, so the fact has FK's to the dimensions, but no real keys of it's own.</p> <p>A Delivery Fact (a Line Item) belongs to a Branch, it has a Product, it is part of a larger Delivery, it occurs on a particular Date. Sounds like ...
18,061
<p>In SQL Server how do you query a database to bring back all the tables that have a field of a specific name?</p>
<p>The following query will bring back a unique list of tables where <code>Column_Name</code> is equal to the column you are looking for:</p> <pre><code>SELECT Table_Name FROM INFORMATION_SCHEMA.COLUMNS WHERE Column_Name = 'Desired_Column_Name' GROUP BY Table_Name </code></pre>
<pre><code>SELECT Table_Name FROM Information_Schema.Columns WHERE Column_Name = 'YourFieldName' </code></pre>
2,565
<p>Is it possible to provide WCF with a custom proxy address and custom credentials? </p> <p>I've found this answer on stackoverflow: <a href="https://stackoverflow.com/questions/105499/how-to-set-proxy-with-credentials-to-generated-wcf-client">How to set proxy with credentials to generated WCF client?</a>, but I've g...
<p>If you set the <a href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.defaultwebproxy.aspx" rel="noreferrer">WebRequest.DefaultWebProxy</a> property to a new WebProxy with credentials, WCF will use it for all HTTP requests that it makes. (This will affect all HttpWebRequests used by the application u...
<p>The client credentials you're setting are fine in order to authenticate to your services.<br> For proxy authentication you need to use HttpTransportSecurity.ProxyCredentials.</p> <p>This link might help you out.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.httptransportsecurity.proxy...
22,639
<p>Is there an equivalant to Environment.NewLine in DotNet for a Tab character?</p>
<p>NewLine is on the Environment class because the new line specification varies between platforms:</p> <p>It's "\r\n" for non-Unix platforms and "\n" for Unix platforms. However tab is always "\t".</p>
<p>Short answer is: no, tab does not change between platforms as newline might, so there is no need for one.</p> <p>Long answer is: technically, yes, you could use the one provided by VB in the Microsoft.VisualBasic.dll. I think it's Microsoft.VisualBasic.Constants.vbTab, but there's no good reason to use it in C# as ...
37,662
<p>Any python libs for parsing Bind zone files? Basically something that will aid in adding/removing zones and records. This needs to work even if someone modifies the zone file by hand so overwriting the zone files every time is not a solution. </p>
<p>I was unable to use bicop for classical zone files like these:</p> <pre><code> $TTL 86400 @ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. ( 2006040800 ; serial 14400 ; refresh 1800 ; retry 604800 ; expire 86400 ) ; minimum @ IN NS ...
<p>See answer above about bicop.</p> <p>As an aside, the Python Package Index at <a href="http://pypi.python.org/pypi" rel="nofollow noreferrer">http://pypi.python.org/pypi</a> is a great place to look for Python packages.</p> <p><strong>EDIT</strong>: The below may still be helpful to someone trying to figure out si...
29,308
<p><strong>The situation</strong><br> I have a Git repo and an SVN repo that both hold the same source code but different commit histories. The Git repo has a lot of small well commented submits... while the SVN repo has a few huge commits with comments like "Lots of stuff". Both series of commits follow the same chang...
<p>That could be tough to do what you want. You can import a git repo into svn via something like this: <a href="http://code.google.com/p/support/wiki/ImportingFromGit" rel="nofollow noreferrer">http://code.google.com/p/support/wiki/ImportingFromGit</a>, but I think you will have conflicts. You could just recreate yo...
<p>From the git svn repository that you are trying to migrate to, do something like the following:</p> <pre><code>git remote add old-repo &lt;path-to-old-repo&gt; git fetch old-repo # to browse and figure out the hashes, if that helps gitk --all &amp; # for each branch you want to graft git rebase --onto &lt;new git ...
14,296
<p>Why EAccessViolation is raised when executing the code below? </p> <pre><code>uses Generics.Collections; ... var list: TList&lt;TNotifyEvent&gt;; ... begin list := TList&lt;TNotifyEvent&gt;.Create(); try list.Add(myNotifyEvent); list.Remove(myNotifyEvent); // EAccessViolation at address... ...
<p>It looks like a bug.</p> <p>If you compile with debug dcu's (normally don't do that unless you want to loose your sanity!) you see that a call to the comparer went wrong. A (possibly optional) third value of a compare function is not set and causes the access violation.</p> <p>So possibly you can't put method poin...
<p>the above code is used in TForm1 ...</p> <pre><code>uses Generics.Collections; procedure TForm1.Button1Click(Sender: TObject); var list: TList&lt;TNotifyEvent&gt;; begin list := TList&lt;TNotifyEvent&gt;.Create(); try list.Add(myNotifyEvent); list.Remove(myNotifyEvent); // EAccessViolation at add...
36,926
<p>I'm using the following code within the JCProperty class to retrieve data from a DAL: </p> <pre><code>Dim x As JCProperty x = JCPropertyDB.GetProperty(PropertyID) If Not x Is Nothing Then Me.PropertyID = x.PropertyID Me.AddressLine1 = x.AddressLine1 Me.AddressLi...
<p>Not sure if this will answer your question, but the important point is that the domain model is independent of display and independent of storage. This is often denoted as separation of concerns. The idea is to get loose couplings and create a simple system where objects do not have several completely different resp...
<p>Check out: <a href="http://www.icemanind.com/layergen.aspx" rel="nofollow noreferrer">http://www.icemanind.com/layergen.aspx</a></p>
23,597
<p>Is there any way to generate Excel/CSV through Javascript? (It should be browser compaatible too)</p>
<p>There is an interesting project on github called <strong>Excel Builder (.js)</strong> that offers a client-side way of downloading Excel <strong>xlsx</strong> files and includes options for formatting the Excel spreadsheet.<br> <a href="https://github.com/stephenliberty/excel-builder.js" rel="noreferrer">https://git...
<p>To answer your question with a working example: </p> <pre><code>&lt;script type="text/javascript"&gt; function DownloadJSON2CSV(objArray) { var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; var str = ''; for (var i = 0; i &lt; array.length; i++) { var line = new Array(...
43,235
<p>I have a MasterPage, with my Usercontrol inside a div.</p> <p>I can set visible=false to the UserControl and to the containing div, and this works fine. But the Page_Load of the UserControl is always hit.</p> <p>Is this by design, or am I missing how to stop page execution going into the Page_Load method of the Us...
<p>svnadmin dump is the recommended way to <a href="http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.5" rel="noreferrer">migrating your repositories</a>, but you'll need shell access to do it, otherwise you will have to contact your hosting provider and ask them to do the full repository dump for you. </...
<p>Sounds like you need a <a href="http://rsvndump.sourceforge.net/" rel="nofollow noreferrer">remote SVN dump command</a>. I haven't used it but it claims to do what you want.</p>
46,261
<p>I really should upgrade to Firefox 3, but I'm very dependent on Firebug working properly.</p> <p>I know there is a version of Firebug that is supposed to work with Firefox 3, but last time I looked, there seemed to be problems with it.</p> <p>So, for those that have made the jump, is Firebug on Firefox 3 ready for...
<p>Yes, I've been using Firebug heavily and it's been rock-steady. What problems were you having in particular? We could test and report the results.</p>
<p>FYI, there's a bug in firebug 1.3.3 on firefox 3.0.9 that causes it not to send an If-modified-since header so it always gets a copy from the server instead of using the cached local copy.</p> <p><a href="http://code.google.com/p/fbug/issues/detail?id=1274&amp;q=etag&amp;colspec=ID%20Type%20Status%20Owner%20Test%20...
16,681
<p>We're building tools to mine information from the web. We have several pieces, such as </p> <ul> <li>Crawl data from the web</li> <li>Extract information based on templates &amp; business rules</li> <li>Parse results into database</li> <li>Apply normalization &amp; filtering rules</li> <li>Etc, etc.</li> </ul> <p>...
<p>The code says what happens at each stage. Using a DSL would be a boon, but possibly not if it comes at the cost of writing your own scripting-language and/or compiler.</p> <p>Higher level documentation should not include details of what happens at each step; it should provide an overview of the steps and how they...
<p>Top down design helps a lot. One mistake I see is making the top down design sacred. Your top level design needs to be reviewed and update just like any other section of code. </p>
39,068
<p>I have to make a newsletter sending utility application which will collect the list of subscriber from our central database and send out the newsletter. I've considered the possibility to be blacklisted due to flooding if I just flush out all emails at once, so I decided to go on a desktop-based softwer which will e...
<p>I make Thread.Sleep(2000) after every 2 mail</p>
<p>It's really going to vary by configuration, so there's not necessarily a one-size-fits-all answer. You might want to check with your ISP - it's probably them or their upstream that you'd need to worry about.</p> <p>Since you're sending a newsletter, could you add multiple recipients via BCC rather than individual ...
29,131
<p>Do any queries exist that require RIGHT JOIN, or can they always be re-written with LEFT JOIN?</p> <p>And more specifically, how do you re-write this one without the right join (and I guess implicitly without any subqueries or other fanciness):</p> <p><pre><code> SELECT * FROM t1 LEFT JOIN t2 ON t1.k2 = t2.k2 RIGH...
<p>You can always re-write them to get the same result set. However, sometimes the execution plan may be different in significant ways (performance) and sometimes a right join let's you express the query in a way that makes more sense.</p> <p>Let me illustrate the performance difference. Programmers tend to think in...
<p>I use <code>LEFT JOIN</code>s about 99.999% of the time, but some of my dynamic code generation uses <code>RIGHT JOIN</code>s which mean that the stuff outside the join doesn't need to be reversed.</p> <p>I'd also like to add that the specific example you give I believe produces a cross join, and that is probably n...
30,845
<p>I am using <a href="http://www.hibernate.org/" rel="noreferrer">Hibernate</a> in a Java application to access my Database and it works pretty well with MS-SQL and MySQL. But some of the data I have to show on some forms has to come from Text files, and by Text files I mean Human-Readable files, they can be CSV, Tab-...
<p>Hibernate is written against the JDBC API. So, you need a JDBC driver that works with the file format you are interested in. Obviously, even for read-only access, this isn't going to perform well, but it might still be useful if that's not a high priority. On a Windows system, you can set up ODBC datasources for del...
<p>Like erickson said, your only hope is in finding a JDBC driver for that task. There is maybe <del><a href="https://xlsql.dev.java.net/" rel="nofollow noreferrer">xlsql</a></del> (CSV, XML and Excel driver) which could fit the task. After that, you just have to either find or write the most simple Hibernate Dialect w...
5,347
<p>What library should be included to use TransparentBlt?</p> <p>This is VC98 (Visual Studio 6) linking to the Gdi32.lib. (Other GDI functions such as BitBlt link as expected), and the compilers compiles with out error or warning.</p> <p>Even though the Gdi32.lib is included, yet the linker returns this error:</p> <...
<p>AFAIK, you will need the Msimg32.lib</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms532303(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms532303(VS.85).aspx</a></p>
<p>Msimg32.lib</p> <p>FYI you can search the functions on <a href="http://msdn.microsoft.com/library" rel="nofollow noreferrer">http://msdn.microsoft.com/library</a> and at the bottom it will tell you what library you need.</p>
20,869
<p>I'd like to allow users to record videos directly from their webcam. I haven't done much work with PHP but am stuck with it for this project. We currently have a system in place for video uploading and encoding, but nothing to actually access a user's webcam. How would you recommend I proceed?</p>
<p>Webcams aren't available to HTML or JavaScript/DOM in any browsers that I know of, so you're going to end up dependent on some sort of plugin. I'd recommend you start your search with Adobe Flash/Flex, though It's possible that Microsoft Silverlight is able to do the same thing. Flex is a bit more reliable technol...
<p>The browser itself cannot access a user's webcam. There are proposals for a new type of input field to support this, but is is not currently available. You'd have to do it through a plug-in.</p>
27,017
<p>I just set up a refurbished <a href="https://www.monoprice.com/product?p_id=29417" rel="nofollow noreferrer">MP Select Mini V2</a> and tried to print the test file included by the manufacturer, <code>cat.gcode</code>, from the included SD card. I printed in PLA (I think; the unlabeled sample included with the printe...
<p>Your trouble lies within the presliced G-code: the temperatures are rather low for PLA and upping both by 10 degrees would be advisable:</p> <ul> <li>200 °C for the Hotend</li> <li>60 °C for the Bed</li> </ul> <p>Atop that, printing a raft for PLA is usually not advisable.</p> <p>Get yourself a slicer (the most c...
<p>It looks to me as the model did not have enough surface contact with the raft.</p> <hr> <p>This can be caused by to big of a gap between raft and model set in the slicer or because of Underextrusion. The part itself does not look underextruded, at least not a lot, so I would say that the slicer settings were not ...
1,385
<p>I must admit that I am incredibly jealous of those developers who happen to live near active user groups (e.g. the ALT.NET guys in Austin). I often read blog posts and listen to podcasts that reference these in-person meetings and find myself wishing that I could sit in and participate as well. But it just isn't r...
<p>There's a <a href="http://www.sldnug.net/" rel="nofollow noreferrer">.NET usergroup</a> in SecondLife. Of course this depends how you feel about second life.</p>
<p>There's a <a href="http://www.sldnug.net/" rel="nofollow noreferrer">.NET usergroup</a> in SecondLife. Of course this depends how you feel about second life.</p>
14,249
<p>I currently have a button called Edit and a text box call blah on a ajax updatepanel. is it possible to set the asp.net's textbox Readonly via trigger? </p>
<p>Yes it is possible.</p> <p>Assuming the trigger is the edit button's onclick handler, put the code there...</p>
<p>As long as the button triggers the update panel all you should have to do is set the read only property to true in the button's click event handler.</p>
46,638
<p>I'm trying to debug the MSBuild Customtask, that I have just created, but for some reason it never stops at the breakpoint. I've even tried this:</p> <pre><code> public override bool Execute() { System.Diagnostics.Debugger.Break(); </code></pre> <p>And added a break point on that line... I even eli...
<p>It's a bit of a hack, but you could always just put this line of code wherever it is that you want to start debugging:</p> <pre><code>System.Diagnostics.Debugger.Launch(); </code></pre> <p>When you invoke it, the CLR will launch a dialog asking you what debugger you want to attach.</p>
<p>You can set the environment variable <code>MSBUILDDEBUGONSTART=1</code> to make <code>MSBuild.exe</code> prompt to launch a debugger at its application startup.</p> <p>You can then select the Visual Studio instance you're using to develop your task as the debugger, and set a breakpoint in your task's code.</p> <p>Th...
46,607
<p>I want to use the mouse scrollwheel in my OpenGL GLUT program to zoom in and out of a scene? How do I do that?</p>
<p>Note that venerable <a href="http://www.xmission.com/~nate/glut.html" rel="noreferrer">Nate Robin's GLUT</a> library doesn't support the scrollwheel. But, later implementations of GLUT like <a href="http://freeglut.sourceforge.net/" rel="noreferrer">FreeGLUT</a> do.</p> <p>Using the scroll wheel in FreeGLUT is dead...
<p>observe case 3 and 4 in the switch statement below in the mouseClick callback</p> <pre><code>glutMouseFunc(mouseClick); </code></pre> <p>... </p> <pre><code>void mouseClick(int btn, int state, int x, int y) { if (state == GLUT_DOWN) { switch(btn) { case GLUT_LEFT_BUTTON: std::cout &lt;&lt; "lef...
3,515
<p>I have a class Agent with a property Id</p> <p>Given a collection of Agents I need to check if any of them have duplicate Ids.</p> <p>I am currently doing this with a hash table but am trying to get Linq-ified, what's a good way of doing this?</p>
<p>Similar to Y Low's approach,</p> <p><strong>Edited:</strong></p> <pre><code> var duplicates = agents.GroupBy(a =&gt; a.ID).Where(a=&gt;a.Count() &gt; 1); foreach (var agent in duplicates) { Console.WriteLine(agent.Key.ToString()); } </code></pre>
<p>this is how i would do it without the need to do group-by in one line:</p> <pre><code> List&lt;Agent&gt; duplicates = new HashSet&lt;Agent&gt;(agents.Where(c =&gt; agents.Count(x =&gt; x.ID == c.ID) &gt; 1)).ToList(); </code></pre>
40,212
<p>For certain programs nothing beats the command line. Unfortunately, I have never seen good documentation or examples on how to write console applications that go beyond "Hello World". I'm interested in making console apps like <a href="http://en.wikipedia.org/wiki/Vim_(text_editor)" rel="nofollow noreferrer">Vim</a...
<p><a href="http://pdcurses.sourceforge.net/" rel="nofollow noreferrer">PDCurses</a> works on Win32.</p>
<p>This is the best tool for it I've ever seen!!<br> 1) Create any application using <strong><em>VB6 IDE</em></strong><br> 2) Convert it to <strong><em>Console Application</em></strong>, using <a href="http://nirsoft.net/vb/console_application_visual_basic.html" rel="nofollow"><strong>THIS!</strong></a></p>
6,487
<p>I'm aware of the built in code generation and refactoring one can do with the "Source" and "Refactor" menu items in Eclipse. </p> <p>I also use the Commonclipse plugin to easily make use of the Apache Commons classes that build hashCode, toString, equals methods.</p> <p>What other plugins or tools should I be awar...
<p><strong>Telosys</strong> ( <a href="https://www.telosys.org/" rel="nofollow noreferrer">https://www.telosys.org/</a> ) is a simple and efficient tool for Java code generation.</p> <p>This code generator is available as an <strong>Eclipse Plugin</strong> (<a href="https://marketplace.eclipse.org/content/telosys-tools...
<p>I don't know if you're a big UML fan but <a href="http://www.ibm.com/developerworks/rational/library/05/ahmed/" rel="nofollow noreferrer">IBM Rational suite</a> is extremly powerful.</p> <p>I used it to move from UML to generated mock objects but that's only a slight part of what it can do</p>
47,019
<p>How can I write a function that takes an array of integers and returns true if their exists a pair of numbers whose product is odd?</p> <p>What are the properties of odd integers? And of course, how do you write this function in Java? Also, maybe a short explanation of how you went about formulating an algorithm fo...
<p>An odd number is not evenly divisible by two. All you need to know is are there two odd numbers in the set. Just check to see if each number mod 2 is non-zero. If so it is odd. If you find two odd numbers then you can multiply those and get another odd number.</p> <p>Note: an odd number multiplied by an even nu...
<p>You can test for evenness (or oddness) by using the modulus.</p> <p>i % 2 = 0 if i is even; test for that and you can find out if a number is even/odd</p>
34,931
<p>I have a Ruby on Rails Website that makes HTTP calls to an external Web Service.</p> <p>About once a day I get a SystemExit (stacktrace below) error email where a call to the service has failed. If I then try the exact same query on my site moments later it works fine. It's been happening since the site went live ...
<p>Using fcgi with Ruby is known to be very buggy. </p> <p>Practically everybody has moved to <a href="http://mongrel.rubyforge.org/" rel="noreferrer">Mongrel</a> for this reason, and I recommend you do the same.</p>
<p>I would also take a look at <a href="http://modrails.com/" rel="nofollow noreferrer">Passenger</a>. It's a lot easier to get going than the traditional solution of Apache/nginx + Mongrel.</p>
2,294
<p>I'm using the new ASP.Net ListView control to list database items that will be grouped together in sections based on one of their columns like so:</p> <pre><code>region1 store1 store2 store3 region2 store4 region3 store5 store6 </code></pre> <p>Is this possible to do with the ListView's Gro...
<p>I haven't used GroupItemCount, but I have taken this example written up by <a href="http://mattberseth.com/" rel="nofollow noreferrer">Matt Berseth</a> titled <a href="http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html" rel="nofollow noreferrer">Building a Grouping Grid with the ASP.NET 3.5 LinqD...
<p>I tried using GroupItemCount programmatically but it didn't give me the expected results. </p> <p>I followed Otto's suggestion and implemented an outer and inner ListView control. This seems to be the best available solution.</p>
3,375
<p>I have a problem with a little .Net web application which uses the Amazon webservice. With the integrated Visual Studio web server everything works fine. But after deploying it to the IIS on the same computer i get the following error message:</p> <pre><code>Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenst...
<p>Proxy use can be configured in the web.config. The system.net/defaultProxy element will let you specify whether a proxy is used by default or provide a bypass list.</p> <p>For more info see: <a href="http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx" rel="noreferrer"><a href="http://msdn.microsoft.com/en-us/lib...
<p>IIS is a destination. The configuration issue is in whatever is doing the call (acting like a client). If you are using the built-in .Net communication methods you will need to make the adjustment inside of ... Wait for it ... Internet Explorer. </p> <p>Yep! That little bugger has bitten me more times than I ca...
8,642
<p>The following question answers how to get large memory pages on Windows :<br> "<a href="https://stackoverflow.com/questions/39059/how-do-i-run-my-app-with-large-pages-in-windows">how do i run my app with large pages in windows</a>".</p> <p>The problem I'm trying to solve is how do I configure it on Vista and 2008 S...
<p>Assuming cmd is your SqlCeCommand....</p> <pre><code>using(var dr = cmd.ExecuteReader()) { DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add(); dt.Load(dr); ds.WriteXML(...); } </code></pre>
<p>I would think you could retrieve the data to a DataSet, call WriteXML on it, and then on the other end declare a new DataSet and call ReadXML on it.</p>
10,121
<p>In certain areas in my application I need data from several tables in the database (I have an application, the application has many attributes, each attribute has several definitions, and each definition has a value). I need the data from all these tables for an application. Should I use a view (one that would be r...
<p>Views are typically expanded in place into subqueries, unless you explicitly mark the views as persisted by dropping a clustered index on them.</p>
<p>This is an 'It depends' question. A view might help to make the code more maintainable but complex selection predicates might confuse the optimiser.</p> <p>Another option is a stored procedure that returns a record set. If you reuse a subquery several times you may get some mileage from splitting up the query, se...
21,977
<p>This fails:</p> <pre><code>my @a = ("a", "b", "c", "d", "e"); my %h = map { "prefix-$_" =&gt; 1 } @a; </code></pre> <p>with this error:</p> <pre><code>Not enough arguments for map at foo.pl line 4, near "} @a" </code></pre> <p>but this works:</p> <pre><code>my @a = ("a", "b", "c", "d", "e"); my %h = map { "pref...
<p>Because Perl is guessing an EXPR (a hash reference, for example) instead of a BLOCK. This should work (note the '+' symbol):</p> <pre><code>my @a = ("a", "b", "c", "d", "e"); my %h = map { +"prefix-$_" =&gt; 1 } @a; </code></pre> <p>See <a href="http://perldoc.perl.org/functions/map.html" rel="noreferrer">http://p...
<p>I think that </p> <pre><code>map { ; "prefix-$_" =&gt; 1 } @a; </code></pre> <p>is more idiomatic, as far as specifying that it is a block of statements and not a hash ref. You're just kicking it off with a null statement. </p>
34,055
<p>I have a database of strings (arbitrary length) which holds more than one million items (potentially more).</p> <p>I need to compare a user-provided string against the whole database and retrieve an identical string if it exists or otherwise return the closest fuzzy match(es) (60% similarity or better). The search ...
<p><a href="http://en.scientificcommons.org/514330" rel="noreferrer">This paper seems to describe exactly what you want.</a></p> <p>Lucene (<a href="http://lucene.apache.org/" rel="noreferrer">http://lucene.apache.org/</a>) also implements Levenshtein edit distance.</p>
<p>Since the amount of data is large, when inserting a record I would compute and store the value of the phonetic algorithm in an indexed column and then constrain (WHERE clause) my select queries within a range on that column. </p>
39,868
<p>I'm having a hard time determining what characters <strong>must</strong> be escaped when using Perl's qr{} construct</p> <p>I'm attempting to create a multi-line precompiled regex for text that contains a myriad of normally escaped characters (#*.>:[]) and also contains another precompiled regex. Additionally I nee...
<p>You have to escape the delimiter for qr//, and you have to escape any regex metacharacters that you want to use as literals. If you want those to be literal *'s, you need to escape them since the * is a regex quantifier.</p> <p>Your problem here is the various regex flags that you've added. The /m doesn't do anythi...
<p>Like brian said, you must escape the delimiter and regex metacharacters. Note that when using <code>qr//x</code> (which you are), you must also escape whitespace characters and # (which is a comment marker). You probably don't actually want to use <code>/x</code> here. If you want to be safe, you <strong>can</str...
37,133
<p>I want to write a query like this:</p> <pre><code>SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order o </code></pre> <p>But this isn't how the <code>MAX</code> function works, right? It is an aggregate function so it expects a single parameter and then returns the MAX of all rows. </p> <p>Do...
<p>You'd need to make a <code>User-Defined Function</code> if you wanted to have syntax similar to your example, but could you do what you want to do, inline, fairly easily with a <code>CASE</code> statement, as the others have said.</p> <p>The <code>UDF</code> could be something like this:</p> <pre><code>create func...
<p>In Presto you could use use</p> <pre><code>SELECT array_max(ARRAY[o.NegotiatedPrice, o.SuggestedPrice]) </code></pre>
15,144
<p>I have an enumeration value marked with the following attribute. The second parameter instructs the compiler to error whenever the value is used. I want this behavior for anyone that implements my library, but I need to use this enumeration value within my library. How do I tell the compiler to ignore the Obsolet...
<p>Private a separate constant somewhere like this:</p> <pre><code>private const Choices BackwardsCompatibleThree = (Choices) 3; </code></pre> <p>Note that anyone else will be able to do the same thing.</p>
<p>TheSoftwareJedi correctly notes that this won't work with obsolete attribute set to be an error. The following "answer" only works when the obsolete notification is raised as a warning.</p> <hr> <p>From Visual Studio you can do this on a per-project basis:</p> <ol> <li>Go to the Project Properties page for the p...
44,826
<p>I would like to display the up time of the machine my code is running, how can I do that?</p>
<p>Try this link. It uses the <strong>System.Environment.TickCount</strong> property</p> <blockquote> <p>Gets the number of milliseconds elapsed since the system started. - MSDN</p> </blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/system.environment.tickcount(VS.80).aspx" rel="noreferrer">http://msdn.m...
<p>I suggest you to use the command line : <strong>net statistics workstation</strong> and parse the output. The time that machine is running is after "Statistics since ".</p>
33,214
<p>I am interested in using some kind of a command-line utility for SQL Server similar to Oracle's SQL*Plus. SQL Server seems to have several options: osql, isql, and sqlcmd. However, I am not quite certain which one to use.</p> <p>Do they all essentially do the same thing? Are there any situations where it is prefera...
<p>Use sqlcmd-- it's the most fully featured product.</p> <ul> <li><strong>sqlcmd</strong>: The newest, fanciest command-line interface to SQL Server.</li> <li><strong>isql</strong> : The older, DB-Library (native SQL Server protocol) way of command-line communication with SQL Server.</li> <li><strong>osql</strong> : ...
<p>There is a free tool "SQLS<em>Plus" (on <a href="http://www.memfix.com" rel="nofollow noreferrer">http://www.memfix.com</a> ) which is exactly like Oracle SQL</em>Plus for SQL Server. Works with all SQL Server versions. </p> <p>Very flexible with data formatting (set lines size, pagesize, etc), variables (var, &amp...
43,913
<p>I'm starting to build a community website from the site up and my web framework will be Asp.net and Mysql.</p> <p>I want to start planning some scalability into the infrastructure early because I'm anticipating high traffic when the site goes live.</p> <p><strong>Are there any case studies which you recommend read...
<p>I think it could be a challenge to find reference materials for that particular combination. Many .NET shops stick to SQL Server, and fewer use MySQL (at least at scale).</p> <p>In general it would be appropriate to:</p> <ul> <li>Follow general <a href="http://msdn.microsoft.com/en-us/library/ms998530.aspx" rel="n...
<p>For mysql scaling, you may find this interesting: <a href="http://www.scribd.com/doc/269855/danga-com-livejournal-backend" rel="nofollow noreferrer">danga livejournal</a> </p>
45,552
<p>I have a <a href="http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux" rel="noreferrer">RHEL</a> box that I need to put under a moderate and variable amount of CPU load (50%-75%).</p> <p>What is the best way to go about this? Is there a program that can do this that I am not aware of? I am happy to write some C c...
<p>This is exactly what you need (internet archive link): <a href="https://web.archive.org/web/20120512025754/http://weather.ou.edu/%7Eapw/projects/stress/stress-1.0.4.tar.gz" rel="nofollow noreferrer">https://web.archive.org/web/20120512025754/http://weather.ou.edu/~apw/projects/stress/stress-1.0.4.tar.gz</a></p> <p>F...
<p>Not sure what your goal is here. I believe glxgears will use 100% CPU. </p> <p>So find any process that you know will max out the CPU to 100%.</p> <p>If you have four CPU cores(0 1 2 3), you could use "taskset" to bind this process to say CPUs 0 and 1. That should load your box 50%. To load it 75% bind the process...
17,129
<p>Note: The "TL smoothers" referred to in the question title are an arrangement of 8 diodes that presumably both provide a voltage drop to address the minimum current output issue of some stepper drivers described in <a href="https://hackaday.com/2016/08/29/how-accurate-is-microstepping-really/" rel="nofollow noreferr...
<p>Is your BL Touch a v3 (likely if you've only just purchased it)? If so, make sure you're using the bugfix version of Marlin 1.1.9, which supposedly fixes the compatibility issues. I say supposedly because there's also a capacitor on the mainboard that can be removed to fix the issue, and once I removed it (and comme...
<p>I've been through the <a href="/q/6959">same sort of issues</a> and eventually found that it was attributed by the cable and connector. Re-check or re-wire the sensor, this helped me out.</p>
1,372
<p>Let's say you have a class with a Uri property. Is there any way to get that property to accept both a string value and a Uri? How would you build it?</p> <p>I'd like to be able to do something like one of the following, but neither are supported (using VB, since it lets you specify type in the Set declaration fo...
<p>Alternatively, you can of course forego overloading and just name the properties appropriately:</p> <pre><code>Public WriteOnly Property UriString() As String Set(ByVal value As String) m_Uri = new Uri(value) End Set End Property </code></pre> <p>Of course you don't have to make this <code>WriteOnl...
<blockquote> <p>Let's say you have a class with a Uri property. Is there any way to get that property to accept both a string value and a Uri?</p> </blockquote> <p>No because this would mean having two getters that vary only in their return type and this isn't allowed in .NET.</p> <p>I would use the <code>Uri</code...
19,695
<p>We're having sporadic, random query timeouts on our SQL Server 2005 cluster. I own a few apps that use it, so I'm helping out in the investigation. When watching the % CPU time in regular ol' Perfmon, you can certainly see it pegging out. However, SQL activity monitor only gives cumulative CPU and IO time used by a ...
<p>This will give you the top 50 statements by average CPU time, check here for other scripts: <a href="http://www.microsoft.com/technet/scriptcenter/scripts/sql/sql2005/default.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/scriptcenter/scripts/sql/sql2005/default.mspx?mfr=true</a></p> <pre...
<p>Profiler may seem like a "needle in a haystack" approach, but it may turn up something useful. Try running it for a couple of minutes while the databases are under typical load, and see if any queries stand out as taking way too much time or hogging resources in some way. While a situation like this could point to s...
3,552
<p>We have been using CruiseControl for quite a while with NUnit and NAnt. For a recent project we decided to use the testing framework that comes with Visual Studio, which so far has been adequate.</p> <p>I'm attempting to get the solution running in CruiseControl. I've finally got the build itself to work; however,...
<p>Not sure if that helps (i found the ccnet Documentation somewhat unhelpful at times):</p> <p><a href="http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest" rel="noreferrer">Using CruiseControl.NET with MSTest</a></p>
<p>The CC.Net interface is generated via an XSL transform on your XML files put together as specified in the ccnet.config file for your projects. The XSL is already written for things like FxCop - check your server's CC xsl directory for examples - shouldn't be too hard to write your own to add in the info - just reme...
2,373
<p>I need to have one column as the primary key and another to auto increment an order number field. Is this possible?</p> <p>EDIT: I think I'll just use a composite number as the order number. Thanks anyways.</p>
<pre><code>CREATE TABLE [dbo].[Foo]( [FooId] [int] IDENTITY(1,1) NOT NULL, [BarId] [int] IDENTITY(1,1) NOT NULL ) </code></pre> <p>returns</p> <pre><code>Msg 2744, Level 16, State 2, Line 1 Multiple identity columns specified for table 'Foo'. Only one identity column per table is allowed. </code></pre> <p>So...
<p>A workaround would be to create an INSERT Trigger that increments a counter.</p> <p>So I have a table that has one identity col : applicationstatusid. its also the primary key. I want to auto increment another col: applicationnumber </p> <p>So this is the trigger I write.</p> <pre><code> create trigger [applicati...
45,426
<p>I wrote a sample program at <a href="http://codepad.org/ko8vVCDF" rel="noreferrer">http://codepad.org/ko8vVCDF</a> that uses a template function.</p> <p>How do I retrict the template function to only use numbers? (int, double etc.)</p> <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt; using namespace s...
<p>The only way to restrict a template is to make it so that it uses something from the types that you want, that other types don't have.</p> <p>So, you construct with an int, use + and +=, call a copy constructor, etc.</p> <p>Any type that has all of these will work with your function -- so, if I create a new type t...
<p>Suppose we want our templated add function can only accepts int and floats, We can do something like below. Can be seen here: <a href="https://godbolt.org/z/qa4z968hP" rel="nofollow noreferrer">https://godbolt.org/z/qa4z968hP</a></p> <pre><code>#include &lt;fmt/format.h&gt; template &lt;typename T&gt; struct restri...
17,879
<p>I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public), a Java JDK (which I already have, but should probably update), and an IDE (I have Eclipse). But what else should I have or know before starting?</p>
<p>Lets see... you'll need:</p> <ol> <li>A JDK. Preferably the <a href="http://java.sun.com/javase/downloads/index.jsp" rel="nofollow noreferrer">Standard Edition</a>, unless you plan on using GlassFish as a J2EE server. If you do use the standard edition, you need to include the jars from your servlet container/J2E...
<p>I would go for maven.</p> <p>It will give you a quick start in configuring your project (by using archetypes) and it will manage your dependencies.</p> <p>Install it and run the archetype command to create your project.</p> <pre><code>mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -Darche...
35,617
<p>I have a web application that I need to modify so that it can be rebranded for different customers. I did the same thing with the windows version of the app using resource files and a #define. I have been reading up on resource files for aspx/C# but it seems that they are limited to localization. I'd like to do s...
<p>Depending on what you want to rebrand (colors, logo, etc.) you could do this using different CSS files.</p>
<p>I've used Themes to change the 'branding' of a website based on what someone wants. <a href="http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx</a>.</p> <p>You can create numerous themes, put them in the application and then you s...
43,316
<p>I tried this on J2ME</p> <pre><code>try { Image immutableThumb = Image.createImage( temp, 0, temp.length); } catch (Exception ex) { System.out.println(ex); } </code></pre> <p>I hit this error: <code>java.lang.IllegalArgumentException:</code></p> <p>How do I solve this?</p>
<p>Image.createImage() throws an IllegalArgumentException if the first argument is incorrectly formatted or otherwise cannot be decoded. (I'm assuming that temp is a byte[]).</p> <p><a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Image.html#createImage(byte[],%20int,%20int)" rel="nof...
<p>I just had the same problem with my MIDLET and the problem in my case was the HTTP header that comes along the JPEG image that I read from the socket's InputStream. And I solved it by finding the JPEG SOI marker that is identified by two bytes: <code>FFD8</code> in my byte array. Then when I find the location of the...
34,172
<p>what is the best way to track and lower GDI windows handles . . </p>
<p>Two links worth reading...</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc301756.aspx" rel="noreferrer">Resource Leaks: Detecting, Locating, and Repairing Your Leaky GDI Code</a></p> <p><a href="http://www.relisoft.com/win32/GdiLeaks.html" rel="noreferrer">GDI Resource Leaks</a></p>
<p>the easiest way to see the current usage on an end user's machine is to use task manager and look at the column "GDI Handles"</p> <p>When I suspect I have GDI handle leaks I tend to run through my leak scenario once, force a garbage collection, look at task manager, run the action again with gc and check for a diff...
41,106
<p>Why don't we see C-like languages that allow for callables with polymorphism in the return type? I could see how the additional type inference would be a hurdle, but we have <a href="http://en.wikipedia.org/wiki/Type_inference" rel="nofollow noreferrer">plenty of languages</a> with full-fledged type inference system...
<p>If by "return type polymorphism" you mean overloading based on the return value type, I'm not sure about other languages, but for C++ here's the answer (pretty much from the horse's mouth):</p> <p>Function return types don't come into play in overload resolution simply because Stroustrup (I assume with input from o...
<p>Because of auto-conversion of types, it is not obvious to know which function to call when return types are close.</p>
30,986
<p>There appear to be a lot of unnecessary frameworks loading into my iPhone app. I didn't link against them in Xcode, and I don't need them.</p> <p>When I run "lsof -p" against them on the iPhone, I see these (and others) that I can't explain:</p> <ul> <li>CoreVideo </li> <li>AddressBookUI</li> <li>JavaScriptCore</...
<p>This is normal, but that doesn't mean it's ideal. It probably only has a small impact on app startup time, but it'll have a slightly greater impact than that on memory usage.</p> <p>If you'd like this to be improved, the best thing to do is to head on over to <a href="http://bugreport.apple.com" rel="nofollow nore...
<p>Before you go to all of the trouble of trying to stop the OS from loading these frameworks, you should rule out other causes of your slow launch time.</p> <p>First, build a "Hello, World" app and use it as a baseline. A project template app with nothing added should serve well. If that is starting up faster than ...
13,675
<p>I am using ASP.NET membership for the authentication of my web app. This worked great for me. I now have to implement password expiration.</p> <p>If the password has expired the user should be redirected to <code>ChangePassword</code> screen and should not be allowed access to any other part of the application with...
<p>Further to <a href="https://stackoverflow.com/questions/349286/asp-net-membership-password-expiration/349687#349687">csgero's answer</a>, I found that you don't need to explicitly add an event handler for this event in ASP.Net 2.0 (3.5).</p> <p>You can simply create the following method in <code>global.asax</code> ...
<p>I used the code from above and only slightly modified it to implement in Asp.NET (4.5) MVC5 using the .NET Identity Provider. Just leaving it here for the next guy/gal :) </p> <pre><code>void Application_PostAuthenticateRequest(object sender, EventArgs e) { if (this.User.Identity.IsAuthenticated) ...
45,449
<p>This is probably <a href="http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/x13320.html" rel="noreferrer">a complex solution</a>.</p> <p>I am looking for a simple operator like ">>", but for prepending.</p> <p>I am afraid it does not exist. I'll have to do something like </p> <pre> mv myfile t...
<p>This still uses a temp file, but at least it is on one line:</p> <pre><code>echo "text" | cat - yourfile &gt; /tmp/out &amp;&amp; mv /tmp/out yourfile </code></pre> <p>Credit: <a href="http://www.cyberciti.biz/faq/bash-prepend-text-lines-to-file/" rel="noreferrer">BASH: Prepend A Text / Lines To a File</a></p>
<p>Bah! No one cared to mention about <em>tac</em>.</p> <pre><code>endor@grid ~ $ tac --help Usage: tac [OPTION]... [FILE]... Write each FILE to standard output, last line first. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -b, --befo...
7,798
<p>Python provides the "*" operator for unpacking a list of tuples and giving them to a function as arguments, like so:</p> <pre><code>args = [3, 6] range(*args) # call with arguments unpacked from a list </code></pre> <p>This is equivalent to:</p> <pre><code>range(3, 6) </code></pre> <p>Does anyone know...
<p>You can use <a href="http://www.php.net/call_user_func_array" rel="noreferrer"><code>call_user_func_array()</code></a> to achieve that:</p> <p><code>call_user_func_array("range", $args);</code> to use your example.</p>
<p>You should use the call_user_func_array</p> <pre><code>call_user_func_array(array(CLASS, METHOD), array(arg1, arg2, ....)) </code></pre> <p><a href="http://www.php.net/call_user_func_array" rel="nofollow noreferrer">http://www.php.net/call_user_func_array</a></p> <p>or use the reflection api <a href="http://www.p...
37,571
<p>In C++, a function's signature depends partly on whether or not it's const. This means that a class can have two member functions with identical signatures except that one is const and the other is not. If you have a class like this, then the compiler will decide which function to call based on the object you call...
<p>This really only makes sense when the member function returns a pointer or a reference to a data member of your class (or a member of a member, or a member of a member of a member, ... etc.). Generally returning non-const pointers or references to data members is frowned upon, but sometimes it is reasonable, or sim...
<pre><code>#include &lt;iostream&gt; using namespace std; class base { public: void fun() const { cout&lt;&lt;"have fun"; } void fun() { cout&lt;&lt;"non const"; } }; int main() { base b1; b1.fun(); //does not give error return 0; } </code></pre> <p>Here compiler won't give any error, because in ...
31,266
<p>I'd like to start 3d printing in wax.</p> <p>Is there a reasonably priced 3d printer that is capable of it?</p> <p>Am I right in assuming that all I need is to make my own filament and set extruder temperature correctly, or do I miss something?</p>
<p>Yes, with the proper equipment.</p> <p>Printing wax filament (at 51 seconds): <a href="https://youtu.be/tibkVZB_n9c?t=51s" rel="noreferrer">https://youtu.be/tibkVZB_n9c?t=51s</a></p> <p>There are also options for melting wax, filling a heated reservoir head, and printing with that. I recommend doing this with a co...
<p>Just make a silicone mold of any of your prints and pour you wax in the silicone,you silicone putty is pretty cheap so is wax ,no need to break the bank as printers have become less expensive and can do a pretty good job </p>
629
<p>I have a object of type <code>ICollection&lt;string&gt;</code>. What is the best way to convert to <code>string[]</code>. </p> <p>How can this be done in .NET 2?<BR> How can this be done cleaner in later version of C#, perhaps using LINQ in C# 3?</p>
<p>You could use the following snippet to convert it to an ordinary array:</p> <pre><code>string[] array = new string[collection.Count]; collection.CopyTo(array, 0); </code></pre> <p>That should do the job :)</p>
<p>In the (trivial) case of <code>ICollection&lt;String&gt;</code>, use ToArray:</p> <pre><code>String[] GetArray(ICollection&lt;String&gt; mycoll) { return mycoll.ToArray&lt;String&gt;(); } </code></pre> <p>EDIT: with .Net 2.0, you can return the array with an extra <code>List&lt;String&gt;</code>:</p> <pre><co...
42,597
<p>Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time. </p>
<p><a href="https://github.com/swfobject/swfobject" rel="nofollow noreferrer">SWFObject</a> is very reliable. I have used it without trouble for quite a while.</p>
<p>To create a Flash object standart-compliant (with JavaScript however), I recommend you take a look at</p> <p>Unobtrusive Flash Objects (UFO) </p> <p><a href="http://www.bobbyvandersluis.com/ufo/index.html" rel="nofollow noreferrer">http://www.bobbyvandersluis.com/ufo/index.html</a></p>
19,265
<p>I have a nib that I load the usual way</p> <p><code>[NSBundle loadNibNamed:@"AuthorizationWindow" owner:self];</code></p> <p>and I see the window show on the screen briefly, and using NSLog() I can confirm that -awakeFromNib is called, but I can't figure out why the window does not stay on the screen. I had it wor...
<p>I'd guess your window is being deallocated (or if under GC, collected) right out from under you. There are about a million possible reasons for this (none of which we can diagnose from one line of code), but there mere fact you're using +loadNibNamed:owner: is a warning flag. The reason is that items instantiated ...
<p>I would take a closer look at the object you are using to load the nib (<code>self</code>, in the code you provided). Since it is the owner of the window, the window will be released when that object is released.</p>
49,154
<p>I there a PHP based source control 'server' that is compatible with SVN clients?<br /> I'd like to host my SVN on my hosting servers, however the current host will not allow me to start any process or install any software</p>
<p>You could try:</p> <p><a href="http://sourceforge.net/projects/deltaweb" rel="nofollow noreferrer">http://sourceforge.net/projects/deltaweb</a></p>
<p>Not that I know of.</p> <p>You can look at services like <a href="http://cvsdude.com/" rel="nofollow noreferrer">CVSDude.org</a> which provide great SVN hosting that's pretty affordable. They basically specialize in both CVS, and now SVN hosting. </p>
48,177
<p>I need to apply some xml templates to various streams of xml data (and files, on occasion) and there seem to be a large number of xml libraries for java out there -- enough that it's difficult to quickly determine which libraries are still active, how they differ from the other options that are also active, and what...
<p>saxon is the xslt and xquery parser -- <a href="http://saxon.sourceforge.net/" rel="noreferrer">http://saxon.sourceforge.net/</a>. this is built by a known xslt expert(who was on the xslt spec committe and who has authored books). there is an open source version and a commercial version.</p> <p>It(xslt piece) gets ...
<p>I use Xerces for XML parsing (DOM) and validation against XSD.</p> <p>For XSLT processing I used Xalan but it was 3 years ago so many things must have change, in my memory it was easy to use and powerful (I was using input XML file of several Mo)</p>
27,127
<p>I'm working on a Rails web application, and it's currently being used by some 20 users.</p> <p>Some parts of the application are only accessible by some users, so we already have a basic authorization framework in place, which I implemented using the acts_as_authenticated plugin.</p> <p>The users' privileges depen...
<p>The basic concept of authorization, as I understand it, is a role. Role can express various things:</p> <ol> <li>relation of a user to the system as a whole (eg. to be an admin of the system)</li> <li>relation of a user to some kind of entities (eg. to be a moderator of comments)</li> <li>relation of a user to some...
<p>you may need to introduce the notion of 'function points' or 'features' into your model as control-points for access; a 'feature' may have an optional 'parent feature' to form a hierarchy. You get to decide what is and isn't a feature, and check for permissions programatically. This should also allow you to check fo...
35,307
<p>So I'm generating a random number using Rnd and Randomize to set a seed that looks like this:</p> <pre><code>Randomize lSeed Response.Write Rnd </code></pre> <p>I'm noticing that it's returning the same result for two values in a row for lSeed (e.g. 123, 124) but then on say 125 it will return a new value but 126 ...
<p>That's the problem with random numbers...</p> <p><a href="http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif" rel="nofollow noreferrer">http://web.archive.org/web/20011027002011/http://dilbert.com/comics/dilbert/archive/images/dilbert2001182781025.gif...
<p>You should reseed before getting a random value each time. I'd recommend seeding to a timer.</p>
35,705
<p>Using WMI VB scripting, I would like to create/attach multiple child processes to a parent process, such as the explorer process.</p> <p>When an app is started by clicking on it, it becomes a child process of the explorer process. The same is true for all apps that are loaded when Windows starts up.</p> <p>If you ...
<p>A window's process keeps track of the Process ID of who created it, this is how the relationships are being managed. To get what you want, you either have to change the parent PID stored in the child process, or inject code into the process you want to be the parent and have it create the new child process. Neither ...
<p>The use of JobObjects as proposed by @josh poley is standard practice for grouping processes, but does not work when a process is launched as a DCOM service.</p> <p>Launching applications from VBScript has a serious downside when it comes to tracking the processes of things instantiated through CreateObject: Dependi...
44,764
<p>Is there a managed API to compile C# applications (to memory or disk)? I assume one exists because SharePoint compiles ASP.NET pages in memory. We want to use it to, at runtime, generate Linq <code>DataContext</code>s and compile those against various projects. </p>
<p>Take a look at the <a href="http://msdn.microsoft.com/en-us/library/microsoft.csharp.csharpcodeprovider.aspx" rel="nofollow noreferrer">Microsoft.CSharp.CSharpCodeProvider</a> class. That page has sample code how to use that class to compile C# sources.</p> <p><strong>Note</strong>: This class cannot be use in part...
<p>As Franci has pointed out, the CSharpCodeProvider is what you want.</p> <p>While writing my C# book I built "Snippy" which is a quick'n'dirty way of building and running snippets of C# - it's a simple enough project to make it quite easy to see how to use CSharpCodeProvider. The <a href="http://csharpindepth.com/Do...
28,075
<p>I would like to ask if it is possible to show Generalization relationship in UML for a Domain Model although I understand I can do that in a Class Diagram? I did not see much examples of Domain Model displaying Generalization Relationship except in Class Diagram. If not possible, what is the best way to display that...
<p>Yes, generalization between entities in your domain model is allowed. </p> <p>Basically, the domain model is a class diagram, where classes show the types of entities in your conceptual design, and not concrete programming language classes that you show in your typical class diagram.</p> <p>To better find what you...
<p>You need to clarify why you're distinguishing between a domain model and a class diagram. </p> <p>On the one hand, your domain model could simply be a class diagram of everything that could map to your database, and consume it. Hence a generalization relationship could simply depict implementation inheritance or in...
19,996
<p>I am new to UserControls, and while developing my own control I found a problem with showing events of my control in the property grid at design time. If I have some events in my control I want to see them in Property grid and if I double-click that I want to have a handler, in the same way Microsoft does for its c...
<p>They should automatically appear if I'm not mistaken. Make sure you've built your project though, or changes won't propagate to open designers. And make sure it's a <b><code>public</code></b> event too. (Private/protected events rightfully shouldn't show up because they're not accessible.)</p> <p>One thing you can ...
<p>You should be use Delegate at UserControl and raise it at Main page (aspx page) .If this way didn't work,you should be careful when register UserControlID.It need differ with other UserControl.Each UserControl need a ID.</p>
47,675