instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I need to minify some C# code in a handful of Silverlight .cs and .xmal files. What are your tips for maintaining one code base and running a "tool" to generate minified code for a project?</p>
<p>Are there any tools (like Resharper) that will do this? If not fully, partially or assist in some way...</p>
<p>EDIT: ... | <p>How about a source-code obfuscator? They generally abbreviate names, etc - and certainly remove white space.</p>
<p>For example, <a href="http://www.semdesigns.com/Products/Obfuscators/CSharpObfuscator.html" rel="nofollow noreferrer">here</a>, with demo <a href="http://www.semdesigns.com/Products/Obfuscators/CSharp... | <p>Is that necessary? It was my understanding that the compiled .Net assembly would be sent across the wire, not the C# (or whatever language) source code.</p>
| 45,656 |
<p>I see this often in the build scripts of projects that use autotools (autoconf, automake). When somebody wants to check the value of a shell variable, they frequently use this idiom:</p>
<pre><code>if test "x$SHELL_VAR" = "xyes"; then
...
</code></pre>
<p>What is the advantage to this over simply checking the val... | <p>If you're using a shell that does <em>simple</em> substitution and the <code>SHELL_VAR</code> variable does not exist (or is blank), then you need to watch out for the edge cases. The following translations will happen:</p>
<pre><code>if test $SHELL_VAR = yes; then --> if test = yes; then
if test x$SHELL... | <p>I used to do that in DOS when the SHELL_VAR might be undefined.</p>
| 20,977 |
<p>Is it possible to restore a backup of a SQL Server 2005 database onto an instance of SQL Server 2008?</p>
<p>I need to rebuild a server as it's getting rather crufty, so I plan to take this opportunity to upgrade to SQL 2008 and wondered if I'll be able to restore my backups OK.</p>
| <p>Upgrading from 2005 to 2008 is OK, moving back might require more work</p>
<p>N.B. You might have a problem with your database the logins (as they will not exist in the new server master db) but that's something which would happen regardless of the server version. Just re-create them and re-associate with your data... | <p>You can also do a detach/attach with the database files (leastways you could going from 2000 to 2005), but there are more caveats with this approach (requires explicit rebuild indexes afterwards IRRC)</p>
| 24,989 |
<p>I have a "fat" GUI that it getting fairly complex, and I would like to add links from a place to an other, and add back/forward buttons to ease navigation. It seems to me that this would be easier if my application was addressable: each composite could have its URI, and links would use that URI.</p>
<p>Are there de... | <p>My solution for doing things like this usually involves the <a href="http://en.wikipedia.org/wiki/Observer_pattern" rel="nofollow noreferrer">listener pattern</a>. In a nutshell, you reduce coupling by providing a way to send and receive events to and from interested parties (composites in this case). This is fair... | <p>My solution for doing things like this usually involves the <a href="http://en.wikipedia.org/wiki/Observer_pattern" rel="nofollow noreferrer">listener pattern</a>. In a nutshell, you reduce coupling by providing a way to send and receive events to and from interested parties (composites in this case). This is fair... | 38,866 |
<p>I know there's a bug with conditional visibility and page breaks with SQL 2005, but I wonder if anyone has come up with a work around.</p>
<p>I have a table that has a conditional visibility expression, and I need a page break at the end of the table.</p>
<ul>
<li>If I set the PageBreakAtEnd property to true. It i... | <p>Place two rectangles, one inside the other.<br>
Place your table inside the inner rectangle and set it to always be visible.<br>
Set the inner rectangle's Page Break to Insert After Rectangle.<br>
Set the outer rectangle's visibility to use your conditional expression.</p>
<p>The page break and the conditional visi... | <p>Add a second (empty) table immediately after the first. Page break after that.</p>
| 2,984 |
<p>What's the difference between absolute path & relative path when using any web server or Tomcat?</p>
| <p>Absolute paths start with / and refer to a location from the root of the current site (or virtual host).</p>
<p>Relative paths do not start with / and refer to a location from the actual location of the document the reference is made.</p>
<p>Examples, assuming root is <a href="http://foo.com/site/" rel="noreferrer... | <p>Through trial and error I have determined that the starting point of a path in Tomcat is the webapps folder.</p>
<p>In other words if your Java code is trying to read ../somefile.txt then the absolute path to that file would be %TOMCAT_HOME%/webapps/../somefile.txt i.e. %TOMCAT_HOME%/webapps/somefile.txt</p>
| 21,952 |
<p>Here's the code I have in the html file to "include" the file "vmenu.php"</p>
<pre><code> <div id="apDivVistaMenus">
<?php
include 'vmenu.php';
?>
<!-- Begin Vista-Buttons.com -->
<!-- End Vista-Buttons.com -->
</div>
</code></pre>
<p>The menus used to be between the commen... | <p>Note that, in order for PHP includes to work, the file must be parsed by the PHP engine. By default, major web servers like Apache do not run .html files through the PHP interpreter, so you must either specify in your web server's configuration that you want to parse .html files as PHP files, or rename the .html fil... | <p>Change your code to this:</p>
<pre><code><div id="apDivVistaMenus">
<!-- Begin Vista-Buttons.com -->
<?php include 'vmenu.php'; ?>
<!-- End Vista-Buttons.com -->
</div>
</code></pre>
<p>...and you'll be golden.</p>
| 40,806 |
<p>I'm using PUT and DELETE more and more w/ my ajax work and wanted to see if it would be a "bad idea" to add these verbs to the .aspx application extension in IIS.</p>
| <p>This transformation:</p>
<pre>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="data">
<xsl:variable name="vNumLeft" select="count(item[@column='left'])"/>
<data>
<... | <p>You would use the element and attribute tags...</p>
<pre><code><xsl:element name="item">
<xsl:attribute name="left"><xsl:value-of select="$theLeft"/></xsl:attribute>
<xsl:attribute name="right"><xsl:value-of select="$theRight"/></xsl:attribute>
</xsl:element>
... | 43,828 |
<p>I've been using Flex Builder 3 to create Flex applications that are part of larger Flex / Java project using LiveCycle Data Services. Flex Builder creates and deploys the .war file, which is convenient for the development cycle, but I don't understand what the .war file has to contain in order to deploy and run.</p... | <p>Check out the sample applications here:</p>
<p><a href="http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=build_apps_3.html" rel="nofollow noreferrer">http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=build_apps_3.html</a></p>
<p>Those apps will g... | <p>I don't know anything about LiveCycle Data Services, so that may be an issue. However, I have a flex app that interacts with a java server, and I didn't really have to do anything special for flex apart from what you would do for other static content.</p>
<p>Specifically, I have my flex projects properties ~ Flex B... | 32,949 |
<p>Is there a better windows command line shell other than <code>cmd</code> which has better copy paste between Windows' windows and console windows?</p>
| <p>Enable <strong>QuickEdit mode</strong>, under the <em>Options</em> tab of your shortcut to the command shell. Mark with the mouse, right-click to copy, right-click again to paste. </p>
<p>While you're there, enable a hotkey (like <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>C</kbd>) for lightning fast access to the she... | <p>@Chirs<br>
I think you need to clarify shell vs host(emulator). To me it sounds like you need another interface to your existing shell that better supports copy and paste, not another shell that supports more/different features.</p>
<p>I second Pat's suggestion of Console2, it is a very good application and OSS to... | 2,757 |
<p>How, in Java, to quickly (or generically) convert one class that implements an interface into another class that implements the same interface?</p>
<p>I mean, if they're a POJO one class setters should take the other class getters as arguments.</p>
<p>Is there a Pattern for this situation?</p>
| <p>I believe that the pattern for this situation is called a <a href="http://en.wikipedia.org/wiki/Proxy_pattern" rel="nofollow noreferrer">Proxy</a>:</p>
<blockquote>
<p>A proxy, in its most general form, is a class functioning as an interface to another thing. The other thing could be anything: a network connectio... | <p>I believe that the pattern for this situation is called a <a href="http://en.wikipedia.org/wiki/Proxy_pattern" rel="nofollow noreferrer">Proxy</a>:</p>
<blockquote>
<p>A proxy, in its most general form, is a class functioning as an interface to another thing. The other thing could be anything: a network connectio... | 29,174 |
<p>In Firefox you can enter the following into the awesome bar and hit enter:</p>
<pre><code>javascript:self.resizeTo(1024,768);
</code></pre>
<p>How do you do the same thing in IE?</p>
| <pre><code>javascript:resizeTo(1024,768);
vbscript:resizeto(1024,768)</code></pre>
<p>Will work in IE7, But consider using something like</p>
<pre><code>javascript:moveTo(0,0);resizeTo(1024,768);</code></pre>
<p>because IE7 doesn't allow the window to "resize" beyond the screen borders. If you work on a 1024,768 des... | <p>It works in IE6, but I think IE7 added some security around this?</p>
| 8,480 |
<p>I want in a good performance way (I hope) replace a named parameter in my string to a named parameter from code, example, my string:</p>
<pre><code>"Hi {name}, do you like milk?"
</code></pre>
<p>How could I replace the {name} by code, Regular expressions? To expensive? Which way do you recommend?</p>
<p>How do t... | <p>Have you confirmed that regular expressions are too expensive?</p>
<p>The cost of regular expressions is greatly exaggerated. For such a simple pattern performance will be quite good, probably only slightly less good than direct search-and-replace, in fact. Also, have you experimented with the <code>Compiled</code>... | <p>A compiled regex might do the trick , especially if there are many tokens to be replaced. If there are just a handful of them and performance is key, I would simply find the token by index and replace using string functions. Believe it or not this will be faster than a regex.</p>
| 49,692 |
<p>When using the 'as' keyword in C# to make a cast which fails, null gets returned. What's going on in the background? Is it simply suppressing an exception so I don't have to write handling code for a failure?</p>
<p>I'm interested in the performance characteristics of it compared to a typical cast wrapped in a try-... | <p>It's using the IL instruction <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.isinst.aspx" rel="noreferrer"><code>isinst</code></a> to perform the cast instead of the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.castclass.aspx" rel="noreferrer"><code... | <p>And to add to Greg's excellent post... </p>
<p>The first time a new Type is referenced at runtime, the CLR loads into memory a structure called <code>COREINFO_CLASS_STRUCT</code> ( or something similar) that contains, among other things, a pointer to the <code>COREINFO_CLASS_STRUCT</code> object for the base class ... | 47,150 |
<p>Has anyone done any sort of performance tests against MSMQ?</p>
<p>We have a solution in prod environment where errors are added to a MSMQ for distribution to databases or event monitors.</p>
<p>We need to test the capacity of this system but not sure how to start.</p>
<p>Anyone know any tools or have any tips?</... | <p>try overloading it with a test program and see where it balks/fails</p>
<p>[analgous to "destructive testing" in materials engineering]</p>
| <p>yeah I was thinking that was hoping for a more public tool.</p>
| 19,151 |
<p>In my work environment, Visual Studio currently crashes every time I start our main project unless I delete the .suo (solution options) and .ncb (C++ Intellisense symbols) files.</p>
<p>Obviously, I've found a workaround. Is there a more permanent solution than this?</p>
| <p>Have you installed Visual Studio 2005 Service Pack 1?</p>
| <p>The accepted answer wasn't quite correct, but it pointed in the right direction.</p>
<p>There is a hotfix for VS2k5 SP1 described in KB article 947315 that addresses this issue.</p>
| 7,356 |
<p>Our Flex app automatically resizes with the browser window, we've addressed a whole bunch of scaling issues quite easily but one that remains is tooltips. They show in the wrong location on screen, not being scaled properly based on the window size. Since tooltips are positioned automatically, how can we address thi... | <p>Not sure if you found a solution to this one, but there's a simpler approach. This code hooks into the tooltip-show event, during the capture phase (before it displays), to scale and position it appropriately based on the scale of the containing element -- in "this" case, the <code>parentApplication</code> document... | <p>I don't think there is a great solution to this problem since the <code>ToolTipManager</code> is not aware of when the <code>currentTarget</code> for a <code>ToolTip</code> changes location on the stage. The fix pretty much has to go into the Flex Framework itself. I have cludged together something that seems to w... | 49,918 |
<p>I am a big time user of using double quotes in PHP so that I can interpolate variables rather than concatenating strings. As a result, when I am generating HTML I often use single quotes for setting tag fields. For example:</p>
<pre><code>$html = "<input type='text' name='address' value='$address'>";
</code><... | <p>This is similar to <a href="https://stackoverflow.com/questions/242766/when-did-single-quotes-in-html-become-so-popular">When did single quotes in HTML become so popular?</a>. Single quotes around attributes in HTML are and always have been permitted by <a href="http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2"... | <p>Single Quotes are fine for HTML, but they don't make valid XHTML, which might be problematic if anybody was using a browser which supported only XHTML, but not HTML. I don't believe any such browsers exist, though there are probably some User-Agents out there that do require strict XHTML. </p>
| 34,435 |
<p>So far the only way I've found to do this is by telling Lighty to pipe its logs through an app called "vlogger". Is there a way to break out log files by date without introducing any external dependencies or cron jobs? I feel like there might be a way to do it with config file variables, but my Lighty-fu just isn'... | <p>I only know the option to use syslog for log handling or additional software like "logrotate" or something similiar. Perhaps the <a href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModAccessLog" rel="nofollow noreferrer">manual</a> helps.</p>
| <p>Im using cronolog instead of vlogger to do this without any problems. Unfortunately, you can't use this technique to rotate the error log. Looking at old Lighttpd bug reports, there was a patch to fix this for error logs but it was rejected upsteam.</p>
| 30,782 |
<p>I've got Postscript code/data (?) in memory (in a Java Tomcat webapp) that I'd like to send directly to a networked PS printer. Is there an easy way (i.e. just popping open a port and sending the text) to print this, bypassing all of the O/S-specific drivers and stuff (and hopefully not even requiring extra jars)? ... | <p>open a TCP socket to the LPR port on the target printer.</p>
<p>send your data; as long as the printer comprehends it, you're cool.</p>
<p>don't forget a Line feed when you're done.</p>
<p>(then close the port.)</p>
| <p>I am not sure you can do it without extra library.</p>
<p>This <a href="http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=outputCreatingPrint.46.3.html" rel="nofollow noreferrer">example</a> shows you how to send the file to a network pr... | 40,692 |
<p>For a person without a comp-sci background, what is a lambda in the world of Computer Science?</p>
| <p>Lambda comes from the <a href="http://en.wikipedia.org/wiki/Lambda_calculus" rel="noreferrer">Lambda Calculus</a> and refers to anonymous functions in programming.</p>
<p>Why is this cool? It allows you to write quick throw away functions without naming them. It also provides a nice way to write closures. With that... | <p>A lambda function can take any number of arguments, but they contain only a single expression. ...
Lambda functions can be used to return function objects.
Syntactically, lambda functions are restricted to only a single expression.</p>
| 3,724 |
<p>Is there a way to allow a flex application to have a dynamic height while embedded in an HTML wrapper?</p>
<p>I want the Flex application to grow in height in a way that it will not cause vertical scroll bars.</p>
| <p>I'm not sure I fully understand the question, are you trying to get the aplication to have a size larger than the browser's view port? If so, then as @hasseg commented and @RickDT mentioned, you can set the Application's horizontalScrollPolicy and/or verticalScrollPolicy properties to "off"?</p>
<p>If you're simply... | <p>Unfortunately no, I think the only way you could do this is to get rid of the html wrapper in the first place. HTH.</p>
| 41,192 |
<p>Earlier today I successfully completed a small print (less than 1 hour) on our Tevo Tarantula. When it came time to print the next one, I started preheating for PLA and got an "E1 Thermal Runaway" error. I replaced the heating element with a backup and got no error on preheat.</p>
<p>With an estimated 5+ hrs printi... | <h1>1 PID Tune</h1>
<p>Changing the thermosensor or the heater cartridge is a big change in the system: each of these items has internal errors differing them from each other item. If your thermosensor has a different standard resistance by a small way than the one before, if the resistance of the cartridge is differen... | <p>@Trish gives a lot of good info, but:</p>
<p><strong>I don't think your heating element is the problem, I think the thermistor is, or a flaky connection between it and your board.</strong></p>
<p>The termistor senses the temperature of your heater (you also have one on a heat bed), and tells the electronics when t... | 1,122 |
<p>I have a heavily modified DiscoEasy 200 from Dagoma, see picture:</p>
<p><a href="https://i.stack.imgur.com/XVfL4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XVfL4.jpg" alt="enter image description here"></a></p>
<p>The heatbed is mounted on 4 springs, on top of the original plate. I made su... | <p>Did you check if your bed is parallel to the gantry? </p>
<p>It can happen that after leveling one side and moving to the other the adjustment there puts the first side out of alignment - I level my bed by doing some couple turns</p>
| <p>As I understand your question:</p>
<ol>
<li>You manually go through a leveling process and have it set up well.</li>
<li>You allow the printer to "auto-level". </li>
<li>You print, and the right side is too low by about 0.1mm. </li>
</ol>
<p>Is it possible that the filament (which is on the left side) pulls up on... | 1,251 |
<p>Here is the code currently used.</p>
<pre><code>public String getStringFromDoc(org.w3c.dom.Document doc) {
try
{
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
Transfor... | <p>Relies on <a href="http://www.w3.org/TR/DOM-Level-3-LS/load-save.html" rel="noreferrer">DOM Level3 Load/Save</a>:</p>
<pre><code>public String getStringFromDoc(org.w3c.dom.Document doc) {
DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
LSSerializer lsSerializer = do... | <p>You could use <a href="http://xom.nu/" rel="nofollow noreferrer">XOM</a>:</p>
<pre><code>org.w3c.dom.Document domDocument = ...;
nu.xom.Document xomDocument =
nu.xom.converters.DOMConverter.convert(domDocument);
String xml = xomDocument.toXML();
</code></pre>
<p>You could use <a href="https://jsoup.org/" rel="n... | 40,731 |
<p>Basically, I would like to check if I have rights to open the file before I actually try to open it; I do not want to use a try/catch for this check unless I have to. Is there a file access property I can check before hand?</p>
| <p>I have done this countless times in the past, and nearly every time I was wrong to even make the attempt.</p>
<p>File permissions (even file existence) are <em>volatile</em> — they can change at any time. Thanks to Murphy's Law this <em>especially</em> includes the brief period between when you check the file and w... | <pre><code>public static FileStream GetFileStream(String filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare, ref int attempts, int attemptWaitInMilliseconds)
{
try
{
return File.Open(filePath, fileMode, fileAccess, fileShare);
}
catch (UnauthorizedAccessExceptio... | 33,350 |
<p>I am interested to read and understand the 2D mesh algorithms. A search on Google reveals <a href="http://www.google.com.my/search?rlz=1C1GGLS_enMY291&sourceid=chrome&ie=UTF-8&q=meshing+algorithm" rel="noreferrer">a lot of papers and sources</a>, however most are too academic and not much on beginner's s... | <p>I second David's answer regarding <a href="http://www.cs.berkeley.edu/~jrs/" rel="nofollow noreferrer">Jonathan Shewchuk's</a> site as a good starting point.</p>
<p>In terms of open source software, it depends on what you are looking for exactly. </p>
<ul>
<li>If you are interested in mesh generation, you can have... | <p>The first link on your Google search takes you to <a href="http://www.cs.berkeley.edu/~jrs/" rel="nofollow noreferrer">Jonathan Shewchuk's</a> site. This is not actually a bad place to start. He has a program called <a href="http://www.cs.cmu.edu/~quake/triangle.html" rel="nofollow noreferrer">triangle</a> which you... | 22,012 |
<p>One of Delphi 2009's advertised features was PNG support. That's great, because the Unicode issues break the pngimage.pas library I was using before. Only problem is, I can't <em>find</em> the Delphi 2009 version. Anyone know what it's called, and how difficult it is to migrate existing pngimage.pas-based code to... | <p>All VCL image support in Delphi is provided via TImage. If you want to display a PNG image, simply drop a TImage control and then load a PNG image into the Picture property. </p>
<p>If you want to manipulate a PNG image in code (i.e., not display it) then you can add</p>
<p>pngimage</p>
<p>to your uses clause, ... | <p>You can read png images into a TImage control.
Just like gif, jpg, emf, wmf, bmp.</p>
<p>Not sure if that's what you want.</p>
| 31,806 |
<p>I can't seem to figure out how to set the default database in Sql Server from code. This can be either .Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in Sql Server Management Studio.</p>
| <p>from: <a href="http://doc.ddart.net/mssql/sql70/sp_da-di_6.htm" rel="noreferrer">http://doc.ddart.net/mssql/sql70/sp_da-di_6.htm</a></p>
<pre><code>sp_defaultdb [@loginame =] 'login' , [@defdb =] 'database'
</code></pre>
| <p>If you're trying to change which database you are using after you are logged in, you can use the USE command. E.g. USE Northwind.</p>
<p><a href="https://www.tutorialspoint.com/sql/sql-select-database.htm" rel="nofollow noreferrer">https://www.tutorialspoint.com/sql/sql-select-database.htm</a></p>
| 13,145 |
<p>With VS2005, I want to create a DLL and automatically export all symbols without adding <code>__declspec(dllexport)</code> everywhere, and without hand-creating <code>.def</code> files. Is there a way to do this?</p>
| <h2>Short answer</h2>
<p>You can do it with help of the new version of the CMake (any version cmake-3.3.20150721-g9cd2f-win32-x86.exe or higher).</p>
<p>Currently it's in the dev branch.
Later, the feature will be added in the release version of the cmake-3.4.</p>
<p>Link to the cmake dev: </p>
<p><a href="http://w... | <p>No, you will need a macro that resolves to <code>__declspec(dllexport)</code> when it's included by the .cpp file that implements the exported functions, and resolves to <code>__declspec(dllimport)</code> otherwise.</p>
| 27,861 |
<p>Is there a preference or behavior difference between using:</p>
<pre><code>if(obj.getClass().isArray()) {}
</code></pre>
<p>and</p>
<pre><code>if(obj instanceof Object[]) {}
</code></pre>
<p>?</p>
| <p>In most cases, you should use the <code>instanceof</code> operator to test whether an object is an array.</p>
<p>Generally, you test an object's type before downcasting to a particular type which is known at compile time. For example, perhaps you wrote some code that can work with a <code>Integer[]</code> or an <co... | <p>There is no difference in behavior that I can find between the two (other than the obvious null-case). As for which version to prefer, I would go with the second. It is the standard way of doing this in Java.</p>
<p>If it confuses readers of your code (because <code>String[] instanceof Object[]</code> is true), you... | 27,070 |
<p>I know you should, like an infant, never leave your printer without surveillance.</p>
<p>But sometimes we all do, trusting our double thermistors and heat runaway configurations. But electronics fry and who says there is no danger even after the print job has finished and it's cooling down, still hooked up?</p>
<p... | <p>Disclaimer: I am not affiliated with any linked brand or company, I just link to them for reference of the suggested print settings.</p>
<h1>What is PLA?</h1>
<p>PLA is, by its definition PolyLacticAcid, a polymer of entwined lactic acids. It is commonly made from fermenting starch - not via Type I (alcohol) but Typ... | <p>Adding this as a new answer since it doesn't seem to be covered in existing ones:</p>
<p>Despite "PLA+" being a marketing term without a specific definition, I've found that many (most?) filament vendors don't seem to be doing their own secret-sauce blending to make it, and most premium filament vendors wh... | 747 |
<p>Consider the following interface in Java:</p>
<pre><code>public interface I {
public final String KEY = "a";
}
</code></pre>
<p>And the following class:</p>
<pre><code>public class A implements I {
public String KEY = "b";
public String getKey() {
return KEY;
}
}
</code></pre>
<p>Why is ... | <p>You are hiding it, it's a feature of "Scope". Any time you are in a smaller scope, you can redefine all the variables you like and the outer scope variables will be "Shadowed"</p>
<p>By the way, you can scope it again if you like:</p>
<pre><code>public class A implements I {
public String KEY = "b";
publ... | <p>Static fields and methods are attached to the class/interface declaring them (though interfaces cannot declare static methods as they are wholly abstract classes which need to be implemented).</p>
<p>So, if you have an interface with a public static (vartype) (varname),
that field is attached to that interface.</p>... | 25,144 |
<p>I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this:</p>
<blockquote>
<p>Connection Interrupted<br>
The connection to the server was reset while the page was loading.
The network link was interrupted while negotiating a connection. Please t... | <p>It's possible that your script could be caught in an infinite loop. If that doesn't apply, then I'd check the error logs like TimB suggested.</p>
| <p>Try doing the request with Firebug enabled and see what info you can get out of that; I always find that using wget is helpful for seeing the raw HTTP interaction without worrying about Firefox's UI elements interfering.</p>
| 15,140 |
<p>When I save a file with an .htm or .html extension, which one is correct and what is different?</p>
| <p>Neither is wrong, it's a matter of preference. Traditionally, MS software uses <code>htm</code> by default, and *nix prefers <code>html</code>.</p>
<p>As oded pointed out below, the .htm tradition was carried over from win 3.xx, where file extensions were limited to three characters.</p>
| <p>Both are working as same,but For the technical and non technical reference please find out here,
<a href="http://www.sightspecific.com/~mosh/www_faq/ext.html" rel="nofollow">http://www.sightspecific.com/~mosh/www_faq/ext.html</a></p>
| 16,818 |
<p>I'm looking for a really generic way to "fill out" a form based on a parameter string using javascript.</p>
<p>for example, if i have this form:</p>
<pre><code><form id="someform">
<select name="option1">
<option value="1">1</option>
<option value="2">2</option>
<... | <p>If you're using Prototype, this is easy. First, you can use the <a href="http://prototypejs.org/api/string/toQueryParams" rel="nofollow noreferrer">toQueryParams</a> method on the String object to get a Javascript object with name/value pairs for each parameter.</p>
<p>Second, you can use the Form.Elements.setValue... | <p>Three lines of code in <a href="http://www.prototypejs.org/" rel="nofollow noreferrer">prototype.js</a>:</p>
<pre><code>$H(query.toQueryParams()).each(function(pair) {
$("form")[pair.key].setValue(pair.value);
});
</code></pre>
| 32,099 |
<p>Assuming a Perl script that allows users to specify several text filter expressions in a config file, is there a safe way to let them enter regular expressions as well, without the possibility of unintended side effects or code execution? Without actually parsing the regexes and checking them for problematic constru... | <p>This</p>
<pre><code>eval {
qr/$re/;
};
if ( $@ ) {
# do something
}
</code></pre>
<p>compiles an expression, and lets you recover from an error. </p>
<p>You can watch for malicious expression, since you're only going to do matching, by looking for these patterns, which would allow arbitrary code to be ... | <p>Would the <a href="http://perldoc.perl.org/Safe.html" rel="nofollow noreferrer" title="Safe">Safe</a> module be of any use with regard to compiling/executing untrusted regular expressions?</p>
| 29,971 |
<p>How does one build Web applications on the Mac that is not RoR or PHP? Can Web applications be created using Objective-C and Cocoa? I'm entirely new to this subject</p>
<p>- Hahnemann</p>
| <p>The "Apple" way is to use <a href="http://www.apple.com/webobjects/" rel="nofollow noreferrer">WebObjects</a></p>
| <p>I am using Seaside on Squeak (Smalltalk). I daily transfer the code from pc to mac and back again, as it is fully cross-platform. </p>
| 49,224 |
<p>I've been programming in C++ for a few years, and I've used STL quite a bit and have created my own template classes a few times to see how it's done.</p>
<p>Now I'm trying to integrate templates deeper into my OO design, and a nagging thought keeps coming back to me: They're just a macros, really... You could impl... | <p>Macros are a text substitution mechanism.</p>
<p>Templates are a functional turing-complete language that is executed at compile time and is integrated into the C++ type system. You can think of them as a plugin mechanism for the language.</p>
| <p>Templates offer some degree of type safety.</p>
| 21,749 |
<p>Is there a performant equivalent to the isnull function for DB2?</p>
<p>Imagine some of our products are internal, so they don't have names:</p>
<pre><code>Select product.id, isnull(product.name, "Internal)
From product
</code></pre>
<p>Might return:</p>
<pre><code>1 Socks
2 Shoes
3 Internal
4 Pants
</code><... | <p>For what its worth, COALESCE is similiar but </p>
<pre><code>IFNULL(expr1, default)
</code></pre>
<p>is the exact match you're looking for in DB2. </p>
<p>COALESCE allows multiple arguments, returning the first NON NULL expression, whereas IFNULL only permits the expression and the default.</p>
<p>Thus</p>
<pre... | <p><code>COALESCE</code> function same <code>ISNULL</code> function
Note. you must use <code>COALESCE</code> function with same data type of column that you check is null.</p>
| 9,079 |
<p>I am attempting to integrate an existing payment platform into my webshop. After making a succesful transaction, the payment platform sends a request to an URL in my application with the transaction ID included in the query parameters.</p>
<p>However, I need to do some post-processing like sending an order confirma... | <p>Not really what you ask for, but don't you need to persist the order into database before you send the customer to the payment-service? It's better to rely on persisted data in your post-processing of the order when you receive the confirmation of the payment. </p>
<p>Relying on sessions is not reliable since you w... | <p>Dirty, but has worked for me:</p>
<p>Tell the payment gateway to use </p>
<pre><code>http://yourdomain.com/callbackurl.php?PHPSESSID=SESSIONIDHERE
</code></pre>
<p>PHP uses that method of passing a session around itself if you set certain config vars (session.use_trans_sid), and it seems to work even if PHP has b... | 42,207 |
<p>I have a custom installer action that updates the PATH environment, and creates an additional environment variable. Appending a directory to the existing path variable is working fine, but for some reason my attempts to create a new environment variable have been unsuccessful. The code I am using is:</p>
<pre><code... | <p>Is there any reason that you have to do it through the registry?</p>
<p>If not, you can use Environment.SetEnvironmentVariable() since .NET 2.0. It allows you to set on a machine, process or user basis.</p>
| <p>It turns out there was another problem that was preventing the code in my question from being called. However, I was using the Win32 assembly because the example code I was following was written before the Environment assembly became available. So Thanks Peter for pointing out the Environment API.</p>
| 6,210 |
<p>I'm using the 'using' declaration in C++ to add std::string and std::vector to the local namespace (to save typing unnecessary 'std::'s).</p>
<pre><code>using std::string;
using std::vector;
class Foo { /*...*/ };
</code></pre>
<p>What is the scope on this declaration? If I do this in a header, will it inject th... | <p>When you #include a header file in C++, it places the whole contents of the header file into the spot that you included it in the source file. So including a file that has a <code>using</code> declaration has the exact same effect of placing the <code>using</code> declaration at the top of each file that includes th... | <p>Edited:</p>
<p>As a additional information , put "using" in your source file will affect your header when the statement is placed <strong>"before the #include"</strong> . ( The scope of using <strong>does not extend "backwards"</strong> )</p>
<p>header.h</p>
<pre><code>//header.h
#inclu... | 27,526 |
<p>I need to access some members marked internal that are declared in a third party assembly.</p>
<p>I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return types that are also internal and... | <p>You just keep digging on the returned value (or the PropertyType of the PropertyInfo):</p>
<p>u</p>
<pre><code>sing System;
using System.Reflection;
public class Foo
{
public Foo() {Bar = new Bar { Name = "abc"};}
internal Bar Bar {get;set;}
}
public class Bar
{
internal string Name {get;set;}
}
static... | <p>You can always retrieve it as an object and use reflection on the returned type to invoke its methods and access its properties.</p>
| 24,523 |
<p>I am constructing a search page with a textbox and a button for now, and probably a dropdown to filter results later on. I have my button's PostBackUrl set to my search page (~/search.aspx). Is there an easy way to pass the value in the text box to the search page?</p>
| <p>If you have the PostBackUrl set on your button, then the search box field on your first page, and any other form fields on that page, are already being posted to your search page. The trick is getting access to them in the code-behind for your search.aspx page.</p>
<pre><code>if (Page.PreviousPage != null)
{
Te... | <p>you may be able to use useSubmitBehavior="true" and put a method="get" on the form. that way it will use the browsers submit behavior and will append the values of the textbox's to the query string</p>
| 25,066 |
<p>I was looking at purchasing the Creality CR-X or another similar dual extruder (note, NOT dual nozzle) printer. I know it was designed to print two colors of the same filament, but is it able to print two different filaments?</p>
<p>I would be printing HIPS with ABS or PVA with PLA, so the two filaments would have v... | <p>I believe the problem is not so much that the filament is sticking to the nozzle; it's that the filament is not sticking to the bed.</p>
<p>You've confirmed that you have correct clearance for the nozzle to bed distance. The next considerations are bed temperature and nozzle temperature. New brands often require new... | <p>I believe the problem is not so much that the filament is sticking to the nozzle; it's that the filament is not sticking to the bed.</p>
<p>You've confirmed that you have correct clearance for the nozzle to bed distance. The next considerations are bed temperature and nozzle temperature. New brands often require new... | 1,792 |
<p>I'm trying to fully understand all of Haskell's concepts.</p>
<p>In what ways are algebraic data types similar to generic types, e.g., in C# and Java? And how are they different? What's so algebraic about them anyway? </p>
<p>I'm familiar with universal algebra and its rings and fields, but I only have a vague ide... | <p>Haskell's <em>algebraic data types</em> are named such since they correspond to an <em>initial algebra</em> in category theory, giving us some laws, some operations and some symbols to manipulate. We may even use algebraic notation for describing regular data structures, where:</p>
<ul>
<li><code>+</code> represents... | <p>For me, the concept of Haskell's algebraic data types always looked like polymorphism in OO-languages like C#.</p>
<p>Look at the example from <a href="http://en.wikipedia.org/wiki/Algebraic_data_types" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Algebraic_data_types</a>:</p>
<pre><code>data Tree = Empt... | 3,745 |
<p>It seems to me its very easy to implement an implicit operator versus a TypeConverter, so I'm assuming they aren't equivalent because of the prevalence of TypeConverters in the framework (see anything that extends FrameworkElement).</p>
<p>But why? Wouldn't it have been much easier to create string->object and obj... | <p>Type converters are a lot more complex than they seem; a type-converter has access to a range of meta-data about the <em>context</em> of the conversion - for example, the property and object that are involved. This is used to provide custom options per scenario (think: linked drop-downs, i.e. Country / County / City... | <p>Implicit operators are nice but also they can be confusing. I think that when you need to convert from one type to another it best to be explicit as there is no question as to what is going on.</p>
<p>Also implicit operators seemed to be reserved for things that are very much alike and the implicit conversion is i... | 49,697 |
<p>Can standard pointers in .Net do this? Or does one need to resort to P/invoke?</p>
<p>Note that I'm not talking about object references; I'm talking about actual C# pointers in unsafe code.</p>
| <p>C#, as a managed and protected run time engine, does not allow low level hardware access and the memory locations associated with actual hardware are not available.</p>
<p>You'll need to use a port driver or write your own in C++ or C with the proper Windows API to access the memory mapped I/O regions of interest. ... | <p>To expand on <a href="https://stackoverflow.com/questions/207291/how-to-read-from-a-memory-mapped-io-port-in-net#207320">Adam's answer</a>, you can't even perform memory-mapped I/O from a Win32 application without the cooperation of a kernel driver. All addresses a Win32 app gets are virtual addresses that have not... | 25,402 |
<p>I want to buy a 128bit SSL certificate for a website selling services. I checked <a href="http://www.rapidssl.com/ssl-certificate-products/ssl-certificate.htm" rel="noreferrer">http://www.rapidssl.com/ssl-certificate-products/ssl-certificate.htm</a> and <a href="http://www.geotrust.com/ssl/compare-ssl-certificates.h... | <p>The job of the SSL certificate authority(CA)/provider is to validate your organizational identity so that when customers access your web site, they not only get the padlock for security, but they know that your identity as the fully qualified hostname are authentic and not some phishing scam.</p>
<p>True, most all ... | <p>As for the warranty mentioned above, as far as I understand this is a warranty to the "end user" in case the certificate authority issues a certificate to a fraudulent person/domain. It is not a warranty to the website owner.</p>
| 19,029 |
<p>I have a list of timesheet entries that show a start and stop time. This is sitting in a MySQL database. I need to create bar charts based on this data with the 24 hours of the day along the bottom and the amount of man-hours worked for each hour of the day.</p>
<p>For example, if Alice worked a job from 15:30 to 1... | <p>Create a table with just time in it from midnight to midnight containing each minute of the day. In the data warehouse world we would call this a time dimension. Here's an example:</p>
<pre><code>TIME_DIM
-id
-time_of_day
-interval_15
-interval_30
</code></pre>
<p>an example of the data in the table would b... | <p>I came up with a pseudocode solution, hope it helps.</p>
<pre><code>create an array named timetable with 24 entries
initialise timetable to zero
for each user in SQLtable
firsthour = user.firsthour
lasthour = user.lasthour
firstminutes = 4 - (rounded down integer(user.firstminutes/15))
lastminutes = round... | 10,520 |
<p>I am looking at embedding perl 5.10 in a large C++ application compiled with VC++ 6.0. This leads to two questions.</p>
<p>1) Is it a bad idea to simply use Strawberry Perl as a dependency rather than compile my own perl with VC++ 6.0? Would Strawberry even work given the compiler mismatch? I presume Strawberry ... | <p>Given the uncertainty involved, I would recommend compiling Perl using MSVC instead of experimenting with Strawberry Perl for this application. There are instructions in <a href="http://perldoc.perl.org/perlwin32.html" rel="nofollow noreferrer">perlwin32</a> and a <a href="http://perlmonks.org/?node_id=346164" rel=... | <p>Activestate perl is compiled with VC++ 6.0. It can use VC++ 6.0 or MinGW to compile modules since they link to the same C runtime library, msvcrt.dll. It would be preferable to use MinGW because VC++ 6.0 is neither free nor readily available (unless you can be sure that it is installed on the target machine.) <a hre... | 49,065 |
<p>I am using tinyMCE as my text editor on my site and i want to reformat the text before saving it to my database (changing the &rsquo; tags into ' then in to &#39;). I cannot find a simple way of doing this using tinyMCe and using htmlentities() changes everything including <>. Any ideas?</p>
| <p>You can user <code>strip_tags($str, $allowed_tags)</code> like below:</p>
<pre><code>$txt = strip_tags($txt, '<p><a><br>');
</code></pre>
| <p>Directly from the PHP manual: <a href="http://fr2.php.net/manual/en/function.strip-tags.php" rel="nofollow noreferrer">strip_tags()</a></p>
<p>The $allowable_tags variable allows you to define a string of allowed tags. You can use this optional second parameter to specify tags which should not be stripped. </p>
| 24,531 |
<p>I have a Python web application consisting of several Python packages. What is the best way of building and deploying this to the servers?</p>
<p>Currently I'm deploying the packages with Capistrano, installing the packages into a virtualenv with bash, and configuring the servers with puppet, but I would like to go... | <p>Depends on what Your infrastructure is. We're just using debian packages and buildbot to make them.</p>
<p>On other setups, I use <a href="http://docs.fabfile.org/" rel="nofollow noreferrer">Fabric</a> scripts. As for format, I'm just using tbz2 files, but I've heard about people just depoloying eggs.</p>
<p>I'd s... | <p>Would SCons do what you want?</p>
<p><a href="http://www.scons.org/" rel="nofollow noreferrer">http://www.scons.org/</a></p>
| 20,088 |
<p>This should be easy, but I'm not sure how to best go about it. I have a WinForms app that lets the user type in long descriptions. Occaisionally, they would type in URLs, and the RichTextBox would recognize them and make them clickable when displayed.</p>
<p>I'm moving the app to the web, and I'm not sure how to ma... | <p>It's actually a very difficult problem. You can get close, but not perfect, with regular expressions. There's a very nice breakdown of potential regex patterns to consider here: <a href="http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/" rel="nofollow noreferrer">http://www.regexguru.com/2008/11/... | <p>Beware. If the clickable URLs your users are generating are visible to other users, you'll be introducing new issues with cross-site scripting attacks and the like. Also, you may need to sanitize URLs. For example, there might be an ampersand in the URL but you'll need to escape it.</p>
<p>So, there's actually t... | 44,441 |
<p>How can I check if an application is running from a batch (well cmd) file?</p>
<p>I need to not launch another instance if a program is already running. (I can't change the app to make it single instance only.)</p>
<p>Also the application could be running as any user.</p>
| <p>Another possibility I came up with, which does not require to save a file, inspired by using <a href="http://en.wikipedia.org/wiki/Grep" rel="noreferrer">grep</a> is:</p>
<pre><code>tasklist /fi "ImageName eq MyApp.exe" /fo csv 2>NUL | find /I "myapp.exe">NUL
if "%ERRORLEVEL%"==&q... | <p>You should check the parent process name, see <a href="http://en.wikipedia.org/wiki/The_Code_Project" rel="nofollow noreferrer">The Code Project</a> article about a <a href="http://www.codeproject.com/KB/cs/ParentProcWindow.aspx" rel="nofollow noreferrer">.NET based solution**</a>.</p>
<p>A non-programmatic way to ... | 19,627 |
<p>My <code>Account</code> model has the following two associations:</p>
<pre><code>has_many :expenses,
:order => 'expenses.dated_on DESC',
:dependent => :destroy
has_many :recent_expenses,
:class_name => 'Expense',
:conditions => "expenses.dated_on <= '#{D... | <p>Rails is building the query when loaded and then will re-use that query every time you call @account.recent_expenses which is exactly what you're experiencing.</p>
<p>If you're using Rails 2.1 you can use named_scope to achieve what you're looking for.</p>
<p>in your <strong>Expense</strong> model, put the followi... | <p>Here is what it would look like in Rails 3:</p>
<pre><code>scope :recent, lambda { where("expenses.dated_on <= ?", Date.today).order('dated_on DESC').limit(5) }
</code></pre>
<p><em><strong>WARNING:</em></strong> Watch out for chained scopes that are not wrapped in lambda. You may think that part of the chain ... | 21,400 |
<p>Is it possible to make it appear to a system that a key was pressed, for example I need to make <kbd>A</kbd> key be pressed thousands of times, and it is much to time consuming to do it manually, I would like to write something to do it for me, and the only thing I know well enough is Python.</p>
<p>A better way t... | <p>Install the <a href="https://github.com/mhammond/pywin32" rel="noreferrer">pywin32</a> extensions. Then you can do the following:</p>
<pre><code>import win32com.client as comclt
wsh= comclt.Dispatch("WScript.Shell")
wsh.AppActivate("Notepad") # select another application
wsh.SendKeys("a") # send the keys you want
<... | <p>You can use pyautogui module which can be used for automatically moving the mouse and for pressing a key. It can also be used for some GUI(very basic).
You can do the following :-
import pyautogui
pyautogui.press('A') # presses the 'A' key</p>
<p>If you want to do it 1000 times, then you can use a while loop</p>
<p>... | 16,545 |
<p>Has the introduction of the .net framework made raw programming in COM and DCOM redundant ? </p>
<p>(Except for using some COM+ services, e.g. for transaction management through the System.EnterpriseServices namespace)</p>
| <p>Not yet, because the OS is still unmanaged.</p>
<p>If MS finally do what their labs have been talking about for years and produce a fully managed OS then it will.</p>
<p>That OS won't be backwards compatible though. They would have to produce managed versions of Office, IE, etc first. They will have to produce a v... | <p>.NET has been deliberately designed to replace COM (and, consequently, DLL Hell) so while .NET applications still can access COM components, all new development are encouraged to move to .NET except if you have a very good reason to stick with COM.</p>
| 5,449 |
<p>Is there a way other than looping through the Files in a SPFolder to determine if a give filename (string) exists?</p>
| <p>You can, if you know the URL also use the SPFile.Exists property as follows:</p>
<pre><code>using (SPSite site = new SPSite("http://server/site"))
using (SPWeb web = site.OpenWeb())
{
SPFile file = web.GetFile("/site/doclib/folder/filename.ext");
if (file.Exists)
{
...
}
}
</code></pre>
<p>One would on... | <p>Using a <a href="http://msdn.microsoft.com/en-us/library/ms467521.aspx" rel="nofollow noreferrer">CAML</a> query is the most efficient way (<a href="http://www.devx.com/dotnet/Article/31762/0/page/1" rel="nofollow noreferrer">example here</a>)</p>
<p>CAML can be a bit unwieldy, so also worth looking at the <a href=... | 46,919 |
<p>How can I use multiple keys in WSH Script like (ALT,CTRL,DELETE)?
How can i take a screenshot of an application and paste it in MSWord using WSH SCript?</p>
| <p>Using SendKeys, you can't. <a href="https://stackoverflow.com/questions/370673/taking-screenshots-of-an-application-using-wsh-script#370685">I told you so</a>.</p>
<p>Regarding sending multiple keys - please read the <a href="http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx" rel="nofollow noreferrer">do... | <p>Yeah I think like Tomalak said, what you're trying to do will most likely involve invoking an ActiveX component using the CreateObject command.</p>
<p>I'd advise against it though, usually when you hit the point where your script is trying to invoke applications (Word) and take screenshots... it's time to invest in... | 48,473 |
<p>Every tutorial or explanation of REST just goes too complicated too quickly - the learning curve rises so fast after the initial explanation of CRUD and the supposed simplicity over SOAP. Why can't people write decent tutorials anymore!</p>
<p>I'm looking at Restlet - and its not the best, there are things missing... | <p>It sounds like you could use a solid understanding of the fundamentals of REST, and for that I <em>highly</em> recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0596529260" rel="noreferrer" rel="nofollow noreferrer">RESTful Web Services</a> by Leonard Richardson and Sam Ruby. I provides a great introd... | <p>eSoftHead company has just released a <a href="http://blog.esofthead.com/develop-restful-application-with-resteasy/" rel="nofollow noreferrer">short tutorial</a> of developing Restful application by using RESTeasy.</p>
| 43,259 |
<p>I'm toying with my first remoting project and I need to create a RemotableType DLL. I know I can compile it by hand with csc, but I wonder if there are some facilities in place on Visual Studio to handle the Remoting case, or, more specificly, to tell it that a specific file should be compiled as a .dll without havi... | <p>Note the caveat in the manual at <a href="http://uk.php.net/error_reporting" rel="noreferrer">http://uk.php.net/error_reporting</a>:</p>
<blockquote>
<blockquote>
<p>Most of E_STRICT errors are evaluated at the compile time thus such errors are not reported in the file where error_reporting is enhanced to inc... | <p>Use <em>log_errors</em> for them to be logged instead of displayed.</p>
| 10,378 |
<p>According to the doucmentation for "Directory.Delete( "path", true )", it remove directories, subdirectories, and files in the path.</p>
<p>What does Directory.Delete( "path", false ) do? According to the doucmentation it does "otherwise".</p>
<p>I mean how can you delete a directory without removing the directory... | <p>Bill James is correct. According to <a href="http://msdn.microsoft.com/en-us/library/fxeahc5f.aspx" rel="noreferrer">MSDN</a>, if the <em>recursive</em> parameter is false and the directory is not empty, IOException will be thrown.</p>
| <p>Second argument tells whether you want a recursive delete. If it's false, the method will throw an IOException if the directory is not empty.</p>
| 22,986 |
<p>A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth.</p>
<p>Is this true? How's this technique named?</p>
| <p>There is a technique called "<a href="http://en.wikipedia.org/wiki/Hole_punching" rel="nofollow noreferrer">Hole Punching</a>" that works well with "Cone" NAT (Cone is a technical familly of router). That's not an 100% sure technique, today, it works well with UDP on about 80% of the router.</p>
<p>There is some im... | <p>This is true. It's the way <a href="https://www.copilot.com/" rel="nofollow noreferrer">FogCreek Copilot</a> works</p>
<p>Take a look at item 2 on Joel's <a href="http://www.joelonsoftware.com/items/2007/01/26.html" rel="nofollow noreferrer">Copilot 2.0 post</a>.</p>
| 6,587 |
<p>I have an extender (IExtenderProvider) which extends certain types of
controls with additional properties. For one of these properties, I have
written a UITypeEditor. So far, all works just fine.</p>
<p>The extender also has a couple of properties itself, which I am trying to
use as a sort of default for the UIT... | <p>Could you read the attribute yourself?</p>
<pre><code>DefaultValueAttribute att = context.
PropertyDescriptor.Attributes.
OfType<DefaultValueAttribute>().
FirstOrDefault();
object myDefault = null;
if ( att != null )
myDefault = att.Value;
</code></pre>
<p>I've used Linq to simplify the code,... | <p>Have you considered adding the DefaultValue as a static property of the ExtenderProvider, then you can access it without requiring an instance of the provider?</p>
| 4,636 |
<p>I'm writing code that looks similar to this:</p>
<pre><code>public IEnumerable<T> Unfold<T>(this T seed)
{
while (true)
{
yield return [next (T)object in custom sequence];
}
}
</code></pre>
<p>Obviously, this method is never going to return. (The C# compiler silently allows this, wh... | <p>So long as you document very clearly that the method will never finish iterating (the method itself returns very quickly, of course) then I think it's fine. Indeed, it can make some algorithms much neater. I don't believe there are any significant memory/perf implications - although if you refer to an "expensive" o... | <p>I would not use an infinite enumerator in a public API. C# programmers, myself included, are too used to the foreach loop. This would also be consistent with the .NET Framework; notice how the Enumerable.Range and Enumerable.Repeat methods take an argument to limit the number of items in the Enumerable. Microsoft ch... | 24,001 |
<p>I would like to know how to unload an assembly that is loaded into the main AppDomain.</p>
<p>I have the following code:</p>
<pre><code>var assembly = Assembly.LoadFrom( FilePathHere );
</code></pre>
<p>I need/want to be able to unload this assembly when I am done.</p>
<p>Thanks for your help.</p>
| <p><strong>For .net versions core 3.0 and later:</strong></p>
<p>You can now unload assemblies. Note that appdomains are no longer available in .net core. Instead, you can create one or more AssemblyLoadContext, load your assemblies via that context, then unload that context. See <a href="https://learn.microsoft.com... | <p>As an alternative, if the assembly was just loaded in the first place, to check information of the assembly like the publicKey, the better way would be to not load it,and rather check the information by loading just the AssemblyName at first:</p>
<pre><code>AssemblyName an = AssemblyName.GetAssemblyName ("myfile.ex... | 15,013 |
<p>This print failed a couple of hours in. I was wondering if the nature of the print surface, with lots of retracts (similarly the previous print which was OK) might have contributed to the clog, or if it's just bad luck? To be clear, the surface has lots of short dead-end, not just a wiggly perimeter.
<a href="https... | <p>Reading your question it's not clear to me if you are referring to <em>filament retraction</em> (which is a configurable setting) or <em>surface recesses</em> which seems what you are referring to when writing:</p>
<blockquote>
<p>the nature of the print surface, with lots of retracts</p>
</blockquote>
<p>If it ... | <p>In addition to the retraction distance, in the case of this model, I was seeing some places where there were a lot of very close retractions. I think these were increasing the risk of damaged filament, so I reduced the 'maximum retraction count' which at 50 over a 5mm length seemed fairly high.</p>
| 837 |
<p>I understand that IronPython is an implementation of Python on the .NET platform just like IronRuby is an implementation of Ruby and F# is more or less OCaml. </p>
<p>What I can't seem to grasp is whether these languages perform closer to their "ancestors" or closer to something like C# in terms of speed. For exa... | <p>IronPython and IronRuby are built on top of the DLR -- dynamic language runtime -- and are compiled to CIL (the bytecode used by .NET) on the fly. They're slower than C# but faaaaaaar faster than their non-.NET counterparts. There aren't any decent benchmarks out there, to my knowledge, but you'll see the differen... | <p>Currently IronRuby is pretty slow in most regards. It's definitely slower than MRI (Matz' Ruby Implementation) overall, though in some places they're faster.</p>
<p>IronRuby does have the potential to be much faster, though I doubt they'll ever get near C# in terms of speed. In most cases it just doesn't matter. ... | 17,507 |
<p>I'm using the following code</p>
<pre><code>System::Diagnostics::Process^ p = gcnew System::Diagnostics::Process();
p->StartInfo->FileName = "tnccmd.exe";
p->StartInfo->UseShellExecute = false;
p->StartInfo->RedirectStandardInput = true;
p->StartInfo->RedirectStandardOutput = true;
p->S... | <p>I'm a little confused by the question, but here are some thoughts:</p>
<ol>
<li><code>DataGridView</code> has an <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autogeneratecolumns.aspx" rel="nofollow noreferrer"><code>AutoGenerateColumn</code>s</a> property; if you don't want it ... | <p>I can only give a partial answer but I think the reason that </p>
<pre><code>public void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
libDataGrid.DataSource = this.manager.Lib.LibList;
libDataGrid.Refresh();
}
</code></pre>
<p>isn't working, is beca... | 41,229 |
<p>I've been having a hard time lately getting the raft off of my ABS prints.</p>
<p>Is that a symptom of either a nozzle or bed that are too hot? Or is there some other factor I should be looking in to?</p>
<p>I have an UP mini that I've modified both the nozzle and bed to customize the temperatures on.</p>
<p>Bed ... | <p>A couple things to consider:</p>
<ul>
<li>Ensure that your build plate is flat and level. An un-parallel HBP could result in the object "welding" to the raft.</li>
<li>Turn down your nozzle temperature. It is likely that the material is hotter than it needs as it is extruding. This results in a slower "cool-down ra... | <p>I haven't got a printer with a heated bed so have only tested this on PLA but I have found editing the G code so the printer cools the nozzle down and then heats it up again gives the raft enough time to cool down so that it peels off easier when the print is finished. </p>
| 300 |
<p>Often I find myself interacting with files in some way but after writing the code I'm always uncertain how robust it actually is. The problem is that I'm not entirely sure how file related operations can fail and, therefore, the best way to handle exceptions.</p>
<p>The simple solution would seem to be just to catch... | <blockquote>
<p>...but is it possible to get a bit more fine-grained error messages.</p>
</blockquote>
<p>Yes. Go ahead and catch <code>IOException</code>, and use the <code>Exception.ToString()</code> method to get a relatively relevant error message to display. Note that the exceptions generated by the .NET Framew... | <p>I would use the using statement to simplify closing the file. See <a href="http://msdn.microsoft.com/en-us/library/aa664736.aspx" rel="nofollow noreferrer">MSDN the C# using statement</a></p>
<p>From MSDN:</p>
<pre><code> using (TextWriter w = File.CreateText("log.txt")) {
w.WriteLine("This is line one");
... | 11,229 |
<p>I have a printer with a 0.1 mm typical layer thickness. Of course I can choose some different sizes in Cura or other slicing software, but most prints on this machine will be .1mm. In my (admittedly limited) experience thus far, the 0.1 mm seems typical for other printers, too.</p>
<p>I want to get a sense of just ... | <p>I'm not sure exactly what you mean by your comment to Davo's answer, but with respect to your use of a sheet of paper reference, it seems like you can still use <em>80 gsm</em> paper as a reference for 0.1 mm layers.</p>
<p>From <a href="http://www.printware.co.uk/Blog/311/Paper-Sizes-Explained.html" rel="nofo... | <p>IMO, better way for the thickness visualization is the <a href="https://en.wikipedia.org/wiki/Feeler_gauge" rel="nofollow noreferrer">feeler gauge</a>. Also it can be successfully used for the calibration of gap between the nozzle and the hotbed (instead paper)</p>
| 993 |
<p>I am trying to launch the ColdFusion Server Monitor on a Windows Server 2003 (Web Edition) machine running ColdFusion 8 (ver. 8,0,0,176276). It is running in stand-alone configuration. </p>
<p>The pop-up window launches as <a href="http://www.mydomain.com/CFIDE/administrator/monitor/launch-monitor.cfm" rel="nofollo... | <p>** FURTHER EDIT **</p>
<p>Adobe have created a new technote to address this issues at
<a href="http://www.adobe.com/go/kb407866" rel="nofollow noreferrer">http://www.adobe.com/go/kb407866</a></p>
<p>** ORIGINAL POST **</p>
<p>I posted this same question on the Adobe forums and that great Coldfusion community sta... | <p>I've run into this where you need to launch the shortcut from the profile that installed the CF server app. Either that or you have a typo in credentials, compare to a working one or try domain\user or .\user</p>
<p>hope that helps</p>
| 32,725 |
<p>I would like to quickly send email from the command line. I realize there are probably a number of different ways to do this.</p>
<p>I'm looking for a simple way to do this from a linux terminal (likely a bash shell but anything should do) and an alternative way to do this on Windows. I want to be able to whip up... | <pre><code>$ echo "This is the email body" | mail -s "This is the subject" me@email.com
</code></pre>
<p>Alternatively:</p>
<pre><code>$ cat | mail -s "A few lines off the top of my head" me@here.com
This is where my
multiline
message would go
^D
</code></pre>
<p>^D - means press <kbd>ctrl</kbd>+<kbd>d</kbd></p>
| <p>If you want to invoke an email program, then see this article:</p>
<p><a href="https://stackoverflow.com/questions/17373/how-do-i-open-the-default-mail-program-with-a-subject-and-body-in-a-cross-platf">How do I open the default mail program with a Subject and Body in a cross-platform way?</a></p>
| 5,708 |
<p>I'm trying to do an informal feasibility study for work on if Mono/Apache/Linux is realistically 'ready' and in any way comparable to a more traditional .NET/IIS/Windows stack.</p>
<p>Any comparison of performance would be helpful too.</p>
| <p>Take a look at <a href="http://www.mono-project.com/Companies_Using_Mono" rel="noreferrer">companies using Mono</a>.</p>
<p>It even says that <a href="http://en.wikipedia.org" rel="noreferrer">Wikipedia</a> uses Mono for its search facilities.</p>
| <p>I am running a couple sites off ASP.NET over Mono. I am targeting 2.0 of the framework.
I haven't had Digg numbers, but I have also never had an issue.</p>
| 20,959 |
<p>I'm developing a website (using asp.net by the way) and I'm having a problem with IE6.</p>
<p>When I use some icons near links, using background-image and padding-left on the links, the icons display nice on FF and Chrome but in IE6 they take a kind of "gray" background, and sometimes the flash strangely.</p>
<p>A... | <p>Are they .png files? IE6 has issues with alpha transparency in .pngs. There is a <a href="http://homepage.ntlworld.com/bobosola/pnghowto.htm" rel="nofollow noreferrer">javascript fix though</a>.</p>
<p>Edit, to clarify - If IE6 sees a .png with alpha transparency (which is different than the transparency in .gifs) ... | <p>Be careful with the PNG fix in IE6 - it uses a DirectX filter and it's relatively slow. If you have a lot of images on a page (for instance an icon on each row of 25 in a table) it can slow the page down quite a bit.</p>
<p>We found that the only performant solution was to server up aliased GIFs to IE6 and PNGs to ... | 28,053 |
<p>I've created an <code>IHttpHandler</code> in .NET C# which returns pieces of html to a classic asp page.</p>
<p>The classic asp page communicates with the <code>IHttpHandler</code> through basic http requests using <code>ServerXMLHTTP</code> in vbscript or Ajax Calls in JavaScript.</p>
<p>Now, I need a way to shar... | <p>You could put your value in a cookie, then you could read with javascript and do anything with it, including sending it in a request to the .net app...</p>
| <p>In the end my solution to the problem was the following:</p>
<ol>
<li>I send the variables to my webservice along with the normal ws request</li>
<li>I store the variable values in a hash table on the webservice and return the hashkey to the client in a hidden html object (I used a head <code><meta></code> el... | 13,955 |
<p>I'm pretty sure stackoverflow.com is created with ASP.NET, but no matter where I click I see no .aspx extension in the address bar.
How it is done and is there a particular reason for this?</p>
| <p>In the case of stackoverflow, they use ASP.NET MVC rather than ASP.NET web forms. With web forms, the url is pointing to a file on your disk, while MVC is pointing to a controller action. If you're using webforms, you'd want to use URL rewriting. Scott Guthrie has a <a href="http://weblogs.asp.net/scottgu/archive... | <p>and as far as a reason :</p>
<ul>
<li>you can change technology (say to PHP) without indexed or bookmarked URLs breaking</li>
<li>your URLs are more 'REST'ful and correspond to resources and not just a file</li>
<li>you can remember a URL or read it to someone over the phone more easily</li>
</ul>
| 27,633 |
<p>Is there any way to print in memory collection or variable size in WPF? </p>
<p>I am using the following code in which I print the ListView control. But when the content is larger than the vertical scroll bar takes over and cuts the content. </p>
<pre><code> PrintDialog printDialog = new PrintDialog();
... | <p>To print multiple pages you just need to use a class that implements DocumentPaginator FixedDocument is one of the more complex implementations, FlowDocument is a simpler one.</p>
<pre><code>FlowDocument fd = new FlowDocument();
foreach(object item in items)
{
fd.Blocks.Add(new Paragraph(new Run(item.ToString(... | <p>Interesting, Is the ListView virtualized? If it is, the object are not drawn, that is a possibility. Take a look at the Printing <a href="http://www.charlespetzold.com/blog/2006/02/PrintaBunchaButtons.cs" rel="nofollow noreferrer">example</a> from Petzold.</p>
| 25,123 |
<p>I can understand wanting to avoid having to use a cursor due to the overhead and inconvenience, but it looks like there's some serious cursor-phobia-mania going on where people are going to great lengths to avoid having to use one.</p>
<p>For example, one question asked how to do something obviously trivial with a ... | <p>The "overhead" with cursors is merely part of the API. Cursors are how parts of the RDBMS work under the hood. Often <code>CREATE TABLE</code> and <code>INSERT</code> have <code>SELECT</code> statements, and the implementation is the obvious internal cursor implementation. </p>
<p>Using higher-level "set-based o... | <p>basicaly 2 blocks of code that do the same thing. maybe it's a bit weird example but it proves the point. SQL Server 2005:</p>
<pre><code>SELECT * INTO #temp FROM master..spt_values
DECLARE @startTime DATETIME
BEGIN TRAN
SELECT @startTime = GETDATE()
UPDATE #temp
SET number = 0
select DATEDIFF(ms, @startTime, GE... | 36,569 |
<p>Frequently, I've dug into apropos and docs looking for something like the following only to give up to get back to the task at hand:</p>
<p>(repeat-last-command)</p>
<p>do the last C- or M- command I just executed (to be rebound to a fn key)</p>
<p>or sometimes the related: </p>
<p>(describe-last-function)</p>
... | <p>Repeat functionality is provided by the <code>repeat.el</code> Emacs Lisp package, which is included with standard Emacs distributions. From <code>repeat.el</code>'s documentation:</p>
<blockquote>
<p>This package defines a command that
repeats the preceding command,
whatever that was, including its
argume... | <p><a href="https://www.emacswiki.org/emacs/dot-mode.el" rel="nofollow noreferrer">dot-mode</a> is a way to repeat the last command(s).</p>
<p>From its commentary:</p>
<blockquote>
<p>It emulates the vi `redo' command, repeating the
immediately preceding sequence of commands. This is done by
recording input commands w... | 34,769 |
<p>Does anyone know of a Jabber library for Lua? I've found the 'Lua Messaging Library' for AIM, although I can't find a download for it, it appears to be abandoned.</p>
<p>Something like that for Lua would be helpful.</p>
<hr>
<p>I'm sorry I didn't state this originally, I meant a 'pure Lua' library.</p>
<p>I'm f... | <p>As a bit of a follow-up, I'm the author of both Prosody and Verse. I'm in the process of updating Verse to use the new code developed for Prosody, and as such Verse will become a "pure Lua" XMPP library descended from it.</p>
<p>It will of course need to depend on the usual LuaSocket, LuaExpat, etc. but no generate... | <p>There is <a href="http://prosody.im/" rel="nofollow noreferrer" title="Prosody Home Page">Prosody</a> which is a LUA XMPP server: it may give you a head-start.</p>
| 26,136 |
<p>Let's face it. The Singleton Pattern is <a href="https://stackoverflow.com/questions/11831/singletons-good-design-or-a-crutch#11839">highly controversial</a> topic with hordes programmers on <em>both</em> sides of the fence. There are those who feel like the Singleton is nothing more then a glorified global variab... | <p>Alex Miller in "<a href="http://tech.puredanger.com/2007/07/03/pattern-hate-singleton/" rel="noreferrer">Patterns I Hate</a>" quotes the following:</p>
<p>"When a singleton seems like the answer, I find it is often wiser to:</p>
<ol>
<li>Create an interface and a default implementation of your singleton</li>
<li>C... | <p>What do you mean, what are my techniques to avoid it?</p>
<p>To "avoid" it, that implies that there are many situations that I come across in which the singleton pattern is a naturally good fit, and hence that I have to take some measures to defuse these situations.</p>
<p>But there are not. I don't have to avoid... | 19,599 |
<p>A large international company deploys a new web and MOTO (Mail Order and Telephone Order) handling system. Among other things you are tasked to design format for both order and customer identification numbers.</p>
<p>What would be the best format in your opinion? Please list any assumptions and considerations.</p>
... | <p>Go with all numbers or all letters. If you must mix it up, then make sure there are no ambiguous characters (Il1m, O0, etc.). </p>
<p>When displayed/printed, put spaces in every 3-4 characters but make sure your systems can handle inputs without the spaces.</p>
<p>Edit:
Another thing to consider is having a built ... | <p>An additional consideration to the format issue- in the code, create a separate class for OrderId and CustomerId. These classses are immutable, and validate their input to ensure that they are acceptable IDs. Also, no value could be and order ID and a customer ID. </p>
<p>The simplest approach would just be to have... | 21,523 |
<p>I'm working on an app that requires no user input, but I don't want the iPhone to enter the power saving mode.</p>
<p>Is it possible to disable power saving from an app?</p>
| <p><strong>Objective-C</strong></p>
<pre><code>[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
</code></pre>
<p><strong>Swift</strong></p>
<pre><code>UIApplication.shared.isIdleTimerDisabled = true
</code></pre>
| <p>We were having the same issue. Turned out to be a rogue process on our MDM server that was deleted in our account but on the server was still sending the command to dim our devices. </p>
| 15,271 |
<p>In my ASP.NET application I have a web.config file. In the web.config file I have a connection string...</p>
<pre><code><connectionStrings>
<add name="HRDb" connectionString="xxxxx" providerName="System.Data.SqlClient" />
</connectionStrings>
</code></pre>
<p>Yet, when I retrieve this value u... | <p>I figured out what was going wrong.</p>
<p>So to answer my own question... ConfigurationManager only reads from web.config.</p>
<p>My problem was that the project was configured to use an IIS web server when running the project instead of using the Visual Studio Development server. So I was in fact running an old... | <p>Where was the 'old' value stored? Is it in a different config file? The config manager should only pull from the config files, but there can be multiple files for an application. Is part of your build process copying in an old file?</p>
| 30,015 |
<p>I am working on the issue of testing my GUI and I am not entirely sure of the best approach here. My GUI is built using a traditional MVC framework so I am easily able to test the logic parts of the GUI without bringing up the GUI itself. However, when it comes to testing the functionality of the GUI, I am not reall... | <p>You have (at least) 2 issues - the complexity of the environment (the server) and the complexity of the GUI.</p>
<p>There are many tools for automating GUI testing. All of them are more or less fragile and require pretty much constant maintenance in the face of changing layout. There is benefit to be gained from usi... | <p>What you're looking for is "acceptance testing." How you do it depends on the frameworks you're using, what type of application you are creating and in what language. If you google your particular technology and the above phrase, you should find some tools you can use.</p>
| 11,757 |
<p>I am working with a Sharepoint document library and I'm trying to locate the source of the document library page. I'm working on the Sharepoint server. I just can't find it, where should it be stored?</p>
<p>Thank you!</p>
| <p>SharePoint does not store the pages directly in the filesystem. The mechanism is a little less straightforward.</p>
<p>To understand this mechanism, You have to understand the concepts of Ghosting/Unghosting, and the ASP.NET Virtual Path Provider. The SharePoint stores the pages in the Database as BLOBS, and serves... | <p>If I understand what Sacha and Naspinski are saying, when I am creating a new Document library, the look of the page is retrieved from the 12 hive and stored (ghosted?) into the DB. The page is no more stored into the 12 hive, as for each document library I will have a somehow "customized page". <br><br>Is that true... | 15,295 |
<p>When using strongly typed dataSets in Visual Studio 2005/2008, if the underlying database schema changes, the only practical way to refresh is to delete the dataset and recreate it from scratch. This is OK unless I need to customize the dataset.</p>
<p>Customizing by extending the partial dataset class allows cus... | <p>If you are just making a simple change like adding a field to a table, then I right click on the table and click configure. Go through the wizard again adding the new field, (or even replacing the select with select *) and it adds the field to the table and syncs up all the queries that you've built. I've had tabl... | <p>Typed Datasets are evil. LINQ to SQL is what typed datasets should have been, so I like to think of it as Typed Datasets 3.0. I hope when they fold L2S into the Entity Framework they retain what makes L2S so good.</p>
| 37,395 |
<p>Whenever I have a library that use across different websites/ applications I've always just added the library's project into the same solution and reference it from there. This is great when needing to debug within the solution but in all other situations it seems pointless and more space taken up in the solution ex... | <p>We keep our production Dlls in a well-known location on a network drive and reference is via the DFS UNC path (no drive letter). This way we can have different versions of the library in use at the same time and updates don't break code/force a recompilation until the newer version needs to be used. A standard nam... | <p>Keep the library in some shared folder between projects, and just reference it. That way when its updated, the changes will be persisted everywhere. For debugging, i think if you keep the .pdb files for the library handy then you should be able to step into the dlls, however, should you be concerned with debugging a... | 34,199 |
<p>I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My initial target platform, Blackberry, lim... | <p>For anything past a few kilobytes you need to use either JSR 75 or a remote server. RMS records are extremely limited in size and speed, even in some higher end handsets. If you need to juggle 1MB of data in J2ME the only reliable, portable way is to store it on the network. The HttpConnection class and the GET and ... | <p>I'm just starting to code for JavaME, but have experience with old versions of PalmOS, where all data chunks are limited in size, requiring the design of data structures using record indexes and offsets.</p>
| 3,951 |
<p>I'm developing an application with a team in .Net (C++) and provide a COM interface to interact with python and other languages.</p>
<p>What we've found is that pushing data through COM turns out to be pretty slow.</p>
<p>I've considered several alternatives:</p>
<ul>
<li>dumping data to a file and sending the fi... | <p>Staying within the Windows interprocess communication mechanisms, we had positive experience using <em>windows named pipes</em>.
Using Windows overlapped IO and the <code>win32pipe</code> module from <a href="http://pywin32.sourceforge.net/" rel="noreferrer">pywin32</a>.</p>
<p>You can learn much about win32 and p... | <p>It shouldn't be too complicated to set up a test for each of your alternatives and do a benchmark. Noting beats context sensitive empirical data... :)</p>
<p>Oh, and if you do this I'm sure a lot of people would be interested in the results.</p>
| 36,433 |
<p>in C++ I have two chars holding hex values e.g.:</p>
<pre><code>char t = 0x4;
char q = 0x4;
</code></pre>
<p>How would i compare if the two values held in the char are the same?? I tried</p>
<pre><code>if (t == q) // should give me true
</code></pre>
<p>but no, any help, thanks!</p>
| <p>A char is just an 8-bit integer. It doesn't matter if you initialized it with hex or decimal literal, in either case the value of the char will be the same afterwards. </p>
<p>So: </p>
<pre><code>char t = 0x4;
char q = 0x4;
if(t == q)
{
//They are the same
}
</code></pre>
<p>It is equivalent to:</p>
<pre><... | <p>Ah, I found the solution:</p>
<pre><code>if (t & q)
</code></pre>
| 32,102 |
<p>I have setup both mirroring and and log shipping on 8 databases of about 10 GB each size on same instance, but now when I want to mirror another database it very long to display the Database Properties page. Any suggestion for this problem.</p>
| <p>I am assuming you are using "ALTER DATABASE [dbname] SET SAFETY FULL" as that will cause the databases to update syncronized (e.g. your transaction will not complete until commited on both database servers).</p>
<p>If you have high latency between the servers, you will get a large performance penalty.</p>
<p>You c... | <p>You could set up a trace and see what is going on when the GUI makes the call to SQL. </p>
<p>I had a similar problem with a database that was moved from 2000 to 2005, but it eventually cleared up on it's own. </p>
| 44,750 |
<p>As I get more and more namespaces in my solution, the list of using statements at the top of my files grows longer and longer. This is especially the case in my unit tests where for each component that might be called I need to include the using for the interface, the IoC container, and the concrete type. </p>
<p... | <p>Some people enjoy hiding the usings in a <code>#region</code>. Otherwise, I think you're out of luck. Unless you want to put the namespace on all your referents.</p>
| <p>Resharper - the add-in for Visual Studio - has a feature that strips unsued Using's from a file, but I don't know anything that does quite what you describe.</p>
| 8,757 |
<p>I have an abstract class:</p>
<pre><code>type
TInterfaceMethod = class abstract
public
destructor Destroy; virtual; abstract;
function GetBasePlan: Word; virtual; abstract;
procedure CountBasePlan; virtual; abstract;
procedure Calculate; virtual; abstract;
procedure Prepare... | <p>Yes you can. Abstract classes are classes and they can have implementations.</p>
<p>By adding the abstract keyword to a class, you prohibit the class to be instantiated. It does not require to have any abstract methods.</p>
<p>A class with absract methods can be instantiated, but this result in a warning at compil... | <p>Just to add to Gamecat's answer, not only can you, but you should put your common code there.</p>
| 42,681 |
<p><strong>Goal:</strong>
Allow the user to delete a record by dragging a row from an AdvancedDataGrid, dropping it onto a trash-can icon and verify the user meant to do that via a popup alert with "OK" and "Cancel" buttons. </p>
<p><strong>What is working:</strong>
<ul>
<li>Dragging/Dropping a row onto the tra... | <p>Have you tried running the validateNow() method on the ADG after the cancel event?</p>
<p>Here is some more information on the validateNow() method. </p>
<p><a href="http://www.judahfrangipane.com/blog/?p=220" rel="nofollow noreferrer">Why you need to know about validateNow...</a></p>
<p>I really do think this is... | <p>Try refreshing the data bindings on the datagrid using executeBindings and/or invalidateDisplayList in the enclosing control. </p>
<p>To be honest this sounds a bit like a bug. Have you posted this on <a href="http://tech.groups.yahoo.com/group/flexcoders/messages" rel="nofollow noreferrer">flexcoders</a>? The A... | 27,571 |
<p>I've been using various source control systems for a while, but when it comes to reverting changes I'm not yet an expert. Can someone help given this scenario:</p>
<h2>Scenario</h2>
<ul>
<li>Given a bug was introduced in revision #5</li>
<li>And 3 files were changed in revision #5</li>
<li>And changes in 2 files w... | <p>Here is a <a href="http://svnbook.red-bean.com/en/1.8/svn.tour.history.html" rel="nofollow noreferrer">link to svn</a> book explaining all about reverts and history. </p>
<p>To do a diff you would do something like svn diff -r 4:5 somefile.txt</p>
| <p>If you are using <a href="http://tortoisesvn.tigris.org/" rel="nofollow noreferrer">http://tortoisesvn.tigris.org/</a> then this is a rather simple process. Just right click on a file and select "log" to get a list of changes between now and a selected reversion. Then it is a matter of reverting the two files to rev... | 25,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.