instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm looking to vertically align text by adding <code>&lt;br /&gt;</code> tags between characters with jQuery.</p> <pre><code>&lt;div id="foo"&gt;&lt;label&gt;Vertical Text&lt;/label&gt;&lt;/div&gt; </code></pre> <p>would look like this:</p> <p>V<br /> e<br /> r<br /> t<br /> i<br /> c<br /> a<br /> l<br /> <br /...
<p>Let's go golfing!</p> <pre><code>$('#foo label').html($('#foo label').text().replace(/(.)/g,"$1&lt;br /&gt;")); </code></pre> <p>Completely untested, but the pattern in the regex looks like a boob.</p>
<p>Why use a while loop when you can use jQuery's builtin each method?</p> <p><code>$.each( $('#foo').text(), function(){ $('#foo').append(this + '<br/>'); } ); </code></p> <p>There. It works. You can test it.</p>
35,227
<p>First time posting to a questions site, but I sort of have a complex problem i've been looking at for a few days.</p> <p><b>Background</b> At work we're implementing a new billing system. However, we want to take the unprecedented move of actually auditing the new billing system against the old one which is signifi...
<p>Actually, for the above type of query, the <a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpsamples&amp;DownloadId=51" rel="nofollow noreferrer">dynamic LINQ</a> stuff is quite a good fit. Otherwise you'll have to write pretty-much the same anyway - a parser, and a mechani...
<p>On the subject of LINQ in general - again, a good fit due to your size issues:</p> <blockquote> <p>Just some notes on the scale, each billing system produces roughly 6 million records / day at a total file size of about 1 gig.</p> </blockquote> <p>LINQ can be used fully with streaming solutions. For exampl...
41,812
<p>I'm trying to expand navigation options of the context menu on certain elements (specifically, <code>h1</code> and <code>h2</code> tags) I want to prevent the browser's default action when right-clicking on those elements.</p> <p>I found nice information at <a href="http://ajaxcookbook.org/disable-browser-context-m...
<p>This will prevent the context menu from appearing on a particular element</p> <pre><code>$(it).observe("contextmenu", function(e){ e.stop(); }); </code></pre> <p>So, for example stop all H1/H2 tags from showing a context menu</p> <pre><code>$$('h1, h2').each(function(it){ $(it).observe("contextmenu", func...
<p>You can obfuscate it a bit, but ultimately your page is only a guest in the browser in, (and you can take that to mean in the same manner that a prisoner is a "guest" of the state, if you wish). Therefore the page must rely on the browser to play nice. If the user wants to run a browser that doesn't play nice, or ...
35,077
<p>In the application I'm developping (in Java/swing), I have to show a full screen window on the <em>second</em> screen of the user. I did this using a code similar to the one you'll find below... Be, as soon as I click in a window opened by windows explorer, or as soon as I open windows explorer (i'm using windows XP...
<p>Usually when an application is in "full screen" mode it will take over the entire desktop. For a user to get to another window they would have to alt-tab to it. At that point windows would minimize the full screen app so that the other application could come to the front. </p> <p>This sounds like it may be a bug ...
<p>The following code works (thank you John). With no full screen and a large "always on top" window. But I still don't know why windows caused this stranged behavior...</p> <pre><code>private Window initFullScreenWindow() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDe...
7,740
<p>I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it.</p> <p>So, can someone give me a quick overview of how to track merg...
<h3>Usage</h3> <p>Merge tracking is managed by the client and stored in a property (<a href="http://subversion.tigris.org/merge-tracking/design.html" rel="nofollow noreferrer">svn:mergeinfo</a>).</p> <p>To use merge tracking you just merge as usual but without the revision range:</p> <pre><code>svn merge trunkURL </...
<p>If you've built your repository with the ~ svn-merge.py command you can upgrade your repository to use svn native merge tracking with the XXX command.</p>
6,795
<p>Is there any one website which contains many good C# screencasts?</p>
<p>I like the <a href="http://channel9.msdn.com/tags/CSharp/" rel="nofollow noreferrer">channel 9 screencasts</a> tagged C#..</p>
<p><a href="http://www.asp.net/learn/" rel="nofollow noreferrer">http://www.asp.net/learn/</a></p> <p><a href="http://www.learnvisualstudio.net" rel="nofollow noreferrer">http://www.learnvisualstudio.net</a></p>
18,794
<p>Has anyone implemented Mozilla's Object.toSource() method for Internet Explorer and other non-Gecko browsers? I'm looking for a lightweight way to serialize simple objects into strings.</p>
<p>If matching the exact serialization format of Firefox is not your aim, you could use one of the JavaScript JSON serialization/deserialization libraries listed at <a href="http://json.org" rel="noreferrer">http://json.org</a>. Using a standard scheme like JSON may be better than mimicking the proprietary Gecko format...
<p>See also <a href="https://stackoverflow.com/questions/130404/javascript-data-formattingpretty-printer" title="JavaScript data formatting/pretty printer">JavaScript data formatting/pretty printer</a>. I think the routine exports in valid JS format, so it can be eval to get it back.</p> <p>[EDIT] Actually, not! It is...
20,666
<p>I have created a .NET DLL which makes some methods COM visible.</p> <p>One method is problematic. It looks like this:</p> <pre><code>bool Foo(byte[] a, ref byte[] b, string c, ref string d) </code></pre> <p>VB6 gives a compile error when I attempt to call the method:</p> <blockquote> <p>Function or interface m...
<p>Declaring the array argument with "ref" is required. Your 2nd attempt should have worked just fine, perhaps you forgot to regenerate the .tlb?</p> <p>Tested code:</p> <pre><code>[ComVisible(true)] public interface IMyInterface { bool Foo(ref byte[] a, ref byte[] b,string c, ref string d); } [ComVisible(true)] p...
<p>Try</p> <pre><code>[ComVisible(true)] bool Foo([In] ref byte[] a, [In] ref byte[] b, string c, ref string d) </code></pre>
28,881
<p>When I access a wrong call to a sql server data into my application in classical ASP I get this message in my entire site: Service Unavailable. It stopped. My site is in a remote host. Don´t know what to do. What can I tell to the "support team" of them to fix that?</p>
<p>If you check out Administration Tools/Event Viewer - Application log you will probably see an error message. </p> <p>This should give you more information as too why the application pool died or why IIS died.</p> <p>If you paste this into your question we should be able to narrow things down a bit.</p>
<p>One reason you can get this is if the application pool has stopped.</p>
36,342
<p>I've built a simple application that applies grid-lines to an image or just simple colors for use as desktop wallpaper. The idea is that the desktop icons can be arranged within the grid. The problem is that depending on more things than I understand the actual spacing in pixels seems to be different from system to ...
<p>there are a 1001 ways to get/set this (but I only know 2) :-D</p> <p>Windows Register:</p> <pre>HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics</pre> <p>values are <strong>IconSpacing</strong> and <strong>IconVerticalSpacing</strong></p> <p>by code:</p> <p><code>using System.Management; </p> <p>public st...
<p>They might also be a size problem due to scaling algorithm if the requested size of the icon is not available.<br> (since an icon file is actually a collection of icons, as explained in this thread about <a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/20/8880062.aspx" rel="nofollow noreferrer">Icons and c...
24,824
<p>I've created a service for one of my apps. How do i create a system tray component in VB.net that can be used to monitor the progress of the service? Is there a way to have this installed via tcpip on multiple client machines such as those that are for our employees?</p>
<p>We do exactly that here, with the server running a really basic HTTP server on a configurable port on a separate thread that returns status in an XML format (nothing else, just that) -- the client just uses a web request to get the XML, before parsing it and displaying it appropriately. </p> <p>This approach also a...
<p>I guess your question is not about how to actually do the "traybar"-thing, but how to communicate with the service to get the information you want to show in the monitor/traybar-program?</p> <p>It can be done in many ways, API is one way, use sendmessage/postmessage/getmessage is one way to make 2 running programs ...
46,033
<p>I have two objects, let's call them <strong><code>Input</code></strong> and <strong><code>Output</code></strong></p> <p><strong><code>Input</code></strong> has properties <em><code>Input_ID</code></em>, <em><code>Label</code></em>, and <em><code>Input_Amt</code></em><br> <strong><code>Output</code></strong> has pro...
<p>Okay, now that I understand what's going on a bit better, the main problem is that you haven't got the equivalent of the ISNULL bit. Try this instead:</p> <pre><code>var InnerQuery = from i in input join o in output on i.Input_ID equals o.Output_ID into joined from...
<pre><code>var labelsAndAmounts = input .GroupJoin ( output, i =&gt; i.InputId, o =&gt; o.OutputId, (i, os) =&gt; new { i, oAmount = os.Any() ? os.Select(o =&gt; o.OutputAmt).Sum() : 0 } ) .GroupBy(x =&gt; x.i.Label) .Select(g =&gt; new { Label = g.Key, Amou...
31,786
<p>I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.</p> <p>An obvious way to do this is via something like XML-R...
<p>Well, you could try <a href="http://en.wikipedia.org/wiki/Named_pipe" rel="nofollow noreferrer">named pipes</a> or something similar but I really think that XML-RPC would be the most headache-free way.</p>
<p><a href="https://stackoverflow.com/questions/2752979/using-jruby-jython-for-ruby-python-interoperability">Using JRuby/Jython for Ruby/Python interoperability?</a> has more information. Of note: JRuby and Jython don't have object compatibility, but IronPython and IronRuby do.</p>
25,346
<p>In my <code>index.php</code> file I always load some classes used later. From profiler it states it sometimes can take about 20% of entire code. Is there any improvement that can make this process faster?</p> <p>I would try to make this list of classes shorter, but app is very big and checking all dependencies will...
<p>Op-code caches such as <a href="http://www.php.net/apc" rel="nofollow noreferrer">APC</a> and <a href="http://eaccelerator.net/" rel="nofollow noreferrer">eAccelerator</a> store a compiled version of your scripts in a cache. This dramatically reduces memory usage and loading time for frequently used static scripts. ...
<p>You might want to look at apc php.net/apc</p>
46,643
<p>In Perl, you can execute system commands using system() or `` (backticks). You can even capture the output of the command into a variable. However, this hides the program execution in the background so that the person executing your script can't see it. </p> <p>Normally this is useful but sometimes I want to see wh...
<p>As I understand, system() will print the result of the command, but not assign it. Eg.</p> <pre><code>[daniel@tux /]$ perl -e '$ls = system(&quot;ls&quot;); print &quot;Result: $ls\n&quot;' bin dev home lost+found misc net proc sbin srv System tools var boot etc lib media mnt opt root se...
<p>Hmm, interesting how different people are answering this different ways. It looks to me like <a href="https://stackoverflow.com/questions/17225/echo-system-commands-to-terminal-in-perl#17245">mk</a> and <a href="https://stackoverflow.com/questions/17225/echo-system-commands-to-terminal-in-perl#17293">Daniel Fone</a...
3,791
<p>I need a way of calling a web page from inside my .net appliction. </p> <p>But i just want to send a request to the page and not worry about the response. </p> <p>As there are times when the response can take a while so i dont want it to hang the appliction. </p> <p>I have been trying in side the page_load event<...
<p>Doak, Was almost there, but each time I put any of the request in a sepreate thread the page still wouldn't render until all the thread had finished running.</p> <p>The best way I found was adjusting Doak's method, and just sticking a timeout in there and swallowing the error. </p> <p>I know its a hack but it does...
<p>Use <code>System.Net.WebClient.DownloadDataAsync/DownloadFileAsync</code> in conjunction with <code>DownloadDataCompleted/DownloadFileCompleted</code>.</p>
38,893
<p>I have a class that creates several IDisposable objects, all of these objects are then passed to another 'manager' class in a 3rd party library. As I need some of the objects in later calls I kept a local field reference to the created objects so that I could access them at a later time. When I ran FxCop on the clas...
<p>The class that owns the object is the one that should dispose of them... It sounds like your manager is the owner, so he should dispose of the object.</p> <p>If you're trying to avoid the FXCop warning then one option is to have MyClass request the disposable object from the manager each time is needs to use it. Th...
<p>If you create any disposable objects, you should either dispose them yourself or make sure you're handing them off to another class which will take responsibility for that.</p> <p>In this case, I'd say it really depends on what the manager class is going to do. If that guarantees that it will dispose of anything th...
22,183
<p>Scott Hanselman recently posted a <a href="http://www.hanselman.com/blog/TheWeeklySourceCode35ZipCompressingASPNETSessionAndCacheState.aspx" rel="nofollow noreferrer">blog article</a> describing how to compress strings stored in the session / cache. This looks fairly promising, but the majority of data that I am st...
<p>Firstly I'd look at why you need to compress the data in your session / cache. Compression should be an act of last resort, better programming should be the first. </p> <p>Are you running out of memory, and if so, which objects are consuming the most? This should point you in the direction for code improvement to r...
<p>Could you use an XML Serializer to transformed it into an XML format?</p>
28,686
<p>I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as suscriber. Web synchro has to be launched manually through IE interface (menu tools/synchronize) and to be selected among available synchronizations.</p> <p>Everything is working fine except that I did not find a way to autom...
<p>In order to silence the message, you must be redirecting <code>stderr</code> <strong>at the time the message is generated</strong>. Because the <a href="http://ss64.com/bash/kill.html" rel="noreferrer"><code>kill</code></a> command sends a signal and doesn't wait for the target process to respond, redirecting <code>...
<p>Simple:</p> <pre class="lang-sh prettyprint-override"><code>{ kill $! } 2&gt;/dev/null </code></pre> <p>Advantage? can use any signal</p> <p>ex:</p> <pre class="lang-sh prettyprint-override"><code>{ kill -9 $PID } 2&gt;/dev/null </code></pre>
10,722
<p>It's not just a capture I'm looking to do here. I want to first capture the packet, then in real time, check the payload for specific data, remove it, inject a signature and reinject the packet into the stack to be sent on as before.</p> <p>I had a read of the ipfw divert sockets using IPFW and it looks very promis...
<p>See divert sockets: <a href="http://www.faqs.org/docs/Linux-mini/Divert-Sockets-mini-HOWTO.html" rel="nofollow noreferrer">Divert Sockets mini HOWTO</a>.</p> <p>They work by passing traffic matching a certain ipfw rule to a special raw socket that can then reinject altered traffic into the network layers.</p>
<p>If you're just looking for packet capture, libpcap is very popular. It's used in basic tools such as tcpdump and ethereal. As far as "hooking into the stack", unless you plan on fundamentally changing the way the way the networking is implemented (i.e. add your own layer or alter the behavior of TCP), your idea of u...
8,873
<p>Visual Studio fails to deploy reports or data sources on remote MSRS instance. Error message is</p> <blockquote> <p>Unable to connect to the remote server.</p> </blockquote> <p>The server is up and running and <code>TargetServerURL</code> property of the project points to correct url which works in the browser.<...
<p>This was happening to me a couple of weeks ago.</p> <p>Be sure the TargetServerURL is <code>http://server/ReportServer/</code> and not <code>http://server/Reports/</code></p> <p>There is a different URL used for the web services portion of reporting services (publishing/viewing/editing reports programmatically) an...
<p>This was happening to me a couple of weeks ago.</p> <p>Be sure the TargetServerURL is <code>http://server/ReportServer/</code> and not <code>http://server/Reports/</code></p> <p>There is a different URL used for the web services portion of reporting services (publishing/viewing/editing reports programmatically) an...
49,239
<p>I've been going down the learning road with two broken printers that I'm rebuilding with better parts and electronics.</p> <p>One thing that I've recognized is that there is a pretty low likelihood that any hotend or heatbed that has had the thermistor/thermocouple and/or the printer board swapped with a non-OEM pa...
<p>The short answer is, you use the temps and speeds that give you good results. It's trial and error. </p> <p>The temperature number your printer reports really doesn't matter. That's just a process control variable: it needs to be consistent and repeatable, but it doesn't need to be accurate against an independent r...
<p>It looks like you have to calibrate your thermometer first. The easiest way is to use well known thermistor (preferably in well working printer) and then measure temperatures with your thermometer. This way will give you proper calibration of it. Then you can measure other thermistors with this thermometer.</p> <p>...
252
<p>There are many options for editing and writing Stored Procedures in Oracle; what is the best tool for you and why? (one tool per answer.)</p>
<p><a href="http://www.toadsoft.com/lic_agree.html" rel="nofollow noreferrer"><strong>T</strong>ool for <strong>O</strong>racle <strong>A</strong>pplication <strong>D</strong>evelopers (TOAD)</a>, from <a href="http://www.quest.com/" rel="nofollow noreferrer">Quest Software</a> (formerly <a href="http://www.toadsoft.co...
<p>I just used a standard editor (vim which then gave me syntax highlighting).</p> <p>/Allan</p>
9,516
<p>I've got a collection of records to process, and the processing can be parallelized, so I've created an <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorService.html" rel="nofollow noreferrer">ExecutorService</a> (via <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/...
<p>To answer your question: <strong>no</strong>, two <code>ExecutorService</code> objects <strong>cannot</strong> share a thread pool. However you can share an <code>ExecutorService</code> between your objects, or alternatively create several Executors, as necessary, though this is less recommended.</p> <p>Best soluti...
<p>There are a few good reasons to want to do this, such as separate bounds and metrics per queue. AFAIK, Cassandra 2.1 gained not insignificantly from using an executor service implementation with a shared thread pool; the code is at <a href="https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra...
48,124
<p>Every project I compile with Delphi 7, in which I do <strong><em>not</em></strong> compile with run-time packages, gives a linker error: "Too many resources". Even a blank application gives this error.</p> <p>In other words: Delphi died on me.</p>
<p>What happens when you try to build it from the command line? (i.e., \Program Files\Borland\Delphi7\Bin\dcc32.exe)</p> <p>Also, have you build any custom .RES files for this project? If not, try deleting the default .RES that Delphi created for you, and let it get re-created by the project.</p> <p>You can also for...
<p>Most likely a corrupted project.res file. Try renaming the old and see if it is successfully recreated?</p>
10,025
<p>What is the best way to build a dynamic <em>Threaded</em> ASP.net radio button list? I am not that familiar with <code>RadioButtonLists</code> and it is my understanding that ASP.net doesn't like the application of individual styling of <code>ListItems</code>.</p>
<p>Well, why not use the <code>RadioButtonList</code> control, with a <code>ReapeatDirection="Horizontal"</code>?</p>
<p>Threaded like hierarchical and in a tabbed format? You are going to have to build a custom control if you are looking for this kind of functionality; it isn't available really easily out of the box. The list controls aren't the greatest for extending out of the box unfortunately.</p>
33,304
<p>I need to write some registration data (unique computer number, and corresponding activation code).</p> <p>The Computer Number needs to be visible from <i>other</i> programs and <em>all</em> accounts ({Admin|Non Admin} with User Access Control turned {On|Off} )</p> <p>It's acceptable to write the Computer Number a...
<p>Yes, but 234 won't be stored in the cookie. The cookie will only contain a unique ID (for example, <code>lit3py55t21z5v55vlm25s55</code>). Every time ASP.NET sees that unique ID, it will look up the corresponding session information.</p> <p>If you don't want to use cookies, you can put the session ID in the URL. Re...
<p>Session variables are kept on the server, but the user will have a cookie that identifies his session.</p>
31,157
<p>When developing a database of articles in a Knowledge Base (for example) - what are the best ways to sort and display the most relevant answers to a users' question?</p> <p>Would you use additional data such as keyword weighting based on whether previous users found the article of help, or do you find a simple keyw...
<p>Perhaps the easiest and most naive approach that will give immediately useful results would be to implement <a href="http://en.wikipedia.org/wiki/Tf%E2%80%93idf"><strong>*tf-idf</strong></a>:</p> <blockquote> <p>Variations of the tf–idf weighting scheme are often used by search engines as a central tool in scorin...
<p>keyword matching is not enough when dealing with questions, you need to understand intent, as joannes say a very hot topic in search</p>
21,420
<p>How to create a DOM from a User's input in PHP5?</p>
<p>I would use the DOM API that has been part of the core since 5. For an XML string $xml, you can build a DOM object with</p> <pre><code>$dom = new DOMDocument(); $dom-&gt;loadXML($xml); </code></pre> <p>Manipulate it with the rest of the DOM API, defined at <a href="http://uk.php.net/DOM" rel="nofollow noreferrer">...
<p>And when you need to inject it back into some other DOM (like your HTML page) you can export it again using the $dom->saveXML() method. The problem however is that it also exports an xml header (it's even worse for the saveHTML version). To get rid of that use this:</p> <pre><code>$xml = $dom-&gt;saveXML(); $xml = ...
10,387
<p>Sooo...it's only sort of programming related, but I figure it's election day, right? Is there a single good reason why they aren't, not necessarily open source in that anyone can contribute, but open source in that anyone could inspect the source?</p>
<p>Voting machines aren't open-source because lobbyists for the "electrical till" industry successfully hoodwinked politicians not qualified to make technology choices into buying their snake-oil. This was accomplished with a mix of anti-FOSS FUD and good ol' fashioned <strike>bribery</strike> campaign contributions.</...
<p>Because if they were they would not be able to blame inaccurate votes on <a href="http://blog.wired.com/27bstroke6/2008/10/video-recalibra.html" rel="nofollow noreferrer">calibration-errors</a> on the touchscreen.</p>
32,803
<p>I know you can use several different view engines with ASP.NET MVC:</p> <ul> <li>ASPX, obviously</li> <li>NVelocity</li> <li>Brail</li> <li>NHaml</li> <li>et al...</li> </ul> <p>The default ASPX view engine seems to make the most sense to me, coming from an ASP.NET WebForms background. </p> <p>But, I wanted to g...
<p>I use <a href="http://dev.dejardin.org/" rel="nofollow noreferrer">Spark</a>. It has nice flow between HTML and code. Scott Hanselman also did a <a href="http://www.hanselman.com/blog/TheWeeklySourceCode30SparkAndNHamlCrazyASPNETMVCViewEngines.aspx" rel="nofollow noreferrer">post</a> on it with his weekly source c...
<p>I've used NVelocity with MonoRail for some time but have recently switched to <a href="http://dev.dejardin.org" rel="nofollow noreferrer">Spark</a> for both Asp.Net MVC and MonoRail. The syntax seems very natural to me, but I guess that's to be expected. ;)</p>
6,414
<p>Is there an app or way to browse a directory that requires different login credentials without using a mapped drive? </p> <p>The issue is given one login credential Windows Explorer only allows you to map it to one drive and disallows using the same login credential to map to a different drive. </p>
<p>No, they are not instructed to roll back because in the original poster's scenario, some of the nodes have already committed. What happens is when the crashed node becomes available, the transaction coordinator tells it to commit again.</p> <p>Because the node responded positively in the "prepare" phase, it is requ...
<p>There are many ways to attack the problems with two-phase commit. Almost all of them wind up as some variant of the Paxos three-phase commit algorithm. Mike Burrows, who designed the Chubby lock service at Google which is based on Paxos, said that there are two types of distributed commit algorithms - "Paxos, and in...
20,724
<p>I have a RegEx that is working for me but I don't know WHY it is working for me. I'll explain.</p> <pre><code>RegEx: \s*&lt;in.*="(&lt;?.*?&gt;)"\s*/&gt;\s* </code></pre> <p><br> Text it finds (it finds the white-space before and after the input tag):</p> <pre><code>&lt;td class="style9"&gt; &lt;input name=...
<p>You appear to be using 'greedy' matching. </p> <p>Greedy matching says "eat as much as possible to make this work" </p> <p>try with </p> <pre><code>&lt;in[^=]*= </code></pre> <p>for starters, that will stop it matching the "=" as part of ".*" </p> <p>but in future, you might want to read up on the </p> <pre>...
<p>.* is greedy, so it'll find up to the last =. If you want it non-greedy, add a question mark, like so: .*?</p>
32,917
<p>In my most C++ project I heavily used ASSERTION statement as following:</p> <pre><code>int doWonderfulThings(const int* fantasticData) { ASSERT(fantasticData); if(!fantasticData) return -1; // ,,, return WOW_VALUE; } </code></pre> <p>But TDD community seems like to enjoy doing something lik...
<p>In my (limited) experience the first option is quite a bit safer. In a test-case you only test predefined input and compare the outcome, this works well as long as every possible edge-case has been checked. The first option just checks every input and thus tests the 'live' values, it filters out bugs real quickly, h...
<p>I don't know which particlar TDD subcommunity you're refering to but the TDD patterns I've come across either use Assert.AreEqual() for positive results or otherwise use an ExpectedException mechanism (e.g., attributes in .NET) to declare the error that should be observed.</p>
3,789
<p>The term is getting 'hotter' with Microsoft Azure and Windows 7.<br> What are the benefits + how does the status quo of desktop computing now change? Does the machine no longer need an OS installation (or a highly stripped down version of a typical OS)... what is needed to interact with the 'Cloud' ?</p> <p><stron...
<p>Two buzzwords.</p>
<p>So far, it looks like the idea of having software &amp; your data hosted at msft's data centre. SOA seems to be related to what cloud is offering.</p> <p>No need to have local software (office will run from internet, your docs will be saved there. so that, you can access it anywhere). I think, the target could be b...
35,399
<p>I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?</p>
<p>An implicit cursor is one created "automatically" for you by Oracle when you execute a query. It is simpler to code, but suffers from </p> <ul> <li>inefficiency (the ANSI standard specifies that it must fetch twice to check if there is more than one record)</li> <li>vulnerability to data errors (if you ever get two...
<p>Explicit...</p> <p>cursor foo is select * from blah; begin open fetch exit when close cursor yada yada yada</p> <p>don't use them, use implicit</p> <p>cursor foo is select * from blah;</p> <p>for n in foo loop x = n.some_column end loop</p> <p>I think you can even do this</p> <p>for n in (select * from b...
9,973
<p>I have long considered the design of a database that involves shared table purposes to be somewhat a trait of smelly code, and progressively increasing proliferation of smelly-code related problems.</p> <p>By this I mean, people over-normalizing, using 1 table where 2 tables could be more logical, people who've jus...
<p>I think that from the perspective of SO, both questions and responses are the same thing -- user posts. They just happen to be related. If a post has no parent, then it's a question. If a post does have a parent, then it's an answer. I find this perfectly reasonable though I'm not sure I would make the same choi...
<p>First, </p> <blockquote> <p>people over-normalizing, using 1 table where 2 tables could be more logical</p> </blockquote> <p>I find that denormalized data tends to be in fewer tables, not more. <hr> As to "re-using" tables for more than one purpose: JUST SAY NO! It's incurring technical dept from day 1.</p> <p>...
40,837
<p>How to center text over an image in a table cell using javascript, css, and/or html?</p> <p>I have an HTML table containing images - all the same size - and I want to center a text label over each image. The text in the labels may vary in size. Horizontal centering is not difficult, but vertical centering is.</p> ...
<p>you could try putting the images in the background.</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td style="background: url(myImg.jpg) no-repeat; vertical-align: middle; text-align: center"&gt; Here is my text &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>You'll just nee...
<p>I would set the images as the cells' background via CSS, set the cells' size to the proper fixed value (again via CSS), and then insert the text label as the cell content. By default, the content of table cells is centered vertically, so I think you don't have to worry about it. Again, vertical and horizontal alignm...
11,593
<p>Do you know any open source/free software C++ libraries to manipulate images in these formats: .jpg .gif .png .bmp ? The more formats it supports, the better. I am implementing a free program in C++ which hides a text file into one or more images, using <a href="http://en.wikipedia.org/wiki/Steganography" rel="nofol...
<p><a href="http://www.imagemagick.org/" rel="noreferrer">ImageMagick</a> can manipulate about anything and has interfaces for a <a href="http://www.imagemagick.org/script/api.php" rel="noreferrer">dozen of languages</a>, including the <a href="http://www.imagemagick.org/Magick++/" rel="noreferrer">Magick++</a> API for...
<p>Have you considered <a href="http://www.codeproject.com/KB/GDI-plus/cgdiplusbitmap.aspx" rel="nofollow noreferrer">GDI</a>?</p> <p>-- Kevin Fairchild</p>
6,301
<p>When modelling an architecture in UML component diagrams, how do you show various attributes of connectors simultaneously? Like </p> <ul> <li>business object information flow (A->B, B->A, A&lt;->B)</li> <li>request/response direction</li> <li>synchronous/asynchronous behaviour</li> </ul> <p>I am aware of other dia...
<p>For a start, <strong>don't</strong> try to explain these dynamic collaborations using the connectors on your class diagram. </p> <p>The direction of the arrow connectors on the class diagram just specifies the <em>who knows who</em>. That means, the dependencies between classes. With those arrows you can communicat...
<p>You might want to use <a href="http://www.agilemodeling.com/artifacts/sequenceDiagram.htm" rel="nofollow noreferrer">sequence diagrams</a> instead of class (i.e, component) diagrams.</p> <p>If you want to stick to a static diagram, you may also want to consider adding &lt;&lt; sterotypes>> to various connectors, or...
15,314
<p>I'm trying to create an instance of a class at run time. The classes I'm trying to create all inherit from a base class, ConfigMgrObj, and are named <code>ConfigMgr_xxxxxx</code> e.g. <code>ConfigMgr_Collection</code>. They all take a special object that I'm calling oController and a string as arguments.</p> <p>Thi...
<p>Are the types you're trying to instantiate actually declared within the same assembly? Passing null as the first parameter is telling Activator that the types live in the current assembly.</p>
<p>Looks like it did not find the the class named <code>"StackOverflowNamespace."+ClassToGet</code> in the current assembly.</p>
21,338
<p>If you had to write code that takes messages from a message queue and updates a table in a database, how would you go about structuring it in a good oo way. How would you structure it? The messages is XML data, one node per row in the table. The rows in the table could be updated, deleted or inserted.</p>
<p>I don't believe you've provided enough information for a good answer. What do the messages look like? Do they vary in contents/type, or are they all just "messages"? Do they interact with each other, or is this just a data format conversion? One of the keys to OO development is to realize that the "find the noun...
<p>The best way of building OO code when doing messaging or dealing with any kind of middleware is to hide the middleware APIs from your code and just deal with business logic.</p> <p>e.g. see these examples</p> <ul> <li><a href="http://activemq.apache.org/camel/pojo-consuming.html" rel="nofollow noreferrer">POJO Con...
45,036
<p>How do you generate passwords?</p> <ul> <li>Random Characters?</li> <li>Passphrases?</li> <li>High Ascii?</li> </ul> <p>Something like this?</p> <pre><code>cat /dev/urandom | strings </code></pre>
<p>Mac OS X's "Keychain Access" application gives you access to the nice OS X password generator. Hit command-N and click the key icon. You get to choose password style (memorable, numeric, alphanumeric, random, FIPS-181) and choose the length. It also warns you about weak passwords.</p>
<pre><code>&lt;?php print md5(rand(0, 99999)); ?&gt; </code></pre>
12,683
<p>I know that within a view I can render an action from the same controller using Html.RenderPartial. However, I need to render the output from an action under a different controller. What is the best way to do this? I would prefer to do this directly within the view, rather than doing it in the controller and saving ...
<p>The best thing to do is use <code>Html.RenderAction</code> which needs a references to the 'Futures' assembly <code>Microsoft.Web.Mvc</code> which <a href="https://stackoverflow.com/questions/334408/where-to-get-microsoftwebmvcdll">there's a question about how to get it</a>.</p> <p>You will also need to add the nam...
<p>I would look at Steve Sanderson's implementation of "Partial Requests" found <a href="http://blog.codeville.net/2008/10/14/partial-requests-in-aspnet-mvc/" rel="nofollow noreferrer">here</a></p>
48,968
<p>I am trying to create a query string of variable assignments separated by the <code>&amp;</code> symbol (ex: <code>"var1=x&amp;var2=y&amp;..."</code>). I plan to pass this string into an embedded flash file.</p> <p>I am having trouble getting an <code>&amp;</code> symbol to show up in XSLT. If I just type <code>&am...
<p>You can combine <code>disable-output-escaping</code> with a <code>CDATA</code> section. Try this:</p> <pre><code>&lt;xsl:text disable-output-escaping="yes"&gt;&lt;![CDATA[&amp;]]&gt;&lt;/xsl:text&gt; </code></pre>
<p>try: &lt;xsl:value-of select="&amp;amp;" disable-output-escaping="yes"/></p> <p>Sorry if the formatting is messed up.</p>
9,341
<p>Are there any useful techniques for reducing the repetition of constants in a CSS file?</p> <p>(For example, a bunch of different selectors which should all apply the same colour, or the same font size)?</p>
<p>Recently, <a href="https://www.w3.org/TR/css-variables/" rel="nofollow noreferrer"><strong>variables have been added</strong></a> to the official CSS specs.</p> <p>Variables allow you to so something like this :</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <d...
<p>You can use multiple inheritance in your html elements (e.g. <code>&lt;div class="one two"&gt;</code>) but I'm not aware of a way of having constants in the CSS files themselves.</p> <p>This link (the first found when googling your question) seems to have a fairly indepth look at the issue:</p> <p><a href="http://...
5,004
<p>I have to refactor a large C# application, and I found a lot of functions that are never used. How can I check for unused code, so I can remove all the unused functions?</p>
<p>Yes, ReSharper does this. Right click on your solution and selection "Find Code Issues". One of the results is "Unused Symbols". This will show you classes, methods, etc., that aren't used.</p>
<p>FXCop is a code analyzer... It does much more than find unused code. I used FXCop for a while, and was so lost in its recommendations that I uninstalled it.</p> <p>I think NDepend looks like a more likely candidate.</p>
30,516
<p>In developing search for a site I am building, I decided to go the cheap and quick way and use Microsoft Sql Server's Full Text Search engine instead of something more robust like Lucene.Net.</p> <p>One of the features I would like to have, though, is google-esque relevant document snippets. I quickly found determi...
<p>Although it is implemented in Java, you can see one approach for that problem here: <a href="http://rcrezende.blogspot.com/2010/08/smallest-relevant-text-snippet-for.html" rel="noreferrer">http://rcrezende.blogspot.com/2010/08/smallest-relevant-text-snippet-for.html</a></p>
<p>If you use CONTAINSTABLE you will get a RANK back , this is in essence a density value - higher the RANK value, the higher the density. This way, you just run a query to get the results you want and dont have to result to massaging the data when its returned.</p>
35,697
<p>I'm writing a quick Rails app and was wondering how I can validate the success an exec'd command. The two commands I'm running are and SVN update, and a cp from one directory to another.</p>
<p>If you use the <a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005982" rel="noreferrer">Kernel.system()</a> method it will return a boolean indicating the success of the command.</p> <pre><code>result = system("cp -r dir1 dir2") if(result) #do the next thing else # handle the error </code></pre> <p>Ther...
<p>For SVN update, check the version number before and after the update.</p> <pre><code>svn_start_version = IO.popen("svn info").readlines[4] `svn update` svn_end_version = IO.popen("svn info").readlines[4] if svn_end_version &gt; svn_start_version "success" end </code></pre> <p>For the cp, you could do a filesize ...
20,658
<p>We have a rather large SVN repository. Doing SVN updates are taking longer and longer the more we add code. We added <code>svn:externals</code> to folders that were repeated in some projects like the <a href="http://en.wikipedia.org/wiki/CKEditor" rel="noreferrer">FCKeditor</a> on various websites. This helped, but ...
<p>If it's an older SVN repository (or even quite new, but wasn't setup optimally), it maybe using the older BDB style of repository database. <a href="http://svn.apache.org/repos/asf/subversion/trunk/notes/fsfs" rel="noreferrer">http://svn.apache.org/repos/asf/subversion/trunk/notes/fsfs</a> has notes on the new one....
<p>If you have many folders in the root of repository and your local copy reflects the repository, then try to slit monolithic local copy into many separated downloadable folders and update these folders separately too, It will be really faster than one big folder.</p>
9,091
<p>I've compiled a java project into a Jar file, and am having issues running it.</p> <p>When I run:</p> <pre><code>java -jar myJar.jar </code></pre> <p>I get the following error</p> <pre><code>Could not find the main class: myClass </code></pre> <p>The class file is not in the root directory of the jar so I've tr...
<p>In your manifest file, make sure you have the attribute <code>Main-Class</code> set to the name of the class containing your <code>main()</code> method. For example, if the package-qualified name of the class is <code>my.cool.Class</code>, then, in your JAR manifest, <code>Main-Class</code> should be set to <code>my...
<p>You should specify your main class during jar creation with full path, something like:</p> <pre><code>&lt;target name="jar" depends="compile"&gt; &lt;delete file="myJar.jar"/&gt; &lt;delete file="MANIFEST.MF"/&gt; &lt;manifest file="MANIFEST.MF"&gt; &lt;attribute name="Main-Class" value="my.p...
39,820
<p>I'm looking for an existing library to summarize or paraphrase content (I'm aiming at blog posts) - any experience with existing natural language processing libraries?</p> <p>I'm open to a variety of languages, so I'm more interested in the abilities &amp; accuracy.</p>
<p>I think he wants to generate blog posts by automatically paraphrasing whatever was it the blogs this system is monitoring.</p> <p>This would be really interesting if you could combine 2 to 10 blog posts that are similar, but from different sources and then do a paraphrased "real" summary automatically (the size of ...
<p>Your getting into really far out AI type domain. I have done extensive work in text transformation into machine knowledge mainly using Attempto Controlled English (see: <a href="http://attempto.ifi.uzh.ch/site/" rel="nofollow noreferrer">http://attempto.ifi.uzh.ch/site/</a>), it is a natural language (english) that ...
4,497
<p>I want to create a small survey in an email message. The user are to respond using free form text boxes, check boxes , or pre-defined drop downlist . I see applications that claim to be able to do that. my needs are not that elaborate. Just a few questions that need to be asked</p>
<p>In Outlook 2007 there is functionality to <a href="http://office.microsoft.com/en-us/outlook/HP100804251033.aspx" rel="nofollow noreferrer">create polls (Voting)</a> which may satisfy your needs:</p> <blockquote> <p>This feature requires you to use a Microsoft Exchange Server 2000, Exchange Server 2003, or Exchan...
<p>Cant you use HTML to make it work?</p>
12,023
<p>How do I do this</p> <pre><code>Select top 10 Foo from MyTable </code></pre> <p>in Linq to SQL?</p>
<p>In VB:</p> <pre><code>from m in MyTable take 10 select m.Foo </code></pre> <p>This assumes that MyTable implements IQueryable. You may have to access that through a DataContext or some other provider.</p> <p>It also assumes that Foo is a column in MyTable that gets mapped to a property name.</p> <p>See <a href=...
<p>I had to use Take(n) method, then transform to list, Worked like a charm:</p> <pre><code> var listTest = (from x in table1 join y in table2 on x.field1 equals y.field1 orderby x.id descending select new tempList() ...
23,358
<p>My new boss went to a speech where Deliverance, a kind of proxy allowing to add skin to any html output on the fly, was presented. He decided to use it right after that, no matter how young it is.</p> <p>More here :</p> <p><a href="http://www.openplans.org/projects/deliverance/introduction" rel="nofollow noreferre...
<p>Having used Plone professionally for the last 4 years or so, and Deliverance on 4 commercial sites, I would advise all new front end developers (and old hands alike) to use Deliverance to theme Plone sites.</p> <p>It is <em>much</em> easier to learn (a couple of weeks Vs couple of months) and potentially much more ...
<p>I will start answering this question here while we perform tests but I'd love to have feedback from other users.</p> <h2>Install</h2> <p>We have spent a small afternoon from tuto to "how to" to finally install and run the thing on a virtual machine.</p> <p>This one is ok : <a href="http://www.openplans.org/projec...
25,045
<p>What is the Action Design Pattern, I haven't heard of it before? I am suspecting it is the same as the <a href="http://en.wikipedia.org/wiki/Command_pattern" rel="noreferrer">Command Design pattern</a> [wikipedia] but I can't find any resources on it.</p>
<p>You're right, action pattern == command pattern. You hear it called the action pattern more often in GUI design, in the form "on some button pressed, perform this action". In the code the button would be wired up with an action object of some kind.</p>
<p>Action design pattern is same as Command design pattern. Action is a key entity, which encapsulates information with in itself regarding what's its behavior, what processing have to be done on its do() method, how it can be undone, and so on. When an application or any of its components is designed in accordance wit...
49,893
<p>Is Boost the only way for VS2005 users experience TR2? Also is there a idiot proof way of downloading only the TR2 related packages?</p> <p>I was looking at the boost installer provided by BoostPro Consulting. If I select the options for all the threading options with all the packages for MSVC8 it requires 1.1GB. W...
<p>I believe you're actually referring to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf" rel="nofollow noreferrer">TR1</a>, rather than TR2. The call for proposals for TR2 is open, but don't expect to see much movement until the new C++ standard is out. Also, although boost is a provider of...
<p>The libraries I am most interested in from TR1/TR2 are <a href="http://www.open-std.org/JTC1/sc22/wg21/docs/papers/2007/n2320.html" rel="nofollow noreferrer">threads</a> and the related <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html" rel="nofollow noreferrer">atomics</a>.</p>
3,782
<p>I need to convert a Word document into HTML file(s) in Java. The function will take input an word document and the output will be html file(s) based on the number of pages the word document has i.e. if the word document has 3 pages then there will be 3 html files generated having the required page break.</p> <p>I s...
<p>We use tm-extractors (<a href="http://mvnrepository.com/artifact/org.textmining/tm-extractors" rel="nofollow noreferrer">http://mvnrepository.com/artifact/org.textmining/tm-extractors</a>), and fall back to the commercial Aspose (<a href="http://www.aspose.com/" rel="nofollow noreferrer">http://www.aspose.com/</a>)....
<p>You'd have to find the MS word doc specification ( since it is basically a binary dump of whatever is in word at that point in time ), and slowly go through it element by element converting ms word "objects/states" to the html equiv. you might be able to find a script to do it for u since this really isn't fun work ...
28,118
<p>I'm trying to write a regex to replace all spaces that are not included in quotes so something like this:</p> <pre><code>a = 4, b = 2, c = "space here" </code></pre> <p>would return this:</p> <pre><code>a=4,b=2,c="space here" </code></pre> <p>I spent some time searching this site and I found a similar q/a ( <a h...
<p>This seems to work:</p> <pre><code>result = string.gsub(/( |(".*?"))/, "\\2") </code></pre>
<p>try this one, string in single/double quoter is also matched (so you need to filter them, if you only need space):</p> <pre><code>/( |("([^"\\]|\\.)*")|('([^'\\]|\\.)*'))/ </code></pre>
25,176
<p>Our dev shop continues to support IE6 etc. I'm wanting to <a href="https://stackoverflow.com/questions/304284/can-html5-sessionstorage-be-written-to-disk">use session storage</a> to make an app-cache but wondering how much work it would be... </p> <p>Is it possible to use an HTML4 doc type in an HTML5-compatible ...
<p>Actually, you can. Browsers <em>don't care</em> about doctypes. HTML 4 strict or HTML 5 won't make a difference, just make sure your page is in Standards Mode, not <a href="http://en.wikipedia.org/wiki/Quirks_mode" rel="noreferrer">Quirks Mode</a>.</p> <p>Personally, I don't see a reason not to use the HTML5 doctyp...
<p>Good question... theoretically the answer is no, but practically it's vendor dependent. My solution would be to have the server check the user-agent and dynamically tag the page accordingly to what you find out when testing cross-browser implementation. Unfortunately this is one of those things you can't do dynamica...
39,097
<p>I am dealing with a large codebase that has a lot of classes and a lot of abstract methods on these classes. I am interested in peoples opinions about what I should do in the following situation.</p> <p>If I have a class Parent-A with an abstract method. There will only be 2 children. If Child-B implements Abst...
<p>If AbstractMethodA does not apply to Child-B, then Child-B should not be inheriting from Parent-A.</p> <p>Or to take the contrapositive, if Child-B inherits from Parent-A, and AbstractMethodA does not apply to the child, then it should not be in the parent either.</p> <p>By putting a method in Parent-A, you are sa...
<p>make it virtual empty in base class and override it in children.</p>
42,189
<p>I have a control where I have to check in which page I am, so I can set a certain variable accordingly.</p> <pre><code>string pageName = this.Page.ToString(); switch (pageName) { case "ASP.foo_bar_aspx": doSomething(); break; default: doSomethingElse(); break; } </code></pre> <p>this works fine locally and on some...
<p>You cant rely on auto generated names. Use types instead, eg:</p> <pre><code>if (Page is FooBar) { ... } </code></pre>
<p>That seems like a really dodgy way of getting the current request. Have you tried using <code>HttpContext.Current.Request.FilePath</code> or another <code>HttpContext.Current.Request...</code> variable instead?</p>
19,507
<p>I have the following JavaScript code to pop up a window in Internet Explorer. The code is executed from a page within a Microsoft CRM modal dialog box. (RequestID is a string that is always the same in the test system - at the moment it contains "abcdefg" - without the quotes).</p> <pre><code>var cancelUrl = "Cance...
<p>Ah, I think I got it... missed it in the description...</p> <p>You are <strong>trying to open a non-modal</strong> window <strong>from a modal dialog</strong> in <strong>IE</strong>.</p> <p>This AFAIK, should not work.</p> <p>Try opening another modal window instead.</p> <p>Effectively you are saying...</p> <p>...
<p>This code is simple. Use debugger and see what is going on.</p> <p>Check that site with FireFox or Chrome, they have JS debuggers.</p> <p><strong>Edit:</strong></p> <p>Add try/catch block around <code>window.open()</code> and see if there is some exception there.</p> <p><strong>Edit 2:</strong></p> <p>I see now...
32,767
<p>I'm using Emma in my ant build to perform coverage reporting. For those that have used Emma, is there a way to get the build to fail if the line coverage (or any type of coverage stat) does not meet a particular threshold? e.g. if the line coverage is not 100%</p>
<p>Not out of the box.</p> <p>However, the <a href="http://emma.sourceforge.net/reference/ch03s02.html#prop-ref.report.metrics" rel="nofollow noreferrer"><code>report.metrics</code></a> property or attribute of <code>&lt;report&gt;&lt;/report&gt;</code> can be set for <code>name, class, method, block</code>, and <code...
<p>I wrote an ant task to do this.</p> <p>You should be able to find all the information you need on my <a href="http://mchr3k.github.com/emmacheck/" rel="nofollow">EmmaCheck site</a>.</p>
40,036
<p>I have a timely operation that runs on a background thread. While running, I currently put the cursor in a wait state:</p> <pre><code>Mouse.OverrideCursor = Cursors.Wait </code></pre> <p>I just implemented a feature that allows the user to click a "Cancel" button if they're tired of waiting. However, some users ...
<pre><code>Me.Cursor = Cursors.AppStarting </code></pre>
<p>May be you should also change the background colour (or some graphical clue) of the cancel button in order to make the user realize the cancelation is posible .</p>
35,100
<p>Is there in Windows API or in MFC any analog to <code>atoh()</code> function?</p> <p><code>atoh()</code> converts a string containing a hexadecimal number into an unsigned number like</p> <pre><code>unsigned x = atoh("A"); </code></pre> <p>and x = 10 after the operation.</p> <p>In Windows I have a CString, conta...
<pre><code>long x = strtoul("A", (char **) NULL, 16); // x will be 10 decimal </code></pre>
<p><code>unsigned long ten = <a href="http://msdn.microsoft.com/en-us/library/5k9xb7x1(VS.80).aspx" rel="nofollow noreferrer">strtoul("a", NULL, 16)</a>;</code> should handle it, if you can get a plain old <code>char *</code>-representation out of the CString. The accepted solution using <code>strtoul()</code> does a s...
43,705
<p>I have a method that's about ten lines of code. I want to create more methods that do exactly the same thing, except for a small calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. W...
<p>Anonymous inner class</p> <p>Say you want to have a function passed in with a <code>String</code> param that returns an <code>int</code>.<br> First you have to define an interface with the function as its only member, if you can't reuse an existing one.</p> <pre><code>interface StringFunction { int func(String...
<p>The open source <a href="https://github.com/Hervian/safety-mirror" rel="nofollow noreferrer">safety-mirror</a> project generalizes some of the above mentioned solutions into a library that adds functions, delegates and events to Java.</p> <p>See the README, or <a href="https://stackoverflow.com/a/63775875/6095334">t...
14,891
<p>I'm trying to use the VssGet task of the MSBuild Community Tasks, and the error message "File or project not found" is beating me with a stick. I can't figure out what in particular the error message is referring to. Here's the task:</p> <pre><code>&lt;LocalFilePath Include="C:\Documents and Settings\michaelc\My ...
<p>Two thoughts. One, sometimes a type load exception manifests as a FNF - let's hope that's not it. But if the code is actually being honest, you can track the problem using <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">Procmon</a> or <a href="http://technet.micros...
<p>@famoushamsandwich that's a great response -- I had not previously heard of procmon or filemon. Tried procmon on the problem, but even after sifting through the relevant output (my gosh the machine does a lot more stuff behind the screen than I was aware of) I couldn't find where a file I'm referencing wasn't being...
30,269
<p>I want to do something like this:</p> <pre><code>SQL.Text := Format('select foo from bar where baz like ''%s%''',[SearchTerm]); </code></pre> <p>But Format doesn't like that last '%', of course. So how can I escape it? <code>\%</code>? <code>%%</code>? </p> <p>Or do I have to do this:</p> <pre><code>SQL.Text := ...
<p>Use another % in the format string:</p> <pre><code>SQL.Text := Format('select foo from bar where baz like ''%s%%''',[SearchTerm]); </code></pre>
<p>Add 2 percent sign to have 1 single %<br> Example :</p> <pre><code> Format('select foo from bar where baz like ''%%%s%%'',[SearchString]) </code></pre> <p>Gives you</p> <pre><code>select foo from bar where baz like '%SearchString%' </code></pre>
33,550
<p>We've got an app with some legacy printer "setup" code that we are still using <code><a href="http://msdn.microsoft.com/en-us/library/ms646940(VS.85).aspx" rel="nofollow noreferrer">PrintDlg</a></code> for. We use a custom template to allow the user to select which printer to use for various types of printing tasks ...
<p>I found a related post on the Microsoft forums: <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2677398&amp;SiteID=1" rel="nofollow noreferrer">On Vista x64, DocumentProperties fails from UAC-elevated process</a></p> <p>I've verified with a sample program that PrintDlg running as non-admin works.</p>...
<p>I found a post on the Quicken Community forum: <a href="http://www.quickencommunity.com/webx/Forums/Quicken%20Personal%20Finance%20Software%20Forum%20for%20Windows/Printing%20in%20Quicken/531/26?5" rel="nofollow noreferrer">Solution to Printing Problems Vista 64 Quicken 2008</a>, and the related FAQ: <a href="https:...
36,241
<p>Previously Visual Studio had templates for mobile web forms (not the mobile SDK). They appear to be gone in Visual Studio 2008 and the only solution I've seen is to download some templates from Omar here:</p> <p><a href="http://blogs.msdn.com/webdevtools/archive/2007/09/17/tip-trick-asp-net-mobile-development-with...
<p>I thought I'd come back to answer this. The mobile forms controls are still there and the templates provided unofficially above are the only ones available that I've found. I'm not sure why they took them out in Visual Studio 2008.</p> <p>Without the templates, you mostly you just need to change your pages to der...
<p>From what I can tell, this has not made it in there, supposedly they were to be included in SP1 of VS2008, but they were not.</p> <p>Since the source of the templates came from blogs.msdn.com, I would guess that yes, it is the current supported method for building mobile targeted forms.</p>
18,467
<p>I can use an bitmap in a menu</p> <pre><code>CMenu men; CBitmap b; b.LoadBitmap(IDB_0); men.AppendMenu( MF_ENABLED,1,&amp;b); </code></pre> <p>I can draw an icon into a DC</p> <pre><code> CImageList IL; IL.Create(70, 14, ILC_COLOR16 | ILC_MASK, 1, 0); IL.Add(AfxGetApp()-&gt;LoadIcon(IDI_0)); IL.Draw ( pDC...
<p>I asked the question you reference.</p> <p>The way to add (normal, 16-bit color) icons to menus is to make a toolbar with the same resource id as the menu you want to have icons in. You then assign id's to each of the toolbar buttons, the same id's as the menu entries. Make a wizard-generated new MFC application an...
<p>In order to set up a bitmap for a menu, you need to call CMenu::SetMenuItemInfo() for each item with something like this:</p> <pre><code>MENUITEMINFO mii; mii.cbSize = sizeof mii; mii.fMask = MIIM_BITMAP; mii.hbmpItem = bitmapHandle; menu.SetMenuItemInfo(menuItem,&amp;mii,TRUE); </code></pre> <p>A further complica...
33,700
<p>I have a view that supports landscape and portrait viewing, with the controls all moving around when you switch from one to the other. I'm currently doing this by setting the .center of each one of my controls when the user rotates the phone. The problem is that this is tedious, and requires a lot of code, and seems...
<p>When necessary, I add <code>UIView</code> objects to the view in IB which I make hidden. Give it a nice background color so you can see it, and send it all the way to the background. Then use that view's frame when you need to set the frame of an object. If you have a lot of them, you might consider using <code>U...
<p>I'm not 100% sure if it's possible, but have you considered using different view controllers for landscape and portrait?</p>
22,430
<p>I have an ASP.NET MVC project and I have a single action that accepts GET, POST, and DELETE requests. Each type of request is filtered via attributes on my controllers <code>Action</code> methods.</p> <pre><code>[ActionName(Constants.AdministrationGraphDashboardAction), AcceptVerbs(HttpVerbs.Post)] public ActionRe...
<p>i don't believe this is possible. the method attribute of form elements in HTML4 &amp; XHTML 1.0 will only accept GET or POST. in addition, standard configs of most webservers will deny DELETE and PUT requests. assuming you have configured your webserver to allow methods like PUT / DELETE (such as WebDav does), you...
<p>Using XMLHttpRequest, it's not only the "best practice", it's really the only way.</p>
34,967
<p>In <a href="https://stackoverflow.com/questions/32404/can-i-run-a-python-script-as-a-service-in-windows-how" title="Python scripts as Windows service">another question</a> I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Window...
<p>Here is code to install a python-script as a service, written in python :)</p> <p><a href="http://code.activestate.com/recipes/551780/" rel="noreferrer">http://code.activestate.com/recipes/551780/</a></p> <p>This post could also help you out:</p> <p><a href="http://essiene.blogspot.com/2005/04/python-windows-serv...
<p>You can use srvany.exe from Windows NT Resource Kit to create a user defined service that will show up in the admin tools...</p> <p><a href="http://support.microsoft.com/kb/137890" rel="nofollow noreferrer">http://support.microsoft.com/kb/137890</a></p> <p>I am using this method to run tracd (a python script / ser...
5,455
<p>For years and years, I've tried to understand the <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4" rel="noreferrer">part</a> of Java specification that deals with memory model and concurrency. I have to admit that I've failed miserably. Yes' I understand about locks and "synchronized"...
<p>I'm not going to attempt to actually answer your questions here - instead I'll redirect you to the book which I seeing recommended for advice on this topic: <a href="https://rads.stackoverflow.com/amzn/click/com/0321349601" rel="noreferrer" rel="nofollow noreferrer">Java Concurrency in Practice</a>.</p> <p>One word...
<p>One notion might be helpful: data (datum) and copies.</p> <p>If you declare a variable, let's say a byte, it resides somewhere in the memory, in a data segment (roughly speaking). There are 8 bits somewhere in the memory devoted to store that piece of information.</p> <p>However, there can be several copies of tha...
47,345
<p>3D-printing newbie here. I have a Geeetech's Prusa i3 mk2 B.</p> <p>I'm trying to print this: <a href="https://www.thingiverse.com/thing:1358311" rel="noreferrer">https://www.thingiverse.com/thing:1358311</a></p> <p>That's a mold, with 2 external parts and a core. The exterior prints wonderful. But the core is too...
<p>Basically, <strong>you print too hot (and fast) without enough cooling</strong>. The deformed small pin in your image is a perfect example of depositing new layers onto too hot (not cooled down enough) prior layers.</p> <p>You can easily solve this by printing two identical parts spaced apart from each other. This ...
<p>I'm sorry for the long time I took to answer, but the ammount of NEW problems I faced since started this question was so big that wanted to write a list of them before answering my own question. I've finally also desisted from the list, as the problems tends towards infinity. </p> <p>Simple version: printing more t...
1,258
<p>I have a stored procedure with the following header:</p> <pre><code>FUNCTION SaveShipment (p_user_id IN INTEGER, p_transaction_id IN INTEGER, p_vehicle_code IN VARCHAR2 DEFAULT NULL, p_seals IN VARCHAR2 DEFAULT NULL) RETURN INTEGER; </code></pre> <p>And I am having trouble running it from TOAD's Editor. I cannot ...
<p>Are you calling the stored procedure from another SP?</p> <p>I think the syntax is (if I recall correctly):</p> <pre><code>declare c integer; begin c:=storedProc(...parameters...); </code></pre> <p>Hope this helps.</p>
<p>you could probably SELECT orm_helper.orm_helper.SAVESHIPMENT (9999, 31896, NULL, '') FROM DUAL.</p>
20,764
<p>I would like to implement a search engine which should crawl a set of web sites, extract specific information from the pages and create full-text index of that specific information.</p> <p>It seems to me that Xapian could be a good choice for the search engine library.</p> <p>What are the options for a crawler/par...
<p>First of all you should set authorization cookie:</p> <pre><code>FormsAuth.SetAuthCookie(UserName, RememberMe); </code></pre> <p>After this you should return RedirectToAction result:</p> <pre><code>return RedirectToAction(actionName, controllerName); </code></pre> <p>Or Redirect result:</p> <pre><code>return Re...
<p>I use the classic ReturnUrl querystring parameter to get the user back to the right page. Unfortunately, the RedirectFromLoginPage does not work well after OpenId Authentication so you must do it manually. Note, this is done as an authentication module rather than deeper in on the controller. It feels cleaner thi...
43,095
<p>Weird issue:</p> <ol> <li>Open a large notepad window</li> <li>create a toolwindow (style WS_EX_TOOLWINDOW)</li> <li>create 2 more windows (normal overlapped) (WS_OVERLAPPED)</li> <li>close those 2 overlapped windows (child of desktop or the toolwindow)</li> <li>the toolwindow jumps behind the notepad window</li> <...
<p>This isn't surprising. In fact, it's exactly the behavior I'd expect.</p> <p>You're tool window isn't jumping down; rather Notepad is jumping up.</p> <p>You closed the window that had activation. The system is going to activate the next-highest top-level window in the z-order. Your tool window doesn't a count a...
<p>Are the three windows dialogs to another main window or are they applications in their own right?</p> <p>If they are dialog windows then I would check that their parent window is correctly assigned. </p> <p>If they are application windows then I would check that they are appearing in the taskbar. </p> <p>Without ...
21,175
<p>I'm looking at using CompositeWPF (<a href="http://www.codeplex.com/CompositeWPF" rel="nofollow noreferrer">http://www.codeplex.com/CompositeWPF</a>) - aka Prism, to build an application I am working on.</p> <p>The application isn't a traditional LOB application, however it does present data and state information t...
<p>WPF has very good support for animations. Animations are supported from both xaml and code behind, so you should be able to achieve any look that you are going for.</p> <p>The MSDN <a href="http://msdn.microsoft.com/en-us/library/ms752312.aspx" rel="nofollow noreferrer">Animation Overview</a> for WPF looks to have ...
<p>At its simplest, a fade effect like this just requires a timer of some sort that gradates the color back towards normal with each tick. The faster the time, the more discrete colors you will display from start to finish, and the smoother the overall effect will be (WPF may have something built-in to do this).</p> ...
34,928
<p>I have a some JPA entities that inherit from one another and uses discriminator to determine what class to be created (untested as of yet).</p> <pre><code>@Entity(name="switches") @DiscriminatorColumn(name="type") @DiscriminatorValue(value="500") public class DmsSwitch extends Switch implements Serializable {} @Ma...
<p>As your switch class is not an entity, it cannot be used in an entity relationship... Unfortunately, you'll have to transform your mappedsuperclass as an entity to involve it in a relationship.</p>
<p>I don't think that you can with your current object model. The Switch class is not an entity, therefore it can't be used in relationships. The @MappedSuperclass annotation is for convenience rather than for writing polymorphic entities. There is no database table associated with the Switch class.</p> <p>You'll e...
20,297
<p>Does <a href="https://facelets.dev.java.net/" rel="nofollow noreferrer">Facelets</a> have any features for neater or more readable internationalised user interface text labels that what you can otherwise do using JSF?</p> <p>For example, with plain JSF, using h:outputFormat is a very verbose way to interpolate vari...
<p>Since you're using Seam, <a href="http://docs.jboss.com/seam/2.1.0.BETA1/reference/en-US/html_single/#d0e13037" rel="noreferrer">you can use EL</a> in the messages file.</p> <p>Property:</p> <pre><code>label.widget.count = You have a total of #{widgetCount} widgets. </code></pre> <p>XHTML:</p> <pre><code>&lt;h:o...
<p>Use ResourceBundle and property files.</p>
11,172
<p>Being an aspiring Apple developer, I want to get the opinions of the community if it is better to learn C first before moving into Objective-C and ultimately the Cocoa Framework?</p> <p>My gut says learn C, which will give me a good foundation.</p>
<p>I would learn C first. I learned C (and did a lot in C) before moving to Obj-C. I have many colleagues who never were real C programmers, they started with Obj-C and learned only as much C as necessary.</p> <p>Every now and then I see how they solve a problem entirely in Obj-C, sometimes resulting in a very clumsy ...
<p>Heck no, go straight to objective C!</p> <p>I moved from ActionScript 3 to Objective C, and I already have an intern at a company!</p> <p>Do what you want.</p>
21,784
<p>I have an ASP page which will query records from a DB Table and do some processing and then Render an HTML table in the browser.My table has more than 16000 rows in it. When i am running the prigram with select top 2500 StudId,StudName from StudentsTbl, It is working fine.But when i am Using select "StudId,StudName...
<p>Based on your description of the problem, I'm betting that you're using IE as your test browser. The Response.Flush() <em>is</em> outputting HTML, but it will not display right away because IE doesn't know how to render a table incrementally. Instead, IE waits for the entire table to output before it draws it to the...
<p>Try outputting it as a table to the browser - I bet you get a "Script Timed Out" error.</p> <p>Best bet would be to up the timeout interval. You can do that with a bit of code at the start of the script or you can do that as a global server setting. I would recommend the former.</p>
40,860
<p>I have the following config in my lighttpd.conf:</p> <pre><code>$HTTP["host"] == "trac.domain.tld" { server.document-root = "/usr/home/daniels/trac/htdocs/" fastcgi.server = ( "/trac" =&gt; ( "trac" =&gt; ( "socket" =&gt; "/tmp/trac-fastcgi.s...
<p>Look for "For top level setup: ..." <a href="http://trac.lighttpd.net/trac/wiki/HowToSetupTrac" rel="nofollow noreferrer">here</a>.</p>
<p>Look for "For top level setup: ..." <a href="http://trac.lighttpd.net/trac/wiki/HowToSetupTrac" rel="nofollow noreferrer">here</a>.</p>
13,498
<p>I need to run a Linux CLI command and get its stdout output from C.</p> <p>I can use pipe() to create a pipe, then fork/exec, redirecting child's stdout descriptor into the pipe before calling exec(), and reading from the pipe in parent. Plus I'll need to wait on the child.</p> <p>Is there a simple call to do fork...
<p>Is this it?</p> <pre> NAME popen, pclose - process I/O SYNOPSIS #include &lt;stdio.h> FILE *popen(const char *command, const char *type); int pclose(FILE *stream); DESCRIPTION The popen() function opens a process by creating a pipe, forking, and invoking the shell. Since...
<p>Use <code>popen()</code> and <code>pclose()</code>.</p> <hr> <p><code>popen()</code> does not actually wait, of course, but reads on the pipe will block until there is data available.</p> <p><code>pclose()</code> waits, but calling it prematurely could cut off some output from the forked process. You'll want to d...
26,968
<p>It is open season for posting ads on other sites. It might be a good idea to take advantage of this to help 3dPrinting.SE grow. I'm wondering what everyone might think about it?</p> <p>If it does interest you, please post up an answer to this question with where you might think would be a good place to advertise. U...
<p>Considering 3D printing needs 3D models, I think it would be natural to advertise on <a href="https://blender.meta.stackexchange.com/q/2580/13218">Blender.SE</a>, perhaps with a catchphrase like "Want to print your Blender model?"</p> <p><a href="https://graphicdesign.meta.stackexchange.com/q/3573/30985">GraphicDes...
<p>Sounds like a great idea. StackOverflow is by for the most populated site (and the one I came from).</p> <p>3D printing interests nerdy-trendy folks like those the in SO, that's where I can from.</p> <p>Prehaps woodworking SE sites would work as well.</p>
64
<p>Does anyone have any good font and colour themes for Visual Studio that will give me nice support for Resharper? The majority of themes out there don't support Resharper, and as such all the extra R# highlighting looks rubbish...</p> <p>Cheers! Matt</p>
<p>I use this <a href="http://www.iunknown.com/2007/06/vibrant_ink_vis.html" rel="nofollow noreferrer">VibrantInk</a> theme, with <a href="http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released" rel="nofollow noreferrer">EnvyCode R</a> font, looks good with the Resharper Highlighting </p>
<p><a href="http://blog.muonlab.com/2009/05/14/visual-studio-and-resharper-colour-woes-with-added-visual-svn/" rel="nofollow noreferrer">Here</a> are mine, based on textmate</p> <p>Edit: (still a work in progress, but its getting there)</p>
39,807
<p>I got a row structure looks like ID bigint, ScanRept XML</p> <p>I want to wind up with a file named 4.xml containing just the xml from the ScanRept column where the ID number is 4.</p> <p>I don't want to do it interactively (by going into Manager Studio, finding the row, right-clicking the field and doing Save AS)...
<p>The upsizing wizard in Access 2007 is not aware of SQL Server 2008 and therefore won't connect. You should use the <a href="http://www.microsoft.com/sqlserver/en/us/product-info/migration-tool.aspx#Access" rel="nofollow noreferrer">SQL Server migration assistant for Access</a> tool that is provided with SQL Server 2...
<p>What error do you get when trying to link to the ODBC connection? Just to confirm, you are selecting ODBC Database from the Import part of the 'External Data' ribbon? If you test your ODBC conneciton does it pass?</p>
34,221
<p>Over the years, I think I have seen and tried every conceivable way of generating stub data structures (fake data) for complex object graphs. It always gets hairy in java.</p> <pre><code> * * * * A---B----C----D----E </code></pre> <p>(Pardon cheap UML) </p> <p>The key issue is that there are certain re...
<p>You might find the <a href="http://martinfowler.com/bliki/ObjectMother.html" rel="nofollow noreferrer">Object Mother</a> pattern to be useful. I've used this on my current Groovy/Grails project to help me create example data.</p> <p>It's not groovy specific, but a dynamic language can often make it easier to creat...
<p>I typically create object mothers using the builder pattern. </p> <pre><code>public class ItineraryObjectMother { Status status; private long departureTime; public ItineraryObjectMother() { status = new Status("BLAH"); departureTime = 123456L; } public Itinerary build() ...
37,064
<p>Does anyone have any experience with doing this? I'm working on a Java decompiler right now in C++, but would like a higher level language to do the actual transformations of the internal trees. I'm curious if the overhead of marshaling data between languages is worth the benefit of a more expressive and language ...
<p>I'm a big advocate of always choosing the right programming language for each challenge. If there is another language which handles some otherwise tricky task easily, I'd say go for it.</p> <p>Does it happen in the real world? Yes. I am currently working on a project which is made up of both PHP and objective-c cod...
<p>Marshalling costs depend on the languages and architecture you're working with. For example, if you're on the CLR or JVM, there are low-cost interop solutions available - though I know you are working with probably unmanaged C++.</p> <p>Another avenue is an embedded domain-specific language. Tree transformations ar...
40,453
<p>I have an Ender 5 with an auto bed leveling sensor (TRU-LEV 600).</p> <p>It is working fine, however, as the sensor probes the bed, the nozzle and the bed cool down and are not staying heated as it is getting the points, even though they were heated up in the first place.</p> <p>How do I stop the bed and hotend from...
<p>For Marlin firmware, you should <strong>check the setting <code>PROBING_HEATERS_OFF</code></strong> in <em>Configuration.h</em> file:</p> <pre><code>//#define PROBING_HEATERS_OFF // Turn heaters off when probing #if ENABLED(PROBING_HEATERS_OFF) //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back u...
<p>Eco mode under settings shuts off the bed after a 30 minutes ish maybe an hour. Either way it is probably the issue</p>
1,846
<p>My math-fu is failing me! I need an efficient way of reducing network ranges to supersets, e.g. if I input list of IP ranges:</p> <ul> <li>1.1.1.1 to 2.2.2.5</li> <li>1.1.1.2 to 2.2.2.4</li> <li>10.5.5.5 to 155.5.5.5</li> <li>10.5.5.6 to 10.5.5.7</li> </ul> <p>I want to return the following ranges:</p> <ul> <li>1...
<p>This is a union of segments computation. An optimal algorithm (in O(nlog(n))) consists in doing the following:</p> <ol start="2"> <li>sort all endpoints (starting and ending points) in a list L (each endpoint should know the segment it belongs to). If an endpoint is equal to a starting point, the starting point sho...
<p>What you need to do is simply check the ranges for overlap. If two ranges overlap, then they get merged into a single range. Ranges overlap if the right hand side of one range is greater than the left hand side of another. </p>
18,025
<p>In a <a href="https://stackoverflow.com/questions/112351/recommendations-for-starting-web-programming">related question</a>, I asked about Web Development. I came across something called <a href="http://www.openlaszlo.org/" rel="nofollow noreferrer">OpenLaszlo</a> yesterday and thought it looked interesting for doi...
<p>I worked on a website for about a year in which the entire UI was developed in Laszlo. I've also developed AJAX applications using JS frameworks such as JQuery, Prototype and Scriptaculous.</p> <p>In my experience, the total effort required is considerably less when using Laszlo, and the class-based object model he...
<p>I used openLaszlo to develop a few blog widgets for some friends of mine (about a year ago) and it was easy enough to get something basic working and it looked OK. But if I had to do it again, I would probably use <a href="http://www.adobe.com/products/flex/" rel="nofollow noreferrer">FLEX</a> I think you can make ...
16,840
<p>I just need a simple JSON or YAML (or other) text based format for recording the time I spend on tasks. I prefer to do as much work as possible in my text editor (e text editor) so it is more natural to me to stay in the editor and not switch back and forth to programs like Excel (plus this way I retain portable an...
<p>How about using XML? >:)</p>
<p>How about using XML? >:)</p>
22,640
<p>Related to this <a href="https://stackoverflow.com/questions/59075/how-do-i-save-each-sheet-in-an-excel-workbook-to-seperate-csv-files-with-a-macro">question</a>, how to save many different csv files into one excel workbook with one sheet per csv ? I would like to know how to do this programmatically in Java. </p>
<p>You'll need some form of library for accessing Excel from Java. A Google search turned this one up:</p> <p><a href="http://j-integra.intrinsyc.com/support/com/doc/excel_example.html" rel="nofollow noreferrer">http://j-integra.intrinsyc.com/support/com/doc/excel_example.html</a></p> <p>An alternative is to use the ...
<p>Take a look at the Aspose products, I've used them before when working with Excel and they saved me a huge amount of headache and time. Excel has several quirks that can make importing and exporting spreadsheets painful.</p> <p><a href="http://www.aspose.com/categories/file-format-components/aspose.cells-for-.net-...
28,483
<p>I have a large tree of Java Objects in my Desktop Application and am trying to decide on the best way of persisting them as a file to the file system.</p> <p>Some thoughts I've had were:</p> <ul> <li><p><strong>Roll my own serializer using DataOutputStream</strong>: This would give me the greatest control of what...
<p>I would go for the your final option JavaDB (Sun's distribution of <a href="http://db.apache.org/derby" rel="nofollow noreferrer">Derby</a>) and use an object relational layer like <a href="http://hibernate.org" rel="nofollow noreferrer">Hibernate</a> or <a href="http://ibatis.apache.org" rel="nofollow noreferrer">i...
<p>I think it depends on what you need. Let's see the options:</p> <p>1) Descarded imediatelly! I'll not even justify. :)</p> <p>2) If you need a simple, quick, one-method persistence, stick with it. It will persist the complete data graph as it is! Beware of how long you'll be maintaning the persisted objects. As yo...
5,792
<p>I'm looking to 3D print a structure that won't deform in high heat, up to about 220&nbsp;&deg;C. The filament itself can be 3D printed all the way up to about 380&nbsp;&deg;C. </p> <p>PEI seems like it could be a viable option. I found some <a href="https://www.matterhackers.com/store/l/3dxtech-thermax-pei-175mm-05...
<p>Your expected operating temperature exceeds the glass transition temperature by 3&nbsp;&deg;C. This implies that the structure will become weak and can deform under load. </p> <p>Note that you cannot simply print PEI on a normal machine, it requires a special high temperature capable printer with hot end temperatur...
<p>An easier but less simple solution might be to make a PLA 'pattern' that is the right size and shape, then use that to cast your item in aluminium (melting point ~ 660C) using the 'investment' or 'lost PLA' process.<br> Links:- <a href="https://www.instructables.com/id/3D-Printed-Lost-PLA-Investment-Casting-Alumin...
1,449
<p>They both seem to fulfill the same purpose. When would I chose one over the other?</p>
<p>Use the events when you've got a thread that is waiting on one of or all of a number of events to do something.</p> <p>Use the monitor if you want to restrict access to a data structure by limiting how many threads can access it.</p> <p>Monitors usually protect a resource, whereas events tell you something's happe...
<p>This tutorial has detailed descriptions of what you'll need to know: <a href="http://www.albahari.com/threading/" rel="nofollow noreferrer">http://www.albahari.com/threading/</a></p> <p>In particular, this will cover the XXXResetEvent classes,<br> <a href="http://www.albahari.com/threading/part2.aspx" rel="nofollow...
19,115