instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I seem to be getting breakpoints from other programmers when checking out code...</p>
<p>Where is the list of breakpoints saved by Visual Studio? In the vbproj file? vbproj.user file? documents and settings? are they meant to be specific to the solution, the project, the user, the computer they are set on?</p>
<p>... | <p>They are saved in the <solutionname>.suo file. SUO stands for Solution User Options, and should not be added to source control.</p>
<p>No .vbproj.user files should be in source control either!</p>
| <p>Starting from Visual Studio 2015 CTP solution and project related files are stored in the .vs directory. The path to the suo file is .vs\<SolutionName>\v14\.suo for Visual Studio 2015.</p>
| 24,402 |
<p>So, in your experience, whats the best way? Is there a secure way that's also scriptable/triggerable in a build automation tool?</p>
<p>Edit: I should mention this is windows/.net and I'll be deploying to iis6</p>
| <p>For some projects I use <a href="http://www.capify.org/" rel="nofollow noreferrer">Capistrano</a> to push out to live. It is built on top of ruby and makes deploy script writing super easy and uses ssh. </p>
<p>On other projects I have a tiny deploy app that uses bash to do an svn export to a temporary directory an... | <p>You could always write a small client/server app that encrypts at the source, pushes the files, and then decrypts at the destination. That's a little bit of work, but probably a trivial amount. And it's scriptable as long as your automation tool supports executing something in the file system (which I think all do).... | 3,883 |
<p>If I do the following:</p>
<pre><code>import subprocess
from cStringIO import StringIO
subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0]
</code></pre>
<p>I get:</p>
<pre><code>Traceback (most recent call last):
File "<stdin>", line ... | <p><a href="https://docs.python.org/3/library/subprocess.html?highlight=subprocess#subprocess.Popen.communicate" rel="noreferrer"><code>Popen.communicate()</code></a> documentation:</p>
<blockquote>
<p>Note that if you want to send data to
the process’s stdin, you need to
create the Popen object with
stdin=PIPE. Simila... | <pre><code>p = Popen(['grep', 'f'], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
p.stdin.write('one\n')
time.sleep(0.5)
p.stdin.write('two\n')
time.sleep(0.5)
p.stdin.write('three\n')
time.sleep(0.5)
testresult = p.communicate()[0]
time.sleep(0.5)
print(testresult)
</code></pre>
| 19,771 |
<p>How to set the turbo c path in windows globally so that i can compile and run my C programs (which are in other drives) using command prompt in windows XP?
Can any one tell me how to get commands at every drive in the command prompt just by typing in </p>
<pre><code>c:\tcc
</code></pre>
<p>in command prompt i... | <ul>
<li>Go to the Start Menu, then Control Panel. </li>
<li>Choose the "System" applet.</li>
<li>Click on the "Advanced" tab.</li>
<li>Click on "Environment Variables"</li>
<li>Find the "Path" variable, and press "Edit"</li>
<li>Append a semicolon, then the path to Turbo C</li>
</ul>
<p>For setting the include and l... | <p>Is there some reason why you're using such an old compiler? Turbo C was last released in the early 1990s, if I remember correctly.</p>
<p>I might suggest downloading the free <a href="http://www.microsoft.com/Express/" rel="nofollow noreferrer">Visual Studio Express Edition</a> which is a much more modern compiler ... | 28,841 |
<p>I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it.<br /><br />What suggestions do you have... | <p>Eric Sink has an <a href="http://www.ericsink.com/scm/source_control.html" rel="noreferrer">excellent series</a> on source code control aimed at beginners. For Subversion specifics, including setting up and administering a server, the <a href="http://svnbook.red-bean.com/" rel="noreferrer">Subversion book</a> is a g... | <p>I recommend using SVN with apache on Linux, svn as a linux client, and TortioseSVN on windows (It does great MS Office diffs).</p>
<p>I have lots of stuff on my svn, and I would hate not using it.</p>
| 5,621 |
<p>I have a server behind a firewall. It runs a web application (Java servlets under Apache Tomcat) and responds only to port 443 (HTTPS). There is no scripting code in the pages served - the forms use HTTP POST to receive the form, process the data (with appropriate input filtering) and then output an HTTP result page... | <p>Given that the only protocols that you're interested in (ssh and https) are "negotiate encryption on connect" there's little that a standard firewall will be able to inspect after that point. Once the SSL/SSH session is established the firewall will only see encrypted packets. Ask your vendor what their product exam... | <p>As a network security professional, this sounds like overkill to me.</p>
<p>Martin Carpenter's answer is 100% on target. Anytime you're considering security, you need to understand</p>
<ul>
<li>What you're securing,</li>
<li>What you're securing it <em>against</em>,</li>
<li>The likelihood of an attack, and</li>
... | 40,003 |
<p>I am given a responsibility in my project to develop a Equipment tracking tool with following requirements</p>
<ol>
<li>New Equipment can be added by admin to a particular user</li>
<li>Once equipment is assigned to a person he will a request to accept the request so he will be responsible</li>
<li>User can transfe... | <p>It still sounds like you want a web app, you just won't be deploying it on a traditional web server. One thing to note, client versions of Windows (XP, Vista) will limit you to 10 incoming connections per computer.</p>
<p>You'll want to follow these <a href="http://docs.djangoproject.com/en/dev/intro/install/#intr... | <p>Try <a href="http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index</a></p>
<p>and if you should deploy using IIS then try <a href="http://code.djangoproject.com/wiki/DjangoOnWindowsWithII... | 39,091 |
<p>I'm using VS2008 for a C++ project. The code is quite old and has passed through many hands. There are several classes hierarchies, functions, enums and so on which are no longer being used.</p>
<p>Is there a way to get the compiler/linker to list out identifiers which have been declared or defined but are not bein... | <p>VS will warn about identifiers declared within a function and not used, you may need to move to warning level 4, but for global variables, and a hunt for many other potential problems, you would do well to try <a href="http://www.gimpel.com/" rel="nofollow noreferrer">lint</a> or <a href="http://www.riverblade.co.uk... | <p>For the most obvious unused declarations, a high warnlevel would take care of the matter. </p>
<p>Regarding the identification of unused pieces of code, the deadstripper (not being the center of a late night crime drama, but the mechanism which culls unused code during linking) will only get you part of the way - w... | 24,944 |
<p>I am writing a macro for Visual studio that will generate some code.</p>
<p>I would like for the macro to generate for both C# and VB, is there a way to determine what language is being used in the active (current) document?</p>
| <p>I just located a bit of code, it seems that it's a hidden property:</p>
<pre><code>DTE.ActiveDocument.Language = "CSharp"
</code></pre>
| <p>Have you considered using <a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx" rel="nofollow noreferrer">T4</a>?</p>
<p>T4 is a code generator built right into Visual Studio. If you're using C#, you'll have a sub .cs file, or if you're using VB, a ... | 31,158 |
<p>When I was at university a lecturer said how some people managed to code using sequence diagrams, this to me seems a good way of programming but of course the devil is in the details. I have a few questions.</p>
<ul>
<li>Does this actually happen or was I
misinterpreting what he said?</li>
<li>Has
anyone here actu... | <p>I've found that "normal" sequence diagrams are almost always more of a pain than they're worth (although I have found them useful for showing data flow in LINQ). Doing a "rough and ready" diagram and explaining it (preferably in person, but with plenty of words either way) works better in my experience.</p>
<p>I th... | <p>Sequence diagrams work for procedural languages. They are not as useful for OO languages.</p>
| 34,861 |
<p>When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with <code>grep</code> and <code>sed</code>. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?... | <p>I've found xmlstarlet to be pretty good at this sort of thing. </p>
<p><a href="http://xmlstar.sourceforge.net/" rel="noreferrer">http://xmlstar.sourceforge.net/</a></p>
<p>Should be available in most distro repositories, too. An introductory tutorial is here:</p>
<p><a href="http://www.ibm.com/developerworks/lib... | <p>JEdit has a plugin called "XQuery" which provides querying functionality for XML documents.</p>
<p>Not quite the command line, but it works!</p>
| 11,722 |
<p>We have a NET app that gets installed to the Program Files folder.
The app itself writes some files and creates some directories to its app folder.
But when a normal windows user tries to use our application it crashes because that user does not have permission to write to app folder.
Is there any folder in both Wi... | <p>There is no such folder.</p>
<p>But you can create one.</p>
<p>There is CSIDL_COMMON_APPDATA which in Vista maps to %ProgramData% (c:\ProgramData) and in XP maps to c:\Documents and Settings\AllUsers\Application Data</p>
<p>Feel free to create a folder there in your installer and set the ACL so that everyone can ... | <p>I'm not sure that there is a single path to which all non-administrator users have permission to write to.</p>
<p>I think the correct one would be <code><User>\Application Data</code></p>
| 10,743 |
<p>OK I have an array of tserversocket and am using the tag property to keep track of its index. When an event is fired off such as _clientconnect i am using Index := (Sender as TServerSocket).Tag; but i get an error that highlights that line and tells me its an invalid typecast. What am I doing wrong if all I want to ... | <p>Are you sure Sender is the TServerSocket? Isn't the event defined like below:</p>
<pre><code>procedure TfrmServer.sskServerClientConnect(Sender: TObject; Socket: TCustomWinSocket);
</code></pre>
<p>In which case your code probably should be:</p>
<pre><code>Index := (Socket as TServerSocket).Tag;
</code></pre>
<p... | <p>Are you sure Sender is the TServerSocket? Isn't the event defined like below:</p>
<pre><code>procedure TfrmServer.sskServerClientConnect(Sender: TObject; Socket: TCustomWinSocket);
</code></pre>
<p>In which case your code probably should be:</p>
<pre><code>Index := (Socket as TServerSocket).Tag;
</code></pre>
<p... | 21,321 |
<p>I have been looking for documentation related to interacting with MSPaint from the command line. I have only found references to /p, /pt and /wia, but no guidance as to how to use them and their limitations.</p>
<p>I am trying to send some graphics files to the printer and when I drop the file on my printer driver ... | <p>I know that <code>mspaint /p filename</code> and <code>mspaint /pt filename</code> both print straight to the default printer. Not sure what <code>/wia</code> does, maybe something to do with Windows Image Acquisition?</p>
<p>Also, as others have pointed out, there are many programs a lot more capable for doing wha... | <p>What OS (specific version) are you using? The newer versions of Windows support printing graphics files without the need for MS Paint or any other graphics program. It's called the "Photo Printing Wizard" in XP, and you can even just right-click on a graphics file and choose "Print" right from Explorer - no other pr... | 17,037 |
<p>I need to design a notifications framework written solely in .Net. I was wondering is there were some libraries already available to ease in creating rules for the notifications. </p>
<p>PS: Anything other than SQL Server Notifications please. </p>
<p>Note: Notifications as in Emails and SMS notifications. </p>
| <p>I'm sort of shopping around for some solutions as well. If understand you correctly, you want to do what is also called "Publish/Subscribe." This can also be done with something called an "Enterprise Service Bus." There are other methods like MSMQ and so forth. There are some articles in Patterns and Practices on do... | <p>I'm sort of shopping around for some solutions as well. If understand you correctly, you want to do what is also called "Publish/Subscribe." This can also be done with something called an "Enterprise Service Bus." There are other methods like MSMQ and so forth. There are some articles in Patterns and Practices on do... | 43,653 |
<p>How do I distribute a small amount of data in a random order in a much larger volume of data?</p>
<p>For example, I have several thousand lines of 'real' data, and I want to insert a dozen or two lines of control data in a random order throughout the 'real' data.</p>
<p>Now I am not trying to ask how to use random... | <p>There's always a possibility that they get close to each other if you do it really random :)</p>
<p>But What I would do is:</p>
<ol>
<li>You have <code>N</code> rows of real data and <code>x</code> of <em>control</em> data</li>
<li>To get an index of a row you should insert <code>i</code>-th control row, I'd use: ... | <p>Here's my thought. Why don't you just loop through the existing rows and "flip a coin" for each row to decide whether you will insert random data there.</p>
<pre><code>for (int i=0; i<numberOfExistingRows; i++)
{
int r = random();
if (r > 0.5)
{
InsertRandomData();
}
}
</code><... | 22,684 |
<p>I want to be able to run a text editor from my app, as given by the user in the TEXT_EDITOR environment variable. Now, assuming there is nothing in that variable, I want to default to the TextEdit program that ships with OSX. Is it kosher to hardcode /Applications/TextEdit.app/Contents/MacOS/TextEdit into my app, ... | <p>In your second edit it makes it sound like you just want to get the path to TextEdit, this can be done easily by using NSWorkspace method absolutePathForAppBundleWithIdentifier:</p>
<pre><code>NSString *path = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.TextEdit"];
</code></pre... | <p>You could run following command from your application:</p>
<pre><code>open <full path to text file>
</code></pre>
<p>This will open the text file in the default text editor. You can open any file type using <code>open</code> command.</p>
| 18,054 |
<p>you can request the http header to check if a web page has been edited by looking at its date but how about dynamic pages such as - php, aspx- which grabs its data from a database?</p>
| <p>Even though you might think it's outdated I've always found Simon Willison's article on <a href="http://simonwillison.net/2003/Apr/23/conditionalGet/" rel="nofollow noreferrer">Conditional GET</a> to be more than useful. The example is in PHP but it is so simple that you can adapt it to other languages. Here it is t... | <p>You can if it uses the http response headers correctly but it's often overlooked.</p>
<p>Otherwise storing a local md5-hash of the content might be useful to you (unless there's an easier in-content string you could hook out). It's not ideal (because it's quite a slow process) but it's an option.</p>
| 25,095 |
<p>Is there a better way to implement copy construcor for matlab for a handle derived class other than adding a constructor with one input and explicitly copying its properties?</p>
<pre><code>obj.property1 = from.property1;
obj.property2 = from.property2;
</code></pre>
<p>etc.</p>
<p>Thanks,
Dani</p>
| <p>If you want a quick-and-dirty solution that assumes all properties can be copied, take a look at the PROPERTIES function. Here's an example of a class that automatically copies all properties:</p>
<pre><code>classdef Foo < handle
properties
a = 1;
end
methods
function F=Foo(rhs)
if nargin==0... | <p>You can even use </p>
<pre><code>try
F.(fns{i}) = rhs.(fns{i});
end
</code></pre>
<p>which makes the method more useful</p>
| 30,732 |
<p>How do I prevent my users from accessing directly pages meant for ajax calls only?</p>
<p>Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source...</p>
<p>p/s: Using Apache as webserver.</p>
<p>... | <p>As others have said, Ajax request can be emulated be creating the proper headers.
If you want to have a basic check to see if the request is an Ajax request you can use:</p>
<pre><code> if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
//Request identified as ajax request
}
</code></pre>
<p>However... | <p>Not sure about this, but possibly check for a referrer header? i think if someone manually typed in your url, it wouldn't have a referrer header, while AJAX calls do (at least in the quickly test I just did on my system).</p>
<p>It's a bad way of checking though. Referrer can be blank for a lot of reasons. Are y... | 22,433 |
<p>I have Perl code which relies on <code>Term::ReadKey</code> to get the terminal width. My installation is missing this module, so I want to provide a default if the module isn't present rather than throw an exception.</p>
<p>How can I conditionally use an optional module, without knowing ahead of time whether it is ... | <p>Here's a bare-bones solution that does not require another module:</p>
<pre><code>my $rc = eval
{
require Term::ReadKey;
Term::ReadKey->import();
1;
};
if($rc)
{
# Term::ReadKey loaded and imported successfully
...
}
</code></pre>
<p>Note that all the answers below (I hope they're below this one! :-)... | <p>I think it doesn't work when using variables.
Please check <a href="http://perldoc.perl.org/functions/require.html" rel="nofollow">this link</a> which explains how it can be used with variable</p>
<pre><code>$class = 'Foo::Bar';
require $class; # $class is not a bareword
#or
require "Foo:... | 31,352 |
<p>I'd like to change the security attribute of a directory that InstallShield creates under the <code>CSIDL_COMMON_APPDATA</code> - can someone please advise on how to do that during the installation process?</p>
<p>It's a script-defined folder.</p>
<p>Thank you.</p>
| <p>Under InstallShield 2008 it's </p>
<pre><code>Installation Designer > Components > [somecomponent] > Destination Permissions
</code></pre>
<p>Note that the directory properties are attached to the component, while individual File permissions are set under the 'Files' node</p>
<p>This assumes you are lett... | <p>I don't know whether a Installshield builtin function exists for that. The simple solution is to create a DLL that does the real work of manipulating the security attributes and call it once the directory is created.</p>
<p>Typically, one might want to change the access so that everyone is able to read/write to the... | 16,676 |
<p>I have a custom webpart that is displaying dynamic list data, it needs to render an image from a Picture Library (or at least provide me the URL so I can encapsulate it with an tag), however, none of the fields in the Picture Library seem to contain the image URL? Is there a 'image utility' (SPImageUtility) or som... | <p>Assuming you are using the object model then the you should use this (c#)</p>
<pre><code>SPListItem["EncodedAbsUrl"]
</code></pre>
<p>to get the HTML encoded absolute URL of the image (where "<strong>EncodedAbsUrl</strong>" is the name of the field/column).</p>
<p>To get the unencoded site relative url you can us... | <p>Are getting information from a CAML query? If so you will need to add the required field to the query.</p>
<p>Otherwise the spListItem object from the spList has the property URL which has a web relative URL for the image.</p>
| 30,370 |
<p>Given the following XML structure</p>
<pre><code><html>
<body>
<div>
<span>Test: Text2</span>
</div>
<div>
<span>Test: Text3</span>
</div>
<div>
<span>Test: Text5</span>
</div>
</body... | <pre><code>//span[starts-with(.,'Test')]
</code></pre>
<p><br>References:</p>
<p><a href="http://www.w3.org/TR/xpath/#function-starts-with" rel="nofollow noreferrer">http://www.w3.org/TR/xpath/#function-starts-with</a></p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/starts-with" rel="nof... | <p>Valid option is also:</p>
<pre><code>//span[contains(.,'Test')]
</code></pre>
| 17,756 |
<p>In the same spirit of other platforms, it seemed logical to follow up with this question: What are common non-obvious mistakes in Java? Things that seem like they ought to work, but don't.</p>
<p>I won't give guidelines as to how to structure answers, or what's "too easy" to be considered a gotcha, since that's wha... | <p>Comparing equality of objects using <code>==</code> instead of <code>.equals()</code> -- which behaves completely differently for primitives. </p>
<p>This gotcha ensures newcomers are befuddled when <code>"foo" == "foo"</code> but <code>new String("foo") != new String("foo")</code>.</p>
| <p>IMHO
1. Using vector.add(Collection) instead of vector.addall(Collection). The first adds the collection object to vector and second one adds the contents of collection.
2. Though not related to programming exactly, the use of xml parsers that come from multiple sources like xerces, jdom. Relying on different pars... | 20,494 |
<p>I have an object that I want to print in 3D. But I have a few questions about it. What are the things that I have to watch out for when 3D printing? </p>
<p>I know how to change the metric size etc. Some people said that it's best to set the thickness to a low amount and not make the object solid (to leave the in... | <p>You are correct about the walls. Using a <em>Solidify</em> object modifier is probably your best bet. A low <em>Thickness:</em> value (<em>0.1</em> is probably good) helps keep the walls thin but strong. You can monitor the thickness while you adjust the value from <em>Wireframe</em> view.</p>
<p><a href="https://i... | <blockquote>
<p>What are the things that i have to watch out for when 3d printing? </p>
</blockquote>
<p><a href="https://blender.stackexchange.com/q/7910/2816">non manifold geometry</a> : geometry that can not exist in the real world. </p>
<p>It's a good idea to check if the dimensions of your mesh are correct b... | 305 |
<p>I am having a problem with FCKeditor reverting html entities entered in the source view back to their original unicode representations.
For example when I enter <code>&euro;</code> into the source view, switch to html and then back to source view, the entity is replaced by an actual € symbol.
The bigger proble... | <p>What version of FCKeditor are you using? The current version is 2.6.3. I tested the € symbol in their demo by copying <code>&euro;</code> into source view, switched back to display and then back to HTML the ASCII <code>&euro;</code> was retained correctly. As such it sounds like there might be a configura... | <p>What version of FCKeditor are you using? The current version is 2.6.3. I tested the € symbol in their demo by copying <code>&euro;</code> into source view, switched back to display and then back to HTML the ASCII <code>&euro;</code> was retained correctly. As such it sounds like there might be a configura... | 25,810 |
<p>In my job we have to deploy an application on various environments. It's a standard WAR file which needs a bit of configuration, deployed on Tomcat 6.</p>
<p>Is there any way of creating a 'deployment package' with Tomcat so that you just extract it and it sets up Tomcat as well as your application? I'm not sure th... | <p>lex/flex and yacc/bison provide easy-to-use, well-understood lexer- and parser-generators, and I'd really recommend doing something like that as opposed to doing it procedurally in e.g. Perl. Regular expressions are powerful stuff for ripping apart strings with relatively-, but not totally-fixed structure. With an... | <p>In trying to find my answer, I found this on <a href="http://www.ibm.com/developerworks/edu/au-dw-au-parsingwithantlr-i.html" rel="nofollow noreferrer">ANTLR</a> - might be of use</p>
| 9,616 |
<p>I have a control which the user can resize with the mouse. When they move the right side, I just change the width, and everything works fine.</p>
<p>However, when they move the left size, I have to change the Left and Width properties. The right hand side of the control visibly twitches, showing the old width in ... | <p>You might want to try calling <code>Control.SuspendLayout()</code> on the containing form before moving / resizing, then <code>Control.ResumeLayout()</code>.</p>
<p>It sounds like no matter what mode you set the control to, some event that fires when you change the bounds is redrawing it before both values are set.... | <p>Could this help?
<a href="http://richardsbraindump.blogspot.com/2007/09/how-to-create-flicker-free.html" rel="nofollow noreferrer">http://richardsbraindump.blogspot.com/2007/09/how-to-create-flicker-free.html</a></p>
<p>I dont know if you used SetStyle with those parameters.</p>
<p>If this isnt helping, Ill delete... | 42,958 |
<p>When I run this code:</p>
<pre><code>MIXERLINE MixerLine;
memset( &MixerLine, 0, sizeof(MIXERLINE) );
MixerLine.cbStruct = sizeof(MIXERLINE);
MixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT;
mmResult = mixerGetLineInfo( (HMIXEROBJ)m_dwMixerHandle, &MixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE... | <p>If you run your application in "XP compatibility" mode, the mixer APIs should work much closer to the way they did in XP.</p>
<p>If you're not running in XP mode, then the mixer APIs reflect the mix format - if your PC's audio solution is configured for mono, then you'll see only one channel, but if you're machine ... | <p>Long time Microsoftie <a href="http://blogs.msdn.com/larryosterman/" rel="nofollow noreferrer">Larry Osterman has a blog</a> where he discusses issues like this because he was on the team that redid all the audio stuff in Vista.</p>
<p>In the <a href="http://blogs.msdn.com/larryosterman/archive/2005/12/16/504710.as... | 27,417 |
<p>I am developing an application for PocketPC. When the application starts the custom function SetScreenOrientation(270) is called which rotates the screen. When the application closes the function SetScreenOrientation(0) is called which restores the screen orientation.</p>
<p>This way the screen orientation isn't re... | <p>The correct message is <a href="http://msdn.microsoft.com/en-us/library/aa453907.aspx" rel="nofollow noreferrer">WM_SIZE</a>, but Daemin's answer points to the wrong WM_SIZE help topic. Check the wParam. Be careful as your window may be maximized but hidden.</p>
| <p>I don't know what these are called in the C++ world, but in .NET Compact Framework your application form's Resize event would be called when you minimize/maximize a window, and then in the event code you would check the WindowState property of the form to see if its minimized or mazimized.</p>
<p>Altering the state... | 36,975 |
<p>I've written an Access 2003 application to handle internal things at my company over the past couple years and we are talking about upgrading all of our computers to Office 2007 which means Access will be updated. Is this going to cause a problem for me?</p>
| <p>Allen Browne, Microsoft access MVP, has written a comprehensive article on Microsoft Access 2007 and upgrading:</p>
<p><a href="http://allenbrowne.com/Access2007.html" rel="noreferrer">Converting to Access 2007</a></p>
<p>Here is an article by Microsoft:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb2... | <p>We just recently went through this.</p>
<p>One issue we found was converting <em>reports</em> to Excel. They took that functionality out of Access, so if you do that you'll need to convert it programmatically using the Excel COM object model. I ended up writing a function to replace the old functionality but you ... | 25,974 |
<p>Basically I'm about to start work on a site and I'd like something that I can add into my .htaccess file (or elsewhere) that'll work like this pseudo code: (my ip will be in place of 127.0.0.1)</p>
<pre><code>if (visitors_ip <> 127.0.0.1)
redirectmatch ^(.*)$ http://www.example.com/under-construction.html... | <p>That would be <a href="http://kb.siteground.com/article/How_to_redirect_all_visitors_except_your_IP_to_another_site.html" rel="noreferrer">something like</a>:</p>
<pre><code>RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteCond %{REQUEST_URI} !/mypage\.html$
RewriteRule .* http://... | <p>Be careful with this approach.</p>
<p>I've gotten burned by taking the IP based approach to limiting access, and then losing the lease on my IP address.</p>
<p>Of course you can always ssh into the box in question and change the .htaccess file again, but the 5 minutes of panic while you try to figure out what just... | 37,431 |
<p>I have a page being loaded with jQuery. The initial load includes 100 records with 6 icons per record. Needless to say, it takes a few seconds to load and I want to give the user a "loading" prompt/animation. </p>
<p>Any ideas?</p>
| <p><a href="http://www.ajaxload.info/" rel="noreferrer">http://www.ajaxload.info/</a> is a great resource for generating animated GIFs for this sort of thing.</p>
<p>Once you've got your animation, render it as part of the page; fire the jQuery load mechanism on the animation's onload() event (so you're certain the an... | <p>You could display a div with an animated GIF image as a loading prompt. That's the way I've done it in the past. </p>
| 22,877 |
<p>I get FLAC files a lot and want to automate the taging of the end point MP3 files after I have converted them.</p>
<p>What is my best library to interface with? Vista machine and C# for my code base. </p>
<p>The flac files come with a text file for the show, and the numbers performed. I'll edit that any way pos... | <p>Check out libid3tag... <a href="http://en.wikipedia.org/wiki/ID3"Wikipedia"" rel="nofollow noreferrer">http://sourceforge.net/project/showfiles.php?group_id=12349</a>...</p>
<p>And, actually, the ID3 tag is prettty simple, it's just text (with fixed length fields) tacked on to the front of the MP3 file..... | <p>You might also want to check out TagLib# (google it). It's not too hard to use, and makes reading and writing ID3 tags and other metadata pretty easy.</p>
<p>I've used it an ASP.NET project in the past, to automatically populate a database record using metadata from the ID3 tag of uploaded mp3 and mp4 files, with ... | 18,688 |
<p>Where can I set the display name in the Service Control Manager of a c++ app?</p>
| <p>Use <a href="http://msdn.microsoft.com/en-us/library/ms681987(v=vs.85).aspx" rel="nofollow noreferrer">ChangeServiceConfig</a> to change the display name; you can use <a href="http://msdn.microsoft.com/en-us/library/ms681987(v=vs.85).aspx" rel="nofollow noreferrer">ChangeServiceConfig2</a> to change the description.... | <p>If you want to just change the DisplayName of a particular service, it can be done from the command line instead of <em>risky</em> registry edits.</p>
<pre><code>sc config <ServiceName> DisplayName= <NewName>
</code></pre>
| 31,676 |
<p>What kind of practical issues are there concerning sending tons of e-mail from a server? Will the likelihood of that e-mail being received be just the same as if it had been sent from g-mail or a personal e-mail account if I for example just blindly call the mail() function in PHP tens of thousands of times a day? <... | <p>While you may technically be able to send thousands of mails per minute, in reality you must be carefull.</p>
<p>Say you send out 500 emails to yahoo for example. if enough people mark your message as spam, soon, ANY email you send to yahoo will be marked as spam, or [BULK]. Many isp's routinely tar-pit or outrigh... | <p>Check with your hosting provider, especially if you're on shared hosting. For example: GoDaddy limits shared hosting accounts to sending 1000 emails per day on their server (<a href="http://support.godaddy.com/groups/web-hosting/forum/topic/e-mail-sending-limit/" rel="nofollow">http://support.godaddy.com/groups/web-... | 46,286 |
<p>I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?</p>
| <p>In order to truncate a string to a UTF8 byte array without splitting in the middle of a character I use this:</p>
<pre><code>static string Truncate(string s, int maxLength) {
if (Encoding.UTF8.GetByteCount(s) <= maxLength)
return s;
var cs = s.ToCharArray();
int length = 0;
int i = 0;
... | <p>Efficient way would be finding how much (pessimistically) bytes you will need per character with</p>
<pre><code>Encoding.GetMaxByteCount(1);
</code></pre>
<p>then dividing your string size by the result, then converting that much characters with</p>
<pre><code>public virtual int Encoding.GetBytes (
string s,
in... | 5,461 |
<p>What's the best way to handle a user going back to a page that had cached items in an asp.net app? Is there a good way to capture the back button (event?) and handle the cache that way?</p>
| <p>You can try using the <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.cache.aspx" rel="noreferrer">HttpResponse.Cache property</a> if that would help:</p>
<pre><code>Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cac... | <p>The best way to deal with it is to probably put a no-cache directive in your ASP.NET pages (or a master page if you're using one). I don't think there's a way to deal with this directly in your ASP.NET code (since the cache decision is happening on the client).</p>
<p>As for MVC, don't know how you would accomplish... | 4,309 |
<p>My application will read xml from urlconnection. The xml encoding is ISO-8859-1, it contains é character. I use xerces saxparser to parse received xml content. However, é can not be parsed correctly while running application under lunix OS. Everything works fine in Windows. Could you guys please give me some hints? ... | <p>This is probably a case of a file marked as "ISO-8859-1" when it in reality is in another encoding.</p>
<p>Often this happens with "ISO-8859-1" and "Windows-2152": They are being used as if they were interchangeable, but they are not. <em>(In the comments to this answer it has been clarified that both encodings agr... | <p>If the XML declaration doesn't specify an encoding, the sax parser will try to use the default encoding, UTF-8.</p>
<p>If you know the character encoding but it isn't specified in the XML declaration, you can tell the parser to use that encoding with an InputSource:</p>
<pre><code>InputSource inputSource = new Inp... | 37,489 |
<p>So I have a ListView with an upper limit of about 1000 items. I need to be able to filter these items using a textbox's TextChanged event. I have some code that works well for a smaller number of items (~400), but when I need to re-display a full list of all 1000 items, it takes about 4 seconds.</p>
<p>I am not c... | <p>There are two things to address this:</p>
<ol>
<li>Turn off sorting while manipulating the list contents.</li>
<li>Hide the list so it doesn't try to paint.</li>
</ol>
<p>The 1st point is the biggest performance gain in list manipulation out of these two. To achieve this, just set the ListViewItemSorter to null fo... | <p>Also note that you can hide items and so make them invisible without removing them. So add all your items the first time around and then later on you just hide the ones no longer needed and show the ones that are.</p>
| 20,468 |
<p>On the SVN server, there is a file called <code>config.conf</code>. I have a local version called the same thing (in the same place). <strong>How can I make sure that my local config does not get overwritten, nor checked in?</strong> </p>
<p>While I'm here, is the answer different for a directory?</p>
<p>I'm using... | <p>TortoiseSVN has a nice answer for half of this problem: <strong>ignore-on-commit</strong> </p>
<p>This prevents you from accidentally committing "local only" changes, but it doesn't solve the problem on accidentally updating a locally changed file.</p>
<p>Check out this blog post for the detailed how to: </p>
<p>... | <p>as Scrappydog pointed out</p>
<p>You can use / create different lists in commit dialog box </p>
<p>it supports <strong>ignore-on-commit</strong> list, this way the files under this list will not be visible ..</p>
<p>you can refer to <strong><a href="http://blog.baljeetsingh.net/2009/02/tips-tricks-svn-ignore-on-... | 28,894 |
<p>I've seen several Q&As on recycling and reusing plastic from failed prints, but what have you done with the last few meters of filament? I've been keeping the ends of PLA (or sections I needed to cut) to maybe use for friction welding pieces together, but I only need so much for that. I've considered just shov... | <p>The welding option is only appropriate if you have the tool needed for it, the lighter welding is really hard to do and if your printer allows it you could just watch for the moment the spool runs out and push the new filament as the last of the previous one gets extruded, that's what I used to do on my bowden extru... | <ul>
<li><p>Weld the fragment to the beginning of a new spool and use it that
way. <a href="http://www.i3dinno.com/easywelder-p186486.html" rel="noreferrer">Most are made from metal</a> so they aren't that easy to make
at home. Here is another <a href="https://3dprinting.stackexchange.com/questions/1345/how-to-connec... | 725 |
<p>Anything thats as good and as stable and as feature-rich as gigaspaces?</p>
| <p>Gigaspaces is top notch as far as a Javaspaces implementation goes for scalability and performance. Are you restricted to a Javaspaces implementation? Blitz Javaspaces is top notch for a free product.</p>
| <p>I'd suggest taking a look at Gartner's "Competitive Landscape: In-Memory Data Grids" at <a href="http://www.gartner.com/technology/reprints.do?id=1-1HCCIMJ&ct=130718&st=sb" rel="nofollow">http://www.gartner.com/technology/reprints.do?id=1-1HCCIMJ&ct=130718&st=sb</a></p>
| 4,339 |
<p>I'm new to Flex, and I'm trying to write a simple application. I have a file with an image and I want to display this image on a Graphics. How do I do this? I tried [Embed]-ding it and adding as a child to the component owning the Graphics', but I'm getting a "Type Coercion failed: cannot convert ... to mx.core.IUIC... | <p>Off the top of my head I can think of two things that might help you (depending on what it is exactly that you're trying to achieve):</p>
<p>If you just want to display an image you've embedded, you can add an <a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/Image.html" rel="noreferrer">Image</a> compo... | <p>You can also add a regular AS3 displayobject to a Flex component by adding it to the rawChildren collection (myComponent.rawChildren.addChild(myPNG)), but that's a bit of a hack. </p>
<p>If you're trying to do this via myDisplayObject.graphics, please post some sample source.</p>
| 32,679 |
<p>We've got a Java server application that runs on a number of computers, all connected to the Internet, some behind firewalls. We need to remotely update the JAR files and startup scripts from a central site, with no noticeable interruption to the app itself.</p>
<p>The process has to be unattended and foolproof (i.... | <p>You didn't specify the type of server apps - I'm going to assume that you aren't running web apps (as deploying a WAR already does what you are talking about, and you very rarely need a web app to do pull type updates. If you are talking about a web app, the following discussion can still apply - you'll just implem... | <p>We use Eclipse which the update system of OSGi, and our experience is very good.</p>
<p>Recommended!</p>
| 15,244 |
<p>In the below link, Linq-To-Sql produces a range of methods to get data back based on various real-world needs (e.g. recent topics, etc).</p>
<p>How can I get Subsonic to produce me a set of classes which would interrogate and return data back from my data source in such a way? I get classes which really just presen... | <p>Depends what you mean by "new code". </p>
<p>They aren't really relevant for classes you are newly developing, so in that case, no, they probably shouldn't be used. </p>
<p>But even in a brand new project, you may still need to modify an existing class that you can't change in other ways (vcl class, third-party cl... | <p>These sound like C# extension methods. I would say that while extension methods like these are useful when you don't have the ability to modify a class that you need to extend with functionality, they are a poor way to design your own code. When designing your own code, you'd like all the functionality to be locat... | 46,252 |
<p>Using C or C++, After I decrypt a file to disk- how can I guarantee it is deleted if the application crashes or the system powers off and can't clean it up properly? Using C or C++, on Windows and Linux?</p>
| <p>Don't write the file decrypted to disk at all.</p>
<p>If the system is powerd off the file is still on disk, the disk and therefore the file can be accessed.</p>
<p>Exception would be the use of an encrypted file system, but this is out of control of your program.</p>
| <p>This is a tricky topic. Generally, you don't want to write decrypted files to disk if you can avoid it. But keeping them in memory doesn't always guarentee that they won't be written to disk as part of a pagefile or otherwise. </p>
<p>I read articles about this a long time ago, and I remember there being some di... | 35,135 |
<p>How do i take a HTML site that currently has no doctype declaration and make it W3C compliant?</p>
| <p>First of all: think about <em>why</em> you need to make it W3C compliant. If it's just for the little badge, then it's not worth it.</p>
<p>If you do have a good reason (and there are plenty), then this is what I'd do:</p>
<p>Start by choosing a doctype. From the sound of it, HTML 4.0 might be the way to go. Run y... | <p>I trash my previous answer, based on misunderstanding of the question...</p>
<p>The base answer would be to use <a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer" title="HTML Tidy Project Page">HTML Tidy</a>, it should help a lot to make it compliant.</p>
| 29,564 |
<p>What's the best way to kill a process and all its child processes from a Perl script? It should run at least under Linux and Solaris, and not require installation of any additional packages.</p>
<p>My guess would be to get a list of all processes and their parents by parsing files in /proc or by parsing the output ... | <p>If you can live with killing a process group, you can use the following:</p>
<pre><code>kill -$signum, $pgid;
</code></pre>
<p>where <code>$signum</code> is the signal number, and <code>$pgid</code> is the process group ID. However, signal numbers aren't very portable, in which case you can (on some platforms; rea... | <p>I adapted and hacked "rkill" to do the job, it was easy.</p>
<p><a href="https://gitlab.com/pslist/pslist/blob/master/pslist" rel="nofollow noreferrer">https://gitlab.com/pslist/pslist/blob/master/pslist</a></p>
<p>This is part of "pslist" package in e.g. ubuntu.</p>
| 39,355 |
<p>I've installed the Windows XAMPP package on three separate computers, 2 running Windows Vista 32 bit ( 1 Ultimate / 1 Home Premium ) and 1 running Windows Vista 64 Home Premium.</p>
<p>After enabling xdebug in php.ini and restarting apache, viewing the default XAMPP localhost index causes apache to crash in the sam... | <p>I'm running XAMPP for Windows Version 1.7.1 on my Win7 machine with xDebug and it works perfect.</p>
<p>Check if you have SP1 installed, and then follow <a href="http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development#Edit_PHP.INI_File" rel="nofollow noreferrer">these notes</a>:</p>
<ol>
<li><p>... | <p>Thanks for your comment, I resolved the problem using this version of php_xdebug-2.0.2-5.2.5.dll, work for me on Windows Vista Business 64bit......the php.ini configuration is the same, just to use this xdebug dll version.......thanks </p>
<p>Hermes</p>
| 25,338 |
<p>I've used TinkerCAD (<a href="https://www.tinkercad.com/" rel="nofollow noreferrer">https://www.tinkercad.com/</a>) and was able to easily model objects for 3D printing, despite having no prior experience in 3D modeling.
However it needs to be connected to the internet to work, which is not always available at my lo... | <p>I have used a standard soldering iron to modify and fix 3D prints in the past. You have to keep some things in mind when doing so:</p>
<ul>
<li>Don't overheat your material. PLA can take a soldering iron of about 230 °C before charring.</li>
<li>Don't use a tip with solder, or you will get grey deposits in the plast... | <p>Cutting materials with a 'hot knife' isn't anything new. There should be a fairly established toolset for working foam. For 3D prints, I prefer to add coatings rather than modify surfaces with a hand held tool after. I do run a drill bit through printed holes though.</p>
| 1,912 |
<p>If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one relationship between the derived table and the base table, ... | <p>Enforcing a 1:0-1 or 1:1 relationship can be achieved by defining a unique constraint on the foreign key's columns, so only one combination can exist. Normally this would be the primary key of the child table.</p>
<p>If the FK is on a primary or unique key of the referenced tables it will constrain them to values... | <p>If you use MySQL 5.x you can use triggers for these kinds of constraints.</p>
<p>Another (suboptimal) option would be to use a "type" column in the parent table to silently ignore duplication, and to be able to choose the correct "extension table".</p>
| 13,894 |
<p>Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a time has passed, rather than until a number reac... | <p>The simplest way is just to write a program with an infinite loop, and then hit control-C to stop it. Without more description it's hard to know if this works for you.</p>
<p>If you do it time-based, you don't need a generator. You can just have it pause for user input, something like a "Continue? [y/n]", read from... | <p>If you want to exit based on time, you can use the signal module's alarm(time) function, and the catch the SIGALRM - here's an example <a href="http://docs.python.org/library/signal.html#example" rel="nofollow noreferrer">http://docs.python.org/library/signal.html#example</a></p>
<p>You can let the user interrupt t... | 32,855 |
<p>What's the easiest programmatic way to restart a service on a remote Windows system? Language or method doesn't matter as long as it doesn't require human interaction.</p>
| <p>As of Windows XP, you can use <code>sc.exe</code> to interact with local and remote services. Schedule a task to run a batch file similar to this:</p>
<pre>
sc \\server stop service
sc \\server start service
</pre>
<p>Make sure the task runs under a user account privileged on the target server.</p>
<p><code>psser... | <ol>
<li>open service control manager database using openscmanager</li>
<li>get dependent service using EnumDependService()</li>
<li>Stop all dependent services using ChangeConfig() sending STOP signal to this function if they are started</li>
<li>stop actual service</li>
<li>Get all Services dependencies of a service<... | 33,401 |
<p>My group is developing a service-based (.NET WCF) application and we're trying to decide how to handle exceptions in our internal services. Should we throw exceptions? Return exceptions serialized as XML? Just return an error code?</p>
<p>Keep in mind that the user will never see these exceptions, it's only for ... | <p>WCF uses <code>SoapFaults</code> as its native way of transmitting exceptions from either the service to the client, or the client to the service.</p>
<p>You can declare a custom SOAP fault using the <code>FaultContract</code> attribute in your contract interface:</p>
<p>For example:</p>
<pre><code>[ServiceContra... | <p>Phil, different parts of the application call each other using WCF. By "return exceptions serialized as XML," I meant that the return value of the function wold be an exception object. Success would be indicated by null. </p>
<p>I don't think that's the right option.</p>
<p>WCF fault contracts sound good, but I... | 6,133 |
<p>How can I test <code>Controller.ViewData.ModelState</code>? I would prefer to do it without any mock framework. </p>
| <p>You don't have to use a Mock if you're using the Repository Pattern for your data, of course.</p>
<p>Some examples:
<a href="http://www.singingeels.com/Articles/Test_Driven_Development_with_ASPNET_MVC.aspx" rel="noreferrer">http://www.singingeels.com/Articles/Test_Driven_Development_with_ASPNET_MVC.aspx</a></p>
<p... | <p>Adding to the great answers above, check out this fantastic use of the protected TryValidateModel method within the Controller class.</p>
<p>Simply create a test class inheriting from controller and pass your model to the TryValidateModel method. Here's the link:
<a href="http://blog.icanmakethiswork.io/2013/03/uni... | 36,353 |
<p>Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue.</p>
<p>Assume the login page asks for a username and password, a... | <p>This is one good place where Ajax techniques might be helpful. When the user clicks the submit button, show the login dialog on client side and validate with the server before you actually submit the page.</p>
<p>Another way I can think of is showing or hiding the login controls in a DIV tag dynamically in the main... | <p>Collect the data on the page they submitted it, and store it in your backend (database?) while they go off through the login sequence, hide a transaction id or similar on the page with the login form. When they're done, return them to the page they asked for by looking it up using the transaction id on the backend, ... | 7,669 |
<p>Where can I find a guide for integrating JavaScript and JMS (Java Messaging Service)?</p>
<p>I would like a best practice or established technology that allows me to directly or indirectly receive messages from a topic and update a site based on the message. I was thinking of creating two components, a servlet for ... | <p>I think <a href="http://activemq.apache.org/ajax.html" rel="nofollow noreferrer">this</a> is your answer. Looks like it is baked in to ActiveMQ. I tried the examples and they seem to work.</p>
<p><a href="http://activemq.apache.org/ajax.html" rel="nofollow noreferrer">http://activemq.apache.org/ajax.html</a></p>
| <p>You'll find some references to the Dojo/Bayeux approach here<br>
<a href="http://www.pathf.com/blogs/2006/08/bayeux_a_json_p/" rel="nofollow noreferrer">http://www.pathf.com/blogs/2006/08/bayeux_a_json_p/</a></p>
<p>If you're using WebSphere 6.0 or higher then the Web 2.0 Feature Pack includes an implementation.</p... | 9,239 |
<p>My rails model has code that is attempting to <code>define_method(method_name)</code> inside the model.</p>
<p>I keep getting:</p>
<pre><code>NoMethodError: undefined method `define_method'
</code></pre>
<p>What am I doing wrong? Am I doing this in the wrong place. I need this method attached to this model. Where... | <p>There's nothing magical or about a rails model, it's just a normal class with a bunch of pre-existing methods,</p>
<p>So, the question is "can I define_method in a class"?</p>
<h3>Part 1: Yes you can.</h3>
<p>The important distinction is than you can define method <em>in a class</em> not <em>in an instance... | <p>The answer to your question is "yes, you can". As for why it's not working for you - it's impossible to say for sure why, if you don't provide some context for the code.</p>
| 38,896 |
<p>I'm looking for an official Adobe page explaining the ins and outs of the various directories used in Flex Builder, namely <em>html-template, bin-debug</em> and <em>bin-release</em>.</p>
<p>There's a lot happening in these folder: folders get created and deleted, files get copied around automatically, or not, as se... | <p>This link might be useful for you.
<a href="http://livedocs.adobe.com/flex/3/html/wrapper_01.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/wrapper_01.html</a></p>
| <p>I would check out these pages in the official documentation:</p>
<p><a href="http://livedocs.adobe.com/flex/3/html/apparch_01.html" rel="nofollow noreferrer">Flex Application Structure</a>,
<a href="http://livedocs.adobe.com/flex/3/html/building_overview_1.html" rel="nofollow noreferrer">Building Overview</a>,
and
... | 47,481 |
<p>We are considering switching from MS Visual Studio 2003 to MS Visual Studio 2005 for our C++ development. I think jumping to 2008 might be better.</p>
<p>In what ways are VS2008 better than VS2005 for C++ development?</p>
<p>Are there any disadvantages of VS2008 over VS2005?</p>
| <p>There are very little difference between 2005 and 2008 from native C++ developer point of view. However, if coming from 2003, it makes sense to upgrade directly to 2008 - the conversion process should be almost the same, and you will end up with a slightly better platform. Some new features which are available for 2... | <p>Visual C++ 2008 have dropped support for single threaded runtime library. I don't think it really matters though.</p>
| 36,453 |
<p>First, a little background. A couple of years ago, I was researching making my own candy, and I came across this page: <a href="http://www.instructables.com/id/LeGummies-brick-shaped-gummy-candies/" rel="nofollow">Lego brick shaped gummy candies</a>, describing how to use real Lego bricks as a positive to make silic... | <p>In principle, ABS is safe for contact with (cold or room-temperature) food. The two main concerns specific to 3D printing are, assuming you start with a filament that is not itself contaminated:</p>
<ol>
<li><p>Pores and holes in the printed part which may harbor bacteria</p></li>
<li><p>Impurities introduced into ... | <p>The plastic is not quite your main concern (though it still can be). You should worry about the cracks and crevices in FDM prints. Bacteria loves to hide there. For most people, this is the first concern when it comes to "Is X 3D printed food-safe?" If the end product is a hard material, you should sand or smooth yo... | 308 |
<p>What is the best method for displaying major/minor versions in a C# console application?</p>
<p>The <code>System.Windows.Forms</code> namespace includes a <code>ProductVersion</code> class that can be used to display the name/version information set via the Visual Studio project properties (Assembly Information). A... | <pre><code>Assembly.GetExecutingAssembly().GetName().Version
</code></pre>
<p>Also, you can still use the class, you just have to reference the containing assembly. It's no biggie.</p>
| <p>what about the following line</p>
<pre><code>Console.WriteLine("FileVersionInfo::ProductVersion : {0}",
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileVersionInfo.ProductVersion);
</code></pre>
| 26,069 |
<p>I've some experiences on build application with Asp.Net, but now MVC frameworks become more popular. I would like to try building new multilingual web application using with Asp.Net MVC or Castle MonoRail but I don't know which one is good for me. I don't like the web form view engine, but I like routing feature in ... | <p>Speaking as an advocate of monorail, I've got to say you should probably go for ASP.NET MVC. To be honest, the simple fact that ASP.NET MVC is going to become the default architecture within three years should probably swing it. This equation was different a year ago, simply because the default architecture had se... | <ol>
<li><p>I think MVC wins hands down. Its feature set is very similar, but is going to be the more "popular" of the two (and thus typically more widely supported, documented and extended throughout the development community). In addition, the new ViewEngine (Razor).. and IDE improvements factor in for me, and boost ... | 36,967 |
<p>I'm trying to implement a <code>KeyListener</code> for my <code>JFrame</code>. On the constructor, I'm using this code:</p>
<pre><code>System.out.println("test");
addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) { System.out.println( "tester"); }
public void keyReleased(KeyEvent e) { S... | <p>You must add your keyListener to every component that you need. Only the component with the focus will send these events. For instance, if you have only one TextBox in your JFrame, that TextBox has the focus. So you must add a KeyListener to this component as well.</p>
<p>The process is the same:</p>
<pre><code>my... | <p>lol .... all you have to do is make sure that </p>
<p>addKeyListener(this);</p>
<p>is placed correctly in your code.</p>
| 36,456 |
<p>I would like to change all the names of the attributes where <code>class="testingCase"</code> throughout all my whole html document.</p>
<p>e.g. Change:</p>
<pre><code><a class="testingCase" href="#" title="name of testing case">Blabla</a>
<a class="testingCase" href="#" title="name of another testi... | <p>There is no built-in method/function to "rename" an attribute in javascript, but you can create new attributes and remove other ones...</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-ov... | <p>same answer as @nickf but cleaner code:</p>
<pre><code>$('a.testingCase[title]').each(function() {
var curElem = $(this);
curElem.attr("newTitleName", curElem.attr('title')).removeAttr('title');
});
</code></pre>
| 40,964 |
<p>I'm working on a utility which needs to resolve hex addresses to a symbolic function name and source code line number within a binary. The utility will run on Linux on x86, though the binaries it analyzes will be for a MIPS-based embedded system. The MIPS binaries are in ELF format, using DWARF for the symbolic debu... | <p>Please check <a href="https://github.com/eliben/pyelftools" rel="nofollow">pyelftools</a> - a new pure Python library meant to do this.</p>
| <p>I don't know of any, but if all else fails you could use <a href="http://docs.python.org/lib/module-ctypes.html" rel="nofollow noreferrer">ctypes</a> to directly use libdwarf, libelf or libbfd.</p>
| 6,798 |
<p>I am working on a single sign-on login page using <a href="http://en.wikipedia.org/wiki/Shibboleth_(Internet2)" rel="noreferrer">Shibboleth</a> that will be used for a variety of web applications. Obviously we would like to make this page as secure and usable as possible while limiting the effects of phishing scams.... | <p>Usability notes: </p>
<p>Personally I <strong>hate</strong> when sites put the "forgot password" or "forgot username" or "help" links inbetween the password field, and the Login button. As a keyboard user, I shouldn't have to TAB over them to get to the submit button.</p>
<p>Better yet, also capture the Enter key... | <p>Realize that your user is going to spend all of 10 seconds on that page generally, it really doesn't matter what it looks like so long as it is obvious where to put your user ID and password. Other than that just don't be one of those sites that offers to email me my password if I forget it. At least let me believ... | 30,235 |
<p>I'm working in a .net application where we need to generate XML files on the fly based on the dataset retrieved from the db. XML schema should be based on a xsd provided. I would like to know is there any way to bind or associate a dataset or each datarow with the xsd. I dont know whether it can be done at all or i ... | <p>Use the schema document as a parameter to the command line xsd.exe program included with visual studio to generate class files or typed datasets that you can include in your project/solution. These classes or datasets can be serialized to xml and will conform to the schema document you used to create them.</p>
<p>... | <p>Use the schema document as a parameter to the command line xsd.exe program included with visual studio to generate class files or typed datasets that you can include in your project/solution. These classes or datasets can be serialized to xml and will conform to the schema document you used to create them.</p>
<p>... | 10,157 |
<p>I have a number of panels in a single window in C# application and I created 2 scrollbars, one for horizontal and one vertical. This is what I currently have:</p>
<p><a href="http://www.simnet.is/elinnils52/scrollbar.jpg" rel="nofollow noreferrer">picture with 2 scroolbars http://www.simnet.is/elinnils52/scrollbar.... | <p>Why not just make the maximum value of the scrollbar the overflow (visible area height - panel height)? Then just set the top of the panel to the value of the scrollbar * -1.</p>
| <p>Is there a reason not to use the AutoScroll property?</p>
| 16,381 |
<p>What do you suggest to use for code coverage on 64-bit environment. It seems that NCover supports 64-bit only in Enterprise version which seems to be quite expensive. Or isn't it? What are people using on 64-bit systems for .NET code coverage?</p>
<p>EDIT: I am aware of the CorFlag workaround. I would like to know ... | <p>Google found me this: <a href="http://rabdullin.com/how-to-run-free-ncover-on-a-64-bit-machine/" rel="nofollow noreferrer">http://rabdullin.com/how-to-run-free-ncover-on-a-64-bit-machine/</a></p>
| <p>David, I recently took a look at the open source <a href="http://sourceforge.net/projects/partcover/" rel="nofollow noreferrer">Part Cover</a>. It too has issues with 64 bit, the <a href="http://sourceforge.net/forum/forum.php?thread_id=1981722&forum_id=605221" rel="nofollow noreferrer">work around</a> also bein... | 29,946 |
<p>You can use a standard dot notation or a method call in Objective-C to access a property of an object in Objective-C.</p>
<pre><code>myObject.property = YES;
</code></pre>
<p>or</p>
<pre><code>[myObject setProperty:YES];
</code></pre>
<p>Is there a difference in performance (in terms of accessing the property)? ... | <p>Dot notation for property access in Objective-C <strong>is</strong> a message send, just as bracket notation. That is, given this:</p>
<pre><code>@interface Foo : NSObject
@property BOOL bar;
@end
Foo *foo = [[Foo alloc] init];
foo.bar = YES;
[foo setBar:YES];
</code></pre>
<p>The last two lines will compile exa... | <p>As far as I've seen, there isn't a significant performance difference between the two. I'm reasonably certain that in most cases it will be 'compiled' down to the same code.</p>
<p>If you're not sure, try writing a test application that does each method a million times or so, all the while timing how long it takes.... | 5,500 |
<p>What tools are there available for static analysis against C# code? I know about FxCop and StyleCop. Are there others? I've run across NStatic before but it's been in development for what seems like forever - it's looking pretty slick from what little I've seen of it, so it would be nice if it would ever see the lig... | <p><strong>Code violation detection Tools:</strong></p>
<ul>
<li><p><a href="https://msdn.microsoft.com/en-us/library/bb429476(v=vs.80).aspx" rel="noreferrer">FxCop</a>, excellent tool by Microsoft. Check compliance with .NET framework guidelines.</p>
<p><strong>Edit October 2010:</strong> No longer available as a stan... | <p>I find the <a href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=CodeMetrics&referringTitle=Home" rel="nofollow noreferrer">Code Metrics</a> and <a href="http://www.tom-carter.net/" rel="nofollow noreferrer">Dependency Structure Matrix</a> add-ins for Reflector very useful.</p>
| 5,955 |
<p>Is there a way to extract the data from an Oracle Lite ODB file without installing Oracle Lite? Is there a reader out there which will let me browse and copy the data?</p>
| <p>You should be able to export the data using the OLLOAD utility, which is part of, but should not require the installation of, Oracle Lite.</p>
<p><a href="http://download.oracle.com/docs/cd/E12095_01/doc.10302/e12548/cdbtools.htm#BABIIJGF" rel="nofollow noreferrer">OLLOAD Documentation</a></p>
| <p>If you know the tables you need, you do need Oracle Lite completely. You have to however have the webtogo.jar on your classpath. Then you can simply write a small java program to connect via JDBC to the ODB and extract the data you need. </p>
| 48,185 |
<p>How do I select all records that contain "LCS" within the title column in sql.</p>
| <pre><code>SELECT * FROM TABLE WHERE TABLE.TITLE LIKE '%LCS%';
</code></pre>
<p>% is the wild card matcher.</p>
| <p>Look into the LIKE clause</p>
| 4,251 |
<p>Today I ran into an issue with the filament not sticking to the build plate. However, the strange part is, that this only happens with one filament color (both PLA, khaki, black works just fine) and only in the main print. The test line on the side of the bed and the brim all stick without a problem. I already relev... | <p>Yes you can edit many parameters in Cura that may help with your problem.</p>
<p>However, I believe an easier fix to this problem may be to either apply some glue or masking tape to the bed before you try to change Cura settings since the problem only occurs with just one filament type..</p>
| <p>Your temperatures look pretty good. You could try raising both bed temperatures by 5°C.</p>
<p>You could try Elmer's glue stick or hair spray.</p>
<p>Make sure your Z height is still OK as well as your bed being level after you loaded the different filament.</p>
| 1,936 |
<p>I'm creating a webservice, and I want to name it appropriately.</p>
<p>Right now my service is named Service as per the /App_Code/Service.cs</p>
<p>Should I rename it to something like: <em>com.example.MyWebService.cs</em>?</p>
<p>How do I get around the class file not excepting '.' in the file name?</p>
| <p>the "com.example.whatever" namespace thing is java specific. Microsoft recommends that you use Company.Product.etc..</p>
<p>Check out the Naming guidelines at:
<a href="http://msdn.microsoft.com/en-us/library/ms229002.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms229002.aspx</a></p>
| <p>com.example would be the namespace, and not part of the class/service name.</p>
<p>You should do:</p>
<pre><code>namespace Com.Example
{
public class MyWebService
{
// class contents
}
}
</code></pre>
| 20,179 |
<p>I'm trying to put the following Google generated search box code into a Master page on a site:</p>
<pre><code><form action="http://www.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="partner-pub-xxxxxxxxxx:u3qsil-l6ut" />
<input type="hidden" name="ie"... | <p><a href="http://joyent.com/accelerator/pricing/" rel="nofollow noreferrer">Joyent</a> might be a good solution for you. Honestly adding memcache to a LAMP stack is ridiculously easy and you should be able to do it with relative ease. Find a good VPS provider (linode and slicehost are so good I'll recommend them with... | <p>I'd definitely look into using a linode.</p>
| 39,644 |
<p>I have a base class vehicle and some children classes like car, motorbike etc.. inheriting from vehicle.
In each children class there is a function Go();
now I want to log information on every vehicle when the function Go() fires, and on that log I want to know which kind of vehicle did it.</p>
<p>Example:</p>
<pr... | <p>Calling <a href="http://msdn.microsoft.com/en-us/library/system.object.gettype.aspx" rel="noreferrer"><code>GetType()</code></a> from Vehicle.Go() would work - but only if Go() was actually called.</p>
<p>One way of enforcing this is to use the <a href="http://en.wikipedia.org/wiki/Template_method_pattern" rel="nor... | <p>this.GetType() will give you the type of the current instance</p>
| 38,789 |
<p>After reading a couple of answers and comments on some SQL questions here, and also hearing that a friend of mine works at a place which has a policy which bans them, I'm wondering if there's anything wrong with using backticks around field names in MySQL.</p>
<p>That is:</p>
<pre><code>SELECT `id`, `name`, `anoth... | <p>Using backticks permits you to use alternative characters. In query writing it's not such a problem, but if one assumes you can just use backticks, I would assume it lets you get away with ridiculous stuff like</p>
<pre><code>SELECT `id`, `my name`, `another field` , `field,with,comma`
</code></pre>
<p>Which does... | <p>The main use of backticks (`) in SQL is to use them in situations where you are going to call them again in upcoming clauses. In every other time it is recommended to use double quotes(""). </p>
<p>For example</p>
<pre><code>SELECT CONCAT(Name, ' in ', city, ', ', statecode) AS `Publisher and Location`,
COUNT(... | 32,693 |
<p>Hey everyone. I'm trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it's in the center field). any idea how to fix this?</p>
| <p>You have to add the button to another panel, and then add that panel to the frame.</p>
<p>It turns out the BorderLayout expands what ever component is in the middle </p>
<p>Your code should look like this now:</p>
<p>Before</p>
<pre><code>public static void main( String [] args ) {
JLabel label = new JLabel(... | <p>Again :)</p>
<pre><code>
import javax.swing.*;
public class TestFrame extends JFrame {
public TestFrame() {
JLabel label = new JLabel("Some info");
JButton button = new JButton("Ok");
Box b = new Box(BoxLayout.Y_AXIS);
b.add(label);
b.add(... | 40,190 |
<p>I'm building up a library of filters for a validation class in PHP, some of them using regular expressions. I have a lot of filters in mind, but I also don't want to potentially miss any. What do you most often use regular expressions to check? What are some of the not-so-common things that you've had to check that ... | <p>Regex should be strongly tested with their expected use cases.
Hence, it may be difficult to develop a complete and general library.
I would aim for a library of functions you know you need now.
Then add to this list later, when you have proper test cases.</p>
<p>That said, here are some common use cases:</p>
<p>N... | <p>The majority of my RE use is fixing up data given to me by various sources into a standardized format. A lot of exporting excel docs as CSV or tab delimited and then running through a bunch of RE transformations in TextPad.</p>
| 28,600 |
<p>What's the best way of inserting information in table A and using the index from table A to relate to table B. </p>
<p>The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last ind... | <p>if you're using MSSQL you could use SCOPE_IDENTITY to return the last id inserted in your current session. You can then use that to insert into table B.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms190315.aspx" rel="noreferrer">This article from MSDN</a> gives a decent example on how to do it.</p>
| <p>If your tables are UUID-keyed, generate UUID and use it in both inserts.</p>
| 18,311 |
<p>Can't figure out why I'm getting 'SQL Statement ignored' and 'ORA-01775: looping chain of synonyms' on line 52 of this stored procedure. Got any ideas?</p>
<pre><code>CREATE OR REPLACE PACKAGE PURGE_LOG_BY_EVENT_DAYS AS
TYPE dual_cursorType IS REF CURSOR RETURN dual%ROWTYPE;
PROCEDURE log_master_by_event_day... | <p>I have no idea why you're getting the synonym error. But that's a lot of code for something that should be a single DELETE statement. I assume you've changed it to commit-every-n to avoid rollback errors. It would be nice if you could get your DBA to increase the undo space so you can actually do the work you nee... | <pre><code>SELECT table_owner, table_name, db_link
FROM dba_synonyms
WHERE owner = 'PUBLIC' and db_link is not null
</code></pre>
<p>returns 0 rows
as far as i know, there are no synonyms.......</p>
| 31,653 |
<p>I've been having an agruement with a friend that Mason (Perl) is not a framework, but a templating language. I feel Mason for Perl does what JSP does for Java (as an analogy, not pure technical comparison). From what I know, JSP is not a framework and I feel neither is Mason. When I looked up wikipedia <a href="http... | <p>Mason is an 'M' short of being a MVC (Model-View-Controller) framework. It provides extensive rendering (View) features, which is why people think of Mason as being a templating language. However it also provides quite a few dispatch mechanisms (epsecially in the form of dhandlers), and control mechanisms (which f... | <p>Depends of your definition of framework.</p>
<p>You can apply name framework to any library if it does more than one thing.</p>
| 45,427 |
<p>I have an ASP.NET page that uses a menu based on <code>asp:LinkButton</code> control in a Master page. When a user selects a menu item, an <code>onclick</code> handler calls a method in my C# code. The method it calls just does a <code>Server.Transfer()</code> to a new page. From what I have read, this is not sup... | <p>You can use iframes to make sure that URL of browser doesn't change.
In Page_Load you can change src attribute of iframe to help.aspx</p>
| <p>Try <code>Server.Execute("Help.aspx")</code> instead. You can preserve the form if you need by using </p>
<pre><code>Server.Execute("Help.aspx",true);
</code></pre>
| 45,578 |
<p>I've written an image processing script in php which is run as a cron scheduled task (in OSX). To avoid overloading the system, the script checks the system load (using 'uptime') and only runs when load is below a predefined threshold.</p>
<p>I've now ported this over to Windows (2003 Server) and am looking for a s... | <p>You can try this at a windows command line. This works in XP, get a lot of other info too. </p>
<p>wmic CPU</p>
| <p>You can use a command-line utility called <a href="http://www.teamcti.com/pview/prcview.htm" rel="nofollow noreferrer">pv</a> to display the process name and CPU% usage over a specific time period (defaults to 500ms) using this command line:</p>
<pre><code>pve.exe -o"%n\t%c"
</code></pre>
<p>There is help using th... | 41,949 |
<p>Is it possible to use a DB sequence for some column that <strong>is not the identifier/is not part of a composite identifier</strong>? </p>
<p>I'm using hibernate as jpa provider, and I have a table that has some columns that are generated values (using a sequence), although they are not part of the identifier.</p>... | <p>Looking for answers to this problem, I stumbled upon <a href="http://forum.hibernate.org/viewtopic.php?p=2405140" rel="noreferrer">this link</a></p>
<p>It seems that Hibernate/JPA isn't able to automatically create a value for your non-id-properties. The <code>@GeneratedValue</code> annotation is only used in conju... | <p>I've been in a situation like you (JPA/Hibernate sequence for non @Id field) and I ended up creating a trigger in my db schema that add a unique sequence number on insert. I just never got it to work with JPA/Hibernate</p>
| 35,040 |
<p>I'd like to create an XPS document for storing and printing.</p>
<p>What is the easiest way to create an XPS document (for example with a simple grid with some data inside) in my program, and to pass it around?</p>
| <p>Nothing easy about it. But it can be done. I've got some (sadly, still buggy) sample code and information on my blog for creating the document in memory.</p>
<p>Here's some code I whipped up for testing that encapsulates everything (it writes a collection of FixedPages to an XPS document in memory). It includes ... | <p>All it is, is really XML. If you're comfortable working with XML files, you should have no problem working with XPS documents. Here's a simple tutorial I've used in the past to get me started:</p>
<p><a href="http://blogs.ocrasoft.nl/jeroenveurink/?p=21" rel="nofollow noreferrer">http://blogs.ocrasoft.nl/jeroenveur... | 45,909 |
<p>I know what ViewData is and use it all the time, but in ASP.NET Preview 5 they introduced something new called TempData. </p>
<p>I normally strongly type my ViewData, instead of using the dictionary of objects approach.</p>
<p>So, when should I use TempData instead of ViewData?</p>
<p>Are there any best practices... | <p>In one sentence: <code>TempData</code> are like ViewData with one difference: They only contain data between two successive requests, after that they are destroyed. You can use <code>TempData</code> to pass error messages or something similar.</p>
<p>Although outdated, <a href="http://www.squaredroot.com/2007/12/20... | <p>view data is used when we want to pass data from controller to corresponding view.
view data have very short life it means it will destroy when redirection occurs.
Example(Controller):</p>
<pre><code>public ViewResult try1()
{
ViewData["DateTime"] = DateTime.Now;
ViewData["Name"] = "Mehta Hitans... | 20,861 |
<p>I have to call ping from c++ code.I'd like to easily read the output for further utilizations.</p>
<p>I have come up with two solutions:</p>
<ul>
<li>use a fork and a pipe, redirect ping output to the pipe and then parse it</li>
<li>find a library suited for the purpose to use a ping(ip_addresss) function directly... | <p>I would go with your first option. Linux is built around the concept of having small, specialized apps which do one thing really well, communicating with pipes. Your app shouldn't include a library to implement ping, since there is already a built-in command to do it, and it works very well!</p>
| <p>I've managed to do like this:</p>
<p>I use popen which basically creates a pipe, fork and exec
Then, if I need, i can wait with pclose.</p>
| 40,445 |
<p>I am using C# .Net 2.0 to write a webservices client. The server's soap implementation is tested and is pretty solid. gSoap/C++ applications had no problem reading the responses. However the .Net implementation complains "There is an error in XML document" while calling one of the methods. Similar responses recieved... | <p>First of all I'd grab a snapshot of the failing XML in the Deserialise stage to try and diagnose the problem.</p>
<p>You can hook your soap extension into your client app without recompiling. Just add:</p>
<pre><code><webServices>
<soapExtensionTypes>
<add type="DebugTools.SOAP.SOAPTrace... | <p>BTW, .NET does not use MSXML. It has its own implementation. The performance would be horrible if XmlReader were calling out to MSXML for every <strong>Read</strong> call.</p>
| 49,996 |
<p>In making a restful ASP.NET MVC app I'm wondering about the best way to structure the projects in my solution. By convention, the controllers reside in the same project as the views. However, if I have a few different presentation tiers accessing my restful controllers, would it be better to put my controllers in a ... | <p>You could craft an XSLT to do this work for you. XSLT is specifically designed for the translation of XML data into some other text-based format, including XML. For more information on XSLT, I recommend <a href="http://www.w3schools.com/xsl/default.asp" rel="nofollow noreferrer">W3 Schools</a>.</p>
| <p>XSLT is the "recommended" way of doing it. However, you could probably do it faster with your python xml dom if you are familiar with python. Learning XSLT is a good idea though. I have to do this myself and I will be doing it with perl.</p>
| 46,130 |
<p>We have some raw voice audio that we need to distribute over the internet. We need decent quality, but it doesn't need to be of musical quality. Our main concern is usability by the consumer (i.e. what and where they can play it) and size of the download. My experience has shown that mp3s do not produce the best com... | <p><a href="http://en.wikipedia.org/wiki/Speech_encoding" rel="noreferrer">Start here.</a></p>
<p>As you rightly point out, voice compression is different from general audio compression. You'll find many codecs dedicated to telephony applications, ranging from PCM and ADPCM through later packet based encodings such a... | <p>Assuming your users will be running Windows, there is a WMA speech compression codec that you can use with the Windows Media Encoder SDK. Failing that, you can use ACM to use something like G723/G728, ADPCM, mu-law or a-law, some of which are installed as standard on Windows XP & above. These can be packaged ins... | 20,235 |
<p>In Java, is there an elegant way to detect if an exception occurred prior to running the finally block? When dealing with "close()" statements, it's common to need exception handling within the finally block. Ideally, we'd want to maintain both exceptions and propagate them up (as both of them may contain useful inf... | <p>Your idea about setting a variable outside the scope of the try/catch/finally is correct.</p>
<p>There cannot be more than one exception propagating at once.</p>
| <p>In vb.net, it's possible to use a "Catch...When" statement to grab an exception to a local variable without having to actually catch it. This has a number of advantages. Among them:</p>
<ol>
<li>If nothing is going to 'ultimately' catch the exception, an unhandled exception trap will be fired from the spot of the... | 22,339 |
<p>I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult to troubleshoot and very "magic" (e.g. ... | <p>Use Bindings.</p>
<p>Note that you <em>must</em> follow the MVC pattern to get the most from bindings. <strong>This is easier than it seems</strong>, as Cocoa does almost everything for you nowadays:</p>
<ol>
<li>View: <code>NSView</code> and subclasses (of course), <code>NSCell</code> and subclasses, <code>NSWind... | <p>For the curious, I did end up using bindings and after a couple of days they suddenly just started "making sense". So I would definitely recommend just going ahead and taking the time to learn them.</p>
<p>I also found the advice of Brian Webster quite helpful, as I did indeed end up doing a handful of things the o... | 35,165 |
<p>Title says it mostly. I want to add a simple extension method to the base Dictionary class in C#. At first I was going to name it Pop(TKey key), kind of like the Stack method, but it accepts a key to use for lookup.</p>
<p>Then I was going to do Take(TKey key), but it coincides with the LINQ method of the same name... | <p>I reckon <strong>Extract</strong>, like when archaeologists <em>Find</em> a mummy in the ground, <em>Remove it</em> and then <em>Return</em> it to a museum :)</p>
| <p>anything in particular wrong with the <a href="http://msdn.microsoft.com/en-us/library/system.collections.idictionary.remove.aspx" rel="nofollow noreferrer">Remove(key) method already provided?</a></p>
<p>oh wait, you want to return the element removed also? how about</p>
<pre><code>object valueRemoved = someDicti... | 36,828 |
<p>I have an Enumerable array</p>
<pre><code>int meas[] = new double[] {3, 6, 9, 12, 15, 18};
</code></pre>
<p>On each successive call to the mock's method that I'm testing I want to return a value from that array.</p>
<pre><code>using(_mocks.Record()) {
Expect.Call(mocked_class.GetValue()).Return(meas);
}
using(... | <p>There is alway static fake object, but this question is about rhino-mocks, so I present you with the way I'll do it.
The trick is that you create a local variable as the counter, and use it in your anonymous delegate/lambda to keep track of where you are on the array. Notice that I didn't handle the case that GetVal... | <p>IMHO, yield will handle this.
<a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0%28VS.80%29.aspx" rel="nofollow noreferrer">Link</a>.</p>
<p>Something like:</p>
<pre><code>get_next() {
foreach( float x in meas ) {
yield x;
}
}
</code></pre>
| 9,468 |
<p>ASP.NET master pages - essential things.</p>
<p>However, I have a lot of very similar UserControls in my projects - it might be a standard layout for an AJAX ModalPopup, or something more involved.</p>
<p>I wish I could get rid of some of my duplicated code (both in ascx files and code-behind) with some Master Use... | <p>The closest thing I can suggest for what you are looking for is a <a href="http://msdn.microsoft.com/en-us/library/ms178657(VS.85).aspx" rel="nofollow noreferrer">templated custom control</a>. Unfortunately, sharing controls across projects is a lot easier if those things are custom controls, without an ascx file. ... | <p>Inheritance. You build the base control as a base class, and then inherit from it.</p>
| 43,328 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.