instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am having a peculiar problem with the order in which FlowLayoutPanels are added in to the form's <strong>controls</strong> property. This is what I tried,</p>
<p>I added 7 FlowLayoutPanels in to a C# window application from left to right in vertical strips. Then I tagged the flow layouts as 1, 2, 3, ... 7 again f... | <p>I know this is quite an old question, but...</p>
<p>You might want to use <code>SetChildIndex</code>. e.g. <code>this.Controls.SetChildIndex(button1, 0);</code></p>
| <p>Is it really a problem?</p>
<p>As long as the UI operates correctly (in terms of tab order, for example), I'd recommend that you don't make any assumptions about the order in which they're enumerated.</p>
<p>EDIT: Thanks for explaining your requirement in more detail. I think I'd still recommend against using the ... | 35,474 |
<p>In Django templates, is there a variable in the context (e.g. <code>{{ BASE\_URL }}</code>, <code>{{ ROOT\_URL }}</code>, or <code>{{ MEDIA\_URL }}</code> that one can use to link to the <code>home</code> url of a project?</p>
<p>I.e. if Django is running in the root of a project, the variable (let's call it R) <co... | <p>You could give the URL configuration which you're using to handle the home page a name and use that:</p>
<p>urls.py:</p>
<pre><code>from django.conf.urls.defaults import *
urlpatterns = patterns('myproject.views',
url(r'^$', 'index', name='index'),
)
</code></pre>
<p>Templates:</p>
<pre><code><a href="{%... | <pre><code>(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/home/'}),
</code></pre>
<p>works fine :)</p>
| 28,015 |
<p>I'm currently working on a quite large library (5M lines of code, in C++ under VS2005, 1 solution and close to 100 projects). Even though we distribute compilation, and use incremental linking, recompilation and relinking after small source modifications takes between a few minutes (usually at least 3) and close to ... | <p>I don't know much about development at that level, but... it seems like it would be a good idea to separate into multiple solutions. You could have a final "pre-ship" step that consolidates them all into a single .dll if you/your customers really insist.</p>
<p>Compare, e.g., to the .NET Framework where we have lot... | <p>@Domenic: indeed, it would be a good thing... However, a whole team's been at it for some time now, and until they succeed we are stuck with a single .dll and something quite monolithic :-(</p>
| 5,933 |
<p>Okay, my company is a bank. The upper management is dead set on a websphere IBM portal. Apparently IBM is tossing them a bone they can't refuse. We're also a very big IBM shop anyhow with A LOT of LotusNotes applications.</p>
<p>In my experience with IBM, they generally make you go through them to learn their stuff... | <p>Check out the IBM <a href="http://www.redbooks.ibm.com/portals/websphere" rel="nofollow noreferrer">Redbooks</a> and <a href="http://www.ibm.com/developerworks/websphere/zones/portal/proddoc.html" rel="nofollow noreferrer">online help</a> for documentation and development guides. Try the <a href="http://www.ibm.com/... | <p>If I remember right from the days I worked with it, RAD have some sample "hello world" projects for WPS.
You can also <a href="http://www.skywayradio.com/tech/WAS51/portal/wps/wpsbscfg.html" rel="nofollow noreferrer">import sample portlets from here</a>.</p>
| 35,186 |
<p>A basic definition and example and a few references for "<a href="http://en.wikipedia.org/wiki/C_preprocessor#X-Macros" rel="nofollow noreferrer">X-Macros</a>" is given in this <a href="http://en.wikipedia.org/wiki/C_preprocessor" rel="nofollow noreferrer">wikipedia entry on the C pre-processor</a>:</p>
<blockquot... | <p>I use X Macros() in code a lot. The value comes from only adding new data only to the "X list" and not modifying any other code.</p>
<p>The most common use of X Macros() is for associating error text with error codes. When new error codes are added, programmers must remember to add the code and the text, typically ... | <p>Dr. Dobb's has an <a href="http://www.ddj.com/cpp/184401387" rel="noreferrer">article</a> on this.</p>
| 33,096 |
<p>With which version(s) of VS2008/VSTS can I work with .dbproj files?</p>
| <p>You can definitely use <a href="http://msdn.microsoft.com/en-us/library/aa833253(VS.80).aspx" rel="nofollow noreferrer">Team Edition for Database Professionals</a>. The bad news is that it seems you <a href="http://msdn.microsoft.com/en-us/library/aa833253(VS.80).aspx" rel="nofollow noreferrer">can only use this</a... | <p>One good note is that recently Microsoft changed the licensing so that if you already have Team System Developer Edition you can use Team Edition for DB Pro for free (and vice versa).</p>
<p><a href="http://www.microsoft.com/defyallchallenges/teamsystem/default.aspx?WT.mc_id=R" rel="nofollow noreferrer">Announcemen... | 39,173 |
<p>I know I should use different nozzles for filaments that use vastly different temperatures but what about filament types that use similar temperatures?</p>
<p>For example, PLA and PLA composites like ColorFabb Woodfill filament. Should I use a separate nozzle for that?</p>
| <p>There is absolutely no reason to use different nozzles, <em>not even if filaments do require different temperatures</em>.</p>
<p>The only exception is when printing abrasive filaments (such as glow-in-the-dark and carbon-fiber) in which case you should use an abrasion-resistant, stainless steel nozzle. This nozzle ... | <p>It depends on the size of the nozzle you are using. If you are using a small nozzle, e.g. 0.2 mm, normally, you should increase the nozzle diameter (filament manufacturers often refer to about 0.5 mm nozzle diameters). Wood/cork, or whatever particle filled filament requires a somewhat larger diameter to p... | 390 |
<p>Simplified, I have an application where data is intended to flow over the internet between two servers. Ideally, I'd like to test at what point the software ceases to function. At what lowerbound limit (bandwidth, latency, dropped packets) do things stop working to test the reliability of the software.</p>
<p>What ... | <p><a href="http://wanem.sourceforge.net/" rel="noreferrer">WANem</a> does exactly this. We have used it both in a virtual machine on the desktop and on a dedicated old pc and it worked great. It can simulate all sorts of broken connectivity.</p>
| <p>There is a very good (and free) Microsoft solution for that, we use it for quite some time and it works great, it can very easily simulate every thing(packet loss, low bandwidth, disconnection, latency....)
This is the best solution i found for a windows environment </p>
<p>More information and a download link can ... | 22,005 |
<p>I am trying to convert an access datetime field to a mysdl format, using the following string:</p>
<pre><code>select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T');
</code></pre>
<p>While I do not get an error, I do not get the expected result, instead I get this:</p>
<pre><code>+------------------------------... | <p>Your syntax for the function is off.</p>
<p>Try:</p>
<pre><code>select str_to_date('04/03/1974 12:21:22', '%m/%d/%Y %T');
</code></pre>
<p>The second parameter is telling the function where the parts of the dates are located in your string.</p>
<p>For your access question:</p>
<pre><code>select str_to_date('06.... | <p>It's not clear to me which end of this you're using, the Access end or the MySQL end, though it looks like you are trying to solve it with MySQL's functions. If your problem is that you've exported CSV from Access/Jet and it's not in the expected format, then maybe you need to fix the CSV export from Access to use a... | 33,751 |
<p>We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So...</p>
<p>I want to have a property on my class that will return the database name (SQL Server, so DB_NAME()). How can I do... | <p>In the DBML XML file, you can set the Expression attribute of a Column element to this:</p>
<pre><code> <Column Name="Table1.DBName"
DbType="nvarahcar(128)"
Type="System.String"
Expression="DB_NAME()" />
</code></pre>
| <p>How are you iterating through the different databases? Could you just include information from the context in the query? For example:</p>
<pre><code>Dim results = _
From x In myContext.MyTables _
Select x, info = myContext.Connection.ConnectionString
</code></pre>
| 24,625 |
<p>Where I'm at there is a main system that runs on a big AIX mainframe. To facility reporting and operations there is nightly dump from the mainframe into SQL Server, such that each of our 50-ish clients is in their own database with identical schemas. This dump takes about 7 hours to finish each night, and there's ... | <p>I have worked with loading bulk sets of data in SQL Server quite a bit and did some performance testing on the Index on while inserting and the add it afterwards. I found that BY FAR it was much more efficient to create the index after all data was loaded. In our case it took 1 hour to load with the index added at... | <p>To the best of my knowledge, you are correct - it's much better to add the records all at once and then index once at the end.</p>
| 27,939 |
<p>It seems that the </p>
<ul>
<li><a href="https://msdn.microsoft.com/en-us/library/system.diagnostics.debug(v=vs.110).aspx" rel="noreferrer"><code>System.Diagnostics.Debug</code></a>, and </li>
<li><a href="https://msdn.microsoft.com/en-us/library/system.diagnostics.trace(v=vs.110).aspx" rel="noreferrer"><code>Syste... | <p>The main difference is the one you indicate: Debug is not included in release, while Trace is.</p>
<p>The intended difference, as I understand it, is that development teams might use Debug to emit rich, descriptive messages that might prove too detailed (or revealing) for the consumer(s) of a product, while Trace i... | <p>I'd look at using log4net for tracing as its capabilities are much more flexible and robust.</p>
<p>But for true debug messages that I never intend for anyone other than me or an internal tester to see, I'd probably stick with Debug.</p>
| 21,703 |
<p>Working on an app with notification via e-mail. I'd like to run test with out sending e-mails to production servers and clients. A couple years ago I remember someone bringing down our exchange server with a bad e-mail loop and would prefer to not repeat... </p>
<p>Any suggestion for a dev setup? Currently thin... | <p><a href="https://github.com/changemakerstudios/papercut" rel="nofollow noreferrer">Papercut</a> is the perfect fit for what you are looking for. It has been publicly available for the last couple of months. I have been using it for a month. It couldn't get any easier to test email functionality.</p>
<ol>
<li>Dow... | <p>Why not simply spit the email list out to a text file and disconnect any calls to the mail Server?</p>
| 46,621 |
<p>Following my question regarding a <a href="https://stackoverflow.com/questions/42071/net-yaml-library">.NET YAML Library</a>... as there doesn't seem to be great support for YAML in .NET, are there and good open source <em>really simple</em> .NET XML libraries. I just want something where I can pass it a section na... | <p>isn't the system.xml namespace suficient?</p>
<p>once i had to use it for the simple scenarios that you described and thought that it was a simple and efficient solutions.</p>
<p>take a look at this examples</p>
<p><a href="http://msdn.microsoft.com/en-us/library/443c16cf(VS.71).aspx" rel="nofollow noreferrer">Re... | <p>Can you use the 3.5 framework? Linq to XML is fantastic, and simple.</p>
| 6,350 |
<p>i have a web service hosted on another server with the Anonymous Access CheckBox in IIS is already checked. when my local web application is trying to access the web service, i still get the "The request failed with HTTP status 401: Access Denied." error. my web application is calling the web
service like the follo... | <p><a href="https://web.archive.org/web/20160216023758/http://blogs.msdn.com:80/b/david.wang/archive/2005/07/14/howto-diagnose-iis-401-access-denied.aspx" rel="nofollow noreferrer">Here</a> is a good reference on diagnosing 401 errors.</p>
<p>From that, one place to start is looking at the credentials you configure for... | <p>have you try un selecting the allow iis to control password some times that get out of sink. </p>
<p>try the site and it may work. you sould be able to reenable control after that </p>
| 29,955 |
<p>So I've designed a few components in Fusion 360, but I'm kinda new to CAD. I did the tutorials AutoDesk have on YouTube, modelled an Arduino enclosure, a shampoo bottle, a lamp shade, etc. but what I'm doing now isn't as straightforward...</p>
<p>Before I used to create solids, but what I'm doing right now is essen... | <p>Ok, let's go down the main two ways to a part, and in practice you usually use both to design for 3D printing. Only for machining, you try to keep to the cutting method only.</p>
<ul>
<li>Cutting Method</li>
<li>Building Method</li>
</ul>
<h1>Cutting Method</h1>
<p>You start with a piece of "stock". A cube... | <p>After @Trish posted their answer, I went back to my design, and used substractive design, because I watch a lot of machining videos, and instead of the "thicken" feature that kinda did what I wanted, I used the "shell" command that did exactly what I wanted, see below.</p>
<p><a href="https://i.s... | 1,793 |
<p>Given a specific <code>DateTime</code> value, how do I display relative time, like:</p>
<ul>
<li><code>2 hours ago</code></li>
<li><code>3 days ago</code></li>
<li><code>a month ago</code></li>
</ul>
| <p>Jeff, <a href="https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/12#12">your code</a> is nice but could be clearer with constants (as suggested in Code Complete).</p>
<pre class="lang-csharp prettyprint-override"><code>const int SECOND = 1;
const int MINUTE = 60 * SECOND;
const int HOUR = 60 *... | <p>My way is much more simpler. You can tweak with the return strings as you want</p>
<pre><code> public static string TimeLeft(DateTime utcDate)
{
TimeSpan timeLeft = DateTime.UtcNow - utcDate;
string timeLeftString = "";
if (timeLeft.Days > 0)
{
timeLeftString +=... | 2,233 |
<p>Where is a good place to start with making an application in .NET that communicates through <a href="http://www.opcfoundation.org/Default.aspx/01_about/01_whatis.asp" rel="nofollow noreferrer">OPC</a>?</p>
| <p>You can find a good article and a library to start with here: <a href="http://www.codeproject.com/KB/COM/opcdotnet.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/COM/opcdotnet.aspx</a></p>
| <p>If buying a comercial toolkit is an option I've used the Northern Dynamics <a href="http://www.nordyn.com/Main/Products/Main.htm" rel="nofollow noreferrer">server toolkit</a> and it worked fine. A toolkit will take away a lot of the issues mentioned in the other questions (or at least you should get support if there... | 9,233 |
<p>Why when I save a value of say 40.54 in SQL Server to a column of type Real does it return to me a value that is more like 40.53999878999 instead of 40.54? I've seen this a few times but have never figured out quite why it happens. Has anyone else experienced this issue and if so causes it?</p>
| <p>Have a look at <a href="http://docs.sun.com/source/806-3568/ncg_goldberg.html" rel="noreferrer">What Every Computer Scientist Should Know About Floating Point Arithmetic</a>.</p>
<p>Floating point numbers in computers don't represent decimal fractions exactly. Instead, they represent <em>binary</em> fractions. Most... | <p>To add a clarification, a floating point numbers stored in a computer behaves as described by other posts here, because as described, it is stored in binary format.
This means that unless it's value (both the mantissa and exponent components of the value) are powers of two, and cannot be represented exactly.</p>
<... | 34,437 |
<p>I'm doing research on some non-brittle release process techniques in a 24x7x365 web service environment. What are some of your favorite methods for releasing code from a development environment to a critical-production environment. This includes not only code changes -- but also database schema changes. Let's assume... | <p>There are a couple of principles that I think are important to ensure:</p>
<ol>
<li>Release only from source control system (either a dedicated branch or a tag on mainline). No possibility of releasing directly from working directory.</li>
<li>Make push-to-production and push-to-staging processes utterly automated ... | <p>Denis Hennessy wrote a fine summary. As for tools, have a look at <a href="http://www.capify.org/" rel="nofollow noreferrer">Capistrano</a>.</p>
| 46,177 |
<p>I'd like to create a script to manipulate Apache2 configuration directly, reading and writing its properties (like adding a new VirtualHost, changing settings of one that already exists).</p>
<p>Are there any libs out there, for Perl, Python or Java that automates that task?</p>
| <p>In Perl, you've got at least 2 modules for that:</p>
<p><a href="http://search.cpan.org/~nwiger/Apache-ConfigFile-1.18/ConfigFile.pm" rel="nofollow noreferrer">Apache::ConfigFile</a></p>
<p><a href="https://metacpan.org/pod/Apache::Admin::Config" rel="nofollow noreferrer">Apache::Admin::Config</a> </p>
| <p>Also see <a href="http://search.cpan.org/perldoc?Config::General" rel="nofollow noreferrer">Config::General</a>, which claims to be fully compatible with Apache configuration files. I use it to parse my Apache configuration files for automatic regression testing after configuration changes.</p>
| 26,492 |
<p>When you run something similar to:</p>
<pre><code>UPDATE table SET datetime = NOW();
</code></pre>
<p>on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be whe... | <p><a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now</a></p>
<blockquote>
<p>"NOW() returns a constant time that indicates the time at which the statement began to execute. (With... | <p>The sqlite answer is </p>
<pre><code>update TABLE set mydatetime = datetime('now');
</code></pre>
<p>in case someone else was looking for it.</p>
| 23,709 |
<p>I am pulling a long timestamp from a database, but want to present it as a Date using Tags only, no embedded java in the JSP.<br><br> I've created my own tag to do this because I was unable to get the parseDate and formatDate tags to work, but that's not to say they don't work.<br>
<br>
Any advice?</p>
<p>Thanks.</... | <p>You can avoid having to make any changes to your Servlet by creating a date object within the JSP using the <code>jsp:useBean</code> and <code>jsp:setProperty</code> tags to set the time of newly created date object to that of the time stamp. For example:</p>
<pre><code><%@ taglib uri="http://java.sun.com/jsp/js... | <p>The parseDate and formatDate tags work, but they work with Date objects.
You can call new java.util.Date(longvalue) to get a date object, then pass that to the standard tag.</p>
<p>somewhere other than the jsp create your date object.</p>
<pre><code>long longvalue = ...;//from database.
java.util.Date dateValue = ... | 10,112 |
<p>Could some one tell me how to capture SOAP messages passed between the client and the server webservice applications.</p>
<p>I tried using both tools.
pocket soap
<a href="http://www.pocketsoap.com/pocketsoap/" rel="nofollow noreferrer">http://www.pocketsoap.com/pocketsoap/</a></p>
<p>Fiddler
<a href="http://www.f... | <p>Try <a href="https://tcpmon.dev.java.net/" rel="nofollow noreferrer">tcpmon</a>.</p>
<p><a href="http://www.soapui.org/" rel="nofollow noreferrer">soapUI</a> integrates with tcpmon, and may provide a nicer interface for you.</p>
<p><a href="https://stackoverflow.com/questions/306214/http-request-monitoring-tool#30... | <p>There is also TCP/IP Monitor which comes bundled with WTP plugin for eclipse which allows you to set up a monitor on a port to look into the SOAP requests.</p>
| 39,774 |
<p>I am reading log files but not all lines want to be processed straight away. I am using a queue / buffer to store the lines while they wait to be processed.</p>
<p>This queue is regularly scanned for particular lines - when they are found, they are removed from the queue (they can be anywhere in it). When there isn... | <p>LinkedHashSet might be of interest. It is effectively a HashSet but it also maintains a LinkedList to allow a predictable iteration order - and therefore can also be used as a FIFO queue, with the nice added benefit that it can't contain duplicate entries.</p>
<p>Because it is a HashSet too, searches (as opposed to... | <p>Because you need to remove and add elements from the set, and search for specific values, maybe a better structure could be something that implements SortedSet, such as TreeSet. This class guarantees log(n) performance for add, remove and contains.</p>
| 36,435 |
<p>Assuming the file exists (using <code>os.path.exists(filename)</code> to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference.</p>
| <p><a href="http://docs.python.org/library/os.html#os.stat" rel="noreferrer">os.stat()</a></p>
<pre><code>import os
filename = "/etc/fstab"
statbuf = os.stat(filename)
print("Modification time: {}".format(statbuf.st_mtime))
</code></pre>
<p>Linux does not record the creation time of a file (<a href="https://unix.stac... | <p>New for python 3.4+ (see: <a href="https://docs.python.org/3/library/pathlib.html" rel="noreferrer">pathlib</a>)</p>
<pre><code>import pathlib
path = Path('some/path/to/file.ext')
last_modified = path.stat().st_mtime
</code></pre>
| 49,086 |
<p>Can anyone explain why following code won't compile? At least on g++ 4.2.4.</p>
<p>And more interesting, why it will compile when I cast MEMBER to int?</p>
<pre><code>#include <vector>
class Foo {
public:
static const int MEMBER = 1;
};
int main(){
vector<int> v;
v.push_back( Fo... | <p>You need to actually define the static member somewhere (after the class definition). Try this:</p>
<pre><code>class Foo { /* ... */ };
const int Foo::MEMBER;
int main() { /* ... */ }
</code></pre>
<p>That should get rid of the undefined reference.</p>
| <p>Regarding the second question: push_ref takes reference as a parameter, and you cannot have a reference to static const memeber of a class/struct. Once you call static_cast, a temporary variable is created. And a reference to this object can be passed, everything works just fine.</p>
<p>Or at least my colleague who... | 34,365 |
<p>When you use the PHP <a href="http://us2.php.net/manual/en/function.copy.php" rel="noreferrer">copy</a> function, the operation blindly copies over the destination file, even if it already exists. How do you copy a file safely, only performing the copy if there is no existing file?</p>
| <p>The obvious solution would be to call <a href="http://us2.php.net/manual/en/function.file-exists.php" rel="nofollow noreferrer">file_exists</a> to check to see if the file exists, but doing that could cause a race condition. There is always the possibility that the other file will be created in between when you cal... | <p>Try using the <a href="http://us.php.net/manual/en/function.link.php" rel="nofollow noreferrer"><code>link()</code></a> function instead of <code>copy()</code>.</p>
<pre><code>function safe_copy($src, $dest) {
if (link($src, $dest)) {
// Link succeeded, remove old name
unlink($filename);
... | 28,060 |
<p>What on earth is a caret in the context of a CSplitterWnd class? I can't find any documentation relating explicitly to CSplitterWnds...</p>
<p>EDIT: Specifically, what do these functions <em>actually</em> do:</p>
<pre><code>CWnd * pCurView = m_wndSplitter2.GetPane(2, 0);
pCurView->ShowCaret()
pCurView->HideC... | <p>Any CWnd can have a caret, but only CWnd inheritors that CreateCaret first actually display one. @DannySmurf gives you one example - CEditView - of a CView that creates a caret that you can show and hide.</p>
<p>Depending on the specific kind of CView you've got on your pane, ShowCaret is probably irrelevant. It ha... | <p>Perhaps they are referring to the cursor, the blinking vertical bar on the screen.</p>
| 25,662 |
<p>Reading on another forum I've came across the world of CSS Frameworks. The one I've been specifically looking at is <a href="http://www.blueprintcss.org/" rel="nofollow noreferrer">BluePrint</a>. I was wondering if anyone else had come across CSS frameworks, suggest which is the best and if they are worth the effort... | <p>CSS 'frameworks' are completely missing the point.</p>
<p>CSS is not like JavaScript, where you can include a base library/framework and then call functions and objects from it to do higher-level work. All a CSS framework can give you is declarative rules: some default browser-rule-reset stuff, some class styles to... | <p>check out <a href="http://www.ez-css.org/" rel="nofollow">http://www.ez-css.org/</a>. one of easiest and lightest css framework to work on. :)</p>
| 24,839 |
<p>You can use more than one css class in an HTML tag in current web browsers, e.g.:</p>
<pre><code><div class="style1 style2 style3">foo bar</div>
</code></pre>
<p>This hasn't always worked; with which versions did the major browsers begin correctly supporting this feature?</p>
| <p>@Wayne Kao - IE6 has no problem reading more than one class name on an element, and applying styles that belong to each class. What the article is referring to is creating new styles based on the combination of class names.</p>
<pre><code><div class="bold italic">content</div>
.bold {
font-weight: 80... | <p>Apparently IE 6 doesn't handle these correctly if you have CSS selectors that contain multiple class names:
<a href="http://www.ryanbrill.com/archives/multiple-classes-in-ie/" rel="nofollow noreferrer">http://www.ryanbrill.com/archives/multiple-classes-in-ie/</a></p>
| 8,614 |
<p>All too often I want a WPF slider that behaves like the System.Windows.Forms.TrackBar of old. That is, I want a slider that goes from X to Y but only allows the user to move it in discrete integer positions.</p>
<p>How does one do this in WPF since the Value property on the Slider is double?</p>
| <p>The simple answer is that you take advantage of the <strong>IsSnapToTickEnabled</strong> and <strong>TickFrequency</strong> properties. That is, turn snapping to ticks on and set the tick frequency to 1.</p>
<p>Or, in other words ... take advantage of ticks ... but you don't necessarily have to show the ticks that ... | <p>The snap trick is handy but has limitations, for instance if you want to only show a subset of valid ticks. I've had success with two alternatives: either bind to an integer or round the new value. Here is a combined example:</p>
<pre><code>public int MyProperty { get; set; }
private void slider1_ValueChanged(obje... | 20,846 |
<p>Any idea on how to check whether that list is a subset of another?</p>
<p>Specifically, I have</p>
<pre><code>List<double> t1 = new List<double> { 1, 3, 5 };
List<double> t2 = new List<double> { 1, 5 };
</code></pre>
<p>How to check that t2 is a subset of t1, using LINQ?</p>
| <pre><code>bool isSubset = !t2.Except(t1).Any();
</code></pre>
| <p>Try this</p>
<pre><code>static bool IsSubSet<A>(A[] set, A[] toCheck) {
return set.Length == (toCheck.Intersect(set)).Count();
}
</code></pre>
<p>The idea here is that Intersect will only return the values that are in both Arrays. At this point if the length of the resulting set is the same as the origina... | 43,157 |
<p>After noticing that my ender 3 couldn't print a 'perfect' circle I decided to use a <a href="https://www.thingiverse.com/thing:1278865" rel="nofollow noreferrer">calibration cube</a> to see if that could be the issue. These were my results:</p>
<p><a href="https://i.stack.imgur.com/OHJOF.jpg" rel="nofollow noreferre... | <p>Your top layer looks like you need to add additional top layers and there are signs of a slight bit of over-extrusion in that top layer (red). On the other hand, it looks like the top layer is not sliced nicely resulting in gaps and holes (yellow), which might be a fault of the test print.</p>
<p><a href="https://i.... | <p>First, check that the calibration part you have is actually a cube. Maybe you downloaded a trick 'calibration cube' model. Cura will show he overall dimensions of any model which it is slicing.</p>
<p>Ignore any print quality issues first off. A hollow calibration cube is mainly used to check the X/Y/Z motion and s... | 1,034 |
<p>I was working with the Action Delegates in C# in the hope of learning more about them and thinking where they might be useful.</p>
<p>Has anybody used the Action Delegate, and if so why? or could you give some examples where it might be useful?</p>
| <p>Here is a small example that shows the usefulness of the Action delegate</p>
<pre><code>using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
Action<String> print = new Action<String>(Program.Print);
List<String> names = new List<String&g... | <p>I used it as a callback in an event handler. When I raise the event, I pass in a method taking a string a parameter. This is what the raising of the event looks like:</p>
<pre><code>SpecialRequest(this,
new BalieEventArgs
{
Message = "A Message",
Action = UpdateMethod,
... | 48,488 |
<p>Should practical quantum computing become a reality, I am wondering if there are any public key cryptographic algorithms that are based on NP-complete problems, rather than integer factorization or discrete logarithms.</p>
<p>Edit:</p>
<p>Please check out the "Quantum computing in computational complexity theory" ... | <p>I am responding to this old thread because it is a very common and important question, and all of the answers here are inaccurate.</p>
<p>The short answer to the original question is an unequivocal "NO". There are no known encryption schemes (let alone public-key ones) that are based on an NP-complete problem (and... | <p>Since nobody really answered the question I have to give you the hint: "McEliece". Do some searches on it. Its a proven NP-Hard encryption algorithm. It needs O(n^2) encryption and decryption time. It has a public key of size O(n^2) too, which is bad. But there are improvements which lower all these bounds.</p>
| 40,083 |
<p>I have heard from people who have switched either way and who swear by the one or the other.</p>
<p>Being a huge Eclipse fan but having not had the time to try out IntelliJ, I am interested in hearing from IntelliJ users who are "ex-Eclipsians" some specific things that you can do with IntelliJ that you can not do ... | <h2>CTRL-click works anywhere</h2>
<p>CTRL-click that brings you to where clicked object is defined works everywhere - not only in Java classes and variables in Java code, but in Spring configuration (you can click on class name, or property, or bean name), in Hibernate (you can click on property name or class, or inc... | <p>Show Navigation Bar ALT-Home.</p>
| 29,669 |
<p>I asked this question before, <a href="https://stackoverflow.com/questions/264441/does-a-native-php-5-function-exist-that-does-the-following-in-1-line">Here</a> however I think I presented the problem poorly, and got quite a few replies that may have been useful to someone but did not address the actual question and... | <p><strong>No, there is no way to do that natively.</strong></p>
<p>You can, however:</p>
<p>1.- Store the unavoidable array instead of the string. Given PHP's limitation this is what makes most sense in my opinion.</p>
<p>Also, don't forget you can <a href="http://php.net/unset" rel="nofollow noreferrer">unset()</a... | <p>If it's memory concerns, there are other ways of going about this that don't split out into an array. But no, there is nothing builtin to handle this sort of situation.</p>
<p>As an alternative, you might try:</p>
<pre><code>$pos = 0;
$num = 0;
while(($pos = strpos($places, ',', $pos+1)) !== false) {$num++;}
$whic... | 33,555 |
<p>Using answers to <a href="https://stackoverflow.com/questions/57522/javascript-array-with-a-mix-of-literals-and-arrays">this question</a>, I have been able to populate a select box based on the selection of another select box. ( <a href="https://stackoverflow.com/questions/57522/javascript-array-with-a-mix-of-litera... | <p>I prefer data structure like this:</p>
<pre><code>var carMakers = [
{ name: 'Honda', models: [
{ name: 'Accord', features: ['2dr', '4dr'] },
{ name: 'CRV', features: ['2dr', 'Hatchback'] },
{ name: 'Pilot', features: ['base', 'superDuper'] }
]},
{ name: 'Toyota',... | <p>You should take a look <a href="http://www.texotela.co.uk/code/jquery/select/" rel="nofollow noreferrer">here</a> for select box manipulation.
For what you want, i think <a href="http://json.org/" rel="nofollow noreferrer">JSON</a> will do the right job for you.
Anyhow, if i were you, i will do this way:
When I cha... | 21,772 |
<p>I've got a DataTable containing a sitemap hierarchy with the following columns:</p>
<ul>
<li>ItemId</li>
<li>ParentId</li>
<li>Name</li>
<li>Url</li>
</ul>
<p>I need to generate a set of nested lists in HTML (left the anchor elements out for clarity):</p>
<pre><code><ul>
<li>Item 1</li>
<li&g... | <p>Here's some pseudocode. The idea is simple: Start with all the nodes unmarked, and mark your current node's parent, <em>its</em> parent, and so on till you reach the root. By doing this, you'll have marked exactly the nodes on the path from your current node to the root. Then you can simply print all the nodes in an... | <p>I made something similar, it might not be that efficient but its easy to debug.</p>
<ol>
<li>Find path to selected node.</li>
<li>Add rootnodes to list.</li>
<li>Find node in list which is in path.</li>
<li>Add all childern to this node.</li>
<li>Find next node in path.</li>
<li>Repeat 4-5 until at selected node, a... | 41,874 |
<p>For example, say one was to include a 'delete' keyword in C# 4. Would it be possible to guarantee that you'd never have wild pointers, but still be able to rely on the garbage collecter, due to the reference-based system?</p>
<p>The only way I could see it possibly happening is if instead of references to memory lo... | <p>With garbage collection, as long as you have a referenced reference to the object, it stays alive. With manual delete you can't guarantee that.</p>
<p>Example (pseudocode):</p>
<pre><code>obj1 = new instance;
obj2 = obj1;
//
delete obj2;
// obj1 now references the twilightzone.
</code></pre>
<p>Just to be shor... | <p>Chris Sells also discussed this on .NET Rocks. I think it was during his first appearance but the subject might have been revisited in later interviews.</p>
<p><a href="http://www.dotnetrocks.com/default.aspx?showNum=10" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=10</a></p>
| 29,243 |
<p>all files in ~/Cipher/nsdl/crypto can be found <a href="http://nsdeleon.wikispaces.com/file/detail/crypto.zip" rel="nofollow noreferrer">here</a>
java files compiled with gcj, see compile.sh</p>
<pre><code>nmint@nqmk-mint ~/Cipher/nsdl/crypto $ echo test | ./cryptTest encrypt deadbeefdeadbeefdeadbeefdeadbeef deadbe... | <p>The Cipher, <code>ecipher</code>, is not initialized, and it throws an <code>IllegalStateException</code> when you try to use it as if it were initialized in <code>ENCRYPT_MODE</code>.</p>
<p>Note your <code>catch</code> block in the constructor of <code>BlockCrypt</code>. It is catching an exception with no messag... | <p>Perhaps looking at <a href="http://fuseyism.com/classpath/doc/javax/crypto/Cipher-source.html" rel="nofollow noreferrer">the source for javax.crypto.Cipher</a> helps this make sense? I couldn't really figure it out, even finding the error message in the source. Good luck!</p>
| 41,332 |
<p>Is it is possible, with <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">Windows Forms</a> in .NET, to change the opacity of a form without it automatically changing the opacity of the controls within the form?</p>
<p>I have a form that is running maximized, that contains a flowlayoutp... | <p>Of course, this is possible in WPF by setting the background of the form to transparent (as opposed to setting opacity to 0, which basically sets transparency on both foreground and background).</p>
<p>If you really wanted to, I don't see why you couldn't embed a winforms component into a transparent wpf form, usin... | <p>Unfortunately, <code>Opacity</code> is a property of <code>Form</code>, not <code>Control</code>. The only way I can imagine this would be possible is if you custom drew the form yourself and used an alpha-component in the brush used to paint the form background. </p>
<p>Even then, I don't think it would work as th... | 21,565 |
<p>I'm looking for tools that implement the distributed agent/service model ... I guess we could also call this grid or cloud computing, but I'm not sure the term is exactly analagous. A distributed agent model would be one where developers build agents that are dispatched to a framework and the framework executes the... | <p>There's a project at Microsoft called Dryad. Here's a good podcast with more info:
<a href="http://www.dotnetrocks.com/default.aspx?showNum=378" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=378</a>
It uses LINQ and is supposed to be easy to use. Microsoft has it doing some production st... | <p>I've been looking into a similar thing for my own work. So far I've found Digipede, <a href="http://www.alchemi.net/" rel="nofollow noreferrer">Alchemi</a> and <a href="http://ngrid.sourceforge.net/" rel="nofollow noreferrer">NGrid</a>, but they all need a SQL database as a grid manager except for NGrid which isn't ... | 23,027 |
<p>I'm getting started on building a REST API for a project I'm working on, and it led me to do a little research as to the best way to build an API using RoR. I find out pretty quickly that by default, models are open to the world and can be called via URL by simply putting a ".xml" at the end of the URL and passing a... | <p>There are several schemes for authenticating API requests, and they're different than normal authentication provided by plugins like restful_authentication or acts_as_authenticated. Most importantly, clients will not be maintaining sessions, so there's no concept of a login.</p>
<p><strong>HTTP Authentication</str... | <p>Another approach that saves building a lot of the stuff yourself is to use something like <a href="http://www.3scale.net/" rel="nofollow">http://www.3scale.net/</a> which handles keys, tokens, quotas etc. for individual developers. It also does analytics and creates a developer portal. </p>
<p>There's a ruby/rails ... | 30,688 |
<p>I know VS2008 has the remove and sort function for cleaning up using directives, as does Resharper. Apart from your code being "clean" and removing the problem of referencing namespaces which might not exist in the future, what are the benefits of maintaining a "clean" list of using directives?</p>
<p>Less code?
Fa... | <p>For me it's basically all about less noise (plus making Resharper happy!).</p>
<p>I would believe any improvement in compilation time would be minimal.</p>
| <p>I can't speak to the benefits in compile time and performance, but there's a lower chance of namespace collisions if you have minimize your using declarations. This is especially important if you are using more than one third party library.</p>
| 29,117 |
<p>My computer has two external audiocards and one in the motherboard with windows vista. In Vista it sees two entities for the same soundcard, a digital- and a analog output. </p>
<p>When i try to play an videofile with digital audio, say an dvd, it chooses <em>'Default DirectSound'</em> whereas i want it to use '<em... | <p>Why would you want to tinker with "merit" of directshow filters? Won't that be a bit overkill. Digital audio or not in your video file, you can use any output device here. So you can even stick your 'Digital Output Auzentech' for all the audio on your system, not just for dvd.</p>
<p>If you just want to select 'Dig... | <p>Thanks for the reply faulty</p>
<p>Its kinda because i'm lazy. My audiocard is attached by an optical cable to hifi setup, and when i'm watching dvd, moviefiles with DTS og DD audio tracks i want it to autoswitch to digital source so i can enable SPDIF. Its because of the new protected media path and other stuff in... | 18,661 |
<p>Being a Windows developer I'm currently working on my own project using LAMP. I understand what I need to know of PHP and MySQL, but Linux looks huge and it's not clear where to start and what is enough given my goals.
And my goals are to grasp general concepts, being able to deploy the project to a hosting provider... | <p>80% of your problems will be permissions. Windows does them differently; if you login as root (or with root-like privs) you can bypass permissions. Apache can't and won't.</p>
<ul>
<li>Learn how to properly set ownership of files and directories. Any Unix book will cover this: be sure to actually understand it -... | <p>Scrounge up an old box on <a href="https://en.wikipedia.org/wiki/Craigslist" rel="nofollow noreferrer">Craigslist</a> and install <a href="https://en.wikipedia.org/wiki/Gentoo_Linux" rel="nofollow noreferrer">Gentoo Linux</a> on it. That...experience...should give you a lot of feel for Linux and how it thinks.</p>
<... | 37,831 |
<p>I want to capture the screen in my code to get an image - like using the 'print screen' button on the keyboard .</p>
<p>Does anyone have an idea how to do this? I have no starting point.</p>
| <p>If using the .NET 2.0 (or later) framework you can use the <a href="http://msdn.microsoft.com/en-us/library/cdcw1c3b.aspx" rel="noreferrer"><code>CopyFromScreen()</code></a> method detailed here:</p>
<p><a href="http://www.geekpedia.com/tutorial181_Capturing-screenshots-using-Csharp.html" rel="noreferrer">http://ww... | <pre><code>Bitmap memoryImage;
//Set full width, height for image
memoryImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
PixelFormat.Format32bppArgb);
Size s = new Size(memoryImage.Width, memoryImage.Height);
Graphics memoryGraphics ... | 47,383 |
<p>I know how I use these terms, but I'm wondering if there are accepted definitions for <strong>faking</strong>, <strong>mocking</strong>, and <strong>stubbing</strong> for unit tests? How do you define these for your tests? Describe situations where you might use each.</p>
<p>Here is how I use them:</p>
<p><stron... | <p>You can get some information :</p>
<h2>From <a href="http://www.martinfowler.com/articles/mocksArentStubs.html" rel="noreferrer">Martin Fowler about Mock and Stub</a></h2>
<p><strong>Fake</strong> objects actually have working implementations, but usually take some shortcut which makes them not suitable for producti... | <p>In <a href="https://rads.stackoverflow.com/amzn/click/com/0131495054" rel="nofollow noreferrer" rel="nofollow noreferrer">xUnit Test Patterns</a> book by Gerard Meszaros There is a nice table that gives a good insight about differences</p>
<p><a href="https://i.stack.imgur.com/B3h5G.png" rel="nofollow noreferrer"><i... | 45,072 |
<p>I am currently looking at a distributed cache solution. </p>
<p>If money was not an issue, which would you recommend?</p>
<ul>
<li><a href="http://www.scaleoutsoftware.com/" rel="nofollow noreferrer">www.scaleoutsoftware.com</a></li>
<li><a href="http://www.alachisoft.com/ncache/" rel="nofollow noreferrer">ncache<... | <p>Out of your selection I've only ever attempted to use memcached, and even then it wasn't the C#/.NET libraries.</p>
<p>However memcached technology is fairly well proven, just <a href="http://en.wikipedia.org/wiki/Memcached" rel="nofollow noreferrer">look at the sites that use it</a>:</p>
<blockquote>
<p>...The syst... | <p>You could also add <a href="http://www.oracle.com/technology/products/coherence/index.html" rel="nofollow noreferrer">Oracle Coherence</a> to your list. It has both .NET and Java APIs.</p>
| 19,473 |
<p>I've got a really large project I made for myself and rece3ntly a client asked for their own version of it with some modifications. The project name was rather silly and my client wants the source so I figured it'd be best if I renamed all my files from</p>
<pre><code>sillyname.h
sillyname.cpp
sillyname.dsp
</cod... | <p>Here is a <a href="http://www.platinumbay.com/blogs/dotneticated/archive/2008/01/01/renaming-and-copying-projects-and-solutions.aspx" rel="nofollow noreferrer">Step by Step</a> on Steve Andrews' blog (he works on Visual Studio at Microsoft)</p>
| <p>You can simply rename the .vcproj or .dsp file and then either create a new workspace (sln dsw) and include the renamed project or simply chnage the name inside the sln file (it's just xml) I can't remember the format of the old workspace but it's still text.</p>
<p>You can either manually rename and reinclude all ... | 17,140 |
<p>Is there a way in Python, to have more than one constructor or more than one method with the <em>same name</em>, who differ in the <em>number of arguments</em> they accept or the <em>type(s) of one or more argument(s)</em>?</p>
<p>If not, what would be the best way to handle such situations?</p>
<p>For an example ... | <p>You can have the factory methods, it is fine. But why not just call it as it is?</p>
<pre><code>Color(r, g, b)
Color(*[r, g, b])
Color(**{'r': r, 'g': g, 'b': b})
</code></pre>
<p>This is the python way. As for the from object constructor, I would prefer something like:</p>
<pre><code>Color(*Color2.as_list())
</c... | <p>You can check the type of the argument passed to your constructor inside:</p>
<pre><code>def __init__(self, r = 0, g = 0, b = 0):
# if r is a list
if (type(r) == type([1,2,3])):
r, g, b = r[0], r[1], r[2]
# if r is a color
if (type(r) == type(self)):
r, g, b = r.r, r.g, r.b
self.... | 46,513 |
<p>I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file with the following command:</p>
<p><... | <p><a href="http://en.wikipedia.org/wiki/Ffmpeg" rel="noreferrer">FFmpeg</a> provides AAC encoding facilities if you've compiled them in. If you are using Windows you can grab full binaries from <a href="http://arrozcru.no-ip.org/ffmpeg_builds/" rel="noreferrer">here</a></p>
<pre><code>ffmpeg -i source.mp3 -acodec lib... | <p>I've had good luck using mplayer (which I believe uses ffmpeg...) and lame. To the point that I've wrapped it up in a script:</p>
<pre><code>#!/bin/sh
TARGET=$1
BASE=`basename "${TARGET}"`
echo TARGET: "${TARGET}"
echo BASE: "${BASE}" .m4a
# Warning! Race condition vulnerability here! Should use a mktemp
# var... | 9,549 |
<p>I need to to print natural nos. 1,2,...n such that the parent process prints all odd numbers and the child process prints all even numbers, and all of this needs to be done using POSIX signals. How would I go about accomplishing this?</p>
<p>The output should be:</p>
<p>Parent : 1<br>
Child : 2<br>
Parent : 3<br>... | <p>I think this homework assignment was given to you to make you try a lot of solution and conclude by yourself that <strong>signals are not a good synchronisation technique</strong>.</p>
<p>This an invaluable lesson, remember it well and use semaphores from now on! :)</p>
| <p>I think this homework assignment was given to you to make you try a lot of solution and conclude by yourself that <strong>signals are not a good synchronisation technique</strong>.</p>
<p>This an invaluable lesson, remember it well and use semaphores from now on! :)</p>
| 5,587 |
<p>I have a multi-table query, similar to this (simplified version)</p>
<pre><code>SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating
FROM table1
LEFT JOIN table2
ON table1.dom_id = table2.rev_domain_from
WHERE dom_lastreview != 0 AND rev_status = 1
GROUP BY dom_url
ORDER B... | <p>You're not able to do calculations with aliases. One way of doing this would be to simply create another alias and order by that.</p>
<pre><code>SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating, sum(table2.rev_rating)/count(table2.rev_id) as avg_rev_rating
FROM table1
LEF... | <p>my mysql is rusty; you might try</p>
<pre><code>SELECT columns, count(table2.rev_id) As rev_count,
sum(table2.rev_rating) As sum_rev_rating,
sum(table2.rev_rating)/count(table2.rev_id) as rev_ratio
FROM table1
LEFT JOIN table2ON table1.dom_id = table2.rev_domain_from
WHERE dom_lastreview != 0
AND rev... | 23,086 |
<p>I am using the Zend Framework.</p>
<p>I have a controller named 'UserController' that has a public function displayAction().</p>
<p>I would like to know how I can get that action method to use a different viewer than the default display.phtml.</p>
<p>Any help is appreciated.</p>
| <p>You can use </p>
<pre><code>$this->render('actionName');
</code></pre>
<p>or, alternatively, you can call a view script directly by calling</p>
<pre><code>$this->renderScript('path/to/viewscript.phtml');
</code></pre>
<p>For more information, you can take a look at <a href="http://framework.zend.com/manual... | <p>Lately, I've been getting errors with the method described above (using ZF 1.11.11). I've had success with this:</p>
<pre><code>$this->_helper->viewRenderer('action');
</code></pre>
| 35,983 |
<p>I have a php web application that is occasionally hanging. When I navigate to the page it will just sit there trying to load for hours, even though max execution is 210. This is an application uses curl behind a proxy to download stuff. Error reporting is set to all, but that dosn't matter since the page is blank ... | <p>Last i checked, HTTP/IO operations happen outside php time, so its possible the CURL is dying or timing out.</p>
<p>Its IO, so php just throws out to some system library and then calls "select" to wait for it to come back.</p>
<p>If it doesn't come back.. php code won't even be looping and thus wont even know its... | <p><a href="http://xdebug.org" rel="nofollow noreferrer">Xdebug</a> is a great idea, and if it doesn't help, I'd also recommend running your webserver through ktrace, strace or truss. It shows you exactly what it does and where it could be hanging.</p>
<p>It sounds like there is a temporary connectivity issue, or some... | 33,095 |
<p>Should you ever use protected member variables? What are the the advantages and what issues can this cause?</p>
| <blockquote>
<p>Should you ever use protected member variables? </p>
</blockquote>
<p>Depends on how picky you are about hiding state. </p>
<ul>
<li>If you don't want any leaking of internal state, then declaring all your member variables private is the way to go. </li>
<li>If you don't really care that subclasses ... | <p>For detailed info on .Net access modifiers <a href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1027680.html" rel="nofollow noreferrer">go here</a></p>
<p>There are no real advantages or disadvantages to protected member variables, it's a question of what you need in your sp... | 5,763 |
<p>I have an ADO.Net login form as my frontend, and I want to check if the username and password input from the user matches the correct values in the database. How can I accomplish this as easily as possible?</p>
<p>By the way, my user information table in the database is called Login.</p>
| <ol>
<li>Do not store plain text password in the database. <strong>Never.</strong></li>
<li>The ASP.NET Login form has an OnLogin or something similar event. You need to attach a method to it.</li>
<li>Query the database for the credentials of the user that tried to log in. That is:</li>
</ol>
<p>SELECT * FROM LOGIN W... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx" rel="nofollow noreferrer">Membership provider</a> instead. Than use the login control.</p>
<p>Bruno Figueiredo</p>
| 35,537 |
<p>Alright, I am going to state up front that this question may be too involved (amount of detail not complexity) for this medium. But I figured this was the best place to start.</p>
<p>I am attempting to setup a proof of concept project and my BIND configuration is my first big hurdle. I want to setup 3 DNS servers... | <p>By using @, you're defining itchy.bogus. You can't then redefine it further down in the zone with the itchy.bogus line.</p>
<p>Try this:</p>
<pre><code>@ SOA ns1.itchy.bogus. hostmaster.itchy.bogus. (
2008102201 ; serial
1H ; refresh
... | <p>Assuming that you've checked all of the obvious things - such as ensuring that the main bind configuration file is what you think it is. Firstly check that the that you think named is using are the right ones - sometimes it's easy to edit a file that's in the wrong directory and wonder why changes aren't noticed.</p... | 27,624 |
<p>I created an Interop user control in VS2005. When the user control is shown inside VB6, it does not pickup/use the XP styles (The buttons and the tabs look like VB6 buttons/tabs). </p>
<p>How do I get the XP styles to work with my control while it is in VB6?</p>
| <p>See <em><a href="http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/" rel="noreferrer">Windows Batch File (.bat) to get current date in MMDDYYYY format</a></em>:</p>
<pre><code>@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f... | <p>Given a known locality, for reference in functional form. The <code>ECHOTIMESTAMP</code> call shows how to get the timestamp into a variable (<code>DTS</code> in this example.)</p>
<pre><code>@ECHO off
CALL :ECHOTIMESTAMP
GOTO END
:TIMESTAMP
SETLOCAL EnableDelayedExpansion
SET DATESTAMP=!DATE:~10,4!-!DATE:~4... | 24,843 |
<p>Is there a way to trigger a garbage collection in a .NET process from another process or from inside WinDBG?</p>
<p>There are the Managed Debugging Assistants that force a collection as you move across a native/managed boundary, and <a href="http://en.wikipedia.org/wiki/AQtime" rel="noreferrer">AQTime</a> seems to ... | <p>Answered in <a href="https://stackoverflow.com/a/26033289/249742">another question</a> :</p>
<p>Basically, use <a href="https://github.com/Microsoft/perfview/blob/master/documentation/Downloading.md" rel="noreferrer">PerfView</a>:</p>
<pre><code>PerfView.exe ForceGC [ProcessName | Process ID] /AcceptEULA
</code></... | <p>If you expose a function/object via remoting, that could be done quite easily.</p>
| 12,661 |
<p>Simple question, spurred on by the removal of the target attribute in HTML 4.0 Strict and XHTML 1.0 Strict.</p>
| <p>I personally don't think so, as web users become more savvy, they'll ask for a new window from the browser. It annoys me when a website does this a lot.</p>
<p>I think the question is sort of subjective. It could be good if you're launching a javascript game or something.</p>
<p>Here's <a href="http://www.sitepo... | <p>Yes, in web apps it sometimes makes sense to use a popup window when pulling up something ancillary that you need to look at without losing the content on the page. </p>
<p>For instance, I have used popups to display reports. In those cases <em>(which are situational)</em>, users needed to look at the report and th... | 43,005 |
<p>I have a three-tier application which is installed in corporate environments. With every server version update, all clients have to be updated, too. Currently, I provide an MSI package which is automatically deployed via Active Directory, however my customers (mostly with 20-300 users each) seem to hate the MSI solu... | <p>You can somewhat replicate what ClickOnce does, just adjust it for your needs.</p>
<ol>
<li>Create a lightweight executable that checks a network/web location for updates. </li>
<li>If there are updates, it copies them locally and replaces the "real" application files.</li>
<li>It runs the "real" application.</li>
... | <p>If you don't want to give your users too many rights, it is possible to write a Windows Service, which will run on each computer under an account with the appropriate privileges, and which can update your application, when a new version gets available.</p>
| 9,167 |
<p>Right now I'm working with an ASP.NET website that automatically generates images and stores them in a temporary folder. When working on my local system these go going into a temporary folder that gets picked up by Visual Source Safe which then wants to check them in. As such, I am wondering if there is a way to jus... | <p>I think you've found one of the main reasons MS went back to projects in VS2008 and in MVC.</p>
<p>It's been a long time since I've used VSS (mainly because it's really out of date now), but most source providers let you exclude files and folders as a setting of the provider, rather than the project under control.<... | <p>I'm not sure if this is an option for you, but if you exclude your temporary folder from VSS (delete the folder inside VSS using the VSS UI), the files that go into it should not get "picked up" again.</p>
| 6,310 |
<p>As per <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/File-Names.html" rel="noreferrer">the Emacs docs</a>, every time you open a file, Emacs changes <code>default-directory</code> to the directory containing that file. </p>
<p>Then, if the cursor is in that buffer and you (for example) start SL... | <p>You could try using something like this:</p>
<pre><code>(add-hook 'find-file-hook
(lambda ()
(setq default-directory command-line-default-directory)))
</code></pre>
| <p>Another variant is to bind <em>default-directory</em> to the necessary directory in directory-local variables, e.g. in the .dir-locals.el file in one of your parent directories to something like:</p>
<pre><code>((nil . ((default-directory . "~/.emacs.d/"))))
</code></pre>
| 46,184 |
<p>What is the safe width in pixels to print a web page? </p>
<p>My page includes large images and I want to make sure they will not be cut of when printed.</p>
<p>I know about different browser margins and US Letter / DIN A4 paper sizes. So we got standard letter sized and some default DPI values. But can I convert ... | <p>As for a true “universal answer”, I can’t provide one. I can, however, provide a simple and definitive answer for some particulars...</p>
<blockquote>
<blockquote>
<p>670 PIXELS </p>
</blockquote>
</blockquote>
<p>At least this seems to be a safe answer for Microsoft products. I read many suggestions, i... | <p>I doubt there is one... It depends on browser, on printer (physical max dpi) and its driver, on paper size as you point out (and I might want to print on B5 paper too...), on settings (landscape or portrait?), plus you often can change the scale (percentage), etc.<br>
Let the users tweak their settings...</p>
| 41,440 |
<p>I have a VB6 program that someone recently helped me convert to VB.NET</p>
<p>In the program, when saving files, I stamp them with the date which I was getting by calling the Today() function. </p>
<p>When I try to run the new VB.NET code in Vista it throws a permission exception for the Today() . If I run Visual ... | <p>Use <code>DateTime.Now</code> or <code>DateTime.Today</code>. These are entirely managed and shouldn't throw security exceptions.</p>
<p>The old VB6 functions, such as <code>Len()</code>, <code>Left()</code>, <code>Right()</code>, <code>OpenFile()</code>, <code>FreeFile()</code> are all present in the .NET Framewo... | <p>When I try the following statement:</p>
<pre><code>Dim result As String = Today()
</code></pre>
<p>It gives me today's date, as I'd expect, and I'm running VB2005 on Vista. Can you modify the question with the version of VB you're using? Also, can you try the following statement instead of <code>Today()</code> to ... | 9,003 |
<p>What is the best way to stop a user from resizing the top-level window of an application written in WPF?</p>
| <p>You will want to use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.resizemode.aspx" rel="noreferrer"><code>ResizeMode.NoResize</code></a> on the window.</p>
<pre><code><Window x:Class="WpfApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x... | <p>A WPF quirk to note is that if <code>ResizeMode="NoResize"</code> and <code>WindowStyle="None"</code> you will lose the chrome around the <em>entirely</em> in Vista Aero.</p>
| 35,142 |
<p>I'm curious what tools people have found useful for building flowcharts. Obviously MS Visio and OmniGraffle come to mind but they both feel so bloated and also tend to emphasize the document formatting/printing side and less on helping to organize the actual logic. Is there anything else out there that fellow develo... | <p>Though you list it as bloated I nonetheless use <A HREF="http://www.omnigroup.com/applications/omnigraffle/" rel="nofollow noreferrer">OmniGraffle</A>.</p>
<p>For quick flowcharting a series of boxes with lines to magnets in the boxes is sufficient, but the rest of the formatting options are good to have later. I f... | <p>I don't do a lot of complex flowcharts but I when I am flowcharting or putting together a data flow I tend to use Powerpoint. It is simple enough and I know it well enough.</p>
| 20,671 |
<p>I have <a href="https://ultimaker.com/en/products/ultimaker-2-plus" rel="noreferrer" title="Ultimaker 2+">Ultimaker 2+ 3D Printer</a> and I need to print a piece that doesn't fit within the build volume of the printer. Even though it would fit I'd still need to print it in two parts because I'll need to fit some equ... | <p>If the equipment has to be removable, then there's no point in trying to make a one-piece object in the first place. So it looks like you have two problems. The first is to decide what's the best way to split your container to facilitate both putting the equipment inside & removing it; the second is how to latc... | <p>Thanks for your reply all. I think I have a solution for my need. Here are some figures!</p>
<p><a href="https://i.stack.imgur.com/BfZmN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfZmN.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/BfyZt.png" rel="no... | 526 |
<p>Could Silverlight be used for the same things as jQuery, or are they intended for different things?</p>
<p>For example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net and C#, or more like C# and JavaScript?</p>
| <p>Silverlight can be used to create rich interactive media, and is more akin to Flash than anything else. jQuery is a javascript library.</p>
| <p>You can use them for the same tasks. You could make interactive web applications in jQuery or flash. There are advantages to each, it depends on if you <em>need</em> flash/silverlight or not. If you can achieve your goal without resorting to flash then you should use just JS. Some people might see it the other way a... | 17,766 |
<p>What is the syntax for placing constraints on multiple types? The basic example:</p>
<pre><code>class Animal<SpeciesType> where SpeciesType : Species
</code></pre>
<p>I would like to place constraints on both types in the following definition such that <code>SpeciesType</code> must inherit from <code>Specie... | <pre><code>public class Animal<SpeciesType,OrderType>
where SpeciesType : Species
where OrderType : Order
{
}
</code></pre>
| <p>You should be able to go :</p>
<pre><code>class Animal<SpeciesType, OrderType>
where SpeciesType : Species
where OrderType : Order {
}
</code></pre>
| 6,849 |
<p>Is there an easy way to cache things when using urllib2 that I am over-looking, or do I have to roll my own?</p>
| <p>You could use a decorator function such as:</p>
<pre><code>class cache(object):
def __init__(self, fun):
self.fun = fun
self.cache = {}
def __call__(self, *args, **kwargs):
key = str(args) + str(kwargs)
try:
return self.cache[key]
except KeyError:
... | <p>@dbr: you may need to add also https responses caching with :</p>
<pre><code>def https_response(self, request, response):
return self.http_response(request,response)
</code></pre>
| 17,933 |
<p>I'm trying to figure out what a Java applet's class file is doing under the hood. Opening it up with Notepad or Textpad just shows a bunch of gobbledy-gook.</p>
<p>Is there any way to wrangle it back into a somewhat-readable format so I can try to figure out what it's doing?</p>
<ul>
<li>Environment == Windows w/ ... | <p><a href="http://jd.benow.ca/" rel="noreferrer">jd-gui</a> is the best decompiler at the moment. it can handle newer features in Java, as compared to the getting-dusty JAD.</p>
| <p>As suggested you can use JAD to decompile it and view the files. To make it easier to read you can use the JADclipse plugin for eclipse to integrate JAD directly to eclipse or use DJ Java Decompiler which is much easier to use than command line JAD</p>
| 10,191 |
<p>I have a Prusa i3 that I am mostly happy with. However, I am seeing these strange artifacts when the extruder moves along one axis in one direction - in particular from the back of the printer towards the front. The extruded lines look uneven and the surface is quite rough, but only in that area and only while the e... | <p>In case of such difference in printing in different directions you can check if;</p>
<ol>
<li>for x and partially z axis
<ul>
<li>filament is blocked and cannot be pulled as it should</li>
<li>spool is blocked</li>
</ul></li>
<li>for x and y axis
<ul>
<li>rods on which caret/HB is sliding are parallel</li>
<li>ti... | <p>In my case, there were some artifacts only on the right side, and the problem was that the screw was partly out of the pulley under the bed. I would suggest moving the bed to the back and checking the pulley. You might also consider <a href="https://help.prusa3d.com/en/guide/maintenance-tips_23200" rel="nofollow nor... | 283 |
<p>I am using a wxGenericDirCtrl, and I would like to know if there is a way to hide directories, I'd especially like to hide siblings of parent nodes.</p>
<p>For example if my directory structure looks like this:</p>
<pre><code>+-a
|
+-b
| |
| +-whatever
|
+-c
| |
| +-d
| |
| +-e
| |
| ... | <p>Listing/walking directories in Python is very easy, so I would recommend trying to "roll your own" using one of the simple tree controls (such as TreeCtrl or CustomTreeCtrl). It should really be quite easy to call the directory listing code when some directory is expanded and return the result.</p>
| <p>I don't think that's possible.</p>
<p>It would be relatively easy to add this functionality to the underlying C++ wxWidgets control, but since you're using wxPython, you'd then have to rebuild that as well which is a tremendous issue.</p>
| 7,619 |
<p>For the most part, you just take whatever Visual Studio sets it for you as a default... I'm referring to the <a href="https://learn.microsoft.com/en-us/visualstudio/ide/build-actions?view=vs-2019" rel="noreferrer">BuildAction</a> property for each file selected in Solution Explorer. There are a number of options and... | <ul>
<li><p><strong>None</strong>: The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file.</p></li>
<li><p><strong>Compile</strong>: The file is compiled into the build output. This setting is used for c... | <p>How about <a href="http://connect.microsoft.com/VisualStudio/feedback/details/536461/designdatawithdesigntimecreatabletypes" rel="nofollow">this page</a> from Microsoft Connect (explaining the DesignData and DesignDataWithDesignTimeCreatableTypes) types. Quoting:</p>
<p><em>The following describes the two Build Act... | 17,567 |
<p>I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item. </p>
| <p>SourceControl property on the ContextMenuStrip class will show the last control that caused that menu strip to be shown.</p>
| <p>The event handler for the MenuItem's Click event will have a Sender parameter. This object should be the control that had the focus when the context menu was displayed.</p>
| 30,244 |
<p>I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache.
I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated.</p>
<p>Thanks</p>
| <p><a href="http://www.junlu.com/msg/179368.html" rel="nofollow noreferrer">This page</a> seems to imply that the correct configuration element is:</p>
<pre><code><attribute name="MaxCapacity">20000</attribute></code></pre>
<p>However, I've only ever used EHCache myself.</p>
| <p>In the version I am working on (JBossCache 1.4.1), it looks like it is not possible to configure this parameter.</p>
| 8,386 |
<p>With C#, How do I play (Pause, Forward...) a sound file (mp3, ogg)? The file could be on the hard disk, or on the internet.</p>
<p>Is there any library or Class out there that can ease me the work ?</p>
| <p>If you don't mind including <strong>Microsoft.VisualBasic.dll</strong> in your project, you can do it this way:</p>
<pre><code>var audio = new Microsoft.VisualBasic.Devices.Audio();
audio.Play("some file path");
</code></pre>
<p>If you want to do more complex stuff, the easiest way I know of is to use the <strong>... | <p>use <a href="http://www.codeproject.com/KB/audio-video/PlaySounds1.aspx" rel="nofollow noreferrer">PlaySound API call</a></p>
| 15,757 |
<p>How can I find out, which keyboard layout the user of my ruby application is using?
My aim is to have a game, where you can move the player on a map. To go one step down and one step left you press "Y" on a german keyboard. On an American keyboard, you would press "Z". We optimized the game for windows and mac, so I... | <p>For Windows, you probably have to use the <a href="http://msdn.microsoft.com/en-us/library/ms646296(VS.85).aspx" rel="nofollow noreferrer">Windows API GetKeyboardLayout()</a>, unless Ruby provides a wrapper for that.</p>
<p>There are a lot of <a href="http://www.microsoft.com/globaldev/DrIntl/columns/default.mspx" ... | <p>I think it'll be much easier and naturally to allow users to define keys themselves.</p>
| 25,223 |
<p>Can anybody recommend a good code profiler for C++?</p>
<p>I came across Shiny - any good? <a href="http://sourceforge.net/projects/shinyprofiler/" rel="noreferrer">http://sourceforge.net/projects/shinyprofiler/</a></p>
| <p><a href="http://valgrind.org/info/tools.html" rel="noreferrer">Callgrind</a> for Unix/Linux</p>
<p><a href="http://www.compuware.com/products/devpartner/default.htm" rel="noreferrer">DevPartner</a> for Windows</p>
| <p>If you have access to a Mac, then I recommend using <a href="http://developer.apple.com/tools/sharkoptimize.html" rel="nofollow noreferrer">Shark</a> from the CHUD tools. </p>
| 29,671 |
<p>I have a PS/2 touchpad which I would like to write a driver for (I'm just a web guy so this is unfamiliar territory to me). The touchpad comes with a Windows XP driver, which apparently sends messages to enable/disable tap-to-click. I'm trying to find out what message it is sending but I'm not sure how to start. Wou... | <p>IDA Pro won't be much use to you if you want to find out what 'messages' are being sent. You should realise that this is a very big step up for most web developers, but you already knew that?</p>
<p>I would start by deciding if you really need to work at the driver-level, often this is the Kernel level. The user mo... | <p>Have a look at <a href="http://www.hex-rays.com/idapro/" rel="nofollow noreferrer">IDA Pro</a> - The Interactive Disassembler. It is an amazing disassembler.</p>
<p>If you want to debug, not just reverse engineer, try PEBrowse Professional Interactive from <a href="http://www.smidgeonsoft.prohosting.com/pebrowse-pr... | 7,383 |
<p>What is the recommended practice? Should I add the my sub-folder under the fitnesse folder to version control? </p>
<p><em>Context: working on a single developer rails pet project. I've my rails project under version-control (Subversion) however my fitnesse wiki pages lie under the fitnesse program folder.</em><... | <p>Use the <code>-d</code> switch (<em>which is surprisingly low profile on a google search</em>)</p>
<pre><code>Fitnesse20081201>run -p 8080 -d c:/projects/MyProjectNeedsAcceptanceTests
</code></pre>
<p>This will create a subfolder in the specified folder called FitnesseRoot if it doesn't already exist, with all ... | <p>FitNesse stores old revisions of every page in a zip file in the same directory as the page's files. The zip filename marks the timestamp of the revision. It works similar to wikipedia - history, but not full-fledged version control.</p>
<p>In our company we wanted a setup where whenever we checkout a (possibly old... | 31,033 |
<p>How do I get a list of the active IP-addresses, MAC-addresses and <a href="http://en.wikipedia.org/wiki/NetBIOS" rel="nofollow noreferrer">NetBIOS</a> names on the LAN?</p>
<p>I'd like to get NetBIOS name, IP and <a href="http://en.wikipedia.org/wiki/MAC_address" rel="nofollow noreferrer">MAC addresses</a> for ever... | <p>As Daren Thomas said, use nmap.</p>
<pre><code> nmap -sP 192.168.1.1/24
</code></pre>
<p>to scan the network 192.168.1.*</p>
<pre><code> nmap -O 192.168.1.1/24
</code></pre>
<p>to get the operating system of the user. For more information, read the manpage</p>
<pre><code> man nmap
</code></pre>
<p>regards</p>
| <p>In PowerShell you can do something like:</p>
<p>$computers = "server1","server2","server3"</p>
<p>Get-WmiObject Win32_NetworkAdapterConfiguration -computer $computers -filter "IPEnabled ='true'" | select __Server,IPAddress,MACAddress</p>
| 11,608 |
<p>Using C++ (and Qt), I need to process a big amount of 3D coordinates.</p>
<p>Specifically, when I receive a 3D coordinate (made of 3 doubles), I need to check in a list if this coordinate has already been processed.
If not, then I process it and add it to the list (or container).</p>
<p>The amount of coordinates c... | <p>Probably the simplest way to speed up such processing is to store the already-processed points in <a href="http://en.wikipedia.org/wiki/Octree" rel="noreferrer">Octree</a>. Checking for duplication will become close to logarithmic.</p>
<p>Also, make sure you tolerate round-off errors by checking the distance betwee... | <p>Pick a constant to scale the coordinates by so that 1 unit describes an acceptably small box and yet the integer part of the largest component by magnitude will fit into a 32-bit integer; convert the X, Y and Z components of the result to integers and hash them together. Use that as a hash function for a map or hash... | 9,773 |
<p>I'm trying to write a <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> macro for a group tha</p>
<ul>
<li>has one workbook where they daily create new worksheets, and also have</li>
<li><em>Sheet 1</em>, <em>Sheet 2</em> and <em>Sheet 3</em> at the end o... | <p>This function works through the sheets from right to left until it finds a non-blank sheet, and returns its name</p>
<pre><code>Function GetLastNonEmptySheetName() As String
Dim i As Long
For i = Worksheets.Count To 1 Step -1
If Sheets(i).UsedRange.Cells.Count > 1 Then
GetLastNonEmptySheetName = Sheets(i).... | <p>The method above will ignore a sheet with a single cell entry, while that may seem to be a quibble, a <code>Find</code> looking for a non-blank cell will give more certainty.</p>
<p>The <code>xlFormulas</code> argument in the <code>Find</code> method will find hidden cells (but not filtered cells) whereas <code>xlV... | 35,527 |
<p>Does anyone know of a good .NET library rules library (ideally open-source)? I need something that can do nested logic expressions, e.g., (A AND B) AND (B OR C OR D). I need to do comparisons of object properties, e.g., A.P1 AND B.P1. (Ideally, I could compare any property -- A.P1 AND B.P2). </p>
<p>It should s... | <p>Agreeing with will I would say use something from the workflow engine family although not workflow.
Examine <a href="http://msdn.microsoft.com/en-us/library/system.workflow.activities.rules.aspx" rel="noreferrer">System.Workflow.Activities.Rules</a> Namespace a little bit - it's supported in .Net 3, and built into .... | <p>Depending on what you are trying to do using Lambda expressions (and expression trees) can work for this concept. Essentially, you provide an expression as a string that is then compiled on the fly into a lambda expression/expression tree, which you can then execute (evaluate). It's not simple to understand at first... | 25,599 |
<p>I'm having a little bit of trouble understanding what the problem is here. I have a bit of code that pulls records from a database using LINQ and puts them into an object which is cast into an interface. It looks a bit like this:</p>
<pre><code>public IEnumerable<ISomeObject> query()
{
return from a in ... | <p>I believe it is an issue of covariance or contravariance as noted by <a href="http://www.manning-sandbox.com/message.jspa?messageID=77137#77137" rel="noreferrer">this forum post</a>.</p>
<p>See <a href="http://blogs.msdn.com/ericlippert/archive/2007/10/17/covariance-and-contravariance-in-c-part-two-array-covariance... | <p>I guess, Linq to Sql may not support casting when translate to sql statement.</p>
| 49,636 |
<p>For instance, winsock libs works great across all versions of the visual studio. But I am having real trouble to provide a consistent binary across all the versions. The dll compiled with VS 2005 won't work when linked to an application written in 2008. I upgraded both 2k5 and 2k8 to SP1, but the results haven't cha... | <p>First, dont pass anything other than plain old data accross DLL boundries. i.e. structs are fine. classes are not.
Second, make sure that ownership is not transferred - i.e. any structs passed accross the dll boundry are never deallocated outside the dll. So, if you dll exports a X* GetX() function, there is a corre... | <p>regarding the problem of passing a structure, this thing is safe as long as you align your structure such as:</p>
<pre>
<code>
#pragma pack(push,4)
typedef myStruct {
int a;
char b;
float c;
}myStruct;
#pragma pack(pop)
</code>
</pre>
<p>You can put this declaration in a header file and include it in both pr... | 28,825 |
<p>I'm trying to get some stats on how many of the visitors to our website have Silverlight enabled browsers. </p>
<p>We currently use Google Analytics for the rest of our stats so ideally we'd like to just add 'Silverlight enabled' tracking in with the rest of our Google Analytics stats. But if it has to get writte... | <p>In case you missed it, there's a link to a more detailed article as well in the comments: <a href="http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-google-analytics-with-rich-managed-web-applications-in-silverlight.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jeffwilcox/archive/2007/10/01/using-goo... | <p>I think you answered it yourself. The page you are linking to does just that: detect which version of Silverlight the user has (not if s/he installs it). From the page:</p>
<blockquote>
<p>After a little poking around, I found that Google Analytics has support for reporting a user-defined field.</p>
</blockquote>... | 5,820 |
<p>We have a product but we are doing some rebranding so we need to be able to build and maintain two versions. I used resource files combined with some #if stuff to solve the strings, images, and whatever else, but the program icon is giving me trouble. I couldn't figure it out from msdn or a google search. Thanks!... | <p>Create icon files named after your config. (E.g. DebugOld.app.ico DebugBranded.app.ico, ReleaseBranded.app.ico)</p>
<p>Create a pre-build step:</p>
<pre><code>copy "$(ProjectDir)$(ConfigurationName).app.ico" "$(ProjectDir)app.ico"
</code></pre>
| <p>Set the icon in normal code, and you should be able to use the same techniques as you have elsewhere. You'll need both icons in the resources file (at least so I suspect) but it should work.</p>
<p>Alternatively, set a prebuild step to copy the appropriate icon into a common filename - e.g. copying debug.ico or rel... | 27,607 |
<p>Converting my current code project to TDD, I've noticed something.</p>
<pre><code>class Foo {
public event EventHandler Test;
public void SomeFunction() {
//snip...
Test(this, new EventArgs());
}
}
</code></pre>
<p>There are two dangers I can see when testing this code and relying on a... | <p>I wouldn't say "take it with a grain of salt" (there is a lot of utility to code coverage), but to quote myself</p>
<blockquote>
<p>TDD and code coverage are not a
panacea:</p>
<p>· Even with 100% block
coverage, there still will be errors
in the conditions that choose which
blocks to execute... | <p>Coverage is only really useful for identifying code that hasn't been tested at all. It doesn't tell you much about code that has been covered.</p>
| 20,549 |
<p>I'm working on a simple javascript login for a site, and have come up with this:</p>
<pre><code><form id="loginwindow">
<strong>Login to view!</strong>
<p><strong>User ID:</strong>
<input type="text" name="text2">
</p>
<p><strong>Password:</strong>... | <p>There are several topics being discussed at once here. Let's try to clarify.</p>
<p><strong>1. Your Immediate Concern:</strong></p>
<p>(<em>Why won't the input button work when ENTER is pressed?</em>)</p>
<p>Use the <strong>submit</strong> button type.</p>
<pre><code><input type="submit".../>
</code></pr... | <p>My Thought = Massive security hole. Anyone can view the username and password.</p>
<p>More relevant to your question: - You have two events happening.</p>
<ol>
<li>User clicks button.</li>
<li>User presses enter.</li>
</ol>
<p>The enter key submits the form, but does not click the button. </p>
<p>By placing your... | 29,579 |
<h2>The story:</h2>
<p>I been googling for some way of displaying computer graphics over the web using acceleration from video cards (<em>no software renders)</em>. I know it is possible to write and activeX module for <em>IE</em> but that is <em>not a complete solution</em> as that would alinate a good amount of user... | <p>You did not mention 'applet' in your question. Try searching for 'jogl applet' or 'lwjgl applet'. I have had more joy with LWJGL than JOGL but they should both satisfy your needs. You may also be interested in Java Web Start. Try the demos <a href="http://lwjgl.org/demos.php" rel="nofollow noreferrer">here</a> for b... | <p>I have used JOGL for a desktop application with the GLUT toolkit and it worked very well ( I have also used the OpenGL bindings in C/C++ and Python) I cannot comment on running a JOGL app inside an applet...</p>
<p>I'm not sure what you mean when you ask how you can query the OpenGL extensions, JOGL is simply the O... | 31,200 |
<p>I was helping out some colleagues of mine with an SQL problem. Mainly they wanted to move all the rows from table A to table B (both tables having the same columns (names and types)). Although this was done in Oracle 11g I don't think it really matters.</p>
<p>Their initial naive implementation was something like <... | <p>Depending on your isolation level, selecting all the rows from a table does not prevent new inserts, it will just lock the rows you read. In SQL Server, if you use the Serializable isolation level then it will prevent new rows if they would have been including in your select query.</p>
<p><a href="http://msdn.micr... | <p>Yes Milan, I haven't specified the transaction isolation level. I suppose it's the default isolation level which I don't know which it is. Neither in Oracle 11g nor in SQL Server 2005.</p>
<p>Furthermore the INSERT that was made during the WAIT command (on the 2nd connection) was <em>NOT</em> inside a transaction. ... | 18,098 |
<p>There are enough books on how to do unit testing.</p>
<p>Do you know any good books (or other good resources) on integration testing?</p>
<p>What I am particularly interested in is</p>
<ul>
<li>Define scope (unit testing < integration testing < automated func. testing </li>
<li>What is a good and bad integ... | <p><strong>Continous Integration</strong> By Duvall, Matyas and Glover
It's a Martin Fowler's signature book published by Addison-Wesley
It might give you some nice ideas.</p>
| <p>Actually there is another thread on this which is pretty good:
<a href="https://stackoverflow.com/questions/555899/the-agile-way-integration-testing-vs-functional-testing-or-both">The Agile Way: Integration Testing vs Functional Testing or both?</a></p>
| 40,622 |
<p>What is the best approach to calculating the largest prime factor of a number?</p>
<p>I'm thinking the most efficient would be the following:</p>
<ol>
<li>Find lowest prime number that divides cleanly</li>
<li>Check if result of division is prime</li>
<li>If not, find next lowest</li>
<li>Go to 2.</li>
</ol>
<p>I... | <p>Actually there are several more efficient ways to find factors of big numbers (for smaller ones trial division works reasonably well). </p>
<p>One method which is very fast if the input number has two factors very close to its square root is known as <a href="http://en.wikipedia.org/wiki/Fermat's_factorization_... | <p>I think it would be good to store somewhere all possible primes smaller then n and just iterate through them to find the biggest divisior. You can get primes from <a href="http://www.prime-numbers.org/" rel="nofollow noreferrer">prime-numbers.org</a>.</p>
<p>Of course I assume that your number isn't too big :)</p>
| 4,328 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.