instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In Visual Basic, is there a performance difference when using the <code>IIf</code> function instead of the <code>If</code> statement?</p>
| <p>VB has the following <code>If</code> statement which the question refers to, I think:</p>
<pre><code>' Usage 1
Dim result = If(a > 5, "World", "Hello")
' Usage 2
Dim foo = If(result, "Alternative")
</code></pre>
<p>The first is basically C#'s ternary conditional operator and the second is its coalesce operator ... | <p>Those functions are different! Perhaps you only need to use IF statement.
IIF will always be slower, because it will do both functions plus it will do standard IF statement.</p>
<p>If you are wondering why there is IIF function, maybe this will be explanation:</p>
<pre><code>Sub main()
counter = 0
bln = Tr... | 4,803 |
<p>I'd like to configure visual studio 2005 to copy .dll's based on whether the OS is 64-bit or 32-bit during a build.</p>
<p>I do not want to specify what the platform target is. </p>
<p>My first attempt was to use a batch file to lookup the Windows version, but some 32-bit and 64-bit versions of Windows share the ... | <p>You should be able to read the environment variable %PROCESSOR_ARCHITECTURE%. Here is some great information on it.</p>
<p><a href="http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process... | <p>Jon's link is a total hack because it relies upon no new processor architectures being added.</p>
<p>See: <a href="http://support.microsoft.com/kb/556009" rel="nofollow">http://support.microsoft.com/kb/556009</a> for the "official" batch file method.</p>
| 23,307 |
<p>I want to verify a drag & drop operation is allowed. A valid item can come from another one of our "controls", or internally from within the custom treeview. Currently I have this:</p>
<pre><code>bool CanDrop(DragEventArgs e)
{
bool allow = false;
Point point = tree.PointToClient(new Point(e.X, e.Y));
... | <p>I use the TreeNode.Tag property to store small "controller" objects that makes up the logic. E.g.:</p>
<pre><code>class TreeNodeController {
Entity data;
virtual bool IsReadOnly { get; }
virtual bool CanDrop(TreeNodeController source, DragDropEffects effect);
virtual bool CanDrop(DataInfoObject info, Drag... | <p>Not strictly answering your question, but I've spotted a bug in your code.
<code>DragDropEffects</code> has the flags attribute set so you could get <code>e.Effect</code> to be a bitwise combination of copy and move. In which case your code would incorrectly return false.</p>
| 11,644 |
<p>Let's in fact generalize to a <code>c</code>-confidence interval. Let the common rate parameter be <code>a</code>. (Note that the mean of an exponential distribution with rate parameter <code>a</code> is <code>1/a</code>.)</p>
<p>First find the cdf of the sum of <code>n</code> such i.i.d. random variables. Use t... | <p>As John D. Cook hinted, the sum of i.i.d. exponential random variables has a gamma distribution.<br>
Here's the cdf of the sum of n exponential random variables with rate parameter a (expressed in Mathematica):</p>
<pre><code>F[x_] := 1 - GammaRegularized[n, a*x];
</code></pre>
<p><a href="http://mathworld.wolfram... | <p>Hint: the sum of independent exponential random variables is a gamma random variable.</p>
| 48,812 |
<p>I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great.</p>
<p>When you are panning in this way and you are release, the page stops dead where you dropped it.</p>
<p>I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone ... | <p>I'm going to make a few assumptions here. First, I presume that you are talking about printf output from an application (whether it be from a console app or from a windows GUI app). My second assumption is the C language.</p>
<p><em>To my knowledge, you cannot direct printf output to the output window in dev stud... | <p>System.Diagnostics.Debug.Writeline() or Trace.Writeline()</p>
| 14,939 |
<p>Do the major web application frameworks (Rails, Django, etc) have libraries that provide functionality for signing in, signing up, creating usernames, changing passwords, and managing lost passwords?</p>
<p>It seems to me that this is common functionality that should be supported by some standard library, but I hav... | <p>Django has a standard User data model which is used extensively by Django applications. There are also many apps available to ease user management, such as <a href="http://www.bitbucket.org/ubernostrum/django-registration/wiki/Home" rel="nofollow noreferrer">django-registration</a>.</p>
<p>Rails has many more opti... | <p>In Rails it is outside of core. You need to either write your own or use a plugin such as Restful_Authentication - which has all the functionality you have mentioned.</p>
<p>If you want it all prebuilt in rails take a look at a skeleton app like Bort.</p>
| 38,978 |
<p>When I use <code>DateTime.Now</code> I get the date and time from the server point of view. Is there any way to get the <em>client</em> date and time in ASP.NET?</p>
| <p>What I'd do is create a hidden input field and then wire a Javascript routine to the onsubmit event for the form. This routine would populate the hidden field with the time on the client machine.</p>
<p>The hidden field can used with ASP.NET by using the HTML control "HtmlInputHidden" class. You just give you input... | <p>I used this method in ASP.Net with VB</p>
<pre><code>Dim strLanguage As String = Request.UserLanguages(0)
Dim currentCulture As CultureInfo = CultureInfo.CreateSpecificCulture(strLanguage)
Dim dateformat As String = currentCulture.DateTimeFormat.ShortDatePattern
</code></pre>
<p>This will yield the data time forma... | 34,628 |
<p>I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7 and as we all know, IIS6 needs the ".mvc"-naming in the URL.</p>
<p>Will this code work to make sure it works on all IIS-versions? Without having to make special adjustments in code, global.asax or config-files for the different IIS-ver... | <p>That should fix the .mvc problem since the integrated pipeline is IIS7 strictly.
But remember to change settings on the IIS7 website to use "2.0 Integrated Pipeline" otherwhise it will return false aswell.
Also ofcouse setup the mapping of .mvc to the asp.net isapi dll, but Im guessing that you already know this.</p... | <p>You can use an ISAPI filter to rewrite URLs which will allow you to have the nice URLs while still on IIS 6. </p>
<p>Look, for example, <a href="http://www.flux88.com/UsingASPNETMVCOnIIS6WithoutTheMVCExtension.aspx" rel="nofollow noreferrer">here</a></p>
| 13,431 |
<p>How can I achieve keeping the motors active during pause to avoid moving their position during filament changes? I have changed the filament during some prints to change the color or to change the a newer spool, but sometimes the X axis is moved during the change. I'm now using some cloth clips to prevent moving du... | <p>Is <code>ADVANCED_PAUSE_FEATURE</code> enabled in your printers <code>configuration_adv.h</code> file?
There is a <code>PAUSE_PARK_NO_STEPPER_TIMEOUT</code> option included in there, which prevents the steppers from timing out during a pause, and may be more robust than a G-Code command if you plan to manually pause... | <p>I have not tried this, but you could use the <code>M84 S0</code> command, this prevents the motors to go into an idle state.</p>
<p>From the <a href="https://reprap.org/wiki/G-code#M84:_Stop_idle_hold" rel="nofollow noreferrer"><code>M84</code> G-code wiki</a> (firmware specific!):</p>
<blockquote>
<p>On <strong... | 1,069 |
<p><a href="http://www.techonthenet.com/oracle/functions/trunc_date.php]" rel="noreferrer">This page</a> mentions how to trunc a timestamp to minutes/hours/etc. in Oracle.</p>
<p>How would you trunc a timestamp to seconds in the same manner?</p>
| <p>Since the precision of <code>DATE</code> is to the second (and no fractions of seconds), there is no need to <code>TRUNC</code> at all.</p>
<p>The data type <code>TIMESTAMP</code> allows for fractions of seconds. If you convert it to a <code>DATE</code> the fractional seconds will be removed - e.g.</p>
<pre><code... | <p>Something on the order of:</p>
<pre><code>select to_char(current_timestamp, 'SS') from dual;
</code></pre>
| 19,125 |
<p>I have a huge web app that is having issues with memory leak in IE 6.</p>
<p>Fixing a memory leak in a 5 line code sample that demonstrates the problem is easy. </p>
<p>But if I have a very huge application, where should a start from?</p>
| <p>Check out <a href="http://sourceforge.net/projects/ieleak" rel="nofollow noreferrer">Drip</a>. That usually takes the guesswork out of IE memory leaks.</p>
<p>If for some reason Drip doesn't find it, take a close look at any JavaScript code that works with events. That is almost always the source of any significa... | <p>Here is how I solved the memory leak problem in IE7. The idea is to dispose/set to null all expando-properties on all DOM nodes at unloading the page. This worked for me. You may find it useful.</p>
<pre><code><!--[if lt IE 8]>
<script type="text/javascript">
function disposeAll() {
if (window.docu... | 4,016 |
<p>I finally got my group to switch from SourceSafe to Subversion. Unfortunately, my manager still wants to use exclusive locks on every single file. So I set the svn:needs-lock property on every file and created a pre-commit hook to make sure the property stays set.</p>
<p>We are running Subversion on a Linux serve... | <p>What you're looking for is the <a href="http://svnbook.red-bean.com/en/1.8/svn.ref.svnadmin.c.lslocks.html" rel="noreferrer"><code>svnadmin lslocks</code></a> command.</p>
<p>I have this set up at work because we keep some Word documents in our Subversion repository (with <code>svn:needs-lock</code>). I have a cron... | <p>This might not be the answer you're looking for, but you should try to convince the manager that locks are actually not the best development practice. There's lots out there that's been written on this subject, so I won't repeat it all here.</p>
<p>When you go from a locking environment to one with no enforced che... | 36,169 |
<p>If I issue the <a href="https://en.wikipedia.org/wiki/Find_(Unix)" rel="noreferrer">find</a> command as follows:</p>
<pre><code>find . -name *.ear
</code></pre>
<p>It prints out:</p>
<pre><code>./dir1/dir2/earFile1.ear
./dir1/dir2/earFile2.ear
./dir1/dir3/earFile1.ear
</code></pre>
<p>I want to 'print' the name and ... | <pre><code>find . -name '*.ear' -exec ls -lh {} \;
</code></pre>
<p>just the h extra from jer.drab.org's reply. saves time converting to MB mentally ;)</p>
| <p>You could try for loop:</p>
<pre><code>for i in `find . -iname "*.ear"`; do ls -lh $i; done
</code></pre>
| 9,025 |
<p>I am building a desktop application. Our analysis says it would be better built with a RCP. Should I use the eclipse or netbeans platform to build my application . Some of the factors to consider are</p>
<ul>
<li>Performance</li>
<li>Look and Feel</li>
<li>Popularity among target users (developers/testers)</li>
<li... | <p>I've used Eclipse to build an RCP text editors, multiple views and graph diagrams (lacking only the block diagrams you mention). The environment was pretty good as well as the support in the community for getting help (it was my first Eclipse RCP experience - nearly all my questions had been answered at one point o... | <p>Eclipse has bugs especialy with the text editors. Netbeans on the other hand sucks RAM worse that Crysis</p>
| 21,379 |
<p>I am admin on a forum.
Earlier we had phpbb 2.0 and i made a bot that could write to the forum.
Now, we have upgraded the forum to phpbb 3.0, but i can't get my bot to write to the forum anymore.</p>
<p>I have looked for a solution, but now i am out of ideas.
So it would have been great if anyone have a suggestion... | <p>I would advise looking at the source code of the 'add post' form on the site. Check the HTML; you will need to emulate each <code>input</code> or <code>select</code> element, as these are the POST values that are submitted via the form.</p>
| <p>Found that it is recommended to rather use the phpbb functions instead of directly editing the database.
The topic here: <a href="http://www.phpbb.com/community/viewtopic.php?f=71&t=936535&p=5358845" rel="nofollow noreferrer">http://www.phpbb.com/community/viewtopic.php?f=71&t=936535&p=5358845</a> s... | 30,712 |
<p>I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact).</p>
<p>With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing with fixed point numbers I get an... | <p>I think the answer to this depends on the exact form of the matrix. A standard decomposition method (LU, QR, Cholesky etc.) with pivoting (an essential) is fairly good on fixed point, especially for a small 4x4 matrix. See the book 'Numerical Recipes' by Press et al. for a description of these methods.</p>
<p><a hr... | <p>If the matrix represents an affine transformation (many times this is the case with 4x4 matrices so long as you don't introduce a scaling component) the inverse is simply the transpose of the upper 3x3 rotation part with the last column negated. Obviously if you require a generalized solution then looking into Gaus... | 18,830 |
<p>I'm trying to make a triangle (isosceles triangle) to move around the screen and at the same time slightly rotate it when a user presses a directional key (like right or left).</p>
<p>I would like the nose (top point) of the triangle to lead the triangle at all times. (Like that old asteroids game).</p>
<p>My prob... | <p>The arctangent (inverse tangent) of vy/vx, where vx and vy are the components of your (centroid->tip) vector, gives you the angle the vector is facing.</p>
<p>The classical arctangent gives you an angle normalized to -90° < r < +90° degrees, however, so you have to add or subtract 90 degrees from the result d... | <pre><code>double v; // velocity
double theta; // direction of travel (angle)
double dt; // time elapsed
// To compute increments
double dx = v*dt*cos(theta);
double dy = v*dt*sin(theta);
// To compute position of the top of the triangle
double size; // distance between centroid and top
double top_x = x + size*cos(th... | 27,148 |
<p>I have a MDB running in WebSphere, when it tries to pull a message off an MQ Queue
the following exception is thrown:</p>
<p>com.ibm.mq.MQException: Message catalog not found </p>
<p>Any idea how to resolve this?</p>
| <p>Add the directory containing the <strong>mqji.properties</strong> file to the CLASSPATH</p>
| <p>Google says it's a missed entry in the classpath:
<a href="http://www.mqseries.net/phpBB2/viewtopic.php?t=5979&highlight=mqji" rel="nofollow noreferrer">http://www.mqseries.net/phpBB2/viewtopic.php?t=5979&highlight=mqji</a></p>
| 24,567 |
<p>I know how to do this using for loops. Is it possible to do something like this using LINQ or lambdas?</p>
<pre><code>int[] a = { 10, 20, 30 };
int[] b = { 2, 4, 10 };
int[] c = a * b; //resulting array should be { 20, 80, 300 }
</code></pre>
| <p>EDIT: The code below will work, but it's not as readable as using an explicit method. LINQ is great where it definitely <em>adds</em> to readability... but this isn't one of those cases.</p>
<p>This is a briefer version of CMS's answer - the extra <code>let</code> isn't required, and when you're just doing a projec... | <p>Check out this <a href="http://msdn.microsoft.com/en-us/magazine/cc163340.aspx" rel="nofollow noreferrer">MSDN article on the upcoming PLINQ</a> (Parallel LINQ). From the article, here is an example of using PLINQ to parallelize matrix multiplication:</p>
<pre><code>void ParMatrixMult(int size, double[,] m1, doubl... | 40,222 |
<p>We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that?</p>
| <p>My team has been using Ext with DWR for almost year a year, and have had nothing but good things to say. If you take this approach, you will end up using DWR's generated JavaScript classes for making your requests to the server. This will often be done in place of using the Ext.Ajax and Ext.data.Connection classes... | <p>It's perfectly fine to build your application using Ext JS/DWR/Spring/Hibernate.</p>
| 9,628 |
<p>In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing.</p>
<p>I am developing with Carbide and have used the UI Designer to add items to the options menu.</p>
<p>Does anyone know how to enable the exit button, or why else it might not work?</p>
<p>Thanks!</p>
| <p>Are you handling (in your <code>appui::HandleCommandL</code>) command ids <code>EEikCmdExit</code> and <code>EAknSoftkeyExit?</code></p>
<pre><code> if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
{
Exit();
}
</code></pre>
| <p>Have you looked inside the <code>HandleCommandL( TInt aCommand )</code> method of the <code>AppUi</code> class of your application? For example, in all UI projects I create with Carbide, the following is automatically present inside the <code>HandleCommandL()</code> method:</p>
<pre><code>void MyAppUi::HandleComman... | 46,978 |
<p>What is the most efficient way to clone a JavaScript object? I've seen <code>obj = eval(uneval(o));</code> being used, but <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval" rel="noreferrer">that's non-standard and only supported by Firefox</a>.<br/><br/> I've done thin... | <h1>Native deep cloning</h1>
<p>There's now a JS standard called <a href="https://developer.mozilla.org/en-US/docs/Web/API/structuredClone" rel="noreferrer">"structured cloning"</a>, that works experimentally in Node 11 and later, will land in browsers, and which has <a href="https://www.npmjs.com/package/@un... | <p><strong>Cloning an object using today's JavaScript: <a href="https://en.wikipedia.org/wiki/ECMAScript#6th_Edition_%E2%80%93_ECMAScript_2015" rel="nofollow noreferrer">ECMAScript 2015</a></strong> (formerly known as ECMAScript 6)</p>
<pre><code>var original = {a: 1};
// Method 1: New object with original assigned.
v... | 14,840 |
<p>I have a CSV data file with rows that may have lots of columns 500+ and some with a lot less. I need to transpose it so that each row becomes a column in the output file. The problem is that the rows in the original file may not all have the same number of columns so when I try the transpose method of array I get:... | <p>I would insert nulls to fill the holes in your matrix, something such as:</p>
<pre><code>a = [[1, 2, 3], [3, 4]]
# This would throw the error you're talking about
# a.transpose
# Largest row
size = a.max { |r1, r2| r1.size <=> r2.size }.size
# Enlarge matrix inserting nils as needed
a.each { |r| r[size - 1... | <pre><code># Intitial CSV table data
csv_data = [ [1,2,3,4,5], [10,20,30,40], [100,200] ]
# Finding max length of rows
row_length = csv_data.map(&:length).max
# Inserting nil to the end of each row
csv_data.map do |row|
(row_length - row.length).times { row.insert(-1, nil) }
end
# Let's check
csv_data
# => ... | 31,215 |
<p>The application I am currently working on generates a lot of SQL inline queries. All generated SQL is then handed off to a database execution class. I want to write a parsing service for the data execution class that will take a query like this:</p>
<pre><code>SELECT field1, field2, field3 FROM tablename WHERE foo=... | <p>Refactor now.</p>
<p>You're fooling yourself if you think this one abstraction layer is going to be able to come in quicker and easier. Deep down, you know it increases risk and uncertainty on the project, but you want to kill the SQL injection problem or whatever problem you are fighting with a magic bullet.</p>
... | <p>I would second the suggestion to use the Command parameters to do what you want.
Any kind of SQL query string parsing is just asking for someone do play an SQL injection game with you. A sample code is below. The Parameters collection is easy to manipulate in the normal way</p>
<pre><code>command.CommandText = "SEL... | 20,607 |
<p>How do I determine in a .Net DLL whether it's running in a Windows GUI application or web service? I've got a low level class which is being shared between two applications and need to disable message boxes when it's used in a web service.</p>
<p>The Windows application has over 200 solutions and I'm not in a posi... | <p>Just a piece of general advice, your low level class should probably not be using the message boxes itself, but should allow an intermediate (closer to the interface) class to handle cases where you might want a messagebox.</p>
<p>If you did this, then you'd simply use different higher-level classes for the web tha... | <p>I don't know if this will work, but it might. Use these Win32 calls:</p>
<p>GetModuleFileNameEx to get the dll's exe and save it for later comparison.<br>
EnumWindows to get all top level windows.<br>
GetWindowModuleFileName to translate the window handles from EnumWindows to module names.</p>
<p>If you can find ... | 21,489 |
<p>I've got a client that sees the "Page can not be displayed" (nothing else) whenever they perform a certain action in their website. I don't get the error, ever. I've tried IE, FF, Chrome, and I do not see the error. The client sees the error on IE.</p>
<p>The error occurs when they press a form submit button tha... | <p>In IE, go to the "Anvanced" section of "Internet Options" and uncheck "Show friendly HTTP errors". This should give you the <em>real</em> error.</p>
| <p>It would be useful to you to figure out which error code is returned. Is it 404 - Resource not found or 503 - Forbidden Access? There are a few more, but in any case, it would help you figure out the cause of the problem. </p>
<p>If your client is running IE, ask him to disable friendly error messages in the advanc... | 10,224 |
<p>I want to allow my users to embed their own Flash animations in their posts. Usually the actual file is hosted on some free image hosting site. I wouldn't actually load the flash unless the user clicked a button to play (so that nothing auto-plays on page load). I know people can make some really annoying crap in... | <p>Flash has some neat security measures in place. Allowing users to upload swf's to your site and embedding them is unsafe, you're basically setting yourself up for an XSS attack.</p>
<p>However, allowing them to hotlink should not be a problem. The swf will be locked to the domain that is hosting it and is not allow... | <p>Yes, it's unsafe.</p>
<p>There's no easy way of allowing it. You could have a domain whitelist that allowed YouTube, Hulu, etc. through, but whitelisting is inherently painstaking - you'd be constantly updating.</p>
| 6,561 |
<p>I've been working on a very simple crud generator for pylons. I came up with something that inspects </p>
<pre><code>SomeClass._sa_class_manager.mapper.c
</code></pre>
<p>Is it ok to inspect this (or to call methods begining with underscore)? I always kind of assumed this is legal though frowned upon as it relies ... | <p>It is intentional (in Python) that there are no "private" scopes. It is a convention that anything that starts with an underscore should not ideally be used, and hence you may not complain if its behavior or definition changes in a next version.</p>
| <p>If it works, why not? You could have problems though when _sa_class_manager gets restructured, binding yourself to this specific version of SQLAlchemy, or creating more work to track the changes. As SQLAlchemy is a fast moving target, you may be there in a year already.</p>
<p>The preferable way would be to integra... | 18,337 |
<p>I have a Monoprice Maker Ultimate 3D printer (a rebranded Wanhao Duplicator 6) and out of the box the hotend temps when set to 200 would vary between 190 and 210. I used repetier-host to run <a href="https://reprap.org/wiki/PID_Tuning" rel="nofollow noreferrer">PID tuning</a> and stored the last set of values it gav... | <p>If you are sure that PID is enabled (and not using bang-bang heating, as this gives a very similar heating profile) and did not fix the fluctuations, the best guess for this phenomenon is that the printer board has incorrect capacitors installed on the printer board. This is not very uncommon and can be found on the... | <h1>Software</h1>
<p>You might want to look at your firmware. When running a PID tune, the firmware decides on a smoothing.</p>
<p>in Marlin, <code>configuration.h</code> contains a line that determines how much the machine shall try to work out the curves. For my ender 3 it reads:</p>
<pre><code>#define PID_K1 0.95 ... | 1,130 |
<p>I have two simple tables in my database. A "card" table that contains Id, Name, and text of a card, and a "rulings" table which contains the Id of the card, and text detailing the rulings for the card.</p>
<p>Often enough in the ruling text, there is a reference to another card in the database. It is easy enough to... | <p>This seems like a fairly simple and common relational problem that is solved by a cross-reference table. For example:</p>
<pre><code>CREATE TABLE dbo.Cards (
id INT NOT NULL,
name VARCHAR(50) NOT NULL,
card_text VARCHAR(4000) NOT NULL,
CONSTRAINT PK_Cards PRIMARY KEY CLUST... | <p>I would recommend that you create another table that stores your references. Then, create an insert and update trigger that maintains this table. This way, you would have a faster query to return the data you are looking for.</p>
<p>I recognize that initially populating this table might be a little difficult, whi... | 41,551 |
<pre><code> include('adodb5/adodb.inc.php');
$myServer = "localhost";
$myUser = "root";
$myPass = "root";
$myDB = "database";
//create an instance of the ADO connection object
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
//define conn... | <p>If you want to use following code:</p>
<pre><code>new COM("ADODB.Connection")
</code></pre>
<p>you need to enable "COM support" in PHP, such using the com_dotnet extension (php_com_dotnet.dll) <a href="http://php.net//manual/fr/com.installation.php" rel="nofollow">How to install COM extension</a></p>
| <p>The most likely cause is that ADO is not correctly installed on the server. Try running the latest version of MDAC and insure it install correctly then try agin. Update your question with more information for further details. I assume you are on a Windows Server?</p>
| 28,624 |
<p>We are developing an application that involves a lot of different tests where each test lead the users to a number of steps. We are thinking of using a state machine framework to capture the states/transitions out of the code. We are also thinking of using rule engine to supplement on the rules. Anyone has experi... | <p><a href="http://jboss.org/jbpm" rel="nofollow noreferrer">jbpm</a> does this and integrates well with jboss. In my experience, it's pretty easy to use and is powerful.</p>
| <p>Have a look at <a href="http://www.stateforge.com" rel="nofollow">StateBuilderJava</a>, a state machine code generator that transforms an XML description of a state machine into an extended version of the Java state pattern. It supports all UML semantics: state machine can be hierarchical, concurrent and asynchronou... | 32,927 |
<p>When trying to work with Qt's signal/slot mechanisms over more than one level of inheritance, I ran into a problem: When my class does not directly inherit from QObject, signals and slots don't seem to work any more.</p>
<p>The output of the following program illustrates the case:</p>
<pre><code>require 'Qt'
clas... | <p>To be able to utilize signals and slots - or more importantly the meta object system in Qt, the class has to inherit from QObject - and it has to inherit QObject first in multiple inheritance. See also <a href="http://doc.trolltech.com/4.4/moc.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/moc.html</a>... | <p>To be able to utilize signals and slots - or more importantly the meta object system in Qt, the class has to inherit from QObject - and it has to inherit QObject first in multiple inheritance. See also <a href="http://doc.trolltech.com/4.4/moc.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/moc.html</a>... | 38,149 |
<p>In an application that heavily relies on <code>.htaccess</code> RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is:</p>
<pre><code>/appRoot/.htaccess
app/
static/
</code></pre>
<p>By default every ... | <p>And the correct answer iiiiis...</p>
<pre><code>RewriteRule ^(a|bunch|of|old|directories).* - [NC,L]
# all other requests will be forwarded to Cake
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</code></pre>
<p>I still don't get why the index.php file in the root directory was call... | <p>Remove the [L] from the previous rules:</p>
<pre><code>RewriteBase /appRoot
RewriteRule ^$ app/webroot/ &nbsp; &nbsp;
RewriteRule (.*) app/webroot/$1
</code></pre>
<p>[L] means "Stop the rewriting process here and don't apply any more rewriting rules."</p>
| 2,533 |
<p>I'm trying to automate some stuff in MS Excel. When I try to set the Calculation property I get the following error message: 'Unable to set the Calculation property of the Application class'</p>
<p>I believe this property should be settable.</p>
<p>Any advice appreciated!</p>
| <p>You need to have an open workbook, ie</p>
<pre class="lang-py prettyprint-override"><code>import win32com
# Create new Excel instance
xl = win32com.client.DispatchEx("Excel.Application")
# Open blank workbook
xl.Workbooks.Add()
# Set property
xl.Calculation = win32com.client.constants.xlCalculationManual
</cod... | <p>Make sure you are setting it to a proper value.</p>
<pre><code> Application.Calculation = xlCalculationManual
</code></pre>
<p>or one of the following values:</p>
<p>xlCalculationAutomatic: Excel controls recalculation. <br>
xlCalculationManual: Calculation is done when the user requests it. <br>
xlCalculationSem... | 34,748 |
<p>I know it's possible to use CSS to add page breaks to web pages, for when they're printed.</p>
<p>I also know CSS support in HTML emails is poor.</p>
<p>So, is there a way to generate a page break when an HTML email is printed? Or given the variety of email clients out there, is that just a daft question?</p>
| <p>I'd say do it the standard CSS way. It'll work for some e-mail reading agents. There's no <strong>other</strong> way to hint at page breaks. If it's really important that people can print the message then maybe make the message available through the web too and tell the recipient to print that one.</p>
| <p>I'd say do it the standard CSS way. It'll work for some e-mail reading agents. There's no <strong>other</strong> way to hint at page breaks. If it's really important that people can print the message then maybe make the message available through the web too and tell the recipient to print that one.</p>
| 49,433 |
<p>I want to create a program that requests from the user 10 grades and then filters them to pass and fail, then prints the number of passes and fails. I did the program but the output is wrong.</p>
<pre><code>int pass,fail,grade,studentcounter;
pass=0;
fail=0;
grade=0;
studentcounter=10;
while (studentcounter!=0)
{... | <p>You are entering a grade number. A switch statement tests that grade against the cases, and i am pretty sure the grades are not 1 percent or 2 percent. An if statement would be a more logical choice in this situation.</p>
<p>Second of all, you have a code block which is never used. First you set studentcounter to z... | <p>you need to keep the count of pass/fails inside the while loop, the grade variable will be overwritten at every input.</p>
<p>edit:
also, dont use a switch statement.</p>
| 45,066 |
<p>I have a method which should be executed in an exclusive fashion. Basically, it's a multi threaded application where the method is invoked periodically by a timer, but which could also be manually triggered by a user action.</p>
<p>Let's take an example :</p>
<ol>
<li><p>The timer elapses, so the method is
called.... | <p>This looks reasonable if you are just interested in not having the method run in parallel. There's nothing to stop it from running immediately after each other, say that you pushed the button half a microsecond after the timer executed the Monitor.Exit().</p>
<p>And having the lock object as readonly static also ma... | <p>This is a good solution although I'm not really happy with the static lock. Right now you're not waiting for the lock so you won't get into trouble with deadlocks. But making locks too visible can easily get you in to trouble the next time you have to edit this code. Also this isn't a very scalable solution.</p>
<p... | 17,841 |
<p>I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use EnableEventValidation="false" to allow this. After I add my options to the sel... | <p>If a DropDownList leaves the server with no options, it's recreated server-side with no options (from the viewstate)</p>
<p>You could add the options to a hidden html control as a delimited string in your javascript as well as to the select list. Then iterate that into the control once server-side on post-back. Oth... | <p>You can get the selected value directly from the form like so:</p>
<pre><code>string fooBar = Request.Form[SomeDropDown.UniqueID];
</code></pre>
<p>This will return the correct value no matter what you do to to the drop down options. I use javascript to change the quantity dropdown for a product based on size sele... | 14,797 |
<p>I'm doing a authorization check from a WinForms application with the help of the AzMan authorization provider from Enterprise Library and am receiving the the following error:</p>
<blockquote>
<p>Unable to update the password. The value provided as the current password is incorrect. (Exception from HRESULT: 0x800... | <p>You can use this:</p>
<pre><code>super if defined?(super)
</code></pre>
<p>Here is an example:</p>
<pre><code>class A
end
class B < A
def t
super if defined?(super)
puts "Hi from B"
end
end
B.new.t
</code></pre>
| <p>Rather than checking if the super method exists, you can just define it</p>
<pre><code>class ActiveRecord::Base
def after_initialize
end
end
</code></pre>
<p>This works in my testing, and shouldn't break any of your existing code, because all your other classes which define it will just be silently overrid... | 3,197 |
<p>When a branch is reintegrated to the trunk, is that branch effectively dead? </p>
<p>Can you make modifications to the branch after the reintegration and merge those back into the trunk at a later date?</p>
| <p>You can do it technically, you branch is not dead nor disabled, but it is not recommended to merge from branch to trunk after reintegration.</p>
<p>You can find a full discussion about the reason for that, here: <a href="http://blogs.collab.net/subversion/2008/07/subversion-merg" rel="noreferrer">Subversion merge r... | <p>When you do a merge, you specify the target. You can merge the differences of TreeA and TreeB to TreeC if you like. As Chris implies, your question doesn't really make that much sense. If you merge your branch into the trunk, the branch remains untouched. If the branch isn't needed afterwards, you could delete i... | 12,804 |
<p>I'm using a CraftBot original to print PLA, but some of the filament has become stuck in the teeth of the <a href="https://craftunique.com/item/craftbot-extruder-gear" rel="nofollow">extruder gear</a> on its way into the hot end. I'm having issues with the gear becoming stuck and "clicking" instead of turning, and ... | <p>I mostly use a tooth brush for that kind of problem</p>
| <p>If you are able to remove the gear, as I suspect you can, a useful tool is the file card. It resembles a flat hair brush but the bristles are short wire, very stiff. In traditional use, it removes metal shavings from conventional metal files. It will easily remove plastic from between the gear teeth. If you are unab... | 322 |
<p>I've just built a basic ASP MVC web site for deployment on our intranet. It expects users to be on the same domain as the IIS box and if you're not an authenticated Windows User, you should not get access.</p>
<p>I've just deployed this to IIS6 running on Server 2003 R2 SP2. The web app is configured with it's own ... | <p>After extensive Googling I managed to find a solution on the following MSDN article:<br>
<a href="http://msdn.microsoft.com/en-us/library/ms998297.aspx" rel="noreferrer">How To: Create a Service Account for an ASP.NET 2.0 Application</a></p>
<p>Specifically the Additional Considerations section which describes "Cre... | <p>It sounds to me as though you've done everything right.</p>
<p>I'm sure you are but have you made sure you are using 'DOMAIN\user' as the user account and not just 'user'?</p>
| 14,542 |
<p>I have a web application that needs to take a file upload from the user and upload it to a remote server. I can take input from user to server fine via file_field, but can't seem to work out the next step of uploading from server to remote. Net::HTTP doesn't do multipart forms out of the box, and I haven't been ab... | <p>I believe the attachment_fu plugin would allow for this:</p>
<p><a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/" rel="nofollow noreferrer">http://svn.techno-weenie.net/projects/plugins/attachment_fu/</a></p>
| <p>Surprisingly multipart form posts really aren't in Net:HTTP. A <a href="http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/47e004681a47a5cb" rel="nofollow noreferrer">thread</a> from comp.lang.ruby seems to have snippet of code you might find useful to perform the encoding necessary:</p>
<pre><code>... | 14,176 |
<p>I am just beginning to do research into the feasibility of using Amazon's SimpleDB service as the datastore for RoR application I am planning to build. We will be using EC2 for the web server, and had planned to also use EC2 for the MySQL servers. But now the question is, why not use SimpleDB?</p>
<p>The applicatio... | <p>The Ruby SimpleDB library is not as complete as ActiveRecord (the default Rails DB adapter), so many of the features you're used to will not be there.</p>
<p>On the plus side it's schemaless, scalable and works well with ec2.</p>
<p>If you're going to do things like full text search in your app then SimpleDB might... | <p>There's a library called <a href="http://gemcutter.org/gems/simple_record" rel="nofollow noreferrer">SimpleRecord</a> that is a drop in replacement for ActiveRecord, but uses SimpleDB as its backend data store.</p>
| 19,735 |
<p>Does any one know how the event handler manages the posted events?</p>
<p>In my app i have two threads (<em>guiThread</em> and <em>computationThread</em>). After an exception is thrown I call <code>postEvent(..)</code> to an existing dialog. The Qt-Event-Handler holds this one back until the dialog is closed. </p>
... | <p>As mentionned in the Qt documentation about <a href="http://doc.qt.io/qt-4.8/qcoreapplication.html#postEvent" rel="nofollow noreferrer">QCoreApplication::postEvent</a> :</p>
<blockquote>
<p>When control returns to the main event loop, all events that are stored in the queue will be sent using the notify() functio... | <p>As others already wrote, I believe this behavior is caused by the fact that the dialog starts its own event loop.</p>
<p>If you use Qt4, you can try using <a href="http://doc.qt.io/qt-4.8/threads-qobject.html#signals-and-slots-across-threads" rel="nofollow noreferrer">queued signal/slot connections</a> as an altern... | 7,607 |
<p>I need to set up SSL over Active Directory. I googled a lot but could not found a decent write up about how to do this. Please if you know some good resources about this let me know.
Thanks!</p>
| <p>Sounds easy - but I ran into quite a few problems getting trusted connections with SSL working in our environment. The article was about ADAM but is just as applicable for AD. In our environment I couldn't install domain-related services like cert-server, nor act as domain-admin.</p>
<p>I blogged about how I got ... | <p>Can you be more specific. What is the client trying to do? Active directory support ldap over ssl by default. There is nothing that should be done to activate it. It is done in port 636/tcp. <a href="http://technet.microsoft.com/en-us/library/bb727063.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-u... | 36,517 |
<p>Hey all, I have something of an interesting requirement for my project. I need a <code>has_one</code> relationship where it is either one class or the other, but without inheritance. I could get away with inheritance if it is the only way, but the two associate records have completely different data and aren't rel... | <p>You're trying to model something that doesn't fit the relational database paradigm. All references in SQL have one origin and one target. </p>
<p>FWIW, Polymorphic Associations is also an anti-pattern because it breaks this rule. It should be a clue that it's a broken design when the <em>documentation</em> says ... | <p>Perhaps one way to do this, is to create to has-one associations in Foo, for Bar and Baz. Then create a method called assignment and assignment= which can be the sole way to access Bar and Baz. You can check which of the two has_ones is not nil in the get method and return that one. In the assignment method, you ... | 49,073 |
<p>Here is an interesting piece of code that my fellow team members were just having a slightly heated discussion about...</p>
<pre><code> Dim fred As Integer
If True Then fred = 5 : fred = 3 : fred = 6 Else fred = 4 : fred = 2 : fred = 1
</code></pre>
<p>After executing the above code snippet, what is the value ... | <p>I'm assuming you mean VB.Net.</p>
<p>According to the grammar in the VB Language spec, which you can read here:</p>
<p><a href="http://www.microsoft.com/Downloads/thankyou.aspx?familyId=39de1dd0-f775-40bf-a191-09f5a95ef500&displayLang=en" rel="nofollow noreferrer">http://www.microsoft.com/Downloads/thankyou.as... | <p>Just a guess</p>
<p>fred = 6 because you can have multiple statements on the same line separated by a colon.</p>
<p>Not sure if the "else" is legal (i.e. compilable)</p>
<p>IMHO a better coding style should be chosen:</p>
<pre><code>
if (condition) then
statement
statement
else
statement
statement
end if... | 47,943 |
<p>Please tell me how can save a string with special characters to DB.Special characters may contatin single <code>quotes/double quotes</code> etc.. I am using ASP.NET with C#</p>
| <p>Use parameterized queries.</p>
<p><a href="http://aspnet101.com/aspnet101/tutorials.aspx?id=1" rel="nofollow noreferrer">http://aspnet101.com/aspnet101/tutorials.aspx?id=1</a></p>
<p>When rendering to the client, you should also use Server.HtmlEncode() to convert characters which have special meaning in HTML to nu... | <p>Hard to answer without much details. But usually the best bet is parametrized queries. </p>
| 35,394 |
<p>For a project I'm working on, the store has two types of products - a real product and a group of products. </p>
<p>For this discussion, let's call them "1 T shirt" and "a box of T shirts". For one t-shirt, I need to store the normal attributes - price, sku, size, color, description, etc. For the box of t-shirts... | <p>You can have a Tshirt table and then self reference it with a has_many :through association.</p>
<p>Tshirt - id, sku, price, size, color, description, is_box</p>
<p>TshirtBox - parent_tshirt (id that references tshirt), child_tshirt (id that references tshirt)</p>
<p>Check out this link for more on self referenti... | <p>I would have the following models</p>
<p>Tshirt<br>
TshirtBox has_many TshirtItems<br>
TshirtBoxItems (This is basically a join table with an id tshirt_box_id and tshirt_id) belongs_to TshirtBox</p>
<p>TshirtBoxItems is a way to link a Tshirt with a box and potentially other things in the future.</p>
| 12,965 |
<p>Is it possible to pass a App setting "string" in the web.config to a Common C# class?</p>
| <p>Of course it's possible - but the thing to keep in mind is that a properly designed class (unless it's explicitly designed for ASP.NET) shouldn't know or care where the information comes from. There should be a property (or method, but properties are the more '.NET way' of doing things) that you set with the string ... | <p>If you have configuration values that are used in many places consider developing a Configuration class that abstracts the actual loading of the configuration items and provides strongly typed values and conversions, and potentially default values.</p>
<p>This technique localizes access to the configuration file ma... | 26,249 |
<p>There is <code>ConnectionManager</code> which waits for incoming connections. For each incoming connection it creates a <code>Connection</code> instance which handles the inbound and outbound traffic on this connection. Each <code>Connection</code> has a <code>Watchdog</code> which handles "bad connection" condition... | <p>If the watchdog is running in a different thread, then the problem isn't too bad - the watchdog signals the ConnectionManager to delete with a asynchronous message, then exits it's own thread.</p>
<p>Mean-while, the ConnectionManager thread gets the delete message, and starts deleting the watchdog.</p>
<p>To avoid... | <p>If you're carefull there isn't a problem.</p>
<ol>
<li><p>ConnectionInstance::a_method() calls Watchdog::a_method() calls ConnectionManager::a_method</p></li>
<li><p>ConnectionManager::a_method() deletes ConnectionInstance deletes Watchdog</p></li>
<li><p>ConnectionManager::a_method() returns to Watchdog::a_method(... | 45,478 |
<p>Is there a way to only load child nodes when the parent node is expanded? The problem that I’m running into is that the “expand” icon doesn’t show up if a node doesn’t have any children. Since I don’t want to load the children until the icon is clicked, I’m left with a bit of a catch 22.</p>
| <p>With tree views you usually have to load the children of each displayed node.</p>
<p>So if you only display the root you need to load the roots children too. Once you expand the root you need to load the children of each child if you want the expand stuff for those children.</p>
| <p>i was also looking at this. I think you need to write your own subclass of the TreeNode that loads the child nodes on demand.<br>
One approach I used in a windows forms TreeView was to add an empty child node to each node and then remove this when the node was expanded and the real child nodes were needed. The probl... | 39,995 |
<p>Recently I have been investigating the possibilities of caching in ASP.NET.</p>
<p>I rolled my own "Cache", because I didn't know any better, it looked a bit like this:</p>
<pre><code>public class DataManager
{
private static DataManager s_instance;
public static DataManager GetInstance()
{
... | <p>I think the maxim "let the computer do it; it's smarter than you" applies here. Just like memory management and other complicated things, the computer is a lot more informed about what it's doing than your are; consequently, able to get more performance than you are.</p>
<p>Microsoft has had a team of engineers wor... | <p>Caching in ASP.NET is feature rich and you can configure caching in quite a granular way. </p>
<p>In your case (data caching) one of the features you're missing out on is the ability to invalidate and refresh the cache if data on the SQL server is updated in some way (SQL Cache Dependency).</p>
<p><a href="http://... | 3,232 |
<p>What is the best way to layout a large django project? The tutorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects should be broken down, how much sharing is allowable/necessary between apps in a typical project (obviously that is large... | <p>The major guidelines are similar to any other large code project. Apps should address a single, clearly-defined responsibility. The name "application" is a misnomer; Django apps should be thought of more as reusable components which can be plugged together to create a real application. Tests for each app should b... | <p>My current layout stems from me wanting to have a test-version of my sites. This means having two projects for every site, since they need different configurations, and forces me to move all the applications out of the projects.</p>
<p>I've created two folders: $APP_ROOT/devel and $APP_ROOT/prod. These contain al... | 6,580 |
<p>I need to access a <strong>SVN</strong> repository from home, that runs under the IP <code>192.168.0.10</code> in the work network.
I can establish a <code>SSH</code> tunnel to my localhost.
Now I have to map <code>192.168.0.10</code> in a way, that instead <code>127.0.0.1</code> is accessed.
Does anybody know a way... | <p>TortoiseSVN allows you to relocate your repository</p>
<p><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1" rel="nofollow noreferrer">http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1</a>:</p>
<blockquote>
<... | <p>Can you reference the DNS name instead? You can override the IP address for a DNS name in your hosts file (C:\windows\system32\drivers\etc\hosts).</p>
| 10,665 |
<p>I've written a setup.py script for py2exe, generated an executable for my python GUI application and I have a whole bunch of files in the dist directory, including the app, w9xopen.exe and MSVCR71.dll. When I try to run the application, I get an error message that just says "see the logfile for details". The only pr... | <p>Contrary to most of the answers here I wouldn't subclass from List in most cases. I found that inheriting from a class to reuse functionality usually causes problems later.</p>
<p>I usually just have a property of type List (or IList) that returns a reference to the list. Usually you only need a get property here. ... | <p>In your example you said "Class Tests contains many Test objects", not "Class Tests is a collection of Tests objects". IMO it is not necessary to subclass List in this scenario unless you need to have List-like interface for this class.</p>
<p>However, answer really depends on context of Tests class. If it behaves ... | 26,749 |
<p>This question is a follow up to my <a href="https://stackoverflow.com/questions/56279/export-aspx-to-html">previous question</a> about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" u... | <p>Try setting the credentials property of the WebClient object</p>
<pre><code>WebClient ww = new WebClient();
ww.Credentials = CredentialCache.DefaultCredentials;
ww.DownloadString("Login.aspx?UserName=&Password=");
string html = ww.DownloadString("Internal.aspx");
</code></pre>
| <p>@Fire Lancer: I asked myself that same question during my tests, so I checked, and it does work from a browser.</p>
| 8,635 |
<p>Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?</p>
| <p>I understand BDD to be more about <strong>specification</strong> than <strong>testing</strong>. It is linked to Domain Driven Design (don't you love these *DD acronyms?). </p>
<p>It is linked with a certain way to write user stories, including high-level tests. An example by <a href="http://tomtenthij.nl/2008/1/25/... | <p>Here's the quick snapshot:</p>
<blockquote>
<ul>
<li><p>TDD is just the process of testing code before writing it!</p></li>
<li><p>DDD is the process of being informed about the Domain before each cycle of touching code!</p></li>
<li><p>BDD is an implementation of TDD which brings in some aspects of DDD!... | 2,461 |
<p>What kind of multi-threading issues do you have to be careful for in asp.net? </p>
| <p>One thing to watch out for at things that expire (I think httpContext does), if you are using it for operations that are "fire and forget" remember that all of a sudden if the asp.net cleanup code runs before your operation is done, you won't be able to access certain information. </p>
| <p>Programmatic Caching is one area which immediately comes to my mind. It is a great feature which needs to be used carefully. Since it is shared across requests, you have to put locks around it before updating it.</p>
<p>Another place I would check is any code accessing filesystem like writing to log files. If one r... | 7,293 |
<p>I've got a java servlet which is hitting this bug when down-scaling images...</p>
<p><a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502</a></p>
<p>I'm trying to work out the best way to work around it and would a... | <p>Image scaling with Java can be surprisingly complicated - I ran into lots of reproducable JVM crashes when doing batch processing, which are not related to your bug though. In the end I ended up using the external command line tool 'convert' from <a href="http://www.imagemagick.org/script/index.php" rel="nofollow no... | <p>You might want to use the Java Advanced Imaging (JAI) API. An example of how to scale an image using JAI can be found <a href="http://archives.java.sun.com/cgi-bin/wa?A2=ind9908&L=jai-interest&P=R14150" rel="nofollow noreferrer">here</a>.</p>
| 13,891 |
<p>I have the following code:</p>
<pre><code>for attribute in site.device_attributes
device.attribute
end
</code></pre>
<p>where I would like the code to substitute the value of "attribute" for the method name.</p>
<p>I have tried <code>device."#{attribute}"</code> and various permutations.</p>
<p>Is this complet... | <p>You can use #send method to call object's method by method's name:</p>
<pre><code>object.send(:foo) # same as object.foo
</code></pre>
<p>You can pass arguments with to invoked method:</p>
<pre><code>object.send(:foo, 1, "bar", 1.23) # same as object.foo(1, "bar", 1.23)
</code></pre>
<p>So, if you have attribute... | <p>you can also do</p>
<pre><code>device.instance_eval(attribute)
</code></pre>
| 38,561 |
<p>Is there any tool that enables you to "hot swap" JavaScript contents while executing a webpage? </p>
<p>I am looking for something similar to what HotSpot does for Java, a way to "hot deploy" new JS code without having to reload the whole page.</p>
<p>Is there anything like that out there?</p>
<p><strong>Clarifyi... | <p>Interesting idea :) </p>
<p>I wrote the following bookmarklet:</p>
<pre><code>function reload(){var scripts=document.getElementsByTagName("script");var head=document.getElementsByTagName("head")[0];var newScripts=[];var removeScripts=[];for(var i=0;i<scripts.length;i++){var parent=scripts[i].parentNode;if(paren... | <p>If you want to do this with <em>entire</em> JavaScript files, see <a href="https://stackoverflow.com/questions/203113"><strong>this question</strong></a> for something similar enough that you should be able to get the basics of the idea.</p>
| 25,428 |
<p>This is not a really technical question but is required for a system I am building. I am after a UK suburb/postcode database. I haven't been able to find this anywhere and wonder if it is available (freely). I know in Australia is is freely downloadable from Australia Post. Also a US suburb/zip database is required ... | <p>Might be worth looking at <a href="https://stackoverflow.com/questions/308017/where-can-i-get-postal-codes-for-all-countries">Where can I get postal codes for all countries?</a> </p>
<p>Accepted answer there was <a href="http://www.geonames.org/" rel="nofollow noreferrer">http://www.geonames.org/</a>, but some oth... | <p>UK-specific:</p>
<p>You can purchase the information from Royal Mail. The database is known as the P.A.F. <a href="http://www.royalmail.com/portal/rm/jump2?mediaId=400085&catId=400084" rel="nofollow noreferrer">details here</a> It's ridiculously expensive, and you have to pay yearly. A total mugging in my opini... | 42,053 |
<p>When I am working in .NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for .NET 2.0 projects?</p>
| <p>Indeed, you can use C# 3.0 compiler features when targeting .NET 2.0, except extension methods and default LINQ implementations, which are located in newer assemblies. But if you need to co-operate with VS2005 users, you can open Properties view for a given project (not Project Properties, but Edit \ Properties Wind... | <p>Daniel Moth has a great <a href="http://www.danielmoth.com/Blog/2007/05/using-c-30-from-net-20.html" rel="nofollow noreferrer">blog post</a> on how to using C# 3.0 features (including extension methods) in .Net 2.0. </p>
<p>After rereading the question, this really doesn't help. You can turn off specific inspection... | 13,059 |
<p>Should I use the <code>change</code> or <code>textInput</code> event to capture user input on a TextInput control? Why?</p>
| <p><a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/TextInput.html#event:textInput" rel="noreferrer"><code>textInput</code></a> is dispatched only when the user has <em>input</em> text into the control. <a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/TextInput.html#event:change" rel="noreferr... | <p>Both Event.CHANGE and TextEvent.TEXT_INPUT events trigger on each character typed. If you want an event that will only trigger a single time for a given TextInput field, use <strong>FocusEvent.FOCUS_OUT</strong>. </p>
<p>Like Event.CHANGE and TextEvent.TEXT_INPUT, this event will only trigger for user input, not ... | 35,948 |
<p>Are there any algorithms or tools that can increase the resolution of an image - besides just a simple zoom that makes each individual pixel in the image a little larger?</p>
<p>I realize that such an algorithm would have to invent pixels that don't really exist in the original image, but I figured there might be s... | <p>Interpolation: <a href="http://en.wikipedia.org/wiki/Image_scaling" rel="nofollow noreferrer">Image Scaling</a></p>
| <p>Most decent image editors have smoothing/interpolating filters to do this kind of resizing/resampling, e.g. <a href="http://www.irfanview.com/" rel="nofollow noreferrer">IrfanView</a> which gives you several options for interpolation filters. See <a href="http://en.wikipedia.org/wiki/Lanczos_resampling" rel="nofollo... | 47,392 |
<p>I am modifying some code and came across a declaration that I am having trouble understanding:</p>
<pre><code>int *userMask[3][4] = {0};
</code></pre>
<p>What exactly is this pointing to? Is it a matrix where every element is a pointer? Or is it pointing to a matrix of size [3][4]?</p>
<p>Thanks</p>
<hr>
<p>I... | <h2>Short answer</h2>
<p>Given userMask is declared as </p>
<pre><code>int *userMask[3][4];
</code></pre>
<p>then <code>userMask</code> has type <code>int*[3][4]</code>. It's a 2d array of pointers to int. The size of the outer dimension is 3, the size of the inner dimension is 4. Really that is nothing more than a... | <p>It is a matrix where every element is a pointer.</p>
<p>If it was pointing to a matrix of size [3][4] the code would have been </p>
<pre><code>int userMask[3][4]={0};
</code></pre>
| 34,636 |
<p>I currently have a 32 bit dll that was created with Visual Studio 2003 in C++ using <a href="http://en.wikipedia.org/wiki/Managed_Extensions_for_C%2B%2B" rel="nofollow noreferrer">Managed Extensions</a>. I'm now trying to compile a 64 bit version without having to upgrade to C++/CLI. I've been following the tutorial... | <p>Do you manually call the .dll file in the code? Like in this?</p>
<pre><code>#using "C:\Windows\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll
</code></pre>
<p>If so, you can change this line to just:</p>
<pre><code>#using "mscorlib.dll"
</code></pre>
| <p>Are you including a library that links to a different version of mscorlib?</p>
<p>Are you specifying both the /clr option and doing a #using "mscorlib.dll" ?</p>
| 33,224 |
<p>Having a bit of trouble with the syntax where we want to call a delegate anonymously within a Control.Invoke.</p>
<p>We have tried a number of different approaches, all to no avail.</p>
<p>For example:</p>
<pre><code>myControl.Invoke(delegate() { MyMethod(this, new MyEventArgs(someParameter)); });
</code></pre>
... | <p>Because <code>Invoke</code>/<code>BeginInvoke</code> accepts <code>Delegate</code> (rather than a typed delegate), you need to tell the compiler what type of delegate to create ; <code>MethodInvoker</code> (2.0) or <code>Action</code> (3.5) are common choices (note they have the same signature); like so:</p>
<pre><... | <p>I never understood why this makes a difference for the compiler, but this is sufficient.</p>
<pre><code>public static class ControlExtensions
{
public static void Invoke(this Control control, Action action)
{
control.Invoke(action);
}
}
</code></pre>
<p>Bonus: add some error handling, because i... | 31,550 |
<p>I am updating my rig and I need to make a decision between staying with XP x64 or going to Vista x64. I do very little development, really just building products from my developers. The other 90% of my work is done with Google Apps, Skype, Office, etc...</p>
<p>I want to upgrade to Vista not only because I will hav... | <p>I am fine with Vista 64 bits for .net and php.</p>
<p>A lot of conversation about it are already on SO. Here is some important point your might take in consideration <strong>for .Net</strong>:</p>
<ul>
<li><p><a href="https://stackoverflow.com/questions/208985/nunitexe-cannot-work-on-vista-64bits-if-x86-build">Uni... | <p>I'd say it depends on what you're developing. The first priority should be to make sure that all of your development and testing tools work properly under Vista x64. If they don't, there's no reason to suffer the pain of doing all your actual work in a virtual machine.</p>
<p>So I'd say the best thing to do is to... | 36,052 |
<p>Our topics page has been sorely lacking for a few years now, and in need of an update, in order to reflect what the site has become, and to take into account what people has been asking for. Note that, the core concept is still the same - 3D Printing. However, the scope has been widened in a number of ways/direction... | <p>I like the expanded definitions, but there is probably an issue with some of the things you'd put into "just rough around the edges" portion of what you state.</p>
<p>For instance, "Print Services" are mentioned as far as on-topic and what is allowed. <em>To what extent are Print Services</em> on-topic and allowed?... | <p>I like the expanded definitions, but there is probably an issue with some of the things you'd put into "just rough around the edges" portion of what you state.</p>
<p>For instance, "Print Services" are mentioned as far as on-topic and what is allowed. <em>To what extent are Print Services</em> on-topic and allowed?... | 68 |
<p>I am using .Net 2 and the normal way to store my settings. I store my custom object serialized to xml. I am trying to retrieve the default value of the property (but without reseting other properties). I use:</p>
<pre><code>ValuationInput valuationInput = (ValuationInput) Settings.Default.Properties["ValuationInput... | <p>BEX=Buffer overflow exception. See <a href="http://technet.microsoft.com/en-us/library/cc738483.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc738483.aspx</a> for details. However, c000000d is STATUS_INVALID_PARAMETER; the technet article talks primarily about status c0000005 or c000040... | <p>Most likely there is an addon that is messing with IE.</p>
<p>You can try this.
1. Open IE
2. Switch to the Advanced tab.
3. Click the Reset Internet Explorer Settings button.
4. Click Reset to confirm the operation.
5. Click Close when the resetting process finished.
6. Uncheck Enable... | 7,492 |
<p>I've heard that you need to get a Mac if you want to develop iPhone apps. Is this true? </p>
<p>Is it possible to develop iPhone apps using Linux? If yes, what do I need and where do I download the necessary tools?</p>
| <p>To provide a differing response, I'm running OS X and Xcode on a virtualised (VMware) machine on Linux. CPU is a Core2Quad (Q8800), and it is perfectly fast. I found a prebuilt VM online (I'll leave it to you to find)
Xcode/iPhone development works perfectly, as does debugging via USB to the phone itself.</p>
<p>... | <p>You will never get your app approved by Apple if it is not developed using Xcode. Never. And if you do hack the SDK to develop on Linux and Apple finds out, don't be surprised when you are served. I am a member of the ADC and the iPhone developer program. Trust, Apple is VERY serious about this.</p>
<p>Don't take t... | 34,929 |
<p>I'm trying to write an algorithm that will find the set of all vertices in a graph with degree smaller than their neighbors. My initial approach is to find the degree of each vertex, then work through the list, comparing the degree of each vertex with the degree(s) of its neighbors. Unfortunately, this looks like it... | <p>Perhaps "this looks like it could be very time consuming", but there is a better way of finding out :-)</p>
<p>Suppose you've stored your graph as an adjacency list. To find the set you're seeking, you necessarily have to look at all the edges, so we have a <strong>lower bound</strong> of Ω(|E|) for the algorithm. ... | <p>I would imagine a greedy approach for an undirected graph as follows:</p>
<pre><code>let Q = all nodes which haven't been checked (initialize all V)
let Q* = all nodes which satisfy the required condition (initialize to empty)
start with an arbitrary node, v in Q
while Q is not empty
let minDeg be the minimum d... | 36,556 |
<p>Are there instances where switch(case) is is a good design choice (except for simplicity) over strategy or similar patterns... </p>
| <p>Use Switches when you're testing on <em>values</em> of primitives. (ie. integers or characters).</p>
<p>Use polymorphism when you are choosing between different <em>types</em>.</p>
<p>Examples :
Testing whether a character the user has entered is one of 'a', 'b' or 'c' is a job for a switch. </p>
<p>Testing whet... | <p><strong>No</strong>, the switch statement is probably only a good design choice in simple situations. </p>
<p>Once you are passed a simple situation switch statements become very painful to keep updating and maintaining. This is part of the reason design patterns came about.</p>
| 43,591 |
<p>I have problem with starting processes in impersonated context in ASP.NET 2.0.</p>
<p>I am starting new Process in my web service code. IIS 5.1, .NET 2.0</p>
<pre><code>[WebMethod]
public string HelloWorld()
{
string path = @"C:\KB\GetWindowUser.exe";
ProcessStartInfo startInfo = new ProcessStartInfo();
... | <p>You have to put privileged code into the GAC (or run in Full trust).</p>
<p>The code in the GAC must assert the XXXPermission, where XXX is what ever permission you are requesting, be it impersonation, access to the harddrive or what have you.</p>
<p>You should revert the assert immediately afterwords.</p>
<p>You... | <p>What exactly are you trying to do? I can't quite see what the point of your code is in creating a different executable. It looks rather odd. Perhaps it would be more helpful to state the busines problem you are trying to solve first.</p>
| 45,588 |
<p>I'm trying to solve <a href="http://uva.onlinejudge.org/external/1/100.pdf" rel="noreferrer">the 3n+1 problem</a> and I have a <code>for</code> loop that looks like this: </p>
<pre><code>for(int i = low; i <= high; ++i)
{
res = runalg(i);
if (res > highestres)
... | <p>I'd try to declare <code>i</code> outside of the loop!</p>
<p>Good luck on solving 3n+1 :-)</p>
<p>Here's an example: </p>
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
int main() {
int i;
/* for loop execution */
for (i = 10; i < 20; i++) {
printf("i: %d\n", i);
... | <p>For Qt-creator: just add next lines to *.pro file...</p>
<pre><code>QMAKE_CFLAGS_DEBUG = \
-std=gnu99
QMAKE_CFLAGS_RELEASE = \
-std=gnu99
</code></pre>
| 4,451 |
<p>In an ASP.NET 3.5 site we have a relatively standard payment checkout progess that contains a number of pages that need to be visited in sequence (shopping basket, payment details etc)</p>
<p>Each page has a "Continue" button that redirects to the next page in the sequence.</p>
<p>I would like a way of managing th... | <p>Why not use the ASP.NET Wizard control?</p>
<p>Alternatively (and I haven't tried it so I can't say how well it works), you could use Windows Workflow to define a sequential workflow and let that control the order pages come up in. There's an article at <a href="http://www.devx.com/dotnet/Article/34732" rel="nofoll... | <p>Check the HttpRequest.UrlReferrer variable in each Page_Load method...</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx</a></p>
<p>... and don't forget to check ... | 41,957 |
<p>I have a delete statement that's going against one of my core application tables. The delete statement is using the table's primary key but is still taking around 30 seconds. As far as I can tell the execution plan needs to do about 12 checks in other tables where this table is a FK prior to doing the delete. I n... | <p>Make sure you have indexes on the FKs in the other tables. </p>
| <p>In the execution plan, which step is taking the majority pf the time? Also can you reRun the delete with "Set Statistics IO ON" and see which table/index has the highest logica reads against it. These two bits of data will be a helpful hint as to where you need to devote some attention.</p>
| 35,624 |
<p>I'm looking for some good resources to ramp up on the animation/storyboard concepts used in WPF/Silverlight. Any pointers?</p>
| <p>The one link posted was WPF specific. For Silverlight here are a few other resources.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/cc189019(VS.95).aspx" rel="nofollow noreferrer">MSDN Animation Overview</a></li>
<li><a href="http://blogs.msdn.com/silverlight_sdk/archive/2008/03/21/silverlight-anima... | <p><a href="http://dotnetslackers.com/articles/wpf/IntroductionToWPFAnimations.aspx" rel="nofollow noreferrer">This</a> site had some good resources that covered some of the information I was looking for. </p>
| 34,970 |
<p>I have to ship some groovy code to some users that have only java installed (no grooy, no $groovy_home, etc). I'm trying to invoke groovy from the commandline but I'm having no luck. Here's my bat file:</p>
<pre><code>java -classpath .;lib;bin;bin-groovy introspector.AclCollector
</code></pre>
<p>And here's my exc... | <p>I think you need to explicitly list the groovy jar in the classpath</p>
| <p>Watch out of [~]!</p>
<pre><code>java -cp .:~/path-to-groovy-all.jar YourClassName # does not work
java -cp ~/path-to-groovy-all.jar:. YourClassName # works
java -cp .:/full/path/to/goovy-all.jar YourClassName # works
</code></pre>
<p>In first line tilde is not processed by bash, and java can not understa... | 49,637 |
<p>Is it possible to use chapters in videos for the iPhone in an application?</p>
<p>For example:
I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s.</p>
<p>Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s... | <p>iPhone SDK 3.0+ has a new MPMoviePlayerController.initialPlaybackTime property for setting the time to start movie playback. This will be "rounded" to the nearest earlier keyframe time, so does not provide exact start positioning, but pretty close.</p>
| <p>This is definitely possible sending the non-documented message <strong>setCurrentTime</strong> to MPMoviePlayerController. It takes one parameter of type double which specifies the playback position in seconds. Find below a short example: </p>
<p>Extend the MPMoviePlayerController to avoid compiler warnings: </p>
... | 12,174 |
<p>When a site is used with URL <strong>test.com</strong> handlers are not fired. Whereas if the site is used with <strong>www.test.com</strong> the handlers work properly? The site is behind an ISA firewall. How should I fix this?</p>
| <p>There is an extensive discussion on URL rewriting on Scott Gu's <a href="http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx" rel="nofollow noreferrer">blog http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx</a></p>
| <p>Make sure DNS resolves both host names to the IP address of your ISA server.</p>
<p>Make sure the ISA server is configured to route both URLs to your server. </p>
<p>Configure your web site (IIS 5/6: Properties, Web Site, Advanced, Add) to accept the additional host header.</p>
<p>Consider configuring the ISA ser... | 37,764 |
<p>Is there a way to get the current xml data when we make our own custom XPath function (see here).</p>
<p>I know you have access to an <code>XPathContext</code> but is this enough?</p>
<p><strong>Example:</strong></p>
<p>Our XML:</p>
<pre><code><foo>
<bar>smang</bar>
<fizz>buzz</fiz... | <p>There is the classic 'ab' (apachebench) program. More power comes from <a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMmeter</a>. For server health, I recommend Munin, which can painlessly capture data from several systems and aggregate it on one page. </p>
| <p>Try <a href="http://www.nagios.org/" rel="nofollow noreferrer">Nagios</a>, it's the default tool to monitor servers. You can write plugins to report just about any data. </p>
| 9,486 |
<p>I am using .net2.0 and IIS6. </p>
<p>When using .net Forms Authentication: How to limit access to resources like pdf files to authenticated users only; so in order to access a file say mysite.com/mydoc.pdf they would have to be authenticated first (go through the login page)</p>
<p>It seems that by default only th... | <p>You have to configure IIS to process wildcard extensions. Thus .pdf & .html extensions will be authenticated. Here's how for IIS6:</p>
<p><a href="http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx" rel="nofollow noreferrer">http://professionalaspnet.com/archi... | <p>Do you have anonymous access turned off? if you just have Integrated Windows auth, it should block all access if you setup your web config with these settings</p>
<p>
</p>
| 34,286 |
<p>I have third-party workflow software (Captaris Teamplate) that's referencing an assembly from my project that's referencing other assemblies from our project solution all through the <a href="http://en.wikipedia.org/wiki/Global_Assembly_Cache" rel="nofollow noreferrer">GAC</a>. </p>
<p>When our application executes... | <p>If at all possible, avoid the GAC. It lends itself to DLL Hell. The VBAssembly may actually be unmanaged, and may have been removed from the <code>WINDOWS/system32</code> directory.</p>
| <p>A starting point is to try to use the <a href="https://stackoverflow.com/questions/221803/visual-studio-2008-clean-solution-option">'Clean Solution'</a> option and then build the solution.</p>
| 41,492 |
<p>I want to create a c# application with multiple windows that are all transparent with some text on.</p>
<p>The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?</p>
| <p>Just making the window transparent is very straight forward:</p>
<pre><code>this.BackColor = Color.Fuchsia;
this.TransparencyKey = Color.Fuchsia;
</code></pre>
<p>You can do something like this to make it so you can still interact with the desktop or anything else under your window:</p>
<pre><code>public const in... | <p>Thanks for the tips Jeff. Its still not quite what I'm after. I would effectively like the window to appear as if it was part of the desktop so icons could sit on top of my form.</p>
<p>Maybe there is a different way to do it. Can I actually draw text and graphics directly on to the desktop?</p>
| 13,908 |
<p>Is there any c library to get a video from the webcam on linux?</p>
| <p>A lot of us use <a href="http://opencv.willowgarage.com/wiki/">OpenCV</a> (cross-platform Computer Vision library, currently on v2.1)</p>
<p>The following snippet grabs frames from camera, converts them to grayscale and displays them on the screen:</p>
<pre><code>#include <stdio.h>
#include "cv.h"
#include "... | <p>Your best bet is probably: <a href="http://en.wikipedia.org/wiki/Video4Linux" rel="noreferrer">video4linux (V4L)</a></p>
<p>It's easy to use, and powerful. </p>
| 35,113 |
<p>I'm looking to create a Visual Studio 2008 template that will create a basic project and based on remove certain files/folders based on options the user enters.</p>
<p>Right now, I have followed some tutorials online which have let me create the form to query the user and pass the data into an IWizard class, but I ... | <p>In my experience, <code>ShouldAddProjectItem</code> only gets called for <em>folders</em> in the template project. As such, it's pretty much useless. </p>
<p>Instead, you would need to put code in your <code>ProjectFinishedGenerating</code> implementation that uses the VS API to remove ProjectItems.</p>
<p>In ther... | <p>If I understand correctly, you want to be able to determine whether or not you should add project items to a project.</p>
<p>If so, you can implement IWizard.ShouldAddProjectItem and return whether or not you want the file to be added or not.</p>
| 32,162 |
<p>INPUT</p>
<pre><code><logs>
<logentry revision="648">
<author>nshmyrev</author>
<date>2008-09-21T19:43:10.819236Z</date>
<paths>
<path action="M">/trunk/po/ru.pi</path>
</paths>
<msg>2008-09-21 Nickolay V. Shmyrev nshmyrev@yandex.ru * ru.po: Updat... | <p>Instead of checking out the project, <em>svn export</em> it. That gets rid of any svn metadata. Beyond that, I've gotta agree with acrosman's suggestion: build a script or purge files by hand.</p>
<p>I don't know about NetBeans and how much it auto-generates stuff that you may have included in svn, but in our proje... | <p>For large projects I generally write a script that checks out the project, removes any extra files (I generally remove any file from the production copy that is unneeded, like sql, setup scripts, etc.), and creates a tarball. </p>
<p>I then deploy the tarball to the staging server. Once we're happy with the condi... | 44,092 |
<p>I have a Java servlet which generates xml, translates it with an xslt stylesheet, and then displays the resulting HTML. This is the first time I've worked with xslt. What's a good way to debug xslt? I have (or can get) some sample XML files to apply the transform too. But I'm not really even sure of the syntax so so... | <p>Xalan should give you useful errors when you try to use an invalid XSLT. If you want something more powerful, one option for debugging XSLT is <a href="http://www.oxygenxml.com/" rel="noreferrer">Oxygen XML Editor</a>. It is integrated with Xalan and Saxon transform engines. Its debugging mode allows you to set b... | <p>Microsoft Visual Studio is also a great tool for xslt debugger. But you must install the </p>
| 26,886 |
<p>I have a ListView on a page that displays a list of widgets. When a user clicks on one of the items in the list, I want to display a <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx" rel="nofollow noreferrer">ModalPopup</a> that contains controls allowing the user to operate on... | <p>When I need to pass data from client to server in ASP.NET AJAX, I generally use an asp:HiddenField with runat="server". Both can see it freely, but beware potential postback asynchronicity.</p>
<p>Sounds like you need to notify the server the widget was clicked - You may use a Timer to postback; or I'd go with opti... | <p>When I need to pass data from client to server in ASP.NET AJAX, I generally use an asp:HiddenField with runat="server". Both can see it freely, but beware potential postback asynchronicity.</p>
<p>Sounds like you need to notify the server the widget was clicked - You may use a Timer to postback; or I'd go with opti... | 31,415 |
<p>My organization is considering using Jabber as an agnostic device to device to application messaging protocol.</p>
<p>Does anyone know of the best practice existing Microsoft competitor to Jabber? Or, an emerging competitor? And, if so, a good URL reference to get a jump start?</p>
<p>Website for Jabber:
<a href... | <p>Jabber is several things : the older name of the Extensible Messaging and Presence Protocol (XMPP), the jabber server and application, and the jabber network.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms731082.aspx" rel="nofollow noreferrer">Windows Communication Foundation</a> is a web-service based... | <p>Check out Coversant's XMPP server/client: <a href="http://www.coversant.com" rel="nofollow noreferrer">Coversant SoapBox Studio</a>
They also have an SDK that will allow you to customize their server and build your own clients.</p>
<p>Another alternative is AGS-XMPP <a href="http://www.ag-software.de" rel="nofollo... | 25,393 |
<p>I've more than one ASP.NET 2.0 web site on IIS 6 and Windows Server 2003.
Each site reference some DLLs: design, logic and so on.
Each site is on a different ApplicationPool with default configuration about recycling techniques.</p>
<p>Every DLL is strong named (not delayed) and has a version that never changes (2.... | <p>It's not <i>exactly</i> the same, but 10 point Monaco (with anti-aliasing turned off) is pretty darn close. I'd say it's actually a little better, because Monaco's 1/l and O/0 glyphs are more distinct than the X font's.</p>
| <p>Try andale mono without anti-aliasing... it looks good on my mac pro 15in</p>
| 49,752 |
<p>If you are printing an object that has a base (A statue or trophy, for example), and presuming that you have already optimized every other setting: which shape of base would give you the best and most consistent bed adhesion when using PLA on the widest range of printers (For example, if you're putting it up on a si... | <p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d... | <p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d... | 2,046 |
<p>I'm relatively new to Threading in Java and I've noticed that everytime I use Thread.sleep() I have to catch InterrupetdException.</p>
<p>What kind of behaviour causes this, and in simple applications where I have a monitor thread can I just Ignore the exception?</p>
| <p>It happens when something calls <a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#interrupt()" rel="noreferrer">interrupt()</a> on the thread. <a href="http://www.ibm.com/developerworks/java/library/j-jtp05236.html" rel="noreferrer">This article by Brian Goetz</a> explains the interruption mechan... | <p>Well if some other Thread calls thread.interupt(), while the thread is sleeping, you'll get the Exception. And yes, you can probably just put try..catch arround the sleep() and ignore it ;)</p>
| 27,835 |
<p>I am trying to reduce the load on my webservers by adding an "Image server" (a dedicated server for handling image requests), and redirecting all requests for .gif,.jpg,.png etc., to it.</p>
<p>My question is, what is the best way to handle the redirection?</p>
<ul>
<li>At the firewall level? (can I do this using... | <p>The further up the chain you can do it, the better. </p>
<p>Ideally, do it at the DNS level by using a different domain for your images (eg imgs.example.com)</p>
<p>If you can afford it, get someone else to do it by using a CDN (Content delivery network).</p>
<p>-Update-</p>
<p>There are also 2 featuers of apach... | <p>i agree with rikh. If you want images to be served from a different webserver, then serve them on a different web-server. For example:</p>
<pre><code><IMG src="images/Brett.jpg">
</code></pre>
<p>becomes</p>
<pre><code><IMG src="http://brettnesbitt.akamia-technologies.com/images/Brett.jpg">
</code></p... | 48,646 |
<p>Debugging in visual studio seems to have been broken with sp1.
Single stepping randomly does not work and just starts to run. Sometimes breakpoints are ignored. It is unpredictable and unusable. It will generally hit the first break point but after that it is totally unpredictable. </p>
<p>Any idea what needs to b... | <p>Make sure you are debuging using the debug configuration, not the release one. Also make sure optimizations are disabled in debug configuration.</p>
<p>Optimizations must be off when you debug else it can lead to very erratic behaviours like these.</p>
<hr>
<p>For C# projects, which I am assuming the question is ... | <p>We are using c# as a language.</p>
<p>The problem has been identified by microsoft.</p>
<p>quote from forums:</p>
<blockquote>
<p>We have identified the root cause of this issue and are currently working on a solution. We apologize for the inconvenience that this is causing you. We will let you know as soon as ... | 4,305 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.