instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Where may one find references on implementing an algorithm for calculating a "dirty rectangle" for minimizing frame buffer updates? A display model that permits arbitrary edits and computes the minimal set of "bit blit" operations required to update the display.</p>
<p>To build the smallest rectangle that contains all the areas that need to be repainted:</p> <ul> <li>Start with a blank area (perhaps a rectangle set to 0,0,0,0 - something you can detect as 'no update required')</li> </ul> <p>For each dirty area added:</p> <ul> <li>Normalize the new area (i.e. ensure that left is...
<p>To build the smallest rectangle that contains all the areas that need to be repainted:</p> <ul> <li>Start with a blank area (perhaps a rectangle set to 0,0,0,0 - something you can detect as 'no update required')</li> </ul> <p>For each dirty area added:</p> <ul> <li>Normalize the new area (i.e. ensure that left is...
10,229
<p>How do I convert a datetime field in Grails to just date, with out capturing the time? I need to do this for comparison with system date. </p> <pre><code>class Trip { String name String city Date startDate Date endDate String purpose String notes static constraints = { name(ma...
<p>There's [unfortunately] not an "out-of-the box" method for performing this operation in <code>Grails|Groovy|Java</code>.</p> <p>Somebody <strong>always</strong> throws in <a href="http://joda-time.sourceforge.net/" rel="noreferrer">Joda-Time</a> any time a <code>java.util.Date</code> or <code>java.util.Calendar</co...
<p>Maybe </p> <pre><code>startDate(validator: {d = new Date(); return (it..d) &gt;= 0}) </code></pre>
45,450
<p>How can I programmatically lock/unlock, or otherwise prevent/enable editing, a source file on Linux using C++.</p> <p>I want to be able to lock source file so that if I open it in an editor it will not allow me to save back to the same source file.</p> <p>I am thinking of maybe changing the permissions to read-onl...
<p>Try man fchmod:</p> <pre> NAME chmod, fchmod - change permissions of a file SYNOPSIS #include &lt;sys/types.h&gt; #include &lt;sys/stat.h&gt; int chmod(const char *path, mode_t mode); int fchmod(int fildes, mode_t mode); </pre>
<p>Why aren't you using a source code management tool like CVS or Subversion? CVS does nice locking (so does Subversion). More importantly, you have the history of changes. Better still (with CVS anyway) you have to make the step of doing a "checkout" to make the file writeable. </p>
21,403
<p>I have developed in C++ many years ago, but these days I am primarily a Java software engineer. Given I own an iPhone, am ready to spring for a MacBook next month, and am generally interested in getting started with Mac OS developmentmt (using Objective C), I thought I would just put this question out there: What N...
<p>Having purchased both of the books in your question, I recommend Cocoa Programming for Mac OS X as a quick way to learn the language and the Cocoa framework, and is probably the fastest way to start producing real applications in Cocoa. I highly recommend it. Programming in Objective-C 2.0 is a great reference book,...
<p>Another option for you is jaiPhon, which allows you to write java apps that get translated into iPhone-speak at build time.</p> <p>I don't know if it's availanle yet, or if it's commercial-ware or whatever, but it's interesting none the less.</p> <p><a href="http://www.jaiphon.com/" rel="nofollow noreferrer">http:...
16,363
<p>I am implementing a class to compare directory trees (in C#). At first I implemented the actual comparison in the class's constructor. Like this:</p> <pre><code>DirectoryComparer c = new DirectoryComparer("C:\\Dir1", "C:\\Dir2"); </code></pre> <p>But it doesn't feel "right" to do a possible lengthy operation in th...
<p>I would think a combination of the two is the "right" choice, as I would expect the Compare method to return the comparison result, not the comparer itself.</p> <pre><code>DirectoryComparer c = new DirectoryComparer(); int equality = c.Compare("C:\\Dir1", "C:\\Dir2"); </code></pre> <p>...and as Dana mentions, th...
<p>If you are working with C#, you could use extension methods to create a method for comparing 2 directories that you would attach to the build in DirectoryClass, so it would look some thing like:</p> <pre><code>Directory dir1 = new Directory("C:\....."); Directory dir2 = new Directory("D:\....."); DirectoryCompare ...
33,936
<p>I know you can use the <code>&lt;jsp:useBean&gt;</code> tag to instantiate objects within JSPs without resorting to scriptlet code. However I'd like to instantiate an Integer who value is the result of an EL expression, something like:</p> <pre><code>&lt;jsp:useBean id="total" class="java.lang.Integer"&gt; &lt;...
<p><strong><code>&lt;c:set var="amount" value="${param1 + param2}" scope="page" /&gt;</code></strong></p>
<p>If you have a bean, can you just update the bean with param1 and 2? Create a method, setAmount(param1, param2), and set it before you use getAmount(), which is what the bean is going to call.</p>
45,705
<p>I am connecting to CRM with the intention of retrieving a list of picklist values. On my development machine I am working under my own login name and all works fine. On the test server, the code executes under the NETWORK SERVICE account. When it connects to the CRM web service everything is great. When it connects ...
<p>I suspect it might be a Kerberos / delegation issue, to make sure it is try replacing DefaultCredentials with new System.Security.Net.NetworkCredentials("username","password","domain");</p> <p>See if that still gives you a 401.</p> <p>This is the quick way I normally try to see if it is kerbos/security related. <...
<p>In my case (yes, we still use CRM 4), the website in IIS wasn't bound to the hostname being used to access the metadata service on port 5555.</p>
24,990
<p>I build and maintain a set of Flash components that is distributed to publishers and allows them to integrate with our system. Currently the component has no UI and simply contains compiled code for querying our system servers, parsing the response, and modifying the params sent in the query. There's an As2 version ...
<p>We're using FlexUnit on our project and I'm pretty happy with it. Assuming your project was designed with a fairly loose degree of coupling, you shouldn't need to change much at all (if anything) in order to test your code. If you're already using an MVC framework like <a href="http://opensource.adobe.com/wiki/dis...
<p>While I never had the chance to work with a unit tester in actionscript, at work we created a framework which:</p> <ol> <li>compiled the script(s) inside a test application, in our case with flex</li> <li>set up a timer (watchdog) application, in case of loop failure</li> <li>ran the application which, in turn: <u...
27,025
<p>We have a database that many persons have to have access to. I am looking for a way that will allow us to get notification whenever "alter" occurs on this database, so other parties can be aware of it. Please advise.</p>
<p>You can create TRIGGERs to catch a number of database events...</p> <p><a href="http://www.psoug.org/reference/ddl_trigger.html" rel="nofollow noreferrer">http://www.psoug.org/reference/ddl_trigger.html</a></p> <p>...including before/after an ALTER on a schema.</p>
<p>ALTER what ?</p> <p>ALTER SESSION may be a very common command (especially ALTER SESSION SET NLS_DATE_FORMAT or CURRENT_SCHEMA).</p> <p>More commonly you'd be want to track ALTER schema_object, maybe ALTER SYSTEM and ALTER DATABASE</p>
32,639
<p>About two months ago, I added a heated bed to my custom 3D printer in order to print larger ABS parts for my research project. The heated bed (the PCB kind) was not new, but taken from an old printer I had built, but took apart. The bed worked well for a few weeks, but after one print finished, the glass bed above t...
<p>The problem is in the design of your bed. Let's start from the basic setup of a glass bed:</p> <p>The heater element is usually mounted to a metal carrier, which is both spreading the thermal energy over the bed, but also is the structural element that is leveled against the carriage. Atop that comes the glass prin...
<p>I would be careful before trying another glass just hoping it will go better, since you haven't found the issue.</p> <p>I have a PCB heated bed in direct contact (PCB copper traces on top) a 2 mm glass (plain float glass, not hardened and not borosilicate). It never broke and I've been using it intensely for the la...
1,672
<p>I have found an interesting issue in windows which allows me to cause the Windows clock (but not the hardware clocks) to run fast - as much as 8 seconds every minute. I am doing some background research to work out how Windows calculates and updates it's internal time (not how it syncs with an NTP servers). Any info...
<p><a href="http://msdn.microsoft.com/en-us/library/ms724961(VS.85).aspx" rel="nofollow noreferrer">This MSDN article</a> gives a very brief description of how the system time is handled: "When the system first starts, it sets the system time to a value based on the real-time clock of the computer and then regularly up...
<p>_ftime doesn't use at all GetSystemTimeAsFileTime. Just read the source code.</p>
26,134
<p>In the tradition of <a href="https://stackoverflow.com/questions/309492/user-defined-functions-sql-server-2005-flagged-incorrectly-as-non-deterministic">this question</a> and in light of <a href="http://msdn.microsoft.com/en-us/library/ms178091(SQL.90).aspx" rel="nofollow noreferrer">the documentation</a>, how does ...
<p>BOL says that <code>CONVERT</code> <em>is</em> deterministic with datetimes if the <em>style</em> parameter is specified. So if you change the first UDF to:</p> <pre><code>RETURN CONVERT(datetime, CONVERT(varchar, @DATA_DT_ID), 112) </code></pre> <p>Then it <em>should</em> be deterministic, if I understand the do...
<p>From the articles you linked:</p> <blockquote> <p>To be deterministic, the style parameter must be a constant. Additionally, styles less than or equal to 100 are nondeterministic, except for styles 20 and 21. Styles greater than 100 are deterministic, except for styles 106, 107, 109 and 113.</p> </blockquote> <p...
39,954
<p>For whatever reason, our company has a coding guideline that states:</p> <p><code>Each class shall have it's own header and implementation file.</code></p> <p>So if we wrote a class called <code>MyString</code> we would need an associated <strong>MyStringh.h</strong> and <strong>MyString.cxx</strong>.</p> <p>Does...
<p>The term here is <strong>translation unit</strong> and you really want to (if possible) have one class per translation unit ie, one class implementation per .cpp file, with a corresponding .h file of the same name.</p> <p>It's usually more efficient (from a compile/link) standpoint to do things this way, especially...
<p>I'm surprised that almost everyone is in favor of having one file per class. The problem with that is that in the age of 'refactoring' one may have a hard time keeping the file and class names in synch. Everytime you change a class name, you then have to change the file name too, which means that you have to also ma...
4,780
<p>I have sproc 'up&#95;selfassessform&#95;view' which has the following parameters:</p> <pre><code>in ai_eqidentkey SYSKEY in ai_acidentkey SYSKEY out as_eqcomments TEXT_STRING out as_acexplanation TEXT_STRING </code></pre> <p>&nbsp;-&nbsp; which are domain objects - SYSKEY is 'integer' and TEXT_STRING is 'long varc...
<p>Minix 3 is a new version; LINUX was prompted on the original Minix.</p> <p>Minix is really best suited to small systems of embedded systems. If you have an old x86 PC around it should run minix handily, giving you an environment very much like what we called "an amazing workstation" in the mid-80's. </p> <p>I lov...
<p>Coded round robin scheduler and such with nano, SSH connection can be used to code in new fashion platforms and send back the files. Minix is a great way to learn basics about Operating Systems. </p>
39,108
<p>I start using the visual studio c++ express 2008 at home but there is no ATL in it.<br> How can I add ATL to visual studio c++ express 2008? </p>
<p>ATL 7.1 is now part of the <a href="http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx" rel="noreferrer">Windows Driver Kit</a>. </p>
<p>You'll need to download the platform SDK and muck around with some dependencies to get ATL.</p> <p>There might be some more "unsavory" ways to get MFC ;) if you catch my drift. Also many institutions have educational VS licenses which are free.</p>
9,720
<p>What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()?</p>
<p>How about this:</p> <pre><code>master.sys.fn_varbintohexstr(@binvalue) </code></pre>
<p>CONVERT(varchar, @binary)</p>
9,909
<p>I like Django, but for a particular application I would like to use only parts of it, but I'm not familiar enough with how Django works on the inside, so maybe someone can point me into the right direction as to what I have to check out.</p> <p>Specifically, I <i>want to use</i>:</p> <ul> <li>The models and databa...
<p>I myself use Django for its object/db mapping without using its urlconfigs. Simply create a file called <code>djangosettings.py</code> and insert the necessary configuration, for example:</p> <pre><code>DATABASE_ENGINE = 'oracle' DATABASE_HOST = 'localhost' DATABASE_NAME = 'ORCL' DATABASE_USER = 'sco...
<p>I've shared an example of solution, which prevents Python Path manipulation inside code:</p> <p><a href="https://github.com/askalyuk/django-orm-standalone" rel="nofollow">https://github.com/askalyuk/django-orm-standalone</a></p> <p>It contains a standalone data access package, a separated simple Django site and a ...
38,872
<p>I'm writing a Spring web application that requires users to login. My company has an Active Directory server that I'd like to make use of for this purpose. However, I'm having trouble using Spring Security to connect to the server.</p> <p>I'm using Spring 2.5.5 and Spring Security 2.0.3, along with Java 1.6.</p> ...
<p>I had the same banging-my-head-against-the-wall experience you did, and ended up writing a custom authentication provider that does an LDAP query against the Active Directory server.</p> <p>So my security-related beans are:</p> <pre><code>&lt;beans:bean id="contextSource" class="org.springframework.security.ld...
<p>LDAP authentication without SSL is not safe anyone can see the user credential when those are transffered to LDAP server. I suggest using LDAPS:\ protocol for authentication. It doesn't require any major change on spring part but you may ran with some issues related to certificates. See <a href="http://javarevisited...
11,019
<p>Coming from a java background, one of the things I am used to is telling the JVM what the maximum heap size should be. If the running program tries to swallow more than is allowed, and the garbage collector cannot free any more resources, then OutOfMemoryError is thrown and it all goes bang. So setting the maximum...
<p>You can't set max heap size in .Net unless you host the CLR yourself in a process. </p> <p>Edit: To control the memory allocations of CLR including the max heap size, you need to use the hosting api to host the clr and specifically use the "Memory manager interfaces", some starter info can be found here <a href="ht...
<p>As far as I've found, there is no simple way to <a href="http://bytes.com/groups/net-c/683386-how-set-max-heap-size-c" rel="noreferrer">control the size of the heap</a> of a .Net app using the CLR.</p> <p>The link above only half answers the question. When I've researched this same issue, the response is "The heap ...
38,664
<p>I'm currently working on a JavaScript tool that, during the course of its execution, will ultimately traverse each node in the DOM. Because this has potential to be a very expensive task, I'd like to benchmark the performance of this script.</p> <p>What's the best, free tool for benchmarking a script such as this a...
<p><strong><a href="http://getfirebug.com" rel="noreferrer">Firebug</a></strong> does include JS profiling, and it is probably the best out there. While I've had problems with Firebug's debugger, its profiler is currently top-of-the-line. <strong><a href="http://www.mozilla.org/projects/venkman/" rel="noreferrer">Ven...
<p>Jeff posted <a href="http://www.codinghorror.com/blog/archives/001023.html" rel="nofollow noreferrer">The great browser javascript shutdown</a></p> <p><a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html" rel="nofollow noreferrer"><H2>SunSpider JavaScript Benchmark</H2></a></p> <p>But i wonder where t...
7,734
<p>I have Apache 2 running on a VPS server (running Debian). I recently changed the timezone on the server (using dpkg-reconfigure tzdata) from America/New_York to America/Los_Angeles to match my move across country. I have also rebooted the virtual machine since making the change.</p> <p>However, the Apache process...
<p>As it turns out, I had two Django projects running on this Apache instance, one of which I had fixed to point to America/Los_Angeles, but the other I had left behind. Depending on which app was accessed first when a new Apache process was created, it would muck up the time zone!</p>
<p>Possibly some of the Apache worker processes were started before you changes the timezone, and some afterwards. Have you completely stopped and re-started Apache since changing the system timezone setting?</p>
20,034
<p>Here is the directory structure</p> <pre><code>/domain.com /public_html /functions /image /mobile /www </code></pre> <p>the /domain.com/public_html/www folder has a file index.php the default web directory is /user/public_html/www in the index file is an include that includes the functions with include".....
<p>It is not possible to directly access files outside of the webroot; this is a builtin security restriction that is there for good reason.</p> <p>It is however possible to use a PHP-script to serve these images for you. This way you can call an image like:</p> <pre><code>/image.php?file=myfile.jpg </code></pre> <p...
<p>You can either make a link to the image directory inside the public___html, move the image directory to public_html or, if you have a particular liking towards convoluted solutions, you can write a script that reads the image file and outputs it to the user (Of course, unless you make a whitelist of all the images, ...
32,252
<p>I'm interested in creating a game that uses fractal maps for more realistic geography. However, the only fractal map programs I have found are Windows-only, for example <a href="http://www.nbos.com/products/mapper/mapper.htm" rel="nofollow noreferrer">Fractal Mapper</a>. Needless to say, they are also not open-sourc...
<p><a href="http://www.bottlenose.demon.co.uk/share/fracplanet/" rel="noreferrer">Fracplanet</a> may be of use.</p>
<p>If you want truely realistic geography, you could use NASA's <a href="http://www2.jpl.nasa.gov/srtm/" rel="nofollow noreferrer">SRTM</a> dataset, perhaps combined with <a href="http://www.openstreetmap.org" rel="nofollow noreferrer">OpenStreetMap</a> features. :-)</p>
19,023
<p>Is there any easy way to retrieve table creation DDL from Microsoft Access (2007) or do I have to code it myself using VBA to read the table structure? </p> <p>I have about 30 tables that we are porting to Oracle and it would make life easier if we could create the tables from the Access definitions.</p>
<p>Thanks for the other suggestions. While I was waiting I wrote some VBA code to do it. It's not perfect, but did the job for me.</p> <pre><code>Option Compare Database Public Function TableCreateDDL(TableDef As TableDef) As String Dim fldDef As Field Dim FieldIndex As Integer Dim fldName ...
<p>A bit late to the party, but I use RazorSQL to generate DDL for Access databases.</p>
20,830
<p>I'm working on a project with will be buried in soil. It's an enclosure for a sensor that will be potted inside the 3D printed part. What filament will give me the longest life in soil? </p> <p>ETA: burial will be permanent, and I'd like it to last at least five years.</p> <p>ETA: The printed part will provide mec...
<p>I would recommend PETG - only because it is structurally similar to the plastic used in the bottles that last forever, and most PETG is food grade - implying that its chemical stability should be reasonably good...</p>
<p>If TPU ends up not being rigid enough for you: I've had good enough luck with ABS coated in automotive RTV.</p> <p>Thing with ABS though is that it's a special (not so)"solid" that gets softer as it gets hotter. My use had water in it when warm so wasn't too much of an issue, and it never experienced freezing temp...
1,649
<p>For my Ender 3 Pro I bought this touch sensor set <a href="https://tr.aliexpress.com/item/4001209045993.html?spm=a2g0s.9042311.0.0.68ea4c4d3CjwfW" rel="nofollow noreferrer">Chinese clone BLTouch set</a> and changed the printer's firmware to the latest TH3D firmware (first I tried with Creality's original BLTouch fir...
<p>Following <a href="https://3dprinting.stackexchange.com/a/14765/5740">Nathan's</a> answer, I've solved my problem with Nathan's suggestions and the method in <a href="https://www.youtube.com/watch?v=W8ouBPnRV4s&amp;ab_channel=cheule" rel="nofollow noreferrer">this video</a>.</p> <p>What I did?</p> <ol> <li>Flashed ...
<p>I would suggest you read <a href="https://www.reddit.com/r/ender3/comments/jdd2nf/for_some_reason_my_bltouch_isnt_working_quite_as/g9amvfn/?context=3" rel="nofollow noreferrer">this</a>, even tho it's a different mainboard it may help.</p> <p>Next to that you should level the bed the old fashion way first with a pap...
1,773
<p>AFAIK, you never need to specify the protocol in an onclick:</p> <p><code>onclick="javascript:myFunction()"</code> <strong>Bad</strong></p> <p><code>onclick="myFunction()"</code> <strong>Good</strong></p> <p>Today I noticed in <a href="http://web.archive.org/web/20080428095515/http://www.google.com/support/analyt...
<p>Some of the responses here claim that the "javascript:" prefix is a "leftover from the old days", implying that it's intentionally, specially handled by the browsers for backwards compatibility. Is there solid evidence that this is the case (has anyone checked source code)?</p> <pre><code>&lt;span onclick="javascri...
<p>It's good practice for your maintenance programmer. The compiler knows the difference, but that young, just-out-of-college web developer may not.</p>
48,645
<p>What is the difference between web reference and service reference in WCF? Which is preferable in WCF?</p>
<p>The low-level answer here is that a Web Reference will create a client proxy class that allows your code to talk to a Web Service that is described via WSDL and communicates via SOAP or HTTP GET (other posters indicate that it is only ASMX, but Web References can also talk to Java-based Web Services or Python-based ...
<p>Service references deal with endpoints and bindings, which are completely configurable. They let you point your client proxy to a WCF via any transport protocol (HTTP, TCP, Shared Memory, etc)</p> <p>They are designed to work with WCF.</p> <p>If you use a WebProxy, you are pretty much binding yourself to using WC...
39,733
<p>I'm trying to build a C# console application to automate grabbing certain files from our website, mostly to save myself clicks and - frankly - just to have done it. But I've hit a snag that for which I've been unable to find a working solution.</p> <p>The website I'm trying to which I'm trying to connect uses ASP....
<pre><code>&lt;?php /* Resizes an image and converts it to PNG returning the PNG data as a string */ function imageToPng($srcFile, $maxSize = 100) { list($width_orig, $height_orig, $type) = getimagesize($srcFile); // Get the aspect ratio $ratio_orig =...
<p><a href="http://www.phpit.net/article/image-manipulation-php-gd-part2/" rel="nofollow noreferrer">This article</a> seems like it would fit what you want. You'll need to change the saving imagejpeg() function to imagepng() and have it save the file to a string rather than output it to the page, but other than that i...
4,225
<p>I'd like something like a generic, re-usable <code>getPosition()</code> method that will tell me the number of bytes read from the starting point of the stream. Ideally, I would prefer this to work with all InputStreams, so that I don't have to wrap each and every one of them as I get them from disparate sources.</...
<p>Take a look at <a href="http://commons.apache.org/io/apidocs/org/apache/commons/io/input/CountingInputStream.html" rel="noreferrer">CountingInputStream</a> in the Commons IO package. They have a pretty good collection of other useful InputStream variants as well.</p>
<p>No. <code>InputStream</code> is intended to handle potentially infinite amounts of data, so a counter would get in the way. In addition to wrapping them all, you might be able to do something with aspects.</p>
29,745
<p>Python has this wonderful way of handling string substitutions using dictionaries:</p> <pre><code>&gt;&gt;&gt; 'The %(site)s site %(adj)s because it %(adj)s' % {'site':'Stackoverflow', 'adj':'rocks'} 'The Stackoverflow site rocks because it rocks' </code></pre> <p>I love this because you can specify a value once i...
<pre><code>function subst($str, $dict){ return preg_replace(array_map(create_function('$a', 'return "/%\\($a\\)s/";'), array_keys($dict)), array_values($dict), $str); } </code></pre> <p>You call it like so:</p> <pre><code>echo subst('The %(site)s site %(adj)s because it %(adj)s', array('site'=&gt;'Stackoverflow'...
<p>Some of the user-contributed notes and functions in <a href="http://us3.php.net/sprintf" rel="nofollow noreferrer">PHP's documentation for sprintf</a> come quite close.</p> <p>Note: search the page for "sprintf2".</p>
4,781
<p>Recently (in 2017) there was <a href="https://m.box.com/shared_item/https%3A%2F%2Fumich.box.com%2Fs%2Fn9cvs27ckehdr64gzv5igtmboykymgk6" rel="nofollow noreferrer">a paper</a> that got some publicity by researchers who are using a B spline algorithm to reduce vibrations in 3D printers. But before them, a B Spline impl...
<p><em>I would have liked to answer linking to credible official sources, but I cannot add references either on direct B-spline printing. So I'm writing down my thoughts. I've familiarized myself in B-splines to understand what they are and read into the 2 references given by the OP.</em></p> <hr /> <p>Basically, the p...
<p>In more practical terms, you could design the part so that the corners are rounded (also known as fillets). This will help keep the print head moving and would prevent the sudden stop and start effect that causes "jerking". Further 8 bit controllers tend to get saturated when reading large amounts of g-code from the...
1,401
<p>I want to add some <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" rel="noreferrer">Ajax</a>-niceness to my Django-coded website. </p> <p>In my Django code, I use the <code>@login_required</code> decorator from <code>django.contrib.auth.decorators</code> to mark which view requires authentication. The...
<p>I am facing the same issue, and, like you, I would like a simple decorator to wrap around a Django ajax view in order to handle authentication in the same way that I have other views. One approach that seems promising to me is to use such a decorator in conjunction with JavaScript that looks for a certain value in ...
<p>Here is proposed version of the decorator with wrap.__doc__ , wrap.__name__</p> <pre><code>from functools import wraps def ajax_login_required(function): def wrap(request, *args, **kwargs): if request.user.is_authenticated(): return function(request, *args, **kwargs) json = simplejs...
40,332
<p>In my ASP.NET User Control I'm adding some JavaScript to the <code>window.onload</code> event:</p> <pre><code>if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction()...
<p>Most of the "solutions" suggested are Microsoft-specific, or require bloated libraries. Here's one good way. This works with W3C-compliant browsers and with Microsoft IE.</p> <pre><code>if (window.addEventListener) // W3C standard { window.addEventListener('load', myFunction, false); // NB **not** 'onload' } els...
<p>I don't know a lot about ASP.NET, but why not write a custom function for the onload event that in turn calls both functions for you? If you've got two functions, call them both from a third script which you register for the event.</p>
3,085
<p>If I have several <code>Section</code> elements in an XML document, what XQuery do I use to get a list of all the <code>name</code> values?</p> <pre><code>&lt;Section name="New Clients" filePath="XNEWCUST.TXT" skipSection="False"&gt; </code></pre>
<p>In XPath 2.0 (which is a subset of XQuery) one would use the following expression to get a sequence of all string values of the "name" attributes of the "Section" elements:</p> <pre class="lang-xquery prettyprint-override"><code>for $attr in //Section/@name return string($attr) </code></pre> <p>Do note that usi...
<pre><code> /Section/@name </code></pre>
41,997
<p>In Python properties are used instead of the Java-style getters, setters. So one rarely sees get... or set.. methods in the public interfaces of classes.</p> <p>But in cases were a property is not appropriate one might still end up with methods that behave like getters or setters. Now my questions: Should these met...
<p>I think shorter is better, so I tend to prefer the later. But what's important is to consistent with your project: don't mix the two methods. If you jump into someone else's project, keep what the other developers chose initially.</p>
<p>If I have to use a getter/setter, I like it this way:</p> <p>Suppose you have a variable self._x. Then x() would return the value of self._x, and setX(x) would set the value of self._x</p>
49,024
<p>Is there a generic way, without creating and managing your own CLR host, to take over locating and loading a type if that type is not found?</p> <p><strong>The following is just an example. In your rush to be the first answer, don't suggest the new add-in framework or the MEF as a solution to my question.</strong>...
<p>There are events on the <a href="http://msdn.microsoft.com/en-us/library/system.appdomain_events.aspx" rel="nofollow noreferrer">AppDomain</a> that you can use.</p> <p>You would want <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.typeresolve.aspx" rel="nofollow noreferrer">TypeResolve</a> event, ...
<p>Isn't that possible just by using AppDomain events?</p>
14,905
<p><a href="http://en.wikipedia.org/wiki/SHA-1" rel="noreferrer">SHA Hash functions</a></p>
<pre><code>require 'digest/sha1' Digest::SHA1.hexdigest 'foo' </code></pre>
<p>Where 'serialize' is some user function defined elsewhere.</p> <pre><code> def generateKey(data) return Digest::SHA1.hexdigest ("#{serialize(data)}") end </code></pre>
5,473
<p>I am using Cura for slicing, and OctoPrint for the actual printing.</p> <p>On small pieces with roughly one square cm of surface area prints over about 6&nbsp;mm have a risk of coming off at 60&nbsp;&deg;C.</p> <p>In fact, I have had to use 71&nbsp;&deg;C so it stick properly. However, I don't want the print bed ...
<p><strong>The actual problem you are facing is bed adhesion</strong>, the proposed solution (in your question) shouldn't be the preferred solution to get your parts to stick to the plate/glass as plastic shrinks as it cools down. Note that a 5&nbsp;&deg;C temperature drop after the first layer usually isn't a problem,...
<ul> <li>You can manually edit the file. Look for the line that has the Z height of your choice, and insert the temp change g-code right above it.</li> <li>Upgrade to a real slicer like Simplify3D with has an options to set a heater temp at different layers.</li> <li>Preheat the bed before you print, then print with a ...
1,549
<p>I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process.</p> <p>I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but...
<p>Here's how you can disable/enable indexes in SQL Server:</p> <pre><code>--Disable Index ALTER INDEX [IX_Users_UserID] SalesDB.Users DISABLE GO --Enable Index ALTER INDEX [IX_Users_UserID] SalesDB.Users REBUILD</code></pre> <p>Here are some resources to help you find a solution:</p> <p><a href="http://weblogs.sqlt...
<p>Yes your ideas will help.<br> Lean on option 1 if there are no reads happening while your loading.<br> Lean on option 2 if you destination table is being queried during your processing.</p> <p>@Andrew<br> Question. Your inserting in chunks of 300. What is the total amount your inserting? SQL server should be abl...
4,394
<p>How do I set the initial width of a QDockWidget?</p> <p>I have implemented the sizeHint function but what next?</p>
<p>The documentation for <code>QDockWidget</code> says:</p> <blockquote> A QDockWidget acts as a wrapper for its child widget, set with setWidget(). Custom size hints, minimum and maximum sizes and size policies should be <b>implemented in the child widget</b>. QDockWidget will respect them, adjusting its own constrai...
<p>If you want it to have the same width as the same last time the program was running, you should look into settings. The Qt 4.4 documentation has an example on how to use settings <a href="http://doc.trolltech.com/4.4/mainwindows-application.html" rel="noreferrer">here</a>.</p> <p>This is how I have done it:</p> <p...
23,192
<p>Many times I've seen links like these in HTML pages:</p> <pre><code>&lt;a href='#' onclick='someFunc(3.1415926); return false;'&gt;Click here !&lt;/a&gt; </code></pre> <p>What's the effect of the <code>return false</code> in there?</p> <p>Also, I don't usually see that in buttons.</p> <p>Is this specified anywhe...
<p>The return value of an event handler determines whether or not the default browser behaviour should take place as well. In the case of clicking on links, this would be following the link, but the difference is most noticeable in form submit handlers, where you can cancel a form submission if the user has made a mis...
<p>When using forms,we can use 'return false' to prevent submitting.</p> <pre><code>function checkForm() { // return true to submit, return false to prevent submitting } &lt;form onsubmit="return checkForm()"&gt; ... &lt;/form&gt; </code></pre>
15,675
<p>Quick question: Would it be a good or a bad idea to implement my domain-driven design style repositories as singletons? Why?</p> <p>Or should I maybe use a dependency injector container to manage my repositories and decide if they are singletons or not?</p> <p>I'm still reading <em>DDD Quickly</em>, and would like...
<p>I've seen a couple of ways to do this.</p> <p>The most common way is to use dependency injection to inject the repositories into the objects that use them. Usually these are presenter or controller classes but in some cases the model calls into the repository. Usually it's better if you avoid this. If you can use a...
<p>I am not sure about this and I have the same problem. I think that you should make a repository a singleton when the objects that it works with are used often. And that it shouldn't be made a singleton if you use objects that it works with rarely, because the repository would take a lot of memory for objects and may...
41,948
<p>I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: </p> <pre><code>$filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") </code></pre> <p>this returns "01-04-2008"</p> <p>I want to the output to be "1-4-2008"</p> <p>an...
<pre><code>$filedate = get-date -format "M-d-yyyy" </code></pre>
<p>use format string like : </p> <pre><code>get-date -format yyyy/M/d </code></pre> <p>or</p> <p>get-date.tostring(yyyy/M/d)</p>
44,386
<p>I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the .application file for the app.</p> <p><strong>This works fine via RDP desktop session on the terminal server</strong>. As a TS RemoteApp, however, well... not so mu...
<p>The Key to getting it to work is to use Windows Explorer "C:\windows\explorer.exe". This process is the base process when you login to a full session.</p> <p>If you setup the RemoteApp to use Windows Explorer and the command line argument of the path to the .application file for the ClickOnce application then it w...
<p>Try using RegMon and FileMon when starting the app - You may be able to track it down to a file and/or registry permission issue.</p>
13,164
<p>I have a simple row that I edit using LINQ. It has about 30 columns, including a primary key numeric sequence.</p> <p>When an UPDATE is performed through LINQ, the UPDATE statement includes all the columns of the table (for concurrency checking). </p> <p>I'm wondering how inefficient this is - if not negligibiel. ...
<p>We ran into this early on Stack Overflow. Every LINQ to SQL update verifies that the underlying fields haven't changed before writing an update. In other words, every update is "update the record <em>only if</em> this field equals, and this field equals, and this field equals"..</p> <p>We decided most of the time w...
<p>If you can modify the schema add a column of type rowversion. The latest LINQ to SQL sets the update check to Never for all columns. If you have a timestamp, it will use that as an optimistic lock check, and the system bumps it every time there is an update. </p> <p>NOTE: this used to be the Timestamp data type as ...
42,759
<p>I am currently working on parts for a custom prosthesis.</p> <p>My main concern at the moment is to find biocompatible materials that can be 3D printed from a UP or a Reprap. The piece would need to be in contact with the skin for extended periods of time, probably around 17 hours a day on average.</p> <p>The main...
<p>There are printers designed for medical use, and the manufacturers supply them with varying levels of <a href="http://www.medicalplasticsnews.com/opinion/passing-the-test_1/" rel="nofollow">certification and testing</a>, however I've not seen a filament manufacturer certify their material as bio-compatible separate ...
<p>If you want to know something about what you are questioning, it is interesting to you to read <a href="http://e-nable.org/resources/prosthetics-students-consultation/" rel="nofollow noreferrer">http://e-nable.org/resources/prosthetics-students-consultation/</a></p> <p>That's a link with complementary information h...
117
<p>I have a BSTR object that I would like to convert to copy to a wchar__t object. The tricky thing is the length of the BSTR object could be anywhere from a few kilobytes to a few hundred kilobytes. Is there an efficient way of copying the data across? I know I could just declare a wchar_t array and alway allocate the...
<p>BSTR objects contain a length prefix, so finding out the length is cheap. Find out the length, allocate a new array big enough to hold the result, process into that, and remember to free it when you're done.</p>
<p>Use ATL, and CStringT then you can just use the assignment operator. Or you can use the USES_CONVERSION macros, these use heap alloc, so you will be sure that you won't leak memory.</p>
9,754
<p>I was wondering if adding (an) extra fan(s) (not connected to the printer, but blowing on the print area) could improve the quality of PLA based prints(printing at 210 C). The printer already has a built in fan with a fan shroud that directs air to the hotend, but is it beneficial to add an extra fan in order to get...
<blockquote> <p>The printer already has a built in fan with a fan shroud that directs air to the hotend</p> </blockquote> <p><strong>Unless your printer is defective, it may look like so, but the airflow should really be directed towards the print, not the hot-end</strong>. Cooling the hot-end will at best just was...
<p>Fan blow at hot end is necessary because hotend needs cooling.</p> <p>For PLA it will yield better result with a seperate controllable fan direct airflow across the print head, but just like everything with 3D printing, you will need to test out every possible configuration to get the best for your setup.</p>
819
<p>Some friends and colleagues of mine have a little running contest to find or write the longest class/variable/property/method names possible. Keep in mind, we try to be good boys and girls and keep the naming intelligible and concise, while still explaining what the thing does via its name.</p> <p>Sometimes it jus...
<p>This isn't a class name but an enum, but it's a lot longer:</p> <pre><code>VirtualMachineDeviceRuntimeInfoVirtualEthernetCardRuntimeStateVmDirectPathGen2InactiveReasonOther </code></pre> <p>from the VMware vSphere API. Google for it and you'll find the online documentation.</p>
<p>get the <code>js</code> items that will be retrieved and if page should display recommendations.</p>
26,070
<p>i m trying to design a mmo game using python...</p> <p>I have evaluated stackless and since it is not the general python and it is a fork, i dont want to use it</p> <p>I am trying to chose between pysage candygram dramatis and parley</p> <p>any one try any of these libraries?</p> <p>Thanks a lot for your respons...
<p>I would go for <a href="http://code.google.com/p/pysage/" rel="nofollow noreferrer">pysage</a>.</p> <p>It has the highest level of abstraction and a lightweight messaging API which will give you lots of flexibility. I would imagine when designing an MMO you will want as much flexibility as possible.</p> <p>It al...
<p>I tried to write an MMO in Python, it was horrible. Now I have switched to Erlang and its lightyears ahead of other languages in terms of developing server software. You can check my project at: <a href="http://www.next-gen.cc" rel="nofollow noreferrer">http://www.next-gen.cc</a>.</p> <p>Btw writing the client grap...
40,221
<p>I am looking for a .net templating engine - something simple, lightweight, stable with not too many dependencies. All I need it for at the moment is creating templated plain text and html emails. Can anyone give me a good recommendation?</p> <p>If it helps at all - something like Java's <a href="http://freemarker...
<p>Here's a couple more:</p> <ul> <li><a href="http://code.google.com/p/nhaml/" rel="noreferrer">NHaml</a></li> <li><a href="http://sparkviewengine.com/" rel="noreferrer">Spark</a></li> <li><a href="http://docs.castleproject.org/MonoRail.Brail.ashx" rel="noreferrer">Brail</a> (can be used <a href="https://github.com/c...
<p>Have you seen NVelocity, a .NET port of Velocity? <a href="http://nvelocity.sourceforge.net/" rel="nofollow noreferrer">http://nvelocity.sourceforge.net/</a></p>
44,173
<p>How can I compile a .cs file into a DLL?</p> <p>My project name is WA. In my <code>bin</code> folder after the compilation, I found:</p> <ul> <li><code>WA.exe</code></li> <li><code>WA.vshost.exe</code></li> <li><code>WA.pdb</code></li> </ul>
<p>You have to compile it:</p> <pre><code>csc /t:library source.cs -&gt; source.dll </code></pre>
<p>Its automatically created for you when you run a build in visual studio. Check the bin folder in your project folder.</p>
42,806
<p>For features comparison of Web Canoo Web Functional Test and Selenium software, it would be good have an assessment, in terms of integration to Java platform applications, speed, how quick is it to deploy Tests, execute, and analyze results, JavaScript support etc. I am using Canoo project, it is pretty good. </p>...
<p>So I initially pursued Canoo as a direction for functional tests. I ended up choosing Selenium as we saw that running selenium in browser was a better fit for us than Canoo which uses HTTPUnit to run tests.</p> <p>If you are running tests at build time with selenium you will need to have the browser software you wi...
<p>Canoo webtest reports are very rich in features, not sure if selenium has such in-built reporting capability or if Selenium + TestNG gives the equivalent.</p> <p>Canoo scripting is much simpler and easy..</p>
32,620
<p>Do we need mold release agent in 3D printing mold? If it is not used, what effect will it have on the product?</p>
<p>It seems I misread your question. </p> <h2>3D Printed Mold</h2> <p>You were asking about (or the question now states) use of a mold release compound to prevent a molded part from sticking to a 3d print mold.</p> <p>Yes. It is always beneficial for the molded part to not stick to the mold. Easy separation and p...
<p>Welcome to the 3D Printing Stack Exchange site.</p> <h2>Used in Casting</h2> <p>A mold release agent is commonly used when a part is cast. The release agent is placed on the inside of the mold before the liquid object is added. As the object becomes solid, the release agent prevents the object from adhering to t...
1,459
<p>I query all security groups in a specific domain using </p> <pre><code>PrincipalSearchResult&lt;Principal&gt; results = ps.FindAll(); </code></pre> <p>where ps is a PrincipalSearcher.</p> <p>I then need to iterate the result (casting it to a GroupPrincipal first ) and locate the ones that contains a specific stri...
<p>You can access the 'notes' field of a directory entry as such:</p> <pre><code>// Get the underlying directory entry from the principal System.DirectoryServices.DirectoryEntry UnderlyingDirectoryObject = PrincipalInstance.GetUnderlyingObject() as System.DirectoryServices.DirectoryEntry; // Read the content of ...
<p>For anybody using the "info" attribute:note that it will throw an exception if using an empty string or null value.</p>
41,925
<p>I wish to set a usererror string before leaving a function, depending on the return code and variable in the function.</p> <p>I currently have:</p> <pre><code>Dim RetVal as RetType try ... if ... then RetVal = RetType.FailedParse end try endif ... finally select case RetVal case ... ...
<p>The only real way of doing this in C# would be to declare a variable at the start of the method to hold the value - i.e.</p> <pre><code>SomeType result = default(SomeType); // for "definite assignment" try { // ... return result; } finally { // inspect "result" } </code></pre> <p>In VB, you <em>might</em...
<p>Declare the variable out of the try block, and check in the finally block if it has been set.</p>
39,194
<p>I really want to get the google Calendar Api up an running. I found a <a href="http://www.ibm.com/developerworks/library/x-googleclndr/" rel="nofollow noreferrer">great article</a> about how to get started. I downloaded the Zend GData classes. I have php 5 running on my dev box and all the exetensions should be lo...
<p>I think this use of SSL is part of the Zend GData library so I assume it is correct. I think not having OpenSSL correctly installed is my main issue.</p>
<p>Could you have mistyped the PROTOCOL in the URL? It should be HTTPS, not "SSL". For example, , not SSL://www.google.com:443. Can you double check this in your example client and make sure it is HTTPS, not SSL.</p>
10,192
<p>I have a data set that is organized in the following manner:</p> <pre><code>Timestamp|A0001|A0002|A0003|A0004|B0001|B0002|B0003|B0004 ... ---------+-----+-----+-----+-----+-----+-----+-----+----- 2008-1-1 | 1 | 2 | 10 | 6 | 20 | 35 | 300 | 8 2008-1-2 | 5 | 2 | 9 | 3 | 50 | 38 | 290 | 2 2008...
<p>Same kinda answer here, that was fun:</p> <pre><code>-- Get column names from system table DECLARE @phCols NVARCHAR(2000) SELECT @phCols = COALESCE(@phCols + ',[' + name + ']', '[' + name + ']') FROM syscolumns WHERE id = (select id from sysobjects where name = 'Test' and type='U') -- Get rid of the column we...
<p>OK, I have come up with one solution which should get you started. It will probably take some time to put together, but will perform well. It would be nice if we didn't have to list out all the columns by name.</p> <p>Basically this is using UNPIVOT and placing that product into a temp table, then querying it int...
39,800
<p>Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development.</p>
<p>I am not sure whether I understood your intentions correctly, but let's see if this one helps.</p> <pre><code>public class TypedProperty&lt;T&gt; : Property where T : IConvertible { public T TypedValue { get { return (T)Convert.ChangeType(base.Value, typeof(T)); } set { base.Value = value.To...
<pre><code>public class TypedProperty&lt;T&gt; : Property { public T TypedValue { get { return (T)(object)base.Value; } set { base.Value = value.ToString();} } } </code></pre> <p>I using converting via an object. It is a little bit simpler.</p>
3,008
<p>I am facing a problem with my 3D print. Whenever I am printing any object, the print from the top is shifting to the right hand side - it is symmetric at the bottom but not at the top. </p> <p>Checkout the photo below:</p> <p><a href="https://i.stack.imgur.com/uocCD.jpg" rel="nofollow noreferrer"><img src="https:/...
<p>You appear to have a couple of issues here, </p> <p>First off your nozzle appears to be a bit hot for your filament (you can see this be the drooping and sagginess of the layers on the outer shell)</p> <p>Second issue is it appears as though your belts are loose. You can tell if your belts are loose if your parts ...
<p>Make sure you are using cura 15.02.1, also download the configuration file from the 101hero website, and upload it to cura using the" open profile" button. Make sure your extruder temp is set to 198. I use a 113% flow rate on my 101hero.</p>
560
<p>In what areas of programming would I use state machines ? Why ? How could I implement one ?</p> <p><strong>EDIT:</strong> please provide a practical example , if it's not too much to ask .</p>
<h2>In what areas of programming would I use a state machine?</h2> <p>Use a state machine to represent a (real or logical) object that can exist in a limited number of conditions ("<em>states</em>") and progresses from one state to the next according to a fixed set of rules.</p> <h2>Why would I use a state machine?</...
<p>State driven code is a good way to implement certain types of logic (parsers being an example). It can be done in several ways, for example:</p> <ul> <li><p>State driving which bit of code is actually being executed at a given point (i.e. the state is implicit in the piece of code you are writing). <a href="http:...
31,917
<p>How can I make Emacs show blank spaces (like a space, a tab, a line-jump, etc). Many other editors like Kate and Eclipse have this feature and I find it very useful to see when code is indent-broken because of mix of spaces and tabs (particularly Python).</p>
<p><a href="https://www.emacswiki.org/emacs/WhiteSpace" rel="noreferrer">WhiteSpace</a> mode is an Emacs minor mode for visualizing all white space characters in the current buffer. It can be activated with <code>M-x whitespace-mode</code>.</p> <p>Here is a screenshot of WhiteSpace in action taken directly from the Em...
<p>indent-broken? - never use tabs in your code - disk space is cheap these days.</p> <p>Put <code>(setq-default indent-tabs-mode nil)</code> in your .emacs file. Get used to typing <code>C-x h M-x untabify</code> to untabify the entire buffer. To search for tabs type <code>C-s C-i</code>. If you have obscure control ...
37,494
<p>I've always wanted to be able to get a reasonably elegant way of getting vimdiff to work with a CVS controlled file. I've found numerous (somewhat hacky) scripts around the internet (best example <a href="http://www.vim.org/tips/tip.php?tip_id=390" rel="noreferrer">here</a>) that basically check out the file you are...
<p>I've been working on a similar script here: <a href="http://github.com/ghewgill/vim-scmdiff" rel="nofollow noreferrer">http://github.com/ghewgill/vim-scmdiff</a> (in fact, they may have the same ancestry). I haven't used scmdiff with cvs, but it should do a diff against the branch you have checked out. You can also ...
<p>You could change the call to <code>cvs</code> to take branches into account. That shouldn't be to hard. It bit harder would to change the whole function and make the branch your working a variable (argument, session, global or otherwise).</p>
4,580
<h2>Repetitive Dates:</h2> <p>Billing cycles come in a lot of different formats, for example: "the first of the month", "third Friday of the month", or "first weekday on or after 21st day after the 13th of the month" (thanks visa!). My goal is to be able to represent these different billing cycles in one easily parsed...
<p>You forgot weekend processing. If my bill is due on a Sunday, I want it to show up on Friday. That kind of thing. I think there are three possibilities:</p> <ol> <li>Always before the weekend</li> <li>Always after the weekend</li> <li>If it's Saturday, Friday, and if it's Sunday, Monday</li> </ol>
<p>You forgot weekend processing. If my bill is due on a Sunday, I want it to show up on Friday. That kind of thing. I think there are three possibilities:</p> <ol> <li>Always before the weekend</li> <li>Always after the weekend</li> <li>If it's Saturday, Friday, and if it's Sunday, Monday</li> </ol>
46,636
<p>I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using the following code:</p> <pre><code>Dim Winsock1 As Winsock 'Object type definition Sub Init() Set Winsock1 = CreateObject("MSWinsock.Winsock") 'Object initialization Winsock1.RemoteHost = "MyHost" Winsock1.RemotePort =...
<p>Are you stuck using MSWinsock?<br> <a href="http://www.ostrosoft.com/oswinsck/oswinsck_reference.aspx" rel="nofollow noreferrer">Here</a> is a site/tutorial using a custom winsock object.</p> <p>Also... You need to declare Winsock1 <strong>WithEvents</strong> within a "Class" module:</p> <pre><code>Private WithEve...
<p>Documentation about <strong>Winsock Control</strong>: <br/> <a href="http://msdn.microsoft.com/en-us/library/aa228119%28v=vs.60%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa228119%28v=vs.60%29.aspx</a> <br/> Example here: <br/> <a href="http://support.microsoft.com/kb/163999/en-us" rel="nofollow...
15,313
<p>is there a way to have a mysql select statement return fully qualified column names like "table.field" without using AS for every single field?</p> <p>like so:</p> <pre><code>SELECT * FROM table1 LEFT JOIN table2 on table1.f_ID = table2.ID </code></pre> <p>and the result would be: "table1.ID", "table1.name"...
<p>Not really. You could write some dynamic SQL to accomplish this, but it wouldn't be simple. If you really want the dynamic SQL, let me know and I could try to whip something up.</p>
<pre><code>select table1.* , table1='&lt;======' table2.* , table2='&lt;======' from table1 left join table2 on table1.f_ID = table2.ID </code></pre>
33,666
<p>This query works great:</p> <pre><code>var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op) .SingleOrDefault(); </code></pre> <p>I get a ...
<p>You can use anonymous types for this, i.e.:</p> <pre><code>var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select new { pg, op }).SingleOrDefault(); </code></pre...
<p>change </p> <pre><code>select op) </code></pre> <p>to</p> <pre><code>select new { op, pg }) </code></pre>
5,237
<p>I have to write a component that re-creates SQL Server tables (structure and data) in an Oracle database. This component also has to take new data entered into the Oracle database and copy it back into SQL Server.</p> <p>Translating the data types from SQL Server to Oracle is not a problem. However, a critical di...
<p>I don't see an easy solution for this. </p> <p>Maybe you can store your values as one or more blanks <code>-&gt; ' '</code>, which aren't NULLS in Oracle, or keep track of this special case through extra fields/tables, and an adapter layer.</p>
<p>I've written an explanation on how Oracle handles null values on my blog a while ago. Check it here: <a href="http://www.psinke.nl/blog/hello-world/" rel="nofollow">http://www.psinke.nl/blog/hello-world/</a> and let me know if you have any more questions. If you have data from a source with empty values and you mus...
19,444
<p>Suppose I have the following directory layout in a Maven project:</p> <pre><code>src/ |-- main | |-- bin | | |-- run.cmd | | `-- run.sh | |-- etc | | |-- common-spring.xml | | |-- log4j.xml | | `-- xml-spring.xml | `-- java | `-- com ... </code></pre> <p>I would like to build a zip ...
<p>I use the <a href="http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/" rel="noreferrer">AppAssembler plugin</a> to get something similar. Example:</p> <pre><code>... &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;appassembler-m...
<p>The appassembler generates the 'run.xx' files for you.</p> <p>If you have already created the shell scripts yourself you can use the maven-assembly-plugin to create the zip file. To gather the dependencies you can use maven-dependency-plugin.</p>
35,941
<p>I would like to create a case or a box which has two holes for incoming and exiting water. I want the box to be opened and closed. Therefore it is good to be something like a treasure box.</p> <p>Is there a way to design the lid of the box to prevent water from leaking around the areas where the box and the lid are ...
<p>&quot;Completely&quot; is always relative, but for water at the pressures involved it's probably achievable. Normally you need some sort of <em>gasket</em> (material that can bend/compress to slight imperfections in the mating surfaces), and a means of holding the two surfaces tight against the gasket, to get such a...
<p>I know this sounds obvious, but given the box has holes in the top – does it only need to be watertight when it's the right way up? If not, you could just do something like:</p> <p><a href="https://i.stack.imgur.com/JXft9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JXft9.jpg" alt="enter image...
1,764
<p>Imagine the radio of a car, does the electro magnetic fields through which the car goes through, have interference in the processing? It's easy to understand that a strong field can corrupt data. But what about the data under processment? Can it also be changed?</p> <p>If so how could you protect your code against ...
<p>For the most robust mission critical systems you use multiple processors and compare results. This is what we did with aircraft auto pilot (autolanding). We had three autopilots, one flying the aircraft and two check that one. If any one of the three disagreed, it was shut down.</p>
<p>I doubt you can.</p> <p>Code that is changed won't run, so likely your program(s) will crash if you have this problem.</p> <p>This is a hardware problem.</p>
25,525
<p>I have a WPF app which snaps to screen edges (I just set the .Top or .Left of the window if you're within 20 pixels of the screen edge), but I recently added some code <a href="http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx" rel="noreferrer">provided by the WPF SDK Team</a> to "mess...
<p>The reason this happens is that handling the <code>WM_NCCALCSIZE</code> changes the overall size of the window ... but if you're moving the window, changing your position during <code>WM_MOVE</code> or <code>WM_WINDOWPOSCHANGED</code> (which corresponds to the WPF <code>WindowPositionChanged</code> event) causes ano...
<p>The wParam always seems to be TRUE (1) and lParam is a NCCALCSIZE_PARAMS ... </p> <p>The intent is to do exactly what you said: to force the whole window to be "client" and then use the Vista DWM apis to extend the frame into the client area. I just don't see why it's moving so far to the left...</p> <p>If I trac...
23,477
<pre><code>&lt;input type="submit"/&gt; &lt;style&gt; input { background: url(tick.png) bottom left no-repeat; padding-left: 18px; } &lt;/style&gt; </code></pre> <p>But the bevel goes away, how can I add an icon to submit button and keep the bevel?<br> Edit: I want it to look like the browser default.</p>
<p>Using &lt;.input type="submit" /> with a background will look different depending on what browser / OS you're on.</p> <p>If you want to keep the browser styles, you could use the button element, which allows HTML inside the tag:</p> <pre><code>&lt;button type="submit"&gt;&lt;img src="image.gif" /&gt; Text&lt;/butt...
<p>Use border. For example:</p> <pre><code>INPUT.button { BORDER-RIGHT: #999999 1px solid; BORDER-TOP: #999999 1px solid; FONT-SIZE: 11px; BACKGROUND: url(tick.png) bottom left no-repeat; BORDER-LEFT: #999999 1px solid; CURSOR: pointer; COLOR: #333333; BORDER-BOTTOM: #999999 1px solid ...
28,423
<p>I am writing an iPhone application and need to essentially implement something equivalent to the 'eyedropper' tool in photoshop, where you can touch a point on the image and capture the RGB values for the pixel in question to determine and match its color. Getting the UIImage is the easy part, but is there a way to...
<h2>A little more detail...</h2> <p>I posted earlier this evening with a consolidation and small addition to what had been said on this page - that can be found at the bottom of this post. I am editing the post at this point, however, to post what I propose is (at least for my requirements, which include modifying pix...
<p>To do something similar in my application, I created a small off-screen CGImageContext, and then rendered the UIImage into it. This allowed me a fast way to extract a number of pixels at once. This means that you can set up the target bitmap in a format you find easy to parse, and let CoreGraphics do the hard work o...
17,399
<p>I've been using WWF for a while as part of an internal call center application (ASP.NET), and while learning it was a good practice in understanding how a state machine based workflow system <em>should</em> work, I am definitely not in love with WWF itself. In my opinion it is:</p> <ol> <li>Overly complex, especial...
<p>You could try <a href="http://www.thefreakparade.com/2008/05/simplestatemachine-codeplex-project/" rel="noreferrer">Simple State Machine</a>. You would have to implement access control and background timers yourself, but that shouldn't be a big deal. SSM was also built out of frustration with WF. <a href="http://www...
<p>Do you have the option to consider BizTalk Server?</p>
3,974
<p>I'm looking for a open source .Net HTTP proxy library. Basically I want to develop something like Fiddler (so much lighter with less features).</p>
<p>I've used the Mentalis Proxy at work: <a href="http://www.mentalis.org/soft/projects/proxy/" rel="nofollow noreferrer">http://www.mentalis.org/soft/projects/proxy/</a></p> <p>It's not been touched for a while so there may be a few bugs.</p> <p>Licence details are here: <a href="http://www.mentalis.org/site/license...
<p>There is <a href="http://urlrewriter.sourceforge.net/" rel="nofollow noreferrer">URLRewriter.NET</a>, a free open-source component for IIS/ASP.NET.</p> <p>As the name suggests, it's an URL rewriting component, but it has <strong>also proxying capabilities</strong>. With a simple line like this in the configuration ...
40,101
<p>I am building a 3D printer from scratch, the bed will only move on Z and the head will stay at the top of the printer and move X and Y.</p> <p>How do I modify the Marlin firmware to have the bed lower as it prints instead of lift like most printers.</p>
<p>You can control in Marlin what the direction of the stepper motor is, e.g. my Hypercube CoreXY printer (which has a similar setup like you described) has the following set (in the Marlin <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration.h" rel="nofollow noreferrer"><code>Configuration...
<p>To understand normal commands from a basic printer slicer, all movement commands in g-code are written to be away from the base layer as positive. Note that <em>technically</em> a &quot;lower the bed&quot; printer does violate Orthonormal coordinates unless you either swap X and Y while retaining 0 in the front-left...
1,886
<p>I'm a student about to start my exam project, where I will be responsible for the server implementation of an online game targeting the flash player. I have a hard time to decide wether i should write my own lightweight server in Erlang or use the open source Red5. </p> <p>My experience is that java-developers tend...
<p>I'd say use Red5 if you are ok with programming java - it might feel trivial to implement your own server but I'd guess you probably will find out that there are some more things to it than you are thinking of now.</p> <p>However, if you want to program in erlang and think you'll have loads of fun developing your o...
<p>If you go to <a href="http://www.stripclubcity.com/" rel="nofollow noreferrer">http://www.stripclubcity.com/</a> or more specifically <a href="http://www.stripclubcity.com/new-jersey-strip-clubs" rel="nofollow noreferrer">http://www.stripclubcity.com/new-jersey-strip-clubs</a> they are using Red5 to stream their cam...
48,971
<p>Can ANTLR output C# using StringTemplate or any text I want it to like Yacc/Bison or does it only output to java? From the examples I've looked at it appears to be a very java centric tool.</p>
<p>The ANTLR IDE has option by which you can switch between Java and C# code generation.</p> <p>Better, consult this article (the Specifying Code Generation section):</p> <p><a href="http://www.antlr2.org/doc/csharp-runtime.html" rel="nofollow noreferrer">http://www.antlr2.org/doc/csharp-runtime.html</a></p>
<p>You can download the latest source code as a tar file from <a href="http://antlr.org/download/antlr-3.0.1.tar.gz" rel="nofollow noreferrer">here</a>. The C# runtime (binary) is also available directly, <a href="http://antlr.org/download/DOT-NET-runtime.zip" rel="nofollow noreferrer">here</a>.</p> <p>Which solution...
9,204
<p><strong>UPDATE</strong> - A comprehensive comparison, updated as of February 2015, can be found here:</p> <h1><a href="https://stackoverflow.com/questions/200284/what-are-alternatives-to-extjs/2144878#2144878">Alternatives to Ext JS</a></h1> <hr /> <p><em>2008 question</em>:</p> <p>There are a number of great and no...
<p>When considering a JavaScript library/framework for usage you should first define on your goals. I used to separate all JavaScript libraries/frameworks into three categories by their purpose and architecture:</p> <ol> <li><p>I want to <strong>pimp up my page</strong> with some really "cool" features. Go for <em>Jav...
<p><a href="http://rialto.improve-technologies.com" rel="nofollow noreferrer">Rialto</a> (Rich Internet Application Toolkit) is ajax-based cross browser javascript widgets library. Because it is technology agnostic it can be encapsulated in JSP, JSF, .Net, Python or PHP graphic components. The purpose of Rialto is to e...
26,910
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/65820/unit-testing-c-code">Unit Testing C Code</a> </p> </blockquote> <p>I've seen a few questions specific to C++, but I'm really curious about C. I'm trying to add a standard unit test framework into our buil...
<p>I write embedded software using C and I decided to write my own framework. It's very simple and written for MS Visual Studio. It's easily ported to other platforms. </p> <p><a href="http://code.google.com/p/cunitwin32/" rel="nofollow noreferrer">http://code.google.com/p/cunitwin32/</a></p> <p>If you're targeting l...
<blockquote> <p>We started some work with CUnit, which worked except that everything ran in one thread and any memory faults caused the unit tests to stop running, which was rather annoying. </p> </blockquote> <p>There one C unit testing framework that forks and executes each test cases in a separate process so that...
21,351
<p>I'm making a simple extra java app launcher for Eclipse 3.2 (JBuilder 2007-8) for internal use.</p> <p>So I looked up all the documentations related, including this one <a href="http://www.eclipse.org/articles/Article-Launch-Framework/launch.html" rel="nofollow noreferrer" title="The Launching Framework">The Launch...
<p>I had to add <code>contextualLaunch</code> under <code>org.eclipse.debug.ui.launchShortcuts</code>.</p> <p>The old way seems like it's deprecated a long ago.</p> <p>For other people who are working on the same subject, you might want to extend <code>org.eclipse.ui.commands</code> and bindings, too.</p> <p>I canno...
<p>You class should implement ILaunchShortcut. Check out the <a href="http://help.eclipse.org/help32/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/debug/ui/ILaunchShortcut.html" rel="nofollow noreferrer">Javadoc</a>. </p> <p>What exception are you getting? Check the error log.</p>
4,573
<p>This is my code:</p> <pre class="lang-hs prettyprint-override"><code>type HoraAtendimento = (String, Int, Int) htmlHAtendimento :: [HoraAtendimento] -&gt; Html htmlHAtendimento [] = toHtml "" htmlHAtendimento ((da,hia,hfa):[]) = toHtml da +++ "feira " +++ ...
<p>Look at the type of <code>map</code>. It is <code>(a -&gt; b) -&gt; [a] -&gt; [b]</code>. That doesn't look like your type, which is [a] -> b. That's not a map, that's a fold.</p> <p>The higher-order function you want to look at is <code>foldr</code>. See <a href="http://haskell.org/ghc/docs/latest/html/libraries/b...
<p>You want to fold over a nonempty list. This code might do the trick:</p> <pre><code>type HoraAtendimento = (String, Int, Int) htmlHAtendimento :: [HoraAtendimento] -&gt; Html htmlHAtendimento [] = toHtml "" htmlHAtendimento l = foldl1 (+++) $ map convert l where convert (da,hia,hfa) = toHtml da +++ "feira " +++...
49,334
<p>This is an extension of my <a href="https://stackoverflow.com/questions/205923">earlier XSS question</a>.</p> <p>Assuming that there isn't a Regex strong enough to guarantee XSS saftey for user entered URLs I'm looking at using a redirect.</p> <p>(Although if you do have one please add it under the other question)...
<p>It's not possible to log someone out in just one tab / window.</p>
<p>restrict cookies to www.example.com and have the forwarding page at links.example.com</p>
26,049
<p>I am building an application where most of the HTML is built using javascript. The DOM structure is built using some JSON data structures that are sent from the server, and then the client-side code builds a UI for that data. </p> <p>My current approach is to walk the JSON data structures, and call script.aculo.u...
<p>There are some template solutions out there, but they aren't doing much more than you're doing already. jQuery has been doing some <a href="http://ejohn.org/blog/javascript-micro-templating/" rel="nofollow noreferrer"><strong>work along these lines</strong></a>, and some jQuery <a href="http://plugins.jquery.com/pr...
<p>You can have a look to soma-template, the syntax is quite lightweight.</p> <p>Pure DOM manipulation, a lot of features, natural syntax, fully extensible with other libraries such as underscore.string, function calls with parameters, helpers, watchers. Capability to update only some nodes if needed, templates inside...
24,728
<p>What's the best available online resource.</p>
<p>I have only played with the Mobile Framework briefly but a good start would be <a href="http://msdn.microsoft.com/en-us/windowsmobile/default.aspx" rel="nofollow noreferrer">Windows Mobile Developer Center</a></p> <p>Also it is worth looking at some example open source projects on <a href="http://www.codeplex.com/P...
<p>I've just got a new smart phone, (WinMo 6 Pro) and looking at developing for it. Unfortunately there really seems a lack of clear concise guides/documentation/tutorials/books for native Window Mobile development.</p> <p>Currently the best resource I've found is MSDN, pity it I find it so painful to trawl through.</...
20,055
<p>I am currently using the following command to upload my site content:</p> <pre><code>scp -r web/* user@site.com:site.com/ </code></pre> <p>This works great except that the .htaccess file is not sent. Presumably, this is because it's hidden.</p> <p>I have tried adding a second line to send the file explicitely:</p...
<p>Just combine the two commands:</p> <pre><code>scp -r web/* web/.htaccess user@site.com:site.com/ </code></pre> <p>If you want 0 entries of your password you can set up <a href="http://sial.org/howto/openssh/publickey-auth/" rel="noreferrer">public key authentication</a> for ssh/scp.</p>
<p>A word of caution - don't attempt to match dotted files (like <code>.htaccess</code>) with <code>.*</code> - this inconveniently also matches <code>..</code>, and would result in copying all the files on the path to the root directory. I did this once (with <code>rm</code>, no less!) and I had to rebuild the server ...
5,389
<p>I'm working on a project using 3D printed parts, everything is working very nicely except for one part that needs a 3 mm x 1.2 mm diameter rod. I can print with PLA/PLA+ but such a thin object doesn't seem viable for 3D printing. Is it still possible or am I better off using a 1.2 mm metal dowel?</p> <p>The bigger p...
<p>It would be impossible to print this standing with the rod straight up, and even if you got it to print the part would be very weak due to the thin cross-section of the rod aligning with the layers.</p> <p>The only way to print this part and get a usable result is to print it in the orientation shown in the picture,...
<p>If you insist on printing it entirely, I would suggest cutting the model in two halves through the centerline, printing them flat and gluing both parts together after printing. This will make sure the axial direction of the rod is in the XY plane, and doesn't require support.</p> <p>However, the beauty of 3D printin...
2,098
<p>As much as i like the eclipse diff/merge perspective, when dealing with large projects and multiple branches that need to be merged occasionally there's one feature missing:</p> <p>Is there any way to set the eclipse diff to ignore the CVS tags like <em>$Author:$</em>, <em>$Revision:$</em> and so on?</p> <p>Since ...
<p>This seems to be a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=36436" rel="noreferrer">known bug</a>.</p>
<p>On the other hand, using keyword expansion with your SCM might be considered outdated procedure. <a href="http://wordaligned.org/articles/keyword-substitution-just-say-no" rel="nofollow noreferrer">here</a> are some compelling arguments.</p>
26,845
<p>I'm thinking about using BlogEngine.NET to launch my blog. I'm a C# programmer and was wondering was BlogEngine.NET has in the belly.</p> <p>Does it scale well? Is it caching properly? Is it memory intensive? Can you easily add/remove functionality?</p> <p>I also accept any hosting recommendation :)</p>
<p>I'm running BlogEngine.Net. I don't know about scaling because my weblog isn't that popular (yet). I'm very happy with it. I tried subtext before and I had some stability problems with it, it logged exceptions that I found hard to debug. I got an error exporting the database to BlogML and it messed up the order of ...
<p>It runs well for us. I did see very rare situations where memory skyrocketed when we were getting a DDOS (appeared to be some kind of a memory leak) but in general, it works fine. We don't run the most popular blog, but we did get good amounts of traffic for some of our posts. </p> <p>We wrote our own plugin for ou...
27,323
<p>My wife wants me to use an FFM 3d printer to make custom stamps for her to use on paper (scrap books, letters, etc.). She is convinced, however, that they will be too rigid to make good stamps. A quick google search showed ones made from <a href="https://3dprint.com/110918/3d-printed-stamp-collection/" rel="norefer...
<p>I see three options...</p> <p><strong>1. Print with a flexible filament:</strong></p> <ul> <li>Many options: TPU as you pointed out, the flexible PLA that Tom mentioned, and others. Here's an article with a few options from <a href="https://3dprintingindustry.com/news/which-flexible-3d-printing-filament-should-yo...
<p>Recently I've experimented with printing some <a href="http://rads.stackoverflow.com/amzn/click/B00TOOBPNO" rel="nofollow">Nylon 618 filament</a> after <a href="http://www.matterhackers.com/articles/printing-with-nylon" rel="nofollow">reading stuff online</a> about it. I'm using a Craftbot original with the stock h...
389
<p>In JavaScript, you can use <a href="http://peter.michaux.ca/article/3556" rel="noreferrer">Lazy Function Definitions</a> to optimize the 2nd - Nth call to a function by performing the <strong>expensive</strong> one-time operations only on the first call to the function.</p> <p>I'd like to do the same sort of thing ...
<p>Use a local static var:</p> <pre><code>function foo() { static $called = false; if ($called == false) { $called = true; expensive_stuff(); } } </code></pre> <p>Avoid using a global for this. It clutters the global namespace and makes the function less encapsulated. If other places bes...
<p>If you do wind up finding that an extra boolean test is going to be too expensive, you can set a variable to the name of a function and call it:</p> <pre><code>$func = "foo"; function foo() { global $func; $func = "bar"; echo "expensive stuff"; }; function bar() { echo "do nothing, i guess"; ...
14,453
<p>Is there a preferred way to handle animation when using Flex -- For instance, if I want to render a ball and bounce it around the screen?</p>
<p>I prefer to use a tweening library for things like this. Check these out:</p> <p><a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fcode.google.com%2Fp%2Ftweener%2F&amp;ei=X4nOSIPJAaioesqPveAI&amp;usg=AFQjCNH06RZesH0SEvPCYbJ-J0OMFd7GGQ&amp;sig2=Ki_WXXUX1aHzahMMMSctIw" r...
<p>You can use mx.effects.AnimateProperty even though your target is not a UIComponent. </p> <p>If the tween you want to acheive is a simple one (Move, Resize, Fade etc) this saves you writing the boiler plate code that mx.effects.Tween requires.</p>
8,936
<p>.NET developers out there! Need your opinion here!</p> <p>I am now using <a href="http://www.wholetomato.com" rel="noreferrer">Visual Assist X</a>, a decent piece of software, indeed. But the .NET bloggers seem to prefer <a href="http://www.jetbrains.com/resharper" rel="noreferrer">Resharper</a> more. I might want ...
<p>Resharper is much better for C# code (and supposedly VB.Net, but I haven't tried that). Unfortunately there is no support for C/C++, so if you need that, you might want to keep Visual Assist around. </p> <p>They don't coexist very well, unfortunately, so you may need to unload one, then load the other, when switchi...
<p>I know you only asked for a comparison of Resharper vs. Visual Assist but if you are doing .NET development you may also want to consider <a href="http://devexpress.com/Products/Visual_Studio_Add-in/Refactoring/" rel="nofollow noreferrer">"Refactor! Pro"</a>. </p> <p>I remember using VA years ago when doing Visual...
17,911
<p>I'm trying to print <a href="https://www.thingiverse.com/thing:4461654" rel="nofollow noreferrer">a gear for a robovac deal</a>.</p> <p>The issue I'm having is with gaps between the walls of the top part of the gear. It needs to have the corners filled to provide stability or else the tabs easily snap. I've tried ad...
<p>The problem isn't Cura, rather its the precision of the 3D model. If parts of the model is smaller than the line width the model cannot be printed. A solution to this would be to increase the thickness of the cylinder, decrease the size of the square or reduce the line width to allow that region to be properly fabri...
<p>You can fix it by changing <strong>Experimental</strong> &gt; <strong>Slicing Tolerance</strong> &gt; <strong>Exclusive</strong></p> <p><a href="https://i.stack.imgur.com/htVjk.jpg" rel="nofollow noreferrer" title="Cura screenshot of a model with the Slicing tolerance set to Middle"><img src="https://i.stack.imgur.c...
1,802
<p>I have an Excel macro that deletes a sheet, copies another sheet and renames it to the same name of the deleted sheet. This works fine when run from Excel, but when I run it by calling the macro from Python I get the following error message:</p> <blockquote> <p>Run-time error '1004' - Cannot rename a sheet to the...
<p>I ran the code inside Excel VBA.<br> I am guessing that the following line is failing.<br></p> <p><code> Sheets("CC").Delete </code></p> <p>And that is the reason, you can't give the new sheet same name as existing (non-deleted) sheet.<br> </p> <p>Put <code> Application.DisplayAlerts = False </code> before <code>...
<p>Behind the scenes, VB and VBA are maintaining references to COM objects for the application, worksheets etc. This is why you have the globals 'Application', 'Worksheets' etc. It is possible that VBA is still holding a reference to the worksheet, so Excel hasn't tidied it up properly.</p> <p>Try not using these im...
36,820
<p>I am working on a process to allow people to upload PDF files and manage the document (page order) via a web based interface.</p> <p>The pages of the PDF file need to be cropped to a particular size for printing and currently we run them through a Photoshop action that takes care of this.</p> <p>What I want to do ...
<p>For your second question: you need the <a href="http://everything2.com/index.pl?node_id=859282" rel="noreferrer">Douglas-Peucker Generalization Algorithm</a></p>
<p>I don't know much aobut KML, but I think the usual solution to question #2 involves iterating over the points, and deleting any line segments under a certain size. This will cause some "unfortunate" effects in some cases, but it's relatively fast and easy to do.</p>
23,454
<p>This is a winforms application.</p> <p>In windows, I want the user to click and button, and then a popup should make the user select the path of where they want to save the file.</p>
<p>You want the <a href="http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx" rel="noreferrer">WriteAllText</a> function.</p> <pre><code>using (SaveFileDialog dialog = new SaveFileDialog()) { if (dialog.ShowDialog(this) == DialogResult.OK) { File.WriteAllText(dialog.FileName, yourStrin...
<p><code>StringBuilder.ToString()</code> can be passed to the <code>TextStream.Write()</code> method after creating the file.</p> <p>Using the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog(VS.80).aspx" rel="nofollow noreferrer">SaveFileDialog class</a>, you can let the user selec...
28,573
<p>I have two custom controls that are analogous to a node and the control that draws links between nodes. </p> <p>I would like to have both controls written as much in xaml as possible. The link stores both nodes as dependency properties, and I use databinding to move the line between the nodes whenever the nodes m...
<p>you can try doing something like that:</p> <ol> <li>as in previous post define a width, stroke (whatever you need) property on your link class</li> <li>define a multibinding applied to that property, passing your two nodes to the binding it should look like:</li> </ol> <blockquote> <p>&lt;Multibinding Converter=...
<p>You could define a property StrokeWidth in your link class that gets calculated every time the nodes move and then bind the appropriate style property to it.</p> <p>I suppose you could also try to do something with DataTriggers, but they need specific values to work with - you can't use any kind of expressions. Th...
13,454