instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've been fighting on and off with issues with my build plate seemingly not being perfectly flat. I've ordered a machined straight-edge and some new feeler gauges to diagnose the problem (and test any potential replacement) better, but I'd like to get an idea of what options are available for obtaining a flatter bui... | <h2>It all depends on what you mean by "flat".</h2>
<p>Is the problem that the build plate isn't flat (perfectly planar), or is the problem that the distance to the build plate varies based on X and Y coordinates? They are very different problems.</p>
<p>"Bed Leveling" is the process of allowing the firmware to know... | <p>For evaluating the extent of a surface flatness problem and success of a solution, a real machined straightedge and decent feeler gauges are a huge help.</p>
<p>Using them to measure where the problem was, I found that a not-perfectly-flat but non-rigid build surface like the one I have can be corrected with shims,... | 1,589 |
<p>Does anyone know how could I programatically disable/enable sleep mode on Windows Mobile?</p>
<p>Thanks!</p>
| <p>If you want your program to not be put to sleep while it's running, the best way is to create a KeepAlive type function that calls SystemIdleTimerReset, SHIdleTimerReset and simulates a key touch. Then you need to call it a lot, basically everywhere.</p>
<pre><code>#include <windows.h>
#include <commctrl.... | <p>Probably by modifying the "System Power States" as <a href="http://www.codeproject.com/KB/mobile/WiMoPower1.aspx" rel="nofollow noreferrer">described here</a> (but in c#)</p>
<p>That article also describes a way to prevent the mobile device to sleep (which is not exactly what you may want), by calling the native fu... | 30,582 |
<p>How do I increase the maxPoolSize in Grails when using mysql? It appears to be using a default connection pool only 8 connections. </p>
| <p>Unfortunately you will need to configure the dataSource spring bean for yourself if you want to gain more control over it. This can be done by defining the bean in "grails-app/conf/spring/resources.groovy"</p>
<pre><code>beans = {
dataSource(org.apache.commons.dbcp.BasicDataSource) {
driverClassName = "co... | <p>For grails 1.2 you should use a little bit different format:</p>
<pre><code>dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost/yourDB"
driverClassName = "com.mysql.jdbc.Driver"
username = "yourUser"
password = "yourPassword"
properties {
maxActive = 50
... | 49,292 |
<p>It seems that Groovy does not support <code>break</code> and <code>continue</code> from within a closure. What is the best way to simulate this?</p>
<pre><code>revs.eachLine { line ->
if (line ==~ /-{28}/) {
// continue to next line...
}
}
</code></pre>
| <p>You can only support continue cleanly, not break. Especially with stuff like eachLine and each. The inability to support break has to do with how those methods are evaluated, there is no consideration taken for not finishing the loop that can be communicated to the method. Here's how to support continue --</p>
... | <p>In this case, you should probably think of the <code>find()</code> method. It stops after the first time the closure passed to it return true.</p>
| 25,195 |
<p>I'm attempting to make a DTS package to transfer data between two databases on the same server and I'm getting the following errors. Iv read that the Multiple-step OLE DB operation generated error can occur when you are transferring between different database types and there is loss of precision, but this is not tha... | <p>Take a look at the fields's proprieties (type, length, default value, etc.), they should be the same.</p>
<p>I had this problem with SQL Server 2008 R2 because the fields's length are not equal.</p>
| <p>This error will also occur when trying to do an insert and a field is coded not null and nulls are trying to be inserted.</p>
| 7,474 |
<p>I realized the solution to this problem while I was creating the documentation to ASK this question...so I am posting the answer if for no other reason than to keep me from wasting time on this in the future</p>
| <p><code>toggle()</code> is pretty buggy at times, i've had it do odd things to checkmarks (unchecking them) and other assorted issues. i'd suggest just handling it using a click event, much less minor annoyances. and this way, you don't have to worry about what state <code>#lowerDiv</code> is in in the first place:</p... | <p>I know this is a really old question, but just for people that are looking for a quick fix this worked for me:</p>
<p>a. in the PHP/HTML file:</p>
<pre><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/.../jquery.min.js"></script>
<script>
$(document).ready(function(){
... | 36,699 |
<p>Anyone using WPF for real LOB applications?</p>
<p>We have all seen the clever demos of WPF showing videos mapped onto 3D elements. These look great but what about the real world of line-of-business applications that make up the majority of developers efforts. Is WPF just for nice eye candy?</p>
| <p>While we discussing it, smart guys are building amazing apps:</p>
<p><a href="http://channel9.msdn.com/shows/Continuum/LawsonSmartOffice/" rel="nofollow noreferrer">Lawson Smart Office brings WPF goodness to the enterprise</a></p>
<p><a href="http://windowsclient.net/learn/video.aspx?v=48556" rel="nofollow norefer... | <p>I feel the eye candy demos are targeted mostly towards designers. Having said that, there is a huge potential in improving usability of LOB apps using WPF. <a href="http://www.ddj.com/windows/210300284" rel="nofollow noreferrer">Check this article about the potential of Silverlight</a>.</p>
<p><em>Line-of-business ... | 8,716 |
<p>I'm looking for a way to give out preview or demo versions of our software to our customers as easy as possible.</p>
<p>The software we are currently developing is a pretty big project. It consists of a client environment, an application server, various databases, web services host etc.
The project is developed inc... | <p>Since you're looking at an entire application stack, you'll need to virtualize the entire server to provide your customers with a realistic demo experience. Thinstall is great for single apps, but not an entire stack....</p>
<p>Microsoft have licensing schemes for this type of situation, since it's only been used f... | <blockquote>
<p>Thinstall is great for single apps, but not an entire stack....</p>
</blockquote>
<p>I didn't try it yet, but with the new version of thinstall you are able to let different thinstalled application communicate.
But I guess you're right a vm-ware image would be easier</p>
| 4,955 |
<p>I have a project where a .master page was created without a code behind page. Now I want to add a code behind page for this .master page and move the "in page" code to the code behind file. What is the best/easiest way to go about doing this? I'm using Visual Studio 2008.</p>
| <p>Create new class file, name it yourmaster.master.cs (Visual Studio will automaticly group it with the .master) and move the code to it, reference it in your masterpage.</p>
<p>Then rightclick on your project and click "Convert to Web Application" and Visual Studio will create the designer file.</p>
| <p>One way to do it, is to create a new empty masterpage/aspx-file and then copy-paste the code you allready have into that page. That will take care of all the wire-up and creating of code-files.</p>
| 6,914 |
<p>I need to pack all my js, but need to edit it going into source control.</p>
<p>is there a nice easy plugin for ccnet, or nant, that will allow me to pack my js, and store them in the same files on the way out to production.</p>
<p>Not really looking for file combining, just minifying each file.</p>
| <p>Here is the best answer I have found. It calls the YUI version of minify and just uses plain old Nant to do so and replace the existing js files with the minifyed ones.</p>
<p><a href="http://codeclimber.net.nz/archive/2007/08/22/How-to-use-YUI-JS-Compressor-inside-a-NAnt-build.aspx" rel="nofollow noreferrer">http:... | <p>I built my own Nant task off of this one.</p>
<p><a href="http://www.nabble.com/Re:-All-.js-files-into-1-p19593677.html" rel="nofollow noreferrer">http://www.nabble.com/Re:-All-.js-files-into-1-p19593677.html</a></p>
| 32,312 |
<p>On my main form, there is another (floatable) window. This floatable window works sort of like a popupwindow in that it will close when the user clicks somewhere else outside of this window. This is handled by the Deactivate event. But what I want to do is, if the user clicks on a different control (say a button), I... | <pre><code>foreach(Control c in parentForm.Controls)
{
c.Click += delegate(object sender, EventArgs e)
{
if(floatyWindow != null && floatyWindow.IsFloating)
{
floatyWindow.Close();
}
};
}
</code></pre>
<... | <p>I had a slightly hacky solution. In your Deactivate event, fire another custom event to your main form. Then when you main form is handling the custom event, enumerate through your control(this.Controls) and locate the control under the mouse by checking all their bound then call Focus(). You might need to sort by t... | 47,740 |
<p>I want to use Google spreadsheets to store data online so multiple people can enter and maintain data, then publish or export (csv, xls, ods) the sheet for their application. What is the easiest way to process the sheet? If the data can be accessed as a link the updates could be immediately reflected in the client's... | <p>This article <a href="http://ouseful.wordpress.com/2008/10/14/data-scraping-wikipedia-with-google-spreadsheets/" rel="nofollow noreferrer">Data Scraping Wikipedia with Google Spreadsheets</a> discusses using Google spreadsheets as an application platform.</p>
<p>It already has features that allow you to share the s... | <p>I think if I am clear on your requirements, you want to store your data online in a Google Spreadsheet where multiple people can access that right? Then you want an app to use that data? Correct me if I am wrong. </p>
<p>It is possible to have Google spreadsheet as a database and the client app can directly access ... | 30,317 |
<p>I have an asp.net application that should access data from two SQL Servers. One of the SQL Servers is present on the same machine as IIS (let us call it SQLSERVER1) whereas the other SQL server is present on another machine (SQLSERVER2).</p>
<p>The connection strings are trusted for both the SQL servers. Impersonat... | <p>This is absolutely a <strong>delegation</strong> problem. As one person pointed out, you need to make sure <a href="http://en.wikipedia.org/wiki/Kerberos_(protocol)" rel="nofollow noreferrer">Kereberos</a> authentication is being used. The old style <a href="http://en.wikipedia.org/wiki/NTLM" rel="nofollow norefer... | <p>Your authentication to the webserver is not passed through to the sql server. The web server is authenticating to the SQL Server using the account that your application pool is running under.</p>
| 23,184 |
<p>This might seem obvious but I've had this error when trying to use LINQ to SQL with my business logic in a separate class library project. </p>
<p>I've created the DBML in a class library, with all my business logic and custom controls in this project. I'd referenced the class library from my web project and att... | <p>The LINQ designer ads the connection string to the app.config of the class library, but the web site needed to see it in the web.config of the web project. Once copied across all was well.</p>
| <p>you can pass in a connection or connection string to the data context as well.</p>
| 12,310 |
<p>Is it possible to have a post-mortem ( or post-exception ) debugging session in Java ? What would the workarounds be ( if there isn't a solution for this already ) ?</p>
| <p>You can attach the debugger to a java process and set a breakpoint when a specific
exception is received. Is this what you need?</p>
<p>From
<a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html</a></p>
<blo... | <p>As far as I know, you'd have to wait for Java 7 for an official API - see <a href="http://tech.puredanger.com/java7#jsr326" rel="nofollow noreferrer">http://tech.puredanger.com/java7#jsr326</a>.</p>
<p>In the meantime, you could substitute Exception (replace base class, inject code via instrumentation, etc) to keep... | 40,640 |
<p>Does anyone know a good resource to concisely explain the different types of lists available in C# and when their usage is appropriate?</p>
<p>For example, List, Hashtable, Dictionaries etc.</p>
<p>I'm never quite sure when I should be using what.</p>
| <p>These aren't all lists, although they're all collections. Here's a quick summary.</p>
<p><strong>Non-generic collections (API is in terms of <code>object</code>. Values types are boxed.</strong></p>
<p>These are mostly in the <a href="http://msdn.microsoft.com/en-us/library/system.collections.generic.aspx" rel="no... | <p>Intellisense will show you a short description of each if you just type <code>System.collections.Generic.</code> into a code window. Don't forget the trailing period. Oh, and there's also <code>System.Collections.ObjectModel.</code>. From there you should be able to get more info on anything that looks promising ... | 24,120 |
<p>I have a very large background image (about 940x940 pixels) and I'm wondering if anyone has tips for compressing a file this large further than Photoshop can handle? The best compression without serious loss of quality from Photoshop is PNG 8 (250 KB); does anyone know of a way to compress an image down further tha... | <p>Have a look at <a href="http://www.irfanview.com/" rel="noreferrer">http://www.irfanview.com/</a>, is an oldy but a goody. </p>
<p>Have found this is able to do multipass png compression pretty well, and does batch processing way faster than PS. </p>
<p>There is also PNGOUT available here <a href="http://advsys.... | <p>PNG images are already compressed internally, in a manner that doesn't benefit from more compression much (and may actually expand if you try to compress it).</p>
<p>You can:</p>
<ul>
<li>Reduce the resolution from 940x940 to something smaller like 470x470.</li>
<li>Reduce the color depth</li>
<li>Compress using a... | 41,296 |
<p>We're currently using Lucene 2.1.0 for our site search and we've hit a difficult problem: one of our index fields is being ignored during a targeted search. Here is the code for adding the field to a document in our index:</p>
<pre><code>// Add market_local to index
contactDocument.add(
new Field(
"mark... | <p>For debugging Lucene, the best tool to use is <a href="http://www.getopt.org/luke/" rel="noreferrer">Luke</a>, which lets you poke around in the index itself to see what got indexed, carry out searches, etc. I recommend downloading it, pointing it at your index, and seeing what's in there.</p>
| <p>Another simple thing to do would be to use a debugger or logging statement to check the value of </p>
<blockquote>
<p>StringUtils.objectToString(currClip.get("market_local"))</p>
</blockquote>
<p>to make sure it is what you think it is.</p>
| 6,412 |
<p>I am trying a straightforward remote json call with jquery. I am trying to use the reddit api. <a href="http://api.reddit.com" rel="nofollow noreferrer">http://api.reddit.com</a>. This returns a valid json object.</p>
<p>If I call a local file (which is what is returned from the website saved to my local disk) thin... | <p>The URL you are pointing to (www.redit.com...) is not returning JSON! Not sure where the JSON syndication from reddit comes but you might want to start with the example from the <a href="http://docs.jquery.com/Ajax/jQuery.getJSON" rel="nofollow noreferrer">docs</a>:</p>
<pre><code>$(document).ready(function() {
$... | <p>I'm not sure about reddit.com, but for sites that don't support the JSONP idiom you can still create a proxy technique (on the backend) that would return the reddit JSON, and then you would just make an ajax request to that that. </p>
<p>So if you called <a href="http://mydomain.com/proxy.php?url=http://api.reddit.... | 49,477 |
<p>If I need to 3D print a hollow box that can not have any light permeating into the box, what would be the best course of action? Should I 3D print the hollow box as a whole or print out the 6 sides individually and put them together at the end? And if I do the second option, what would be the best way to put the pie... | <p>That depends very much on what your goal is with the box. If it needs to be hollow and you don't need any access to the inside (and also prefer it to be printed in one piece) than the answer provided by user77232 would probably be the best.</p>
<p>Alternatively, if you need access to the inside of the box you would ... | <ol>
<li>Print it as a whole object</li>
<li>Use 20% infill.</li>
<li>Profit!</li>
</ol>
| 1,738 |
<p>I know that in C#, if you write <code>~MyClass()</code>, this basically translates to <code>override System.Object.Finalize()</code>. So, whether you write the <em>destructor</em> or not, every type in CLR will have a <code>Finalize()</code> method in it (of <code>System.Object</code> at least).</p>
<p>1] So, does ... | <p><strong>Questions 1 and 2</strong>: The CLR basically checks whether or not the finalizer is overridden. If it's not, it treats it as not having a finalizer.</p>
<p>The benefit of having a finalizer in System.Object is that compilers know they can <em>always</em> put a call to <code>base.Finalize()</code> in. This ... | <p>1) Yes (by virtue of inheritance)</p>
<p>2) Nothing is holding a reference to the instance of a class (that will make it eligible for finalization)</p>
<p>3) Yes (why should one implement IDisposable unless it is requiring the user to explicitly call dispose? Connection classes in .net use an umanaged resource und... | 46,776 |
<p>I would like to know if you guys have any suggestions about debug levels when writing an application.</p>
<p>I thought about 4 levels:</p>
<p>0 : No Debug<br>
1 : All inputs and outputs<br>
2 : "I am here" notification from significant functions with main parameters<br>
3 : All variables verbose</p>
| <p>Here's what we did in one project I worked on. It's not the bible of logging levels, just one possibility. Logging should be fitted to your situation.</p>
<ul>
<li>LOG_SEVERE, severe errors that require program exit (e.g., in an application, you ran out of disk space).</li>
<li>LOG_ERROR, error messages that can't ... | <p>What is really most important with different levels of logging is that all developers are using the same definitions.</p>
<p>I've seen examples of developers logging an Error from a tcp package when failing to deliver a packet even though that is handled and a resend is done by the caller.<br>
The developer in ques... | 40,259 |
<p>After deploying a new build (mostly changed DLL's) of an ASP.NET web app the CPU on the server is now jumping to 100% every few seconds and the culprit is lsass.exe. Do you think that the deployment of the asp.net web app to the server and this problem are related? (or a coincidence that it happened at the same time... | <p>I eventually isolated the problem to an ASP forum running "under" that ASP.NET web app. Using the admin page on the forum I took the forum down and then brought it back up again and the problem disappeared. I find this very frustrating because the problem has now gone but I don't know what caused it and as such it c... | <p>Have you checked the System and Application event logs for anything unusual?</p>
| 34,791 |
<p>I am dynamically creating a table which I want to have clickable rows. When the user clicks on one of the rows I want to redirect to a page specific to the item of that row. My question is how on the server side can I wire the "onclick" event to a routine that will then allow me to build a url based on some of the... | <p>It sounds like your actual goal is simply to display/edit the row on another page. If this is the case, you could simply add a javascript event handler to the table row when you create it.</p>
<pre><code><tr onclick="window.location='DetailPage.aspx?id=<%= IdFromDb %>'">
<!-- etc......-->
<... | <p>In your click event handler, you cast the sender as button, then get its parents until you get to the TableRow, then do a FindControl() to find the control with the value specific to that row and use it to build your URL!</p>
<p>Good luck!</p>
| 41,642 |
<p>I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:</p>
<p>You can <a href="http://eclipsesnippets.blogspot.com/2007/07/tip-creating-and-sharing-launch.html" rel="noreferrer">save run configurations in a <code>.launch</code> fi... | <p><a href="http://ant4eclipse.sourceforge.net/ant-for-eclipse-reference-launch.html" rel="nofollow noreferrer">Ant4Eclipse</a> may provide a good starting point on how to do this. </p>
<p>Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin ... | <p>I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.</p>
<p><a href="http://www.eclipse.org/articles/Article-PDE-Auto... | 27,394 |
<p>I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:</p>
<pre><code>sum(reviews.rev_rating)/count(reviews.rev_id) as avg_ratin... | <p>You could use a HAVING clause, which <em>can</em> see the aliases, e.g.</p>
<pre><code> HAVING avg_rating>5
</code></pre>
<p>but in a where clause you'll need to repeat your expression, e.g. </p>
<pre><code> WHERE (sum(reviews.rev_rating)/count(reviews.rev_id))>5
</code></pre>
<p>BUT! Not all expressions w... | <p>If your query is static, you can define it as a view then you can use that alias in the where clause while querying the view.</p>
| 24,412 |
<p>I have a computer at home which I can't access from work. I'd like to be able to view results from work that my home computer produces. The best idea I've come up with is an automated script running on my home computer that emails myself the results (from a text file or stderr/out) when complete. </p>
<p>I'm dec... | <p>On any Linux I have used the mail sending from command-line is simple:</p>
<pre><code>mail -s "My subject here" recipient@wherever.com <message_body.txt
</code></pre>
<p>AFAIK this acts as a front-end to sendmail, and you have to have sendmail configured to forward the messages to your ISP mail server. </p>
| <p>Traditionaly, with unix systems like Linux, you'd have an MTA, a mail transfer agent, on the computer that deals with sending e-mail.</p>
<p>This could be a full blown e-mail server like exim, or something simple like ssmtp that just sends messages on to a relaying SMTP server such as would be provided by your ISP.... | 33,509 |
<p>I want to pass in the tType of a class to a function, and the class object to a generic function.</p>
<p>I need to be able to cast to that Type (of class) so I can access the class's methods.</p>
<p>Something like:</p>
<pre><code>void GenericFunction(Object obj, Type type)
{
(type)obj.someContainer.Add(1);
}
... | <p>Here's three ways to go about what you're asking:</p>
<pre><code>public interface ICanReport
{ void Report(); }
public class SomeThing : ICanReport
{
public void Report()
{ Console.WriteLine("I'm SomeThing"); }
}
public class SomeOtherThing : ICanReport
{
public void Report()
{ Console.WriteLine("... | <p>Can you use generics in your method call? Something like:</p>
<pre><code>void GenericFunction<T>(Object obj)
where T : class {
obj.someContainer.Add(1) as T;
}
</code></pre>
<p>Hope that helps!</p>
| 41,167 |
<p>I would like to include a different file depending on the version of GCC. More precisely I want to write:</p>
<pre><code>#if GCC_VERSION >= 4.2
# include <unordered_map>
# define EXT std
#elif GCC_VERSION >= 4
# include <tr1/unordered_map>
# define EXT std
#else
# include <ext/hash_map>... | <p>There are a number of macros that should be defined for your needs:</p>
<pre><code>__GNUC__ // major
__GNUC_MINOR__ // minor
__GNUC_PATCHLEVEL__ // patch
</code></pre>
<p>The version format is major.minor.patch, e.g. 4.0.2</p>
<p>The documentation for these can be found <a href="http://gcc.g... | <p>As a side note:</p>
<p>To find all the predefined macros:</p>
<ul>
<li>Create empty file t.cpp</li>
<li><code>g++ -E -dM t.cpp</code></li>
</ul>
| 32,383 |
<p>How can I get <a href="http://search.cpan.org/perldoc?LWP" rel="noreferrer">LWP</a> to verify that the certificate of the server I'm connecting to is signed by a trusted authority and issued to the correct host? As far as I can tell, it doesn't even check that the certificate claims to be for the hostname I'm conne... | <p>This long-standing security hole has finally been fixed in version 6.00 of <a href="https://metacpan.org/release/libwww-perl" rel="noreferrer">libwww-perl</a>. Starting with that version, by default <a href="https://metacpan.org/pod/LWP::UserAgent" rel="noreferrer">LWP::UserAgent</a> verifies that HTTPS servers pre... | <p>Just perform execute the following command in Terminal:
<strong>sudo cpan install Mozilla::CA</strong></p>
<p>It should solve it.</p>
| 9,999 |
<p>OK, another road bump in my current project.</p>
<p>I have never had form elements in <strong>both</strong> my master and content pages, I tend to have all the forms in the content where relevant.</p>
<p>In the current project however, we have a page where they want both. <strong>A login form at the top right, and... | <p>Thought I would review some of my outstanding questions and see if I can close some of them off.</p>
<p>This one was an interesting one. I outright refused to believe you can only have one form on an ASP.NET page. This to me made no sense. I have seen plenty of webpages that have more than one form on a web page, <s... | <p>no, you can only have one asp.net form per page.
That has been the rule since 1.0</p>
<p>They should both share the same form</p>
| 21,500 |
<p>What is the best way to use ResolveUrl() in a Shared/static function in Asp.Net? My current solution for VB.Net is:</p>
<pre><code>Dim x As New System.Web.UI.Control
x.ResolveUrl("~/someUrl")
</code></pre>
<p>Or C#:</p>
<pre><code>System.Web.UI.Control x = new System.Web.UI.Control();
x.ResolveUrl("~/someUrl");
<... | <p>I use <a href="http://msdn.microsoft.com/en-us/library/system.web.virtualpathutility.aspx" rel="noreferrer">System.Web.VirtualPathUtility.ToAbsolute</a>.</p>
| <p>I tend to use HttpContext.Current to get the page, then run any page/web control methods off that.</p>
| 4,637 |
<p>I have two dedicated servers and no hardware firewall. I'd like to forward all requests that come into the primary server on port 1008 to be fulfilled by another dedicated server on the same network. I know I need to set up some kind of TCP proxy, but I first heard of IPTables yesterday. Any quick tips?</p>
| <p>The easiest way is to use something which is just a TCP proxy. It is possible to achieve this using iptables, but not easy.</p>
<p>It is easy to forward requests from A intended for B to C (using DNAT) but harder to get C's responses to go back to A via B (because DNAT does not change the sender address). A would t... | <p>First off I would recommend you get a firewall in place. I've used <a href="http://www.shorewall.net/" rel="nofollow noreferrer">Shorewall</a> for a long time to manage iptables and it is pretty easy to configure. Second if you use something like Shorewall there are easy <a href="http://www.shorewall.net/two-interfa... | 42,514 |
<p>So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display properly. The problem t... | <p>I also had trouble activating and bringing a window to the foreground. Here is the code that eventually worked for me. I'm not sure if it will solve your problem.</p>
<p>Basically, call ShowWindow() then SetForegroundWindow().</p>
<pre><code>using System.Diagnostics;
using System.Runtime.InteropServices;
// Sets ... | <p>You shouldn't need to import any win32 functions for this. If .Focus() isn't enough the form should also have a .BringToFront() method you can use. If that fails, you can set it's .TopMost property to true. You don't want to <em>leave</em> it true forever, so then call Application.DoEvents so the form can process... | 6,807 |
<p>I am using LightBurn to laser engrave on wood. I am just trying to print some letters. </p>
<p>In the softwares preview the output looks correct. The black part is where the laser should burn and the red part are traversal/scan lines
<a href="https://i.stack.imgur.com/nLs8P.png" rel="nofollow noreferrer"><img src="... | <p><code>M42</code> command is an immediate command. This means that it will run before the move GCode commands finish. This is exactly what I was facing. </p>
<p>This video has the walk-through of solving the issue: <div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://ww... | <p>This is too long for a good comment but may fall short of being a true answer. If the mods prefer, I can recast it as a set of comments.</p>
<p>There are several differences between using a GPIO pin as a binary data pin and using one as a PWM pin, and the behavior depends on several factors:</p>
<ol>
<li>Is the P... | 1,321 |
<p>I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus.</p>
<p>I did read through <a href="https://stackoverflow.com/questions/177799/what-is-a-good-pdf-report-generator-tool-for-python">this ... | <p>For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to <a href="http://www.reportlab.org/downloads.html" rel="nofollow noreferrer">ReportLab</a> (which I had initially avoided for r... | <p>Is the reportlab code not ok? The reason why using LaTeX might not be overkill is because pdf is a really low-level format. In pdf you do not get line-breaks automatically, you have to calculate line-widths yourself.</p>
| 35,253 |
<p>Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service's session when the service is started? Logging in as the service user and creating a persistent mapping will not establish the mapping in the context of the actual servi... | <p>Use this at your own risk. (I have tested it on XP and Server 2008 x64 R2)</p>
<p>For this hack you will need <a href="http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx" rel="noreferrer">SysinternalsSuite by Mark Russinovich</a>:</p>
<p><strong>Step one:</strong>
Open an elevated cmd.exe prompt (Run as... | <p>Instead of relying on a persistent drive, you could set the script to map/unmap the drive each time you use it:</p>
<pre><code>net use Q: \\share.domain.com\share
forfiles /p Q:\myfolder /s /m *.txt /d -0 /c "cmd /c del @path"
net use Q: /delete
</code></pre>
<p>This works for me.</p>
| 22,091 |
<p>In C# documentation tags allow you to produce output similar to MSDN. What are a list of allowable tags for use inside the /// (triple slash) comment area above classes, methods, and properties?</p>
| <p>Check out <a href="http://web.archive.org/web/20100118163744/http://thoughtpad.net/alan-dean/cs-xml-documentation.html" rel="noreferrer">Great documentation on the various C# XML documentation tags.</a> (Go to the bottom to see the tags)</p>
| <p>Look inside the docs for <a href="http://blogs.msdn.com/sandcastle/" rel="nofollow noreferrer">Sandcastle</a>. This is the new documentation standard for .NET.</p>
| 9,160 |
<p>The renewal wizard doesn't seem to ask for a renewal period.</p>
| <p>I think the Cerficate Supplier sets the renewal period. So it depends on the type of Cert you buy (or the setup of your certification service).</p>
| <p>The expiration date of the certificate you buy/create would define that</p>
| 36,325 |
<p><a href="https://www.thingiverse.com/thing:4195002" rel="nofollow noreferrer">A part</a> I've printed (on a Monoprice Maker Select V2, sliced with Cura) has a small peg on it, which is an unsupported overhanging section of the model.</p>
<p>The first few layers of the peg end up a mess of PLA spaghetti. Here I've r... | <p>Unsupported parts need to be printed with support. If your supports are too hard to remove, try the Tree Support setting and make sure that your support structure is set up with a gap to the actual print. As we don't know which slier you use, I can't go into more details here.</p>
| <p>You could try printing slower and/or increase cooling ( possibly even a cooler bed temp) if you absolutely want to avoid supports, or just use supports with a support interface and tweak support distance.</p>
| 1,605 |
<p>What's an example of something dangerous that would not be caught by the code below?</p>
<p>EDIT: After some of the comments I added another line, commented below. See Vinko's comment in David Grant's answer. So far only Vinko has answered the question, which asks for specific examples that would slip through th... | <h2>It's never enough – whitelist, don't blacklist</h2>
<p>For example <code>javascript:</code> pseudo-URL can be obfuscated with HTML entities, you've forgotten about <code><embed></code> and there are dangerous CSS properties like <code>behavior</code> and <code>expression</code> in IE. </p>
<p>There are <a h... | <p>Another vote for whitelisting. But it looks like you're going about this the wrong way. The way <em>I</em> do it, is to parse the HTML into a tag tree. If the tag you're parsing is in the whitelist, give it a tree node, and parse on. Same goes for its attributes.</p>
<p>Dropped attributes are just dropped. Everythi... | 23,772 |
<p>I would like to keep the overhead at a minimum. Right now I have:</p>
<pre><code>// Launch a Message Box with advice to the user
DialogResult result = MessageBox::Show("This may take awhile, do you wish to continue?", "Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Exclamation);
// The test will only be launc... | <p>You can use "OK" and "Cancel"</p>
<p>By substituting <code>MessageBoxButtons::YesNo</code> with <code>MessageBoxButtons::OKCancel</code></p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxbuttons.aspx" rel="nofollow noreferrer">MessageBoxButtons Enum</a></p>
<p>Short of that yo... | <p>From everything I can find it looks like <a href="https://stackoverflow.com/users/1736/corin">Corin</a> is right. Here is the code that I used to accomplish the original goal. I am not usually a Managed C++ programmer, so any editing would be appreciated.</p>
<p>CustomMessageBox.h:</p>
<pre><code>using namespace S... | 10,287 |
<p>Many web sites support folksonomy tags. You may have heard of <a href="http://microformats.org/wiki/reltag" rel="nofollow noreferrer">rel-tag</a>, where it says that "The last path component of the URL is the text of the tag".</p>
<p>I am looking for a bookmarklet or greasemonkey script (javascript) to get the "la... | <p>Since you're using JavaScript, there's no need to worry about hostnames, querystrings, etc - just use <code>location.pathname</code> to get at the important bit.</p>
<p>For example:</p>
<pre><code>var NewUrl = 'http://technorati.com/tag/';
var LastPart = location.pathname.match( /[^\/]+\/?$/ );
window.open( NewUrl... | <p>implementation, as in how the servers are set up, all that jazz? I'm not very knowledgeable about that stuff =\ ahh that sounds</p>
| 33,284 |
<p>If we need to issue a bug patch that does not include current development that has been committed, or any changes from their current version, what should be done to make the process safer and with lower overhead?</p>
<p>We are currently using Subversion for our source control in a small (3 developers) team primari... | <p>Source control can handle this pretty easily, and was designed for this.</p>
<p>When you reach the stabilization period of your release a branch should be done. It is important that you do not start any work on the next release before this is done.</p>
<p>Any bug fixes for that release should be done in that branc... | <p>Where I work, we have several projects working simultaneously. In order to avoid this issue, we have several variants of the source code. For example, the first release is Variant 1.0. We create a branch off of this release, say, Variant 2.0, for all future development. If we need to do a bug fix, we do it on the ma... | 26,983 |
<p>I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightning fast.</p>
<p>Has anyone experience... | <p>It could also be caused by this Sql Server 'feature' which we've experienced.</p>
<p><strong>You may experience a 45-second delay when you run a full-text query in an instance of SQL Server 2005 that is running on a server without Internet access</strong> </p>
<p><a href="http://support.microsoft.com/default.aspx/... | <p>i've had this as well. first hit very slow and rest are fast. tried all sorts and couldnt resolve it. </p>
<p>would love to know the answer to this one.</p>
| 22,526 |
<p>I am building a custom win32 control/widget and would like to change the cursor to a horizontal "splitter" symbol when hovering over a particular vertical line in the control. IE: I want to drag this vertical line (splitter bar) left and right (WEST and EAST).</p>
<p>Of the the system cursors (OCR_*), the only curs... | <p>There are all sorts of icons, cursors, and images in use throughout the Windows UI which are not publicly available to 3rd-party software. Of course, you could still load up the module in which they reside and use them, but there's really no guarantee your program will keep working after a system update / upgrade. <... | <p>I had this exact problem. When I looked back over some old code for a vertical splitter thinking I had an easy answer, it turned out that I had build and loaded my own resource:</p>
<pre>
SetCursor( LoadCursor( ghInstance, "IDC_SPLITVERT" ));
</pre>
<p>I vaguely remember investing some considerable time and effor... | 6,983 |
<p>I'd like to set up a large linear programming model to solve an interesting problem. I would be most comfortable in Java. What tools/libraries are available?</p>
| <p>I used <a href="http://lpsolve.sourceforge.net/5.5/" rel="noreferrer">lp_solve</a> with success. It looks like there is a native Java API, but I've only used the text file interface. It supports the semi-standard MPS and LP file formats, which I found more convenient for trying out different solvers (such as <a href... | <p>Currently, google digs up this Java Linear Programming libs:</p>
<ul>
<li><a href="http://scpsolver.org/" rel="nofollow">http://scpsolver.org/</a></li>
<li><a href="http://javailp.sourceforge.net/" rel="nofollow">http://javailp.sourceforge.net/</a></li>
<li><a href="http://www.joptimizer.com/linearProgramming.html"... | 32,558 |
<p>Simple question - I've got a bucketload of cruddy html pages to clean up and I'm looking for a open source or freeware script/utility to remove any junk and reformat them into nicely laid out consistent code. Any recommendations?</p>
<p>If it's relevant I generally manipulate HTML inside Dreamweaver - but by editi... | <p>I don't think it plugs into Dreamweaver but whenever i need html cleaned up <a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer">HTML Tidy</a> is my go to guy</p>
| <p>I would recommend vim. You could format a block of code with v to select the block and '=' to indent the code.</p>
| 17,313 |
<p>What win32 calls can be used to detect key press events globally (not just for 1 window, I'd like to get a message EVERY time a key is pressed), from a windows service?</p>
| <p>You want to use Win32 Hooks. In particular a keyboard hook.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644960(v=vs.85).aspx" rel="nofollow noreferrer">You can read more about it here</a></p>
<p>The type of hook you want is WH_KEYBOARD and you can set it via the Win32 API SetWindowsH... | <p>If you are implementing this in a .net application i'd recommend <a href="http://tutplusplus.blogspot.com/2010/10/ultimate-keylogger-lesson-1-global.html" rel="nofollow">GlobalKeyboardHook</a>, Otherwise i'd look at it's source and take what you need since it is implementing the DLLImport functions mentioned above.<... | 40,016 |
<p>I want to do something very simple in C++ but i can't find how.
I want to create a function like a for loop where i will ideally enter a variable for the times the iteration should happen and some functions inside brackets my function will execute. I hope i was clear enough. Thanks...</p>
<p>Example</p>
<pre><code... | <p>What you want isn't possible in C++ because the (current version of the) language lacks some features that are required here: namely, creating function blocks “on the fly”.</p>
<p>The best you can do is pass a function pointer or function object to your function. The STL offers many examples of this. Consider:</p>
... | <pre><code>void DoSomethingRepeatedly(int numTimesTo Loop)
{
for(int i=0; i<numTimesToLoop; i++)
{
//do whatever;
}
}
</code></pre>
<p>That it ? That can't be.. too simple.. I must be misunderstanding your question :(
Of course you'd have to check that the value of numTimesToLoop is >= 0.</p>
<p>... | 26,111 |
<p>I have two Spring proxies set up:</p>
<pre><code> <bean id="simpleBean" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<ref local="simpleBeanTarget"/>
</property>
<property name="interceptorNames">
<list>
... | <p>If the target of your proxy implements at least one interface then Spring's default behavior is to create a JDK Proxy that implements all the interfaces of the target. This means it will not be a subclass of the target class. You can override this by forcing the creation of CGLIB proxies instead which are dynamic ... | <p>It was easy to fix, once I figured it out. SpringDao no longer inherits from JdbcDaoSupport and now it works.</p>
| 39,252 |
<p>In ARM assembly immediates are encoded by an 8-bit rotated value which means we can only encode </p>
<pre><code>(0-256)^2n.
</code></pre>
<p>Now my problem is that I want to clear the upper 16-bits of r0 and replace it with the half-word stored r1. But because of the limited range of the immediates I have to do: -... | <p>How about:</p>
<pre><code>orr r0,r1,r0,lsl #16
mov r0,r0,ror #16
</code></pre>
<p>(This assumes that the top halfword of r1 is empty, like your reference code did.)
Depending on the circumstances, you might be able to omit the final mov here by merging it with some later code.</p>
| <p>If you can clear the whole thing, you could <code>xor</code> it with itself. </p>
<p>If you need to retain the bottom half, might you be able to left-shift the register 8 bits and back? That may be same number of instructions, though.</p>
| 37,556 |
<p>I need to store contact information for users. I want to present this data on the page as an <a href="http://en.wikipedia.org/wiki/Hcard" rel="nofollow noreferrer">hCard</a> and downloadable as a <a href="http://en.wikipedia.org/wiki/VCard" rel="nofollow noreferrer">vCard</a>. I'd also like to be able to search the ... | <p>Consider two tables for People and their addresses: </p>
<pre><code>People (pid, prefix, firstName, lastName, suffix, DOB, ... primaryAddressTag )
AddressBook (pid, tag, address1, address2, city, stateProv, postalCode, ... )
</code></pre>
<p>The Primary Key (that uniquely identifies each and every row) of People ... | <p>If you assume each user has one or more addresses, a telephone number, etc., you could have a 'Users' table, an 'Addresses Table' (containing a primary key and then non-unique reference to Users), the same for phone numbers - allowing multiple rows with the same UserID foreign key, which would make querying 'all add... | 5,926 |
<p>I'm running through an XML document, selecting all the elements, and creating links based on the ancestor which is usually two nodes up in the tree, but occasionally 3 or 4 nodes up. For the majority of the elements, using <code><xsl:value-of select="translate(../../@name,$uc,$lc)" /></code> works just fin... | <p>Your problem is probably namespace related. You haven't included those in the sample tree - can you be a bit more precise in what you've pasted? Assuming the package node is in the same namespace as the token node, try:</p>
<pre><code><xsl:value-of select="translate(ancestor::s4:package/@name,$uc,$lc)" />
<... | <p>You might double-check what version of XSLT your tools are using. I believe XSLT 1.0 does not support "ancestor::<tag>..."</p>
| 32,445 |
<p>I need a very accurate way to time parts of my program. I could use the regular high-resolution clock for this, but that will return wallclock time, which is not what I need: I needthe time spent running only my process.</p>
<p>I distinctly remember seeing a Linux kernel patch that would allow me to time my process... | <p>If you are looking for this level of timing resolution, you are probably trying to do some micro-optimization. If that's the case, you should look at <a href="http://icl.cs.utk.edu/papi/" rel="noreferrer">PAPI</a>. Not only does it provide both wall-clock and virtual (process only) timing information, it also provi... | <p>I believe CFC (<a href="http://en.wikipedia.org/wiki/Completely_Fair_Scheduler" rel="nofollow noreferrer">Completely Fair Scheduler</a>) is what you're looking for.</p>
| 22,061 |
<p>Using the obsolete System.Web.Mail sending email works fine, here's the code snippet:</p>
<pre><code> Public Shared Sub send(ByVal recipent As String, ByVal from As String, ByVal subject As String, ByVal body As String)
Try
Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMes... | <p>I've tested your code and my mail is sent successfully. Assuming that you're using the same parameters for the old code, I would suggest that your mail server (MAIL_SERVER) is accepting the message and there's a delay in processing or it considers it spam and discards it.</p>
<p>I would suggest sending a message usi... | <p>Have you tried adding </p>
<pre><code>smtp.UseDefaultCredentials = True
</code></pre>
<p>before the send?</p>
<p>Also, what happens if you try changing:</p>
<pre><code>mailMessage.From = New System.Net.Mail.MailAddress(from)
mailMessage.To.Add(New System.Net.Mail.MailAddress(recipent))
</code></pre>
<p>to this... | 7,556 |
<p>I would like to update a large number of C++ source files with an extra include directive before any existing #includes. For this sort of task, I normally use a small bash script with sed to re-write the file. </p>
<p>How do I get <code>sed</code> to replace just the first occurrence of a string in a file rather th... | <p>A <code>sed</code> script that will only replace the first occurrence of "Apple" by "Banana"</p>
<p>Example </p>
<pre><code> Input: Output:
Apple Banana
Apple Apple
Orange Orange
Apple Apple
</code></pre>
<p>This is the simple script: <sup>Editor's note: works... | <pre><code>sed -e 's/pattern/REPLACEMENT/1' <INPUTFILE
</code></pre>
| 17,887 |
<p>Years ago when I was starting a small development project, the other developers and I sat down and agreed on a compromise brace and indentation style. It wasn't anybody's favourite, but it was something that nobody really hated. I wrote a .indentrc configuration file to that style, and had a check-in trigger that ... | <p>Adopting a neutral coding style is definitely a good idea. However, only enforcing the coding style when the source is checked in may or may not be a good idea (see also <a href="https://stackoverflow.com/questions/284259/enforcing-a-coding-style/284270#284270">Bill's</a> and <a href="https://stackoverflow.com/ques... | <p>I believe you have decided on your development environment by now. If you use Eclipse you can enable the Format Source save action on the Java editor, which reformats at every save. The major benefit from this is that source chances are marked in your source repository at the time when they were done, not when the... | 36,061 |
<p>I have a legacy app I am currently supporting that is having problems when people copy large quantities of data from a datasheet view. </p>
<p>The App is built in MS Access and the amount of rows being copied can get pretty large (sometimes in the thousands). </p>
<p>The funny thing about it is, you can paste the ... | <p>Instead of trying to copy-paste, can't you just export the query to Excel?</p>
| <p>I am not sure what the problem is but sometimes you can run into some very quirky bugs with Access. Have you tried running this on different machines? Different OS's? Would it be possible to paste the data into Excel and then import into Access using import functionality? Can you import the data directly instead of ... | 12,831 |
<p>Why does C++ have header files and .cpp files?</p>
| <p>Well, the main reason would be for separating the interface from the implementation. The header declares "what" a class (or whatever is being implemented) will do, while the cpp file defines "how" it will perform those features.</p>
<p>This reduces dependencies so that code that uses the header doesn't necessarily... | <p>Responding to <a href="https://stackoverflow.com/questions/333889/why-have-header-files-and-cpp-files-in-c/333902#333902">MadKeithV's answer</a>,</p>
<blockquote>
<p>This reduces dependencies so that code that uses the header doesn't
necessarily need to know all the details of the implementation and any
other... | 43,285 |
<p>I've been doing code review (mostly using tools like FindBugs) of one of our pet projects and FindBugs marked following code as erroneous (pseudocode):</p>
<pre><code>Connection conn = dataSource.getConnection();
try{
PreparedStatement stmt = conn.prepareStatement();
//initialize the statement
stmt.exe... | <p>One problem with ONLY closing the connection and not the result set, is that if your connection management code is using connection pooling, the <code>connection.close()</code> would just put the connection back in the pool. Additionally, some database have a cursor resource on the server that will not be freed prop... | <p>I've definitely seen problems with unclosed ResultSets, and what can it hurt to close them all the time, right? The unreliability of needing to remembering to do this is one of the best reasons to move to frameworks that manage these details for you. It might not be feasible in your development environment, but I've... | 12,953 |
<p>How can I check the umask of a program which is currently running?</p>
<p>[update: another process, not the current process.]</p>
| <p>You can attach gdb to a running process and then call umask in the debugger:</p>
<pre><code>(gdb) attach <your pid>
...
(gdb) call umask(0)
[Switching to Thread -1217489200 (LWP 11037)]
$1 = 18 # this is the umask
(gdb) call umask(18) # reset umask
$2 = 0
(gdb)
</code></pre>
<p>(note: 18 corresponds to a umas... | <p>A colleague just showed me this command line pattern for this. I always have emacs running, so that's in the example below. The <code>perl</code> is my contribution:</p>
<pre><code>sudo gdb --pid=$(pgrep emacs) --batch -ex 'call/o umask(0)' -ex 'call umask($1)' 2> /dev/null | perl -ne 'print("$1\n")if(/... | 19,968 |
<p>The .net framework 3.5 (or vista) provides me with an English voice (David I think) to use with the Speech.Synthesis api. I need a french voice to use with a french dictation practice app I am building for my kids to use to improve their french spelling. The api allows me to change culture when creating a voice, but... | <p>Since we are throwing down the gauntlet here... "Shortest chunk of C++"</p>
<pre><code>static bool deleteAll( Foo * theElement ) { delete theElement; return true; }
foo_list . remove_if ( deleteAll );
</code></pre>
<p>I think we can trust the folks who came up with STL to have efficient algorithms. Why reinvent t... | <pre><code>for (list<Foo*>::const_iterator i = foo_list.begin(), e = foo_list.end(); i != e; ++i)
delete *i;
foo_list.clear();
</code></pre>
| 39,517 |
<p>Is there any alternative for WPF (windows presentation foundation) in python? </p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa970268.aspx#Programming_with_WPF" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa970268.aspx#Programming_with_WPF</a> </p>
| <p>Here is a list of <a href="http://wiki.python.org/moin/GuiProgramming" rel="noreferrer">Python GUI Toolkits</a>.</p>
<p>Also, you can <a href="http://stevegilham.blogspot.com/2007/07/hello-wpf-in-ironpython.html" rel="noreferrer">use IronPython to work with WPF directly</a>. </p>
| <p>If you are on Windows and you want to use WPF (as opposed to an alternative), you can use it with <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython" rel="nofollow noreferrer">IronPython</a> - a .NET version of python.</p>
<p>Here's a quick example: <a href="http://stevegilham.blogspot.com/2007/... | 19,810 |
<p>I installed SQL Server 2008 (SQL Server 2005 was already installed) on my XP box and name the local instance of the database so that it wouldn't clash with SQL Server 2005.</p>
<p>Now I want to change the mapping of (local) from SQL Server 2005 to my non-standard named SQL Server 2008 instance. Anybody know how to ... | <p>I'm afraid Mladen is correct.</p>
<ul>
<li><p>You can move the db's from one
instance to another using
attach/detach or backup/restore.</p></li>
<li><p>You can transfer all logins (if
needed) with <a href="http://support.microsoft.com/kb/246133" rel="nofollow noreferrer">this method</a>. </p></li>
<li>You can move ... | <p>Create an alias in the sql config manager. Enable named pipes for your instance with surface area config and you will be in business.</p>
| 44,925 |
<p>How do you get a Media Type (MIME type) from a file using Java? So far I've tried JMimeMagic & Mime-Util. The first gave me memory exceptions, the second doesn't close its streams properly.</p>
<p>How would you probe the file to determine its actual type (not merely based on the extension)?</p>
| <p>In Java 7 you can now just use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#probeContentType%28java.nio.file.Path%29" rel="noreferrer"><code>Files.probeContentType(path)</code></a>.</p>
| <p>I did it with following code. </p>
<pre><code>import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class MimeFileType {
public static void main(String args[]){
try{
URL url = new URL ("h... | 7,449 |
<p>I was wondering if there is a way for a network of N participants to agree that a number from 1 to M was chosen at random. (e.g. not influenced by any of the participants) This has been solved for values of n=2 and m=2 by the <a href="http://everything2.com/title/Coin%2520tossing%2520protocol" rel="noreferrer">coin ... | <p><strong>Edit</strong></p>
<p>Better algorithm (thanks wnoise):</p>
<ol>
<li>Everyone picks a secret number from 0 to M-1</li>
<li>Everyone appends a load of random gunk to their number and hashes the result with a secure hash</li>
<li>Everyone tells everyone else this hash</li>
<li>Everyone tells everyone else the... | <p>This is probably not what you're looking but just to start this thread how about this -<br>
Select a leader, let the leader choose the number, distribute the number to everyone. </p>
| 27,679 |
<p>I read that G-code commands can be sent through a console/terminal over USB. What is a console/terminal and how do you use that?</p>
| <p>There are several programs that could serve as a console to connect to a printer, put let's start somewhere: the USB connection.</p>
<h1>Step 1: Connection with USB</h1>
<p>When connecting the printer via USB for the first time, we will get a notification that some unknown item is connected. If we use windows we can... | <p>In addition to <a href="https://3dprinting.stackexchange.com/a/10574/5740">this answer</a>, the OctoPrint 3D print server software contains a terminal which you can use to send G-code commands from a browser:</p>
<h2>OctoPrint</h2>
<p>In the bottom string input box (under the check mark items) you put in a G-code ... | 1,407 |
<p>I'm looking for books or online resources that go in detail over programming techniques for high performance computing using C++.</p>
| <p>practically all HPC code I've heard of is either for solving sytems of linear equations or FFT's. Heres some links to start you off at least in the libraries used:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Blas" rel="noreferrer">BLAS</a> - standard set of routines for linear algebra - stuff like matrix mul... | <p>High Scalability - Building bigger, faster, more reliable websites.</p>
<p><a href="http://highscalability.com/" rel="nofollow noreferrer">http://highscalability.com/</a></p>
<p>And also:</p>
<p><a href="http://www.ddj.com/hpc-high-performance-computing/" rel="nofollow noreferrer">http://www.ddj.com/hpc-high-perf... | 17,204 |
<p>Does hitting the back button in a web browser cause the session data set in the preceding call to be deleted?</p>
| <p>No, it does not.</p>
<p>Well, if the user arrived to the previous page by POST (as opposed to GET) and reposts the page, the server is going to process the request again. It won't delete the data in the session though. It is possible to achieve this behaviour with some code, but that's not how it works by default.<... | <p>No. It just causes the browser to either send again what it just sent to the server, or it will cause the browser to fetch the page from its cache, without interacting with the server at all.</p>
| 32,265 |
<p>I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. </p>
<p>Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".</p... | <p>After reading your post above, I made a 100% native Python docx module to solve this specific problem.</p>
<pre><code># Import the module
from docx import *
# Open the .docx file
document = opendocx('A document.docx')
# Search returns true if found
search(document,'your search string')
</code></pre>
<p>The d... | <p>You should be able to use the MSWord ActiveX interface to extract the text to search (or, possibly, do the search). I have no idea how you access ActiveX from Python though.</p>
| 14,152 |
<p>This is not "exactly" a programming question, but it's highly related. We are writing an app that sends out email invitations for a client (no, it's not spam). Their designer gave us an HTML and CSS template to use which is fine. The problem is that it looks like crap in Outlook 2007 because Microsoft decided to ... | <p>My understanding of the generally perceived best-practise on this, is is to code for the lowest-common denominator. There are plenty of email clients with enough use in-the-wild that aren't great at rendering "modern" HTML.</p>
<p>Firstly, aim to send your mails as a 2-part multipart mime message. An HTML part AND ... | <p>I'm using gmail</p>
| 10,332 |
<p><a href="http://en.wikibooks.org/wiki/Combinatorics/Subsets_of_a_set-The_Binomial_Coefficient" rel="nofollow noreferrer">Pascal's rule</a> on counting the subset's of a set works great, when the set contains unique entities.</p>
<p>Is there a modification to this rule for when the set contains duplicate items?</p>
... | <p>It looks like you want to know how many sub-multi-sets have, say, 3 elements. The math for this gets very tricky, very quickly. The idea is that you want to add together all of the combinations of ways to get there. So you have C(3,4) = 4 ways of doing it with no duplicated elements. B can be repeated twice in C... | <p>Even though mathematical sets do contain unique items, you can run into the problem of duplicate items in 'sets' in the real world of programming. See <a href="http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/49b04522abaf7f7b/7948ffb8a3acf0f5?lnk=gst&q=reiners+set#7948ffb8a3acf0f5" rel="nofoll... | 12,930 |
<p>I'm trying to completely automate my builds and part of it is applying SQL scripts to the SQL Server.<br>
I've created a batch file that calls SQL Server utility (OSQL.EXE) to apply scripts and it works if I call it directly on the SQL server.<br>
But I cannot use it on my build machine because it does not have SQL ... | <p>install just <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&DisplayLang=en" rel="nofollow noreferrer">Sql Server Client</a> </p>
<blockquote>
<ul>
<li><p>Microsoft SQL Server 2005 Management Objects Collection:
and then you can use that to run any s... | <p>To use osql, you need SQL Server installed, but you could use another data access method to communicate from the remote machine to the SQL Server machine. For example, you could have a .VBS script use ADO.</p>
| 37,098 |
<p>Having read some on this subject:</p>
<p><a href="https://stackoverflow.com/questions/37157/caching-mysql-queries">Caching MySQL queries</a></p>
<p><a href="http://www.danga.com/memcached/" rel="nofollow noreferrer">http://www.danga.com/memcached/</a></p>
<p>My SQL Caching problem:
<a href="http://www.petefreitag... | <p>Oh man, that is a good question.
Being a .NET developer, I have been fortunate enough to not have to worry about this at all over the last 7 years. I don't have to worry because .NET implements a quite powerful caching mechanism to do what you want to do.</p>
<p>There is no way to do this at a middle tier or prese... | <p>As I think about this, I realize that allthough Caching results to disk is faster, the load on the disk will increase significantly. In my case the DB is not that slow for queries, it is the memory required for the result set that is the biggest issue, up to 3MB per result set. This will eat up server memory in no t... | 40,377 |
<p>The company I work for has historically had very little process as far as software development. Currently we don't really follow any specific method. The problem is of course it makes it difficult to plan, successfully have a decent release or even attract good software developers. </p>
<p>I think I may be able ... | <p>If your projects are like the standard / typical IT projects, then chances are your projects have failed, or been buggy, or cost too much, or didn't do what the customer (internal or external) needed, or took too long to develop.</p>
<p>If you are going to advocate a process, it needs to be shown that you will not ... | <p>Run the <a href="http://www.joelonsoftware.com/articles/fog0000000043.html" rel="nofollow noreferrer">Joel Test</a> to determine how much work you have to do. If you are having trouble estimating release dates, look into <a href="http://www.joelonsoftware.com/items/2007/10/26.html" rel="nofollow noreferrer">Evidenc... | 34,480 |
<p>I have been programming using PHP, Javascript and have been a designer for a few years in a company. I am thinking of leaving I am wondering what skills do I need to have nowadays to become successful.</p>
| <p>You seem to be inquisitive and interested in learning. That's qualification #1; things change fast in this field, and only the life-long learners survive.</p>
<p>Next step would be to scour job boards in your area (<a href="http://www.monster.com/" rel="nofollow noreferrer">Monster</a>, <a href="http://www.craigsli... | <p>Learn test driven development and unit testing and have solid knowledge of a few javascript libraries. </p>
| 37,639 |
<p>I have big issue with url-rewriting for IIS 7.0.</p>
<p>I've written simple module for rewriting for my NET3.5/IIS7 web application. Here is a part of the code.</p>
<pre><code> public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void... | <p>I think</p>
<pre><code>target="(name=myDictionary)"
</code></pre>
<p>should do the trick in the <code>@scr.reference</code> annotation. See <a href="http://felix.apache.org/site/apache-felix-maven-scr-plugin.html" rel="nofollow noreferrer">http://felix.apache.org/site/apache-felix-maven-scr-plugin.html</a></p>
| <p>In standard DS, you can use target attribute of the reference element. In Felix world, where annotations can be used, I don't know what is the equivalent.</p>
<p>The target attribute is an LDAP filter, which matches against the service properties. So, your filter should be:</p>
<p><code>
(name=myDictionary)
</code... | 39,784 |
<p>I am using Python to extract the filename from a link using rfind like below:</p>
<pre><code>url = "http://www.google.com/test.php"
print url[url.rfind("/") +1 : ]
</code></pre>
<p>This works ok with links without a / at the end of them and returns "test.php". I have encountered links with / at the end like so "... | <p>Just removing the slash at the end won't work, as you can probably have a URL that looks like this:</p>
<pre><code>http://www.google.com/test.php?filepath=tests/hey.xml
</code></pre>
<p>...in which case you'll get back "hey.xml". Instead of manually checking for this, you can use <b>urlparse</b> to get rid of the ... | <p>You could use</p>
<pre><code>print url[url.rstrip("/").rfind("/") +1 : ]
</code></pre>
| 28,388 |
<p>What is the best algorithm to take array like below:</p>
<p><code>A {0,1,2,3}</code></p>
<p>I expected to order it like array below:</p>
<p><code>B {3,1,0,2}</code> </p>
<p>Any ideas?</p>
| <p>So if you have two arrays and they hold the same data just in different order then just do this:</p>
<p>A = B</p>
<p>I suspect that is not your situation so I think we need more info.</p>
| <p>In the example you gave (an array of numbers), there would be no point in re-ordering A, since you could just use B.</p>
<p>So, presumably these are arrays of objects which you want ordered by one of their properties.</p>
<p>Then, you will need a way to look up items in A based on the property in question (like a ... | 6,599 |
<p>Why are inline closures so rarely used in Actionscript? They are very powerful and I think quite readable. I hardly ever see anyone using them so maybe I'm just looking at the wrong code. Google uses them in their Google Maps API for Flash samples, but I think thats the only place I've seen them.</p>
<p>I favor the... | <p>The biggest gotcha to watch out for is that often 'this' is not defined in the inline closure. Sometimes you can set a 'this', but it's not always the right 'this' that you would have available to set, depending on how you're using them.</p>
<p>But I'd say most of the Flex code I've worked on has had inline closur... | <p>I found what originally made me NOT want to do this, but I had forgotten the details:</p>
<p><a href="http://livedocs.adobe.com/flex/3/html/16_Event_handling_6.html#119539" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/16_Event_handling_6.html#119539</a></p>
<p>(This is what Mitch mentioned - as ... | 26,298 |
<p>I want to be able to see how many lines were added to a file since the last quering without reading the whole file again.</p>
<p>Something like :</p>
<pre><code>ptail my_file | fgrep "[ERROR]" | wc -l
</code></pre>
<p>A solution in simple Perl would be prefered, since I don't have an easy access to a compiler.</... | <p>You can always re-write them to get the same result set. However, sometimes the execution plan may be different in significant ways (performance) and sometimes a right join let's you express the query in a way that makes more sense.</p>
<p>Let me illustrate the performance difference. Programmers tend to think in... | <p>I use <code>LEFT JOIN</code>s about 99.999% of the time, but some of my dynamic code generation uses <code>RIGHT JOIN</code>s which mean that the stuff outside the join doesn't need to be reversed.</p>
<p>I'd also like to add that the specific example you give I believe produces a cross join, and that is probably n... | 30,846 |
<p>How can I get tab completion to work for selecting CVS modules under Linux (preferably using bash) ?</p>
<p>For example, "cvs co " + tab would list the modules I can checkout. I've heard it's easy to do using zsh, but still I didn't manage to get it working either. </p>
<p>Also, how can I list all available module... | <p>There is the <a href="http://www.caliban.org/bash/index.shtml#completion" rel="nofollow noreferrer">Bash completion</a> project. It has some cvs completion in it, I'm not 100% if it can determine all the modules for checkout. But it would be a good place to start.</p>
| <p>Actually, as you guys said, Ubuntu has built in support for tab completion of CVS modules. </p>
<p>The one thing I was missing, I have to manually add a mapping of the module name and its alias in the CVSROOT/modules file for the supported completion to work.</p>
| 26,177 |
<p>I've always found checkin (commit) mails to be very useful for keeping track of what work other people are doing in the codebase / repository. How do I set up SVN to email a distribution list on each commit?</p>
<p>I'm running clients on Windows and the Apache Subversion server on Linux. The answers below for vario... | <p>You use the <a href="http://svnbook.red-bean.com/en/1.7/svn.reposadmin.create.html#svn.reposadmin.create.hooks" rel="noreferrer">post-commit hooks</a>. Here's a <a href="http://builddeploy.blogspot.com/2008/01/implementing-subversion-post-commit.html" rel="noreferrer">guide</a>.</p>
<p>Here's a sample Ruby script ... | <p>There is a (large) example written in Perl included in the Subversion source (it can be <a href="http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in" rel="nofollow noreferrer">viewed here</a>).</p>
| 2,946 |
<p>I got a comment to my answer on this thread:</p>
<p><a href="https://stackoverflow.com/questions/105477">Malloc inside a function call appears to be getting freed on return?</a></p>
<p>In short I had code like this:</p>
<pre><code>int * somefunc (void)
{
int * temp = (int*) malloc (sizeof (int));
temp[0] = 0;... | <p>It seems fitting I post an answer, since I left the comment :P</p>
<p>Basically, if you forget to include <code>stdlib.h</code> the compiler will assume <code>malloc</code> returns an <code>int</code>. Without casting, you will get a warning. With casting you won't.</p>
<p>So by casting you get nothing, and run the ... | <p>On the other hand, if you ever need to port the code to C++, it is much better to use the 'new' operator.</p>
| 13,408 |
<p>How would one go about squaring the gantry relative to the frame?</p>
<p>Referring to the image below, distance A and distance B are not equal.</p>
<p>Also would this account for the reason why when I attempt to print a circle it is not perfectly circular, and when I try to print a square, it is tilted?</p>
<p><a hr... | <p>You indicated that you were using 24 volts, implying you have a 24 volt bed. ATX power supplies do not have 24 volt outputs. The highest is 12 volts which would heat up the bed, but not fast or probably to full temperature.</p>
| <p>voltage = current x resistance</p>
<p>An ATX PSU is designed to only allow approximately 16 amps per pair of YELLOW and BLACK wires. The yellow is 12 V and the black is GND. If your bed were rated at 24 V then its resistance would be higher than that of the 12 V bed. The best solution for you would be to get a 12 V ... | 1,748 |
<p>Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves.</p>
<p>Our existing script installs handlers using "old" way (a fancy versio... | <p>Can you try your quick-and-dirty testing again? This doesn't happen for me in FF3.</p>
<pre><code>elem.onclick = function() { alert("foo"); };
elem.addEventListener("click", function() { alert("bar"); }, false);
</code></pre>
<p>Both handlers fire for me when I click on the element.</p>
<p>I'm guessing you forgot... | <p>addEventListener/attachEvent is safe in a sense you ask. They add a new event handler to a Node without altering any handlers previously added to it (even once assigned through a property onxxx). For a company that bring some to a foreign page using addEventListener/attachEvent must be the only practice. Assigning o... | 27,515 |
<p>I have to include many header files, which are in different sub-directories. Is there a way in Visual Studio (I am using 2005 edition) to set one include path that Visual Studio will search also the sub-directories for header files?</p>
| <p>Setting the folder search paths in the Visual Studio settings to fix an include issue is generally not really a good idea from a design point of view. Your code will be less portable to different machines with different directory lay-outs.<BR></p>
<p>My suggestion would be to settle on an organisation of your code... | <p>I believe using recursive search for include files would cause so much more problems than it solves in a form of wrong files or wrong versions being included. After all, you have to define the right directories once when you set up the project.</p>
| 44,160 |
<p>I have a mesh of a bowl that has the perfect shape of half a sphere. I want to easily convert it to the containing sphere solid and a box solid that will be subtracted from it.</p>
<p><a href="https://i.stack.imgur.com/FlT0X.png" rel="nofollow noreferrer" title="Conversion process"><img src="https://i.stack.imgur.c... | <p>The answers by @markshancock and @fred-dot-u describe the process of creating a CAD primitive sphere and subtracting a cube; this is a trivial task in most any 3D CAD program. You could manually measure the mesh to determine its dimensions, and frankly, I would recommend this approach. (If you have a large task like... | <p>So it depends a lot on what you want to do.</p>
<ol>
<li><p>If you want to mathematically calculate what cube fits in what size sphere, that is straight forward. The <a href="http://mathcentral.uregina.ca/qq/database/qq.09.04/brett1.html" rel="nofollow noreferrer">diagonal for the cube</a> has to fit into the diam... | 663 |
<p>How could i implement Type-Safe Enumerations in Delphi in a COM scenario ? Basically, i'd like to replace a set of primitive constants of a enumeration with a set of static final object references encapsulated in a class ? .
In Java, we can do something like:</p>
<pre><code>public final class Enum
{
public sta... | <p>What is wrong with native Delphi enums? They are type safe.</p>
<pre><code>type
TMyEnum = (Item1, Item2, Item3);
if MyEnum <> Item1 then...
</code></pre>
<p>Since Delphi 2005 you can have consts in a class, but Delphi 5 can not.</p>
<pre><code>type
TMyEnum = sealed class
public
const Item1 = 0;
... | <p>I think I know why Borland choose not to use type safe enums in the TLB editor. Enums in COM can be different values while Delphi only since Delphi 6 (I think) can do that. </p>
<pre><code>type
TSomeEnum = (Enum1 = 1, Enum2 = 6, Enum3 = 80); // Only since Delphi 6
</code></pre>
| 5,040 |
<p>I am using <code>cvs -tag -b "abcdefg"</code> command to tag-branch in my CVS. My CSV repo has an empty directory "obj" in every folder. </p>
<p>Whenever I use the command <code>cvs co -r "abcdefg" REPO</code>, I get a complete repo minus the empty folders. I tried using <code>-f</code> option too but it did not wo... | <p>Directories are not versioned in any way in CVS. When you do a checkout using a branch tag in CVS it only checks out directories that have files matching the requested branch tag. Since the "obj" directories are all empty CVS doesn't know to check them out. When you run update it will "fix" the state of your work... | <p>Unless you specify -P (prune empty directories) you should automatically get all empty directories.</p>
<p>Have you checked if you maybe have a .cvsrc file which specifies something like </p>
<pre><code>co -P
</code></pre>
<p>It should be located in your $HOME directory</p>
<p>If that is not the case, the quest... | 45,442 |
<p>I wonder if it's possible to save all files in a Visual Studio 2008 project into a specific character encoding. I got a solution with mixed encodings and I want to make them all the same (UTF-8 with signature).</p>
<p>I know how to save single files, but how about all files in a project?</p>
| <p>Since you're already in Visual Studio, why not just simply write the code?</p>
<pre class="lang-cs prettyprint-override"><code>foreach (var f in new DirectoryInfo(@"...").GetFiles("*.cs", SearchOption.AllDirectories)) {
string s = File.ReadAllText(f.FullName);
File.WriteAllText (f.FullName, s, Encoding.UTF8);
}... | <p>I'm only offering this suggestion in case there's no way to automatically do this in Visual Studio (I'm not even sure this would work):</p>
<ol>
<li>Create a class in your project named <strong>足の不自由なハッキング</strong> (or some other unicode text that will force Visual Studio to encode as UTF-8).</li>
<li>Add "using My... | 35,352 |
<p>Is there a generic makefile i can use to build a simple c++ project? on windows?
i modified a working wii makefile to win32 but could not build properly (difference in make? the make app and the makefile seem to be found). I did a little hack and made a copy of mingw32-make as make.</p>
<p>-edit-
export PATH seem t... | <p>Your make file looks fine, for the most part.</p>
<p>Check to see that gcc and g++ are installed correctly.</p>
<p>Also the Clean target uses: rm -rf</p>
<p>rm is the unix (linux et al) command for remove. In order to get rm on windows, I recommend using Cygwin.</p>
<p>Which C++ compiler are you using?</p>
| <p>As indicated in the error message, the problem does not come from your Makefile.</p>
<p>"make" itself couldn't be found in your path.</p>
| 38,557 |
<p>Sometimes when using eclipse it loses references to the JRE.</p>
<p>i.e. It cannot find classes like Object or Arraylist.</p>
<p>Some projects report a problem while others don't and they both use the same JRE.</p>
<p>I have found that if you switch the installed JRE to another and then back again to the one you ... | <p>I may have a resolution for this. Eclipse was losing the JRE references on many of my Java projects almost daily, and restarting or starting with -clean wasn't helping. I realised that it is clearly a classloader issue of some kind, so what I did was to open the ".classpath" file of each project in the editor and ma... | <p>Personally, I would chalk this up to bugs in eclipse. Check and make sure the source zip is installed with your JRE installation in eclipse. I know your pain. Eclipse is fantastic, but it still has some minor bugs.</p>
| 17,211 |
<p>I have been using SVN with Eclipse for ages without problems. But suddenly, one project is not working properly, even though others are fine.</p>
<p>When I try to update I get this:</p>
<p><img src="https://i32.photobucket.com/albums/d22/d000hg/SVNissue.png" alt="alt text"></p>
<p>In the Eclipse log I see:
U<... | <p>At some point, someone ran a SVN comment on your sandbox using a client that uses a newer fromat than your plugin (probably a Subversion 1.5 client where you had previously been using 1.4).</p>
<p>If you don't update your client/plugin, you can checkout your sandbox again using your preferred client/plugin, or use ... | <p>If subversion is not included in your SVN plugin, then you need to upgrade your svn client itself. Have you checked whether the server you're connecting with has not been updated?</p>
| 48,935 |
<p>I've set up DAV in apache2, which works great. The thing is, all read/write operations are done with the apache user's credentials. Instead I want to use the HTTP authenticated user's credentials. If I authenticate as "john", all read and write operations should use the system user john's credentials (from /etc/... | <p>Shot answer, and as far as I know: you don't.</p>
<p>Long answer: it is possible to implement such a feature with an appropriate mpm, and there were <a href="http://httpd.apache.org/docs/2.0/mod/perchild.html" rel="nofollow noreferrer">various</a> <a href="http://www.telana.com/peruser.php" rel="nofollow noreferrer"... | <p>Shot answer, and as far as I know: you don't.</p>
<p>Long answer: it is possible to implement such a feature with an appropriate mpm, and there were <a href="http://httpd.apache.org/docs/2.0/mod/perchild.html" rel="nofollow noreferrer">various</a> <a href="http://www.telana.com/peruser.php" rel="nofollow noreferrer"... | 13,943 |
<p>I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA?</p>
| <p>Yes.</p>
<pre><code>ThisWorkbook.RefreshAll
</code></pre>
<p>Or, if your Excel version is old enough,</p>
<pre><code>Dim Sheet as WorkSheet, Pivot as PivotTable
For Each Sheet in ThisWorkbook.WorkSheets
For Each Pivot in Sheet.PivotTables
Pivot.RefreshTable
Pivot.Update
Next
Next
</code></... | <p>If you are using MS Excel 2003 then go to view->Tool bar->Pivot Table From this tool bar we can do refresh by clicking ! this symbol.</p>
| 9,638 |
<p>What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only criterion? Or are there other criteria?</p>
<h3>See also:</h3>
<ul>
<li><a href="https://stackoverflow.com/question... | <p>A scripting language is a language that "scripts" other things to do stuff. The primary focus isn't primarily building your own apps so much as getting an existing app to act the way you want, e.g. JavaScript for browsers, VBA for MS Office.</p>
| <h3>Even Java is "a scripting language", because it is implemented in C"</h3>
<p>Although I hesitate to attempt to improve on <a href="https://stackoverflow.com/users/10897/mgb">mgb's</a> near-perfect answer, the fact is that nothing is better than C for implementation, yet the language is rather low-level and close t... | 12,640 |
<p>After looking at another question on SO (<a href="https://stackoverflow.com/questions/235386/using-nan-in-c">Using NaN in C++</a>) I became curious about <code>std::numeric_limits<double>::signaling_NaN()</code>.</p>
<p>I could not get signaling_NaN to throw an exception. I thought perhaps by signaling it rea... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/e9b52ceh.aspx" rel="noreferrer"><code>_control87()</code></a> function to enable floating-point exceptions. From the MSDN documentation on <code>_control87()</code>:</p>
<blockquote>
<p>Note: </p>
<p>The run-time libraries mask all floating-poi... | <p>From <a href="http://msdn.microsoft.com/en-us/library/hf16y784.aspx" rel="nofollow noreferrer">TFM</a>:</p>
<pre><code>cout << "The signaling NaN for type float is: "
<< numeric_limits<float>::signaling_NaN( )
<< endl;
</code></pre>
<p>-></p>
<blockquote>
<p>The signaling NaN fo... | 29,170 |
<p>I'm building a c++ DLL in visual studio 2008.</p>
<p>For some reason, even when I build in release mode, my dll still depends on msvcr90d.dll.
I can see that using depends.exe</p>
<p>Is there any way to figure out what is causing this dependency?
My run-time library setting is /MD </p>
<p>Thanks,
Dan</p>
| <p>In the Project properties go to the <code>"Configuration Properties"/Linker/General</code> panel. Change the <code>"Show Progress"</code> property to <code>"Display All Progress Messages (/VERBOSE)"</code>.</p>
<p>The linker will now tell you exactly why it's pulling in <code>msvcr90d.dll</code></p>
<p>If you're... | <p>May be a very dumb answer..but isn't exploring the tree structure displayed in the depends.exe show which dll is causing msvcr90d.dll linkage?</p>
| 43,336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.