instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I moved an ex-site based on joomla to wordpress. Import worked fine but the problem is that the old links don't work anymore. Because there is only 50 or so articles, i thought will be a good idea to put a rule for each post (in .htaccess).</p> <p>Well... Not always things are like you want, so redirects dont work ...
<p>Since the conversion of your site over to Wordpress is relatively new, is there anything preventing you from using the old Joomla! ID's in your WP database table? This would allow you to use a regex fairly easily.</p> <p>Another option would be to create a separate PHP script that handles the Joomla! URLs then redi...
<p>Another option might have been to use a redirection plugin to do this for you. Saves the solution breaking each time you change or update your theme.</p>
43,798
<p>I am looking to others who have successfully printed in ABS using a Wanhao Duplicator i3. </p> <p>I have tried and get a lot of warping and delamination. I tried putting a large box over the printer which did help with the warping some but I am still getting some layer separation. I used 235&nbsp;°C for the extrude...
<p>I am an official Wanhao Distributor</p> <p>By experience I can recommend you to print with this settings:</p> <ul> <li>Extruder 230 °C </li> <li>Heated Bed 65 °C</li> <li>Have a glass surface</li> <li>Use hairspray over the glass</li> <li>Continue to enclose the printer or at least put it where there is almost no ...
<p>I've had hit and miss success, but nothing I would consider great. I was using Hatchbox ABS with the extruder at 230&nbsp;°C and the bed at 65&nbsp;°C and a homemade enclosure. </p> <p>One thing that did help was making sure the HVAC vents near the printer were closed. </p>
277
<p>I wrote an application in Java and when it runs on one customer's computer running OS X The Save and Export buttons are disabled. (Everything else works in the application.)</p> <p>Both of these buttons open up a standard save file dialog.</p> <p>Any ideas?</p>
<p>The fact that these buttons open a file dialog probably has nothing to do with it being disabled. Buttons can end up being disabled for a number of reasons, </p> <ul> <li>its <code>setEnabled</code> can be called with <code>false</code>, </li> <li>when using an action, its <code>setEnabled</code> can be called wi...
<p>A stab in the dark, but most macs are still running Java 1.5; check if your current code misbehaves with Java 1.5 on your end. Maybe that's where you problem lies.</p>
12,997
<p>I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. </p> <p>YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to...
<p>YouTube provides an <a href="http://code.google.com/apis/youtube/flash_api_reference.html" rel="noreferrer">ActionScript API</a>.</p> <p>Using this, you could load the videos into Flash using their API and then have your Flash app create the annotations on a layer above the video. </p> <p>Or, alternatively, if you...
<p>The player itself has a <a href="http://code.google.com/apis/youtube/js_api_reference.html" rel="noreferrer">Javascript API</a> that might be useful for syncing the video if you choose to make your own <code>annotation-thingamajig</code>.</p>
2,266
<p>Using regular expressions, what is the simplest way to fetch a websites HTML and find the value inside this tag (or any attribute's value for that matter):</p> <pre><code>&lt;html&gt; &lt;head&gt; [snip] &lt;meta name="generator" value="thevalue i'm looking for" /&gt; [snip] </code></pre>
<p>Depends on how sophisticated of an Http request you need to build (authentication, etc). Here's one simple way I've seen used in the past. </p> <pre><code>StringBuilder html = new StringBuilder(); java.net.URL url = new URL("http://www.google.com/"); BufferedReader input = null; try { input new BufferedReader( ...
<p>You may want to check the documentation for Apache's org.apache.commons.HttpClient package and the related packages <a href="http://hc.apache.org/httpclient-3.x/apidocs/index.html" rel="nofollow noreferrer">here</a>. Sending an HTTP request from a Java application is pretty easy to do. Poking through the documenta...
5,136
<p>A Java6 application sits in the system tray. It needs to be activated using a hotkey (e.g. Super-G or Ctrl-Shift-L etc) and do something (e.g. showing an input box).</p> <h2>How do I do that on:</h2> <ul> <li>Windows (XP or Vista)</li> <li>OS/X</li> <li>Linux (Gnome or KDE)</li> </ul>
<p>I've compiled a library for global hotkeys in java using JNA. It currently supports Windows, Linux and Mac OSX. It also supports media keys on windows and linux.</p> <p>if anyone is interested, try <a href="https://github.com/tulskiy/jkeymaster" rel="noreferrer">https://github.com/tulskiy/jkeymaster</a> </p> <p>I ...
<p>I've written a Java library for global key/mouse events here. This works for Windows, Linux X11, and OSX.</p> <p><a href="https://github.com/repeats/SimpleNativeHooks" rel="nofollow noreferrer">https://github.com/repeats/SimpleNativeHooks</a></p>
10,505
<p>I want a way to list files in a directory and putting a check box beside each one of them so I can select some of them and perform operations with each selected file, what's the best way to do this?</p>
<p>Drop a CheckedListBox control onto the form, then populate the contents using the DirectoryInfo and FileSystemInfo classes, like this:</p> <pre><code>System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("c:\\"); System.IO.FileSystemInfo[] files = di.GetFileSystemInfos(); checkedListBox1.Items.AddRange(files); <...
<p>Check out <a href="http://www.ssware.com/fileview/fileview.htm" rel="nofollow noreferrer">FileView Control</a> It can show files/folders with check boxes.</p>
42,148
<p>I have the following very simple Javascript-compatible regular expression:</p> <pre><code>&lt;script type="text/javascript" id="(.+)" src="([^"]+)"&gt; </code></pre> <p>I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that th...
<p>Disclaimer: Be careful with regular expressions and HTML source code. It's brittle and therefore easily broken or circumvented, you should not even think of using it to validate user input. </p> <p>If you are sincere of the source data and know it conforms to the rules of well-formed HTML, you can use this:</p> <p...
<p>Try the following:</p> <pre><code>&lt;script\s*\S*\s*(id="([^"]+)")?\s*\S*\s*(src="([^"]+)")\s*\S*\s*(id="([^"]+)")?[^&gt;]*&gt; </code></pre> <p>since you don't care about the type, just remove it because it makes things more complicated. And then just brute force the rest by adding two optional ID's on either s...
42,975
<p>Subversion lets you embed working copies of other repositories using <a href="http://svnbook.red-bean.com/en/1.1/ch07s04.html" rel="nofollow noreferrer">externals</a>, allowing easy version control of third-party library software in your project.</p> <p>While these seem ideal for the reuse of libraries and version ...
<p>I am the author of the quote in the question, which came from a <a href="https://stackoverflow.com/questions/222827/how-do-you-organize-your-version-control-repository#304036">previous answer</a>.</p> <p>Jason is right to be suspicious of brief statements such as mine, and to ask for an explanation. Of course, if ...
<p>Saying that <em>a is b</em> does not make <em>a</em> a <em>b</em> unless you say <em>why</em> this is so.</p> <p>The main flaw I see with external references in subversion is that you're not guaranteed that the repository is present when you update your working copy.</p> <p>Subversion external references can be us...
43,992
<p>Is there an easy or straightforward way in Java to output the results of a DB Query to a file (either csv, tab, etc). Perhaps even in Hibernate?</p> <p>I know that a query results can be dumped to a flat file on the DB Server. I am looking for a way that an application can run a query and get those results into a...
<p>You can change the EntityMode of your Session to "DOM4J" so that Hibernate will return the data represented as an XML document instead of a POJO graph.</p> <pre><code>xmlSession = session.getSession(EntityMode.DOM4J); Element elem = (Element) xmlSession.load(SomePersistentClass.class, id); System.out.println(elem.a...
<p>I seem to remember IntelliJ's JDBC db explorer having the ability to export the results of queries. I wouldn't be surprised if an Eclipse or Netbeans DB plugin or can do the same. Here's a whole bunch of <a href="http://java-source.net/open-source/sql-clients" rel="nofollow noreferrer">open source clients</a>.</p> ...
47,580
<p>I've created a web application that I've hosted with IIS 7 on a Windows Server 2008 machine. I've loaded a security certificate for secure.xxxxx.com.</p> <p><a href="http://img401.imageshack.us/img401/324/certxx6.gif" rel="nofollow noreferrer">IIS 7 Server Certificates http://img401.imageshack.us/img401/324/certxx...
<p>I found the solution at <a href="http://forums.iis.net/t/1151141.aspx" rel="noreferrer">forums.iis.net</a>.</p> <p>In IIS I modified the SSL Settings for my web site.</p> <p><a href="http://img183.imageshack.us/img183/8808/ssl1uc7.gif" rel="noreferrer">IIS SSL Settings icon http://img183.imageshack.us/img183/8808/...
<p>A SSL connection where the server presents a certificate and the user is required to present a certificate is considered 2-way SSL. Governments and businesses are the ones who usually use it the most.</p>
25,146
<p>I have recently inherited a couple of applications that run as windows services, and I am having problems providing a gui (accessible from a context menu in system tray) with both of them.</p> <p>The reason why we need a gui for a windows service is in order to be able to re-configure the behaviour of the windows s...
<p>After fighting this message for days, a friend told me that you MUST use the Release build. When I InstallUtil the Debug build, it gives this message. The Release build Starts fine.</p>
<p>I had this problem too. I made it to work by changing Log On account to Local System Account. In my project I had it setup to run as Local Service account. So when I installed it, by default it was using Local Service. I'm using .net 2.0 and VS 2005. So installing .net 1.1 SP1 wouldn't have helped. </p>
19,148
<p>On AS400 in interactive SQL in a 5250 session,</p> <pre><code>select * from myfile </code></pre> <p>returns rows from one member only when myfile has more than one member.</p> <p>How can I get rows from a specific member?</p> <p>Important: in the end I'd like to do this over JDBC with jt400 so really I want a so...
<p>You can create an alias using the create alias command:</p> <pre><code>CREATE ALIAS myLibrary/myAlias FOR memberLibrary/memberFile(memberName) </code></pre> <p>This will allow you to run sql against that member using the alias like you would any other file:</p> <pre><code>SELECT * FROM myLibrary/myAlias </code></...
<p>SQL Alias </p> <p><code>OS/400 R430</code> and later support an <code>SQL</code> alias statement. Create an alias for each member that must be accessed, then reference the alias from the application. The alias is a persistent object -- it must be created only once. The member referenced in the <code>CREATE ALIAS</c...
45,084
<p>Why should companies invest in refactoring components, though it is not going to add any new feature to the product ?</p> <p>I agree it is to clean the code, fix bugs and remove dead code - but what is the take ?? </p>
<p>Maintenance. It will reduce your maintenance costs significantly. There is no comparison between fully factored code and the junk that sits in most companies repositories. The latter is virtually worthless, while the former is gold.</p>
<p>To start off with: Refactoring is a tax. If the code works, then you are spending time fixing code that already works, I can see the business types looking quizzical now. A saying I like is "Legacy is another word for code that works."</p> <p>Now there are many problems with a growing code base that need to be ad...
38,373
<p>I am trying to call a Actionscript function from javascript but I am having problems in Internet Explorer. I am using Swiff.remote in mootools 1.2.1 to call the actionscript function ie:</p> <pre><code>Swiff.remote(playSwf.toElement(), 'sendResult', result, plays, name); </code></pre> <p>This all works fine in Fir...
<p>I'm not familiar with the Swiff plugin, but you don't need a plugin to call flash functions from Javascript. It's even easier to do it natively. </p> <p>From AS:</p> <pre><code>//1. calling javascript function from Flash. ExternalInterface.call("sendData",tempStr); // argument 1: javascript function, argument 2: d...
<p>Wanted to post this answer, as this <em>may</em> be what's causing problems for others, obviously this is not causing your problem. Still looking into a solution for your issue.</p> <p>From the MooTools Docs: <a href="http://mootools.net/docs/Utilities/Swiff" rel="nofollow noreferrer">http://mootools.net/docs/Utili...
38,413
<p>How do I uninstall a .NET Windows Service if the service files do not exist anymore?</p> <p>I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run</p> <pre><code> InstallUtil /u </code></pre> <p>first, so the service is still listed in the Services MMC.</p> <p>Do I hav...
<p>You have at least three options. I have presented them in order of usage preference.</p> <p><strong>Method 1</strong> - You can use the <a href="http://support.microsoft.com/kb/251192" rel="noreferrer">SC tool</a> (Sc.exe) included in the Resource Kit. (included with Windows 7/8)</p> <p>Open a Command Prompt and...
<p>You can uninstall your windows service by command prompt also just write this piece of command</p> <pre><code>cd\ cd C:\Windows\Microsoft.NET\Framework\v4.0.30319(or version in which you developed your service) ...
24,087
<p>What can I do to comprehensively validate an Australian Phone Number? I need this for an application I'm writing. You can assume it is dialed from within Australia. I want to use a white-list approach.</p> <p>Here are my rules so far (after removing any whitespace):-</p> <ol> <li>Starts with 13 and is 6 digits l...
<p>I did a similar thing a while ago. The Wikipedia page that unthinkableMayhem mentioned was a great starting point.</p> <p>As of a year ago, my rules looked something like:</p> <pre><code>02[3-9]\d{7} NSW/ACT 03[4-9]\d{7} VIC/TAS 07[3-9]\d{7} QLD 08\d{8} SA/NT/WA 04[\d]{8} Moblies 04x[123] = Optus, ...
<p>I'd be tempted to remove the parentheses as well. I still see phone numbers written like "(0212) 34 5678" every once in a while.</p> <p>Are there still 008 numbers in use? How about 1800? I think that's a valid prefix similar to 1300 nowadays.</p>
41,744
<p>In my example below I'm using a <code>dijit.form.DateTextBox</code>:</p> <pre><code>&lt;input type="text" name="startDate" dojoType="dijit.form.DateTextBox" constraints="{datePattern:'MM/dd/yyyy'}" value='&lt;c:out value="${sessionScope.adminMessageForm.startDate}"/&gt;' /&gt; </code></pre> <p>So for example, if ...
<p>Try overriding the validate method in your markup.</p> <p>This will work (just tested):</p> <pre><code>&lt;input type="text" name="startDate" dojoType="dijit.form.DateTextBox" constraints="{datePattern:'MM/dd/yyyy'}" value='&lt;c:out value="${sessionScope.adminMessageForm.startDate}"/&gt;' validate='retur...
<p>My only suggestion is to programmatically remove the dojoType on the server-side or client-side. It is not possible to keep the dojoType and not have it validate. Unless you create your own type that has you logic in it.</p>
3,633
<p>Is there a way to get a <code>DrawingContext</code> (or something similar) for a <code>WriteableBitmap</code>? I.e. something to allow you to call simple <code>DrawLine</code>/<code>DrawRectangle</code>/etc kinds of methods, rather than manipulate the raw pixels directly.</p>
<p>I found sixlettervariables' solution the most workable one. However, there's a "drawingContext.Close()" missing. According to MSDN, "A DrawingContext must be closed before its content can be rendered". The result is the following utility function:</p> <pre><code>public static BitmapSource CreateBitmap( int widt...
<p>A different way to solve this problem is to use a <code>RenderTargetBitmap</code> as a backing store, just like in the <code>WriteableBitmap</code> example. Then you can create and issue WPF drawing commands to it whenever you want. For example:</p> <pre><code>// create the backing store in a constructor var backin...
11,413
<p>Warm Standby SQL Server/Web Server</p> <p>This question might fall into the IT category but as the lead developer I must come up with a solution to integration as well as pure software issues.</p> <p>We just moved our web server off site and now I would like to keep a warm standby of both the website and database ...
<p>If you want a remote standby you probably want to look into a log shipping solution. </p> <p><a href="http://msmvps.com/blogs/omar/archive/2006/09/15/How-to-setup-SQL-Server-2005-Transaction-Log-Ship-on-large-database-that-really-works.aspx" rel="nofollow noreferrer">This article</a> may help you out. In the past I...
<p>I've heard good things about Syncback:</p> <p><a href="http://www.2brightsparks.com/syncback/sbpro-features.html" rel="nofollow noreferrer">http://www.2brightsparks.com/syncback/sbpro-features.html</a></p>
36,050
<p>I'm very new to 3D printing, but so far I've been able to print a couple things off Thingiverse without issue. However, as I'm trying to print another part, I've run into a situation where Cura is totally confused as to what's touching the buildplate and what isn't:</p> <p><a href="https://i.stack.imgur.com/j56yL.p...
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p> <p>You might just caught a bug, you could post that of their forum.</p> <p>Update: <...
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p> <p>You might just caught a bug, you could post that of their forum.</p> <p>Update: <...
977
<p>I have a multiple platform application set, with some applications running on Linux and some on Windows. I want to accomplish the following build:</p> <p>Server L runs CruiseControl with Project A, a Linux-only server application. This should build first.</p> <p>If Project A builds successfully, it needs to some...
<p>Having Project A build is straight forward. In the publishing phase write a file to a network drive.</p> <p>Project B can use the files system source control block to monitor the network file system, and trigger a build based on the change from Project A. When it is done it writes another file to the file system (...
<p>Are you mixing CruiseControl and CruiseControl.Net? For CruiseControl.Net-only setup, just use <a href="http://confluence.public.thoughtworks.org/display/CCNET/Project+Trigger" rel="nofollow noreferrer">Project Trigger</a>.</p>
35,870
<p>The DB load on my site is getting really high so it is time for me to cache common queries that are being called 1000s of times an hour where the results are not changing. So for instance on my city model I do the following: </p> <pre><code>def self.fetch(id) Rails.cache.fetch("city_#{id}") { City.find(id) } ...
<p>With respect to the caching, a couple of minor points:</p> <p>It's worth using slash for separation of object type and id, which is rails convention. Even better, ActiveRecord models provide the cacke_key instance method which will provide a unique identifier of table name and id, "cities/13" etc.</p> <p>One minor...
<p>Check out <a href="http://github.com/netshade/cached_model/tree/master" rel="nofollow noreferrer">cached_model</a></p>
44,846
<p>Within an unordered list:</p> <pre><code>&lt;li&gt;&lt;span&gt;&lt;/span&gt; The lazy dog.&lt;/li&gt; &lt;li&gt;&lt;span&gt;AND&lt;/span&gt; The lazy cat.&lt;/li&gt; &lt;li&gt;&lt;span&gt;OR&lt;/span&gt; The active goldfish.&lt;/li&gt; </code></pre> <p>Adding a class or style attribute is permitted but padding the...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>ul { list-style-type: none; padding-left: 0px; } ul li span { float: left; width: 40px; }</code></pre> <pre cl...
<p>Well, there's always the brute force method:</p> <pre><code>&lt;li&gt;&lt;pre&gt; The lazy dog.&lt;/pre&gt;&lt;/li&gt; &lt;li&gt;&lt;pre&gt;AND The lazy cat.&lt;/pre&gt;&lt;/li&gt; &lt;li&gt;&lt;pre&gt;OR The active goldfish.&lt;/pre&gt;&lt;/li&gt; </code></pre> <p>Or is that what you meant by "padding" the te...
32,129
<p>I'm getting the error below when trying to loop through a listbox and then remove the item.</p> <blockquote> <p>List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.</p> </blockquote> <pre><code>foreach (string s in listBox1.Items) { MessageBox.S...
<p>Do you want to remove all items? If so, do the <code>foreach</code> first, then just use <code>Items.Clear()</code> to remove all of them afterwards.</p> <p>Otherwise, perhaps loop backwards by indexer:</p> <pre><code>listBox1.BeginUpdate(); try { for(int i = listBox1.Items.Count - 1; i &gt;= 0 ; i--) { // ...
<p>You can't make modification to the collection being iterated within the ForEach block.</p> <p>A quick fix is to iterate over a copy of the collection. An easy way to make this copy is through the ArrayList constructor. The DataRowView objects in the copied collection will refer to, and be able to modify, the same...
49,857
<p>I'm running a stock Ender 5 pro with the filament that came with it, and using Creality Slicer 4.8.2, but I'm only able to get reliable bed adhesion if I increase the bed temperature from 50 to 60 °C for the bottom layer and decrease the print head speed by about 75 % from the default profile for the Ender 5.</p> <p...
<p>Your bed is too low - raise it by turning the knobs underneath.</p> <p>The first layer should not look like strings sitting on the bed as per your photo. Instead it should be a wider strip that looks somewhat like an electronic circuit trace, or like someone has pushed wet paint out of a tube that is being wiped ac...
<p>Assuming Creality's stock firmware still doesn't have Linear Advance enabled, there's a fairly hard requirement to go slow on the first layer. This is because, as the toolhead accelerates up to higher speed without advancing the extruder extra to compensate for the backpressure in the filament-path/nozzle, you'll ha...
2,090
<p>Here's a simplified version of what I'm trying to do :</p> <ol> <li>Before any other actions are performed, present the user with a form to retrieve a string.</li> <li>Input the string, and then redirect to the default controller action (e.g. index). The string only needs to exist, no other validations are necessa...
<p>Part of the problem is that you aren't setting @string. You don't really need the before_filter for this at all, and should just be able to use:</p> <pre><code>def get_string @string = params[:string] || session[:string] respond_to do |format| if @string format.html {redirect_to(accounts_url)} # au...
<p>It looks like me like your missing a rails concept. Every single page the user sees is a different request. </p> <p>I might have missunderstood what you are trying to do. But it seems to me you want the user to see two pages, </p> <ol> <li>In the first page they set a string variable </li> <li>In the second page t...
13,229
<p>I'd like to prefix this question with the fact that I know virtually nothing about 3D printers, aside from the general principles of how they work.</p> <p>I've recently seen that SLS printers have become more affordable, to the point where in a few years they might be a compelling investment. I'm mainly interested ...
<h2>Consumer Market?</h2> <p>While there are no &quot;consumer level&quot; SLS printers on the market currently, the question in itself is very interesting on a scientific level. The pricing edges for the consumer market for 3D printers can be somewhat estimated from the consumer electronics segment. This puts a maximu...
<p>It's difficult to tell from your photo the level of detail required. A scale reference in the form of a metric ruler would be valuable. If, for example, the metallic eye on the gunner is 2 mm diameter, that would be 40 layers of 50 micron grains, allowing for substantial detail.</p> <p>Consumer level SLS printers, ...
1,585
<p>In a web application, is it acceptable to use HTML in your code (non-scripted languages, Java, .NET)?</p> <p>There are two major sub questions:</p> <ol> <li>Should you use code to print HTML, or otherwise directly create HTML that is displayed?</li> <li>Should you mix code within your HTML pages?</li> </ol>
<p>Generally, it's better to keep presentation (HTML) separate from logic ("back-end" code). Your code is decoupled and easier to maintain this way.</p>
<p>Its fugly, and not type safe. But people do it without consequence. I'd prefer using a DOM or, at a minimum, classes designed to write HTML using type safe semantics. Also, its not all that good to mix UI with logic...</p>
9,035
<p>I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error:</p> <p>Metadata file 'System.Data.Linq.dll' could not be found</p> <p>My code looks like:</p> <pre><code>CompilerParameters compilerParams = new CompilerParameters(); compile...
<p>That may be because this assembly is stored in a different location than mscorlib is. It should work if you provide a full path to the assembly. The most convenient way to get the full path is to let the .NET loader do the work for you. I would try something like this:</p> <pre><code>compilerParams.ReferencedAss...
<p>This may be a silly answer, but are you sure the code is running on a machine with .NET Framework 3.5?</p>
8,577
<p>I have a View that allows a user to enter/edit data for a new Widget. I'd like to form up that data into a json object and send it to my controller via AJAX so I can do the validation on the server without a postback.</p> <p>I've got it all working, except I can't figure out how to pass the data so my controller m...
<p>Thanks Jeff, that got me on the right path. The DefaultModelBinder is smart enough to do all the magic for me...my problem was in my Widget type. In my haste, my type was defined as:</p> <pre><code>public class Widget { public int Id; public string Name; public decimal Price; } </code></pre> <p>Notice t...
<p>What you want to do is structure your javascript form object in the same way your backend object is structured:</p> <pre><code>{ Id : "id", Name : "name", Price : 1.0 } </code></pre> <p>Then use the toJSON plugin to convert it into the above string. You send this string to your backend and use something like the J...
33,579
<p>I know that default cron's behavior is to send normal and error output to cron's owner local email box.</p> <p>Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?</p>
<p>You could chuck file redirection onto either the command shown or the actual command in the crontab for both stdout and stderr - like <code>command &gt; /tmp/log.txt 2&gt;&amp;1</code> .</p> <p>If you want several users to receive this log, you could insert a <code>MAILTO=nameofmailinglist</code> at the top of you ...
<p>The cron line is just like any other unix command line so you can redirect output to another program. Ie.</p> <pre><code>* * * * * /path/my/command &gt; /my/email/script 2&amp;&gt;1 </code></pre>
6,496
<p>One of the really nice things about python is the simplicity with which you can name variables that have the same name as the accessor:</p> <pre><code>self.__value = 1 def value(): return self.__value </code></pre> <p>Is there a simple way of providing access to the private members of a class that I wish to s...
<p>Not conveniently, without further breaking encapsulation. The double-underscore attribute is name-mangled by prepending '_ClassName' for the class it is being accessed in. So, if you have a 'ContainerThing' class that has a '__value' attribute, the attribute is actually being stored as '<code>_ContainerThing__value<...
<p>Not sure of where to cite it from, but the following statement in regard to access protection is Pythonic canon: "We're all consenting adults here".</p> <p>Just as Thomas Wouters has stated, a single leading underscore is the idiomatic way of marking an attribute as being a part of the object's internal state. Two...
19,686
<p>I'm having the trouble finding the wording, but is it possible to provide a SQL query to a MS SQL server and retrieve the results asynchronously?</p> <p>I'd like to submit the query from a web request, but I'd like the web process to terminate while the SQL server continues processing the query and dumps the result...
<p>This really depends on how you are communicating with the DB. With ADO.NET you can make a command execution run asynchronously. If you were looking to do this outside the scope of some library built to do it you could insert a record into a job table and then have SQL Agent poll the table and then run your work as a...
<p>It's a complicated topic to be able to execute a stored procedure and then asynchronously retrieve the result. It's not really for the faint of heart and my first recommendation would be to reexamine your design and be certain that you in fact need to asynchronously process your request in the data tier.</p> <p>Dep...
47,185
<p>Does anyone know of a library or bit of code that converts British English to American English and vice versa?</p> <p>I don't imagine there's too many differences (some examples that come to mind are doughnut/donut, colour/color, grey/gray, localised/localized) but it would be nice to be able to provide localised s...
<p>I've been working on one to convert US English to UK English. As I've discovered it's actually a lot harder to write something to convert the other way but I hope to get around to providing a reverse conversion one day.</p> <p>This isn't perfect, but it's not a bad effort (even if I do say so myself). It'll convert...
<p>I think if you're thinking of converting from American English to British English, I personally wouldn't bother. Britain is very Americanised anyway, we accept silly yank spellings on the net :)</p>
14,547
<p>Is there a good method for writing C / C++ function headers with default parameters that are function calls? </p> <p>I have some header with the function:</p> <pre><code>int foo(int x, int y = 0); </code></pre> <p>I am working in a large code base where many functions call this function and depend on this default...
<p>Go figure! It does work. <a href="http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/cplr237.htm" rel="noreferrer">Default arguments in C++ functions</a></p>
<p>Try making bar() a static member function. This will allow any part of the program which has such a static class in scope to access it. For example:</p> <p>class Foo { public:</p> <p>static int bar(); };</p> <p>Then you would declare:</p> <p>int foo(int x, int y = Foo::bar());</p> <p>If you need different obj...
24,796
<p>Is there a nicer way of styling a <code>&lt;hr /&gt;</code> tag using CSS, that is cross-browser consistent and doesn't involve wrapping a <code>div</code> around it? I'm struggling to find one.</p> <p>The best way I have found, is as follows:</p> <p><strong>CSS</strong></p> <pre><code>.hr { height:20px; ...
<p>The classic way of doing this is creating a wrapper around the &lt;hr&gt; and styling that. But I have come up a CSS trick for image replacing the element without the need for extra markup:</p> <p>For non MSIE browsers:</p> <pre><code>hr { border : 0; height : 15px; background : url(hr.gif) 0 0 no-repeat;...
<p>If you set display to <code>block</code> it should behave more like a <code>&lt;div&gt;</code>.</p> <p>Your answer you should remove hr altogether and just use the <code>div</code></p>
26,840
<p>I use Prusa i3 with one extruder for some years and I would like to print from one material in two colors or from different materials for one model. Therefore I'm lookig for new printer with dual extruder.</p> <p>Is there some way how to measure and/or compare quality of printers with dual extruder on the market?</...
<p>As you suggest yourself, ordering test prints of some model is one way to do it. </p> <p><a href="https://www.3dhubs.com">3D Hubs</a> and <a href="https://www.makexyz.com/">MakeXYZ</a> allows you to get your model printed by hobbyists and small businesses for a fair price. Both sites also allow you to order prints ...
<p>"Make" Magazine compares 3-D printers in a way that is as scientific as possible to help determine the strengths/weaknesses of each 3-D printer compared to others. The link to the November 2015 comparison test is available here: <a href="http://makezine.com/comparison/3dprinters/" rel="nofollow">http://makezine.com/...
288
<p>There are two scenarios I need to clarify:</p> <ol> <li><p>An executable compiled with .NET 3.5 needs to use a library compiled with .NET 1.1 and the library must run on the 1.1 runtime.</p></li> <li><p>An executable compiled with .NET 1.1 needs to use a library compiled with .NET 3.5.</p></li> </ol> <p>I cannot f...
<p>No -- you can't load the CLR into the same process twice. See the documentation for <a href="http://msdn.microsoft.com/en-us/library/zaf1h1h5.aspx" rel="noreferrer">CLR Hosting</a></p> <blockquote> <p>As with earlier versions of the runtime, the CorBindToRuntimeEx function initializes the runtime. You can c...
<p>For case #1, is there any particular reason (say, breaking changes) which requires the library to be hosted in the 1.1 runtime? Is it possible to expose the library via a 1.1-compiled web service, and have the executable point to the web service instead? (Or some other remoting technique, to get the library in its o...
24,629
<p>I currently have a relatively small (4 or 5 tables, 5000 rows) MySQL database that I would like to convert to an sqlite database. As I'd potentially have to do this more than once, I'd be grateful if anyone could recommend any useful tools, or at least any easily-replicated method.</p> <p>(I have complete admin ac...
<p>I've had to do similar things a few times. The easiest approach for me has been to write a script that pulls from one data source and produces an output for the new data source. Just do a <code>SELECT *</code> query for each table in your current database, and then dump all the rows into an <code>INSERT INTO</code...
<p>If it's just a few tables you could probably script this in your preferred scripting langauge and have it all done by the time it'd take to read all the replies or track down a suitable tool. I would any way. :)</p>
2,881
<p>I've come back to using NHibernate after using other technologies (<a href="http://www.lhotka.net/" rel="nofollow noreferrer">CSLA</a> and <a href="http://subsonicproject.com/" rel="nofollow noreferrer">Subsonic</a>) for a couple of years, and I'm finding the querying a bit frustrating, especially when compared to S...
<p>The thing with LINQ for NHibernate is still in beta; I'm looking forward to NHibernate 2.1, where they say it will finally make the cut.</p> <p>I made a presentation on LINQ for NHibernate around a month ago, you might find it useful. I blogged about it here, including slides and code:</p> <p><a href="http://dotne...
<p>scrap nHibernate and go back to Subsonic if you can. In my opinion, Subsonic is a far more fluent and testable ORM/DAL. I absolutely hate HQL what's the point of a weakly typed query in an ORM? And why would I use Linq/nH/SQL when I can just use Linq to SQL and cut out a layer?</p> <p>nHibernate was a good ORM w...
6,500
<p>As the title mentions, I have a timeout callback handler on an ajax call, and I want to be able to test that condition but nothing is coming to mind immediately on ways I can force my application to hit that state, any suggestions?</p>
<p>First off, I think you need to be clearer in your question - what technology are you using and where is this process that is timing out - server-side or client-side?</p> <p>If you want to have the server-side code take a long time and you are using .NET, place this line in the method you call server-side:</p> <pre...
<p><a href="http://developer.yahoo.com/yui/connection/" rel="nofollow noreferrer">YUI Connection Manager</a> allows you to introduce slowdown in your Javascript to test AJAX against latency.</p>
4,312
<p>Got a Cocoa video capture app that works fine in 10.4. It uses NSThread to start the video capture driver. When app just started, video capture is very slow ( 1-2 fps). But after resize the UI window (or bring the window from background to foreground), video capture speed is back to normal. This only happens in 10.5...
<p>Not sure specifically why, but you should be using Instruments to figure out what's going on</p>
<p>We have an application that uses multithreaded video capture and recording similar to what you describe. We use libdc1394 for the capture from a Firewire camera, an NSOpenGLView for display, and QuickTime for the video encoding. Capture from the camera is on a separate thread from the OpenGL video display and the ...
33,119
<p>In Java projects in Eclipse version 3.4.1 sometimes the folder "Referenced Libraries" disappears from the "Project Explorer" view. All third party jars are shown directly in the root of the project folder. The project compiles and runs fine. It seems to be a GUI problem.</p> <p>How can I get this folder back?</p>
<p>First, bring up the "Package Explorer" view (instead of the "Project Explorer" view).</p> <p>Then, if the referenced .jar files still are visible in the root of the project, click on the little "down arrow" icon in the top-right corner of the Package Explorer view. In the context menu that appears, one of the items...
<p>Use the Package Explorer view instead of the Project Explorer view.</p>
16,260
<p>Let's say you already "know" what your client wants from you (i.e. you already did some analysis and have some clue about what are you supposed to deliver). What are the next steps you usually go through after this phase? In other words, what are the steps (in terms of preparation of the framework, plugins, reposito...
<p>The first thing that we usually do here at work is to get a <strong>hosted virtual private server (VPS)</strong> as a <strong>development server</strong> (slicehost? whatever that fits your pocket) where you can ssh into and configure the following</p> <ol> <li>Setup up <strong>server combination</strong> of your c...
<p>So you're looking at wireframes, UMLs, thinking what next? Piston and rake are good for bulk-installing your favorite plugins (not sure how well piston works with git right now): </p> <p><a href="http://devblog.rorcraft.com/2007/5/20/a-plugin-for-installing-plugins" rel="nofollow noreferrer">http://devblog.rorcraf...
22,666
<p>Visual Studio does it; Reflector does it; and now I want to as well :)</p> <p>I want to retrieve the XML documentation for some members in some framework assemblies (i.e. <code>mscorlib.dll</code>, <code>System.dll</code>, etc). I assume this would involve:</p> <ul> <li>finding the XML file for the assembly, </li>...
<p><strong>Find xml</strong></p> <p>For assembly.dll it is named as assembly.xml, but installed by Framework SDK, Runtime itself doesn't contain .xml files. Users do not need API documentation. </p> <p>Location is a bit more complex. It can be side by side with the dll, in the subdirectory named after current locale ...
<p>The XML file is named exactly like the assembly's file, except for the different 'xml' extension and must be located in the same directory as the assembly itself.</p> <p>Can't help you with the other two questions, though. AFAIK, you're on your own...</p>
28,582
<p>I have some forms that communicate with server using AJAX for real reasons: cascade combos, suggestions, multiple correlated selections (e.g. I have {elementary} knowledge of {French} [add], and {good} knowledge of {German} [add]...). I also have some regular fields that I handle trough get. </p> <p>Thing is that o...
<p>User experience is an important part of any software product. If you can improve the experience by providing better interactions, there's no reason not to do it. </p> <p>Make sure though that you write <a href="http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/" rel="nofollow noreferrer">unobtrusive...
<p>The only problem with this strategy is that you're in a lot deeper trouble if someone decides they want a non-javascript solution as well. I think it's fairly wise to use the "least fancy" mechanism that will get the desired result on the web. If it's just a form post, then keep it a form post unless there's a reaso...
42,478
<p>Is there any software to help in learning / understanding / experimenting with the rules of harmony and counterpoint?</p>
<p>Bach-style 4 part harmony actually does follow some pretty rigid rules (no parallel 4ths, 5th or octaves, for example), and once you get your head around the rules it is a fairly trivial matter to harmonise a melody in four parts. That was the way I was taught at A-Level in the UK, and we weren't supposed to deviat...
<p>While very carefully coded applications could give you some hints, I find that the most important lesson is when to break the rules. And a computer program could never help with that.</p> <p>I suggest you buy a book instead. Good ones include</p> <ul> <li><a href="https://rads.stackoverflow.com/amzn/click/com/0486...
35,764
<p>I'm looking for a clear, concise and accurate answer. </p> <p>Ideally as the actual answer, although links to good explanations welcome.</p>
<p>Boxed values are <a href="http://en.wikipedia.org/wiki/Data_structure" rel="noreferrer">data structures</a> that are minimal wrappers around <a href="http://en.wikipedia.org/wiki/Primitive_type" rel="noreferrer">primitive types</a>*. Boxed values are typically stored as pointers to objects on <a href="http://en.wik...
<p>Like anything else, autoboxing can be problematic if not used carefully. The classic is to end up with a NullPointerException and not be able to track it down. Even with a debugger. Try this:</p> <pre><code>public class TestAutoboxNPE { public static void main(String[] args) { Integer i = null; ...
3,409
<p>In particular, would it be possible to have <strong>code similar to this c++ code executed at compile time in c#</strong>?</p> <pre><code>template &lt;int N&gt; struct Factorial { enum { value = N * Factorial&lt;N - 1&gt;::value }; }; template &lt;&gt; struct Factorial&lt;0&gt; { enum { value = 1 }; }; ...
<p>No, metaprogramming of this complexity is not supported directly by the C# language. However, like <a href="https://stackoverflow.com/questions/237326/is-metaprogramming-possible-in-c#237644">@littlegeek</a> said, the <a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVi...
<p>To a <strong>very</strong> limited extent, C# something that could be interpreted as meta-programming. But really it's nothing more than overload resolution. It's a real stretch to call it meta programming. </p> <p>Example:</p> <pre><code>static string SomeFunc&lt;T&gt;(T value) { return "Generic"; } static ...
29,373
<p>in the multi-threaded app I am porting to Symbian using Open C, I have an object that uses an RFile to read/write data to file. This object is supposed to be accessed from different threads (it is threadsafe), however there is the issue that apparently RFile objects can only be accessed within one thread only. As so...
<p>Create a second RFile handle (let's call it secondFile). Don't Open it. Use RFile::Duplicate(secondFile) instead. All the threads in your process should be able to use the secondFile handle after that.</p>
<p>You're looking for a combination of:</p> <ol> <li><p>Transfers an already open file from a server to a client</p> <pre><code>RFile::TransferToClient(const RMessage2 &amp;,TInt)const </code></pre></li> <li><p>Transfers an already open file to another process</p> <pre><code>RFile::TransferToProcess(RProcess &amp;,T...
27,204
<p>I had some site templates designed for me recently. I got the final HTML code, which validates, but the structure of the document is laid out using DL-DD pairs:</p> <pre><code>&lt;dl&gt; &lt;dd class="some-class"&gt; Some text. &lt;/dd&gt; &lt;/dl&gt; </code></pre> <p>I'm not especially familiar with those...
<p>From WC3: <a href="http://www.w3.org/TR/html401/struct/lists.html#h-10.3" rel="nofollow noreferrer">http://www.w3.org/TR/html401/struct/lists.html#h-10.3</a></p> <blockquote>Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is g...
<p>From WC3: <a href="http://www.w3.org/TR/html401/struct/lists.html#h-10.3" rel="nofollow noreferrer">http://www.w3.org/TR/html401/struct/lists.html#h-10.3</a></p> <blockquote>Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is g...
43,555
<p>How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations ...
<p>Finding text in a PDF can be inherently hard because of the graphical nature of the document format -- the letters you are searching for may not be contiguous in the file. That said, <a href="http://search.cpan.org/dist/CAM-PDF" rel="nofollow noreferrer">CAM::PDF</a> has some search-replace capabilities and heurist...
<p>Although it is quite an old thread. Just wanted to share a Node.js package option to search and replace text in PDF: <a href="https://products.aspose.cloud/pdf/nodejs" rel="nofollow noreferrer">Aspose.PDF Cloud SDK for Node.js</a>. It is paid product but it provides 150 free monthly API calls.</p> <pre><code> const ...
27,149
<p>It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example). How can this be done?</p>
<p>You need to use the <code>UIImagePickerController</code> class, basically:</p> <pre><code>UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = pickerDelegate picker.sourceType = UIImagePickerControllerSourceTypeCamera </code></pre> <p>The <code>pickerDelegate</code> object ab...
<p>Hmmmm.....Ever tried using an OverlayView? With this the camera might look customized but in actuality its just a view above it.</p> <p>If the private API's are directly accessed it might result in the app being rejected by Apple. See if the below link helps.</p> <p><a href="http://www.articlesbase.com/programming...
9,981
<p>In <a href="https://stackoverflow.com/questions/48669/are-there-any-tools-out-there-to-compare-the-structure-of-2-web-pages">this post</a> I asked if there were any tools that compare the structure (not actual content) of 2 HTML pages. I ask because I receive HTML templates from our designers, and frequently miss mi...
<p>The DOM is a data structure - it's a tree.</p>
<p>Open each page in the browser and save them as .htm files. Compare the two using windiff.</p>
11,240
<p>I would like to know how to filter files in a open file dialog (in winforms) based on a regular expression. Files have all same extensions (.xml). Big files are split up into several files with the same name only to be separated with _1 ... We only want to show the files without _1 (first data file)</p> <p>the ope...
<p><strong>I don't think you can do it</strong> with the OpenFileDialog's Filter property, which just filters list of files based on extension.</p> <p>I think you'll have to let the user choose an xml file, validate and then pop up the dialog again if its a _1 file. You can subscribe to the FileOK event and slot in th...
<p>I'm not sure how to do it in C# with WinForms, but in C++, what you would do is install a custom hook procedure and listen for the CDN_INCLUDEITEM notification. Then, you check each filename against your regex. See <a href="http://msdn.microsoft.com/en-us/library/ms646960(VS.85).aspx#_win32_Filters" rel="nofollow ...
17,904
<p>I can not distinguish the difference between aggregating and holding. What does it mean in terms of, let`s say, C++?<br> I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself.<br> For example:</p> <pre><code>class A { int state; public: ...
<p>Holding another class means that a class is associated with another class through a parent child relationship. For example a Path has a list of points. The Path is the parent of the List of Points which is the parent of the individual points.</p> <p>Aggregating means taking different classes and putting them behind...
<p>It's very much about ownership and visibility. There are different names for these relationships, but you should consider these two points:</p> <ul> <li><p>Does the parent have strict ownership over the child, such that when the parent dies, the child should die also?</p></li> <li><p>Is the child visible to other ...
48,125
<p>I keep getting an NHibernate.PersistentObjectException when calling session.Save() which is due to an uninitialized proxy passed to save(). If I fiddle with my cascade settings I can make it go away, but then child objects aren't being saved.</p> <p>The only other fix I have found is by adding the following to my ...
<p>Are you trying to work with a child object that is in a list on a root aggregate entity? If you are, you need to work with the root, traverse to the child, make the changes, and save the <em>root</em>, not the child.</p>
<p>Are you trying to work with a child object that is in a list on a root aggregate entity? If you are, you need to work with the root, traverse to the child, make the changes, and save the <em>root</em>, not the child.</p>
25,169
<p>I know the following libraries for drawing charts in an SWT/Eclipse RCP application:</p> <ul> <li><a href="http://www.eclipse.org/articles/article.php?file=Article-BIRTChartEngine/index.html" rel="noreferrer">Eclipse BIRT Chart Engine</a> (Links to an article on how to use it)</li> <li><a href="http://www.jfree.org...
<p>I have not used BIRT or JGraph, however I use JFreeChart in my SWT application. I have found the best way to use JFreeChart in SWT is by making a composite an AWT frame and using the AWT functionality for JFreeChart. The way to do this is by creating a composite </p> <pre><code>Composite comp = new Composite(parent...
<p>There's also JGraph, but I'm not sure if that's only for graphs (i.e. nodes and edges), or if it does charts also.</p>
4,285
<p>Is it possible in C# to see the traces in a separate console. For example, I am having a window based application in which there are trace statements that will write the currently executed method name in to the console. When I run this application, it should automatically open a console and start the traces. Is this...
<p>If you set the project type of your window application to Console, it will open a console window when you run it.</p>
<p>I'd recommend dbgview.exe from Sysinternals. It allows you to capture your trace output and save it to file (among other features).</p> <p>You can get it from <a href="http://live.sysinternals.com" rel="nofollow noreferrer">http://live.sysinternals.com</a></p>
32,636
<p>I need some help from the shell-script gurus out there.</p> <p>I have a .txt file (log) that traces the IP addresses of clients on several lines, in a format similar to this one:</p> <pre><code>Line1 - Client IP [192.168.0.1] Other data Line2 - Client IP [192.168.0.2] Other data Line3 - Client IP [192.168.0.3] Oth...
<p>In PowerShell:</p> <p>The Verbose Way - </p> <pre><code>$regex = '(?&lt;IPAddress&gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' get-content log.txt | where-object {if ($_ -match $regex){$matches.ipaddress}} | group-object -noelement </code></pre> <p>Shorter version</p> <pre><code>gc log.txt | % {if ($_ -match $regex){...
<p>If you can use Cygwin, there is little point to needing to worry about a Windows scripting solution.</p>
22,270
<p>When I run a Flex application in the debug flash player I get an exception pop up as soon as something unexpected happened. However when a customer uses the application he does not use the debug flash player. In this case he does not get an exception pop up, but he UI is not working.</p> <p>So for supportability re...
<p>There is no way to be notified on uncaught exceptions in Flex 3. Adobe are aware of the problem but I don't know if they plan on creating a workaround.</p> <p>The only solution as it stands is to put try/catch in logical places and make sure you are listening to the ERROR (or FAULT for webservices) event for anythi...
<p>Now you can, using loader info:</p> <p><a href="http://www.adobe.com/devnet/flex/articles/global-exception-handling.html" rel="nofollow noreferrer">http://www.adobe.com/devnet/flex/articles/global-exception-handling.html</a></p> <p>Checkout:</p> <pre><code>loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErro...
12,699
<p>So like many people, I'm excited about Ruby on Rails. Being a Windows user, I downloaded InstantRails, got it going, and followed along with the screencast on how to make a blog with RoR 2.0 in fifteen minutes. I used Notepad++ as my text editor, because that's what I've traditionally used for writing the PHP-based ...
<p>Pragmatic Programmer's <a href="http://pragprog.com/titles/rails2/agile-web-development-with-rails" rel="nofollow noreferrer">Agile Web Development with Rails</a> is an excellent book to get started with. </p> <p>There is a <a href="http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition" r...
<p>From what I've read, though, it looks like many of these books and such are now at least partially outdated with the advent of Rails 2.0. Is this true?</p>
46,040
<p>I'm not sure why I'm getting this error, but shouldn't this code compile, since I'm already checking to see if queue is getting initialized? </p> <pre><code>public static void Main(String[] args) { Byte maxSize; Queue queue; if(args.Length != 0) { if(Byte.TryParse(args[0], out maxSize)) ...
<p>The compiler doesn't know that the Environment.Exit() is going to terminate the program; it just sees you executing a static method on a class. Just initialize <code>queue</code> to null when you declare it.</p> <pre><code>Queue queue = null; </code></pre>
<p>The compiler only knows that the code is or isn't reachable if you use "return". Think of Environment.Exit() as a function that you call, and the compiler don't know that it will close the application.</p>
31,954
<p>I ran into an interesting behavior recently. It seems that if I override .equals() to take a parameter other than Object, it doesn't get called. Can anyone explain to me why this is happening? It seems to violate my understanding of polymorphism in OOP, but maybe I'm missing something.</p> <p>Here's much simpler...
<p>You're mixing up "overriding" and "overloading".</p> <p>Overriding -- adding a replacement definition of an existing method for purposes of polymorphism. The method must have the same signature. The signature consists of the name and argument types. Overridden methods are selected at runtime based on the runtime...
<p>Ok let me re-phrase.</p> <p>(1)Because the compiler eliminates all information regarding to Generics (erasure, see <a href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#Type%20Erasure" rel="nofollow noreferrer">here</a>), and (2) because you cannot override a method without the exact ...
39,927
<p>In particular from this web.config:</p> <pre><code>&lt;configuration&gt; &lt;configSections&gt; &lt;section name="RStrace" type="Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics" /&gt; &lt;/configSections&gt; &lt;system.diagnostics&gt; &lt;switches&...
<p>It looks like .NET was installed using a corporate re-packaging technology and not all the bits were there. We installed from the original Microsoft image and all is fine.</p>
<p>It's saying that it's finding the &lt;runtime> tag in you file, but doesn't know what to do with it. It may be in the wrong section.</p> <p>As &lt;runtime> is a standard web.config element, something screwy is going on. Try removing the RTrace section. If that works, restore the Rtrace section after the runtime ...
24,078
<p>On Sql Server 2000, is there a way to find out the date and time when a stored procedure was last executed? </p>
<p>If a stored procedure is still in the procedure cache, you can find the last time it was executed by querying the sys.dm_exec_query_stats DMV. In this example, I also cross apply to the sys.dm_exec_query_plan DMF in order to qualify the object id:</p> <pre><code>declare @proc_nm sysname -- select the procedure...
<p>Not without logging or tracing, I'm afraid</p>
15,881
<p>Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?</p>
<p>Go into 'Window' -> 'Preferences' then select 'Java' -> 'Installed JREs', clone the JRE used by Tomcat and add the following to the default VM Arguments</p> <pre><code>-Djava.security.manager -Djava.security.policy="XXXX\conf\catalina.policy" </code></pre> <p>With XXXX replaced by the appropriate path - Mine was <...
<p>I'm assuming that you're using Tomcat 5.5.x</p> <p>after looking at catalina.bat/catalina.sh, all the -security flag does is to set -Djava.security.policy=="%CATALINA_BASE%\conf\catalina.policy"</p> <p>Most people have CATALINA_BASE set to TOMCAT_HOME or CATALINA_HOME</p> <p>So, if you have installed tomcat in t...
21,826
<p>The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important?</p>
<p>ISP states that:</p> <blockquote> <p>Clients should not be forced to depend on methods that they do not use.</p> </blockquote> <p>ISP relates to important characteristics - <a href="http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29" rel="noreferrer">cohesion</a> and <a href="http://en.wikipedia.org/...
<p>One reason is that having many interfaces with a minimal amount of methods for each one makes it easier to implement each interface and to implement them correctly. A large interface can be unruly. Also, using a focused interface in a scenario makes the code more maintanable because you can see which facet of the ob...
8,344
<p>This was an job placement interview I faced. They asked whether we can realloc Array, I told yes. Then They asked - then why we need pointers as most of the people give reason that it wastes memory space. I could not able to give satisfactory answer. If any body can give any satisfactory answer, I'll be obliged. Ple...
<p>You can only reallocate an array that was allocated dynamically. If it was allocated statically, it cannot be reallocated [safely].*</p> <p>Pointers hold addresses of data in memory. They can be allocated, deallocated, and reallocated dynamically using the new/delete operators in C++ and malloc/free in C.</p> <p>I...
<p>I don't really understand how using pointers "wastes memory". The realloc function: -</p> <pre><code>void *realloc(void *ptr, size_t size); </code></pre> <p>takes a pointer to the memory to resize as a parameter. Also, there are plenty more uses for pointers than dynamic memory, passing by reference for example.</...
24,674
<p>Folks,</p> <p>I need a solution that allows drag-and-drop cell over the table. </p> <p>The cells can be of different colspans, so when the cell is dropped into the middle of another cell, which is bigger, the following steps should be performed:</p> <ol> <li>Another td element is created, which is equal in width ...
<p><a href="http://code.google.com/p/dragtable/" rel="nofollow noreferrer">DragTable</a> might be a good starting point.</p>
<p><a href="http://code.google.com/p/dragtable/" rel="nofollow noreferrer">DragTable</a> might be a good starting point.</p>
14,174
<p>Is there a way to prevent VS2008 creating browse info file files for C++ projects.<br> I rarely use the class browser and it isn't worth the time it takes to recreate it after every build, especially since it runs even if the build failed.</p> <p>EDIT - it's also needed for go to declaration/definition</p>
<p>In the project properties, you will find the browse information under:</p> <p>Configuration Properties -> C/C++ -> Browse Information</p> <p>Just tell it not to generate browse information. All it is used for is quickly browsing between code components (like using 'Go to Definition') and so forth. I personally l...
<p>Try creating a folder with the same name of the ncb file (you'll have to delete the file, of course). I used this trick in the past to prevent intellisense from locking VS2005. You'll lose intellisense, though.</p>
16,470
<p>I am using winsock and C++ to set up a server application. The problem I'm having is that the call to <code>listen</code> results in a first chance exception. I guess normally these can be ignored (?) but I've found others having the same issue I am where it causes the application to hang every once in a while. A...
<p>On a very busy server, you may be running out of Sockets. You may have to adjust some TCPIP parameters. Adjust these two in the registry:</p> <pre><code>HKLM\System\CurrentControlSet\Services\Tcpip\Parameters MaxUserPort REG_DWORD 65534 (decimal) TcpTimedWaitDelay REG_DWORD 60 (decimal) </code></pre> <p>...
<p>This won't answer your question directly, but since you're using C++, I would recommend using something like <a href="http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html" rel="nofollow noreferrer">Boost::Asio</a> to handle your socket code. This gives you a nice abstraction over the winsock API, and should...
34,303
<p>Anyone know a good Regex expression to drop in the ValidationExpression to be sure that my users are only entering ASCII characters? </p> <pre><code>&lt;asp:RegularExpressionValidator id="myRegex" runat="server" ControlToValidate="txtName" ValidationExpression="???" ErrorMessage="Non-ASCII Characters" Display="Dyn...
<p>One thing you may want to watch out for is the lower part of the ASCII table has a lot of control characters which can cause funky results. Here's the expression I use to only allow "non-funky" characters:</p> <pre><code>^([^\x0d\x0a\x20-\x7e\t]*)$ </code></pre>
<p>If you want to map the possible 0x00 - 0xff ASCII values you can use this regular expression (.NET).</p> <pre><code>^([\x00-\xff]*)$ </code></pre>
18,194
<p>"Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition."</p> <p>I just got this error today, the code has been working until this afternoon I published the latest version to our server and it broke with that error both locally and on the server. I don't use "DataSourceID", the ...
<p>Try this:</p> <pre><code>DataSet dsActivity = objCompany.GetActivityDetails(); grdCommunication.DataSource = dsActivity.Tables[0]; grdCommunication.DataBind(); </code></pre>
<p>I ran into the same error, but a totally different problem and solution. In my case, I'm using LINQ to SQL to populate some dropdown lists, then caching the results for further page views. Everything would load fine with a clear cache, and then would error out on subsequent page views.</p> <pre><code>if (Cache["c...
33,873
<p>What's the best way to determine which version of the .NET Compact Frameworks (including Service Packs) is installed on a device through a .NET application. </p>
<p>I have battled this problem myself last week and consider myself somewhat of an expert now ;)</p> <p>I'm 99% sure that not all dlls and static libraries were recompiled with the SP1 version. You need to put</p> <pre><code>#define _BIND_TO_CURRENT_MFC_VERSION 1 #define _BIND_TO_CURRENT_CRT_VERSION 1 </code></pre> ...
<p>I just remembered another trick that I used to find out which static libraries were ill-behaving: 'grep' through the static libraries for the string '21022'. HOWEVER, don't use the 'normal' grep tools like wingrep because they won't show you these strings (they think it's a binary file and look for the raw, non-unic...
8,427
<p>Let's take a web development environment, where developers checkout a project onto their local machines, work on it, and check in changes to development.<br> These changes are further tested on development and moved live on a regular schedule (eg weekly, monthly, etc.).<br> Is it possible to have an auto-moveup of t...
<p>Certainly, but the exact product may be dependent upon the VCS you are using.</p> <p>What you might want to do, is have a a few different branches, and migrate up as you progress. E.g., Development -> Stable-Dev -> Beta -> Production. You can then simply auto-update to the latest version of Stable-Dev and Beta for ...
<p>I doubt many VCSs provide this ability directly, however it should be very simple to script. Either a date or branch based checkout.</p>
3,544
<p>My question, <a href="https://stackoverflow.com/questions/11743/useful-math-for-programmers">his question</a>, but blogs as resources to be specific.</p> <p>I find blogs great to keep up to date... refresh material...</p> <p>So do you know any blogs who tackle math-related programming problems...</p>
<p>Not exactly what you're asking for, but <a href="http://projecteuler.net/" rel="nofollow noreferrer">Project Euler</a> freshens up <em>my</em> math skills.</p>
<p>Found this one with the help of stackoverflow... :)</p> <p><a href="http://www.math.princeton.edu/~wwong/blog/MAT.shtml" rel="nofollow noreferrer">link</a></p> <p>not before you have your first coffee I think...</p>
42,324
<p>Is HTTPS Multipart file upload request a batch process? That is, if I have 99 files, and if the upload fails after file 95 has been uploaded, will that rollback the entire set?</p>
<p>I would assume that the entire set is rolled back, if you use plain HTTP(S) POST requests, as all uploads are POSTed in the same HTTP request. However, you could use JavaScript/AJAX to upload files individually, in a single request per file.</p>
<p>It depends what happens on the server. If you have a single multipart request with 99 files, and as you read the stream, you save each file, then a failure on the 95th file will mean the first 94 files will have been processed and saved. If you need to rollback, you usually would have to implement that yourself.</p>...
25,940
<p>We're releasing a Mac version of our Windows application. Under Windows, there are several tools for executable protection, for example Armadillo, ExeCryptor, AsProtect etc, however, none of these has a Mac version. So, my question is:</p> <p>Are there any executable protection / encryption tools for Mac OS X?</p>
<p>It is my personal view and most other OS X developer's view that you should make it reasonably hard to steal your software but there is a point that it's simply not worth the effort. The fact is that there are very few things that can be done to fully protect a piece of software. And the more you do to try and prot...
<p>I'm a maker of PELock software copy protection for Windows and I must say in my entire life I have received like 2 requests for making a copy protection for MacOS... Once I was looking for some encryption tools for MacOS executables and didn't find anything (except huge licensing solutions that doesn't protect the e...
10,990
<p>I'm writing a Rails application, but can't seem to find how to do relative time, i.e. if given a certain Time class, it can calculate "30 seconds ago" or "2 days ago" or if it's longer than a month "9/1/2008", etc.</p>
<p>Sounds like you're looking for the <a href="http://apidock.com/rails/ActionView/Helpers/DateHelper/time_ago_in_words" rel="noreferrer"><code>time_ago_in_words</code></a> method (or <a href="http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words" rel="noreferrer"><code>distance_of_time_in_wo...
<p>Another approach is to unload some logic from the backend and maek the browser do the job by using Javascript plugins such as:</p> <p><a href="https://github.com/rmm5t/jquery-timeago" rel="nofollow">jQuery time ago</a> or its <a href="https://github.com/jgraichen/rails-timeago" rel="nofollow">Rails Gem adaptation</...
23,785
<p>I've seen that it's possible to get the latitude and longitude (geocoding, like in <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding" rel="nofollow noreferrer">Google Maps API</a>) from a street address, but is it possible to do the reverse and get the street address when you know what ...
<p>Google again</p> <p><a href="http://nicogoeminne.googlepages.com/documentation.html" rel="nofollow noreferrer">http://nicogoeminne.googlepages.com/documentation.html</a></p> <p><a href="http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders" rel="nofollow noreferrer">http://groups.google...
<p>You can also use LINK REMOVED library for that purpose. MKReverseGeocoder is nice but it requires you to use it with a Google map. From MKReverseGeocoder reference documentation:</p> <blockquote> <p>The Google terms of service require that the reverse geocoding service be used in conjunction with a Google map; ta...
19,180
<p>Is it possible to set a default value for columns in JPA, and if, how is it done using annotations?</p>
<p>Actually it is possible in JPA, although a little bit of a hack using the <code>columnDefinition</code> property of the <code>@Column</code> annotation, for example:</p> <pre class="lang-java prettyprint-override"><code>@Column(name="Price", columnDefinition="Decimal(10,2) default '100.00'") </code></pre>
<p>I tried a couple of JPA/Hiberate ways but none seemed to work well. Since I am using Oracle I create a &quot;before trigger&quot; within the trigger a simple test of null then if null set as needed</p>
23,952
<p>I am learning to write a debug visualizer in vs2008 C#. But keep getting the error saying that MyDebugVisualizer dll can't be loaded when I am in debug mode and click the magnifying glass icon.</p> <p>My app project is referencing the visualizer project. Before the type definition I have:</p> <p>[DebuggerVisualize...
<p>In <strong>ZFC</strong>, either the axiom of foundation [as mentioned] or the axiom (scheme) of comprehension will prohibit this. The first, for obvious reasons; the second, since it basically says that for given <em>z</em> and first-order property <em>P</em>, you can construct { <em>x</em> ∈ <em>z</em> : <em>P</em>...
<p>The question is ill-posed in the standard <a href="http://en.wikipedia.org/wiki/Zermelo-Fraenkel_set_theory" rel="nofollow noreferrer">ZFC</a> (Zermelo-Fraenkel + axiom of Choice) set theory because the object thus defined is not a set.</p> <p>Since (again, assuming standard ZFC) your <em>class</em> {x : x\not\in x...
5,581
<p>Since Hex (base 16) uses 0-9A-F, and (I'm assuming here) Base 17 uses 0-9A-G and so on. What symbols are used once 0-9A-Z are all used up.</p>
<p>Well, look at <a href="http://en.wikipedia.org/wiki/Base64" rel="noreferrer">base 64</a>: 0-9, A-Z, a-z and then a few symbols depending on the context. (Base64 for the web tends to be different to other schemes to avoid URL/HTML encoding issues.)</p>
<p>chinese maybe? wikipedia says that there are 47,035 characters in the Kangxi Dictionary!</p>
34,038
<p>Given two sets A and B, what is the common algorithm used to find their union, and what is it's running time?</p> <p>My intuition: </p> <pre><code>a = set((1, 2, 3)) b = set((2, 3, 5)) union = set() for el in a: union.add(el) for el in b: union.add(el) </code></pre> <p>Add checks for a collision, which i...
<p>The complexity of add/find(collision), would depend on the implementation of union.</p> <p>If you are using some hashtable based datastructure then your collision operation will indeed be constant assuming a good hash function.</p> <p>Otherwise, add will probably be O(Log(N)) for a sorted list/tree datastructure.<...
<p>If you can use bitsets (each bit in an array of int equals an item of your set), you can simply walk over the int array and OR the elements. This has the complexity O(N) (where N is the length of the array) or O((m+31)/32) where M is the number of items.</p>
40,407
<p>How, if you have a database per client of a web application instead of one database used by all clients, do you go about providing updates and enhancements to all databases efficiently?</p> <p>How do you roll out changes to schema and code in such a scenario?</p>
<p><a href="http://www.bittorrent.com/" rel="nofollow noreferrer">bittorrent</a>?</p> <p>There have been a few web-based versions already (<a href="http://www.bitlet.org/" rel="nofollow noreferrer">bitlet</a>, <a href="http://torrentfreak.com/w3btorrent-a-bittorrent-client-for-your-web-server/" rel="nofollow noreferre...
<p>@travis</p> <p>Unfortunately It has to be over HTTP inside the users browser. I'll update the question to be more clear about that.</p>
5,571
<p>Let's say I have a string holding a mess of text and (x)HTML tags. I want to remove all instances of a given tag (and any attributes of that tag), leaving all other tags and text along. What's the best Regex to get this done?</p> <p>Edited to add: Oh, I appreciate that using a Regex for this particular issue is n...
<p>Attempting to parse HTML with regular expressions is generally an <em>extremely</em> bad idea. Use a parser instead, there should be one available for your chosen language.</p> <p>You <strong>might</strong> be able to get away with something like this:</p> <pre><code>&lt;/?tag[^&gt;]*?&gt; </code></pre> <p>But it...
<p>I think it might be Raymond Chen (blogs.msdn.com/oldnewthing) that I'm paraphrasing (badly!) here... But, you want a Regular Expression? "Now you have two problems" ... :=)</p> <p>If the string is well-formed (X)HTML, could you load it up into a parser (HTML/XML) and use this to remove any nodes of the offending va...
14,180
<p>I need to write a digital oscilloscope type application. There are many great static graphing controls out there, but I need something that can graph 16 traces processing 4000 samples per second.</p> <p>Is anyone aware of a high speed graphing control for .NET? I'll even take MFC since that can be wrapped into a ...
<p>How about ZedGraph? They mention realtime applications specifically here:</p> <p><a href="http://zedgraph.org/wiki/index.php?title=Display_Dynamic_or_Real-Time_Data" rel="noreferrer">http://zedgraph.org/wiki/index.php?title=Display_Dynamic_or_Real-Time_Data</a></p> <p>They claim at least ~20 samples per second.</p...
<p>The graphics rednereing (points and lines on a widget) is fairly simple - you could do this with raw Win32 a la Petzold.</p>
21,693
<p>If I have a table field named 'description', what would be the SQL (using MS SQL) to get a list of records of all distinct words used in this field.</p> <p>For example:</p> <p>If the table contains the following for the 'description' field:</p> <pre><code>Record1 "The dog jumped over the fence." Record2 "The gian...
<p>I do not think you can do this with a SELECT. The best chance is to write a user defined function that returns a table with all the words and then do SELECT DISTINCT on it.</p> <hr> <p><strong>Disclaimer:</strong> Function <strong>dbo.Split</strong> is from <a href="http://www.sqlteam.com/forums/topic.asp?TOPIC_ID...
<p>it'd be a messy stored procedure with a temp table and a SELECT DISTINCT at the end.</p> <p>if you had the words already as records, you would use SELECT DISTINCT [WordsField] from [owner].[tablename]</p>
13,173
<p>I'm looking for a library to save an array of colour data to a PNG file. (That's all there is to it, right? I know very little about the internals of a PNG.)</p> <p>This is for use in Nintendo DS development, so something lightweight is preferable. I don't need any other fancy features like rotation, etc. </p>
<p>To encode any kind of PNG file, libpng is the way of the walk.</p> <p>However, on small devices like the DS you really want to store your image data in the format which the display hardware expects. It is technically possible to get libpng working on the platform, but it will add significant overhead, both in terms...
<p>I managed to find a library that supports PNG (using libpng) and allows you to just give it raw image data.</p> <p>It's called <a href="http://www.dragonminded.com/?loc=ndsdev/LibPicture" rel="nofollow noreferrer">LibPicture</a>. It's a bit hefty though: ~1MB.</p>
26,386
<p>I have a web server and I am currently paying for SVN hosting at a company that specializes in hosting svn.</p> <p>I am thinking of just installing SVN on my dedicated server, are there any security implications of this? </p>
<p>Small correction to Jedi: it's VisualSVN Server from <a href="http://www.visualsvn.com/server/" rel="noreferrer">http://www.visualsvn.com/server/</a></p>
<p>SVN is very difficult to get setup in the Windows environment, at least if you want hosted SVN, a local repository is different. My suggestion is stick with the company or search out a cheaper SVN that will not cost as much money. They are not difficult to setup, but you would hate to lose all your source code bec...
3,415
<p>I have a problem with a bash script. I have to use the operator * to multiplicate. Instead the script bugs me with expansion and using as operator the name of the script itself. I tried with single quotes but it doesn't work :( Here's the code</p> <pre><code>#!/bin/bash -x # Bash script that calculates an arithmet...
<p>If "op" is "*", it will be expanded by the shell before your script even sees it. You need to choose something else for your multiplication operator, like "x", or force your users to escape it by putting it in single quotes or preceeding it with a backslash.</p> <p>If the terms of the exercise allow it, maybe you ...
<p>It works, you're just not escaping the <code>*</code> correctly. Try using the backslash:</p> <pre><code>$ ./calcola.scr 2 \* 3 + '[' 3 -lt 3 ']' + result=0 + op=+ + j=0 + for i in '"$@"' + '[' 0 -eq 0 ']' + let result+=2 + j=1 + for i in '"$@"' + '[' 1 -eq 0 ']' + op='*' + j=0 + for i in '"$@"' + '[' 0 -eq 0 ']' ...
48,736
<p>I have a very large file that looks like this (see below). I have two basic choices of regex to use on it (I know there may be others but I'm really trying to compare Greedy and Negated Char Class) methods.</p> <pre><code>ftp: [^\D]{1,} ftp: (\d)+ ftp: \d+ </code></pre> <p><strong><em>Note: what if I took off the...
<p>Both your expressions have the same greediness. As others have said here, except for the capturing group they will execute in the same way. </p> <p>Also in this case greediness won't matter much at the execution speed since you don't have anything following \d*. In this case the expression will simply process all t...
<p>Not a direct answer to the question, but why not a different approach altogether, since you know the format of the lines already? For example, you could use a regex on the whitespace between the fields, or avoid regex altogether and split() on the whitespace, which is generally going to be faster than any regular ex...
20,346
<p>How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site?</p> <p>For example, I want to display the content that appears in the iframe at 80% of the original size.</p>
<p><a href="https://stackoverflow.com/questions/166160/how-can-i-scale-the-content-of-iframe/2224816#2224816">Kip's solution</a> should work on Opera and Safari if you change the CSS to:</p> <pre><code>&lt;style&gt; #wrap { width: 600px; height: 390px; padding: 0; overflow: hidden; } #frame { width: 800px; hei...
<p>As said, I doubt you can do it.<br> Maybe you can scale at least the text itself, by setting a style <code>font-size: 80%;</code>.<br> Untested, not sure it works, and won't resize boxes or images.</p>
20,066
<p>Every so often, I'll have to switch between languages for the majority of the code I write (whether for work or for play). I find that C++ is one of those languages that requires a lot of mental cache space, so if I take a long break from it, then I forget a lot of the details. Even things like adding items to an S...
<p>When I switch back from Java to C++, I like to review items from <a href="http://www.gotw.ca/publications/c++cs.htm" rel="noreferrer">C++ Coding Standards</a> by Herb Sutter and Andrei Alexandrescu.</p> <p>Scott Meyers' <a href="http://www.aristeia.com/books.html" rel="noreferrer">Effective C++</a> series are great...
<p>Access to Google and the ability to type suffices for me.</p> <p>Admittedly I am spoilt by having near-guaranteed web access in my working environment. Failing that for whatever reason, I have all three standard PDFs lying around too.</p> <p>The downside of this is a high guess/knowledge ratio during factual Q&amp...
21,130
<p>What is the best way to keep a PHP script running as a daemon, and what's the best way to check if needs restarting.</p> <p>I have some scripts that need to run 24/7 and for the most part I can run them using <a href="http://en.wikipedia.org/wiki/Nohup" rel="noreferrer">nohup</a>. But if they go down, what's the b...
<p>If you can't use the (proper) init structure to do this (you're on shared hosting, etc.), use cron to run a script (it can be written in whatever language you like) every few minutes that checks to see if they're running, and restarts them if necessary.</p>
<p>TBH, PHP probably isn't the best tool for this, really not what it was designed for. I've heard of memory leaks and other bad things happening when you try this. Also bear in mind PHP only has a finite amount of resource ids (for file handles, db connections ect) per execution of a script.</p> <p>Be better of using...
5,948
<p>Want to know what the stackoverflow community feels about the various free and non-free Java Profilers and profiling tools available.</p>
<p>JProfiler works very well for us.</p> <p><a href="http://www.ej-technologies.com/products/jprofiler/overview.html" rel="noreferrer">http://www.ej-technologies.com/products/jprofiler/overview.html</a></p>
<p>You ask what do we use.</p> <p>Tools are fine, but for finding time-tumors, frankly I've seen nothing that works better than <a href="https://stackoverflow.com/questions/266373/one-could-use-a-profiler-but-why-not-just-halt-the-program/317160#317160">this</a>.</p>
21,914
<p>Coming from a desktop background I'm not sure exactly how to pass the exceptions I have caught to an Error page in order to avoid the standard exception screen being seen by my users. </p> <p>My general question is how do I pass the exception from page X to my Error page in ASP.net?</p>
<p>I suggest using the customErrors section in the web.config:</p> <pre><code> &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;/error.html&quot;&gt; &lt;error statusCode=&quot;403&quot; redirect=&quot;/accessdenied.html&quot; /&gt; &lt;error statusCode=&quot;404&quot; redirect=&quot;/pa...
<p>I think you can use the <strong>global.asax</strong> -- <strong>Application_Exception</strong> handler to catch the exception and then store it for displaying in an error page.</p> <p>But actually, your error page shouldn't contains code that might cause just another error. It should be simple "Oops! something went...
15,737
<p>The <a href="http://www.erlang.org/doc/" rel="noreferrer">Erlang documentation</a> contains the documentation of modules.</p> <p>Where can I find the documentation of the Erlang shell? (Which is not a module, I suppose.)</p>
<p><a href="http://www.erlang.org/doc/getting_started/seq_prog.html#2.1" rel="nofollow noreferrer">This page in the documentation</a> seems to be a starting point. Especially the link in it. Check also the <a href="http://www.erlang.org/doc/man/shell.html" rel="nofollow noreferrer">first link</a> in it, with the shell'...
<p><a href="http://carpanta.dc.fi.udc.es/docs/erlang/dbg.html" rel="nofollow noreferrer">This</a> might also be helpful, as well as <a href="http://www.ejabberd.im/interconnect-erl-nodes" rel="nofollow noreferrer">this</a>.</p>
17,003