instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>So I've had my CR-10 Mini for some months now, and I've been continually having strange problems with bed leveling. Basically, after leveling the bed and printing a part, the bed is no longer leveled for printing again.</p> <p>Just now, I auto-homed, leveled the bed to where there was a pretty good amount of fricti...
<p>The Creality CR-10 Mini is a <strong>portal printer</strong> using a <strong>single Z lead screw at one side</strong> of the portal to move the whole X axis gantry. This implies that the X gantry needs to be very stiff when raised and lowered from one side and also have a minimum of play on the rollers (especially o...
<p>The Creality CR-10 Mini is a <strong>portal printer</strong> using a <strong>single Z lead screw at one side</strong> of the portal to move the whole X axis gantry. This implies that the X gantry needs to be very stiff when raised and lowered from one side and also have a minimum of play on the rollers (especially o...
1,177
<p>In a recent conversation, I mentioned that I was using JavaScript for a web application. That comment prompted a response: "You should use Flex instead. It will cut your development time down and JavaScript is too hard to debug and maintain. You need to use the right tool for the right job." Now, I don't know too mu...
<p>I would push you towards standard web development technologies in most cases. Javascript is no longer a great challenge to debug or maintain with good libs like jQuery/Prototype to iron out some of the browser inconsistencies and tools like Firebug and the MS script debugger to help with debugging.</p> <p>There ar...
<p>Aside from what's already been mentioned here, another major difference is that JavaScript is dynamically typed and ActionScript is statically typed. Whether that's good or bad will depend on your point of view :).</p>
15,583
<p>I'm currently working on upgrading a product for the Chinese market. The target is a ARMTDMI7 with a QVGA display. Most resources I've located on the net are targeted at desktop or web programming rather than embedded devices.</p> <ul> <li>Can anyone suggest some tools and resources that might be useful?</li> <li>W...
<p>I suggest looking at EasyGUI but that depends on what graphics controller you use.</p> <p>EasyGUI is a tool that simplifies design of user interfaces and comes with complete source code and driver for a varity of display controllers.</p> <p>For localization you can use EasyTranslate that gives the translater a gra...
<p>Freetype might be good for rendering fonts.</p> <p><a href="http://www.freetype.org/" rel="nofollow noreferrer">www.freetype.org</a></p>
7,743
<p>I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.</p> <p>The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% ...
<p>Sounds like <a href="https://github.com/clintecker/django-chunks" rel="nofollow noreferrer">django-chunks</a> to me.</p>
<p>Are you talking about <a href="http://www.punteney.com/writes/django-simplepages-basic-page-cms-system/" rel="nofollow noreferrer">Django Simplepages</a>? Official site <a href="http://code.google.com/p/django-simplepages/" rel="nofollow noreferrer">here</a>.</p> <p>Another project that sounds similar to what you'...
32,152
<p>If I have the following code:</p> <pre><code>MyClass pClass = new MyClass(); pClass.MyEvent += MyFunction; pClass = null; </code></pre> <p>Will pClass be garbage collected? Or will it hang around still firing its events whenever they occur? Will I need to do the following in order to allow garbage collection?</p> ...
<p>For the specific question "Will pClass be garbage collected": the event subscription has no effect on the collection of pClass (as the publisher).</p> <p>For GC in general (in particular, the target): it depends whether MyFunction is static or instance-based.</p> <p>A delegate (such as an event subscription) to an...
<p><code>pClass</code> will be garbage collected. However, if the code snippet above is inside another class, the instance of that class might not be cleared if you do not set <code>pClass</code> to <code>null</code>.</p>
38,172
<p>And/or: do I need one?</p> <p>I've recently started using FogBugz for my hobby projects, and I'm very happy with things so far. Having read more about it, especially the evidence-based scheduling, I'd like to start using it for my PhD as well. (Heh; something tells me my supervisors won't be opening tickets for me,...
<p>The official answer is no, there is not a dedicated Mac client, other than Safari :)</p> <p>There's a <a href="http://support.fogcreek.com/default.asp?W840" rel="nofollow noreferrer">command line version</a> that runs on Linux, Windows, and Mac.</p> <p>There are also plans for an iPhone version although I'm not te...
<p>I don't think there is any other such Mac tool. I've never found the web interface too bad personally.</p>
6,942
<p>Clearly separation of concerns is a desirable trait in our code and the first obvious step most people take is to separate data access from presentation. In my situation, LINQ To SQL is being used within data access objects for the data access.</p> <p>My question is, where should the use of the entity object stop? ...
<p>I return IQueryable of POCOs from my DAL (which uses LINQ2SQL), so no Linq entity object ever leaves the DAL. These POCOs are returned to the service and UI layers, and are also used to pass data back into the DAL for processing. Linq handles this very well:</p> <pre><code> IQueryable&lt;MyObjects.Product&gt; produ...
<p>I have actually struggled with this, as well. Using plain vanilla LINQ to SQL, I quickly abandoned the DBML tooling, because it bound the entities to tightly to the DAL. I was striving for a higher level of persistence ignorance, although Microsoft didn't make it very easy.</p> <p>What I ended up doing was hand-w...
38,285
<p>I am creating a Firefox Extension...what would be the javascript to open a URL in the current tab from a menuitem?</p> <p>e.g. in my overlay.xul file i have the following line:</p> <pre><code>&lt;menuitem label="Visit homepage" oncommand="window.location='http://www.somepage.com'"/&gt; </code></pre> <p>but in fir...
<p>After browsing around, I found that I had to replace the above code with this:</p> <pre><code>&lt;menuitem label="Visit homepage" oncommand="content.wrappedJSObject.location='http://www.somepage.com'"/&gt; </code></pre>
<p>Call this JS functions on your commmand</p> <pre><code>//open a url current window: function openUrl(url) { content.wrappedJSObject.location = url; newTabBrowser = gBrowser.selectedBrowser; newTabBrowser.addEventListener("load", highlight, true); } //new tab function openUrlNewTab(url) { var win = Components.class...
40,292
<p>I want to access messages in Gmail from a Java application using <a href="http://www.ing.iac.es/~docs/external/java/javamail/javadocs/index.html" rel="nofollow noreferrer">JavaMail</a> and <a href="https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol" rel="nofollow noreferrer">IMAP</a>. Why am I getting a ...
<p>Using imaps was a great suggestion. Neither of the answers provided just worked for me, so I googled some more and found something that worked. Here's how my code looks now.</p> <pre><code>Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session...
<pre><code>URLName server = new URLName("imaps://&lt;gmail-user-name&gt;:&lt;gmail-pass&gt;@imap.gmail.com/INBOX"); </code></pre>
8,630
<p>I want to know if my server is running Subversion 1.5.</p> <p>How can I find that out?</p> <p>Also would be nice to know my SVN client version number. <code>svn help</code> hasn't been helpful.</p> <p><strong>Note:</strong> I don't want my <em>project's</em> revision number, etc. This question is about the <em>Su...
<p>To find the version of the subversion REPOSITORY you can:</p> <ol> <li>Look to the repository on the web and on the bottom of the page it will say something like:<br> "Powered by Subversion version 1.5.2 (r32768)."</li> <li>From the command line: &lt;insert curl, grep oneliner here&gt;</li> </ol> <p>If not display...
<p>You can connect to your Subversion server using <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" rel="nofollow noreferrer">HTTP</a> and find the version number in the HTTP header.</p>
17,048
<p>Now I know that bigint is 2^64; that is, more atoms than there are in the known universe. I shouldn't be worried, as my mere human brain simply can't get around the enormity of that number.</p> <p>However, let's say that I record every change to every category, product and order in my system, from launch until the...
<p>Even if every of your entries only had 1 byte, 2^64 entries would occupy around 18000000 TB on your hard drive, so I guess you shouldn't worry about this.</p>
<p>The way we handle this is by providing a log archiving functionality, that separates out the log table into separate databases by year, allowing us to reset the identity seed on our LogEvent table.</p> <p>We also have different log tables, though only two main ones.</p>
35,036
<p>Does anyone know of a simple way for a C++ program to communicate directly with a MySQL database? I have looked at MySQL++ and found it to be very confusing. If anyone knows of a very simple way of doing this, please let me know.</p> <p>Thanks</p> <p>P.S. I am developing on a Windows machine. PHP and MySQL web ...
<p>The <a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-function-overview.html" rel="noreferrer">C MySQL API</a> is just like using the PHP MySQL extension and so should be pretty familiar. If you are comfortable with C, I'd recommend that (and you don't mind mixing C in your C++).</p>
<p>Are you sure that the C++ program needs to interact directly with the MySQL database?</p> <p>I would suggest having the C++ program communicate with the web server using simple http requests, and let PHP handle the database. Data can be passed to a server-side PHP script via arguments, and data can be returned in X...
32,137
<p>I would like to develop a mobile application that is able to access all the features of the mobile device it runs on (camera, files, phone and network connectivity). I intend to build a series of applications that each have a specific function to perform, rather than a single application with a large feature set. My...
<p>J2ME is the way to go to reach the masses, in the consumer or the business market. From a consumer standpoint, most of the world's mobile phones support J2ME. From a business standpoint, most of the world's smart phones support J2ME. </p> <p>Nokia owns a 40% share of the smart phone market (and the whole market) wo...
<p>I respectfully disagree with Fostah.</p> <p>If you want to reach the masses, the Web is your best bet. It's far easier to write a simple Web application that will work on millions of devices.</p> <p>And the best bit is that you can easily update your application and <strong>improve the user experience everyday wit...
25,450
<p>Coming from C++ to Java, the obvious unanswered question is why didn't Java include operator overloading?</p> <p>Isn't <code>Complex a, b, c; a = b + c;</code> much simpler than <code>Complex a, b, c; a = b.add(c);</code>?</p> <p>Is there a known reason for this, valid arguments for <em>not</em> allowing operator ...
<p>There are a lot of posts complaining about operator overloading.</p> <p>I felt I had to clarify the &quot;operator overloading&quot; concepts, offering an alternative viewpoint on this concept.</p> <h1>Code obfuscating?</h1> <p>This argument is a fallacy.</p> <h2>Obfuscating is possible in all languages...</h2> <p>I...
<p>Java doesn't permit operator overloading because its creator didn't add the functionality to associate different meanings with the same operator. <strong>They just wanted to keep things simple</strong> by just retaining the meaning of an operator uniform throughout the programming language.</p> <p>Overloading the op...
10,318
<p>I have a silverlight control which has a reference to a silverlight enabled wcf service.</p> <p>When I add a reference to the service in my silverlight control, it adds the following to my clientconfig file:</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &...
<p>My solution:</p> <p>Instead of using the devault constructor (which uses the ServiceReferences.ClientConfig file) to instantiate my proxy class, I use the following:</p> <pre><code>svcMyService.DataAccessClient svcProxy_m; System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding(); ...
<p>I have used relative uri in configuration and my SL4 app works.</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="BasicHttpBinding_ICorrectionService" maxBufferSize="2147483647" max...
48,803
<p>Is it possible to use <code>request.setAttribute</code> on a JSP page and then on HTML Submit get the same request attribute in the <code>Servlet</code>?</p>
<p>No. Unfortunately the Request object is only available until the page finishes loading - once it's complete, you'll lose all values in it unless they've been stored somewhere.</p> <p>If you want to persist attributes through requests you need to either:</p> <ol> <li>Have a hidden input in your form, such as <code>...
<p>i think phil is right request option is available till the page load. so if we want to sent value to another page we want to set the in the hidden tag or in side the session if you just need the value only on another page and not more than that then hidden tags are best option if you need that value on more than one...
28,464
<p>I need to to iterate over the files in a directory and perform the following replacement.</p> <p><strong>Before:</strong></p> <blockquote> <p>Hello ${USER_NAME}, you live at ${HOME_ADDRESS}. It is now ${TIME}</p> </blockquote> <p><strong>After:</strong></p> <blockquote> <p>Hello ${userName}, you live at ...
<p>The <code>-i</code> flag to sed will edit a file in-place. For XXX and YYY, you would use something like:</p> <pre><code>sed -i 's/USER_NAME/userName/g' </code></pre> <p>and so on.</p> <p>Update: I see that your question was really about changing "USER_NAME" into "userName" automatically. You could try this Perl ...
<p>The answer above works really well. For completeness, I might add that you can do:</p> <pre><code>sed '/^Hello/ { s/\$\{USER_NAME\}/\$\{userName\}/g' &lt;filename&gt; \ | sed 's/\$\{HOME_ADDRESS\}/\$\{homeAddress\}/g' \ | sed 's/\$\{TIME\}/\$\{time\}/g' </code></pre> <p>They're functionally identical (excep...
29,873
<p>For a current project, I was thinking of implementing WebDAV to present a virtual file store that clients can access. I have only done Google research so far but it looks like I can get away with only implementing two methods:</p> <pre><code>GET, PROPFIND </code></pre> <p>I think that this is great. I was just cur...
<p>For many WebDAV clients and even for read only access, you will also need to support OPTIONS. If you want to support upload, PUT obviously is required, and some clients (MacOS X?) will require locking support.</p> <p>(btw, <a href="http://www.webdav.org/specs/rfc4918.html" rel="noreferrer">RFC 4918</a> is the autho...
<p>Here is another open source project for WSGI WebDAV <a href="http://code.google.com/p/wsgidav/" rel="nofollow noreferrer">http://code.google.com/p/wsgidav/</a> where I picked up the PyFileServer project.</p>
47,061
<p>I have a problem with the <code>CrystalReportsViewer's</code> toolbar that puzzles me. Let's say I have a report that consists of five pages.</p> <ul> <li><p>If I click the next button, I get to <code>page two</code> as expected, but if I press it again, <code>page two</code> reloads! </p></li> <li><p>I can click t...
<p>Never seen that Dev tool before so it won't be in our supported platforms.</p> <p>I recall something similar and it was due to the screen resolution or zoom level.</p> <p>Have a look at the source code of the page to see what it is doing. Compare it to a VS .NET ASP.NET app to see what the differences are.</p>
<p>I haven't seen this weird behavior before, but I know from a project I worked on a few months ago that Crystal Reports isn't supported on Win2k8 / IIS7 yet. I wish I could find a link that stated that for you, but I remember running into that problem.</p> <p>I had to go the route of setting up a virtual server to ...
33,860
<p>My project is split up into a typical 3 layer structure for a Silverlight app. That is:</p> <ul> <li>A base layer, which is a class library that contains all my business objects, logic, data access etc.</li> <li>A middle layer which is a WCF service which communicates with;</li> <li>My Silverlight front end</li> </...
<p>It seems that you are expecting internal classes used in the WCF service which you have marked as DataContracts to be exported as .NET objects to your client code (the Silverlight UI). WCF does not support this capability. A class marked as a DataContract is just that, a data structure with no methods. If you need a...
<p>I did something similar on a small project by creating a "communication layer" dll, which contained only the objects being passed between client and server. A variation of this (share a dll between all the projects needing these objects) should work for you. Watch out for versioning issues, though. Unless you ha...
22,643
<p>Does anyone know of crossbrowser equivalent of explicitOriginalTarget event parameter? This parameter is Mozilla specific and it gives me the element that caused the blur. Let's say i have a text input and a link on my page. Text input has the focus. If I click on the link, text input's blur event gives me the link ...
<p>There is no equivalent to explicitOriginalTarget in any of the other than Gecko-based browsers. In Gecko this is an internal property and it is not supposed to be used by an application developer (maybe by XBL binding writers).</p>
<p>For IE you can use <code>srcElement</code>, and forced it.</p> <pre><code>if( !selectTag.explicitOriginalTarget ) selectTag.explicitOriginalTarget = selectTag.srcElement; </code></pre>
21,697
<p>What is the difference between a <strong><em>framework</em></strong> and a <strong><em>library</em></strong>? </p> <p>I always thought of a library as a set of objects and functions that focuses on solving a particular problem or a specific area of application development (i.e. database access); and a framework on ...
<p>Actually these terms can mean a lot of different things depending the context they are used. </p> <p>For example, on Mac OS X frameworks are just libraries, packed into a bundle. Within the bundle you will find an actual dynamic library (libWhatever.dylib). The difference between a bare library and the framework on...
<p>Really it depends on what definition you give to the terminology. There's probably a lot of different definitions out there.</p> <p>I think the following are nice explanations based on what I believe this terminology refers to:</p> <p><strong>Deterministic Library</strong></p> <p>A deterministic library holds functi...
17,919
<p>I am new to php and wanted to make a blog using php where every one can see the contents posted in the site but another administrator page should be there which can edit, add or delete posts</p> <p>How can i code a page like that? What are the logics required?</p>
<p>no1: If you just need a blog software, don't write it yourself, there are tons of free services and applications you can use or adapt</p> <p>no2: If you want to do this because you want to learn php, go ahead!</p> <p>no3: Best way of doing this is following a tutorial! 10 seconds of googling is enough and will hel...
<p>Internet tutorials are great. You are going to want to consider two main things:</p> <ol> <li>How you store the data (the posts people write)</li> <li>How you present this to the user.</li> </ol> <p><strong>Data</strong>:</p> <p>You could consider databases but this is probably overkill for a learning excersise. ...
41,438
<p>I have some issue with a Perl script. It modifies the content of a file, then reopen it to write it, and in the process some characters are lost. All words starting with '%' are deleted from the file. That's pretty annoying because the % expressions are variable placeholders for dialog boxes.</p> <p>Do you have any ...
<p>You're using <code>printf</code> there and it thinks its first argument is a format string. See the <a href="http://perldoc.perl.org/functions/printf.html" rel="nofollow noreferrer"><code>printf</code> documentation</a> for details. When I run into this sort of problem, I always ensure that I'm using the functions c...
<p>Or even</p> <pre><code>perl -i bak -pe 's{status=["\'][\w ]*["\']\s*}{}gi;' yourfiles </code></pre> <p>-e says "there's code following for you to run"</p> <p>-i bak says "rename the old file to whatever.bak"</p> <p>-p adds a read-print loop around the -e code</p> <p>Perl one-liners are a powerful tool and can s...
39,727
<p>What Javascript libraries can you recommend for syntax highlighting &lt;code&gt; blocks in HTML?</p> <p>(One suggestion per answer please).</p>
<p>StackOverflow uses the <a href="https://github.com/google/code-prettify" rel="noreferrer">Prettify</a> library.</p>
<p><a href="http://code.google.com/p/syntaxhighlighter/" rel="nofollow noreferrer">SyntaxHighlighter</a></p>
19,424
<p>I'm looking for a way to visually mark or tag a window (any OS) so that it stands out.</p> <p>A while back, I accidentally replaced a live production database containing thousands of records with an empty dev version, simply because the two instances of Enterprise Manager looked identical to one another. I'd like t...
<p>None that I'm aware of, but perhaps a <a href="http://en.wikipedia.org/wiki/Virtual_desktop" rel="nofollow noreferrer">virtual desktop</a> system for your OS of choice would help keep the separation a little better for you.</p>
<p>Since you didn't restrict your question, I'll answer with my solution to this type of problem. I often am logged into multiple different machines with <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" rel="nofollow noreferrer">PuTTY</a> as different users (including as <code>root</code>). If I have a wind...
5,447
<p>I'd like to get <strong>uniform distribution</strong> in range [0.0, 1.0)</p> <p>If possible, please let the implementation make use of random bytes from <strong>/dev/urandom.</strong></p> <p>It would also be nice if your solution was <strong>thread-safe</strong>. If you're not sure, please indicate that.</p> <p>...
<p>This seems to be pretty good way:</p> <p><code><pre> unsigned short int r1, r2, r3; // let r1, r2 and r3 hold random values double result = ldexp(r1, -48) + ldexp(r2, -32) + ldexp(r3, -16); </pre></code></p> <p>This is based on NetBSD's drand48 implementation.</p>
<pre><code>#include &lt;stdlib.h&gt; printf("%f\n", drand48()); </code></pre> <h2>/dev/random:</h2> <pre><code>double c; fd = open("/dev/random", O_RDONLY); unsigned int a, b; read(fd, &amp;a, sizeof(a)); read(fd, &amp;b, sizeof(b)); if (a &gt; b) c = fabs((double)b / (double)a); else c = fabs((double)a / (dou...
17,631
<p>I've gone back and forth between having an organized inbox and having an inbox with absolutely everything I've received in it. </p> <p>Would you recommend leaving everything in an inbox, or organize it? If you organize it, is there any method to your madness or possibly an Outlook (2003) plug-in to aid in this ta...
<p>I would recommend following the <a href="http://video.google.com/videoplay?docid=973149761529535925" rel="nofollow noreferrer">inbox zero</a> approach advocated by 43 folders. Joel Spolsky apparently uses it and a lot of people feel it's a great way of decluttering and organising your email life :-).</p>
<p>The best place to start with getting control of your email is definitely Merlin Mann's excellent <a href="http://www.43folders.com/izero" rel="nofollow noreferrer">Inbox Zero</a> series. In particular his <a href="http://video.google.com/videoplay?docid=973149761529535925&amp;hl=en" rel="nofollow noreferrer">Google...
5,904
<p>Is it possible to subscribe to a Windows event that fires when Windows is going into or coming out of Sleep or Hibernate state?</p> <p>I need my application to be made aware when the computer is going to sleep to do some cleanup and avoid timing issues when it comes out of sleep.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.powermodechanged.aspx" rel="noreferrer"><code>Microsoft.Win32.SystemEvents.PowerModeChanged</code></a> event will give you this information. This event is available in all variants of the .NET framework released by Microsoft so far.</p>
<p>You can subscribe to NetworkChange.NetworkAvailabilityChanged and NetworkChange.NetworkAddressChanged. </p> <p>I generally start a two second timer so that I can resume network communications after being in sleep mode when it times out.</p>
28,254
<p>In the context of a personal project I would like to reproduce the appearance of a commercial product of which I send you a cropped image.</p> <p>I would also like to point out that I do not have the object in question, but it would seem that it is made from a polymer. </p> <p>The product is a case with an embedd...
<p>Surface finish does not really map to the substrate material, Visually, what you have shown could be glass, ceramic, plastic, epoxy or metal.</p> <p>The surface finish is a combination of the shaping process, any post processing, and any surface finishing. Most significantly, there are a wide variety of custom pain...
<p>Is there anything else about this object, but its picture? Softening temperature, biodegradability, is it stiff of flexible, hard or soft, anything could help identifying its material.</p> <p>Also, post-processing (sanding down or chemicals like acetone bath) greatly enhances the range of filaments that can be used...
1,172
<p>I am looking for a data structure that operates similar to a hash table, but where the table has a size limit. When the number of items in the hash reaches the size limit, a culling function should be called to get rid of the least-retrieved key/value pairs in the table.</p> <p>Here's some pseudocode of what I'm w...
<p>You are looking for an <code>LRUList</code>/<code>Map</code>. Check out <code>LinkedHashMap</code>:</p> <p>The <code>removeEldestEntry(Map.Entry)</code> method may be overridden to impose a policy for removing stale mappings automatically when new mappings are added to the map.</p>
<p>Take a look at <strong>WeakHashMap</strong></p>
34,330
<p>I need to keep an NSPathControl updated with the currently selected path in an NSBrowser, but I'm having trouble figuring out a way of getting notifications when the path has changed from the NSBrowser. The ideal way to do this would just to be to observe the path key path in the NSBrowser, but that gives a KVO can ...
<p>Courtesy of Rob Keniger over at <a href="http://cocoadev.com/forums/comments.php?DiscussionID=600&amp;page=1#Item_1" rel="nofollow noreferrer">Cocoa Dev</a>:</p> <blockquote> <p>Have you looked at the SimpleBrowser example in /Developer/Examples? It shows how to get the current selection when it is changed by the us...
<p>I just checked in IB, and it looks like NSBrowser has a selection index paths binding (an array of NSIndexPath objects) that you could possibly monitor with KVO. It's strange but I don't see any mention of it in the docs, so you might need to do a little research to see if that's something you should or shouldn't us...
46,200
<p>I found this web site (photoblog) <a href="http://www.OneReaction.net/" rel="nofollow noreferrer">http://www.OneReaction.net/</a></p> <p>and I am very curious how this is done: 1) From source code you don't see the image URL 2) How to overlay the copyright information on the image without changing the underlying p...
<p>Check this link: <a href="http://blog.donnfelker.com/post/Watermarking-Images-in-ASPNET-with-an-HttpHandler.aspx" rel="nofollow noreferrer">Watermarking Images in ASP.NET with an HttpHandler</a>. It describes a technique for adding watermarks to every image of your site. By changing the path of the <code>HttpHandler...
<p>The URL is in source code</p> <pre><code>&lt;img id="image" title="Condemned to Contrast II" src="Resources/ImageHandler.ashx" alt="Condemned to Contrast II" style="border-width:0px;" /&gt; </code></pre> <p>Try <a href="http://www.onereaction.net/Resources/ImageHandler.ashx" rel="nofollow noreferrer">this lin...
37,385
<p>I can't seem to find an easy to use, .net native way to get Comboboxes on .net winforms to display one value and return another based on the selection without creating my own helper class, with the knowledge that winforms is going to display the ToString method on the object that you put in it.</p> <p>This is how I...
<p>This is a bit of a hack, but it means you don't have to write your own Name-Value pair class - not a big deal (could be there's something better already in the framework). But what you could do is use the DictionaryEntry class - which is effectively a name value pair. Add the items to a list, then use the DataMember...
<p>Well, normally, the object you'd place in the Items collection would have their own ToString() which present the object in a presentable form.</p> <p>If, however, you want to have a completely unrelated string displayed for your object, then you are going to have to do it the way you right.</p>
24,096
<p>We have a pretty big ASP.NET WebForm (web application) project with a lot of references to other libraries, other projects etc and most of the time after a compilation, the first time we load a page it takes a LONG time before rendering anything... Disk IO is the main problem. For small projects it's nearly instan...
<p>MVC still uses the same ASP.NET framework as Web Forms, so you are probably going to see similar behavior, regardless. </p> <p>The long first load time is because your project's build output is still just IL code that needs to be compiled into native code by the JIT compiler before executing. Any code changes that ...
<p>There are a lot of things thhat can be done to improve performance, the enhancements in order to provide for a separation of concerns in MVC apps can help a lot. Though the default view engine re-uses webforms, Views have a far simpler control stack than typical webforms, which helps a lot, not to even mention alte...
47,197
<p>For best performance, is it better to use a virtual IDE HDD or virtual SCSI HDD? If, SCSI, does it matter whether you use an BusLogic or LSILogic?</p>
<p>Go for the SCSI and LSILogic. IDE and BusLogic are for compatibility reasons. Like when you do physical2virtual...</p> <p>There's a whitepaper from vmware showing the difference between LSILogic and BusLogic, which in my opinion is rather small: <a href="http://www.vmware.com/pdf/ESX2_Storage_Performance.pdf" rel="...
<p>I don't think that your choice of Virtual Disk type in VMWare matters for performance. What matters is the following: How much memory you have (the more the better), How many CPU cores you have (the more the better), and more specifically about disks, what matters most is the speed of the physical drive (a 15K RPM S...
9,630
<p>I have a project group that contains a project I'm working on as well as some related component and packages. I prefer to keep the database links active during design-time. </p> <p>I know how to write the code which would change the database file location, but in this case, I'm just using <code>".\data"</code> inst...
<p>I have some projects in delphi7, Delphi2009, Delphi2010 and DelphiXE4 and also my project are not stored in my document. I force the save/default like this:</p> <p>Tools > Options > Environment Options > Default project</p> <p>for Delphi 2010 => U:\Projects\Rad Studio 2010\Projects</p>
<p>Tools -> Options -> Environment Options -> Environment Variables - BDSProjectsDir</p>
3,598
<p>Just looking for the relevant documentation. An example is not necessary, but would be appreciated. </p> <p>We have a situation where we are having to create 100s of virtual directories manually, and it seems like automating this would be a good way to make the process more efficient for now. </p> <p>Perhaps ne...
<p>It is easier to do it with <a href="http://techtasks.com/code/viewbookcode/696" rel="nofollow noreferrer">vbscript</a> too..</p> <pre><code>' This code creates a virtual directory in the default Web Site ' --------------------------------------------------------------- ' From the book "Windows Server Cookbook" by R...
<p>The WIX installer tool creates a way to manage this - you would define them as a part of the installation build instructions. It make some work to get all of the project configured but after that maintenance should be a breeze... Here is an excerpt from the Tutorial on creating the Virtual Directory entries...</p>...
33,360
<p>What techniques are available for sending an email via a webpage or a form on a webpage? </p> <p>I've got some background idea that you POST the form data to a script but I've don't really know what a cgi script is (I'd love to learn if this is the suggested method!) or what the current practice is.</p> <p>This is...
<p>When you submit a form, the data in that form gets sent to the server-side script. For example, in PHP you access that data with the <code>$_POST</code> array, the <code>&lt;input name=""&gt;</code> becomes the arrays index.. For example..</p> <pre><code>// &lt;form action="mailer.php"&gt;[..]&lt;input name="subjec...
<p>If you are using the ASP.NET 2.0, you can use the System.Net.Mail namespace. <a href="http://www.systemnetmail.com/default.aspx" rel="nofollow noreferrer">More information here</a></p>
44,487
<p>Is it possible to change the auto-increment offset on a pre-existing table with JavaDB? </p> <p>I'm having a problem where inserting new records usually (but not always) fails with an error complaining about using an existing key (my auto-increment column). To populate this database, I took a dump from another da...
<p>I don't know how to directly change the offset, but I managed to fix this by:</p> <ol> <li>Changing the increment amount by X (1 million in my case).</li> <li>Inserting a dummy record.</li> <li>Reducing the increment amount back down to 1.</li> <li>Deleting the dummy record.</li> </ol> <p>I used this SQL statement...
<p>I don't know how to directly change the offset, but I managed to fix this by:</p> <ol> <li>Changing the increment amount by X (1 million in my case).</li> <li>Inserting a dummy record.</li> <li>Reducing the increment amount back down to 1.</li> <li>Deleting the dummy record.</li> </ol> <p>I used this SQL statement...
46,161
<p>My thermoplastic FDM printer has a heated bed and uses glass as the printing surface. Sometimes the glass will chip or break entirely when I'm removing my print. This happens most often when the print has a large area in contact with the glass.</p> <p>What can I do to keep this from happening?</p>
<p>Some things I've tried that have helped:</p> <p>Lay down a layer of masking tape. Most people who do this use blue painter's tape. The plastic should stick nicely during printing, yet release reasonably easily when you remove the print from the heated bed.</p> <p>Lay down a later of Kapton tape. The principle is t...
<p>I have 2 suggestions.</p> <p>First, get better glass. high quality <a href="https://en.wikipedia.org/wiki/Borosilicate_glass" rel="nofollow noreferrer">borosilicate plate glass</a> at least 3&nbsp;mm thick should shrug off even scraping with a razor. </p> <p>Second, don't scrape it with a razor, put the whole thin...
134
<p>I'm a complete perl novice, am running a perl script using perl 5.10 and getting this warning: </p> <pre><code>$* is no longer supported at migrate.pl line 380. </code></pre> <p>Can anyone describe what $* did and what the recommended replacement of it is now? Alternatively if you could point me to documentation t...
<p>From <a href="http://perldoc.perl.org/perlvar.html#%24*" rel="nofollow noreferrer">perlvar</a>:</p> <blockquote> <p>Use of $* is deprecated in modern Perl, supplanted by the /s and /m modifiers on pattern matching.</p> </blockquote> <p>If you have access to the place where it's being matched just add it to the e...
<p>It turns on multi-line mode. Since perl 5.0 (from 1994), the correct way to do that is adding a <em><code>m</code></em> and/or the <em><code>s</code></em> modifier to your regexps, like this</p> <pre><code> s/\n?Project.*rebuilt\.//msg </code></pre>
11,416
<p>Eg.</p> <pre><code>ConnectionDetails cd = new ConnectionDetails (); cd.ProviderName = "System.Data.OleDb"; cd.DataSource = "serverAddress"; cd.Catalog = "database"; cd.UserId = "userId"; cd.Password = "password"; string connectionString = cs.CreateConnectionString(); // Should return: // "Provider=SQLOLEDB;Data So...
<p>The closest thing I know of is <a href="http://msdn.microsoft.com/en-us/library/system.data.common.dbconnectionstringbuilder.aspx" rel="nofollow noreferrer">DbConnectionStringBuilder</a>.</p> <p>Because the properties required by different providers vary, it uses an associative array (name value collection) rather ...
<p>There is an OleDbConnectionStringBuilder class that will create the connection string for you. </p> <p>But it sounds like you are trying to get it to generate the provider name for you, and I don't think it really works that way. Since the provider name can vary, that is something that you are going to have to supp...
23,308
<p>I'm developing an Excel 2007 add-in using Visual Studio Tools for Office (2008). I have one sheet with several ListObjects on it, which are being bound to datatables on startup. When they are bound, they autosize correctly.</p> <p>The problem comes when they are re-bound. I have a custom button on the ribbon bar...
<p>If anyone else is having this problem, I have found the cause of this exception. ListObjects will automatically re-size on binding, as long as they do not affect any other objects on the sheet. Keep in mind that ListObjects can only affect the Ranges which they wrap around.</p> <p>In my case, the list object whic...
<p>Just an idea of something to try to see if it gives you more info: Try resizes the list object before the exception line and see if that also throws an exception. If not, try and resize the range object to the new size of the DataTable.</p> <p>You say that this happens when the ListObject shrinks and grows. Does it...
4,083
<p>I was running my first Visual Studio 2008 Unit Test with a WCF Service and I received the following error:</p> <blockquote> <p>Test method UnitTest.ServiceUnitTest.TestMyService threw exception: System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authenti...
<p>I had to change the following IIS and WCF service configurations to get past the "Negotiate,NTLM" exception.</p> <p>IIS Configurations:</p> <blockquote> <p>-- Unchecked "Anonymous Access" checkbox and check the "Integrated Windows authentication" checkbox in the directory security setting for the WCF Servi...
<p>As a side note.....There was a GPO setting "NTLM Authentication Level" that was controls authenication that was causing the unit test to generate the "Negotiate,NTLM" exception. </p>
26,305
<p>I've heard people talking about "base 64 encoding" here and there. What is it used for?</p>
<p>When you have some binary data that you want to ship across a network, you generally don't do it by just streaming the bits and bytes over the wire in a raw format. Why? because some media are made for streaming text. You never know -- some protocols may interpret your binary data as control characters (like a mo...
<p>Base64 can be used for many purposes. </p> <p>The primary reason is to convert binary data to something passable.</p> <p>I sometimes use it to pass JSON data around from one site to another, store information in cookies about a user.</p> <p>Note: You "can" use it for encryption - I don't see why people say you ca...
24,601
<p>Given an array of integers, what is the simplest way to iterate over it and figure out all the ranges it covers? for example, for an array such as:</p> <pre><code>$numbers = array(1,3,4,5,6,8,11,12,14,15,16); </code></pre> <p>The ranges would be:</p> <pre><code> 1,3-6,8,11-12,14-16 </code></pre>
<p>If the array is sorted in ascending order, then the problem is easy. Define a <code>Range</code> structure or class, which has a beginning and an end. Then go through the array. If the current element is one more than the previous, update <code>Range.end</code>, otherwise create a new range with this element as <...
<p>Assuming the list is ordered you could start at the end and keep subtracting the next one down. While the difference is 1, you're in a range. When it's not, you start a new range. </p> <p>i.e </p> <p>16-15 = 1</p> <p>15-14 = 1</p> <p>14-12 = 2, the range is 16-14 - start a new range.</p>
14,331
<p>I need to rearrange some content in various directories but it's a bit of a pain. In order to debug the application I'm working on (a ruby app) I need to move my gems into my gem folder one at a time (long story; nutshell: one is broken and I can't figure out which one).</p> <p>So I need to do something like:</p> ...
<p>Put the following into a file named <code>gemmove</code>:</p> <pre><code>#!/bin/bash if [ &quot;x$1&quot; == x ]; then echo &quot;Must have an arg&quot; exit 1 fi for d in gem doc specification ; do mv &quot;backup/$d/$1&quot; &quot;$d&quot; done </code></pre> <p>then do</p> <pre><code>chmod a+x gemmove </c...
<p>You could simply use the bash shell arguments, like this:</p> <pre><code>#!/bin/bash # This is move.sh mv backup/gem/$1 gem/ mv backup/doc/$1 doc/ # ... </code></pre> <p>and then execute it as:</p> <pre><code>sudo ./move.sh foo </code></pre> <p>Be sure make the script executable, with</p> <pre><code>chmod +x mo...
10,052
<p>I am trying to use <code>set.insert (key)</code> as a conditional, where if the key is inserted correctly (meaning that the key does NOT already exist in the set ) then it should go on and perform some kind of code. For example, something like:</p> <pre><code>if (set.insert( key )) { // some kind of code } </co...
<p>The version of insert that takes a single key value should return a <code>std::pair&lt;iterator,bool&gt;</code>, where the bool indicates whether an insertion was made. A value of true indicates that the value was inserted, and false indicates that the value was already present. So your conditional would look like t...
<p>Other answers have suggested just using '.second', and this will work - but if the processing that you need to perform uses the existing entry in the set, then you can store the full result of the insert:</p> <pre><code>std::pair&lt;std::set&lt;key&gt;::iterator, bool&gt; iResult = set.insert (key); if (iResult.sec...
27,178
<p>I'm trying to build a new .NET C++ project from scratch. I am planning to mix managed and unmanaged code in this project.</p> <p>this forum thread <a href="http://www.daniweb.com/forums/thread29742.html" rel="nofollow noreferrer">IDataObject : ambiguous symbol error</a> answers a problem I've seen multiple times.</...
<p>It's a good idea to always use fully qualified names in header files. Because the <code>using</code> statement affects all following code regardless of <code>#include</code>, putting a <code>using</code> statement in a header file affects everybody that might include that header.</p> <p>So you would change your fun...
<p>I don't know much about .NET, so my answer only applies to the unmanaged c++ part of your question. Personally, this is one of the main reasons I avoid like the plague "using namespace XXXX;" statements.</p> <p>I prefer to just be explicit with namespaces like "std::cout &lt;&lt; "hello world" &lt;&lt; std::endl;"<...
18,100
<p>Several people round here recommended switching to the new <strong>WD Velociraptor 10000rpm</strong> harddisk. Also magazine articles praise the performance. I bought one and mirrored my old system to it. The resulting increase in compilation-speed is somewhat disappointing:</p> <ul> <li>On my old Samsung drive (S...
<p>Are you using the /MP option (undocumented, you have to enter it manually to your processor options) to enable source-level parallel build? That'll speed up your compile much more than just a faster harddisk. Gains from that are marginal.</p>
<p>1200 Source files is a lot, but none of them is likely to be more than a couple hundred K, so while they all need to be read into memory, it's not going to take long to do so.</p> <p>Bumping your system memory to 4G (yes, yes I know about the 3.somethingorother limit that 32-bit OSes have), and maybe looking at you...
23,236
<p>I have three stepper motors. One Nema 17 - 2.4 ohm, the second smaller noname from color printer - 9.5 ohm and third the smallest noname from cdrom - 10.5 ohm.</p> <p>I have connected them to arduino mega 2560 with ramps 1.4(set to 1/32 micro stepping) and drivers drv8825. <a href="https://3dprinting.stackexchange....
<blockquote> <p>The second motor is hot. And the third is very hot. I can not even touch it.</p> </blockquote> <p>This is to some degree, completely normal and expected. From the <a href="https://www.oyostepper.com/images/upload/File/17HS19-1684S1.pdf" rel="nofollow noreferrer">datasheet for a typical NEMA 17 steppe...
<h2>Problem statement</h2> <p>Your RAMPs board is supplying your drivers all with similar voltages, with the basic settings calculated for a NEMA 17. </p> <p>So, we got different Resistances R, so why do they heat differently?</p> <h2>Physics background: energy transformation and dissipation</h2> <p>Resistance can ...
1,250
<p>I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?</p>
<p>As a programmer/hacker, <code>Get-Member</code> and <code>Get-Command</code> are the ones I use more than any others, but the ones I use to show off are <code>Select-Control</code> and <code>Send-Keys</code> from <a href="http://CodePlex.com/WASP" rel="nofollow noreferrer">WASP</a>, the <a href="http://PowerGadgets....
<p>While semi-related to your question, it does not entirely fit the Powershell NetCmdlets motif. But I wanted to post it anyhow as I use it daily and it may help others. Simply making shift-control-c key combo into displaying the visual studio command prompt.</p>
2,473
<p>Today i stumbled upon an interesting performance problem with a stored procedure running on Sql Server 2005 SP2 in a db running on compatible level of 80 (SQL2000).</p> <p>The proc runs about 8 Minutes and the execution plan shows the usage of an index with an actual row count of 1.339.241.423 which is about facto...
<p>Ok, finally i got to it myself.</p> <p>The two query plans are different in a small detail which i missed at first. the slow one uses a nested loops operator to join two subqueries together. And that results in the high number at current row count on the index scan operator which is simply the result of multiplicat...
<p>To me it still sounds as if the statistics were incorrect. Rebuilding the indexes does not necessarily update them.</p> <p>Have you already tried an explicit <code>UPDATE STATISTICS</code> for the affected tables?</p>
27,847
<p>I have a django project pro1 with several apps: app1, app2, app3 and so on. I want to display some top level template that contains blocks from each and every app:</p> <p>example_base_template.html:</p> <pre><code>[header /] [left nav bar]{{ app1 rendered template }}[/left nav bar] [right nav bar]{{ app2 rendered ...
<p>You can use a <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include" rel="nofollow noreferrer">{% include %}</a> tag. But It doesn't help you a lot. The better solution is to write custom <a href="http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags" rel="nofollow n...
<p>Many reusable apps (esp. those selected into the <a href="http://pinaxproject.com/" rel="nofollow noreferrer">Pinax</a> project) serve as great examples on how to use custom template tags to insert content. James Bennett's <a href="http://www.youtube.com/watch?v=A-S0tqpPga4" rel="nofollow noreferrer">talk</a> in Dja...
35,909
<p>I am searching for 3D printing filaments, that are suitable for outdoor purposes, but printable on unheated beds.</p> <p>I will mostly use it for sensor node enclosures (should withstand temperature up to 50°C/120°F) and car accessories (70°C/160°F).</p> <p>If it requires annealing, it should have low shrinkage, s...
<p>This is not an easy one to solve, the firmware of the printer should be keeping the printer at a certain temperature depending on the temperature setting and the current value. If the firmware is not able to keep the temperature at the requested level, but goes beyond that level, that could be considered "strange". ...
<p>A similar condition occurred in my 3D printer. I solved the same. I checked all my connection and I came to know that I connected the thermistor of the extruder in the wrong port. So just check the connection of your thermistor.</p> <hr> <p>Actually my 3D printer circuit board frequently failed because of over cur...
969
<p>The shop that I am working part time with is new to Microsoft CRM. I just want to survey what projects have developers done to the system to extend its capabilities.</p>
<p>I can break the work I did into four sections:</p> <ul> <li><p>Tailoring - Simple field level changes. A lot of this is just making sure the fields and language suited the business I was developing for.</p></li> <li><p>Customisation - More complex changes, generally needing JavaScript and maybe ASP.NET. Some exampl...
<p>We extended 3.0 to send text messages rather than email. There are tools available (for 4.0 at least) to do that now, though.</p> <p>We also extended it to push service appointments through to Exchange, as due to the workforce being mostly mobile they did not have the CRM client for Outlook.</p>
16,413
<p>I recently encountered a problem where a value was null if accessed with Request.Form but fine if retrieved with Request.Params. What are the differences between these methods that could cause this?</p>
<p>Request.Form only includes variables posted through a form, while Request.Params includes both posted form variables and get variables specified as URL parameters.</p>
<p>The reason was that the value I was retrieving was from a form element, but the submit was done through a link + JQuery, not through a form button submit.</p>
2,756
<p>My computer at home is set up to automatically download some stuff from RSS feeds (mostly torrents and podcasts). However, I don't always keep this computer on. The sites I subscribe to have a relatively large throughput, so when I turn the computer back on it has no idea what it missed between the the time it was t...
<p>It sounds like <a href="http://reader.google.com" rel="nofollow noreferrer">Google Reader</a> does everything you're wanting. Not sure what you mean by marking individual items--you'd have to do that with any RSS aggregator.</p>
<p>Writing an aggregator for keeping longer history shouldn't be too hard with a good RSS library.</p>
24,683
<p>This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? </p> <p>Also, how do they relate to XML schemas? Should XSD schemas always be associated with a names...
<p>They're for allowing multiple markup languages to be combined, without having to worry about conflicts of element and attribute names.</p> <p>For example, look at any bit of XSLT code, and then think what would happen if you didn't use namespaces and were trying to write an XSLT where the output has to contain "tem...
<p>From the <a href="http://www.w3.org/TR/REC-xml-names/" rel="nofollow noreferrer">W3 recommendation</a>...</p> <blockquote> <p>XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI referen...
15,622
<p>The company I work for we have a CBT system we have developed. We have to go through and create books out of the content that is in our system, I have developed a program that goes through and downloads all of the content out of our system and creates a offline version of the different training modules.</p> <p>I cr...
<p><a href="http://www.princexml.com/" rel="nofollow noreferrer">PrinceXML</a> is commercial software that generates pdf from websites.</p>
<p>If you control the source it is probably not too difficult to generate pdf directly instead of through a screenshot. </p> <p>Did you try unloading the dll?</p> <p>There are also different ways of getting screenshots:</p> <p><a href="http://mashable.com/2007/08/24/web-screenshots/" rel="nofollow noreferrer">http:/...
48,579
<p>I work for a company that makes items from plastics.<br> Many or our current runs are between 500 and 5000 copies, but knowing the company, if we find a good method to do smaller runs, they are willing to see if it is a good commercial option.</p> <p>At the moment we do use several different methods but the technic...
<p>From an electrical standpoint, a two-phase stepper motors (what most 3D printers use) works the same backwards and forwards, the phase just reverses. If you are stalling on only one direction, I would look to see if you have a mechanical bind in that direction. Generally a wiring issue will cause the motor to eith...
<p>Sounds like you are configured for NC switches but are using NO switches, causing them to invert their reported state. Issue a <strong>M119</strong> command and see if the endstop statuses are correct when none are triggered.</p>
774
<p><a href="https://3dprinting.stackexchange.com/questions/413/methods-for-smoothing-3d-objects">Methods for smoothing 3D objects</a></p> <p>So... maybe one day it becomes community wiki. I think that we need this type of questions, so we can provide more detailed answers to methods and practices.</p>
<p><em>"is still too broad?"</em> is answered by your own question, <em>"we can provide more detailed answers"</em>. </p> <p>The problem essentially is that this Q&amp;A format isn't suited to very long treatises on this type of subject. It's far better to ask a specific question such as <em>"How do I smooth this AB...
<p><em>"is still too broad?"</em> is answered by your own question, <em>"we can provide more detailed answers"</em>. </p> <p>The problem essentially is that this Q&amp;A format isn't suited to very long treatises on this type of subject. It's far better to ask a specific question such as <em>"How do I smooth this AB...
20
<p>My company starts a new project next week. We have planned to develop the application with eclipse rcp. The build process should be fully automated, so we're prepared to set up a continuous integration environment (e.g. Continuum). For the build-automation-part I intended to use maven2, because I want use its depend...
<p>Like most Maven questions, this is solved by a link to a plug-in:</p> <p><a href="http://mojo.codehaus.org/pde-maven-plugin/" rel="nofollow noreferrer">"pde-maven-plugin"</a></p> <p>Other advice:</p> <ol> <li>use the assembly plug-in to build the update site </li> <li>consider using hudson rather than Continuum</...
<p>I've got recently the same problem : build eclipse RCP application through continuous integration.</p> <p>I haven't applied them yet but I've found some interesting articles :</p> <ol> <li>Here's <a href="http://docs.codehaus.org/display/M2ECLIPSE/Tycho+user+docs" rel="nofollow noreferrer">the documentation for Ty...
24,805
<p>I have a page where I submit some data, and return to the original form with a "Save Successful" message. However, the user would like the ability to return to the previous page they were at (which contains search results) by clicking the browser's "Back" button. However, due to the postback, when they click the "...
<p>If you put your "Save" button in an <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx" rel="nofollow noreferrer">UpdatePanel</a>, the postback will not show in the users history.</p>
<p>I would avoid if possible. A better solution would be to have a button that just returns them to their search results on the "Save Successful" screen.</p> <p>The problem with the ajaxy saving and such is that you violate the "Back" rules that users expect. This user might want the Back button to go back to the Se...
12,830
<p>How can one ignore Unexpected element situation in JAXB ans still get all other kind of javax.xml.bind.UnmarshalException?</p> <pre><code>obj = unmler.unmarshal(new StringReader(xml)) </code></pre> <p>Notice i still want to get the obj result of the xml parsing.</p>
<p>The solution.</p> <p>In JAXB implementing ValidationEventHandler like so:</p> <pre><code>class CustomValidationEventHandler implements ValidationEventHandler{ public boolean handleEvent(ValidationEvent evt) { System.out.println("Event Info: "+evt); if(evt.getMessage().contains("Unexpected elem...
<p>Use <code>JAXB.unmarshal()</code> which ignores unexpected elements by default. Be careful, since it will also skip schema validation.</p> <p>JavaDoc: <a href="https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXB.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXB.h...
47,317
<p>.NET, Java and other high level database API's in various language often provide techniques known as prepared statements and parameter binding as opposed to sending plain text commands to the Database server. What I would like to know is what happens when you execute a statement like this:</p> <pre><code>SqlCommand...
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statements.html" rel="nofollow noreferrer">The MySQL manual page</a> on prepared statements provides lots of information (which should apply to any other RDBMS).</p> <p>Basically, your statement is parsed and processed ahead of time, and the parameters ...
<p>If you're using MS SQL, load up the profiler and you'll see what SQL statements are generated when you use parameterised queries. Here's an example (I'm using Enterprise Libary 3.1, but the results are the same using SqlParameters directly) against SQL Server 2005:</p> <pre><code>string sql = "SELECT * FROM tblDoma...
3,572
<p>I'd like to add the <code>HttpOnly</code> flag to <code>JSF/richfaces</code> cookies, especially the session cookie, to up the level of security on my web app. Any ideas? </p>
<p>There may be something that allows you to do this in your servlet engine. This is part of the Servlet 3.0 spec which is yet to be released.</p>
<p>Something like:</p> <pre><code>response.setHeader("Set-Cookie", "yourcookiename=yourcookievalue; HTTPOnly"); </code></pre> <p>might work in a Java environment. I am not aware of a JSF-specific way to achieve this... sorry</p> <p>This seems to be not an easy task in Java.</p>
9,795
<p>How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.</p>
<p>uh? imo this is much simpler </p> <pre><code> set /p texte=&lt; file.txt echo %texte% </code></pre>
<p>Print <em>1st line only</em> (no need to read entire file):</p> <pre><code>set /p a=&lt; file.txt &amp; echo !a! </code></pre> <p>To print one line at a time; user to press a key for next line:<br> (After printing required lines, press Ctrl+C to stop.)</p> <pre><code>for /f &quot;delims=&quot; %a in (downing.txt) do...
15,800
<p><strong>Do <em>you</em> write consumer desktop applications with .NET languages?</strong> If so what type?</p> <p>My impression is that most consumer desktop applications are still native compiled applications in C, C++ and the like.</p> <p>Whilst .NET languages are growing in up take and popularity, do these new ...
<p>I built and maintain a big desktop application written in .NET (1.1, 2.0 now). The application is for Dentists and it works by making use of the Ink technology found in the MIcrosoft.Ink namespace in the TabletPC SDK. Some dentists use Tablet PCs to make things easier and leverage the power of that technology.</p> ...
<p>Well there are apps such as <a href="http://www.gnome.org/projects/tomboy/" rel="nofollow noreferrer">Tomboy</a> and <a href="http://beagle-project.org/Main_Page" rel="nofollow noreferrer">Beagle</a> which are available as part of some Linux distros so I'm not sure if they count as high street consumer applications...
10,774
<p>Basically I want to make sure I will always get the computer's name rather than any proxy or other hardware imbetween.</p>
<p>No you cannot.</p> <p>Everything the server knows about a client is only through the user agent string which the browser supplies, since users can change the user agent string and proxies may strip or modify it you cannot make any assumptions on it.</p>
<p>I don't think that's always possible. If a user is using an anonymous proxy, there's really nothing you can do.</p>
43,286
<p>I have a hidden embedded QuickTime object on my page that I'm trying to control via JavaScript, but it's not working. The object looks like this:</p> <pre><code>&lt;object id="myPlayer" data="" type="audio/mpeg" pluginspage="http://www.apple.com/quicktime/download" width="0" height="0"&gt; &lt;param name="autoP...
<p>Try giving the object element some width and height (1px by 1px) and make it visible within the viewport when you attempt to communicate with the plugin via JavaScript.</p> <p>I've noticed that if the plugin area is not visible on screen it's unresponsive to JS commands.</p> <p>This might explain why this isn't wo...
<p>I don't know the QuickTime API, but this might be worth a shot:</p> <pre><code>player.attributes.getNamedItem('data').value = 'http://yoururlhere'; </code></pre>
19,799
<p>How do you use the LEFT function (or an equivalent) on a SQL Server NTEXT column?</p> <p>Basically I'm building a GridView and I just want to return the first 100 or so characters from the Description column which is NTEXT. </p>
<p>SELECT CAST(ntext_col AS nvarchar(100)) as ntext_substr FROM ...</p> <p>[EDIT] Originally had it returning LEFT(N,100) of CAST to nvarchar(MAX), CASTing will truncate and since LEFT is wanted, that is enough.</p>
<p>You would have to cast it to a VARCHAR(MAX) first.</p>
26,715
<p>I've got a few hundred computers running an app. On one computer, I've seen two instances of a single bit being incorrectly set on some strings that I pull out of SQLite. If this was my dev computer I would assume I have a bug somewhere, but there is certainly some number of installations at which point I'll start...
<p>When I notice strange things happening, my strategy is:</p> <ol> <li>check if there is a bug <strong>in the code</strong></li> <li>check if there is a bug in the used library/tool (SQLite, here)</li> <li>check if there is a bug <strong>in the compiler</strong></li> <li>then, and only then, check for hardware faults...
<p>with subtle errors, it can happen anytime, and from several source, even the <a href="http://www.newscientist.com/blog/technology/2008/03/do-we-need-cosmic-ray-alerts-for.html" rel="nofollow noreferrer">most unlikely</a>.</p> <p>As you can see errors occurring on a single machine, your best option is to handle the ...
20,758
<p>I've used the PHP MVC framework Symfony to build an on-demand web app.</p> <p>It has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as <a href="http://robrosenbaum.com/php/howto-disa...
<p>I looked into it, and my coworker agrees that a heartbeat page call should work, you just have to make sure that the action invoked does reset the session timer (things like ajax field completion don't do this on their own).</p>
<p>The company I work for has been using Symfony and the workaround that we've used is to trigger a warning with javascript before the user gets logged out. I suspect that there is a a way to make 'heartbeat' ajax calls to the server to trigger the timer to reset, but that may be a lot of trouble. I think that there ma...
4,480
<p>In this query:</p> <pre><code>SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON User.CompanyId = Company.Id WHERE Company.CanAccessSystem= true AND(User.CanAccessSystem IS null OR User.CanAccessSystem = true) GROUP BY Company.Id </code></pre> <p>I want to query a list of companies that can acc...
<p>The reason that your result doesn't work is because you don't have any join clause. </p> <pre> SELECT IFNULL(COUNT(User.Id), 0) AS UserCount, Company.* FROM Company LEFT JOIN User ON User.CompanyId = Company.Id AND User.CanAccessSystem = true WHERE Company.CanAccessSystem = true GROUP BY Company.Id </pre> <p>That...
<p>You should be counting the number of users for whom User.CanAccessSystem is true. Think of something like</p> <pre><code> count(case when User.CanAccessSystem then true end) </code></pre> <p>The case expression will return NULL in case User.CanAccessSystem is false (default), and <code>count(expr)</code> counts th...
37,524
<p>The comments on <a href="http://steve-yegge.blogspot.com/" rel="nofollow noreferrer">Steve Yegge</a>'s <a href="http://steve-yegge.blogspot.com/2008/06/rhinos-and-tigers.html" rel="nofollow noreferrer">post</a> about <a href="http://www.mozilla.org/rhino/" rel="nofollow noreferrer">server-side Javascript</a> started...
<p>I'd take Yegge's (and Ola Bini's) opinions on static typing with a grain of salt. If you appreciate what static typing gives you, you'll learn how the type system of the programming language you choose works.</p> <p>IIRC, ML uses the '*' syntax for tuples. &lt;type> * &lt;type> is a tuple type with two elements. So...
<p>It's possible that this was in reference to a badly-written compiler which failed to insert parentheses to disambiguate error messages. Specifically, the function expected a tuple of <code>int</code> and returned an <code>int</code>, but you passed a tuple of <code>int</code> and a function from <code>int</code> to...
42,034
<p>I have a suspicion that I'm using the <code>finally</code> block incorrectly, and that I don't understand the fundamentals of its purpose...</p> <pre><code> function myFunc() { try { if (true) { throw "An error"; } } catch (e) { alert (e); retu...
<blockquote> <p>The finally block contains statements to execute after the try and catch blocks execute but before the statements following the try...catch statement. The finally block executes whether or not an exception is thrown. If an exception is thrown, the statements in the finally block execute even if no cat...
<pre><code>function getTheFinallyBlockPoint(someValue) { var result; try { if (someValue === 1) { throw new Error("Don't you know that '1' is not an option here?"); } result = someValue } catch (e) { console.log(e.toString()); throw e; } finally { ...
36,382
<p>Even a simple <a href="http://en.wikipedia.org/wiki/Notepad_%28software%29" rel="noreferrer">Notepad</a> application in C# consumes megabytes of RAM as seen in the task manager. On minimizing the application the memory size in the task manager goes down considerably and is back up when the application is maximized.<...
<p>The reason for the large memory footprint is that the JIT compiler and <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> engine are being loaded with your process. To reduce this, you can do the following:</p> <pre><code>[DllImport("psapi.dll")] static extern int EmptyWorkingSe...
<p>The task manager does not show real life usage of memory for a .NET app. To see that you almost have to put a performance counter on the app or use a profiler.</p> <p>What you see in the Task Manager is the working memory of an app which includes a bunch of overhead for the framework itself which must also load whe...
27,562
<p>I know that there are a lot of CUDA language bindings, such as PyCUDA, but are there any <em>good</em> bindings for .Net? The only one I've seen is <a href="http://www.gass-ltd.co.il/en/products/cuda.net/" rel="noreferrer">this one</a>, but I'd like to know if there are any others.</p>
<p>Here's another library: <a href="http://sourceforge.net/projects/brahma-fx/" rel="nofollow noreferrer">http://sourceforge.net/projects/brahma-fx/</a></p> <p><em>Edit</em>: I've been looking at the documentation for the project you initially listed, and can say that the interface makes me think: what is the point of...
<p>Checkout this two wrappers:</p> <p>First the Tidepowerd that allow programming in .NET languages like C#, F#, and VB.NET* <a href="http://www.tidepowerd.com/product" rel="nofollow">http://www.tidepowerd.com/product</a></p> <p>Second the CUDA.NET da Hoopoe,<br> <a href="http://www.hoopoe-cloud.com/Solutions/cuda.ne...
28,311
<p>I have a T4 template that generates classes from an xml file. </p> <p>How can I add a dependency between the xml file and the template file so that when the xml file is modified the template is rerun automatically without choosing "Run custom tool" from the context menu?</p>
<p>I don't believe T4 supports automatic template transformation based on an external dependency. I agree with Marc - if you only have one external file, you could create a custom "custom tool" for your XML file or simply use <a href="http://code.msdn.microsoft.com/TTxGen" rel="nofollow noreferrer">ttxgen</a>. However,...
<p>Have you tried using <a href="http://www.olegsych.com/2008/08/t4-xsd-directive/" rel="nofollow noreferrer">&lt;#@ xsd</a>?</p>
35,507
<p>For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine...</p> <pre><code>&lt;%@OutputCache Duration="600" VaryByParam="*" %&gt; </code></pre> <p>However, if someone posts a comment, I want to clear the cache so that the page is refreshed...
<p>I've found the answer I was looking for:</p> <pre><code>HttpResponse.RemoveOutputCacheItem("/caching/CacheForever.aspx"); </code></pre>
<p><code>HttpRuntime.Close()</code> .. I try all method and this is the only that work for me</p>
3,267
<p>How can I change an attribute of an element in an XML file, using C#?</p>
<p>Using LINQ to xml if you are using framework 3.5:</p> <pre><code>using System.Xml.Linq; XDocument xmlFile = XDocument.Load("books.xml"); var query = from c in xmlFile.Elements("catalog").Elements("book") select c; foreach (XElement book in query) { book.Attribute("attr1").Value = "MyNewValu...
<p>Here's the beginnings of a parser class to get you started. This ended up being my solution to a similar problem:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace XML { public class Parser { ...
47,996
<p>I have a semi-diy hotend setup on my MOOZ-2 (an obscure chinese printer). It requires that the total nozzle length (including threading) is longer than 15 mm. So far, I've been using Volcano nozzles because they're the only ones I can find that meet this requirement. However I believe this negatively impacts perform...
<p><strong>I think this is just an overcomplicated lost-PLA (investment) casting.</strong></p> <p>What you're asking for is to create an object, create a mold around it, and then burn out the object and replace it with metal. Traditionally this is done with wax, <a href="https://en.wikipedia.org/wiki/Lost-wax_casting"...
<p>I don't see why it wouldn't work. It doesn't seem to be the optimal way but I haven't tried it.</p> <p>Only thing that might be an issue is that PLA doesn't burn away clean (not for me anyway) which can leave defects in the product. But there are filaments specifically made for casting which apparently burn away wit...
2,135
<p>I am doing the following statements in Java,</p> <pre><code>Obj t[] = new Obj[10]; Obj a = new Obj("a"); t[0] = a; a = new Obj("b"); t[1] = a; </code></pre> <p>Why in java, when i access t[0] , it returns me "a", rather than "b"? Is this because of the GC? and can i believe it is safe to do such an operation</p>...
<p>Here's exactly what's happening.</p> <pre><code>Obj t[] = new Obj[10]; // 1 Obj a = new Obj("a"); // 2 t[0] = a; a = new Obj("b"); // 3 t[1] = a; // 4 </code></pre> <ol> <li><p>You create an array that can hold 10 references to instances of <code>Obj</code>. Call this <code>obj01</code>. ...
<blockquote> <p><em>Why in java, when I access t[0] , it returns me "a", rather than "b"?</em></p> </blockquote> <p>Because you told him to hold a reference to the object with "a".</p> <p>Java don't manipulate directly the objects. Instead I uses has object references. But this reference hold the <strong>value</str...
49,881
<p>To implement "method-missing"-semantics and such in C# 4.0, you have to implement IDynamicObject:</p> <pre><code>public interface IDynamicObject { MetaObject GetMetaObject(Expression parameter); } </code></pre> <p>As far as I can figure out IDynamicObject is actually part of the DLR, so it is not new. But I have...
<p>The short answer is that the MetaObject is what's responsible for actually generating the code that will be run at the call site. The mechanism that it uses for this is LINQ expression trees, which have been enhanced in the DLR. So instead of starting with an object, it starts with an expression that represents th...
<p>Here is what I have figured out so far:</p> <p>The Dynamic Language Runtime is currently maintained as part of the <a href="http://www.codeplex.com/IronPython" rel="nofollow noreferrer">IronPython project</a>. So that is the best place to go for information.</p> <p>The easiest way to implement a class supporting I...
30,519
<p>My current project uses NUnit for unit tests and to drive UATs written with Selenium. Developers normally run tests using ReSharper's test runner in VS.Net 2003 and our build box kicks them off via NAnt.</p> <p>We would like to run the UAT tests in parallel so that we can take advantage of Selenium Grid/RCs so tha...
<p>There hasn't been a lot of work on this subject. I didn't find anything really relevent. </p> <p>However, your point is well taken. Most machines nowadays have more cores and less powerful cores compared to powerful one core cpu. </p> <p>So I did find something on a Microsoft blog. The technology is called PUnit a...
<p>Igor Brejc has a blog post about running tests in parallel using MbUnit.</p> <p>However he does say "Once we integrate Selenium into acceptance testing", so it looks like he was just experimenting, I can't find any other posts so I don't know if he has successfully run Selenium tests in parallel.</p> <p><a href="h...
26,164
<p>I'm looking for a "quick and dirty" C++ testing framework I can use on my Windows/Visual Studio box. It's just me developing, so it doesn't have to be enterprise class software. Staring at a list of testing frameworks, I am somewhat befuddled...</p> <p><a href="http://en.wikipedia.org/wiki/List_of_unit_testing_fra...
<p><a href="http://www.gamesfromwithin.com/articles/0412/000061.html" rel="nofollow noreferrer">Here's a great article about C++ TDD frameworks</a>. For the record, my personal preference is CxxTest, which I have been happily using for about six months now.</p>
<p>To get a bare bones testing suite going, I recommend the include-only "Fructose". It is especially neat if you want your tests to run on platforms where text output requires calling non-standard APIs (think gaming consoles, embedded devices etc.)</p>
22,377
<p>I am developing a touch screen application that has to display a possibly large amount of text. The problem I am having is that the default scroll bar attached to text boxes is just too small to be practically used in a touch screen application. I have tried adding a separate scroll bar control and using it to contr...
<p>I think, there is way how to change size of scrollbar wint Win32API. Look at: <a href="http://pinvoke.net/search.aspx?search=scrollbar&amp;namespace=[All]" rel="nofollow noreferrer">http://pinvoke.net/search.aspx?search=scrollbar&amp;namespace=[All]</a> <a href="http://pinvoke.net/default.aspx/user32/FindWindowEx.ht...
<p>We have been using WPF in our most recent project. Is WPF an option for you? If yes, it appears as if everything UI can be altered in WPF apps. We use 2 UI artists. One works in in Adope Photoshop, then converts the output to XAML. The second works in Expression Blend, which natively produces XAML.</p>
35,640
<p>In our industrial automation application, we need to capture and display the data in the milliseconds.</p> <p>We have data binding between data grid control and a DataTable object. We have around three hundred records which needs to be display in the grid. So we update the 300 records every time we get the records....
<p>You should seriously reconsider your user interface:</p> <ul> <li>Is it really necessary to display 300 values? Ordinary human cannot concentrate on more than 7 things simultaneously,</li> <li>Even if you lower number of parameters, there is frequency of refresh that seems to high to be practical.</li> </ul> <p>Yo...
<p>For starters you need to switch from a DataTable to a DataReader as it is much faster. Secondly I would look at a Lazy Loading architecture. Bind 50 entries and when they scroll to the bottom Bind/Load another 50.</p>
23,282
<p>MySQL ResultSets are by default retrieved completely from the server before any work can be done. In cases of huge result sets this becomes unusable. I would like instead to actually retrieve the rows one by one from the server.</p> <p>In Java, following the instructions <a href="http://dev.mysql.com/doc/refman/5.1...
<p>I think you have to connect passing <code>cursorclass = MySQLdb.cursors.SSCursor</code>:</p> <pre><code> MySQLdb.connect(user="user", passwd="password", db="mydb", cursorclass = MySQLdb.cursors.SSCursor ) </code></pre> <p>The default cursor fetche...
<p>Try to use <strong>MySQLdb.cursors.SSDictCursor</strong></p> <pre><code>con = MySQLdb.connect(host=host, user=user, passwd=pwd, charset=charset, port=port, cursorclass=MySQLdb.cursors.SSDictCursor); cur = con.cursor() cur.exec...
43,790
<p>I'm working on kernel design, and I've got some questions concerning paging.</p> <p>The basic idea that I have so far is this: Each program gets its own (or so it thinks) 4G of memory, minus a section somewhere that I reserve for kernel functions that the program can call. So, the OS needs to figure out some way to...
<p>A good starting point for all these questions is to look at how Unix does it. As a famous quote says, "Those who don't understand UNIX are doomed to reinvent it, poorly."</p> <p>First, about calling kernel functions. It is not enough to simply have the functions somewhere a program can call, since the program is mo...
<p>The answer to this question is highly architecture-dependent. I'm going to assume you're talking about x86. With x86, a kernel generally provides a set of <strong>system calls</strong>, which are predetermined entry points into the kernel. User code can only enter the kernel at those specific points, so the kerne...
34,090
<p>Help! I am using jQuery to make an AJAX call to fill in a drop-down dynamically given the user's previous input (from another drop-down, that is filled server-side). In all other browsers aside from Firefox (IE6/7, Opera, Safari), my append call actually appends the information below my existing option - "Select An ...
<p>Can you just change your success function to reset the selected item to the first option?</p> <pre><code>$("#Products").append(result).selectedIndex = 0; </code></pre> <p>or to set it to the previous selection?</p> <pre><code>var tmpIdx = $("#Products").selectedIndex; $("#Products").append(result).selectedIndex =...
<p>I just did the following and it worked fine:</p> <pre><code>&lt;select name="Products" id="Products"&gt; &lt;option value=""&gt;Select Product&lt;/option&gt; &lt;/select&gt; &lt;script type="text/javascript"&gt; $('#Products').append('&lt;option value="1"&gt;test 1&lt;/option&gt;&lt;option value="3"&gt;test 3&lt;/...
8,171
<p>What materials work well for lubricating moving PLA, ABS, or PETG parts? I'm talking items like the the <a href="https://www.thingiverse.com/thing:53451" rel="nofollow noreferrer">Gear Bearings</a> or <a href="https://www.thingiverse.com/thing:4575774" rel="nofollow noreferrer">Print in Place Engine</a>.</p> <p>I've...
<p>When dealing with lubrication of plastics, any solvent or reactive substance is to be avoided. Petroleum is risky and Vaseline™ is a brand name for petroleum jelly.</p> <p>I've had quite good results using inert lubrication such as PTFE and silicone based lubes. PTFE is the generic term for <a href="http://www.chm.b...
<p>After some testing, I can say that any oil is a bad option.</p> <p>I've found that light oils tend to soak into and <strong>through</strong> any 3D printed FDM parts because of the small voids between lines and in turns and corners.</p> <p>It is possible that resin-printed parts could be more oil-resistant, but I do...
1,751
<p>I got tired of trying Delphi every year hoping that I will find a stable version to upgrade from my good old Delphi 7.</p> <p>Should I bother to try Delphi 2009? Or it is as unstable as the previous versions and should I wait until Delphi 2010?</p> <p>Thanks</p>
<p>This may be an open-ended question, but an important one none-the-less. Borland/Code Gear has not had a consistent track record with Delphi releases and I settled on Delphi 7 for much longer than expected, as did many in the Delphi community. Delphi 7 had an awesome help system, sadly abandoned by Borland thanks to ...
<p>Unfortunately not stable. ActionToolbar and ActionManu are causing IDE exceptions all the time :( TActionToolbar on TCoolbar is very flickering. TListView (with autosized columns) is refreshing very slowly when maximizing the form - it looks horrible. Automatic code templates are horrible, unusable. Jumping between ...
32,773
<p>I'm trying to implement a server control that frobs a couple of files inside the web directory of an ASP.NET site. I'm using VS Web Dev Express 2008 as my IDE. When I call <code>HttpContext.Current.Request.ApplicationPath</code> to get a path to the web root so I can find those files, it returns C:. What the heck?</...
<p>This might be because it's using the development web server, which can just serve files from any directory on your hard drive. It doesn't have any specific root. Can you run your project under IIS (assuming your version of windows supports it), and see if you get the same results? </p> <p>To get rid of the probl...
<p>The <a href="http://peterblum.com/ADME/Home.aspx" rel="nofollow noreferrer">ADME Developer's Kit</a> may be what you need if you are trying to get the directory at design time.</p>
20,460
<p>I completed a python script using pyuno which successfully converted a document/ xls / rtf etc to a pdf. Then I needed to update a mssql database, due to open office currently supporting python 2.3, it's ancientness, lacks support for decent database libs. So I have resorted to using Jython, this way im not burdened...
<p>And so it goes, according to this guy, you need some oil.... and it works like a charm</p> <p><a href="http://www.oooforum.org/forum/viewtopic.phtml?p=304263#304263" rel="nofollow noreferrer">http://www.oooforum.org/forum/viewtopic.phtml?p=304263#304263</a></p> <p>include this lib C:\OpenOffice_24\program\classes\...
<p>Using Jython is a great idea for this I think. But why could you not use two scripts, one with pyuno/2.3 and one with pymssql/2.5 (or whatever db adapter you are using)?.</p> <p>The intermediate format could be anything like a pickle, or json, or XML.</p> <p>Edit: I should add that I have used pyuno quite extensiv...
33,138
<p>I've always preferred to use long integers as primary keys in databases, for simplicity and (assumed) speed. But when using a <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" rel="noreferrer">REST</a> or Rails-like URL scheme for object instances, I'd then end up with URLs like this:</p> <pre>...
<p>I can't say about the web side of your question. But uuids are great for n-tier applications. PK generation can be decentralized: each client generates it's own pk without risk of collision. And the speed difference is generally small.</p> <p>Make sure your database supports an efficient storage datatype (16 bytes...
<p>As long as you use a DB system with efficient storage, HDD is cheap these days anyway...</p> <p>I know GUID's can be a b*tch to work with some times and come with some query overhead however from a security perspective they are a savior. </p> <p>Thinking security by obscurity they fit well when forming obscure URI...
2,782
<p>I've got a large source tree (> 2 GB, WINCE build tree) that I would like to start managing with Subversion. Up to this point, 'versioning' has been managed through keeping multiple copies of the tree, and using Beyond Compare to find differences.</p> <p>The last big stumbling block I see to using Subversion is tha...
<p>There is an svn config option that controls how timestamps are stored in the repository:</p> <pre><code>use-commit-times </code></pre> <blockquote> <p>Normally your working copy files have timestamps that reflect the last time they were touched by any process, whether that be your own editor or by some s...
<p>Subversion will do the comparsion much quicker than even beyond compare will do..</p> <p>If you use tortoiseSVN you even can use beyond compare as external Diff tool.</p>
32,737
<p>What is the best way to find out if a primary key with a certain value already exists in a table?</p> <p>I can think of:</p> <pre><code>SELECT key FROM table WHERE key = 'value'; </code></pre> <p>and count the results, or:</p> <pre><code>SELECT SQL_CALC_FOUND_ROWS key FROM table WHERE key = 'value' LIMIT 1; SELE...
<p>I think either of your suggestions in the question are suitable.</p> <p>Depending on how you are using this though, you can potentially save time by doing an INSERT IGNORE, which allows you to insert a new row if the primary key doesn't exist. If it does exist, the error is ignored so you can continue as normal.</p...
<p>I think it would be more intuitive and simplier to use IF EXISTS.</p> <pre><code> IF EXISTS (SELECT key FROM table WHERE key = 'value') PRINT 'Found it!' ELSE PRINT 'Cannot find it!' </code></pre>
19,935