instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am trying to use google search for my site:</p>
<p><a href="http://www.houseofhawkins.com/search.php" rel="noreferrer">http://www.houseofhawkins.com/search.php</a></p>
<p>It is not playing nice with some screen resolutions. Here is the code given from google:</p>
<pre><code><div id="cse-search-results">&... | <p>I have three settings that you can tweak, a combination of which I hope will get you where you need to go:</p>
<ol>
<li><strong>googleSearchFrameWidth</strong> - Set this in the JavaScript to your desired width. This is the most obvious one and the one you've probably already tweaked.</li>
<li><strong>Width of cse-... | <p>Google will not allow you to use a width smaller than 500px. Your best bet is to create a style for the iframe:</p>
<pre><code><style>
#cse-search-results iframe {width: 200px; }
</style>
</code></pre>
| 38,042 |
<p>Given a URL, what would be the most efficient code to download the contents of that web page? I am only considering the HTML, not associated images, JS and CSS.</p>
| <pre><code>public static void DownloadFile(string remoteFilename, string localFilename)
{
WebClient client = new WebClient();
client.DownloadFile(remoteFilename, localFilename);
}
</code></pre>
| <p>I think this is the fastest (download speed time with low latency) solution for download.</p>
<pre><code>// WebClient vs HttpClient vs HttpWebRequest vs RestSharp
// در نهایت به نظرم روش زیر سریعترین روشه
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);
Request.AutomaticDecompression = Decompression... | 4,584 |
<p>My new Ender 5 Plus' Bowden tube keeps popping out of its socket on the extruder mid-print, I've tried several times and it keeps doing it even though it's locked into place securely at the start every time. Is this a known issue? And how do I resolve it?</p>
<p>I just got it so I doubt it's the coupler, I replaced ... | <p>The coupler for the Bowden tube is probably worn out or the tube end has been scraped so that the coupler can't grab it or you have left out the clamp on the coupler.</p>
<p>The coupler has a sleeve that when pressed down releases the Bowden tube. There is a C-shaped clip that should go between the top lip of the s... | <p>OK well I feel silly, it turns out it wasn't fully pushed into place, I pushed it in feeling it lock and thought it was secure, when it actually wasn't, pushing it in till it feels locked up twice resulted in it being properly secured. (sorry if my description doesn't make a lot of sense, I'm not good at that kind o... | 2,066 |
<p>What tool is there for generating C# classes from NHibernate mappings files?</p>
| <p>On the <a href="http://nhibernate.info/doc/nh/en/index.html#toolsetguide-s2" rel="nofollow noreferrer">NHibernate resources page</a> under 'Helpful tools', there are a few code generators listed:
<a href="http://nhibernate.info/doc/nh/en/index.html#toolsetguide-s2" rel="nofollow noreferrer">http://nhibernate.info/do... | <p>I wrote a small one : <a href="http://www.codeplex.com/EntityGenerator" rel="nofollow noreferrer">http://www.codeplex.com/EntityGenerator</a></p>
<p>Currently it's a small console application with a configuration file. Not very user friendly but it works and the templates are easily customizable.</p>
<p>Still unde... | 22,200 |
<p>When working with tables in Oracle, how do you know when you are setting up a good index versus a bad index?</p>
| <p>This depends on what you mean by 'good' and 'bad'. Basically you need to realise that every index you add will increase performance on any search by that column (so adding an index to the 'lastname' column of a person table will increase performance on queries that have "where lastname = " in them) but decrease wri... | <p>A good index is something that you can rely on to be unique for a specific table row.</p>
<p>One commonly used index scheme is the use of numbers which increment by 1 for each row in the table. Every row will end up having a different number index.</p>
| 10,459 |
<p>How do you properly ensure that a user isnt tampering with querystring values or action url values? For example, you might have a Delete Comment action on your CommentController which takes a CommentID. The action url might look like /Comments/Delete/3 to delete the comment with the id 3.</p>
<p>Now obviously you d... | <p>You don't.</p>
<p>It is a cardinal rule of programming, especially in this day and age, that <em>you never trust any input which comes from the user, the browser, the client, etc.</em></p>
<p>It is also a cardinal rule of programming that you should probably not try to implement encryption and security yourself, u... | <p>I've done funky things take the querystring, compress it, Base64 or just hex encode it, so that "commentid=4&userid=12345" becomes "code=1a2b23de12769"</p>
<p>It's basically "Security through obscurity" but it does make a lot of work for someone trying to hack the site.</p>
| 30,463 |
<p>My users use the site pretty equally 24/7. Is there a meme for build timing?</p>
<p>International audience, single cluster of servers on eastern time, but gets hit well into the morning, by international clients.</p>
<p>1 db, several web servers, so if no db, simple, whenever.</p>
<p>But when the site has to come... | <p>If there's truly no good time from the users' perspective, then I'd suggest doing it when your team has the most time to recover from any build-related disaster.</p>
| <p>Use a second site, and hotswap as needed.</p>
| 11,537 |
<p>I'm seeing some errors that would indicate a "connection leak". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time?</p>
| <p>If you're using .net, there's the .net data provider for SQL server in PerfMon. You can look at NumberOfPooledConnections there</p>
<p><a href="https://i.stack.imgur.com/oH5Cd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oH5Cd.png" alt="screenshot of perf monitor" /></a></p>
| <p>you can use the profiler tool to trace all existing and opening and closing connections</p>
<p>You can open profiler from enterprise manager</p>
| 12,204 |
<p>Basically I’ve heard that certain conditions will cause .NET to blow past the <code>finally</code> block. Does anyone know what those conditions are?</p>
| <p>Two possibilities:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.stackoverflowexception.aspx" rel="noreferrer">StackOverflowException</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.executionengineexception.aspx" rel="noreferrer">ExecutionEngineException</a></li>
</ul>
<... | <p>Neither code which follows a finally block, nor code in outer scopes, will execute without the finally block having been started first (an exception within the finally block may cause it to exit prematurely, in which case execution will jump out from the finalizer to an outer scope). If code prior to the finally bl... | 13,680 |
<p>A Visual Studio 2008 project in one solution needs to reference a WCF service in another VS 2008 solution on the same development machine. Does anybody have any suggestions on how best to accomplish this?</p>
| <p>You could do a redirect to buy.php after saving to the session object, which then does a server redirect to check.php, it would mean when the user clicks back, they're going back to the GET request not the POST request</p>
| <p>Yes - I agree with above. I ALWAYS do a <code>redir</code> away from the last post, so clicking back bounces them back without that error OR re-submissions. it also avoids complications. u can always tag the <code>redir</code> link page with a <code>?m</code> or <code>&m</code> (i.e.: <code>page.php?m</code>) an... | 7,963 |
<p>I am trying to play the Asterisk system sound from a C# program with</p>
<pre><code>System.Media.SystemSounds.Asterisk.Play();
</code></pre>
<p>but no sound plays. My system does have a sound set up for Asterisk and other programs (not written by me) cause various system sounds to play.</p>
<p>Can anyone suggest... | <p>I had ignored this problem until today. Some googling revealed that this is quite a common problem and totally unrelated to the .NET Play calls.</p>
<p>What happens is that while you can play/preview the sounds from the Control Panel Sounds and Audio Devices applet they do not play when programs trigger the sounds.... | <p>I'm only 8 years late to the party, but I just had this issue on a Windows 7 tablet PC. The thing that fixed it? The classic <code>Restart</code>. </p>
<p>Try restarting the device.</p>
| 44,713 |
<p>I am working with a wrapper class for <code>CFHTTPMessage</code>, which contains a <code>CFHTTPMessageRef</code> object to which is added the method (GET), the URL of the web application server, and a few custom headers containing the date and an authentication nonce.</p>
<p>I'm having some problems getting the met... | <p>The following worked well:</p>
<pre><code>NSData *d = (NSData *)CFHTTPMessageCopySerializedMessage(messageRef);
NSLog(@"%@",[[[NSString alloc] initWithBytes:[d bytes] length:[d length] encoding:NSUTF8StringEncoding] autorelease]);
</code></pre>
<p>Hope this is helpful to others.</p>
| <p>The only reason why you should be getting an EXC_BAD_ACCESS when accessing the bytes is if the messageData is NULL (no HTTP body) and you're dereferencing it.</p>
<p>Point to remember: the HTTP body isn't the "raw request". It doesn't include the headers or the actual HTTP instruction (GET/POST/ETC). If you haven't... | 45,364 |
<p>I'm trying to find if there is a reliable way (using <a href="http://en.wikipedia.org/wiki/SQLite" rel="noreferrer">SQLite</a>) to find the ID of the next row to be inserted, <em>before it gets inserted</em>. I need to use the id for another insert statement, but don't have the option of instantly inserting and gett... | <p>Either scrapping or committing a series of database operations all at once is exactly what transactions are for. Query <code>BEGIN;</code> before the user starts fiddling and <code>COMMIT;</code> once he/she's done. You're guaranteed that either all the changes are applied (if you commit) or everything is scrapped... | <p>I think this can't be done because there is no way to be sure that nothing will get inserted between you asking and you inserting. (you might be able to lock the table to inserts but Yuck)</p>
<p>BTW I've only used MySQL but I don't think that will make any difference)</p>
| 13,256 |
<p>On long Visual C++ builds, it would be really helpful to hear some sort of (optional) sounds for such build/compile results as:</p>
<ul>
<li>individual compile error</li>
<li>file compile success/failure</li>
<li>build success/failure</li>
<li>batch build success/failure</li>
</ul>
<p>Does anyone know how to enabl... | <p>CJM is almost right. </p>
<p>In VC++ 9 (Visual Studio 2008) Go to Control Panel's Sounds applet (Control Panel/Hardware and Sounds/Sounds in Vista).</p>
<p>Under the Sounds tab scroll to "Build Succeeded" under "Microsoft Visual Studio" and set a sound for this event. </p>
<p>If you have (or had) multiple VS on t... | <p>In VS2005, the sound subsystem wasn't working correctly, not sure it was fixed in 2008. Using macros, you COULD play sounds, like different ones for builds that succeeded, and builds that failed, however the person that I knew that did them was constantly crashing due to the macros failing.</p>
| 16,330 |
<p>I just listened to the StackOverflow team's 17th podcast, and they talked so highly of <a href="http://www.asp.net/mvc/" rel="noreferrer">ASP.NET MVC</a> that I decided to check it out.</p>
<p>But first, I want to be sure it's worth it. I already created a base web application (for other developers to build on) for... | <p>If you are quite happy with WebForms today, then maybe ASP.NET MVC isn't for you.</p>
<p>I have been frustrated with WebForms for a really long time. I'm definitely not alone here. The smart-client, stateful abstraction over the web breaks down severely in complex scenarios. I happen to love HTML, Javascript, an... | <p>Is the fact that ASP.net MVC is only in 'Preview 5' be a cause for concern when looking into it? </p>
<p>I know that StackOverflow was created using it, but is there a chance that Microsoft could implement significant changes to the framework before it is officially out of beta/alpha/preview release?</p>
| 4,993 |
<p>I try to print a stamp with flexible filaments. The problem I encounter is that the filament is flexible, but not soft. This leads to small differences in height to parts of the stamp not working.</p>
<p>One solution would be to add a small 'cushion' to add some squishyness to the stamp. I designed the stamp and th... | <p>As the rubber stamp needs to be soft in one axis for the whole area, you could use an infill that causes the same softness in all directions, but is sliced as such that the stamp experiences the same softness. Alternatively you can use the specific infill types for flexibility, but beware of the orientation:</p>
<u... | <p>Sinusoidal infill provides great squishiness in the infill direction, but you'll still have the problem that where the infill meets the perimeter wall, it'll be less squishy than where the perimeter wall isn't touching any infill. You can reduce this effect by using a stiffer filament for that wall (if you can print... | 1,303 |
<p>I'm looking at <a href="http://www.sqlservercentral.com/articles/SQL+Server+2005/61765/" rel="nofollow noreferrer">this</a> as a baseline explanation of the SQL 2005 Enterprise partitioning. Is there a resource that goes deeper into fine points and considerations of this issue. Some more examples would be useful too... | <p>I've found the <a href="http://technet.microsoft.com/en-us/library/ms130214(SQL.90).aspx" rel="nofollow noreferrer">SQL Server 2005 Books Online</a> normally has all the information I'm looking for.</p>
<p>I found a good resource in the 05 BOL on SQL Server 2005 Partitioning:
<a href="http://technet.microsoft.com/e... | <p>This site may help you:</p>
<p><a href="http://highscalability.com/" rel="nofollow noreferrer">http://highscalability.com/</a></p>
<p>specific tags:</p>
<p><a href="http://highscalability.com/tags/shard" rel="nofollow noreferrer">http://highscalability.com/tags/shard</a></p>
<p><a href="http://highscalability.co... | 12,048 |
<h3>Background:</h3>
<p>I have a module which declares a number of instance methods</p>
<pre><code>module UsefulThings
def get_file; ...
def delete_file; ...
def format_text(x); ...
end
</code></pre>
<p>And I want to call some of these methods from within a class. How you normally do this in ruby is like this... | <p>If a method on a module is turned into a module function you can simply call it off of Mods as if it had been declared as</p>
<pre><code>module Mods
def self.foo
puts "Mods.foo(self)"
end
end
</code></pre>
<p>The module_function approach below will avoid breaking any classes which include all of Mods.</p>... | <p>This old question comes to me today when I am studing Ruby and found interesting so I want to answer with my new knowlege.</p>
<p>Assume that you have the module</p>
<pre class="lang-rb prettyprint-override"><code>module MyModule
def say
'I say'
end
def cheer
'I cheer'
end
end
</code></pre>
<p>then... | 41,740 |
<p>Where can I find the specifications for the various C# languages?</p>
<p><em>(EDIT: it appears people voted down because you could 'google' this, however, my original intent was to put an answer with information not found on google. I've accepted the answer with the best google results, as they are relevant to peop... | <p><a href="http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx" rel="noreferrer">Microsoft's version</a> (probably what you want)</p>
<p><a href="http://www.ecma-international.org/publications/standards/Ecma-334.htm" rel="noreferrer">The formal standardised versions</a> (via ECMA, created just so they could say it ... | <p>From : <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx</a></p>
<p>In .doc format:</p>
<p><a href="http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75351c669b09/CSharp%20Language%20Specification.doc" ... | 15,553 |
<p>It seems like there should be something shorter than this:</p>
<pre><code>private string LoadFromFile(string path)
{
try
{
string fileContents;
using(StreamReader rdr = File.OpenText(path))
{
fileContents = rdr.ReadToEnd();
}
return fileContents;
}
catch
... | <p>First of all, the title asks for "how to write the contents of strnig to a text file"
but your code example is for "how to read the contents of a text file to a string.</p>
<p>Answer to both questions:</p>
<pre><code>using System.IO;
...
string filename = "C:/example.txt";
string content = File.ReadAllText(filenam... | <p>File.ReadAllText() maybe?</p>
<p>ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_mscorlib/html/4803f846-3d8a-de8a-18eb-32cfcd038f76.htm if you have VS2008's help installed.</p>
| 6,373 |
<p>Many 3D printers employ a GT2 band for the <em>y</em>-axis plate and the printhead in the <em>x</em>-axis carriage.</p>
<p>However, there seems to be the obvious disadvantages of:</p>
<ul>
<li>stretching (and need for adjustment) and;</li>
<li>possibly slight inaccuracy, or "wobble" (for want of a better w... | <p>With a belt system, the belt engages roughly half the pulley. This, and the tension in the belt, ensures the belt always engages the pulley tightly. A belt and pulley system is thus relatively forgiving.</p>
<p>With a rack and pinion system, only a few teeth engage at any given time. To avoid backlash and get the s... | <p>The answer so others can understand is that it's cheap and simple to run with a belt. Much of the 3D printers these days either stem from the sintering systems that were developed years ago and things that rose out of the RepRap community where a Lead Screw that had the precision needed to do proper 3D printing at ... | 509 |
<p>I'm getting a syntax error (undefined line 1 test.js) in Firefox 3 when I run this code. The alert works properly (it displays 'work') but I have no idea why I am receiving the syntax error.</p>
<p>jQuery code:</p>
<pre><code>$.getJSON("json/test.js", function(data) {
alert(data[0].test);
});
</code></pre>
<... | <p>I found a solution to kick that error</p>
<pre><code>$.ajaxSetup({'beforeSend': function(xhr){
if (xhr.overrideMimeType)
xhr.overrideMimeType("text/plain");
}
});
</code></pre>
<p>Now the explanation:
In firefox 3 (and I asume only firefox THREE) every file that has the mime-type of "text/xml" is p... | <p>Try renaming "test.js" to "test.json", which is what <a href="http://en.wikipedia.org/wiki/JSON" rel="nofollow noreferrer">Wikipedia</a> says is the official extension for JSON files. Maybe it's being processed as Javascript at some point.</p>
| 43,502 |
<p>I have to give a general note to some huge Java project for which I have but little visibility and I was wondering if there were any guidelines for determining:</p>
<ul>
<li>what number of classes per package can be considered right, to low, or to high (this project has 3.89 classes per package, which seems a bit t... | <p>Steve McConnell in his book Code Complete recommends about 7 methods per class and no more lines in a method then can be viewed in a single screen without scrolling.</p>
<p>I'm not sure about classes per package.</p>
<p>I would highly recommend reading Code Complete for more information on such topics.</p>
| <p>(note: tl;dr available at the very bottom for my real opinion)</p>
<p>I'm not going to quote any big name and say that's the right answer because it's always very case dependant how you do all this stuff. For example the number of methods: If you're making a control software for modern HD LCD TV's remote controller... | 40,295 |
<p>/dev/random and /dev/urandom use environmental noise to generate randomness. </p>
<p>With a virtualised server there can be multiple instances of an Operating System on one hardware configuration. These operating systems will all be sourcing their randomness from the same environmental noise.</p>
<p>Does this mean... | <p>I couldn't find any references quickly, but it would seem to me that the entropy is derived from the kernel data structures for the devices, not the actual devices themselves. Since these would be independent regardless of virtualization, I suspect the answer is not much.</p>
<p>[EDIT] After peeking at the kernel ... | <p>Thanks. </p>
<p>From what I understand that a system that relies on network I/O for entropy is susceptible to man in the middle attacks. I found the <a href="http://lwn.net/Articles/283103/" rel="nofollow noreferrer">follow article</a> that discusses appropriate sources of entropy. Their suggestion is to remove net... | 28,871 |
<p>I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site.</p>
<p>Does anyone have any thoughts/experience with doing this?</p>
<p>Minor clarification:
My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCacheD or Velocity (or another distribu... | <p>I've been using caching decorators (not interceptors) with Windsor and they work great.</p>
<p>Interceptors are good for this as well, see <a href="http://ayende.com/Blog/archive/2007/03/11/AOP-With-Windsor-Adding-Caching-to-IRepositoryT-based-on-Ts.aspx" rel="nofollow noreferrer">this</a> for example.</p>
| <p>Windsor is great, but why use that for caching when you have several built in ways to cache data. Windsor has its foundation in other areas not necessarily caching. From the cache object to session to cookies. There are many ways to cache. More importantly in large applications you end up needing distributed caching... | 12,003 |
<p>Still struggling to understand what best practices are with respect to macros. I'm attempting to write a macro which defines packages on the fly.</p>
<pre><code>(defmacro def-dynamic-package (name)
`(defpackage ,(intern (string-upcase name) "KEYWORD")
(:use :common-lisp)))
</code></pre>
<p>This works fine ... | <p><strong>defpackage</strong> is a macro. As such, it's expanded at compile-time, not run-time. What you want is something that is called at run-time in order to make a new package. Therefore, <strong>defpackage</strong> can't do anything for you.</p>
<p>Fortunately, there's also <strong><a href="http://www.lispwo... | <p>Failure is to be expected here, because a macro is used when its argument should not be evaluated.</p>
<p>In your first make-package-from-path, the def-dynamic-package will receive as argument a list that is EQUAL to the value of the following expression:</p>
<pre><code>(list 'pathname-name 'path)
</code></pre>
<... | 35,355 |
<p>Not sure if there is any Firefox add-on tool for checking JavaScript syntax, var declaration, or even pre-compiling available? </p>
<p>I find out is very difficult to debug JavaScript in a web html page. I have to add some script there. When the scripts get very big or long, it stops working. Basically, there must ... | <p>This page may help you a bit as it also contains a screencast.</p>
<p><a href="http://asymptomatic.net/2007/08/22/2643/debugging-javascript-in-firefox-with-firebug-and-breakpoints" rel="nofollow noreferrer">Debugging Javascript in Firefox with Firebug</a></p>
| <p>Hi Gene: you could change one variable <strong>option.maxerr</strong> inside your <em>jslint.js</em> file into the number you want.</p>
<p>The default value is 50, you could change it to 500 or 1000 to suite your taste.</p>
| 31,482 |
<p>Howdy... here on my local LAN, I have a Windows Server 2k8 box with SQL Server 2k8 installed. I can connect to the database engine using the SSMS tool on the server, but attempting to connect to the database engine from a remote machine (also on the same LAN), the connection fails with the usual generic message abo... | <p>In SQL Server Configuration Manager in Network Configuration-> Protocols enable TCP/IP or other protocols that you need. The default is: only Shared Memory. </p>
| <p><a href="http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx</a></p>
| 37,248 |
<p>I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus k... | <p><a href="http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files" rel="noreferrer">Magic number</a>. If you can read first few bytes of a binary file you can know what kind of file it is. </p>
| <p>On a unix system, capturing the output from the 'file' command should provide adequate info.</p>
| 22,400 |
<p>I have a C# module responsible for acquiring the list of network adapters that are "connected to the internet" on a windows Vista machine. The module uses the "<a href="http://msdn.microsoft.com/en-us/library/aa370803(VS.85).aspx" rel="nofollow noreferrer">Network List Manager API</a>" (or NLM API) to iterate over a... | <p>I can only answer your question about the unit test.</p>
<p>The code you're testing is, in your own words, "a C# module responsible for acquiring the list of network adapters that are 'connected to the internet' on a windows Vista machine. The module uses the 'Network List Manager API' (or NLM API) to iterate over ... | <p>UnitTests shouldn't access to external resources. To UnitTest your method, I would stub out the Network List Manager API. </p>
<p>You still need an acceptance test layer. In that test environment you should replicate various configurations you expect to support in your environment, setup your own webhosts, route... | 23,746 |
<p>Can anyone provide a good explanation of the volatile keyword in C#? Which problems does it solve and which it doesn't? In which cases will it save me the use of locking?</p>
| <p>I don't think there's a better person to answer this than <a href="https://ericlippert.com/2011/06/16/atomicity-volatility-and-immutability-are-different-part-three/" rel="noreferrer">Eric Lippert</a> (emphasis in the original): </p>
<blockquote>
<p>In C#, "volatile" means not only "make sure that the compiler an... | <p>multiple threads can access a variable.
The latest update will be on the variable</p>
| 9,791 |
<p>PNG images appear "fuzzy" in flash CS3. They are very blocky and appear unanti-aliased (if that is a word) Does anyone have a fix for this? Is there some setting I'm missing? </p>
| <p>Are you loading them into your SWF through a loader? Or are they imported into your library as bitmap symbols? If they are loaded in try calling Bitmap.smoothing = true; or if they are in your library go to the Bitmap's properties and click Allow smoothing.</p>
<p>Other than that I would check to make sure you don'... | <p>Well I tried using image.opaqueBackground = 0x000000; and it seems working fine, antialiasing is much better, however, this beats the idea of a transparent background in the process.
This is truly angering, Adobe, do something about it!</p>
| 22,312 |
<p>I am looking to buy an Ender-3 Pro, but the place I'm looking to buy from has this picture:</p>
<p><a href="https://i.stack.imgur.com/RY2ds.jpg" rel="nofollow noreferrer" title="Confusing 3D printer publicity photo"><img src="https://i.stack.imgur.com/RY2ds.jpg" alt="Confusing 3D printer publicity photo" title="Conf... | <p>There is no such thing as a <em>Junior</em><sup>1</sup>, you can see the official Creality range of FDM printers on the <a href="https://www.creality.com/product/fdm-3d-printer" rel="nofollow noreferrer">FDM 3D PRINTER</a> page, on their web site.</p>
<p>Upon a cursory comparison of the photo it is one of these:</p>... | <p>That is an Ender 3, with the vertical PSU, the older interface, and many tweaks like the drawer and filament loading knob isn't present.</p>
<p>Consider the Ender 3 V2 instead, which is an iteration on the same basic design and is newer.</p>
<p>Personally I found it cheaper to buy the V2 direct from Creality's websi... | 2,065 |
<p>It seems that when filament throughput is increased (by increasing movement speed or extrusion width/height), printing temperature also has to be increased to compensate, because the filament will have less time to spend in the melting zone. That much seems clear from practical experience. But I have two questions (... | <p>I think I see what you're asking, but I think you may be thinking about it incorrectly. It's really all about heat being added to the system at the same rate that it's leaving. The heat block is there as a heat reservoir from which the filament draws heat for the glass transition. The heat in that reservoir is ma... | <p>I see an answer not a question. It's a balancing act and there is no predefined formula. Trial and error. Keep a spread sheet. I'll dwell on this a bit.. but as someone who did speed sprinting there's really nothing else to be said other than buy an e3d and the volcano upgrade. </p>
<p>You will calibrate one at a t... | 479 |
<p>Is there a classification of method of control most (FDM) 3D printers fall under?</p>
<p>From a 1986robotics textbook<sup>ref</sup> I was reading they defined three classes of control:</p>
<p>1) Pick and place</p>
<p>2) Point to point</p>
<p>3) Continuous path</p>
<p>However, both point to point and continuous ... | <p>The question is if robots classification terminology the textbook sketches applies to 3D printing?</p>
<p>Servos (closed loop) are used in robots to guarantee position (you don't want to accumulate an error after repetitive movement), most 3D printers use open loop steppers that are instructed on a point to point b... | <p>3D Printers fall under additive manufacturing and then can be classified by the material first. Usually, the material dictates entirely what the design looks like and it would be foolish to not differentiate what you look at by this first. For some materials, there are a couple of subtypes that tell us about which m... | 1,510 |
<p>I may have this completely wrong, but my understanding is that the --standalone compiler option tells the compiler to include the F# core and other dependencies in the exe, so that you can run it on another machine without installing any 'runtime'.</p>
<p>However, I can't get this to work in the CTP - it doesn't ev... | <p>Answer from MS:</p>
<p><em>There is a CTP update 1.9.6.2 that fixed some --standalone bugs.</em></p>
<p>I'm reinstalling now...</p>
<p>UPDATE:
Works for me - so the my accepted answer is <strong>download CTP update 1.9.6.2</strong>.</p>
| <p>F# manual: <a href="http://research.microsoft.com/fsharp/manual/compiler.aspx#Standalone" rel="nofollow noreferrer">Statically linking the F# library using "--standalone"</a></p>
<p>Did you try to run peverify.exe utility?</p>
| 9,661 |
<p>My present contract engagement is at a large E-Commerce company. Their code base which has origins going back to .Net 1.0 has caught me by surprise to contain many issues that raise the level of smell beyond the last crap I took. </p>
<p>That notwithstanding and trying to diffuse my level of distraction from it, I ... | <p>Nothing wrong with inline sql if the user input is properly parameterized, and this looks like it is. </p>
<p>Other than that, yes you do need to close the connections. On a busy web site you could hit your limit and that would cause all kinds of weirdness.</p>
<p>I also noticed it's still using an arraylist. S... | <p>If you were using c# I would wrap the datareader creation in a using statement but I don't think vb has those?</p>
| 36,363 |
<p>Using MVC out of the box I found the generated URLs can be misleading and I wanted to know if this can be fixed or if my approach/understanding is wrong.</p>
<p>Suppose I have a CreateEgg page, which has a form on it, and once the form is filled in and submitted the user is taken to a ListEggs page with the new egg... | <p>The problem is your action does two things, violating the Single Responsibility Principle.</p>
<p>If your Create action redirects to the List action when it's done creating the item, then this problem disappears.</p>
| <p>ActionVerbs Outlined in Scott Gu's <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx" rel="nofollow noreferrer">post</a> seem to be a good approch;</p>
<p>Scott says:</p>
<blockquote>
<p>You can create overloaded
implementations of action methods, ... | 5,934 |
<p>I've been looking into this, but:</p>
<ol>
<li>I'm not certain how to configure my multimeter; </li>
<li>I don't know how to keep the voltage going, and;</li>
<li>I don't know how to keep the multimeter connected to the VMOT?</li>
</ol>
<p>I'm told you're supposed to aim for about 1 A.</p>
| <p>Generally speaking voltage on stepstick output should be around 1V. </p>
<p>To imagine more or less what the current and what the voltage is, you can think about it in the same way as about water.</p>
<p>The wire is more or less the same as the pipe.
The voltage can be imagined as (sort of) the height from which t... | <p>I want to add some points and clarifications to the answer that @darthpixel already has given. Most information you need is in there, I want to give some more practical advice, since that is what I understand you're question is asking for. I'll start with some points on the more theoretical side, though:</p>
<ul>
<l... | 339 |
<p>I have a Maker Farm Prusa i3v 8" i just finished building. Initially when i first homed it, it ran fine, it even ran a test g code for movement. The problem is now the Z axis wont move anymore. First i checked for physical issues such as binding or nuts coming out of traps, everything's OK there. In Pronterface ... | <p>If you are using Repetier the code to test the endstops is m119 I think. If your z stop is triggered, you may have to invert it in the config.h file. I had this same issue for days before i figured out the control board was reading the switch as normal close instead of normal open. Hope that helps!</p>
| <p>Try sending a motion command manually, such as G1 X20 Z10, to eliminate any bugginess from the software interface as a reason for the Z not moving properly when commanded to. Next you could check the park location in Pronterface, perhaps the extruder head is sitting there waiting for the next command.</p>
| 682 |
<p>In a C# program, I have an abstract base class with a static "Create" method. The Create method is used to create an instance of the class and store it locally for later use. Since the base class is abstract, implementation objects will always derive from it.</p>
<p>I want to be able to derive an object from the ... | <p>Try using generics:</p>
<pre><code>public static BaseClass Create<T>() where T : BaseClass, new()
{
T newVar = new T();
// Do something with newVar
return T;
}
</code></pre>
<p>Sample use:</p>
<pre><code>DerivedClass d = BaseClass.Create<DerivedClass>();
</code></pre>
| <p>I'm not sure what your design goals are but from what you asked it sounds like it might end up with alot of code smell. I think you should really look into the Inversion of Control(IoC) / Dependency Injection (DI) design patterns that are implemented in numerous frameworks such as Microsoft Unity, Castle Windsor, St... | 38,470 |
<p>I have an API that is dependent on certain state information between requests. As an easy first version of the code, I am simply using PHP session's to store the state information instead of something more advanced (APC, memcache, DB). Throughout my initial testing in a web browser, everything worked perfectly. Howe... | <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,521 |
<p>My code is like the following:</p>
<pre><code>URLConnection cnx = address.openConnection();
cnx.setAllowUserInteraction(false);
cnx.setDoOutput(true);
cnx.addRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
InputStream is = cnx.getInputStream();
</code></pre>
<p>Is... | <p>The headers <strong>must</strong> be set prior to getting the <code>InputStream</code> to have any affect - an <code>IllegalStateException</code> will be thrown if the connection is already open.</p>
<p>As far as the <code>User-Agent</code> header specifically, it should be sent if it has been set.</p>
<p>See the ... | <p>I'd advise against using low-level constructs such as URLConnection. There are plenty of libraries for sending HTTP requests, with the most prominent being Apache HTTP Client. </p>
| 42,956 |
<p>I currently am tasked with updating an XML file (persistance.xml) within a jar at a customers site. I can of course unjar the file, update the xml, then rejar the file for redeployment. I would like to kind these command line operations in a Swing App so that the person doing it does not have to drop to the comman... | <p>The Java API has <a href="http://java.sun.com/javase/6/docs/api/java/util/jar/package-summary.html" rel="noreferrer">classes</a> for manipulating JAR files.</p>
| <p>You can use Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/ZipFile.html" rel="nofollow noreferrer">ZipFile</a> and <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/ZipEntry.html" rel="nofollow noreferrer">ZipEntry</a> classes to read the contents of a JAR file, then use <a href="... | 10,030 |
<p>I need to set up this scenario: </p>
<blockquote>
<p>A SQL Server 2005 database will create a transactional replication subscription from another database to populate a set of lookup tables. These lookup tables will then be published as a merge replication publication to the client's SQL Server Mobile.</p>
</bloc... | <p>Okay, I managed to get the answers I needed at the <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4093478&SiteID=1&mode=1" rel="nofollow noreferrer">MSDN SQL Server Replication forum</a>.<br />
The article I was looking for is called: <a href="http://msdn.microsoft.com/en-us/library/ms152553(... | <p>I do not get the interest of having a transactional replication to generate lookup tables. Such tables are not made to be updated from the client side, so why do you want to combine transactional + merge replication when you don't have the data modified by the subscribers?</p>
| 31,905 |
<p>After reading <a href="https://stackoverflow.com/questions/36127/any-recommended-vc-settings-for-better-pdb-analysis-on-release-builds">this discussion</a> and <a href="https://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">this discussion</a> about using CrashRpt to generate a crash dump and e... | <p><strong>What CrashRpt does for emailing:</strong> </p>
<p>The email system simply uses MAPI to send your email. Which would try to use your default mail client if you have one, and if it supports MAPI. Take a look at MailMsg.cpp for details. </p>
<p><strong>Personal experience:</strong></p>
<p>In my company's ... | <p>You can find the CrashRpt documentation, FAQ and download a new CrashRpt v1.1 here <a href="http://code.google.com/p/crashrpt/" rel="nofollow noreferrer">http://code.google.com/p/crashrpt/</a> </p>
| 26,725 |
<p>I often have nothing more than an FTP access to a server on which the application is placed.</p>
<p>What I usually use now is "Keeping remote directory up to date" feature of <a href="http://winscp.net/" rel="nofollow noreferrer">WinSCP</a>. Files of the local copy (in theory at least) keep being uploaded to a remo... | <p>I have a similar situation. I used to use Dreamweaver for web development but have switched to other tools that do not have the file sync features of Dreamweaver.</p>
<p><strong>I have recently discovered <a href="http://www.scootersoftware.com/" rel="nofollow noreferrer">BeyondCompare</a></strong>, which is a dif... | <p>If you are using <a href="http://maven.apache.org/" rel="nofollow noreferrer">Maven</a> to automate your build I would recommend you use the <a href="http://cargo.codehaus.org/" rel="nofollow noreferrer">Cargo</a> plugin to deploy your application to the server.</p>
<p>If you cannot use your container's deployer yo... | 17,225 |
<p>I am writing a small program. The interface I am writing to control each repository that is made defines a method of Save(IPublicObject). I am using LINQ for the SQL Version of the repository CRUD. My question is this. I would like to have only the one method which accepts the interface type. I want to think ho... | <p>For LINQ-to-SQL, the data-context already does a lot of the mapping for you. As such, I think generics might be the best way to achieve a save while still having some consideration of your interface (although I'm not quite sure what the interface is giving you in this scenario...).</p>
<p>You can access the generic... | <p>What you wish to do is to have a:</p>
<pre><code>Repository.Save(publicObject)
</code></pre>
<p>and the repository to call a method from publicObject?</p>
<p>If this is the requirement then you can define the Save method in repository as:</p>
<pre><code>public class Repository {
public void Save(IPublicObjec... | 26,589 |
<p>I am trying to import an existing PDF as a template with FPDI. The template is in landscape format. If I import the template into a new document the template page is inserted in portrait form with the content rotated 90 degrees. If my new document is in portrait the full content appears, but if the new document i... | <p>sure, it is no problem. Just add "L" as parameter when calling "addPage()". Here is a sample which works fine for me (the template is in landscape)</p>
<pre><code><?php
require_once('fpdf.php');
require_once('fpdi.php');
$pdf =& new FPDI();
$pdf->addPage('L');
$pagecount = $pdf->setSourceFile('templat... | <p>Finally got to look at this problem again... Although crono's answer is perfectly valid. It seems this only works with more recent versions of the FPDI tools. Upgrading from v1.1 to v1.3 solves the problem.</p>
| 38,120 |
<p>Like, testing for : </p>
<ul>
<li>invalid inputs (strings containing "'"s)</li>
<li>giving random id's in url parameters to access "unauthorized" pages</li>
<li>prevent sql injection</li>
<li>...</li>
</ul>
| <p>I would recommend reading this brilliant <a href="https://rads.stackoverflow.com/amzn/click/com/0471081124" rel="nofollow noreferrer" rel="nofollow noreferrer">book</a> to learn more about the test plans.</p>
<p>In particular a test plan is much more than a list of techniques like you mentioned (these should most l... | <p>If you want to make a list, you can add "Trying simple javascripts within a textarea field to see if the site saves and executes them"</p>
| 22,688 |
<p>I build and export my model using ZBrush and as STL files.<br />
To fix the mesh for 3D print, I try to use 3D Builder which can automatically repair my parts.<br />
As it saves as a single file, if I import all parts at once,<br />
I import the files one by one, repair them, then save them as a new file.<br />
Afte... | <p>STL models as exported by software often include their origin in the origin of the design software. However, when using software to fix modeling errors, those origins are not always retained and thus when importing them into a different software their <em>center of mass</em> is taken as the new point of reference.</... | <p>It has moved it to the ground as close as it could. This is generally best for 3d printing seperate objects.</p>
<p>If you need them together you can reposition them, or combine them.</p>
<p>Alternatively change the 'Collision' and 'Intersect' settings until you get what you want.</p>
| 2,138 |
<p>I have a VB.NET ClickOnce application that I am trying to install on my computer. Previously, I was able to install and run these apps without issue. Now when I install the application, I can see the flash of a window opening, and then nothing. (There are also no processes left hanging or anything when viewed with... | <p>Have you tried using mage.exe? This is a command-line tool that comes with .NET framework. Start up a VS command prompt, and try mage -cc. This will clear your applicaiton cache and will force a new click-once download. This is the first thing I do when my click-once applications fail and it works 99% of the tim... | <p>It's possible that new prerequisites were added that you don't have on hand. If the URL you are using points directly to "my.application" or whatever your equivalent is, prerequisites won't be processed.</p>
<p>So try pointing to the setup.exe that is created in the same directory as the .application file.</p>
<p>... | 24,270 |
<p>I'm writing a service application that sometimes cannot be stopped immediately upon receiving the SERVICE_CONTROL_STOP from the Services MMC. I currently handle it like this: (in pseudo-code):</p>
<pre><code>DWORD
HandlerEx(
DWORD dwControl,
DWORD dwEventType,
PVOID pvEventData,
PVOID pvContext
... | <p>For Perl/Tk, there is <a href="http://www.perltk.org/index.php?option=content&task=view&id=28&Itemid=29" rel="nofollow noreferrer">ZooZ</a>. </p>
<p>Personally, I prefer to use <a href="http://glade.gnome.org/" rel="nofollow noreferrer">Glade</a> for the GUI design and <a href="http://search.cpan.org/d... | <p>The Perlmonks post <a href="http://www.perlmonks.org/?node_id=627282" rel="nofollow noreferrer">http://www.perlmonks.org/?node_id=627282</a> might help, as well as the google search for <a href="http://www.google.com/search?client=safari&rls=en-us&q=perl+gui+builder&ie=UTF-8&oe=UTF-8" rel="nofollow n... | 37,405 |
<p>I've done some Python but have just now starting to use Ruby<br>
I could use a good explanation of the difference between "self" in these two languages. </p>
<p><strong>Obvious on first glance:</strong><br>
Self is not a keyword in Python, but there is a "self-like" value no matter what you call it.<br>
Python met... | <p>Python is designed to support more than just object-oriented programming. Preserving the same interface between methods and functions lets the two styles interoperate more cleanly.</p>
<p>Ruby was built from the ground up to be object-oriented. Even the literals are objects (evaluate 1.class and you get Fixnum). Th... | <p>Well, I don't know much about Ruby. But the obvious point about Python's "self" is that it's not a "keyword" ...it's just the name of an argument that's sent to your method.</p>
<p>You can use any name you like for this argument. "Self" is just a convention.</p>
<p>For example :</p>
<pre><code>class X :
def _... | 19,348 |
<p>I have a large table with 1 million+ records. Unfortunately, the person who created the table decided to put dates in a <code>varchar(50)</code> field.</p>
<p>I need to do a simple date comparison -</p>
<pre><code>datediff(dd, convert(datetime, lastUpdate, 100), getDate()) < 31
</code></pre>
<p>But it fails on... | <p>Place the <code>CASE</code> and <code>ISDATE</code> inside the <code>CONVERT()</code> function.</p>
<pre class="lang-sql prettyprint-override"><code>SELECT COUNT(*) FROM MyTable
WHERE
DATEDIFF(dd, CONVERT(DATETIME, CASE IsDate(lastUpdate)
WHEN 1 THEN lastUpdate
ELSE '12-30-1899'
END), GetDat... | <p>I would suggest cleaning up the mess and changing the column to a datetime because doing stuff like this</p>
<pre><code>WHERE datediff(dd, convert(datetime, lastUpdate), getDate()) < 31
</code></pre>
<p>cannot use an index and it will be many times slower than if you had a datetime colum,n and did</p>
<pre><co... | 4,776 |
<p>I am working on some sort of CRM application which has huge sales data with all the customer leads etc (ASP.NET 2.0/Ajax)</p>
<p>I want to create a dashboard which will have four separate data containers each container will have different sort of data and each container has to update it self after some configured ... | <p>Both ASP.NET UpdatePanel or jQuery (or a mix of both) would serve you fine on this scenario; if you don't have experience with neither, I would recommend the UpdatePanel way because it is closer to the regular ASP.NET code you're used to. </p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb398867.aspx" rel="... | <p>Also you can use <a href="http://www.dynamicdashboards.net" rel="nofollow noreferrer">dynamic dashboard framework</a> and convert update panels to drag-drop widgets.</p>
<p>It's a browser independent web part framework for Asp.Net.</p>
| 42,411 |
<p>I need to do a few very simple URL manipulations in Java. Like get the value for a parameter in the query, or update it, ... I was expecting to find a simple utility class doing that in the commons-lang package, but no. I know it is a simple problem, but if there is something already written, why do it again ? Do yo... | <p>I think what you want is called a query string parser instead of an url manipulator and here's one: <a href="http://ostermiller.org/utils/CGIParser.java.html" rel="noreferrer">http://ostermiller.org/utils/CGIParser.java.html</a></p>
| <p>Apache's httpcomponents library has a URL decoder: <a href="http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/utils/URLEncodedUtils.html" rel="nofollow">http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/utils/URLEncodedUtils.html</a></p>
<p... | 26,897 |
<p>I am working on a web application that was recently converted from Visual Studio 2003 to Visual Studio 2008. The application contained some web services that were written using the .NET 1.1 Framework and Web Service Enhancements 2.0. They were converted to the .NET 3.5 framework using the VS 2008 Conversion Wizard... | <p>If you go directly to the asmx url with a web browser, and then click on the method you want to call, what's the SOAPAction that they want?</p>
<p>next, check the Reference.vb code and see what the SoapDocumentMethodAttribute attribute is set to.</p>
<p>Do they match?</p>
| <p>Does the web service work otherwise? Is it possible your new updated 2.0 web service exists in the same application domain as a 1.1 application? In that case you'll want to make your own app-domain.</p>
<p>If its not local try using Fiddler to see everything that is going back and forth.</p>
| 22,420 |
<p>I'm looking for a way to select until a sum is reached.</p>
<p>My "documents" table has "<code>tag_id</code>" and "<code>size</code>" fields.</p>
<p>I want to select all of the documents with <code>tag_id = 26</code> but I know I can only handle 600 units of size. So, there's no point ... | <p>You need some way to order which records get priority over others when adding up to your max units. Otherwise, how do you know which set of records that totals up to 600 do you keep?</p>
<pre><code>SELECT d.id, d.size, d.date_created
FROM documents d
INNER JOIN documents d2 ON d2.tag_id=d.tag_id AND d2.date_created... | <p>This is much less efficient, but it does avoid a cursor (assuming your documents table also has a serial id column):</p>
<pre><code>select a.id, (select sum(b.size) from documents b where b.id <= a.id and b.tag_id = 26)
from documents a
where a.tag_id = 26
order by a.id
</code></pre>
<p>Also, this was done in p... | 36,546 |
<p>I have a dropdown box and a literal tag inside an Update Panel. On the selection change event of the dropdown up requery the database and repopulate the literal tag and then call UPdatePanel.Update().</p>
<p>below, is there are way i can avoid having to create a new Oledbconnection each time as this seems slow. C... | <p>With .NET is not a good idea to keep your connection alive longer than needs. Good practice would be to put a using statement around it (so it always gets cleaned up):</p>
<pre><code>string dataSource = ConfigurationSettings.AppSettings["contactsDB"];
using(var objConn = new OleDbConnection(dataSource))
{
strin... | <p>You need to recreate this for each request. You have a a state less server. you never know when or if your client will call back. You do not want to keep an open connection to the database nor could you simply service multiply clients while maintaining one database connection.</p>
<blockquote>
<p>To deploy high... | 37,459 |
<p>Ive decided that I really dont like microsoft and their ways. Please could you give me directions on how to handle winmail.dat in emails, is there a jython library or a java library that will allow me to handle this.</p>
<p>Ive just completed a email processing program, written in jython 2.2.1 on java 5. During the... | <p>read here:<br>
<a href="http://en.wikipedia.org/wiki/TNEF" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/TNEF</a></p>
<p>a package for parsing here:<br>
<a href="https://github.com/verdammelt/tnef" rel="nofollow noreferrer">https://github.com/verdammelt/tnef</a></p>
| <p>I have had good luck with <a href="http://www.biblet.freeserve.co.uk/" rel="nofollow noreferrer">wmdecode</a> on Windows. Granted, it's an EXE, not a java project. But it could be useful if you run into WINMAIL.DAT files that other solutions can't decode.</p>
| 43,652 |
<p>Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1? I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and are mangling the code snippets instead of prettifying them.</p>
| <p>I use <a href="http://wordpress.org/extend/plugins/wp-syntax/" rel="noreferrer">WP-Syntax</a> and it's worked very well for me. It's supported every language I've thrown at it so far, and the colors can be customized for a particular theme (though the defaults look just fine too)</p>
| <p>You should also checkout <a href="http://code.google.com/p/syntaxhighlighter/" rel="nofollow noreferrer">syntaxhighlighter</a> from Google Code.</p>
| 5,627 |
<p>I have a base recipe class and I am using a datacontext. I overrode the insert method for the recipe in the datacontext and am trying to insert into its children. Nomatter what I do I cannot get the child to insert.Currently, just the recipe inserts and nothing happens with the child.</p>
<pre><code> partial voi... | <p>I figured it out. Override SubmitChanges in the DataContext, and find all of the inserts and updates that are recipes. Run the algorithm to add children there.</p>
<pre><code> public override void SubmitChanges(
System.Data.Linq.ConflictMode failureMode)
{
ChangeSet changes = this.GetChangeSe... | <p>The InsertX/UpdateX/DeleteX methods are called after LINQ to SQL has determined which objects will be included in SubmitChanges.</p>
<p>You would have been getting a timeout using two DataContext most likely because of locking issues between the two transactions.</p>
<p>I can't clearly make out what you are trying... | 47,678 |
<p>I'm thinking about how to do this, but I have several different shapes of Data in my Database, Articles, NewsItems, etc. </p>
<p>They All have something in common, they all have IDs (in the DB they're named ArticleID, NewsID etc. )</p>
<p>They all have a <strong>Title</strong></p>
<p>They all have <strong>BodyTe... | <p>This is what Interfaces are for. Have each class implement an IContent interface that contains your Title, BodyText, Status and DateAdded properties. Now you can pass around a collection ( <code>List<IContent></code> ) around that could containt different types of content.</p>
<p>If you're using LinqToSql you... | <p>I found one page that looks like it has something along the lines of what I'm looking for (The last post)... but I'm not sure about using weakly typed objects:</p>
<p><a href="http://www.eggheadcafe.com/software/aspnet/32149682/linq-inheritance-problem.aspx" rel="nofollow noreferrer">LINQ inheritance</a></p>
| 31,714 |
<p>It is very easy to ask questions that only tangentially involve 3D printing, such as:</p>
<ul>
<li><p>How do I drill a hole in a 3D printed part?</p></li>
<li><p>How do I paint 3D printed parts?</p></li>
<li><p>How do I sand, smooth, etc...?</p></li>
<li><p>How do I take a picture with a 3D printed camera?</p></li>... | <p>The dividing line of "tangentially off topic" is typically when the <em>actual</em> subject of the question being asked is only <strong><em>coincidentally</em></strong> adjacent to 3D printing. </p>
<p>Here is a <em>clear</em> example illustrating the "tangential issue:"</p>
<blockquote>
<p>I printed a crane mec... | <p>The problem with the questions you raised are (except for the camera one) that they are all about dealing with the materials that are used with 3D-printing and not about the mechanics of printing. But when I started 3D-printing, that's certainly where a large part of my questions lay. It's because the materials are ... | 7 |
<pre><code>class Foo(models.Model):
title = models.CharField(max_length=20)
slug = models.SlugField()
</code></pre>
<p>Is there a built-in way to get the slug field to autopopulate based on the title? Perhaps in the Admin and outside of the Admin.</p>
| <p>for Admin in Django 1.0 and up, you'd need to use</p>
<pre><code>prepopulated_fields = {'slug': ('title',), }
</code></pre>
<p>in your admin.py</p>
<p>Your key in the prepopulated_fields dictionary is the field you want filled, and the value is a tuple of fields you want concatenated.</p>
<p>Outside of admin, yo... | <p><a href="https://bitbucket.org/neithere/django-autoslug" rel="nofollow">autoslug</a> has worked quite well for me in the past. Although I've never tried using it with the admin app.</p>
| 17,098 |
<p>Steve Yegge recently posted an <a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html" rel="noreferrer">interesting blog post</a> on what he calls the universal design pattern. In there he details using prototypes as a modelling tool, instead of classes. I like the way this introduces less co... | <p>One interesting bit is that it's easy to make a prototype-based language act OO but it's difficult to make an OO language act prototype-based. </p>
<ul>
<li>Alex Arnell's <a href="http://code.google.com/p/inheritance/" rel="noreferrer">inheritance.js</a> is a short and sweet chunk of code that makes JavaScript act ... | <p>For those interested, <a href="http://en.wikipedia.org/wiki/Newtonscript" rel="nofollow noreferrer">NewtonScript</a> was (is) a dual language: you had prototypes and you had classes. You could choose whether to inherit from a class, from a prototype or from both.</p>
| 29,369 |
<p>I am completely new to LINQ in C#/.NET. I understand that I could use it to convert a DataSet into an Array/List, am I able to go in the opposite direction?</p>
<p>I'm using NPlot to generate a graph of captured prices, which are stored in a List, where PriceInformation is a class containing two public doubles and... | <p>There's a method called <a href="http://msdn.microsoft.com/en-us/library/bb396189.aspx" rel="nofollow noreferrer">CopyToDataTable</a>. That method will only help if you already have a IEnumerable(DataRow)</p>
<p>Here's how I'd do this:</p>
<pre><code>//extension method to convert my type to an object array.
publi... | <p>if <code>MyObjectType</code> is a linq-generated entity, and those objects are not already associated to a data context you can call </p>
<pre><code>foreach( MyObjectType value in myList )
{
dataContext.MyObkectTypes.InsertOnSubmit(value);
}
dataContext.SubmitChanges();
</code></pre>
<p>However, at this time l... | 27,057 |
<p>I have a XML Structure that looks like this.</p>
<pre><code><sales>
<item name="Games" sku="MIC28306200" iCat="28"
sTime="11/26/2008 8:41:12 AM"
price="1.00" desc="Item Name" />
<item name="Games" sku="MIC28307100" iCat="28"
sTime="11/26/2008 8:42:12 AM"
price="1.00" desc=... | <p>There's an overload of XPathExpression.Addsort which takes an IComparer interface. If you implement the comparison yourself as IComparer, you could use this mechanism.</p>
<pre><code> class Program
{
static void Main(string[] args)
{
XPathDocument saleResults = new X... | <p>suppose ur date time is in this format</p>
<p>2010-06-01T15:16:29+05:00</p>
<p>then simplest way that can be done is</p>
<p>< xsl:sort select="translate(XPATH_RETURNING_DATE,'-T:+','')" order="descending" data-type="number" /></p>
<p>IN DATETIME JUST REPLACE EXTRA CHARACTERS
in my datetime format i have the e... | 44,844 |
<p>Using the Sun Java VM 1.5 or 1.6 on Windows, I connect a non-blocking socket. I then fill a <code>ByteBuffer</code> with a message to output, and attempt to <code>write()</code> to the SocketChannel.</p>
<p>I expect the write to complete only partially if the amount to be written is greater than the amount of spac... | <p>I managed to reproduce a situation that might be similar to yours. I think, ironically enough, your recipient is consuming the data faster than you're writing it.</p>
<pre><code>import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class MyServer {
public static void main(Strin... | <p>I'll make a big leap of faith and assume that the underlying network provider for Java is the same as for C...the O/S allocates more than just <code>SO_SNDBUF</code> for every socket. I bet if you put your send code in a for(1,100000) loop, you would eventually get a write that succeeds with a value smaller than req... | 19,111 |
<p>How do I create a branch in SVN?</p>
| <p>Branching in Subversion is facilitated by a very very light and efficient copying facility.</p>
<p>Branching and tagging are effectively the same. Just copy a whole folder in the repository to somewhere else in the repository using the <code>svn copy</code> command.</p>
<p>Basically this means that it is by conven... | <p>Below are the steps to create a branch from trunk using TortoiseSVN in windows machine. This obviously needs TortoiseSVN client to be installed.</p>
<ol>
<li>Right Click on updated trunk from local windows machine</li>
<li>Select TortoiseSVN</li>
<li>Click branch/Tag</li>
<li>Select the To path in SVN repository. N... | 2,425 |
<p>I assume there must be a system and language independent way to just stick the "current" EOL character into a text file, but my MSDN-fu seems to be weak today. Bonus points if there is a way to do this in a web application that will put the correct EOL character for the current client's machine's OS, not the web se... | <p>For the bonus point:</p>
<ul>
<li>Check the user-agent of the client machine, for substrings such as Windows, or Linux</li>
<li>The System.Environment.NewLine for Windows is 0x13, 0x10; in unix, it's generally 0x10 only; </li>
<li>Choose the appropriate newline string, append it to the line, and off you go</li>
</u... | <p>Open the text file, seek to the end, and append Environment.NewLine.</p>
| 15,842 |
<p>I decided to finally purchase an Ender 3 v2. It arrived today and after a few hours of making sure everything is straight, I tried to power it and do a test print...</p>
<p>I was disappointed to see that the screen stays black after more than 10 seconds from power on.</p>
<p>I did not insert any SD card in the print... | <p>What seems to be a difficulty is the stabilizers for plastic absorb UV. So if added to UV resin, they probably greatly increase the exposure time needed.</p>
<p>The following show characteristics of some plastics, taken from <a href="https://www.coleparmer.com/tech-article/uv-properties-of-plastics" rel="nofollow n... | <p>Sunlight contains the full spectrum of electromagnetic radiation, including the wavelength to photoinitiate your resin. Most UV-curable materials are kept in opaque containers for this reason. The extent to which your material is crosslinked will depend on your material and how much sunlight it receives.</p>
| 1,880 |
<p>I have 1 process that receives incoming connection from port 1000 in 1 <strong>linux</strong> server. However, 1 process is not fast enough to handle all the incoming request.</p>
<p>I want to run multiple processes in the server but with 1 end-point. In this way, the client will only see 1 end-point/process not mu... | <p>You also may want to go with a web server like <a href="http://www.nginx.net" rel="nofollow noreferrer">nginx</a>. It can load balance your app against multiple ports of the same app, and is commonly used to load balance Ruby on Rails apps (which are single threaded). The downside is that you need to run multiple co... | <p>i am thinking to run multiple application similar to <a href="http://ypopsemail.com/" rel="nofollow noreferrer">ypops</a>.</p>
| 6,708 |
<p>I would like to to try Emacs, and want to give it the best chance possible.</p>
<p>To do this, it seems like having a good <code>.emacs</code> file is important.</p>
<p>I primarily use Mac OS X (so I have looked at Aquamacs), and I mainly do Python programming, so anything specifically for that would be great.</p>... | <p>That is a hard question. My theory about Emacs is that you have to give it a <strong>real</strong> honest try. That means working with it for a few months, not days. It is not for the faint of heart! Ideally emacs would become your one and only text editor, and you do things the emacs way. </p>
<p>Really, to g... | <p>You can look to my emacs configs, located on <a href="http://xtalk.msk.su/~ott/en/emacs/" rel="nofollow noreferrer">my site</a>. Aquamacs-specific configuration you can find in <a href="http://xtalk.msk.su/~ott/common/emacs/rc/emacs-rc-local-flash.lan.el.html" rel="nofollow noreferrer">separate file</a></p>
| 34,083 |
<p>I have a web app for commercial property management that needs spreadsheet-like functionality for doing budgets. I don't want to use Google Sheets because my users won't necessarily have a Google account. </p>
<p>So is there anything out there that I could use?</p>
<p>I looked and could only find <a href="http://w... | <p>If you don't mind implementing the logic yourself, the <a href="http://extjs.com/deploy/dev/examples/grid/edit-grid.html" rel="nofollow noreferrer">ExtJS</a> grid component is a JavaScript grid component with lots of powerful features, and it is available in both open-source and commercial versions.</p>
| <p><a href="http://www.infragistics.com" rel="nofollow noreferrer">Infragistics</a> has spreadsheet-type functionality in their data grid product</p>
| 19,195 |
<p>What's the best/most efficient way to extract text set between parenthesis? Say I wanted to get the string "text" from the string "ignore everything except this (text)" in the most efficient manner possible.</p>
<p>So far, the best I've come up with is this:</p>
<pre><code>$fullString = "ignore everything except t... | <p>i'd just do a regex and get it over with. unless you are doing enough iterations that it becomes a huge performance issue, it's just easier to code (and understand when you look back on it)</p>
<pre><code>$text = 'ignore everything except this (text)';
preg_match('#\((.*?)\)#', $text, $match);
print $match[1];
</co... | <pre><code>function getStringsBetween($str, $start='[', $end=']', $with_from_to=true){
$arr = [];
$last_pos = 0;
$last_pos = strpos($str, $start, $last_pos);
while ($last_pos !== false) {
$t = strpos($str, $end, $last_pos);
$arr[] = ($with_from_to ? $start : '').substr($str, $last_pos + 1, $t - $last_pos - 1).(... | 23,876 |
<p>I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine <em>something</em> I end up programming will need a B-Tree, or is that ... | <p>Forever (or as close as I can get). That's the whole point of a source control system.</p>
| <p>Source control, keep it offsite and keep it for life! You'll never have to worry about it.</p>
| 9,365 |
<p>When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL?</p>
<p>example:</p>
<p><strong>data.xml</strong></p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<root&g... | <p>You can generate the XSLT server-side, even if the transformation is client-side.</p>
<p>This allows you to use a dynamic script to handle the parameter.</p>
<p>For example, you might specify:</p>
<pre><code><?xml-stylesheet type="text/xsl"href="/myscript.cfm/sample.xsl?paramter=something" ?>
</code></pre>
... | <p>You can generate the XSLT server-side, even if the transformation is client-side.</p>
<p>This allows you to use a dynamic script to handle the parameter.</p>
<p>For example, you might specify:</p>
<pre><code><?xml-stylesheet type="text/xsl"href="/myscript.cfm/sample.xsl?paramter=something" ?>
</code></pre>
... | 9,156 |
<p>I want to share an object between my servlets and my webservice (JAX-WS) by storing it as a servlet context attribute. But how can I retrieve the servlet context from a web service?</p>
| <p>The servlet context is made available by JAX-WS via the message context, which can be retrieved using the web service context. Inserting the following member will cause JAX-WS to inject a reference to the web service context into your web service:</p>
<pre><code>import javax.annotation.Resource;
import javax.servle... | <p>If you use Maven add this dependency!!!</p>
<pre><code> <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependen... | 32,671 |
<p>I want to be able to explore the contents of a DB for this version of the DB. I was thinking of using the Squirrel DB client (which needs a JDBC driver).</p>
<p>Therefore, I'm looking for a JDBC type 4 driver for SQL SERVER 3.5. Can somone point me to a FREE OR open source or trial ware ?</p>
<p>If no JDBC driver... | <p>There is a free program called SQLCeEditor that does it.</p>
<p>I'd still like a JDBC driver though since that would make it easy to use with Eclipse and Java.</p>
| <p>If you're into linq syntax, you can also use <a href="http://www.linqpad.net/" rel="nofollow">LinqPad</a>. There's a free version that allows exploring the data and editing it. You would pay for autocompletion but you can live without it.
I hope this helps.</p>
| 17,095 |
<p>I have a two way foreign relation similar to the following</p>
<pre><code>class Parent(models.Model):
name = models.CharField(max_length=255)
favoritechild = models.ForeignKey("Child", blank=True, null=True)
class Child(models.Model):
name = models.CharField(max_length=255)
myparent = models.ForeignKey(Par... | <p>I just came across <a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to" rel="noreferrer">ForeignKey.limit_choices_to</a> in the Django docs.
Not sure yet how this works, but it might just be the right thing here.</p>
<p><strong>Update:</strong> ForeignKey.li... | <pre><code>from django.contrib import admin
from sopin.menus.models import Restaurant, DishType
class ObjInline(admin.TabularInline):
def __init__(self, parent_model, admin_site, obj=None):
self.obj = obj
super(ObjInline, self).__init__(parent_model, admin_site)
class ObjAdmin(admin.ModelAdmin):
... | 28,762 |
<p>How do I go about the <code>[HandleError]</code> filter in asp.net MVC Preview 5?<br>
I set the customErrors in my Web.config file</p>
<pre><code><customErrors mode="On" defaultRedirect="Error.aspx">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.... | <pre><code>[HandleError]
</code></pre>
<p>When you provide only the HandleError attribute to your class (or to your action method for that matter), then when an unhandled exception occurs MVC will look for a corresponding View named "Error" first in the Controller's View folder. If it can't find it there then it will ... | <pre><code> [HandleError]
public class ErrorController : Controller
{
[AcceptVerbs(HttpVerbs.Get)]
public ViewResult NotAuthorized()
{
//401
Response.StatusCode = (int)HttpStatusCode.Unauthorized;
return View();
}
[AcceptVerbs(HttpVerb... | 22,159 |
<p>How would you ensure that only one user is logged in per account at a time?</p>
<p>Assuming cookies are persistent.</p>
| <p>Typically the best way is to implement a customization on the provider that checks for last login, as well as adding methods to your code to keep track of user action.</p>
<p>The key is that you must know at what point did the user last do something OR logout. From there you can determine if the account is actuall... | <p>Conceptually you have to decide how you want to respond. If you have User A logged in and then User B attempts to login (using the same credentials) do you:</p>
<ol>
<li>Kick User A out</li>
</ol>
<p>or </p>
<ol start="2">
<li>Not allow a login from User B </li>
</ol>
<p>(2) is problematic because you need to re... | 38,984 |
<p>I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious place to get more info about oom-killer? E.g. detailed info about processes at the t... | <p>You can check the messages log file to see which process got killed and some related information. As for the reasons:</p>
<blockquote>
<p>... the ideal candidate for liquidation is a recently started, non privileged process which together with it's children uses lots of memory, has been nice'd, and does no raw I/... | <p>Typically you should get a message in /var/log/messages, with quite a large amount of detail relating to the process that was killed by the oom-killer.</p>
| 14,593 |
<p>For learning and demonstrating, I need a macro which prints its parameter <strong>and</strong> evaluates it. I suspect it is a very common case, may be even a FAQ but I cannot find actual references.</p>
<p>My current code is:</p>
<pre><code>#define PRINT(expr) (fprintf(stdout, "%s -> %d\n", __STRING(expr), (ex... | <p>You can use the # preprocessor token which converts the parameter following it to a string literal:</p>
<pre><code>#include <stdlib.h>
#include <stdio.h>
#define STR(x) #x
#define PRINT(expr) (fprintf(stdout, "%s -> %d\n", STR(expr), (expr)))
int main(void)
{
int x = 7;
PRINT(x &a... | <p>It is <strong>glibc</strong> who has been providing <code>__STRING</code> since (at least) version 1.04 (1992-09-03), maybe earlier.</p>
<p>/usr/include/sys/cdefs.h:</p>
<pre><code>#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
</code></pre>
<p>They were both used in glibc back then. Currently, <code>__STRING... | 49,424 |
<p>How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.</p>
<p>I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random numb... | <p>UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier), according to <a href="https://www.ietf.org/rfc/rfc4122.txt" rel="noreferrer">RFC 4122</a>, are identifiers designed to provide certain uniqueness guarantees.</p>
<p>While it is possible to implement RFC-compliant UUIDs in a few ... | <p>Here's a method that generates <code>RFC4122</code> using true random via <code>random.org</code>. If the fetch fails it falls back to the browser's inbuilt <code>crypto</code> library which should almost be just as good. And finally, if the user's browser in question doesn't support that, it uses <code>Math.random(... | 13,065 |
<p>Is there a way to find out the size of a SQL Server database using WMI from .NET?</p>
<p>I've had a look at the <a href="http://msdn.microsoft.com/en-us/library/ms180499.aspx" rel="noreferrer">WMI documentation</a> but I'm not clear how I'd be able to locate that information.</p>
<p>We're using SQL Server 2008.</p... | <p>You can access this property via Microsoft.SqlServer.Management.Smo. Give this a try: <a href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.database.size.aspx" rel="nofollow noreferrer">MSDN</a></p>
| <p>A bit of a tangential answer, but whenever I want to play with WMI, I first take a quick look with <a href="http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx" rel="nofollow noreferrer">Scriptomatic</a>, Microsoft's WMI browser.</p>
<p>Doing so against SQL <strong>Express 2005</strong>, the only WMI ... | 44,600 |
<p>I'm working on a video streaming application in Flash and I've been told I need to add quality selection tools. The requirements are "low", "medium" and "high" quality. I'm trying to figure out what kinds of quality settings to actually apply for this (framerate and video quality settings). I feel like there has ... | <p>It may be a better idea to just define bandwidth points and then look at your codec to identify the best quality for a given point. Then you can give each of those bandwidth points a 'normal' name. like:</p>
<ul>
<li>56k is 320x240 @ 8fps and is "low quality" </li>
<li>256k is 640x480 @ 8fps and is "medium qualit... | <p>I ended up coming up with some values, though they're probably not standard.</p>
<p>I realized after asking the question that my needs probably didn't fit the standards, as my resolution was fixed at 160x120 as that's the size of the component that was viewing the video. I just ended up using the video quality set... | 47,066 |
<p>Often you need to show a list of database items and certain aggregate numbers about each item. For instance, when you type the title text on Stack Overflow, the Related Questions list appears. The list shows the titles of related entries and the single aggregated number of quantity of responses for each title.</p>
... | <p>Here's a trick: calculating a <code>SUM()</code> of values that are known to be either 1 or 0 is equivalent to a <code>COUNT()</code> of the rows where the value is 1. And you know that a boolean comparison returns 1 or 0 (or NULL).</p>
<pre><code>SELECT c.catname, COUNT(m.catid) AS item_count,
SUM(i.ownerid = ... | <p>You can sneak a CASE statement inside your SUM():</p>
<pre><code>SELECT categories.catName,
COUNT(map.itemId) AS item_count,
SUM(CASE WHEN owner= @ownerid THEN 1 ELSE 0 END) AS owner_item_count
FROM categories
LEFT JOIN map ON categories.catId = map.catId
LEFT JOIN items ON items.itemId = map.itemId
GROU... | 35,677 |
<p>I'm trying to write a Wordpress plug-in that automatically posts a blog post at a certain time of day. For example, read a bunch of RSS feeds and post a daily digest of all new entries.</p>
<p>There are plug-ins that do something similar to what I want, but many of them rely on a cron job for the automated schedul... | <p><a href="http://codex.wordpress.org/Function_Reference/wp_schedule_event" rel="nofollow noreferrer">http://codex.wordpress.org/Function_Reference/wp_schedule_event</a></p>
| <p>vBulletin uses a sort of Pseudo-Cron system, that basically checks a schedule on every page access, and fires any processes that are due then.</p>
<p>It's been a while since I worked with Wordpress, but I think something like this should work if it runs on each page view. </p>
| 7,762 |
<p>If I have a table like:</p>
<pre><code>CREATE TABLE FRED
(
recordId number(18) primary key,
firstName varchar2(50)
);
</code></pre>
<p>Is there an easy way to clone it's structure (not it's data) into another table of a given name. Basically I want to create table with exactly the same structure, but a different n... | <p>If you're looking a way to find the exact DDL to recreate the table, including the storage clause, you can use </p>
<pre><code>select dbms_metadata.get_ddl('TABLE', 'TABLE_NAME', 'SCHEMA_NAME') from dual
</code></pre>
<p>as described <a href="http://www.troygeek.com/articles/ExtractingOracleDDLCommandLine/" rel="n... | <pre><code>SELECT INTO TARGET_TABLE FROM SOURCE_TABLE;
OR
CREATE TABLE TARGET_TABLE_NAME AS SELECT * FROM SOURCE_TABLE;
</code></pre>
<p>if you want to copy only the structure then add the Where Clause <code>WHERE 1=2</code>.</p>
<p>I hope it will be helpful.</p>
| 32,595 |
<p>I am fortunate to be working for a company in which all of our new development efforts are all in WPF. Are there a lot of other developers out there in this situation? Are companies quickly adopting this as their primary UI platform? As developers we all see the value in it, but are companies buying into it?</p>
| <p>I think the major problem for the companies to adapt this new technology are </p>
<ul>
<li>learning curve on XAML and new UI concepts</li>
<li>Developers have to forget all the knowledge they got on Winforms(or equivalent UI) technologies, most people are reluctant to give up their expertise.</li>
<li>The need for ... | <p>Our company is also doing most new development in WPF. It is working fairly well for us. However, it took 2-3 months for the organization to overcome the learning curve and to begin the "WPF Way of Thinking." </p>
<p>Similar to Louis' point, I think one of the reasons it is slow to take hold of the industry is t... | 44,807 |
<p>I just bought a new RAMPS 1.6 shield to replace my old RAMPS 1.4 shield. The problem is that it's just not working, the motors don't move, heatbed/nozzle don't get heated. It was all working with the RAMPS 1.4 shield.</p>
<p>I checked the RAMPS 1.6 and there's no bridging in the solder joints.</p>
<p>The DRV8255 is ... | <p>IMHO, it's probably better to get the printer as-is first. This way you can get familiar with the printer and 3D printing in general before you get overwhelmed with all the extra introduced variables from your upgrades.</p>
<p>The new model already has loads of features that were considered upgrades on the older mod... | <p>I have an Ender 3 v2 and I haven't upgraded anything except updating the firmware. The first thing I suggest is updating the firmware and changing the hotend to an all-metal one. This will allow you to print in higher temperatures and adding a BLTouch for automatic bed leveling will make your life a bit easier.</p>
| 1,737 |
<p>My dream IDE does full code hints, explains and completes PHP, Javascript, HTML and CSS. I know it exists!</p>
<p>so far, <a href="http://www.zend.com/en/products/studio/features" rel="noreferrer">Zend studio 6</a>, under the Eclipse IDE does a great job at hinting PHP, some Javascript and HTML, any way I can expan... | <p>I think the JavaScript and CSS need to be in separate files for this to work.</p>
<p>Example of CSS autocomplete in Eclipse:</p>
<p>Starting to type <code>border</code></p>
<blockquote>
<p><img src="https://i.stack.imgur.com/h4Sj9.png" alt="css example in eclipse"></p>
</blockquote>
<p>Then setting thickness</... | <p>The default CSS and HTML editors for Eclipse are really good. The default javascript editor does an OK job, but it needs a little work.</p>
<p>I just tested this in Eclipse 3.3.2</p>
<pre><code>function test(){
}
te<CTRL+SPACE>
</code></pre>
<p>and it completed the method for me as did this:</p>
<pre><co... | 2,681 |
<p>I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. However, after a call to device.setFullS... | <p>Try Creating a custom invisible cursor:</p>
<pre><code> Toolkit toolkit = Toolkit.getDefaultToolkit();
Point hotSpot = new Point(0,0);
BufferedImage cursorImage = new BufferedImage(1, 1, BufferedImage.TRANSLUCENT);
Cursor invisibleCursor = toolkit.createCustomCursor(cursorImage, hotSpot, "InvisibleC... | <p>I don't know if this knowledge applies but in a old VB6 app I had the same problem and I got rid of it moving the cursor out of the screen giving it some very large values.<br>
Hope it helps.</p>
| 23,267 |
<p>Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?</p>
| <p>Set the Format to Custom and then specify the format:</p>
<pre><code>dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss";
</code></pre>
<p>or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use ... | <p>If you need (24 hours) military time. You should use "HH" instead of "hh".</p>
<p>"MM/dd/yyyy HH:mm"</p>
| 11,900 |
<p>I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction. </p>
<p>I was wondering if anyone has experience wi... | <p>When reading your answer I didn't get the feeling you are looking for a game framework, but more: how can I easily model a ball with acceleration and friction.</p>
<p>For this you don't need a full fledged physics framework since it is relatively simple to do:</p>
<p>First create a timer which fires 30 times a sec... | <p>I would recommend checking out XNA Studio 3, it has built in support for PC, Xbox 360 and mobile devices, and it's an official & free spin-off of Visual Studio from Microsoft.</p>
<p><a href="http://creators.xna.com/en-US/" rel="nofollow noreferrer">http://creators.xna.com/en-US/</a></p>
<p><a href="http://blo... | 41,718 |
<p>What is the best way to track down a memory leak that is only found on one customer's test/release box, and no where else?</p>
| <p><a href="http://www.jetbrains.com/profiler/index.html" rel="nofollow noreferrer">dotTrace3.1</a></p>
<p>(This question is kinda funny, cause I am tracking a mem leak that isn't present on my machine ...)</p>
| <p>If the user has the problem it consistently, take a stackdump and analyse in the standard way</p>
| 18,183 |
<p>i met a problem with iphone simulator application directory, when i run the application everytime, the name of application directory was changed each of time,can anyone tell me how to keep a static application directory ?</p>
| <p>i'm going to take a guess here and say..</p>
<p>you don't need a static directory.</p>
<p>I think what you need is to get the 'base directory' programatically.</p>
<pre>
NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *path = [d... | <p>If you simply relaunch the app from within the simulator springboard it will keep using the same directory. If you rebuild the app in Xcode it will move, and there is no way to prevent that. Xcode should migrate any data you have from the old directory to the new directory when it installs the new build.</p>
| 34,156 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.