instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Are there ways to programmatically simulate connection problems (slow connection, response does not complete, connection gets dropped, etc.) when using the HttpWebRequest class?</p>
<p>Thanks</p>
<p>EDIT: To elaborate more, I need this for debugging but would want to turn it into a test eventually. I'm using the a... | <p>If this is for testing purposes - i.e. to inspect your's code behavior, I would suggest to create a class which inherits from from HttpWebRequest/HttpWebResponse, and override the methods you are interested in to behave the way you want - i.e. Thread.Sleep for delays, throw an exceptions, etc.</p>
| <p>If you're in control of the site that's responding to the request, I'd say putting the thread to sleep for a while would simulate a slow response. System.Threading.Thread.Sleep(number of milliseconds)</p>
<p>As for a dropped connection, I can't think of anything programmatic, but I've literally pulled out my netwo... | 35,122 |
<p>If you've ever used Eclipse, you've probably noticed the great keyboard shortcuts that let you hit a shortcut key combination, then just type the first few characters of a function, class, filename, etc. It's even smart enough to put open files first in the list.</p>
<p><img src="https://i.stack.imgur.com/aLKhF.png... | <p>Vs11 (maybe 2010 had it too) has the Navigate To... functionality which (on my machine) has the <kbd>Ctrl</kbd>+<kbd>,</kbd> shortcut.</p>
<p>By the way it understands capitals as camelcase-shortucts (eclipse does so too). For instance type HH to get HtmlHelper.</p>
| <p>I have been using biterScripting along with Visual Studio to do more flexible searching and manipulation.</p>
<ol>
<li><p>It can search the entire workspace.</p></li>
<li><p>It can search within any project - EVEN IF THAT PROJECT IS NOT LOADED OR EVEN PART OF A WORKSPACE.</p></li>
<li><p>It can find things using re... | 2,523 |
<p>I'm getting this error in a PHP (Drupal) application:</p>
<pre><code>(104)Connection reset by peer: FastCGI: comm with server "/opt/php-5.2.5/bin/php-cgi" aborted: read failed
</code></pre>
<p>It is often followed by this error:</p>
<pre><code>FastCGI: incomplete headers (0 bytes) received from server "/opt/php-... | <p>In this particular issue, it was related to an odd bug in my code... it seems certain kinds of errors cause FastCGI to fail so badly that it doesn't forward on the underlying PHP code error. Sorry I don't have more detail for those of you visiting from Google.</p>
| <p>I had the same problem but in python and i resolved changing the extention of my script to .py</p>
<pre><code>#.htaccess file
AddHandler fastcgi-script .py
</code></pre>
| 48,776 |
<p>We have a semi-weird issue for our site.</p>
<p>Consistently, from 1 anonymous* user the following error occurs:</p>
<blockquote>
<p>Exception type: System.FormatException</p>
<p>Exception message: Invalid length for
a Base-64 char array.</p>
</blockquote>
<p>After some investigation, it appears the user is using so... | <p>Disabling viewstatemac will not solve the problem; ViewStateMac failures happen when you have multiple web server, <strong>not</strong> when a user is coming from multiple IP addresses.</p>
<p>Are you using a viewstateuserkey by any chance? Even then, that's a long shot as you would get a different exception.</p>
... | <p>Disabling viewstatemac will not solve the problem; ViewStateMac failures happen when you have multiple web server, <strong>not</strong> when a user is coming from multiple IP addresses.</p>
<p>Are you using a viewstateuserkey by any chance? Even then, that's a long shot as you would get a different exception.</p>
... | 44,621 |
<p>I am part of a high school robotics team, and there is some debate about which language to use to program our robot. We are choosing between C (or maybe C++) and LabVIEW. There are pros for each language.</p>
<p>C(++):</p>
<ul>
<li>Widely used</li>
<li>Good preparation for the future (most programming positions ... | <p>Before I arrived, our group (PhD scientists, with little programming background) had been trying to implement a LabVIEW application on-and-off for nearly a year. The code was untidy, too complex (front and back-end) and most importantly, did not work. I am a keen programmer but had never used LabVIEW. With a little... | <p>It seems that if you are trying to prepare our team for a future in programming that C(++) ma be the better route. The promise of general programming languages that are built with visual building blocks has never seemed to materialize and I am beginning to wonder if they ever will. It seems that while it can be done... | 3,461 |
<p><strong><em>Note</strong>: Before any negative flagging, we asked permission on Meta prior to posting & got a YES: <strong><a href="https://3dprinting.meta.stackexchange.com/questions/281/could-this-printing-material-recommendation-question-be-or-shaped-to-be-valid-on/283#283">Could this Printing Material Recomm... | <h2>No FDM print at all.</h2>
<p>The problem of your design will not be the materials, but a basic property of FDM printing: FDM Printers do create a structure by placing a long string of filament next to itself and ontop of itself, creating tons of boudaries.</p>
<p>These boundaries between the layers are the weak poi... | <h2>No FDM print at all.</h2>
<p>The problem of your design will not be the materials, but a basic property of FDM printing: FDM Printers do create a structure by placing a long string of filament next to itself and ontop of itself, creating tons of boudaries.</p>
<p>These boundaries between the layers are the weak poi... | 941 |
<p>I have a databound TextBox in my application like so: (The type of <code>Height</code> is <code>decimal?</code>)</p>
<pre class="lang-xml prettyprint-override"><code> <TextBox Text="{Binding Height, UpdateSourceTrigger=PropertyChanged,
ValidatesOnExceptions=True,
... | <p>You can force the keyboard focus to stay on the <code>TextBox</code> by handling the <code>PreviewLostKeyBoardFocus</code> event like this:</p>
<pre class="lang-xml prettyprint-override"><code> <TextBox PreviewLostKeyboardFocus="TextBox_PreviewLostKeyboardFocus" />
</code></pre>
<pre class="lang... | <p>It sounds to me that you'll want to handle two events:</p>
<p>GotFocus: Will trigger when the textbox gains focus. You can store the initial value of the box.</p>
<p>LostFocus: Will trigger when the textbox loses focus. At this point you can do your validation and decide if you want to roll back or not.</p>
| 6,605 |
<p>I always seem to have a hard time starting a new Firefox extension. Can anyone recommend a good extension skeleton, scaffold, or code generator? Ideally one that follows all the best practices for FF extensions?</p>
| <p>This one works nice: <a href="https://addons.mozilla.org/en-US/developers/tools/builder" rel="nofollow noreferrer">https://addons.mozilla.org/en-US/developers/tools/builder</a></p>
<p>Of course googling for "firefox extension generator" is where I found it ;)</p>
| <p>Look up this eclipse plugin:</p>
<p><a href="http://spket.com" rel="nofollow noreferrer">SPKet</a></p>
<p>It will take care of the skeleton and 50 other things, you will love it.</p>
| 15,789 |
<p>I have this PHP code that I am trying to use to let a user edit a news record in a form and then when they hit the submit button, it will update the record in a database. The problem is that everything works but the record is not actually updated in the database.</p>
<p>Could someone look at my code and see where a... | <pre><code>if ($_GET && !$_POST) {
</code></pre>
<p>...</p>
<pre><code>if (array_key_exists('update', $_POST)) {
</code></pre>
<p>Won't that ensure the update code never fires?</p>
| <p>If you run that UPDATE from the mysql cli with the same data the user sends does it update?</p>
<p>If not check for escaping characters.</p>
| 16,496 |
<p>We develop custom survey web sites and I am looking for a way to automate the pattern testing of these sites. Surveys often contain many complex rules and branches which are triggered on how items are responded too. All surveys are rigorously tested before being released to clients. This testing results in a lot ... | <p>Check out selenium: <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">http://selenium.openqa.org/</a></p>
<p>Also, check out the answers to this other question: <a href="https://stackoverflow.com/questions/484/how-do-you-test-layout-design-across-multiple-browsersoss">https://stackoverflow.com/questio... | <p>Sounds like your engine could generate a test script using something like <a href="http://search.cpan.org/~petdance/Test-WWW-Mechanize-1.20/Mechanize.pm" rel="nofollow noreferrer">Test::WWW::Mechanize</a></p>
| 9,476 |
<p>Is it possible to have one appBase served up by multiple context paths in Tomcat?</p>
<p>I have an application base that recently replaced a second application base. My problem is a number of users still access the old context. I would like to serve the, now common, application from a single appBase yet accessed ... | <p>I'm not sure if the answer above will prevent your webapp from loading twice (as you'd have to deploy it to both new and old context paths), but I could be mistaken. Another option would be to have an extremely simple webapp left in the old context, that does nothing except have one custom servlet filter declared i... | <p>Yes, go into the Tomcat Web Application Manager and scroll down to "Deploy directory or WAR file located on server". For "Context Path (optional):" put in the new context. For "WAR or Directory URL:" put in the same path as your existing app.</p>
| 13,753 |
<p>I have a website with a lot of large files. However, I don't want users to start downloading like 10 files at a time. I noticed there are website out there where they only allow 2 simultaneous downloads.</p>
<p>My website is programmed using ASP.net running on IIS. Does anyone know how I can limit simultaneous dow... | <p>The Dynamic IP Restrictions module from Microsoft (currently in beta) will do this. </p>
<p>For details and a download: <a href="http://www.iis.net/download/DynamicIPRestrictions" rel="nofollow noreferrer">http://www.iis.net/download/DynamicIPRestrictions</a></p>
| <p>Do you want to do it programatically? Otherwise I believe there is a setting for max conncurrent connections from an ip address for IIS.</p>
| 11,280 |
<p>The recently announced managed extensibility framework (MEF) of .NET 4.0 - is it a dependency injection framework? Will Microsoft Unity from Patterns and Practices be obsolete in 4.0 ? How does MEF compare to a framework like Unity?</p>
| <p>Specifically addressed in the PDC 2008 2nd Keynote by Scott Guthrie, MEF has a lot more to do with things like extending Visual Studio 2008 and other applications, without having to use all the COM and older technologies... A very good demonstration of extending the text edition in VS2008 was shown among other thin... | <p>I would like to add one mopre line which I have just read that <strong>MEF is not a part of Inversion of Control(as dependecny is said to be synonym of IOC) but it implements it</strong>.
When we implement IOC via dependency injections we generally use Unity, which helps in discovering static dependencies but MEF al... | 37,400 |
<p>Would it be wwwroot, C, the root virtual directory where the assets are hosted, or the same folder that the assets are in?</p>
<p>Meaning if I have a virtual directory 'virdir' with a sub directory 'swf', which is really like C:\somedir\assets\swf\, where would the crossdomain.xml need to go so that my swf app on a... | <p>you need to be able to access it as <a href="http://yoursite.com/crossdomain.xml" rel="noreferrer">http://yoursite.com/crossdomain.xml</a> so where would you put it to do that? </p>
<p>As a rule of thumb I put it next to my index.html for the site.</p>
| <p>wwwroot will likely work for you.</p>
| 26,230 |
<p>Have any of you ever tried to run from sharepoint? I've worked with sharepoint enough to know that it is not something that interests me. My interests are more along the lines of APIs / backend / distributed development. Have any of you found ways, as consultants, to move away from sharepoint and keep learning other... | <p>If I infer correctly that you work for a consulting firm then find out what other kinds of things your firm works on. Learn those technologies better that the people who currently work on them for your firm, involve yourself in those projects, even if just in a hallway conversation manner, and come up with better (... | <p>I'm, on the other hand, just starting to use SharePoint to enreach my currently boring C#-only projects. I'm starting to use it as a front-end to the distributed and complicated systems: simple configuration and customization, reporting, management, system control - looks like all this is available in this package i... | 14,712 |
<p>In my app users need to be able to enter numeric values with decimal places. The iPhone doesn't provides a keyboard that's specific for this purpose - only a number pad and a keyboard with numbers and symbols.</p>
<p>Is there an easy way to use the latter and prevent any non-numeric input from being entered without... | <p>A more elegant solution happens to also be the simplest.</p>
<p><em>You don't need a decimal separator key</em></p>
<p>Why? Because you can simply infer it from the user's input. For instance, in the US locale when you what to enter in $1.23, you start by entering the numbers 1-2-3 (in that order). In the syste... | <p>A Swift 2 implementation of Mike Weller's post, also only USD:</p>
<pre><code> func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
guard let str = textField.text else {
textField.text = "0.00"
return false
}
... | 34,851 |
<p>Using C# .NET 3.5 and WCF, I'm trying to write out some of the WCF configuration in a client application (the name of the server the client is connecting to).</p>
<p>The obvious way is to use <code>ConfigurationManager</code> to load the configuration section and write out the data I need.</p>
<pre><code>var servi... | <p>The <a href="http://msdn.microsoft.com/en-us/library/ms731354%28v=vs.90%29.aspx" rel="noreferrer"><code><system.serviceModel></code></a> element is for a configuration section <strong>group</strong>, not a section. You'll need to use <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.configur... | <p>GetSectionGroup() does not support no parameters (under framework 3.5).</p>
<p>Instead use:</p>
<pre><code>Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ServiceModelSectionGroup group = System.ServiceModel.Configuration.ServiceModelSectionGroup.... | 4,002 |
<p>I am suddenly resposible for debugging/finding out what is wrong with an asp.net application that crashed its ApplicationPool some days ago. The 5 errors within 5 minutes failsafe we had set took it down. The problem is that it was still served pages and thus returned a 503 for just some visitors. We have inadequate... | <p>You should check Tess Ferrandez "<a href="http://blogs.msdn.com/tess/" rel="nofollow noreferrer">If broken it is, fix it you should</a>" blog. It is the best resource I know of for debugging production asp.net applications. All the logs won't help you enough, probably. As most of the time its application code that i... | <p>In our web app I catch all unhandled exceptions through the HttpApplication error event, and log those to the database, with all the auxilliary data that I need. If that logging fails, then I resort to windows EventLog. Then I have service running on another machine that periodically checks the logs, and the site, a... | 42,947 |
<p>I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.)</p>
<p>QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick search has brought the following... | <p><a href="http://www.boost.org/libs/regex/" rel="noreferrer">Boost.Regex</a> is very good and is slated to become part of the C++0x standard (it's already in TR1).</p>
<p>Personally, I find <a href="http://www.boost.org/libs/xpressive/" rel="noreferrer">Boost.Xpressive</a> much nicer to work with. It is a header-onl... | <p>Noone here said anything about the one that comes with C++0x.
If you are using a compiler and the STL that supports C++0x you could just use that instead of having another lib in your project.</p>
| 21,927 |
<p>Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers.</p>
<p>Also, please feel free to suggest corrections if the provided answers are wrong.</p>
<p>I will go first: </p>
<p>Q: How does SharePoint store pages?</p>
<p>A: ... | <p>Q: What is the difference between <code>System.Web.UI.WebControls.WebParts.WebPart</code> and <code>Microsoft.SharePoint.WebPartPages.WebPart</code>?</p>
<p>A: <code>Microsoft.SharePoint.WebPartPages.WebPart</code> is provided in MOSS 2007 to provide backwards compatability with MOSS 2003 webparts. In MOSS 2007, i... | <p>Q. What are the data types which are supported as Lookup column in SharePoint.</p>
<p>A. Only Single Line of Text and Calculated columns are supported as lookup columns.</p>
<p>Also I have consolidated some more questions on: <a href="http://qmoss.blogspot.com/" rel="nofollow noreferrer">http://qmoss.blogspot.com/... | 25,226 |
<p>What techniques can be applied to detect <a href="http://en.wikipedia.org/wiki/Computer_virus#Polymorphic_code" rel="nofollow noreferrer">Polymorphic</a> and <a href="http://en.wikipedia.org/wiki/Computer_virus#Metamorphic_code" rel="nofollow noreferrer">Metamorphic</a> viruses?</p>
<p>How difficult is to implement... | <p>I thought most of the virus scanners nowadays use <a href="http://www.norman.com/Virus/Sandbox/20374/en" rel="nofollow noreferrer"><em>sandbox techniques</em></a> to check for "bad" behavior. Therefore the polymorphic virusses will also be detected.<br>
of course these detection techniques are also known to virus cr... | <p>It's impossiable to detect all known poly/metamorphic bad-code. White lists verification is the only provable technique. It's not always possiable, especially if your infrastructure/computer has not been maintainedd very well. Which is a good reason why signature, heuristic, emulation based detection is still val... | 5,637 |
<p>I've found the following code from here "<a href="http://www.boyet.com/Articles/CodeFromInternet.html" rel="nofollow noreferrer"><a href="http://www.boyet.com/Articles/CodeFromInternet.html" rel="nofollow noreferrer">http://www.boyet.com/Articles/CodeFromInternet.html</a></a>".<br/>
It returns the speed of the CPU i... | <p>Code below should do the trick</p>
<pre><code> RegistryKey registrykeyHKLM = Registry.LocalMachine;
string keyPath = @"HARDWARE\DESCRIPTION\System\CentralProcessor\0";
RegistryKey registrykeyCPU = registrykeyHKLM.OpenSubKey(keyPath, false);
string MHz = registrykeyCPU.GetValue("~MHz").ToString();
string Pr... | <p>I've used the following code based on the answer by Binoj Antony which returns the speed for each CPU/core, not only the first one:</p>
<pre><code>Microsoft.Win32.RegistryKey registrykeyHKLM = Microsoft.Win32.Registry.LocalMachine;
string cpuPath = @"HARDWARE\DESCRIPTION\System\CentralProcessor";
Microsoft.Win32.Re... | 43,666 |
<p>Can someone tell me why I don't have all of the dev studio windows available to me when I develop on a 64-bit platform? I upgraded my dev desktop box to server 2003 x64 to match our deployment platform. Since then (I'm using VS2005) I've noticed that several windows aren't available. I can't view Processes (which... | <p>"Edit/Continue" can work if you change the build setting to X86 :)</p>
<p>Here was the suggestion from <a href="https://stackoverflow.com/questions/206894/change-to-64-bits-not-allowed-when-trying-to-edit-in-debug-why">StackOverflow</a> about it.</p>
| <p>I had some problem with NUNIT when debugging code. The <a href="https://stackoverflow.com/questions/208985/nunitexe-cannot-work-on-vista-64bits-if-x86-build">solution</a> was to use the special program in the \bin\ folder Nunit-x86.exe for old code built in x86 and use the Nunit.exe for x64 built.</p>
| 26,975 |
<p>I have a pure Winapi application that needs a few new features. One of them would best be implemented as two lists where you can drag-and-drop (multiple) elements between the lists. The new feature can be limited to a single dialog.</p>
<p>What would be the quickest way to implement this?
A few ideas:</p>
<ul>
<li... | <p>My advice would be that if the application is in pure winapi, keep it that way.</p>
<p>Starting a .NET framework runtime just for one dialog with draggable items is as bad as hosting a WebBrowser control and using JQuery for that one functionality - it's at least thedailywtf.com-worthy if you ask me (but then again... | <p>Whichever method you are most familiar with is going to be the quickest. </p>
<p>Certainly it is very easy to do this in .NET Windows Forms. You can easily drag and drop items between ListBox entries by writing just a few lines of code. Look at somewhere like <a href="http://www.codeproject.com" rel="nofollow noref... | 23,131 |
<p>VS 2008 - Visual Basic .NET (C# example is fine, as I can read that as well)</p>
<p>I have an asp:DropDownList that is 100px wide, however some of my list items are much wider than that.</p>
<p>How can I expand the drop down area of the list so it shows all of the text of the list items? The control itself must st... | <p>Hrm. I don't know that you can do that with ASP because of the way the browser handles dropdowns.</p>
<p>You could, however, create your own dropdownlist-like control with JavaScript that acts this way. </p>
| <p>EndangeredMassa is right.</p>
<p>You have no control over how the browser renders it's controls from your code. Unfortunately.</p>
| 27,962 |
<p>i wish to require a popup window for users to type, to access my website. For the username, password .. i was hoping to have a few hardcoded names/passwords in some file. I was told that Digest Authorisation could be used, to do this.</p>
<p>If i've got a stock standard ASP.NET website, where can i define the usern... | <p>There's no release of VB (or C#) that is hostable via the DLR hosting APIs. In general the DLR hosting APIs, and the possibility of getting more MS created languages to support them, are tenatively thought to be post-Dev10. So it won't happen anytime in the short term.</p>
| <p>Officially, there's no supported dynamic languages until VS10 is released. At that time, VBx, which apparently will be built on top of the DLR, will be released, probably alongside version 2.0 of the DLR. (Version 1.0's release is immanent.)</p>
<p>You might find some useful stuff in the VS10 CTP, but keep in mind ... | 38,091 |
<p>I'm looking for some succinct, modern C# code to generate a random date between Jan 1 1995 and the current date.</p>
<p>I'm thinking some solution that utilizes Enumerable.Range somehow may make this more succinct.</p>
| <pre><code>private Random gen = new Random();
DateTime RandomDay()
{
DateTime start = new DateTime(1995, 1, 1);
int range = (DateTime.Today - start).Days;
return start.AddDays(gen.Next(range));
}
</code></pre>
<p>For better performance if this will be called repeatedly, create the <code>start</c... | <p>Useful extension based of @Jeremy Thompson's solution</p>
<pre><code>public static class RandomExtensions
{
public static DateTime Next(this Random random, DateTime start, DateTime? end = null)
{
end ??= new DateTime();
int range = (end.Value - start).Days;
return start.AddDays(random... | 23,678 |
<p>Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.</p>
<p>So, because it's so easy to immediately see the output... | <p>I use pdb for basic python debugging. Some of the situations I use it are:</p>
<ul>
<li>When you have a loop iterating over 100,000 entries and want to break at a specific point, it becomes really helpful.(conditional breaks)</li>
<li>Trace the control flow of someone else's code.</li>
<li>Its always better to use ... | <p>You might want to take a look at this other SO post:</p>
<p><a href="https://stackoverflow.com/questions/426569/why-is-debugging-better-in-an-ide">Why is debugging better in an IDE?</a></p>
<p>It's directly relevant to what you're asking about.</p>
| 21,941 |
<p><a href="http://www.tomshardware.com/news/nvidia-gpu-wifi-hack,6483.html" rel="nofollow noreferrer">Recently WiFi encryption was brute forced by using the parellel processing power of the modern GPU.</a> What other real-life problems do you think will benefit from similar techniques?</p>
| <p>Image processing which is just fancier signal processing which is massively parallel math.</p>
<p>given that, perhaps face recognition, voice recognition, video decode/encode, audio decode/encode, encryption/decryption</p>
| <p>Most batch-processing tasks can be parallised and are well suited to the stream processors in GPUs. Folding. Seti. All those gubbins are already working well on GPUs.</p>
| 26,098 |
<p>While this may seem like terribly noobish question, I'm sure one day someone will have same problem.</p>
<p>I own a ZONESTAR P802QSU (Bowden extruder) and all of sudden my extruder motor stopped working. What I did:</p>
<ol>
<li>I check whether or not motor is moving freely - I can rotate it without any problems m... | <p>Changing the PSU with one with a higher amperage will <em><strong>not</strong></em> make the bed heat up any faster unless the PSU is underrated for the amperage required and the voltage is dropping as a result of the load. This can be checked by measuring the output voltage with a multimeter (when the PSU is loaded... | <p>May I recommend an alternative approach, which does not require any change of hardware? The time required to heat the bed is not huge, so either via USB from your computer or from the front panel, instruct your printer to heat the bed first, while you're setting everything else up (loading gcode files, changing fi... | 892 |
<p>Just out of curiosity:</p>
<p>I know I can tell the compiler if I want a value to be interpreted as a certain numeric type, e.g. as Integer (32 bit signed), this way appending an "I" (type character) to the constant value:</p>
<pre><code>Private Function GetTheAnswerAsInteger() As Integer
Return 42I
End Funct... | <p>There isn't one. If you need to distinguish between an integer and a byte (e.g. to call an appropriate overload) for a constant, you need to cast.</p>
<p>(The same is true in C#, by the way.)</p>
<p><a href="http://msdn.microsoft.com/en-us/library/e2ayt412.aspx" rel="noreferrer">MSDN provides confirmation:</a></p>... | <p>There's no byte literal in .NET.</p>
| 31,498 |
<p>I recently started learning Python and I was rather surprised to find a 1000 deep recursion limit (by default). If you set it high enough, about 30000, it crashes with a segmentation fault just like C. Although, C seems to go quite a lot higher.</p>
<p>(The Python folks are quick to point out that you can always ... | <p>"The Python folks are quick to point out that you can always convert recursive functions to iterative ones and that they're always faster"</p>
<p>This is true, but if it's really as easy as all that, why doesn't Python do it for me, so that my code can look as simple as possible? (I say this not to slam Python impl... | <p>Visual Dataflex will stack overflow.</p>
| 28,839 |
<p>For some school groupwork, I'm making a Generic Pizza Delivery Everything Management System, and got stumped on a problem during data modelling that I can't figure out without using at least several layers of ugly.</p>
<p>The restaurant keeps stock of ingredients and beverages/snacks/etc. (I'll refer to these as "d... | <p>Isn't there a simple solution where you have a table of ingredients or stockable items, which includes drinks and other ingredients that might be listed in their own right. None of these can be ordered directly.</p>
<p>You then have a table of menu items which are all a collection of ingredients / stockable items. ... | <p>SQL does not directly support the concept of inheritance or generalisation. The relationship between tables is only that of reference. So there is no "IS-A" mechanism.</p>
<p>You can use a foreign key to mean "belongs to" (as in "this drink belongs to the category of merchandise with 8% tax rate") or you can use ... | 41,586 |
<p>How do I launch Windows' <a href="https://en.wikipedia.org/wiki/Windows_Registry#Registry_editors" rel="noreferrer">RegEdit</a> with certain path located, like "<code>HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0</code>", so I don't have to do the clicking?</p>
<p>What's the command line argument to do this... | <p>There's a program called <a href="http://technet.microsoft.com/en-us/sysinternals/bb963880.aspx" rel="noreferrer">RegJump</a>, by Mark Russinovich, that does just what you want. It'll launch regedit and move it to the key you want from the command line.</p>
<p>RegJump uses (or at least used to) use the same regedit... | <p>This seems horribly out of date, but <em><a href="http://support.microsoft.com/kb/82821" rel="nofollow noreferrer">Registration Info Editor (REGEDIT) Command-Line Switches</a></em> claims that it <em>doesn't</em> support this.</p>
| 16,593 |
<p>Can I utilise the new functionality provided by the new JavaFX APIs directly from Java to the same extent as I would be able to using JavaFX Script?</p>
<p>Are all the underlying JavaFX APIs purely Java or JavaFX Script or a mix?</p>
| <p>The JavaFX APIs are a mix of JavaFX and Java. The SDK comes with an archive src.zip which contains a part of the APIs (only the most basic classes are included, but things like javafx.scene are missing).</p>
<p>Calling JavaFX code from Java is not officially supported in JavaFX 1.x AFAIK. There's a <a href="http://... | <p>We were able to use the multi-media components with JavaFX with some success. they are totally unsupported in this manner and subject to change similar to how the com.sun packages are in JavaSE.</p>
<p>We integrated them into a Swing UI and were able to do the MM stuff you could do from FX straight from Java.</p>
... | 35,967 |
<p>I have this program, we'll call it Host. Host does all kinds of good stuff, but it needs to be able to accept input through the command line <strong>while it's running</strong>. This means it has to somehow send its other process data and then quit. For example, I need to be able to do this:</p>
<pre><code>./Host -... | <p>If you were on Windows, I'd tell you to use a hidden window to receive the messages, but since you used <code>./</code>, I assume you want something Unix-based.</p>
<p>In that case, I'd go with a <a href="http://en.wikipedia.org/wiki/Named_pipe" rel="noreferrer">named pipe</a>. Sun has a <a href="http://developers... | <p>So, I may be missing the point here, but by deafult a C program's main function takes two arguments; argc, a count of the number of arguments (at least one), and argv (or arg vector), the argument list. You could just parse through the arguments and call the correct method.
For example:</p>
<pre><code> int main(in... | 3,162 |
<p>I have been working on splitting up the app tier and web tier of a web application. In the app tier, I managed to separate the business logic into a bunch of services exposed using WCF proxies. The problem is that these services talk to another legacy application that uses a large CLR object as its primary means of ... | <p>I think instance context sharing can help </p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa354514.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa354514.aspx</a></p>
| <p>Breaking things up into subservices seems like a good idea if you want to be able to spread the app out over a farm. However, it's important to keep in mind that whenever an object crosses the appdomain boundary at the vary least it will have to be copied in memory.</p>
<p>It all depends on how big the object is an... | 35,547 |
<p>What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?</p>
| <p><strong>From .NET 4.5 on, there is the <a href="http://msdn.microsoft.com/en-us/library/system.io.stream.copytoasync.aspx" rel="noreferrer"><code>Stream.CopyToAsync</code> method</a></strong></p>
<pre><code>input.CopyToAsync(output);
</code></pre>
<p>This will return a <a href="http://msdn.microsoft.com/en-us/libr... | <p>The following code to solve the issue copy the Stream to MemoryStream using CopyTo</p>
<pre><code>Stream stream = new MemoryStream();
</code></pre>
<p>//any function require input the stream. In mycase to save the PDF file as stream
document.Save(stream);</p>
<pre><code>MemoryStream newMs = (MemoryStream)stream;
by... | 28,488 |
<p>I'm sorry, but this keyword doesn't mean anything to me... Can someone give me a definition?</p>
<p>Thanks in advance...</p>
| <p>It's a brand. <a href="http://www.pervasive.com/" rel="nofollow noreferrer">http://pervasive.com/</a> And here is a link to their DB products <a href="http://www.pervasivedb.com/Pages/PDBProducts.aspx" rel="nofollow noreferrer">http://www.pervasivedb.com/Pages/PDBProducts.aspx</a> including Pervasive PSQL</p>
| <p>Do you mean <a href="http://ww2.pervasive.com/Database/Products/PSQLv10/Pages/PSQLOverview.aspx" rel="nofollow noreferrer">Pervasive PSQL</a>?</p>
| 31,647 |
<p>Let me preface this by saying I don't care what language this solution gets written in as long as it runs on windows. </p>
<p>My problem is this: there is a site that has data which is frequently updated that I would like to get at regular intervals for later reporting. The site requires JavaScript to work properly... | <p>You could probably use web app testing tools like Watir, Watin, or Selenium to automate the browser to get the values from the page. I've done this for scraping data before, and it works quite well.</p>
| <p>Give <a href="http://www.badboy.com.au/" rel="nofollow noreferrer">Badboy</a> a try. It's meant to automate the system testing of your websites but you may find it's regular expression rules handy enough to do what you want.</p>
| 33,295 |
<p>You can pass a function pointer, function object (or boost lambda) to std::sort to define a strict weak ordering of the elements of the container you want sorted.</p>
<p>However, sometimes (enough that I've hit this several times), you want to be able to chain "primitive" comparisons.</p>
<p>A trivial example woul... | <p>You could build a little chaining system like so:</p>
<pre><code>struct Type {
string first, last;
int age;
};
struct CmpFirst {
bool operator () (const Type& lhs, const Type& rhs) { return lhs.first < rhs.first; }
};
struct CmpLast {
bool operator () (const Type& lhs, const Type& rhs) ... | <p>The chaining solution is verbose. You could also use boost::bind in conjunction with std::logical_and to build your sorting predicate. See the linked article for more information: <a href="http://www.informit.com/articles/article.aspx?p=412354&seqNum=4" rel="nofollow noreferrer" title="How the boost bind library... | 34,646 |
<p>Okay i am working on someone elses code. They do alot of this:</p>
<pre><code>char description[256];
description[0]=0;
</code></pre>
<p>I know this would put a \0 in the first spot of the character array. But is this even a safe way to erase a string?</p>
<p>Also visual studio keeps reporting memory leaks, and i'... | <p>To <em>initialize</em> the string to 0, you could do:</p>
<pre><code>char description[256] = {0};
</code></pre>
<p>that will assign 0 to every element of the array.</p>
<p>Just setting the first element to <code>0</code> (<code>'\0'</code>) does not erase it's contents. It doesn't even guarantee the entire string... | <p>If it's a char[] string, and the only operations performed on it are string functions, it's fine. Of course, it's not good enough for protected data.</p>
<p>As for memory leaks, it might be worth changing to the safe versions of the string functions, but you can't leak static or stack-based strings, so it's probab... | 39,269 |
<p>While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.</p>
<ol>
<li>It can help you understand the problem better. Maybe you don't <em>have</em> to solve it the way you thought you did.</li>
<li>... | <p>Turns out, it's not as hard as you might think. The syntax is ugly as hell, but the batch syntax is actually capable of some surprising things, including recursion, local variables, and some surprisingly sophisticated parsing of strings. Don't get me wrong, it's a terrible language, but to my surprise, it isn't c... | <p>Here's a more legible version that I wrote awhile ago:</p>
<pre><code>@echo off
echo Sorting: %*
set sorted=
:sort
:: If we've only got one left, we're done.
if "%2"=="" (
set sorted=%sorted% %1
:: We have to do this so that sorted gets actually set before we print it.
goto :finalset
)
:: Check if it's in... | 16,120 |
<p>I need to show a camera capture dialog in a compact framework 3.7 application by pinvoking SHCameraCapture from the dll Aygshell.dll. I cannont use the managed object CameraCaptureDialog because of limitations with the technology I'm working with. Instead, I need to access it by Pinvoking it.</p>
<p>See <a href="... | <p>this code works....</p>
<pre><code>#region Enumerations
public enum CAMERACAPTURE_STILLQUALITY
{
CAMERACAPTURE_STILLQUALITY_DEFAULT = 0,
CAMERACAPTURE_STILLQUALITY_LOW = 1,
CAMERACAPTURE_STILLQUALITY_NORMAL = 2,
CAMERACAPTURE_STILLQUALITY_HIGH = 3
}
public enum CAMERACAPTURE_VIDEOTYPES
{
CAMERA... | <p>I've not been able to test this, but your struct/function should look something like this:</p>
<pre><code>struct SHCAMERACAPTURE {
public Int32 cbSize;
public IntPtr hwndOwner;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szFile;
[MarshalAs(UnmanagedType.LPStr)]
string pszIni... | 16,457 |
<p>During undergrad i opted to take a network programming course using the POSIX sockets for linux. As a reference we used the book Internetworking using TCP/IP (comer and stevens). 2008 its a pretty dated and still applicatable texts which takes one through several server designs. </p>
<p>One design that is not real... | <p>Since a socket is simply a number attached to a packet (call it a routing number or address), I can't imagine the socket itself getting congested.</p>
<p>Your code handling the socket could, but that should be pretty easily fixed by distributing packets as they arrive.</p>
<p>You could also code incoming and outgo... | <p>TCP connections are already full-duplex. You could (simplifying things) think of a TCP connection as a pair of unidirectional connections (one sending and one receiving).</p>
<p>Sending multiple requests via a single connection is actually used to <em>increase</em> performance in several protocols (since resusing a... | 36,178 |
<p>We are building an hosted application that uses MS SQL Server Analysis Services 2005 for some of the reporting, specifically OLAP cube browsing. Since it is designed to be used by very large global organizations, security is important.</p>
<p>It seems that Microsoft's preferred client tool for browsing OLAP cubes ... | <p>Basic authentication will work with local user accounts (non-domain) and even support passthrough authentication if the local accounts exist on different machines, however you should force SSL as basic authentication sends passwords in plaintext. </p>
<p>You can use non-windows accounts with basic authentication in... | <p>For a (relatively) cheap thin client front-end for SSAS look at <a href="http://www.rsinteract.com/about/index.html" rel="nofollow noreferrer">RSInteract</a>. For bonus points it will also consume SSRS reports and report models. </p>
<p>Any attempt to use dimension security will require SSAS to be aware of the us... | 15,368 |
<p>I'm working in Flash CS3, targeting Actionscript 2, and I'm writing an image preloader. When I test the movie with the download simulation turned on everything works just fine, and my preloader successfully updates the download progress bar I've made. When I upload the movie to my web server though, it almost behav... | <p>I'd suggest using a debugging proxy like Charles (<a href="http://www.charlesproxy.com/" rel="nofollow noreferrer">http://www.charlesproxy.com/</a>) to see how the file is being downloaded from your server (e.g. is there a high latency before the download begins, how many seconds does it actually take to transfer th... | <p>Thank you for the quick reply Matt. I had never heard of Charles before, but it seems like an incredibly powerful tool. For my purposes I can also see the file get requests and progress using Firebug's Net tool in Firefox. Both Charles and Firebug show that the images are being requested and downloaded successful... | 12,708 |
<p>Hopefully I can do the problem justice, because it was too difficult to summarise it in the title! (suggestions are welcome in the comments)</p>
<p>Right, so here's my table:</p>
<pre><code>Tasks
task_id (number)
job_id (number)
to_do_by_date (date)
task_name (varchar / text)
status... | <p>Obviously you will have to fix this up a bit but I hope you get the idea.</p>
<pre><code>SELECT
task_id, job_id, to_do_by_date, task_name, status, completed_date
FROM
Tasks
WHERE
job_id IN (
SELECT job_id
FROM Tasks
WHERE status <> 'Done'
GROUP BY job_id)
OR... | <p>Given your requirements, it's not obvious to me why job_id 2 should be returned in your results. There is one task with a status of Done, so it fails the first criteria </p>
<blockquote>
<p>all of the tasks for a job_id have a
status <> Done</p>
</blockquote>
<p>And there are tasks with a status other than... | 30,917 |
<p>I accidentally added a binary file to SVN with the add command, and now I want to remove it from being version controlled, but not delete the file. How do I do this?</p>
| <p>svn rm --keep-local</p>
| <p>The simplest way I know how to do that is to move the file, delete the file using svn, and then move the file back. </p>
| 25,899 |
<p>I'd like to <strong>indent a block of text</strong>.</p>
<p>I am able to do this in the <strong>Linux</strong> build of gVim.</p>
<p>I do this in the <strong>state</strong> of gVim where I'm not in the insert or visual mode. The bar at the bottom is blank on the left, and the line number and percentage are showing... | <p>If you first enter SHIFT-V, and than shift+arrows to select the text, it will indent.
You can also use SHIFT-V, and use 'hjkl' to select the block.</p>
<p>If you use shift+arrows or the mouse to select a block of text, it does not work and the selection will be replaced with a '>'. This can be changed when you chan... | <p>You need to change <code>behave mswin</code> to <code>behave xterm</code> in your vimrc file.</p>
| 41,231 |
<p>When it comes to web-design, I am horrible at producing anything remotely good looking. Thankfully there are a lot of free <a href="http://www.mantisatemplates.com/web-templates.php" rel="noreferrer">sources</a> for <a href="http://www.freecsstemplates.org/" rel="noreferrer">design</a> <a href="http://www.oswd.org/"... | <p>Check out the <a href="http://developer.yahoo.com/yui/grids/" rel="nofollow noreferrer">Grids framework</a> from YUI. Particularly awesome is the <a href="http://developer.yahoo.com/yui/grids/builder/" rel="nofollow noreferrer">Grid Builder</a>. Also, they have a set of reset, base, and font CSS files that will give... | <p><a href="http://www.blueprintcss.org/" rel="nofollow noreferrer">BluePrintCSS</a> was, from what I know, the first CSS framework.
As YUI CSS Framework, It's help you to handle layout.</p>
<p>That kind of framework will help you to build multiple CSS for your site.</p>
<p>BluePrintCSS is a quite mature project so I... | 6,501 |
<p>I'm getting this printing where it's not laying the plastic down very well. What could be causing this? I've printed with these settings before, and it turned out just fine. If you need any other info to properly diagnose this, let me know.</p>
<p>I'm using a Robo3D R1+</p>
<p>[<img src="https://i.stack.imgur.com/... | <p>I´ve seen this in my Prusa due two parameters that may vary your results depending on climate if your printer has not a temperature chamber or having a mechanical issue too.</p>
<p>Lack of extrusion is due a cold filament which it can't reach the melting temperature due a fast extrusion feed; I mean in normal condi... | <p>I had this problem also. After a few hours of troubleshooting and changing the extruder temp, printing speed, layer height, and infill density. I realized that I had set the PLA diameter at 2.85 mm when it was 1.75 mm. Changing that fixed all my problems.</p>
| 680 |
<p>I have recently started looking into Google Charts API for possible use within the product I'm working on. When constructing the URL for a given chart, the data points can be specified in three different formats, unencoded, using simple encoding and using extended encoding (<a href="http://code.google.com/apis/chart... | <p>When using the Google Chart API, you will usually need to scale your data yourself so that it fits within the 0-4095 range required by the API.</p>
<p>For example, if you have data values from 0 to 1,000,000 then you could divide all your data by 245 so that it fits within the available range (1000000 / 245 = 4081)... | <p>Per data scaling, this may also help you:</p>
<p><a href="http://code.google.com/apis/chart/formats.html#data_scaling" rel="nofollow noreferrer">http://code.google.com/apis/chart/formats.html#data_scaling</a></p>
<p>Note the chds parameter option.</p>
<p>You may also wish to consider leveraging a wrapper API that... | 36,891 |
<p>Is there an incantation of mysqldump or a similar tool that will produce a piece of SQL2003 code to create and fill the same databases in an arbitrary SQL2003 compliant RDBMS? </p>
<p>(The one I'm trying right now is MonetDB)</p>
| <p>DDL statements are inherently database-vendor specific. Although they have the same basic structure, each vendor has their own take on how to define types, indexes, constraints, etc. </p>
<p>DML statements on the other hand are fairly portable. Therefore I suggest:</p>
<ul>
<li>Dump the database without any data (... | <p>From SQL Server 2000 or 2005 you can have it generate scripts for your objects, but I am not sure how well they will transfer to other RDBMS.</p>
| 11,110 |
<p>Application able to record error in OnError, but we are not able to do any redirect or so to show something meaningfull to user.
Any ideas?
I know that we can set maxRequestLength in web.config, but anyway user can exceed this limit and some normal error need to be displayed.</p>
| <p>As you say you can setup maxRequestLength in your web.config (overriding the default 4MB of your machine.config) and if this limits is exceeded you usually get a HTTP 401.1 error.</p>
<p>In order to handle a generic HTTP error at application level you can setup a CustomError section in your web.config within the sy... | <p>You could check the length of the postedfile (FileUpload.PostedFile.ContentLength), to see if it's below the limit or not and simply showing a friendly error message if necessary.</p>
| 15,345 |
<p>I do TDD on a daily basis for my C++ development on Solaris10. It has greatly reduced the time I have to spend using my debugger but sometime this is the only option.</p>
<p>DBX is pretty powerful but not that user friendly. Note that I'm talking about console DBX not the SunStudio GUI for DBX).</p>
<p>What are th... | <p>I have bookmarked a few sites related to dbx. Here they are, in no particular order in case they might be useful to you:</p>
<ul>
<li><a href="http://developers.sun.com/solaris/articles/dbxerr.html" rel="nofollow noreferrer">Why Can't dbx Find My Function?</a></li>
<li><a href="http://blogs.oracle.com/quenelle/reso... | <p>I too <em>have</em> to use dbx at work and understand your frustrations! </p>
<p>A few tips I have discovered which make my life a little easier:</p>
<p>Using the built commands system like this:
when stop { print <em>whatever</em> ; }<br>
Obviously doesn't work when <em>whatever</em> is out of scope, but I find i... | 27,086 |
<p>Are there limits or performance penalties on the amount of code inside of my <code>home.cs</code> form?</p>
<p>I am writing a database application front-end in C# in Visual Studio 2008. The way things are lining up, I am using a tab-page way of changing the info shown to the end users, instead of using new forms. <... | <p>It's not the lines of code in your .cs files that you need to be worried about with regards to performance - it's the number of controls on your form at runtime that might cause problems. If it's just a few controls on a few tabs, you will have no problems. If it's hundreds of controls on lots of tabs, you may hav... | <p>Sounds horrible but I don't see any reason why it would be a problem.</p>
| 37,062 |
<p>In an ideal world, our development processes would be perfect, resulting in regular releases that were so thoroughly tested that it would never be necessary to "hotfix" a running application.</p>
<p>But, unfortunately, we live in the real world, and sometimes bugs slip past us and don't rear their ugly heads until ... | <p>[Even though we test a lot before we release, ] What we do is this:</p>
<p>Our SVN looks like this:</p>
<pre><code>/repo/trunk/
/repo/tags/1.1
/repo/tags/1.2
/repo/tags/1.3
</code></pre>
<p>Now whenever we release, we create a tag which we eventually check out in production. Before we do production, we do staging wh... | <p>We divide our code in framework code and business customizations. Business customization classes are loaded using a separate classloader and we have tool to submit changes to a running instance of production. whenever we need a change in any class we change it and submit it to a running instance. the running instanc... | 17,354 |
<p>I'd like to run a long rsync command in Cygwin by double clicking on a .sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work?</p>
<p>Note: I've just found <a href="http://web.archive.org/web/20121204091631/http://b... | <p>Ok, I've found something that works. Associating a batch file as Vladimir suggested didn't work, but the bash arguments were key. </p>
<p>Short and sweet: associate with this command: <strong>"C:\cygwin\bin\bash.exe" -li "%1" %*</strong></p>
<p>Long version if you don't know how:</p>
<ol>
<li>In Explorer, go to... | <p>One solution that works is to create a <code>.bat</code> file that will open cygwin and execute your script.</p>
<p>The script to execute the script <code>go.sh</code> located on my home directory:</p>
<pre><code>@echo off
C:
chdir C:\cygwin\bin
bash --login -i ./go.sh
</code></pre>
| 13,066 |
<p>I want to pause input in a shell script, and prompt the user for choices.<br>
The standard <code>Yes</code>, <code>No</code>, or <code>Cancel</code> type question.<br>
How do I accomplish this in a typical bash prompt?</p>
| <p>The simplest and most widely available method to get user input at a shell prompt is the <a href="https://www.gnu.org/software/bash/manual/bashref.html#index-read" rel="noreferrer"><code>read</code></a> command. The best way to illustrate its use is a simple demonstration:</p>
<pre><code>while true; do
read -p &... | <p>I've made this small script for yes/no questions: <a href="https://github.com/optimistiCli/getans" rel="nofollow noreferrer">https://github.com/optimistiCli/getans</a></p>
<p>Example:</p>
<pre class="lang-sh prettyprint-override"><code>#!/bin/bash
if ! getans.sh 'Shall we proceed?' y ; then
echo "User said... | 28,040 |
<p>I have a custom class that implements that IComparable. This class is stored in a Generic List. I now need to compare to lists to see which objects are in list A but not in list B. </p>
<p>I thought the most simple way of doing this would be to iterate through list B and do A.contains().</p>
<p>I do not know ho... | <p>Why don't you just override the <code>Equals</code> method of your class to be consistent in meaning with <code>CompareTo(other) == 0</code>? This is the simplest way and also the most idiomatic since, as you've noticed, <code>Contains</code> compares equality rather than using <code>CompareTo</code>. However, this ... | <p>Thank you Konrad for such a quick and helpful reply. Worked a treat! I used IComparable originally because I needed to sort them on certain criteria but overriding equals worked perfectly for .contains.</p>
<p>:) </p>
| 26,865 |
<p>I have a SQL Mobile database with one table. It has several columns with useful, often queried data and one column that stores a relatively large string per record (1000+ characters) that is not queried often.</p>
<p>Imagine this fake schema, the "lifeStory" field is the large one.</p>
<pre><code>table1
String fir... | <p>From a <a href="http://www.scootersoftware.com/vbulletin/showthread.php?t=41520" rel="noreferrer">Beyond Compare forum post</a>:</p>
<p>/usr/bin/bcompare_svn:</p>
<pre><code>#!/bin/bash
/usr/bin/bcompare $6 $7 &
exit 0
</code></pre>
<p>The invocation of bcompare is obvious but I had to add "exit 0" so that sv... | <p>I recently added instructions for Subversion on Linux to our <a href="http://www.scootersoftware.com/support.php?zz=kb_vcs.php" rel="nofollow noreferrer">Using Beyond Compare With Version Control Systems</a> web page. Once you follow the steps at the above link it should launch Beyond Compare 3 for Linux when you ru... | 36,112 |
<p>How do you add type ahead functionality to an asp.net dropdownlist control?</p>
| <p>More specifically, check out the ListSearch extender. A demo is available <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ListSearch/ListSearch.aspx" rel="nofollow noreferrer">here</a></p>
| <p>look at ajax contol toolkit at www.asp.net</p>
| 36,140 |
<p>I have an ANSI encoded text file that should not have been encoded as ANSI as there were accented
characters that ANSI does not support. I would rather work with UTF-8.</p>
<p>Can the data be decoded correctly or is it lost in transcoding?</p>
<p>What tools could I use?</p>
<p>Here is a sample of what I have:</p>... | <p>EDIT: A simple possibility to eliminate before getting into more complicated solutions: have you tried setting the character set to utf8 in the text editor in which you're reading the file? This could just be a case of somebody sending you a utf8 file that you're reading in an editor set to say cp1252. </p>
<p>Just... | <p>And then there is the somewhat older <a href="http://directory.fsf.org/project/recode/" rel="nofollow noreferrer">recode</a> program.</p>
| 16,042 |
<p>I'm looking to add support for reading and writing video files in my application. If you had to choose exactly one file format and codec combination that would satisfy the majority of users, which would you choose:</p>
<p>1) MPEG-4/H.264 (.mp4)
2) AVI/DiVX (.avi)
3) Ogg/Theora (.ogg)
4) Windows Media Video (.wmv)<... | <p>It depends on what your application is doing. If you want to process videos recorded from a video capture card, you'll probably need to be able to read .mpg files with mpeg2 embedded. A large number of videos use the .avi or .wmv container. Microsoft is pushing .wmv, but .avi has a lot better support amongst free... | <p>First of all, will you also have sound in your videos ? If yes, I'd go with mp3.</p>
<p>Now, considering the video codec and video container. I think that you should not consider options 3 and 4 for various reasons. Theora is really unpopular (i've yet to just come across a theora video) and WMV is a Microsoft tech... | 39,332 |
<p>I have an application where I have potentially many processes must send a message to one process. I figured the most expedient way to do this would be to just send a UDP datagram.</p>
<p>When opening a socket, I need to specify which port to listen to. As I just want to fire and forget the UDP datagram, I'd like ... | <p>Yes. Specify 0 as the port. The OS will pick an available port for you.</p>
| <p>Answering the "Problem" rather than the "Question"</p>
<p>If all the processes are operating on the same PC, you might want to look into shared files or some other means of communications other than a networking stack.</p>
<p>I'd suggest you explore the options in Boost's Interprocess library
<a href="http://www.b... | 34,887 |
<p>I have a Flex application that calls a function which searches a large document collection. Depending on the search term, the user may want to stop the request from flex. </p>
<p>I’d like to not only stop the flex application from expecting the request, but also stop the CFC request. Is this possible? What’s the be... | <p>I don't think there is a <strong>direct</strong> way to stop a page call externally. According to the docs, only the thread itself and it's parent can abort a given thread.</p>
<p>However, you could set a flag for a given thread in a shared scope.</p>
<p>Let's say you call a method that starts some background pro... | <p>You can programmatically end requests with either <code><cfabort/></code> or <code><cfsetting requesttimeout="0"/></code> - but that's on the CF server side of things, which I don't think is what you're asking?</p>
<p>Ending it remotely... well, if you have FusionReactor it <em>might</em> be possible to... | 19,776 |
<p>I have a string (char) and I want to extract numbers out of it.</p>
<p>So I have string: <code>1 2 3 4 /0</code><br>
And now I want some variables, so I can use them as integer: <code>a=1, a=2, a=3, a=4</code></p>
<p>How can I do that?</p>
| <p>If the string always contains 4 numbers delimited with spaces, then it could be done with sscanf:</p>
<pre><code>sscanf(string, "%d %d %d %d", &a, &b, &c, &d);
</code></pre>
<p>If the count of numbers varies, then you would need to parse the string.</p>
<p>Please clarify your question accordingly.... | <p>sscanf() can do that.</p>
<pre><code>#include <stdio.h>
int main(void)
{
int a, b, c, d;
sscanf("1 2 3 4", "%d %d %d %d", &a, &b, &c, &d);
printf("%d,%d,%d,%d\n", a, b, c, d);
}
</code></pre>
| 27,807 |
<p>Many times I will use the same font scheme for static text in a wxPython application. Currently I am making a <code>SetFont()</code> call for each static text object but that seems like a lot of unnecessary work. However, the wxPython demo and wxPython In Action book don't discuss this.</p>
<p>Is there a way to eas... | <p>You can do this by calling SetFont on the parent window (Frame, Dialog, etc) before adding any widgets. The child widgets will inherit the font.</p>
| <p>If all widgets have already been created, you can apply <code>SetFont</code> recursively, for example with the following function:</p>
<pre><code>def changeFontInChildren(win, font):
'''
Set font in given window and all its descendants.
@type win: L{wx.Window}
@type font: L{wx.Font}
'''
try:... | 20,700 |
<p>Is there a freely available Base64 decoding code snippet in C++?</p>
| <p>See <em><a href="http://www.adp-gmbh.ch/cpp/common/base64.html" rel="noreferrer">Encoding and decoding base 64 with C++</a></em>.</p>
<p>Here is the implementation from that page:</p>
<pre><code>/*
base64.cpp and base64.h
Copyright (C) 2004-2008 René Nyffenegger
This source code is provided 'as-is', witho... | <p>I liked <a href="https://github.com/mvorbrodt/blog/blob/master/src/base64.hpp" rel="nofollow noreferrer">this solution on GitHub</a>.</p>
<p>It is a single hpp file and it uses the vector<byte> type for raw data unlike the accepted answer.</p>
<pre><code>#pragma once
#include <string>
#include <vecto... | 21,831 |
<p>I want to add gmail-like file upload functionality for one of my projects. Can anybody help me with this?</p>
<p>My application is built in vb.net.</p>
<p>I would appreciate any kind of help or guidance.</p>
<p>Thanks</p>
| <p>Check out <a href="http://swfupload.org/" rel="noreferrer">SWFUpload</a>, which is essentially a javascript api to flash's absolutely superior file upload handling capabilities. Best thing out there until the browsers finally catch up.</p>
<p>From link:</p>
<blockquote>
<ul>
<li>Upload multiple files at once ... | <p>I'd like a little more clarification of "Gmail-like" file uploading.</p>
<p>do you mean how if it sits for a little bit, it automatically attaches it to a draft?</p>
| 16,366 |
<p>I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis.</p>
<p>Using this method, however, leaves me with everything having the same precedence - it's evaluated left to right regardless of operator, although... | <h3>The hard way</h3>
<p>You want a <a href="http://en.wikipedia.org/wiki/Recursive_descent_parser" rel="noreferrer">recursive descent parser</a>.</p>
<p>To get precedence you need to think recursively, for example, using your sample string, </p>
<pre><code>1+11*5
</code></pre>
<p>to do this manually, you would hav... | <p>Actually there's a way to do this without recursion, which allows you to go through the entire expression once, character by character. This is O(n) for time and space. It takes all of 5 milliseconds to run even for a medium-sized expression.</p>
<p>First, you'd want to do a check to ensure that your parens are ba... | 4,792 |
<p>I need to find a faster way to number lines in a file in a specific way using tools like awk and sed. I need the first character on each line to be numbered in this fashion: 1,2,3,1,2,3,1,2,3 etc.</p>
<p>For example, if the input was this:</p>
<pre><code>line 1
line 2
line 3
line 4
line 5
line 6
line 7
</code></p... | <p>Try the <code>nl</code> command.</p>
<p>See <a href="https://linux.die.net/man/1/nl" rel="noreferrer">https://linux.die.net/man/1/nl</a> (or another link to the documentation that comes up when you Google for "man nl" or the text version that comes up when you run <code>man nl</code> at a shell prompt).</p>
<block... | <p>This should solve the problem. $_ will print the whole line.</p>
<pre><code>awk '{print ((NR-1)%3+1) $_}' < input
1line 1
2line 2
3line 3
1line 4
2line 5
3line 6
1line 7
# cat input
line 1
line 2
line 3
line 4
line 5
line 6
line 7
</code></pre>
| 45,655 |
<p>I did a bit of googling hoping to find a post on IDEA shortcuts similar to Jeff's post on Visual Studio shortcuts (<a href="http://www.codinghorror.com/blog/archives/000315.html" rel="noreferrer">Visual Studio .NET 2003 and 2005 Keyboard Shortcuts</a>), but didn't really spot anything that helped. Hopefully the ans... | <p>These are some of my most used keyboard short cuts</p>
<p>Syntax aware selection in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, e... | <p><a href="http://www.jetbrains.com/idea/docs/ReferenceCard70_mac.pdf" rel="nofollow noreferrer">http://www.jetbrains.com/idea/docs/ReferenceCard70_mac.pdf</a> has everything you need. after a while, you'll develop your own preference for certain shortcuts.</p>
| 37,548 |
<p>I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty?</p>
| <p>I would suggest something like:-</p>
<pre><code> bool nonEmptyDataSet = dataSet != null &&
(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any();
</code></pre>
<p><strong>Edits:</strong> I have significantly cleaned up the code after due consideration, I think this is much cle... | <p>To be clear, you would first need to look at all the DataTables, and then look at the count of Rows for each DataTable.</p>
| 7,010 |
<p>A simple question, but could someone provide sample code as to how would someone call a web service from within the JBoss Seam framework, and process the results?</p>
<p>I need to be able to integrate with a search platform being provided by a private vendor who is exposing his functionality as a web service. So, I... | <p>There's roughly a gajillion HTTP client libraries (Restlet is quite a bit more than that, but I already had that code snippet for something else), but they should all provide support for sending GET requests. Here's a rather less featureful snippet that uses <a href="http://hc.apache.org/httpclient-3.x/tutorial.html... | <pre><code>import org.restlet.Client;
import org.restlet.data.Protocol;
import org.restlet.data.Reference;
import org.restlet.data.Response;
import org.restlet.resource.DomRepresentation;
import org.w3c.dom.Node;
/**
* Uses YAHOO!'s RESTful web service with XML.
*/
public class YahooSearch {
private static final... | 8,098 |
<p>I found one source which successfully overrode <code>Time.strftime</code> like this:</p>
<pre><code>class Time
alias :old_strftime :strftime
def strftime
#do something
old_strftime
end
end
</code></pre>
<p>The trouble is, <code>strftime</code> is an instance method. I need to override <code>Time.now... | <p>This is kinda hard to get your head around sometimes, but you need to open the "eigenclass" which is the singleton associated with a specific class object. the syntax for this is class << self do...end. </p>
<pre><code>class Time
alias :old_strftime :strftime
def strftime
puts "got here"
old_st... | <p>I've been trying to figure out how to override an instance method using modules.</p>
<pre><code>module Mo
def self.included(base)
base.instance_eval do
alias :old_time_now :now
def now
my_now = old_time_now
puts 'overrided now'
# new code
my_now
end
end
... | 36,649 |
<pre><code>private string? typeOfContract
{
get { return (string?)ViewState["typeOfContract"]; }
set { ViewState["typeOfContract"] = value; }
}
</code></pre>
<p>Later in the code I use it like this:</p>
<pre><code>typeOfContract = Request.QueryString["type"];
</code></pre>
<p>I am getting the following error at ... | <p>System.String is a reference type and already "nullable".</p>
<p>Nullable<T> and the ? suffix are for value types such as Int32, Double, DateTime, etc.</p>
| <p>For nullable, use <code>?</code> with all of the <strong>C# primitives</strong>, except for string.</p>
<p>The following page gives a list of the <strong>C# primitives</strong>:
<a href="http://msdn.microsoft.com/en-us/library/aa711900(v=vs.71).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa711900(v... | 22,692 |
<p>I've written some software for a customer, and I'd like to release it to them under a license that permits them to make modifications for their own in-house use, but still prohibits them from selling or otherwise redistributing the software after I've given it to them. Can someone point me to a license that either h... | <p>I know of no such license, and Googling for licenses gives a bazillion hits on the GPL and Open Source licenses...</p>
<p>You could try to look at <a href="http://www.fsf.org/licensing/licenses/index_html#NonFreeSoftwareLicense" rel="nofollow noreferrer">Free Software Foundations rundown on non-free licenses</a>, a... | <p>Why not just write a proprietary license of your own?</p>
<p>I don't think you'll be able to use any of the existing published and explained licenses, since these are geared toward sharing and that's exactly what you're trying to avoid.</p>
| 29,994 |
<p>What should do to setup a sub-domain for the users when they sign-up into my site.</p>
<p>What are the infrastructure required? I am using Linux servers.</p>
| <p>You can make a CNAME entry/ A Record in your DNS settings, for each subdomain</p>
<blockquote>
<p>A CNAME record is a record in your
Domain Management Settings that allows
you to control a subdomain of your
domain.</p>
</blockquote>
<p><strong>To automate it</strong> along with registration, you can write ... | <p>infrastructure includes access the the dns server to add a wildcard entry, and rewrite rules in Apache.</p>
<p>Try these answers:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/183928/how-to-let-php-to-create-subdomain-automatically-for-each-user">How to let PHP to create subdomain automatically for eac... | 41,575 |
<p>I need the values of form inputs to be populated by the sql database. My code works great for all text and textarea inputs but I can't figure out how to assign the database value to the drop down lists eg. 'Type of property' below. It revolves around getting the 'option selected' to represent the value held in the d... | <p>using your current code:</p>
<pre><code><?php
$options = array('House', 'Bungalow', 'Flat/Apartment', 'Studio', 'Villa', 'Any');
foreach($options as $option) {
if ($option == $row['req_type']) {
print '<option selected="selected">'.$option.'</option>'."\n";
} else {
print '&l... | <p>Here is another way of going about it.</p>
<pre><code><?php
$query = "SELECT * FROM ".$prefix."_users WHERE userid='$userid'";
$result = mysql_query($query); ?>
$options = array('House', 'Bungalow', 'Flat/Apartment', 'Studio', 'Villa', 'Any');
<select name="venue">
<?php
while($row = mysql_fetch_... | 25,206 |
<p>I've been asked to develop a simple GUI application using Matlab and GUIDE, which will interact with a separate backend engine (also Matlab). I'm coming from a Java and .Net background.</p>
<p>The Matlab documentation is strong on how to technically do this, but says little about the "engineering" process, in parti... | <p>This is a perfectly reasonable question, and with a bit of care it is possible to write GUI code that is easy to maintain. Some suggestions:</p>
<ul>
<li><p>Put the GUI layout code and the "business logic" in different m-files. (see <a href="http://www.mathworks.com/matlabcentral/fileexchange/16403" rel="nofollow n... | <p>I don't have experience with creating GUI's in matlab but if your company will spend mony on it matlab for .net may be a quicker option. It will allow you to write matlab code that will be rapped in a com component that can be called from .net which means you could write your GUI in any .net language you wanted. The... | 43,525 |
<p>I have a old website that generate its own RSS everytime a new post is created. Everything worked when I was on a server with PHP 4 but now that the host change to PHP 5, I always have a "bad formed XML". I was using xml_parser_create() and xml_parse(...) and fwrite(..) to save everything.</p>
<p>Here is the exampl... | <p>At swcombine.com we use <a href="http://feedcreator.org/" rel="nofollow noreferrer">Feedcreator</a>. Use that one and your problem will be gone. :)</p>
<p>Here is the PHP code to use it once installed:</p>
<pre><code>function feed_simnews() {
$objRSS = new UniversalFeedCreator();
$objRSS->title = 'My Ne... | <p>PHP5 now comes with the <code>SimpleXML</code> extension, it's a pretty quick way to build valid XML if your needs aren't complicated.</p>
<p>However, the problem you're suggesting doesn't seem to an issue of implementation more a problem of syntax. Perhaps you could update your question with a code example, or, a ... | 10,852 |
<p>I have a class A and another class that inherits from it, B. I am overriding a function that accepts an object of type A as a parameter, so I have to accept an A. However, I later call functions that only B has, so I want to return false and not proceed if the object passed is not of type B.</p>
<p>What is the best... | <p>dynamic_cast should do the trick</p>
<pre><code>TYPE& dynamic_cast<TYPE&> (object);
TYPE* dynamic_cast<TYPE*> (object);
</code></pre>
<p>The <a href="http://en.cppreference.com/w/cpp/language/dynamic_cast" rel="noreferrer"><code>dynamic_cast</code></a> keyword casts a datum from one pointer or re... | <p>Use overloaded functions. Does not require dynamic_cast or even RTTI support:</p>
<pre><code>class A {};
class B : public A {};
class Foo {
public:
void Bar(A& a) {
// do something
}
void Bar(B& b) {
Bar(static_cast<A&>(b));
// do B specific stuff
}
};
</co... | 45,817 |
<p>I've currently got a set of reports with a number of common functions sitting in code blocks within the .rdl files. This obviously presents a maintainability issue and I as wondering if anyone knew a way for these different reports to share a library of common code?</p>
<p>Ideally I'd like to have a .Net Assembly a... | <p>From within Visual Studio in the properties of the report, on the 'References' tab add the details for the assembly that contains the managed code. This code can be called from expressions within reports using the instance name that is specified.</p>
<p>This assembly can either be stored in the GAC or the PrivateAs... | <p>You must deploy to the GAC.
<a href="http://www.developerdotstar.com/community/node/333" rel="nofollow noreferrer">http://www.developerdotstar.com/community/node/333</a></p>
| 9,700 |
<p>I'm creating an application which lets you define events with a time frame. I want to automatically fill in the end date when the user selects or changes the start date. I can't quite figure out, however, how to get the difference between the two times, and then how to create a new end Date using that difference.<... | <p>In JavaScript, dates can be transformed to the number of milliseconds since the epoc by calling the <code>getTime()</code> method <strong>or</strong> just using the date in a numeric expression.</p>
<p>So to get the difference, just subtract the two dates.</p>
<p>To create a new date based on the difference, just ... | <pre><code>function checkdate() {
var indate = new Date()
indate.setDate(dat)
indate.setMonth(mon - 1)
indate.setFullYear(year)
var one_day = 1000 * 60 * 60 * 24
var diff = Math.ceil((indate.getTime() - now.getTime()) / (one_day))
var str = diff + " days are remaining.."
document.getEle... | 6,336 |
<p>A co-worker recently ran into a situation where a query to look up security permissions was taking ~15 seconds to run using an = comparison on UserID (which is a UNIQUEIDENTIFIER). Needless to say, the users were less than impressed.</p>
<p>Out of frustration, my co-worker changed the = comparison to use a LIKE and... | <p>It may have just been a poor execution plan that had been cached; Changing to the LIKE statement then just caused a new execution plan to be generated. The same speedup may have been noticed if the person had run sp_recompile on the table in question and then re-run the = query.</p>
| <p>Have you tried updating the statistics on this table/database? Might be worth a try.</p>
| 33,209 |
<p><strong>The question, in brief:</strong></p>
<p>In MVC, how do you distinguish between a checkbox click (or a selectbox or listbox change) from a human meaning "Controller, modify the model", and a checkbox click (or a selectbox or listbox change) from the Controller meaning "I'm updating the view because the model... | <p>Just to recap the MVC model. Views should generally update themselves. Here's how it works: a controller changes the state of the model, the model sends updates to its views, the views pull in new state from the model and update themselves. While controllers and views are generally bundled (i.e. drilling down on dat... | <p>This is a tough one. If I understand correctly, the problem results because you've exposed a click handler on your model, and the model's click event is caught by the controller. The controller updates the view, which in turn toggles the same event.</p>
<p>From my point of view, I would consider it inappropriate fo... | 48,858 |
<p>A fillet is like a rounded corner but on the inside of the corner.</p>
<p><a href="https://i.stack.imgur.com/XDTnd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XDTnd.png" alt="enter image description here"></a></p>
<p>Does it make a difference (structurally) to use fillets on a 3d printed part?</p>
| <p>If your part needs structural support, then the word is: <strong>absolutely</strong>. Fillets provide the added support when you need it. If your part has a meeting line which is sharp - 90° (or perpendicular), there is a natural <a href="https://mechanics.stackexchange.com/q/18183/4152">stress riser</a> in your des... | <p>Fillets in X-Y plane (i.e. between two vertical surfaces) work great for 3D prints and increase the strength a lot. They usually also improve the print quality, because the print head can keep a constant speed in the curve instead of slowing down to a sharp corner.</p>
<p>However fillets that extend in Z direction ... | 1,357 |
<p>Suppose I have a stored procedure that manages its own transaction</p>
<pre><code>CREATE PROCEDURE theProc
AS
BEGIN
BEGIN TRANSACTION
-- do some stuff
IF @ThereIsAProblem
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END
</code></pre>
<p>If I call this proc from an existing transaction, the proc ca... | <p>The syntax to do this probably varies by database. But in Transact-SQL what you do is check @@TRANCOUNT to see if you are in a transaction. If you are then you want to create a savepoint, and at the end you can just pass through the end of the function (believing a commit or rollback will happen later) or else rol... | <p>use @@trancount to see if you're already in a transaction when entering</p>
| 12,334 |
<p>Some of the other questions and answers here on SO extol the virtues of using an enterprise repository tool like Archiva, Artifactory, or Nexus. What are the pros and cons of each? How do I choose between them?</p>
<p>In case it helps:</p>
<ul>
<li>We use both Maven 1 and Maven 2 (at least for a while)</li>
<li>We... | <p>We had been using Archiva for a while, and were happy with it. We recently switched hardware, and decided to try out Nexus because we had read some good things about it. We didn't know what we were missing in Archiva, but Nexus is far better. The repository aspect is easier because it "groups" all the repositorie... | <p>I have used Archiva for over a year now and have been very happy with its reliability and performance.</p>
<p>Both Archiva and Artifactory are available as .war files so you can deploy them on an application server. </p>
<p>One advantage of Archiva over Artifactory is that it can share its user database with Conti... | 20,032 |
<p>Okay I have this RewriteRule which is supposed to redirect any request for the file base.css to {folder of .htacces file}/include/style/base.css, but is just keeps redirecting in an infinite loop, I thought the L parameter would make sure that wouldn't happen.</p>
<pre><code>RewriteRule (.*)/base.css$ include/style... | <p>You have Redirect and Rewrite confused. A redirect is a HTTP status code that tells the browser to go to another URL. You actually just want to Rewrite the location to another file location. Try</p>
<pre><code>RewriteRule (.*)/(.*).css$ /include/style/$2.css [L,NC]
</code></pre>
<p>If this doesn't work try addi... | <p>This R=301 makes a new request. Therefor it evaluates the RewriteRule again.</p>
<p>Try to exclude this path/directory with a rewrite condition (RewriteCond).</p>
| 42,969 |
<p>My team works on a Medium sized product which takes about 2 hours to build on a single dual-core machine.
As part of an effort to improve productivity I am looking for alternatives to improve our build process.</p>
<p>Currently we build C++ code and .NET code using VS2005 solutions, we also have some legacy code bu... | <p>Consider NAnt: <a href="http://nant.sourceforge.net/" rel="nofollow noreferrer">http://nant.sourceforge.net/</a>, CruiseControl: <a href="http://en.wikipedia.org/wiki/CruiseControl" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/CruiseControl</a>, and a faster build system. there are some .NET related links ... | <p>With regard to the "Hudson has extensive plugins .. blah blah blah " its really is a sham .. </p>
<p>What ever hudson CANNOT achieve it is core architecture it does so as a plugin </p>
<p>Surprisingly if i have to mask a passsword or any credential i cannot do it without the "password masking" plugin .. </p>
<p>I... | 38,171 |
<p>I've updated my Ender 3 with V4.2.7 mainboard, BLTouch and 400XL kit (extends the capabilities of your Creality Ender 3 3D Printer to a 400 mm X, 400 mm Y and a 500 mm Z printing platform). Now I need to update the firmware. YouTube did not provide any help: i.e.: out of date, so cryptic as to be unusable. Marlin &a... | <p>Without knowing exactly which Youtube videos you've looked at, I think where I would start is by downloading the latest Marlin Fimrware and configuration files for the Ender 3 with 4.2.7 board:</p>
<p><a href="https://github.com/MarlinFirmware/Marlin/archive/2.0.x.zip" rel="nofollow noreferrer">Latest Release of Mar... | <p>I've done the board upgrade on my Ender 3 Pro. As I've read the BLTouch is easy to install. I'd go over to the Creality <a href="https://forums.creality3dofficial.com/" rel="nofollow noreferrer">forum/help</a> site. You can open a support ticket. They actively have information on firmware in both "release"... | 1,901 |
<p>I've noticed RAII has been getting lots of attention on Stackoverflow, but in my circles (mostly C++) RAII is so obvious its like asking what's a class or a destructor.</p>
<p>So I'm really curious if that's because I'm surrounded daily, by hard-core C++ programmers, and RAII just isn't that well known in general (... | <p>For people who are commenting in this thread about RAII (resource acquisition is initialisation), here's a motivational example.</p>
<pre><code>class StdioFile {
FILE* file_;
std::string mode_;
static FILE* fcheck(FILE* stream) {
if (!stream)
throw std::runtime_error("Cannot open fi... | <p>RAII is specific to C++. C++ has the requisite combination of stack-allocated objects, unmanaged object lifetimes, and exception handling.</p>
| 20,013 |
<p>Marlin has a <a href="http://marlinfw.org/tools/lin_advance/k-factor.html" rel="nofollow noreferrer">Linear Advance calibration pattern generator</a>, but I find it's hard to use because:</p>
<ul>
<li>It only prints the initial layer on the bed, where bed irregularities interfere with accurate reading of it.</li>
<... | <p>I measured mine with a thread gauge and it says the pitch is <strong>0.7 mm</strong>.</p>
<p>So, as the stock adjustment wheels have 14 bumps around their circumference, turning by one of those is an adjustment of exactly 0.05 mm (assuming no backlash).</p>
<p>I can't speak for anyone else's, but due to the availabi... | <p>I don't know what the value is, but there are a few ways to find out. It is very hard to measure this with a caliper, but it can be done, mark the upper and bottom of e.g. 10 windings and measure this with a caliper. Alternatively measure how much the screw drops after 10 full turns. </p>
<p>There are special tools... | 1,572 |
<p>How do I set environment variables from Java? I see that I can do this for subprocesses using <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html" rel="noreferrer"><code>ProcessBuilder</code></a>. I have several subprocesses to start, though, so I'd rather modify the current process's en... | <blockquote>
<p>(Is it because this is Java and therefore I shouldn't be doing evil nonportable obsolete things like touching my environment?)</p>
</blockquote>
<p>I think you've hit the nail on the head.</p>
<p>A possible way to ease the burden would be to factor out a method</p>
<pre><code>void setUpEnvironment(... | <p>You can pass parameters into your initial java process with -D:</p>
<pre><code>java -cp <classpath> -Dkey1=value -Dkey2=value ...
</code></pre>
| 41,125 |
<p>I have a .Net compact framework application with a frankly unimpressive UI.</p>
<p>My win32 app uses Dev Express components and looks great, but I can't find anything similar for the compact framework.</p>
<p>Can anyone recommend components that will jazz up my UI?</p>
<p>Does such a thing exist, oram I going to ... | <p><a href="http://www.opennetcf.com/" rel="nofollow noreferrer">OpenNETCF</a> is a large collection of classes, components and controls for the compact framework. I'm not sure that they have anything that'll jazz up your UI, but it'd be worth a look.</p>
| <p>I really like Resco's mobile controls. They are solid and the support is good.</p>
<p>I purchased a few controls from Pocket PC Controls. They are not bad, but if you run into bugs its hit or miss if you hear back from the developer. Basically, it doesn't seem like the components are constantly being updated.</p>
... | 5,650 |
<p>My program receives large CSV files and transforms them to XML files. In order to have better performance I would like to split this files in smaller segments of (for example) 500 lines. What are the available Java libraries for splitting text files?</p>
| <p>What do you intend to do with those data ?</p>
<p>If it is just record by record processing then event oriented (SAX or StaX) parsing will be the way to go. For record by record processing, an existing "pipeline" toolkit may be applicable.</p>
<p>You can pre-process your file with a splitter function like <a href=... | <p>How are you planning on distributing the work once the files have been split?</p>
<p>I have done something similar to this on a framework called GridGain - it's a grid computing framework which allows you to execute tasks on a grid of computers.</p>
<p>With this in hand you can then use a cache provider such as JB... | 41,578 |
<p>I recently read a question on here about static and dynamic linking, which reminded me of some questions I've had about it. From that post, I can see what the technical difference is (including object file contents directly instead of merely pointing to it), but I'd like to know a bit more about the pros/cons of doi... | <p>I am not sure if static linking is a really good idea in C# to be honest, for a million reasons. One reason is that, as opposed to languages like C or C++, C# has the concept of assemblies, which are basically executable files or DLLs.</p>
<p>Now if you want link things statically in .NET, you either</p>
<ul>
<li>... | <p>There is a good example of the difference between static vs dynamic linking. If you check out the InkScape project you will find <a href="http://portableapps.com/apps/graphics_pictures/inkscape_portable" rel="nofollow">InkscapePortable</a> and InkScape. InkscapePortable will run off a USB stick. InkScape will not.</... | 40,263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.