instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it?</p>
<p>Basic detection can be done with the URL itself, such as “<a href="http://myblog.blogger.com" rel="nofollow n... | <p>Many (most?) blogs will have a meta tag for "generator" which will list the blog engine. For example a blogger blog will contain the following meta tag: </p>
<pre><code><meta name="generator" content="Blogger" />
</code></pre>
<p>My Subtext blog shows the following generator meta tag: </p>
<pre><code>&l... | <p>Some blogs provide a Generator meta tag - e.g. Wordpress - you could find out if there's any exceptions to this.</p>
<p>You'll have to be careful how you detect it though, Google surprised me with this line:</p>
<pre><code><meta content='blogger' name='generator'/>
</code></pre>
<p>Single quotes are blasphe... | 4,609 |
<p>I am new to OpenGL. </p>
<p>Wondering if there is any good Scenegraph API/framework for OpenGL. </p>
<p>At the moment I am using glut with a custom node based solution: I am setting children and siblings for each node the calling a traverse function. </p>
<p>I'd like a more flexible solution when it comes to mana... | <p><a href="http://www.libsdl.org/" rel="nofollow noreferrer">SDL</a> is a bit more up to date than glut, but you are on the right track with rolling your own graph structure to manage scenery. There are plenty of frameworks available. <a href="http://www.opengl.org/sdk/libs/OpenSceneGraph/" rel="nofollow noreferrer">O... | <p>I agree that openscenegraph is a great scenegraph. It is written i C++ and has bindings to some other languages, but not for .NET as far as I know. We were in the situation to use something more than plain old opengl and were looking at managed directx, xna, wpf and opengl. We chose to write our own scenegraph based... | 45,305 |
<p>Sorry for the second newbie question, I'm a developer not a sysadmin so this is all quite new to me. I hope I can explain myself clearly! Here goes.</p>
<p>Here's what I did:</p>
<ul>
<li><p><strong>Logged into the root account</strong></p></li>
<li><p>Created the accounts 'richard' and 'austin'</p></li>
<li><p>Cr... | <p>Looks like you want to use "chmod g+s" or "chmode 2775" to get the SetGID bit set on the directory, that should preserve the group if I remember my permission modes properly.</p>
| <p>How did you change the permissions of /server? Do it recursively, if you didn't.</p>
<p>Good luck!</p>
| 17,708 |
<p>I want to centrally locate all of my application settings in the database. I have a database object which stores the app.settings in an XML column. I'd like to have my application read that object and then parse the XML column into its own app settings. Is there any easy way to arbitrarily read an XML object into... | <p>If you want to go with the preconfigured distribution, but still want to let your developers choose, which plugins from a restricted set of plugins to install additionally, then its worth to create a company internal update site, which <strong>mirrors selected features</strong> and plugins, so your developers can in... | <p>We do not have <em>exactly</em> a common eclipse configuration but rather a common eclipse <strong>distribution</strong>.</p>
<p>A new developer copy that distribution, and launches it through a custom "eclipse.exe" which:</p>
<ul>
<li>calls a script checking if there is any in-house updates I have set up since th... | 45,803 |
<p>I'm moving from Eclipse to Visual Studio .NET and have found all my beloved hotkeys except two:</p>
<ul>
<li>in Eclipse you can press <kbd>ALT</kbd>-<kbd>←</kbd> and <kbd>ALT</kbd>-<kbd>→</kbd> to visit recent changes you have made, something I use frequently to go back to where I was in some other file and then re... | <p>The answers proposed work, but none of them are as nice as eclipse with regard to how they preserve the existing paste buffer, the currently selected characters, and they do not allow the user to operate upon a range of lines. Here is a solution I came up with that preserves the paste buffer, the current character ... | <p>I don't know if VS supports the features you're talking about natively, but I know the resharper plugin allows you to go to the previous edits by using CTRL + SHIFT + BACKSPACE. I don't think it has support for moving a line up and down tho (well not that I've found yet)</p>
| 40,413 |
<p>I am using Django as web framework and then Apache and Lighttpd as web server and static media server respectively. Lighty serves all my static content well and good, but I need to configure it to serve the new files uploaded by the user. Lighttpd is running on a different machine from the Apache(Django) one. My dj... | <p>The simplest answer is that the user uploads to a shared directory that both web servers can access. Then it is available instantly. If you are using unix (sounds like it) then NFS is a possible solution. If you think your site will scale to multiple servers a la flickr then using rsync to push to multiple edge s... | <p>This is the kind of stuff I use rsync for. Do whatever you like on the main server and then periodically (or on demand) rsync push to the static server. Rsync is faster (and more featureful) than anything you can produce with a quick hack.</p>
<p>Just because I'm paranoid I do hourly rsync's of all my customer site... | 45,480 |
<p>Am I correct in assuming that the only difference between "windows files" and "unix files" is the linebreak?</p>
<p>We have a system that has been moved from a windows machine to a unix machine and are having troubles with the format.</p>
<p>I need to automate the translation between unix/windows... | <p>This is only a difference in text files, where UNIX uses a single Line Feed (LF) to signify a new line, Windows uses a Carriage Return/Line Feed (CRLF) and Mac uses just a CR.</p>
<p>Binary files there should be no difference (i.e. a JPEG on a windows machine will be byte for byte the same as the same JPEG on a uni... | <p>In addition to the new-line differences, the <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark" rel="nofollow noreferrer">byte-order mark</a> can cause problems if files are treated as Unicode on Windows.</p>
| 3,823 |
<p>There have been a couple of questions that sort of dealt with this but not covering my exact question so here we go.</p>
<p>For site settings, if these are stored in a database do you:</p>
<ol>
<li>retrieve them from the db every time someone makes a request</li>
<li>store them in a session variable on login</li>
... | <p>I prefer an approach like Glomek proposes... Caching the settings in the WebCache will greatly enhance speed of access. Consider the following:</p>
<pre><code> #region Data Access
private string GetSettingsFromDb(string settingName)
{
return "";
}
private Dictionary<string,string> GetSettingsFromDb(... | <p>Generally I would put site settings in the web.config file, unless you are building an application that has multiple sites and gets changed by the application itself frequently, it usually wouldn't make sense to put it in the database at first.</p>
<p>For user specific settings I would look into starting with the d... | 29,929 |
<p>I am learning to use the Dvorak keyboad layout, but I am not good enough to enter passwords yet, so I need to be able to switch back to qwerty occasionally. In KDE this works very well, Windows fudges this in a way I can live with for the little time I spend on it, but I can't change my work box which runs Solaris... | <p>Try this to get setxkbmap working: <a href="http://bugs.opensolaris.org/view_bug.do?bug_id=6676221" rel="nofollow noreferrer">http://bugs.opensolaris.org/view_bug.do?bug_id=6676221</a></p>
<p>Good luck!</p>
| <p>setxkbmap was added to Solaris Express and OpenSolaris (i.e. Solaris versions newer than Solaris 10), but has not yet been backported to Solaris 10.</p>
<p>On Solaris 10, you can try using xkbcomp directly to modify the XKB layouts, but you may find it's simpler to use the classic xmodmap method of setting the dvor... | 30,410 |
<p>Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio)</p>
| <p>Like others have mentioned, NetBeans' visual editor is pretty good, but it's based pretty heavily on the <a href="https://java.net/projects/appframework/" rel="nofollow noreferrer">Swing Application Framework</a>, so you'd need to get an understanding of how it works to properly use it (although you don't need to di... | <p><a href="https://developers.google.com/java-dev-tools/download" rel="nofollow">window builder pro</a> is good option and it is free also.</p>
| 4,602 |
<p><a href="https://en.wikipedia.org/wiki/Stereolithography">Stereolithography</a> produces parts by projecting ultraviolet light on the top of a vat of liquid photopolymer, causing it to harden. <a href="https://en.wikipedia.org/wiki/Continuous_Liquid_Interface_Production">CLIP</a> produces parts by projecting ultrav... | <p>It's important to understand what specifically is being compared. <strong>CLIP is much faster than bottom-up technologies that require a peel step between every layer.</strong> For example, the Form1 galvo SLA printer tilts the resin vat to separate the transparent bottom from the print. That is, by far, the slowest... | <p>The number of 100x could be true in some situations. I wish I could see the part(s) that they printed to measure this 100x, but that is another story. </p>
<p>Looking at their videos they can move the build plate at a maximum speed of 10mm per minute. You will see the Eiffel tower video where they have to change... | 161 |
<p>I'm developing a multi-threaded app for a Linux embedded platform.</p>
<p>At the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would like to fine tune that value for each thread to something smaller to reduce my application's memory usage. I could go thr... | <p>Here are two tools that measure (native pthreads) stack usage in Linux applications:</p>
<ul>
<li><a href="http://valgrind.org" rel="nofollow noreferrer" title="Valgrind">Valgrind</a></li>
<li><a href="https://github.com/d99kris/stackusage" rel="nofollow noreferrer" title="stackusage">Stackusage</a></li>
</ul>
<p>... | <p>I do not know any good tools but as last resort you could include some code in your application to check it, similar to the following:</p>
<pre><code>__thread void* stack_start;
__thread long stack_max_size = 0L;
void check_stack_size() {
// address of 'nowhere' approximates end of stack
char nowhere;
void* ... | 8,299 |
<p>We have 3 developers all using the same version (VS 2008 SP1) and we all use large VB projects (windows forms). From time to time, the IDE will have all sorts of issues such as locking up, crashing, and even not being able to drag a form object around or it will just instantly disappear.</p>
<p>On the largest of ou... | <p>Yes, I experience this all the time! It has gotten better in 2008, if you can believe it. </p>
<p>I usually find that the reason has to do with an exception in my own code. The UI might bring in a custom control that does not behave well in design mode, causing the problem.</p>
<p>Sometimes, I will bring up a s... | <p>I have personally experienced all sorts of designer wickedness with VS2008 sp1. I uninstalled the service pack to return stability to my dev environment. This is an unfortunate answer, but give it a try.</p>
| 46,470 |
<p>I have 20 ips from my isp. I have them bound to a router box running centos. What commands, and in what order, do I set up so that the other boxes on my lan, based either on their mac addresses or 192 ips can I have them route out my box on specific ips. For example I want mac addy <code>xxx:xxx:xxx0400</code> to go... | <p>Use <code>iptables</code> to setup <code>NAT</code>.<br/></p>
<pre><code>iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 72.049.12.157
iptables -t nat -I POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 72.049.12.158
</code></pre>
<p>This should cause any ips on the <code>192.168.0.0</code> s... | <p>What's the router hardware and software version?</p>
<p>Are you trying to do this with a linux box? Stop now and go get a router. It will save you money long-term.</p>
| 14,543 |
<p>I want to open and manipulate Excel files with ActiveX. I've had success with Python's <a href="http://python.net/crew/mhammond/win32/Downloads.html" rel="nofollow noreferrer">Win32 Extensions</a> and Groovy's <a href="http://groovy.codehaus.org/COM+Scripting" rel="nofollow noreferrer">Scriptom</a> libraries on oth... | <p>Jacob is really the tool for the job here. I recommend that you take the time to learn a bit about how COM and ActiveX work, and I think you'll find that it's easier to use. COM is quite an accomplishment, but it's <em>hard</em>. Wrappers like VB make it seem easy (For the limited use that they work for), but it ... | <p>how about <a href="http://www.nevaobject.com/_docs/_java2com/java2com.htm" rel="nofollow noreferrer">http://www.nevaobject.com/_docs/_java2com/java2com.htm</a> -- this is commercial but works better.</p>
| 21,809 |
<p>Is there any limitations to the WPF Document.Paragraph object when using the FlowDocument control?</p>
<p>I have the FlowDocument turning blank when I add a Paragraph that is more than 450 lines to the Paragraph. I could not locate anything within the MSDN documentation regarding max. lengths etc.</p>
<p>Any idea... | <p>The issue is fixed when IsOptimalParagraphEnabled is set as False. Then the content will be displayed.</p>
<p>Seems this property causes issues with large paragraphs.</p>
| <p>I made a quick test and added 10000 Runs to a Paragraph, and the FlowDocument seemed to display them fine (although it took a bit to calculate the number of pages):</p>
<pre><code>Paragraph p = new Paragraph();
for (int i = 0; i < 10000; i++)
{
p.Inlines.Add(new Run(String.Format("({0}) Sphinx of black quart... | 48,865 |
<pre><code>var pattern = /^0+$/;
</code></pre>
<p>My guess is this:</p>
<p>"Take a look at both the beginning and the end of the string, and if there's a pattern of one or more zeros at the beginning and the end, then return that pattern."</p>
<p>I'm sure that's wrong, though, because when I run the expression with ... | <p>It's saying your string contains only 0... it must begin, then have 1 or more 0's, then end.</p>
| <pre><code>/(^0+|0+$)/
</code></pre>
| 34,747 |
<p>I have the following setup:</p>
<ul>
<li>Code on my local machine (OS X) shared as a Samba share</li>
<li>A Ubuntu VM running within Parallels, mounts the share</li>
</ul>
<p>Running Rails 2.1 (either via Mongrel, WEBrick or passenger) in development mode, if I make changes to my views they don't update without me... | <p>I had the exact same problem while developing on andLinux.
My andLinux's clock was about three hours ahead of the host Windows, and setting the correct time (actually, a minute or so behind) has solved the problem.</p>
| <p>Actually, setting the correct date & time in the VM does seem to have solved the problem (after I restarted mongrel) -- going to do a little more digging.</p>
| 11,340 |
<p>I would like to log each line of G-code to the serial port as it is processed.</p>
<p><strong>Steps to achieve</strong>:</p>
<ul>
<li>the printer reads a file from the SD card</li>
<li>each line it reads will be serial logged (this I can't figure out)</li>
<li>those lines can then read via the serial monitor on a la... | <p>If you have the hardware at hand, you can use OctoPrint to collect the data you require. It's common for users to create an OctoPrint server on a Raspberry Pi, but it can be installed easily on a Windows or Linux machine as well. Once in place, logging is available for various types of information.</p>
<p>From the <... | <p>If you have the hardware at hand, you can use OctoPrint to collect the data you require. It's common for users to create an OctoPrint server on a Raspberry Pi, but it can be installed easily on a Windows or Linux machine as well. Once in place, logging is available for various types of information.</p>
<p>From the <... | 1,798 |
<p>I need to leave some instructional comments for other developers on a page/user control. Is there a better way to do this besides the below?</p>
<pre><code> <% /* DO NOT rename control IDs here, because blah blah blah... */ %>
</code></pre>
| <pre><code><%-- Comment Here --%>
</code></pre>
| <p>That is about it, barring a HTML comment. </p>
<p>Your options are:</p>
<pre><code> <!-- Renders to ClientOutput too -->
</code></pre>
<p>or:</p>
<pre><code> <% /* Your original idea */ %>
</code></pre>
| 31,751 |
<p>When comparing two objects (of the same type), it makes sense to have a compare function which takes another instance of the same class. If I implement this as a virtual function in the base class, then the signature of the function has to reference the base class in derived classes also. What is the elegant way to ... | <p>It depends on the intended semantics of A, B, and C and the semantics of compare(). Comparison is an abstract concept that doesn't necessarily have a single correct meaning (or any meaning at all, for that matter). There is no single right answer to this question.</p>
<p>Here's two scenarios where compare means t... | <p>If you mean that the Compare() in class B or C should always be passed an object of class B or C, no matter what the signature says, you can work with pointers to instances instead of instances, and try to downcast the pointer in the method's code using something like</p>
<pre><code>int B::Compare(A *ptr)
{
othe... | 37,534 |
<p>I have the following code, which will not work. The javascript gives no errors and appears to load fine. but clicking on a link will do nothing. An example of a link is:</p>
<pre><code><a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</li>
</code></pre>
<p>and ... | <p>It may probably be due to the double-quote characters surrounding 'Ed Hardy'. Does this work:</p>
<pre><code><a href="#" onclick="updateByQuery('Layer3', 'Ed Hardy');">Link 1</a><li>Link 2</li>
</code></pre>
| <p>From the wonderful <a href="http://jslint.com" rel="nofollow noreferrer">JSLint</a></p>
<p>You are missing semicolons after these </p>
<pre><code>var xmlHttp
var layername
var url
xmlHttp.onreadystatechange = function() {
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
document.g... | 47,440 |
<p>What are the different types of indexes, what are the benefits of each?</p>
<p>I heard of covering and clustered indexes, are there more? Where would you use them?</p>
| <ul>
<li>Unique - Guarantees unique values for the column(or set of columns) included in the index</li>
<li>Covering - Includes all of the columns that are used in a particular query (or set of queries), allowing the database to use only the index and not actually have to look at the table data to retrieve the results<... | <p>SQL Server 2008 has <a href="http://www.google.md/search?q=microsoft+sql+server+2008+filtered+indexes" rel="nofollow noreferrer">filtered indexes</a>, similar to PostgreSQL's <a href="http://www.postgresql.org/docs/8.0/static/indexes-partial.html" rel="nofollow noreferrer">partial indexes</a>. Both allow to include ... | 16,432 |
<p>I've been reading through the details of the <code>System</code> libraries <code>set</code> and <code>get</code> methods yet the parameters are usually Strings.</p>
<p>Would you consider the use of <code>String</code> as parameters bad practise since the inclusion of <code>enum</code>?</p>
<p>A better alternative ... | <p>I would consider Enums to be a better approach than Strings. They are type safe and comparing them is faster than comparing Strings.</p>
<p>As a pre Java 1.5 alternative you could use the type-safe enum pattern suggested by Joshua Bloch in his book Effective Java. For type-safe enums see also <a href="http://www.ja... | <p>Usage of strings in existing APIs is not bad practice; it is bad practice to change the APIs just because Java has now support for enums. For new APIs, I agree with what everybody else said.</p>
| 34,997 |
<p>I'm currently trying to build a personal website to create a presence on the web for myself. My plan is to include content such as my resume, any projects that I have done on my own and links to open source projects that I have contributed to, and so on. However, I'm not sure which approach would be better from a pe... | <p>I've toyed with this idea in the past but I don't think it's really a good idea for a number of reasons. Firstly, there are a number of places that can take care of most of this without you needing to do the work or maintenance. Just signing up for a linkedIn account for example will allow you to get most of your ne... | <p>I have come to see that the best way to advertise yourself is to put quality content out there. If you write about the technology that you have experience in, maybe create a few tutorials, and if you do all that often enough, that shows some authority in your chosen field of work.</p>
<p>This alone is one of the be... | 3,120 |
<p>What's the best, crossplatform way to perform blackbox tests on AJAX web applications?</p>
<p>Ideally, the solution should have the following attributes:</p>
<ul>
<li>Able to integrate into a continuous integration build loop</li>
<li>Cross platform so I you can run it on Windows laptops and Linux continuous integ... | <p>Selenium might be what you're looking for: <a href="http://selenium.openqa.org/" rel="noreferrer">http://selenium.openqa.org/</a></p>
<p>It allows you to script actions and evaluate the results. It's open-source (Apache 2.0), cross platform, and has nice tools.</p>
| <p>I have used Selenium for exactly this task, but found it to be brittle.</p>
<p>Check out this talk by two Googlers: <a href="http://video.google.com/videoplay?docid=4378663232897374824" rel="nofollow noreferrer">Does my button look big in this? Building testable AJAX applications</a></p>
<p>They isolate the testab... | 9,597 |
<p>I am working on a simple notification service that will be used to deliver messages to the users surfing a website. The notifications do not have to be sent in real time but it might be a better user experience if they happened more frequently than say every 5 minutes. The data being sent to and from the client is n... | <p>Because using a push requires an open HTTP connection to be maintained between your server and each client, I'd go for poll as well - not only is that going to consume a lot of server resources but it's also going to be significantly more tricky to implement as matt b mentioned.</p>
<p>My experience with polling is... | <p>Not sure if you have taken a look at some of the COMET implementations out there (is that what you mean by AJAX push).</p>
<p>If the user is surfing the site, won't that in effect be requesting information from the server that this notification can piggy-back on?</p>
| 27,065 |
<p>I'm working on some Flex spike in my company. We are basically evaluating different scenarios etc. What solution would you recommend for embedding Flex components into Java app? Flex <-> Java communication is not (yet...) an issue, just embedding swf into JFrame.</p>
| <p>I've done it with EasyJCom. It's pretty straight forward as long as you're using one of the standard Java windowing libraries (Swing, awt). You can see an example (From the EZJCom site) here: <a href="http://www.ezjcom.com/FlashTest.java.txt" rel="noreferrer">http://www.ezjcom.com/FlashTest.java.txt</a></p>
<p>The ... | <p>Haven't tested this, but it looks like JFlashPlayer will do the job. <a href="http://www.jpackages.com/jflashplayer/" rel="nofollow noreferrer">http://www.jpackages.com/jflashplayer/</a></p>
| 27,255 |
<p>Is it possible to get a list of all descendant classes of a particular class in objective-c?</p>
<p>Something like:</p>
<pre><code> @interface A : NSObject
@end
@interface B : A
@end
@interface C : A
@end
NSArray *descendants = [A allDescendants]; // descendants = [B, C]
</code></pre>
| <p>The only way I can think is to enumerate the entire list of classes in the runtime (obtained with <code>objc_getClassList</code>) and test each one for <code>isKindOfClass:A</code>.</p>
<p>This is likely the only solution because classes do not maintain links to their descendants (only to their superclass).</p>
| <p>Could you use the class member somehow? Calling <code>[[A class] superclass]</code> returns an instance of the <code>Class</code> class for self's superclass. I think that you can get the name of a class from its <code>Class</code> - would that do what you want?</p>
<p>This doesn't really handle Protocols at all, b... | 47,908 |
<p>In Ruby we have the 'bang' method <code>capitalize!</code> which has the strange behavior of returning a <code>nil</code> if no changes to the string were made.</p>
<p>That means I can't chain this commands with other since it effectively destroys the chain if it returns <code>nil</code>.</p>
<p>What im trying to ... | <p>Use <a href="http://ruby-doc.org/core/classes/String.html#M000810" rel="noreferrer">.capitalize</a> (without the bang) -- unless you actually need it to change the source.</p>
| <p>Since your statement doesn't change the value of fullname, just do:</p>
<pre><code>fname = fullname[0...fullname.index(' ')].capitalize
</code></pre>
<p>Which doesn't return nil if no change is made.</p>
| 39,036 |
<p>I've read a number of posts touting the merits of migrating from VS 2005 to 2008. However, I'd love to hear what the various pitfalls are in actually doing the migration. We're about to migrate and I'd prefer knowing what speed bumps to anticipate and plan for instead of discovering them by surprise along the way. A... | <p>On the off chance you use any Visual Studio plugins, you may experience compatibility problems - when we first switched to it, there wasn't a version of Resharper out yet that supported 2008, so that was a minor issue at the time. Beyond that, we haven't really had any problems with the IDE itself. That being said, ... | <p>We just finished upgrading this past month. I haven't noticed a slowdown - but we have been running SP1 from the start. We made the mistake of installing a Beta version of SP1 (beta for a service pack?!?!) and had to download and run a special tool to remove it before installing the RTM SP1, but that should not affe... | 25,881 |
<p>Is there a maintained package I can use to retrieve and set MP3 ID3 metadata using Python?</p>
| <p>I used <a href="http://eyed3.nicfit.net/" rel="noreferrer">eyeD3</a> the other day with a lot of success. I found that it could add artwork to the ID3 tag which the other modules I looked at couldn't. You'll have to install using pip or download the tar and execute <code>python setup.py install</code> from the sou... | <p>It can depend on exactly what you want to do in addition to reading the metadata. If it is just simply the bitrate / name etc. that you need, and nothing else, something lightweight is probably best.</p>
<p>If you're manipulating the mp3 past that PyMedia may be suitable.</p>
<p>There are quite a few, whatever you... | 3,040 |
<p>I have been looking at metrics for <a href="http://www.ibm.com/developerworks/java/library/j-cq04256/" rel="nofollow noreferrer">coupling</a> and also look at <a href="http://en.wikipedia.org/wiki/Dependency_Structure_Matrix" rel="nofollow noreferrer">DSM</a>. </p>
<p>One of the tools I've been using looks at coupl... | <p>First, it's easy to go overboard looking at dependencies and coupling. Make sure you aren't over complicating it.</p>
<p>With that disclaimer out of the way, here's what I suggest.</p>
<p>There's really 3 different views to dependency/coupling management:
1) physical structure (i.e. assembly dependencies)
2) logi... | <p>coupling and dependency cycles between units of distribution is more "fatal" because it can make it really difficult to deploy your program - and sometimes it can also make it really difficult to even compile your program.</p>
<p>you are mostly right, a good top-level design that divides the code into logical packa... | 15,045 |
<p>I'm trying to call a web service in an Excel Macro:</p>
<pre><code>Set objHTTP = New MSXML.XMLHTTPRequest
objHTTP.Open "post", "https://www.server.com/EIDEServer/EIDEService.asmx"
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.setRequestHeader "SOAPAction", "PutSchedule"
objHTTP.send strXML
</cod... | <p>You SOAP action should also include namespace of the method
e.g.</p>
<pre><code>"http://tempri.org/PutSchedule"
</code></pre>
<p>Find out what the namespace of your Service and add it in front of the method name PutSchedule.</p>
| <p>looks more like you're using xml-rpc instead of soap.
interact with the webservice using the soap type library at : <a href="http://msdn.microsoft.com/en-us/library/aa192537(office.11).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa192537(office.11).aspx</a>, or the one that corresponds wi... | 29,922 |
<p>I am a physics graduate student and I want to create some 3D models for my crystal samples. We have an X-ray diffractometer in our lab. It comes with a goniometer inside it, so basically I can take as many photos as needed from any angles. (I have included a gif animation made of 10 photos taken by the machine as an... | <p>YES, it is possible to make a model from several shots, if you know the angle of rotation between the pictures.</p>
<p>most CAD programs allow to insert a picture, for example as backdrop or to trace it. We are interested in the later use:</p>
<p>We insert the picture, trace it in the picture's layer, then insert th... | <p>You may want to do a search for "photogrammetry". This is software that uses many photos to build a 3D model. Dr. Falkingham did a good review of free software on his blog:</p>
<p><a href="https://peterfalkingham.com/2016/09/14/trying-all-the-free-photogrammetry/" rel="nofollow noreferrer">https://peterfalkingham... | 1,152 |
<p>I'm using SQL Server 2005 and the the Dynamic Management View <code>sys.dm_db_missing_index_details</code>. It continues to tell me that Table1 really needs an index on ColumnX and ColumnY, but that index already exists! I've even dropped and re-created it a couple times to no avail.</p>
<p>More specifics: The view... | <p>Random thought: What if one of the columns is better declared "DESC"?</p>
<p>This is useful for ORDER BY clauses and I've seen logical IO reduce by half.</p>
| <p>If you have dropped & created the index, sp_update_stats shouldn't affect it (problem is not with statistics)</p>
<p>Perhaps it's because of the DMV data is obsolete already
Does Actual Execution Plan suggest the Missing Index in SSMS as well?</p>
<p>From <a href="http://msdn.microsoft.com/en-us/library/ms3454... | 39,298 |
<p>When logging in C#, how can I learn the name of the method that called the current method? I know all about <code>System.Reflection.MethodBase.GetCurrentMethod()</code>, but I want to go one step beneath this in the stack trace. I've considered parsing the stack trace, but I am hoping to find a cleaner more explicit... | <p>Try this:</p>
<pre><code>using System.Diagnostics;
// Get call stack
StackTrace stackTrace = new StackTrace();
// Get calling method name
Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
</code></pre>
<p>one-liner:</p>
<pre><code>(new System.Diagnostics.StackTrace()).GetFrame(1).GetMethod().Name
</cod... | <pre><code>StackFrame caller = (new System.Diagnostics.StackTrace()).GetFrame(1);
string methodName = caller.GetMethod().Name;
</code></pre>
<p>will be enough, I think.</p>
| 20,733 |
<p>I have a jsp page with two radio tags. </p>
<p>The page contains a struts2 form. When I submit the form one of two radio must be automatically checked.</p>
<p>Is it possible to do that?</p>
| <p>One of the features of a radio input is that an item in a radio set once selected cannot be deselected except by another member of the set being selected (unlike a checkbox "set"). i.e. if you initialise the page with a selection you can guarantee you will have a value. Does a default value exist you can do this for... | <p>I believe that with:</p>
<pre><code><html:radio property="foo" value="yes"/>
</code></pre>
<p>this radio tag will show selected (by default) if the method <code>getFoo()</code> of the form-bean returns the string "yes". </p>
<p>May be you can use that to link your form submit to your radio tags ?</p>
| 46,779 |
<p>I'm trying to find the file size of a file on a server. The following code I got from <a href="http://www.thejackol.com/2005/06/11/aspnet-get-file-size/" rel="nofollow noreferrer">this guy</a> accomplishes that for your own server:</p>
<pre><code>string MyFile = "~/photos/mymug.gif";
FileInfo finfo = new FileInfo(... | <p>You can use the <code>WebRequest</code> class to issue an HTTP request to the server and read the <code>Content-Length</code> header (you could probably use HTTP <code>HEAD</code> method to accomplish it). However, not all Web servers respond with a <code>Content-Length</code> header. In those cases, you have to rec... | <p>To get this value you would have to first download the file locally, then you can use the standard methods to get its size.</p>
| 46,576 |
<p>How would you describe the running time of this sort, given a function <code>sorted</code> which returns True if the list is sorted that runs in O(n):</p>
<pre><code>def sort(l):
while not sorted(l): random.shuffle(l)
</code></pre>
<p>Assume shuffling is perfectly random. </p>
<p>Would this be written in big-... | <p>This Algorithm is called <a href="http://Wikipedia.Org/wiki/Bogosort" rel="noreferrer" title="Bogosort">Bogosort</a>. It is an instance of a class of Algorithms called <a href="http://Wikipedia.Org/wiki/Las_Vegas_algorithm" rel="noreferrer" title="Las Vegas Algorithm">Las Vegas Algorithms</a>. Las Vegas Algorithms a... | <p>Big-O notation assumes worst case scenario. In the worst case, this algorithm never terminates. </p>
| 36,787 |
<pre><code>class Tag(models.Model):
name = models.CharField(maxlength=100)
class Blog(models.Model):
name = models.CharField(maxlength=100)
tags = models.ManyToManyField(Tag)
</code></pre>
<p>Simple models just to ask my question.</p>
<p>I wonder how can i query blogs using tags in two different ways.</p>
<u... | <p>You could use Q objects for #1:</p>
<pre><code># Blogs who have either hockey or django tags.
from django.db.models import Q
Blog.objects.filter(
Q(tags__name__iexact='hockey') | Q(tags__name__iexact='django')
)
</code></pre>
<p>Unions and intersections, I believe, are a bit outside the scope of the Django ORM... | <p>Please don't reinvent the wheel and use <a href="http://code.google.com/p/django-tagging/" rel="noreferrer">django-tagging application</a> which was made exactly for your use case. It can do all queries you describe, and much more.</p>
<p>If you need to add custom fields to your Tag model, you can also take a look ... | 13,357 |
<p>Given an amount of days, say 25, convert it into a duration text such as "3 Weeks, 4 Days"</p>
<p>C# and F# solutions would both be great if the F# variation offers any improvement over C#.</p>
<p>Edit: The solution should expand past weeks to include months and years. Bonus points for including centuries and so o... | <pre><code>String.Format("{0} Weeks, {1} days", days / 7, days % 7);
</code></pre>
| <pre><code> public class UnitOfMeasure {
public UnitOfMeasure(string name, int value) {
Name = name;
Value = value;
}
public string Name { get; set; }
public int Value { get; set; }
public static UnitOfMeasure[] All = new UnitOfMeasure[] {
... | 37,962 |
<p>I want to create custom tooltips where I can put any kind of controls. I have derived from CDialog and used the <code>WS_POPUP | WS_BORDER</code> styles. I also add the <code>CS_DROPSHADOW</code> style in the OnInitDialog to get the tooltip shadow.</p>
<p>Then I manage myself the <code>WM_MOUSEHOVER</code> and <cod... | <p>When you create your window, don't set the WS_VISIBLE flag on it. Then you can use ShowWindow with SW_SHOWNA or SW_SHOWNOACTIVATE to make the dialog visible.</p>
| <p>Are you calling <code>CDialog::Create()</code> with <code>WS_VISIBLE</code> set? It might be that even just calling <code>Create()</code> is enough to take focus from the parent. It might also be worth overriding <code>WM_SETFOCUS</code> on your tooltip class and <em>not</em> calling the base class to make it imposs... | 47,397 |
<p>A few weeks ago, I was assigned to evaluate all our programmers. I'm very uncomfortable with this since I was the one who taught everyone the shop's programming language (they all got out of college not knowing the language and as luck would have it, I'm very proficient with it.). On the evaluation, I was very biase... | <p>Gets things done is really all you need to evaluate a developer. After that you look at the quality that the developer generates. Do they write unit tests and believe in testing and being responsible for the code they generate? Do they take initiative to fix bugs without being assigned them? Are they passionate ... | <p>What about getting everyone's input? Everyone that a person is working with will have a unique insight into that person. One person might think someone is a slacker, while another person sees that they are spending a lot of time planning before they start coding, etc.</p>
| 3,494 |
<p>Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number?</p>
<p>Right now I need something that will work with American Express, Discover, MasterCard, and Visa, but it might be helpful if it will also work with other types.</p>
| <p>There are three parts to the validation of the card number:</p>
<ol>
<li><strong>PATTERN</strong> - does it match an issuers pattern (e.g. VISA/Mastercard/etc.)</li>
<li><strong>CHECKSUM</strong> - does it actually check-sum (e.g. not just 13 random numbers after "34" to make it an AMEX card number)</li>
<li><stron... | <p>This is only to make sure that the numbers are valid using some basic RegEX patterns.</p>
<p>Note, this does not check to see if the numbers are in-use by someone.</p>
<p><a href="http://www.roscripts.com/How_to_validate_credit_card_numbers-106.html" rel="nofollow noreferrer">http://www.roscripts.com/How_to_valida... | 21,062 |
<p>This site may attract questions such as</p>
<ul>
<li><p>Is it legal to sell 3D printed objects from a model repository?</p></li>
<li><p>Are 3D printed guns legal in my jurisdiction?</p></li>
<li><p>If my custom-built printer sets my house on fire, does the insurance cover it?</p></li>
</ul>
<p>Are such questions a... | <p><strong>Yes - in some cases.</strong></p>
<p>First, overlap between sites is fine. <em>It doesn't matter if a question is on topic somewhere else</em>; that's no reason to eliminate it from a different site's scope. There were some issues when HSM sprang up, because Mathematics, Physics, and other sites allowed his... | <p>No, such questions should not be allowed. This site deals only with the practical issues of 3D printing. Questions about legal issues should be redirected to sites dealing specifically with those, since users of this site do not have the expertise to address legal issues. A 3D printing expert does not make a legal e... | 10 |
<p>If we develop a winform app using an MVC architecture, it should not be too hard to change over to WPF at a later date, correct? </p>
| <p>Well designed WPF application heavily leverage data-binding. As such, you might consider using classes such as ObservableCollection and others and implement IPropertyNotify when designing your model.</p>
<p>Look up some references to the M-V-VM pattern advocated by Microsoft product groups (e.g., Blend) for more in... | <p>It seems that in Codeplex there is an MVC winform open souce fmwk for developping winforms app
That framework is koossery.MVCwin, located on Codeplex at <a href="http://koosserymvcwin.codeplex.com" rel="nofollow noreferrer">http://koosserymvcwin.codeplex.com</a> </p>
| 33,766 |
<p>Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions:</p>
<ol>
<li>Should table names be plural?</li>
<li>Should column names be singular?</li>
<li>Should I prefix tables or columns?</li>
<li>Should I use any case in ... | <p>I recommend checking out Microsoft's SQL Server sample databases:
<a href="https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks" rel="noreferrer">https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks</a></p>
<p>The AdventureWorks sample uses a very clear and consistent n... | <pre><code>
--Example SQL
CREATE TABLE D001_Students
(
StudentID INTEGER CONSTRAINT nnD001_STID NOT NULL,
ChristianName NVARCHAR(255) CONSTRAINT nnD001_CHNA NOT NULL,
Surname NVARCHAR(255) CONSTRAINT nnD001_SURN NOT NULL,
CONSTRAINT pkD001 PRIMARY KEY(StudentID)
);
CREATE INDEX idxD001_STID on D001_St... | 2,923 |
<p>When using a heated bed with your printer, I have seen claims of running temperatures of 90c throughout the print.</p>
<p>That seems like a fairly high power use to keep a large slab of, say, aluminium at 90c for long print times (ie multiple hours).</p>
<p>Is there a common 'sweet spot' for operating temperature?... | <p>Heatbeds have two purposes:</p>
<ol>
<li>Increase surface energy of the print bed to improve bonding strength of the first layer (particularly important when using surfaces like PEI or Kapton)</li>
<li>Keep the bottom few millimeters of the print hot enough to provide a warp-free foundation for the rest of the prin... | <p>First you say 90c, which means you are talking about ABS likely. I state this as some PLA printers do not even use heated beds, and instead use elaborate rafts only. (Makerbot)</p>
<p>Now that I have gotten that out of the way I wanted to point out to you that it really isn't using that much power. 110 watts (based... | 361 |
<p>It's very painful to add multiple tickets to Trac or to have it as your own todo list. That causes people to use their own task management tools so tasks are then spread all around.</p>
<p>Is there any plugin or macro that would quicken the process of adding a ticket?</p>
| <p>If you're using Eclipse: <a href="http://www.eclipse.org/mylyn/" rel="noreferrer">Mylyn</a> is perfect.</p>
<p>Otherwise you could always get the XML RPC plugin. <a href="http://trac-hacks.org/wiki/XmlRpcPlugin" rel="noreferrer">http://trac-hacks.org/wiki/XmlRpcPlugin</a> and roll your own little tool.</p>
<p>For ... | <p>If Mylyn is working for you, consider checking out <a href="http://tasktop.com" rel="nofollow noreferrer">http://tasktop.com</a> too. Tasktop extends Mylyn with powerful productivity features such as automatic time tracking, web browsing support, email and calendar integration, and more.</p>
| 13,964 |
<p>I am writing a query in SQL server2005. This is returning me a duplicate rows in the result. Can i eliminate this duplication with a particular column as the key?</p>
| <p>You can eliminate complete duplicate rows using the DISTINCT keyword. If there is some key column that is a duplicate but the rest of the columns are not, then you would have to use aggregate functions and a GROUP BY clause to explain to SQL Server what data you do want returned.</p>
| <p>It's possible that your result contains both an associative and a numeric array.</p>
| 14,581 |
<p>For the following example:</p>
<p><a href="http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html" rel="nofollow noreferrer">http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html</a></p>
<p>I would like to make the tabs right aligned and still retain the current order.</p>
<p>I'm ce... | <p>Off the top my head, how about:</p>
<pre><code>
<div id="demo" class="yui-navset">
<ul class="yui-nav" style="text-align:right;">
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li class="selected"><a href="#tab2"><em>Tab Two Label</a></li>
<... | <p>Have you tried applying "text-align: right;" to the container div :</p>
<pre><code><div id="demo" class="yui-navset">
</code></pre>
<p>?</p>
| 48,291 |
<p>I am using a UI component from J2ME Polish. I found a simple bug in the code, and want to quickly fix it but cannot find any build scripts in the download package, although source-code is included. </p>
<p>The problem cannot be solved by extending the class as it involves members with private access. </p>
<p>How s... | <p>I used to use <a href="http://www.texify.com/" rel="nofollow noreferrer">texify.com</a>, but they're no longer available. Now I use <a href="http://code.google.com/apis/chart/infographics/docs/formulas.html" rel="nofollow noreferrer">Google Infographics Mathematical Formulas</a>, which has more features <em>and</em... | <p>I don't know how if this is an acceptable solution for you, but you can upload your own HTML (or any other type for that matter) files on Google Pages. So the proposes solution would be: write manually the HTML pages with the necessary JS tags and upload them to Google Pages.</p>
| 29,423 |
<p>If I've got a table containing Field1 and Field2 can I generate a new field in the select statement? For example, a normal query would be:</p>
<pre><code>SELECT Field1, Field2 FROM Table
</code></pre>
<p>And I want to also create Field3 and have that returned in the resultset... something along the lines of this ... | <pre><code>SELECT Field1, Field2, 'Value' Field3 FROM Table
</code></pre>
<p>or for clarity</p>
<pre><code>SELECT Field1, Field2, 'Value' AS Field3 FROM Table
</code></pre>
| <p>Yes - it's very possible, in fact you almost had it!
Try:</p>
<pre><code>SELECT Field1, Field2, 'Value' AS `Field3` FROM Table
</code></pre>
| 5,994 |
<p>Is it possible to send an email from my Java application using a GMail account? I have configured my company mail server with Java app to send email, but that's not going to cut it when I distribute the application. Answers with any of using Hotmail, Yahoo or GMail are acceptable.</p>
| <p>First download the <a href="https://java.net/projects/javamail/pages/Home" rel="noreferrer">JavaMail API</a> and make sure the relevant jar files are in your classpath.</p>
<p>Here's a full working example using GMail.</p>
<pre><code>import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public cl... | <p>An easy route would be to have the gmail account configured/enabled for POP3 access. This would allow you to send out via normal SMTP through the gmail servers. </p>
<p>Then you'd just send through smtp.gmail.com (on port 587)</p>
| 6,882 |
<p>I'm currently using <a href="http://www.toadsoft.com/" rel="noreferrer">Toad</a> for my day-to-day work on our databases (queries, updates, small scripts, browsing of db objects, etc.).</p>
<p>My question is: since my version of Toad is old and buggy, which are the (possibly free, but not necessarily) alternatives ... | <p>Oracle's <a href="http://www.oracle.com/technology/products/database/sql_developer/index.html" rel="noreferrer">SQL Developer</a>.</p>
| <p>Worked with PL/SQL developer. It rocks.</p>
| 26,423 |
<p>I am a junior programmer. Since my supervisor told me to sit in with the client, I joined. I saw the unsatisfied face of the client despite the successful (from my programmer's perspective) delivery of the project!</p>
<p><strong>Client:</strong> You could have included this!<br>
<strong>Us:</strong> Was not in the... | <p><strong>What you should do to avoid this situation:</strong> </p>
<p>Explicitly spec out what will be included and what will not be included. </p>
<p>The problem probably comes down to the unspecified parts of the spec:</p>
<ul>
<li>The client thinks that unspecified stuff should be in, i.e. it was implied. </li... | <p>Total failure on the part of the person in charge of requirements collection, no doubt about it. Additional failure of the project management to not iterate the deliverable and have check-in meetings with the client.</p>
<p>However, you have a signed-off spec, and what you've delivered matches the spec. So, your ... | 40,673 |
<p>I have a <code>Dictionary<string,int></code> that has the potential to contain upwards of 10+ million unique keys. I am trying to reduce the amount of memory that this takes, while still maintaining the functionality of the dictionary.</p>
<p>I had the idea of storing a hash of the string as a long instead, t... | <p>So I have done something similar recently and for a certain set of reasons that are fairly unique to my application did not use a database. In fact I was try to stop using a database. I have found that GetHashCode is significantly improved in 3.5. One important note, NEVER STORE PERSISTENTLY THE RESULTS FROM GetHash... | <p>Why don't you just use <code>GetHashCode()</code> to get a hash of the string?</p>
| 49,673 |
<p>I try to define a schema for XML documents I receive.</p>
<p>The documents look like:</p>
<pre><code><root>
<items>
<group name="G-1">
<item name="I-1"/>
<item name="I-2"/>
<item name="I-3"/>
<item name="I-4"/>
... | <p>Yes, XSD can handle this. I generated this schema from Visual Studio 2008 (much faster than doing it by hand) and it will do what you're looking for:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.o... | <p>Yes, XSD can handle this. I generated this schema from Visual Studio 2008 (much faster than doing it by hand) and it will do what you're looking for:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.o... | 22,840 |
<p>We have an application which uses COM dll.Now, we are pushing updates of this dll.We copy the new dll ( overwriting the existing one) and register the dll. Is this a good practice.Or, should we first unregister the dll already on clients machine.</p>
| <p>As long as your old COM dll implements the exact same interfaces, there's no reason to unregister/register</p>
| <p>Two things you have to consider if you want just to replace the Com Dll:</p>
<ol>
<li>They old and new have the same GUID.</li>
<li>You haven't append any new interfaces to the updated com Dll.</li>
</ol>
<p>otherwise you should unreg/reg your com dll</p>
| 41,758 |
<p>One thing that's really been making life difficult in getting up to speed on the codebase on an ASP classic project is that the include file situation is kind of a mess. I sometimes find the function I was looking for being included in an include file that is totally unrelated. Does anyone have any advice on how t... | <p>There are a few basic things you can do when taking over a classic ASP application, but you will probably end up regretting doing them.</p>
<ol>
<li><strong>Eliminate duplicate include files</strong>. Every classic ASP app I've ever seen has had 5 "login.asp" pages and 7 "datepicker.js" files and so forth. Hunt d... | <p>i think you should consider moving your code from ASP VBScript to Visual Basic COM DLLs. that'll ease on you having too much includes.</p>
| 17,342 |
<p>We have a web application project (not a web site), until the day we have added batch="false" to web.config web development server was compiling all the web application instead of the page that was requested.</p>
<pre><code><compilation debug="true" batch="false">
<assemblies>
...
&l... | <p>T is for <strong>T</strong>ype. But it's really just a tradition and there is nothing to prevent you from using other names. For example, generic dictionaries use <code><TKey, TValue></code>.</p>
<p>There is also a <a href="http://msdn.microsoft.com/lv-lv/library/ms229040(en-us).aspx" rel="noreferrer">Microso... | <blockquote>
<p><em>T for Type</em></p>
</blockquote>
<p>Also, E is used for Element that's very common too. You're right G also works.</p>
| 48,907 |
<p><a href="https://stackoverflow.com/questions/227727/should-i-dynamically-recreate-a-pdf-rather-than-store-it-in-either-the-database#227758">This question on archiving PDF's</a> got me wondering -- if I wanted to compress (for archival purposes) lots of files which are essentially small changes made on top of a maste... | <p>Several formats do inter-file compression.</p>
<p>The oldest example is .tar.gz; a .tar has no compression but concatenates all the files together, with headers before each file, and a .gz can compress only one file. Both are applied in sequence, and it's a traditional format in the Unix world. .tar.bz2 is the same... | <p>Since LZW compression (which pretty much they all use) involves building a table of repeated characters as you go along, such as schema as you desire would limit you to having to decompress the entire archive at once.</p>
<p>If this is acceptable in your situation, it may be simpler to implement a method which just... | 33,379 |
<p>For <code><script></code> HTML tags, what is the technical difference between <code>lang=Javascript</code> and <code>type=text/javascript</code>?</p>
<p>I usually use both, because I've always assumed that older browsers need one or the other.</p>
| <p>Per the <a href="http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1" rel="noreferrer">HTML 4.01 Spec</a>:</p>
<blockquote>
<p><strong>type</strong>:
This attribute specifies the scripting language of the element's contents and overrides the default scripting language. The scripting language is specif... | <p>Type is more general and refers to the mime encoding of the script block. As far as I know you only need one and usually the block will work without either type or lag attributes.</p>
<p>I tend to use type.</p>
| 13,754 |
<p>I'm using XPath to locate a node (or something close to it) in a template that has non-well-formed HTML about 10 levels deep. (No I didn't write this HTML...but I've been tasked to dig through it.) </p>
<p>I seem to be able to retrieve an XPath to the element in question using the XPartner add-on for Firefox; how... | <p><strong>XPath expressions cannot be evaluated agaist a non-wellformed XML document</strong>, which is exactly the described case.</p>
<p>It is possible to do this in two chained steps, the first of which is to convert the HTML to wellformed XML and then the second -- to apply the XPath expression.</p>
<p>Therefore... | <p>XPath does not work directly with HTML. The interaction of XPath with your HTML is dictacted by whatever software/library is parsing the HTML into a rendering tree. This may help direct your search appropriately.</p>
| 46,156 |
<p>I've always been one to simply use:</p>
<pre><code>List<String> names = new ArrayList<>();
</code></pre>
<p>I use the interface as the type name for <em>portability</em>, so that when I ask questions such as this, I can rework my code.</p>
<p>When should <a href="https://docs.oracle.com/javase/9/docs/api... | <p><strong>Summary</strong> <code>ArrayList</code> with <code>ArrayDeque</code> are preferable in <em>many</em> more use-cases than <code>LinkedList</code>. If you're not sure — just start with <code>ArrayList</code>.</p>
<hr />
<p>TLDR, in <code>ArrayList</code> accessing an element takes constant time [O(1)] and addi... | <p>When should I use <code>LinkedList</code>? When working with stacks mostly, or when working with buffers.
When should I use <code>ArrayList</code>? Only when working with indexes, otherwise you can use HashTable with linked list, then you get:</p>
<h2>Hash table + linked list</h2>
<ul>
<li>Access by key <strong>O... | 41,767 |
<p>Doing like so:</p>
<p><code>Shell ("C:\Program Files\Internet Explorer\iexplore.exe -embedding http://www.websiteurl.com")</code></p>
<p>Doesn't work how I need it as I essentially need it to be able to redirect and prompt a user to download a file. Any ideas?</p>
| <p>Internet Explorer exposes a COM accessible interface you can use. If you really have to. I'd recommend against it - its comparatively slow, error-prone, cumbersome and resource-intensive. </p>
<p>What solves your problem more elegantly is using <code>WinHTTPRequest</code>. In your Project, reference "Microsoft WinH... | <p>If all you are trying to do is download a file, you can use <a href="http://vbnet.mvps.org/index.html?code/internet/urldownloadtofile.htm" rel="nofollow noreferrer">URLDownloadToFile</a>.</p>
| 29,362 |
<p>I need to convert a UNICODE_STRING structure to a simple NULL TERMINATED STRING.</p>
<pre><code>typedef
struct _UNICODE_STRING
{
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
}
UNICODE_STRING, *PUNICODE_STRING;
</code></pre>
<p>I can't find a clean sollution on MSDN about it.
Anyone bee... | <p>You should use WideCharToMultiByte. As an estimate for the output buffer size, you can use the Length field - but do consider the case of true multi-byte strings, in which case it will fail with ERROR_INSUFFICIENT_BUFFER, and you need to start over with a larger buffer. Or, you call it with an output buffer size of ... | <pre><code>WCHAR* UnicodeStringToNulTerminated(UNICODE_STRING* str)
{
WCHAR* result;
if(str == NULL)
return NULL;
result = (WCHAR*)malloc(str->Length + 2);
if(result == NULL)
// raise?
return NULL;
memcpy(result, str->Buffer, str->Length);
result[str->Length] = L'\0';
return result... | 32,260 |
<p>I'm working on a puzzle game, the game engine holds a complex hierarchy of objects, from game actors to vectors to transition animations. Depending on the game state, they might add up from 10 to 1000 (in extreme cases). I've been delaying the moment until I'd have to work on the saving and loading of all that mess,... | <p>NSKeyedArchiver is quite powerful, but it will not let you retain linkages between objects (unless you add them yourself post-unarchiving). If you can/need to store your entire data set atomically, then NSKeyedArchiver is probably the way to go, but there will be some 're-hydration' involved on your part if there's ... | <p>NSKeyedArchiver is quite powerful, but it will not let you retain linkages between objects (unless you add them yourself post-unarchiving). If you can/need to store your entire data set atomically, then NSKeyedArchiver is probably the way to go, but there will be some 're-hydration' involved on your part if there's ... | 39,606 |
<p>Here's the situation - I've got a shell that loads an external .swf. Now, that .swf is 800x600, but it's an animation piece, and there are elements that extends off the stage. When I load the .swf into the shell and call its width attribute, it returns 1200 - because it's including the elements that break out of the... | <p>The width and height of the loaded SWF as defined by the FLA it was created with can be found in the <code>Loader</code> object in which you've loaded the SWF into.</p>
<pre><code>swfLoader.contentLoaderInfo.width
swfLoader.contentLoaderInfo.height
</code></pre>
<p>This will always show you the dimensions as defin... | <p>Mark is very likely right that the <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/LoaderInfo.html#width" rel="nofollow noreferrer">content loader info</a> object will contain the correct width and height. I've never checked myself so I can't guarantee it. The docs say 'nominal' and contrast it with ... | 30,446 |
<p>Let's take the code</p>
<pre><code>int a, b, c;
...
if ((a + b) > C)
</code></pre>
<p>If we add the values of a and b and the sum exceeds the maximum value of an int, will the integrity of the comparison be compromised? I was thinking that there might be an implicit up cast or overflow bit check and that will ... | <p>C will do no such thing. It will silently overflow and lead to a possibly incorrect comparison. You can up-cast yourself, but it will not be done automatically.</p>
| <p>I believe this might be platform specific. Check the C documentation on how overflows are handled...</p>
<p>Ah, yes, and the upcast will not happen automatically...</p>
| 7,330 |
<p>I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eval() multiple times continually appending to the namespace as OSGi bundles are loade... | <p>I am not sure about what you mean about declared classes not existing between evals, the following two scripts work as expected when evaled one after another:</p>
<pre><code>class C {{println 'hi'}}
new C()
</code></pre>
<p>... </p>
<pre><code>new C()
</code></pre>
<p>However methods become bound to the class th... | <p>This might be what you are looking for?</p>
<p>From <a href="https://rads.stackoverflow.com/amzn/click/com/1932394842" rel="nofollow noreferrer" rel="nofollow noreferrer">Groovy in Action</a></p>
<pre><code>def binding = new Binding(x: 6, y: 4)
def shell = new GroovyShell(binding)
def expression = '''f = x * y'''
... | 6,751 |
<p>I've got a PHP script which I'm running from a command line (windows) that performs a variety of tasks, and the only output it gives is via 'print' statements which output direct to screen.</p>
<p>What I want to do is capture this to a log file as well.</p>
<p>I know I can do: </p>
<pre><code>php-cli script.php ... | <p>You can create a powershell script that runs the command, reads the data from the command's STDOUT then outputs the output to both the log file and the terminal for you to watch. You can use the commands Write-Output and Write-Host. </p>
<p>Microsoft's site: <a href="http://www.microsoft.com/technet/scriptcenter/... | <p>Slow:</p>
<pre><code>for /f "delims=" %a in ('php-cli script.php') do @echo %a&echo %a>>log.txt
</code></pre>
<p>or in a batch file:</p>
<pre><code>for /f "delims=" %%a in ('php-cli script.php') do @echo %%a&echo %%a>>log.txt
</code></pre>
| 35,140 |
<p>We are currently running a SQL Job that archives data daily at every 10PM. However, the end users complains that from 10PM to 12, the page shows a time out error.</p>
<p>Here's the pseudocode of the job</p>
<pre><code>while @jobArchive = 1 and @countProcecessedItem < @maxItem
exec ArchiveItems @countProcec... | <p><strong>Session Cookies</strong></p>
<p>Remember that HTTP is <strong>stateless</strong>, so sessions are tracked on your server, but the <strong>client</strong> has to identify itself with each request. When you declare session_start(), <strong>your browser is usually setting a cookie</strong> (the "PHP Session I... | <p>If you call session_start(), then a session will be created if the client isn't in an existing one. If the client doesn't support (or is configured to ignore) the cookies or querystring mechanism used to maintain the session, a new session will be created on every request.</p>
<p>This may bloat your session storage... | 20,522 |
<p>I know there are a lot of positive things mod-rewrite accomplishes. But are there any negative? Obviously if you have poorly written rules your going to have problems. But what if you have a high volume site and your constantly using mod-rewrite, is it going to have a significant impact on performance? I did a quic... | <p>I've used mod_rewrite on sites that get millions/hits/month without any significant performance issues. You do have to know which rewrites get applied first depending on your rules.</p>
<p>Using mod_rewrite is most likely faster than parsing the URL with your current language. </p>
<p>If you are really worried abo... | <p>If you're worried about apache's performance, one thing to consider if you have a lot of rewrite rules is to use the "skip" flag. It is a way to skip matching on rules. So, whatever overhead would have been spent on matching is saved.</p>
<p>Be careful though, I was on a project which utilized the "skip" flag a lot... | 4,612 |
<p>I've been using cmd.Parameters.AddWithValue, and not specifying a DBType (int, varchar,...) to run queries. After looking at SQL Profiler, it seems that queries run with this method run a lot slower than when you specify the data type. </p>
<p>To give you an idea of how much slower it is, here's an example. The ... | <p>The problem is related to how SQL server does implicit type conversions. If you filter a VARCHAR column using an NVARCHAR value (ie. N'some text'), SQL has no choice but to convert the column to NVARCHAR as NVARCHAR cannot be implicitly converted back to VARCHAR.</p>
<p>Your best workaround is either to specify the... | <p>What is the SQL statement generated in both the cases?</p>
<p>I am suspecting that it assumes the value as varchar when you don't explicitly specify it.</p>
<p>e.g. <code>SELECT OrderId FROM Orders WHERE OrderId = 1001</code> <BR>
vs <code>SELECT OrderId FROM Orders WHERE OrderId = '1001'</code></p>
| 44,929 |
<p>while writing a custom attribute in C# i was wondering if there are any guidelines or best practices regarding exceptions in attributes.
Should the attribute check the given parameters for validity? Or is this the task of the user of the property?</p>
<p>In a simple test I did the exception was not thrown until i u... | <p>Attributes are only actually constructed when you use reflection, so that's the only time you <em>can</em> throw an exception. I can't remember <em>ever</em> using an attribute and having it throw an exception though. Attributes usually provide data rather than real behaviour - I'd expect the code which <em>uses</em... | <p>We have some reasonably complex Attributes in our project, so we include validation of inputs. For example, as part of our I18N and L10N work, we have attributes that perform resource lookups (much like the attributes in the framework that are used to localise Category and Description strings for properties in the d... | 40,632 |
<p>It seems <a href="http://openlaszlo.org/" rel="nofollow noreferrer">OpenLaszlo</a> can <a href="http://www.antunkarlovac.com/blog/2008/02/19/writing-an-openlaszlo-air-application/" rel="nofollow noreferrer">run on AIR</a>. What's less obvious is whether OpenLaszlo apps can use the AIR-specific APIs, like file system... | <p>While I don't have any specifics, the article you linked mentions that his application window can be dragged and closed. Those are AIR-only APIs (see the NativeWindow class), so presumably what you're asking about must be possible to some extent. </p>
<p>However, my understanding is that OpenLaszlo tries not to imp... | <p>OpenLaszlo does implement features which are available in certain runtimes only. That's true for MP3 audio playback, Flash Player webcam and microphone access, RTMP streaming. The OpenLaszlo compiler supports inserting ActionScript code directly into scripts and methods.</p>
<p>Here is an example application which ... | 26,548 |
<p>python's time module seems a little haphazard. For example, here is a list of methods in there, from the docstring:</p>
<pre><code>time() -- return current time in seconds since the Epoch as a float
clock() -- return CPU time since process start as a float
sleep() -- delay for a number of seconds given as a float
... | <p>There is actually an inverse function, but for some bizarre reason, it's in the <a href="https://docs.python.org/2/library/calendar.html" rel="noreferrer">calendar</a> module: calendar.timegm(). I listed the functions in this <a href="https://stackoverflow.com/questions/79797/how-do-i-convert-local-time-to-utc-in-p... | <p>I'm only a newbie to Python, but here's my approach.</p>
<pre><code>def mkgmtime(fields):
now = int(time.time())
gmt = list(time.gmtime(now))
gmt[8] = time.localtime(now).tm_isdst
disp = now - time.mktime(tuple(gmt))
return disp + time.mktime(fields)
</code></pre>
<p>There, my proposed name for... | 15,797 |
<p>What's the term for this design?</p>
<pre><code>object.method1().method2().method3()
</code></pre>
<p>..when all methods return *this?</p>
<p>I found the term for this a while ago, but lost it meanwhile.
I have no clue how to search for this on google :)
Also if anyone can think of a better title for the question... | <p>Looks to me like you are describing a fluent interface. Ive also heard it referred to as pipelineing or chaining.</p>
<p>Update-Gishu: <a href="http://martinfowler.com/bliki/FluentInterface.html" rel="noreferrer">http://martinfowler.com/bliki/FluentInterface.html</a> </p>
| <p>The term you're looking for is <a href="https://isocpp.org/wiki/faq/references#method-chaining" rel="nofollow noreferrer">method chaining</a>.</p>
| 25,007 |
<p>A combo box is an auto-complete text box that is also a dropdown (i.e., you can choose from a list if you prefer).</p>
<p>"Best" means combination of: stable, look/feel, API / customizability, maturity.</p>
| <p>I like the <a href="http://developer.yahoo.com/yui/autocomplete/" rel="nofollow noreferrer">Yahoo UI Autocomplete widget</a>. It does not provide the dropdown natively, but a dropdown button can be added with <a href="http://tech.groups.yahoo.com/group/ydn-javascript/message/30178" rel="nofollow noreferrer">a few l... | <p>Surely autocomplete and combo boxes serve two similar, but different purposes:</p>
<ul>
<li>Autocomplete; select one from a very long list (i.e. too long to scroll through)</li>
<li>ComboBox; select one from a relatively short list (i.e. one that is easy to scroll through</li>
</ul>
<p>How many items do you have i... | 41,815 |
<p>Which is the best API to use when accessing a WebCam in .Net? <em>(I know they can be webcam specific, I am willing to buy a new webcam if it means better results).</em></p>
<p>I want to write a desktop application that will take video from a webcam and store it in MPEG4 formats (DivX, Xvid, etc...). I would also... | <p>You never said which ones you have already used but I recommend you might want to try out DirectShow.NET for capturing the device and FFMPEG for your video conversions. You will find both these libraries on SourceForge.</p>
| <p>Use OpenCV. It is a computer vision library that can receive input from webcams, images and videos, and output videos and images. It also comes with a lot of image manipulation functions so it would probably be ideal for what you are wanting.</p>
| 44,868 |
<p><strong>Description |</strong> A Java program to read a text file and print each of the unique words in alphabetical order together with the number of times the word occurs in the text. </p>
<p>The program should declare a variable of type <code>Map<String, Integer></code> to store the words and corresponding... | <p><a href="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html" rel="nofollow noreferrer"><code>TreeMap</code></a> seems a no-brainer to me - simply because of the "in alphabetical order" requirement. <code>HashMap</code> has no ordering when you iterate through it; <code>TreeMap</code> iterates in the natura... | <p>Why not use <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeSet.html" rel="nofollow noreferrer">TreeSet</a>?</p>
<p>Same ordering concept as a TreeMap, except it's a Set - which, by definition, is "A collection that contains no duplicate elements". </p>
<p>From your problem description, it sounds as... | 38,822 |
<p>I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background.</p>
<p>The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the brows... | <p><strong>Solved!</strong></p>
<p>Through ongoing research, scouring forums and source code repositories, I peiced together the necessary steps to accomplish this using only libwebkit and a standard compiz desktop (any Xorg desktop with compositing should do).</p>
<p>For a current libwebkit (1.1.10-SVN), there is an... | <p>Basically you want to be setting the ARGB colour space to be sending to the window manager. Obviously only window managers that support compositing will be able to take advantage of this.</p>
<p>You might want to talk to the screenlet and compiz developers they should be able to help out more.</p>
| 42,069 |
<p>I have a .Net CF 2.0 application and am using log4net to log errors. I get a stack trace, but it doesn't have any line numbers. I noticed that it doesn't appear to deploy the pdb file to the device, so I tried to manually place it in the same directory as the exe. But that didn't help.</p>
| <p>I'm not sure if .Net CF will open pdbs. Also I'm not sure you want to deploy those to a device. If you are industrious you can make a tool to transform a callstack with il offsets into one with line #'s. I'd suggest this <a href="http://blogs.msdn.com/jmstall/archive/2005/08/25/pdb2xml.aspx" rel="nofollow norefer... | <p>Have you tried to bubble up the exceptions with out wrapping them in a new exception; <a href="http://weblogs.asp.net/bhouse/archive/2004/11/30/272297.aspx" rel="nofollow noreferrer">link</a></p>
<pre><code>try {
//code..
}
catch
{
throw;
}
</code></pre>
| 31,789 |
<p>MathWorks currently doesn't allow you to use <code>cout</code> from a mex file when the MATLAB desktop is open because they have redirected stdout. Their current workaround is providing a function, <a href="http://www.mathworks.com/support/tech-notes/1600/1605.html" rel="nofollow noreferrer">mexPrintf, that they re... | <p>You don't really want to overload <code>std::stringbuf</code>, you want to overload <code>std::streambuf</code> or <code>std::basic_streambuf</code> (if you want to support multiple character types), also you need to override the overflow method as well.</p>
<p>But I also think you need to rethink your solution to ... | <p><code>cout</code> is a particular character output stream. If you want a <code>cout</code> that writes to a file, use an <a href="http://www.cplusplus.com/reference/iostream/fstream/" rel="nofollow noreferrer"><code>fstream</code></a>, particularly an <a href="http://www.cplusplus.com/reference/iostream/ofstream/" ... | 30,188 |
<p>Is one more preferred, or performs better over the other?</p>
| <p><a href="http://php.net/is_int" rel="noreferrer"><code>is_int()</code></a> returns true if the argument is an integer type, <a href="http://www.php.net/ctype_digit" rel="noreferrer"><code>ctype_digit()</code></a> takes a string argument and returns true if all the characters in the string are digits.</p>
<p><strong... | <p>Ctype_digit returns false if the range of integer is in negative range or between 0 and 47 or between 58 and 255. You can check ctype_digit's behavior by using the following snippet.</p>
<pre><code>setlocale(LC_ALL, 'en_US.UTF-8');
var_dump(
true === array_every(range(-1000, -1), 'ctype_digit_returns_false'),
... | 29,258 |
<p>I have a xml which is max 3 levels deep. Now by using C# or Xpath what the best method to check the whether all the child nodes under a parent node are empty.</p>
<p>Thanks in Advance.</p>
| <p>Given a sample document of:</p>
<pre><code><foo>
<bar>
<baz/>
<baz>Hello, world!</baz>
<baz><qux/></baz>
</bar>
</foo>
</code></pre>
<p>This expression tells you which children of <code>foo/bar</code> have any child elements:</p>
<pre><co... | <p>This LINQ to XML query should get close to what you are after:</p>
<p><pre><code>
XElement xml = new XElement("contacts",
new XElement("contact",
new XAttribute("contactId", ""),
new XElement("firstName", ""),
new XElement("lastName", ""),
new XElement("Address",
new XElement("Street", "")... | 25,882 |
<p>This question may be too product specifc but I'd like to know if anyone is exporting bug track data from HP Quality Center.</p>
<p>HP Quality Center (QC) has an old school COM API but I'd rather use a web service or maybe even screen scraper to export the data into an excel spreadsheet.</p>
<p>In any case, what's ... | <p>You can use this QC API Code to modify bugs/requirements.</p>
<pre><code>TDAPIOLELib.TDConnection connection = new TDAPIOLELib.TDConnection();
connection.InitConnectionEx("http://SERVER:8080/qcbin");
connection.Login("USERNAME", "PASSWORD");
connection.Connect("QCDOMAIN", "QCPROJECT");
TDAPIOLELib.BugFactory bu... | <p>If manual export (i.e., not using a program) is possible for you, the following will be the easiest way to export defect data.</p>
<p>In QC 9.2 (maybe present in earlier versions, too), there is <code>Export/All</code> in the <code>Defects</code> menu, which exports defects in your defects grid into an Excel sheet.... | 10,514 |
<p>And by donut caching, I'm refering to <a href="http://weblogs.asp.net/scottgu/archive/2006/11/28/tip-trick-implement-donut-caching-with-the-asp-net-2-0-output-cache-substitution-feature.aspx" rel="nofollow noreferrer">Scott Guthrie's blog post</a> which is awesome.</p>
<p>Does anyone know if that works properly?</p... | <p>Note that this technique no longer works as of MVC 2.0. Which sucks.</p>
| <p>Cross-post from <a href="https://stackoverflow.com/questions/4685906/is-donut-caching-available-in-asp-net-mvc-3/6994582#6994582">another question</a>:</p>
<p>Donut Caching (yes, the real thing) is available as part of my 'speed-lib' for MVC: <a href="https://github.com/janjongboom/Moth" rel="nofollow noreferrer">M... | 26,037 |
<p>I am planing on printing something that will make contact with PCB boards. The print will be most likely to be in PLA. I don't want to fry the PCB board so I want to know if 3D printed PLA objects are conductive.</p>
<p>I googled and found out about special non-conductive PLA and conductive PLA. But what about the ... | <p>Normal PLA is non-conductive. You can take an <span class="math-container">$\Omega$</span>-meter to a test part if you're really concerned somehow you have some PLA that is conductive.</p>
<p>There is a caveat that your color may include metal flake or graphite of some kind. Depending on the density it may be conduc... | <p>It's non-conductive, but I would check to make sure with any colored filament. Black may have iron oxide or carbon black which may give it minor conductance. </p>
| 505 |
<p>I would like to subscribe to the ItemCommand event of a Reorderlist I have on my page. The front end looks like this...</p>
<pre><code><cc1:ReorderList id="ReorderList1" runat="server" CssClass="Sortables" Width="400" OnItemReorder="ReorderList1_ItemReorder" OnItemCommand="ReorderList1_ItemCommand">
...
<... | <p>this works:</p>
<pre><code><cc2:ReorderList ID="rlEvents" runat="server" AllowReorder="True" CssClass="reorderList"
DataKeyField="EventId" DataSourceID="odsEvents" PostBackOnReorder="False"
SortOrderField="EventOrder" OnDeleteCommand="rlEvents_DeleteCommand">
...
<asp:ImageButton ID="btnDel... | <p>Since your ImageButton's <code>CommandName="delete"</code> you should be hooking up to the DeleteCommand event instead of ItemCommand.</p>
| 18,165 |
<p>I'm trying to use TestDriven.Net not only to test my code, but to call a function on my code whose purpose is to print out the internal state of the code to the Debug window.</p>
<p>Here's a very simplified example of what I'm trying to do..</p>
<pre><code><TestFixture()> _
Public Class UnitTest
<Tes... | <p>I found that while Debug.Writeline() doesn't work with unit tests, Console.WriteLine() does. </p>
<p>The reason is that when you run tests, the debugger process isn't invoked, and Debug.WriteLine() is ignored. However, if you use "Test with Debugger", I think (haven't tried) Debug.WriteLine() will work.</p>
| <p>IIRC, this output is only shown in the output window when running an individual test. Try right-clicking in the test method to run just that test...?</p>
| 20,920 |
<p>I am trying to select a record out of the table1 by joining table2 and using table2 columns in the WHERE statement. Col1 and Col2 in table1 can be stored in col1 of table2. I need to join col1 of table2 with either the value of col1 or col2 in table1</p>
<p>here is the sql statement I created so (pseudo):</p>
<p... | <p>That should be fine. Another way to write the same condition is as follows:</p>
<pre><code>... JOIN table2 t2 on t2.Col1 IN (t1.Col1, t1.Col2)
</code></pre>
<p>It shouldn't matter which way you do it in this case. Do what you find more readable.</p>
| <p>If I understand your questoion correctly, your SQL query is perfectly fine.</p>
| 44,488 |
<p>I just assembled a Prusa i3 MK3 and went through the calibration process, but when I print the first layer doesn't look good and my prints come unstuck from the bed. I think it might be Z height but this was as high as I could put the probe without the paper moving on the calibration test. The layers after the first... | <p>Judging by the images you posted in your question, the first layer distance is too far away from the bed for the current filament flow.</p>
<p>This could either be related to:</p>
<ul>
<li>having an offset on the first layer like a height correction in the slicer,</li>
<li>an incorrectly levelled (read height adju... | <p>I used the live-z adjustment feature and set it to +0.150 and now my prints look much better.</p>
| 1,068 |
<p>Let's say I have data structures that're something like this:</p>
<pre><code>Public Class AttendenceRecord
Public CourseDate As Date
Public StudentsInAttendence As Integer
End Class
Public Class Course
Public Name As String
Public CourseID As String
Public Attendance As List(Of AttendenceRecord)
End Clas... | <p>You can get this functionality from the System.Windows.Forms.DataGridView control. When you create columns you can set them to be <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.frozen.aspx" rel="nofollow noreferrer">frozen</a> which will then only scroll those columns to th... | <p>Here's an example using just HTML and CSS to achieve what I think you're looking for:</p>
<p><a href="http://www.shrutigupta.com/index.php/2005/12/12/how-to-create-table-with-first-column-frozen/" rel="nofollow noreferrer">http://www.shrutigupta.com/index.php/2005/12/12/how-to-create-table-with-first-column-frozen/... | 12,219 |
<p>I'm trying to switch on and off the Rotate 180 degree setting for an HP Laserjet printer (4200/ 4350) using a duplexer unit.</p>
<p>The Business has a requirement to "print on both sides", for maximum control I'd like to be able to manipulate at print time (through print macros) whether or not duplex printing is en... | <p>Here you go:</p>
<pre><code>declare @string varchar(100)
select @string = 'sfdasadhfasjfdlsajflsadsadsdadsa'
SELECT LEN(@string) - LEN(REPLACE(@string, 'd', '')) AS D_Count
</code></pre>
| <p>In SQl Server if @string = 'sfdasa ddd'
function LEN fails to count trailing white spaces.
Solution to LEN's issue is in
<a href="https://stackoverflow.com/questions/2025585/len-function-not-including-trailing-spaces-in-sql-server">LEN function not including trailing spaces in SQL Server</a></p>
| 36,554 |
<p>Oracle database 11g. What is the easiest way to set up a full nightly database backup to a network drive (ie drive on another computer)?</p>
| <p><a href="http://www.oracle.com/pls/db111/portal.portal_db?selected=4&frame=#backup_and_recovery" rel="nofollow noreferrer">Read the backup and recovery guide.</a></p>
<p>Don't just backup... Make sure you test your backup, regularly!!</p>
| <p>If you have Grid Control setup the easiest way would be to use the web interface. The interface allows you to specify a unc path (\computer\share name). You will have to create a share on the remote computer.</p>
<p>If you don't have Grid Control you can create a script that uses <a href="http://download.oracle.c... | 21,946 |
<p>Does anyone have or know best practices for implementing a custom layout engine in WinForms? I've seen the <a href="http://msdn.microsoft.com/en-us/library/ms973821.aspx" rel="nofollow noreferrer">windowsclient.net</a> link, but it's a bit dated (Sept 2001).</p>
| <p>When I tried to do custom layout engine in WinForms, I was blocked by the fact that IArrangedElement interface is internal. It looks stupid, but it seems you can't get layout properties in a uniform way unless you develop System.Windows.Forms itself. </p>
| <p>When I tried to do custom layout engine in WinForms, I was blocked by the fact that IArrangedElement interface is internal. It looks stupid, but it seems you can't get layout properties in a uniform way unless you develop System.Windows.Forms itself. </p>
| 24,787 |
<p>I have one of those "I swear I didn't touch the server" situations. I honestly didn't touch any of the php scripts. The problem I am having is that php data is not being saved across different pages or page refreshes. I know a new session is being created correctly because I can set a session variable (e.g. $_SESSIO... | <p>Thanks for all the helpful info. It turns out that my host changed servers and started using a different session save path other than /var/php_sessions which didn't exist anymore. A solution would have been to declare <code>ini_set(' session.save_path','SOME WRITABLE PATH');</code> in all my script files but that wo... | <p>Another few things I had to do (I had same problem: no sesson retention after PHP upgrade to 5.4). You many not need these, depending on what your server's php.ini contains (check phpinfio());</p>
<pre><code>session.use_trans_sid=0 ; Do not add session id to URI (osc does this)
session.use_cookies=0; ; ensure cook... | 18,863 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.