instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I need to prevent <a href="http://www.owasp.org/index.php/Session_Fixation" rel="noreferrer">Session Fixation</a>, a particular type of session hijacking, in a Java web application running in JBoss. However, it appears that the standard idiom <a href="http://www.owasp.org/index.php/Session_Fixation_in_Java" rel="nor...
<p><a href="https://jira.jboss.org/jira/browse/JBAS-4436" rel="nofollow noreferrer">This defect</a> (found <a href="http://forum.springframework.org/showthread.php?t=54688" rel="nofollow noreferrer">here</a>) points the way to the solution. The Tomcat instance that runs in JBoss is configured with emptySessionPath="tru...
<p>This problem and the specific case in which it occurs is a problem in Tomcat as well as JBoss. Tomcat shares the emptySessionPath="true" effect (and actually JBoss inherits it from Tomcat).</p> <p>This really seems like a bug in Tomcat and JBoss when you are trying to prevent session fixation attacks but the servle...
2,976
<p>Using MEF I want to do the following.</p> <p>I have a WPF Shell. To the shell I want to Import from another DLL a UserControl that is also a View of my MVP triad. The way the MVP triad works, is that in presenter I have a constructor that takes both IModel and IView and wires them up. So, in order for this to work,...
<p>Check my answer here.</p> <p><a href="http://codebetter.com/blogs/glenn.block/archive/2008/11/12/mvp-with-mef.aspx" rel="nofollow noreferrer">http://codebetter.com/blogs/glenn.block/archive/2008/11/12/mvp-with-mef.aspx</a> </p> <p>EDIT: (<em>Added from the link, to prevent not being flagged as low quality / LOA</e...
<p>The way you outlined in your blog post is the perfectly valid way for utilizing MEF. This is nested composition, and while designing it is always good to keep in mind that Container is the decider, so as a plug-in / extender vendor you will focus on your services that you are "exporting" and as an important, you sho...
33,416
<p>The default check-in action for a work-item is "resolve". I'd like to set it to "associate" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?</p>
<p>Yup, the check-in action can only be associated to a state transition (i.e. Active to Resolved). In my blog post that <a href="https://stackoverflow.com/questions/62294/how-to-modify-the-defaul-check-in-action-in-tfs#62376">Fredrick</a> linked to (<a href="http://www.woodwardweb.com/vsts/top_tfs_tip_3_r.html" rel="...
<p>Unlike previous versions, in VS2015 the registry key solution seems to work in the cases we need!</p> <p>I just went to</p> <pre><code>HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\TeamFoundation\SourceControl\Behavior </code></pre> <p>and changed <code>ResolveAsDefaultCheckinAction</code> from <code>Tru...
8,768
<p>Is there any way to know if I'm compiling under a specific Microsoft Visual Studio version?</p>
<p><code>_MSC_VER</code> and possibly <code>_MSC_FULL_VER</code> is what you need. You can also examine <a href="https://www.boost.org/doc/libs/master/boost/config/compiler/visualc.hpp" rel="noreferrer">visualc.hpp</a> in any recent boost install for some usage examples.</p> <p>Some values for the more recent versions...
<p>In visual studio, go to help | about and look at the version of Visual Studio that you're using to compile your app.</p>
9,544
<p>I need to echo a string containing angle brackets (&lt; and >) to a file on a Windows machine. Basically what I want to do is the following:<br> <code>echo some string &lt; with angle &gt; brackets &gt;&gt;myfile.txt</code></p> <p>This doesn't work since the command interpreter gets confused with the angle bracket...
<p>The Windows escape character is ^, for some reason.</p> <pre><code>echo some string ^&lt; with angle ^&gt; brackets &gt;&gt;myfile.txt </code></pre>
<p>You can also use double quotes to escape special characters...</p> <pre><code>echo some string "&lt;" with angle "&gt;" brackets &gt;&gt;myfile.txt </code></pre>
31,334
<p>Has anyone integrated an "Open in Google Docs" in their web app yet? Gmail has this for opening attachments. How about any other sightings of this in a <em>non-google</em> web app?</p>
<p>Google Docs does <a href="http://code.google.com/apis/documents/developers_guide_protocol.html" rel="nofollow noreferrer">have an API</a> which allows you to search, upload, delete and retrieve documents from the Google Docs list of a specific user. You could conceivably use this to upload a document from your serv...
<p>You have to give a look to the <a href="http://code.google.com/apis/documents/developers_guide_dotnet.html" rel="nofollow noreferrer">Google Documents List Data API</a></p>
11,555
<p><strong>EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it <em>could</em> be done.</strong></p> <p>That's not the way it works right now, that...
<p>I guess you're missing the point of C++, and C++ semantics. You missed the fact <b>C++ is correct in passing (almost) everything by value, because it's the way it's done in C. Always</b>. But not only in C, as I'll show you below...</p> <h2>Parameters Semantics on C</h2> <p>In C, everything is passed by value. &quot...
<p>there are something not clear. when you say:</p> <blockquote> <p>int b(b &amp;param);</p> </blockquote> <p>what did you intend for the second 'b'? did you forget to introduce a type? did you forget to write differently with respect to the first 'b'? don't you think it's clear to write something like:</p> <pre><...
17,615
<p>I new to Scrum and while I understand the team concept behind the Sprints, I imagine there still needs to be a guardian for the team who minimizes the interference from Product Owners who are not conversant in software development. What are your successes, and what horror stories have you lived through?</p> <p>Upd...
<p>"there has to be guidance as to what amount of time should be spent on data model, etc."</p> <p>Right. That's what prioritization is all about. You define the work, you prioritize. You work according to the priorities.</p> <p>What can get out of control?</p> <ol> <li><p>Redefining the work before anything gets...
<p>An agile team is Consist of Developer, Business analyst ,Tester ,DBA ,Scrum master and Product owner.<strong>All are working as one feature based team</strong>.</p> <p>Agile methodology is here to help business to accelerate the faster product development. The product owner can define the priority and change the ...
39,535
<p>How can I draw a 2D rubber band rectangle in DirectX? Preferable using C#.</p>
<p>The classic way to do rubberbanding is to:</p> <ul> <li>Draw the regular scene, i.e. the "background"</li> <li>Switch to "XOR mode", where your pen will XOR the pixels already in the framebuffer. It is important that the mode here is XOR, since XOR is losslessly "revertable", unlike for instance an add operation.</...
<p>You need two point variables (each one holding x and y coordinates). Let's call them FirstPoint and SecondPoint.</p> <p>On mousedown, store the current mouse position to FirstPoint and SecondPoint. As long as the mouse is down, whenever it moves, update SecondPoint with the new mouse position.</p> <p>Then each fra...
30,031
<p>I have an undefined number of display context and each will display a texture. When I call glGenTextures I get the same name returned across all display contexts. Will this work? Even though they have the same name will they still store and display different textures? If not what should do to get around this? </p>
<p>Getting the same name from glGenTexture and having the same texture displayed is not the same thing.</p> <p>Texture names are just integers at a context's discretion, usually starting with 1, and incrementing with every glGenTexture, but not necessarily so. An implementation is not required to work like that (altho...
<p>To my knowledge I have not enabled any texture sharing. however, the same texture is being displayed across all display contexts.</p>
28,748
<p>I'm looking to do various processing of email - eg. inspect the headers, and if they meet some criteria (look like spam), drop the connection, or inspect the recipient list and perform special filtering.</p> <p>Looks like Python's smtpd library provides a nice and simple interface for processing the received email....
<p>You may want to look at the <a href="http://twistedmatrix.com/trac/" rel="noreferrer">twisted</a> implementation as that will give you access to the full range of interaction with the client. I believe (though I have never used it in production) that twisted can be trusted in a production environment.</p>
<p>Another approach: use <a href="http://www.postfix.org" rel="nofollow noreferrer">Postfix</a> for receiving email and write a <a href="http://www.postfix.org/SMTPD_POLICY_README.html" rel="nofollow noreferrer">policy</a> script in Python.</p>
43,530
<p>I need to index up to 500,000 entries for fastest read. The index needs to be rebuilt periodically , on disk. I am trying to decide between a simple file like a hash on disk or a single table in an embedded database. I have no need for an RDBMS engine. </p>
<p>I'm assuming you're referring to indexing tables on a relational DBMS (like mySql, Oracle, or Postgres).</p> <p>Indexes are secondary data stores that keep a record of a subset of fields for a table in a specific order.</p> <p>If you create an index, any query that includes the subset of fields that are indexed in...
<p>This is what <a href="http://en.wikipedia.org/wiki/MapReduce" rel="nofollow noreferrer">MapReduce</a> was invented for. <a href="http://hadoop.apache.org/" rel="nofollow noreferrer">Hadoop</a> is a cool java implementation. </p>
9,370
<p>To elaborate .. a) A table (BIGTABLE) has a capacity to hold a million rows with a primary Key as the ID. (random and unique) b) What algorithm can be used to arrive at an ID that has not been used so far. This number will be used to insert another row into table BIGTABLE.</p> <p>Updated the question with more deta...
<p>The question is of course: why do you want a random ID?</p> <p>One case where I encountered a similar requirement, was for client IDs of a webapp: the client identifies himself with his client ID (stored in a cookie), so it has to be hard to brute force guess another client's ID (because that would allow hijacking ...
<p>If ID is purely random, there is no algorithm to find an unused ID in a similarly random fashion without brute forcing. However, as long as the bit-depth of your random unique id is reasonably large (say 64 bits), you're pretty safe from collisions with only a million rows. If it collides on insert, just try again...
12,021
<p>I know that services like my.yahoo.com allow you to add content from RSS feeds to your personal page, but in general they are links which draw the user to the site which provided the feed. What are the legalities and implications of using RSS feeds as a data source for a site which repackages the data so as to be u...
<p>In my opinion it depends on the data source company as to whether they allow it in their terms and conditions. It probably also depends on where your servers are located (i.e. Which legal framework they fall under.)</p> <p>Unless it is allowed explicitly or you have written consent I don't think it's ethical.</p> ...
<p>Talk to your lawyer.</p>
19,229
<p>This isn't working. Can this be done in find? Or do I need to xargs?</p> <pre><code>find -name 'file_*' -follow -type f -exec zcat {} \| agrep -dEOE 'grep' \; </code></pre>
<p>the solution is easy: execute via sh</p> <pre><code>... -exec sh -c "zcat {} | agrep -dEOE 'grep' " \; </code></pre>
<p>Here's what you should do:</p> <pre><code>find -name 'file_*' -follow -type f -exec sh -c 'zcat &quot;$1&quot; | agrep -dEOE &quot;grep&quot;' sh {} \; </code></pre> <p>I tried a couple of these answers and they didn't work for me. @flolo's answer doesn't work correctly if your filenames have special characters. <a ...
39,502
<p>I find it curious that the most obvious way to create <code>Date</code> objects in Java has been deprecated and appears to have been "substituted" with a not so obvious to use lenient calendar.</p> <p>How do you check that a date, given as a combination of day, month, and year, is a valid date?</p> <p>For instance...
<p>The current way is to use the calendar class. It has the <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#setLenient%28boolean%29" rel="noreferrer">setLenient</a> method that will validate the date and throw and exception if it is out of range as in your example. </p> <p>Forgot to add: If...
<p>Above methods of date parsing are nice , i just added new check in existing methods that double check the converted date with original date using formater, so it works for almost each case as i verified. e.g. 02/29/2013 is invalid date. Given function parse the date according to current acceptable date formats. It ...
28,064
<p>I'm trying to delete a directory that contains XML files from a remote computer. My code compiles and runs fine, but when I go to get a list of XML files in the path I specify, it is not returning anything. Am I missing something permission wise? </p> <p>I have ran it from my computer logged on as myself and from a...
<p>I think you should be using *.xml instead of simply .xml. But I also concur with Kyralessa, test on your local machine first, then add in the complexity of going across a network.</p>
<p>I assume you are passing in a network path? Does it fail when you run the program on a local path? Does this line: fi = di.GetFiles(ext); Return any fileInfo objects?</p> <p>You probably just have something small wrong that can be fixed by some debugging.</p>
28,628
<p>Where should one go to be kept updated on all of the security flaws/problems floating around? Specially in the era of open source where we tend to use libraries from everywhere.</p>
<p>Here's a quick list:</p> <ul> <li><a href="http://cve.mitre.org/" rel="nofollow noreferrer">CVE</a></li> <li><a href="http://www.securityfocus.com/vulnerabilities" rel="nofollow noreferrer">Security Focus</a></li> <li><a href="http://secunia.com/" rel="nofollow noreferrer">Secunia</a></li> <li><a href="http://www.c...
<p>Here's a quick list:</p> <ul> <li><a href="http://cve.mitre.org/" rel="nofollow noreferrer">CVE</a></li> <li><a href="http://www.securityfocus.com/vulnerabilities" rel="nofollow noreferrer">Security Focus</a></li> <li><a href="http://secunia.com/" rel="nofollow noreferrer">Secunia</a></li> <li><a href="http://www.c...
44,782
<p>I'm considering the best way to design a permissions system for an "admin" web application. The application is likely to have many users, each of whom could be assigned a certain role; some of these users could be permitted to perform specific tasks outside the role.</p> <p>I can think of two ways to design this: o...
<p>I think it's a general rule of thumb to stay away from mystical bitstrings that encode the meaning of the universe.</p> <p>While perhaps clunkier, having a table of possible permissions, a table of users, and a link table between them is the best and clearest way to organize this. It also makes your queries and mai...
<p>Permissions are usually key words with a 1, 0 or null (indicating inherit). With an bit system, you probably cannot create indexes on the user id and permission keyword; instead, you would have to scan every record to get the permission value.</p> <p>I would say go for the first option. It seems to me the better so...
24,290
<p>I've been aware ever since I got it that my Ender 3's X-axis isn't level. Measuring from the top of it to the top of the frame, the right-hand (positive) side is about 4.7mm higher than the left.</p> <p>During assembly, the vertical rails were not entirely parallel, and had to be pulled together to get the X axis o...
<p>i've just bought an Ender 3 Pro and on assembly I carefully checked and deburred the uprigh rails on their bottom faces to ensure they did not splay out or in etc.</p> <p>Once the 2 uprights are loosely attached to the base rails I laid the assembly flat onto a table on the uprights to ensure the uprights were squa...
<p>i've just bought an Ender 3 Pro and on assembly I carefully checked and deburred the uprigh rails on their bottom faces to ensure they did not splay out or in etc.</p> <p>Once the 2 uprights are loosely attached to the base rails I laid the assembly flat onto a table on the uprights to ensure the uprights were squa...
1,328
<p>I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways:</p> <ol> <li>I have tried bringing the projects I...
<p>In short, what you are doing is right, you want to move the common code into a class library (DLL) and then reference that in any projects that require its logic.</p> <p>Where you are going wrong is that you are not <em>maintaining</em> it. If you need to make little &quot;tweaks&quot;, <a href="http://en.wikipedia....
<p>I like to write all of my generic classes as just that: generics. I keep them as application independent as possible, and try to keep them even type unaware. If I make a fancy Tree class, I'll use generics to create it as Tree&lt;T&gt; so that I can use any type I want with the class. If I need to use the Tree to ho...
5,511
<p>I have a requirement to implement an "Unsaved Changes" prompt in an ASP .Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should appear warning them that they have unsaved changes, and give them the option to cancel and stay on the current page. The ...
<p>Using jQuery:</p> <pre><code>var _isDirty = false; $("input[type='text']").change(function(){ _isDirty = true; }); // replicate for other input types and selects </code></pre> <p>Combine with <code>onunload</code>/<code>onbeforeunload</code> methods as required.</p> <p>From the comments, the following reference...
<p><a href="https://web.archive.org/web/20210728061434/https://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo3.htm" rel="nofollow noreferrer">One method</a>, using arrays to hold the variables so changes can be tracked.</p> <p>Here's a very simple method to <a href="http://gadgetopia.com/post/2507" rel="nofollow nore...
18,840
<p>Does it mean that two threads can't change the underlying data simultaneously? Or does it mean that the given code segment will run with predictable results when multiple threads are executing that code segment?</p>
<p>Thread-safe code is code that will work even if many Threads are executing it simultaneously. </p> <p><a href="http://mindprod.com/jgloss/threadsafe.html" rel="noreferrer">http://mindprod.com/jgloss/threadsafe.html</a></p>
<p>In simplest words :P If it is safe to execute multiple threads on a block of code it is thread safe*</p> <p>*conditions apply</p> <p>Conditions are mentioned by other answeres like 1. The result should be same if you execute one thread or multiple threads over it etc.</p>
32,733
<p>I am looking into designing new features for Eclipse-based programming tools, from the requirements/ideas perspective. To really do this quickly, I would like to sketch UI elements without having to code things -- my concern is with the concepts and ideas right now, not the possible later realization. Are there any...
<p><a href="http://wireframesketcher.com" rel="nofollow noreferrer">WireframeSketcher</a> is a tool that helps quickly create wireframes, mockups and prototypes for desktop, web and mobile applications. It comes both as a <strong>standalone</strong> version and as a <strong>plug-in</strong> for Eclipse IDEs. It has som...
<p>I've tried the <a href="http://www.eclipse.org/vep/WebContent/main.php" rel="nofollow noreferrer">Visual Editor Project</a> before, but in the past it crashed my instance of Eclipse, and I haven't visited it since.</p> <p><a href="http://www.ibm.com/developerworks/edu/os-dw-os-eclipse-jigloo.html" rel="nofollow nor...
19,282
<p>I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this:</p> <pre><code>$draw = new Draw; $nav = $draw-&gt;wideHeaderBox(). $draw-&gt;left(). $draw-&gt;image(). Image::get($image,6...
<p>HTML time-savers are useful, but they're only useful when they're intuitive and easy-to-understand. Having to instantiate a <code>new Draw</code> just doesn't sound very natural. Furthermore, <code>wideHeaderBox</code> and <code>left</code> will only have significance to someone who intimately knows the system. And ...
<p>The argument he uses is the argument you need to <em>have</em> views. Both result in only changing it in one place. However, in his version, you are mixing view markup with business code.</p> <p>I would suggest using more of a templated design. Do all your business logic in the PHP, setup all variables that are nee...
5,851
<p>Does anyone know how to add a an MSBuild .proj file to my solution?</p> <p>I was just given existing code from a vendor with a solution that references an MSBuild .proj file as one of its projects. When I open the solution, the project shows as (unavailable). It appears that I need to install some sort of project...
<p>I actually got it to work! I re-started Visual Studio and still saw that the projects were unavailable after installing the MSBuild Template mentioned above. I had to manually reload the projects. That fixed the issue.</p>
<p>I actually got it to work! I re-started Visual Studio and still saw that the projects were unavailable after installing the MSBuild Template mentioned above. I had to manually reload the projects. That fixed the issue.</p>
39,843
<p>When I am developing a bunch of designers/tools, what are some of the best fit patterns that go with a VSX Package and/or VSX Isolated Shell Package?</p> <p>Any samples, links would be great.</p>
<p>I learned a lot from looking at the source code to <a href="http://gogrinder.sourceforge.net/" rel="nofollow noreferrer">GoGrinder</a>. It's well thought out, uses MVC correctly, and the comments are helpful (and no, I didn't write it). It's also a fun program to use if you want to learn how to play <a href="http:...
<p>What I've done to learn some new technologies over the years is to look to open source projects that both match the criteria you're looking for and also interest you.</p> <p>I'm not a Swing guy, but I'd suggest finding a project that uses Java Swing, does not appear too complicated, and then start digging through t...
24,042
<p>Running a rails site right now using SQLite3.</p> <p>About once every 500 requests or so, I get a</p> <p>ActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked:...</p> <p>What's the way to fix this that would be minimally invasive to my code?</p> <p>I'm using SQLLite at the moment because you...
<p>You mentioned that this is a Rails site. Rails allows you to set the SQLite retry timeout in your database.yml config file:</p> <pre><code>production: adapter: sqlite3 database: db/mysite_prod.sqlite3 timeout: 10000 </code></pre> <p>The timeout value is specified in miliseconds. Increasing it to 10 or 15 sec...
<p>I believe this happens when a transaction times out. You really should be using a "real" database. Something like Drizzle, or MySQL. Any reason why you prefer SQLite over the two prior options? </p>
10,419
<p>I'm a totally blind individual who would like to learn more of the theory aspect of computer science. I've had an intro data structures class and the general intro programming but would like to learn more on things such as software design, advanced data structures, and compiler design. I want to do this as a self st...
<p>You might find the <a href="http://www.cs.washington.edu/homes/ladner/hahnexperiences.html" rel="noreferrer">Experiences of a Blind Computer Scientist</a> a good read. </p> <p>MIT's <a href="http://ocw.mit.edu/OcwWeb/web/home/home/index.htm" rel="noreferrer">Open Courseware</a> would be a good resource for you wit...
<p>A language called Quorum is a lot like Python but optimized across a few more syntactic details, and the corresponding development environment is designed with the blind in mind. <a href="https://quorumlanguage.com/" rel="nofollow noreferrer">https://quorumlanguage.com/</a> This might fit especially well with the us...
48,480
<p>When viewing someone else's webpage containing an applet, how can I force Internet Explorer 6.0 to use a a particular JRE when I have several installed?</p>
<p>First, disable the currently installed version of Java. To do this, go to <strong>Control Panel > Java > Advanced > Default Java for Browsers</strong> and uncheck <strong>Microsoft Internet Explorer</strong>.</p> <p>Next, enable the version of Java you want to use instead. To do this, go to (for example) <strong>C:...
<p>If you mean when you are not the person writing the web page, then you could disable the add ons you do not wish to use with the <a href="http://windowsxp.mvps.org/addons.htm" rel="nofollow noreferrer">Manage Add-Ons</a> IE Options screen added in Win XP SP2</p>
9,673
<p>Let's say I have a parent DIV. Inside, there are three child DIVs: header, content and footer. Header is attached to the top of the parent and fills it horizontally. Footer is attached to the bottom of the parent and fills it horizontally too. Content is supposed to fill all the space between header and footer.</p> ...
<p>I'm going to get downmodded for this, but this sounds like a job for a table.</p> <p>What you're trying to do is to set the total height of three contiguous divs as a unit, and a 1x3 table with height 100% is actually a cleaner solution.</p>
<p>Absolute positioning is messing you up. Try something like this:</p> <p>HTML:</p> <pre><code>&lt;div id="wrapper"&gt; &lt;div id="header"&gt; header &lt;/div&gt; &lt;div id="content"&gt; content &lt;/div&gt; &lt;div id="footer"&gt; footer &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre class...
8,128
<p>In C#, <code>int</code> and <code>Int32</code> are the same thing, but I've read a number of times that <code>int</code> is preferred over <code>Int32</code> with no reason given. Is there a reason, and should I care?</p>
<p>The two are indeed synonymous; <code>int</code> will be a little more familiar looking, <code>Int32</code> makes the 32-bitness more explicit to those reading your code. I would be inclined to use <code>int</code> where I just need 'an integer', <code>Int32</code> where the size is important (cryptographic code, str...
<p>The bytes int can hold depends on what you compiled it for, so when you compile your program for 32 bit processors, it holds numbers from 2^32/2 to -2^32/2+1, while compiled for 64 bit it can hold from 2^64/2 to -2^64/2+1. int32 will always hold 2^32 values.</p> <p><strong>Edit</strong> : Ignore my answer, I didn't...
8,795
<p>Usually when I build a site, I put all the CSS into one file, and all the properties that relate to a set of elements are defined at once. Like this:</p> <pre><code>#myElement { color: #fff; background-color: #000; padding: 10px; border: 1px solid #ccc; font-size: 14pt; } .myClass { font-si...
<p>The browser will have to find all the definitions and then add them up and override the different properties based on the latest definition. So there will be a slight overhead.</p> <p>That being said it would be rather minimal and not very noticeable even on hardware 5 years old. The browsers are quite efficient at...
<p>As William said, you're not going to see any issue from the browsers parsing the CSS. What you might see, though, is an issue with the number of HTTP requests that a client can open to a single host. Typically this defaults to two. So, if you do put your CSS in multiple files, you might want to put them on a sepa...
24,868
<p>The turntable support part in my microwave has broken. It is a three armed part, with small wheels at the end of each arm. </p> <p><a href="https://i.stack.imgur.com/qza6i.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/qza6i.jpg" alt="support part"></a></p> <p>I'm confident I could print a replacement, ...
<p>I would say PLA itself should not be heated up by microwave. It's because microwave oven creates oscilations which excites water particles <a href="https://en.wikipedia.org/wiki/Microwave_oven" rel="nofollow">(see microwave explanation here)</a> <s>so assuming PLA doesn't contain water, it won't heat up.</s> <em>(re...
<p>Yes. You can. I would think ABS would be a better idea, as it melts at a higher temp. <a href="http://www.thingiverse.com/thing:385288" rel="nofollow">http://www.thingiverse.com/thing:385288</a></p>
368
<p>This is a common problem for all developers, I am looking for the best solution to make windows forms UI responsive. </p> <p>I have an animated GIF file to show progress of my calcuation on windows form. I took a picture box control and placed animated gif into that. now when my calcuation starts - the animaged gif...
<p>Multiple threads would be my recommendation. A bit messy first time you try ;)</p> <p>Simplest model: One thread for the GUI, and one thread for whatever work you need to do.</p> <p>Check <a href="http://msdn.microsoft.com/en-us/magazine/cc300429.aspx" rel="nofollow noreferrer">this link</a>.</p>
<p>Well, the only real way to do 2 things at once (like do calculations, and still keep responsive) is to use threads. If you won't want to explicitly use threads, then check to see if there are any asynchronous calls you can use to do it in the background. Aside from that, do a lot of Application.DoEvents calls wherev...
25,230
<p>I collect a few corner cases and <a href="http://www.yoda.arachsys.com/csharp/teasers.html" rel="nofollow noreferrer">brain teasers</a> and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on t...
<p>I think I showed you this one before, but I like the fun here - this took some debugging to track down! (the original code was obviously more complex and subtle...)</p> <pre><code> static void Foo&lt;T&gt;() where T : new() { T t = new T(); Console.WriteLine(t.ToString()); // works fine ...
<p>I think the answer to the question is because .net uses string interning something that might cause equal strings to point to the same object (since a strings are mutable this is not a problem)</p> <p>(I'm not talking about the overridden equality operator on the string class)</p>
23,632
<p>The manual page for <code>XML::Parser::Style::Objects</code> is horrible. A simple hello world style program would really be helpful.</p> <p>I really wanted to do something like this: (not real code of course)</p> <pre><code>use XML::Parser; my $p = XML::Parser-&gt;new(Style =&gt; 'Objects', Pkg =&gt; 'MyNode'); ...
<p>When ever I need to do something similar, usually I end up using <a href="http://search.cpan.org/~ebohlman/XML-Parser-EasyTree-0.01/EasyTree.pm" rel="nofollow noreferrer">XML::Parser::EasyTree </a> it has better documentation and is simpler to use.</p> <p>I highly recommend it.</p>
<p>When ever I need to do something similar, usually I end up using <a href="http://search.cpan.org/~ebohlman/XML-Parser-EasyTree-0.01/EasyTree.pm" rel="nofollow noreferrer">XML::Parser::EasyTree </a> it has better documentation and is simpler to use.</p> <p>I highly recommend it.</p>
5,528
<p>I have a series of PDFs named sequentially like so:</p> <ul> <li>01_foo.pdf</li> <li>02_bar.pdf</li> <li>03_baz.pdf</li> <li>etc.</li> </ul> <p>Using Ruby, is it possible to combine these into one big PDF while keeping them in sequence? I don't mind installing any necessary gems to do the job.</p> <p>If this isn'...
<p>A <a href="http://www.ruby-forum.com/topic/120008#new" rel="noreferrer">Ruby-Talk</a> post suggests using the <strong><a href="http://www.accesspdf.com/pdftk/" rel="noreferrer">pdftk</a></strong> toolkit to merge the PDFs. </p> <p>It should be relatively straightforward to call <em>pdftk</em> as an external proces...
<p>Any Ruby code to do this in a real application is probably going to be painfully slow. I would try and hunt down unix tools to do the job. This is one of the beauties of using Mac OS X, it has very fast PDF capabilities built-in. The next best thing is probably a unix tool.</p> <p>Actually, I've had some success...
11,101
<p><strong>[SOLVED]</strong> on [EDIT 3]</p> <p>I just finished changing my i3 Mega's PTFE tube and brass nozzle, reassembled it, always taking care not to damage the heating element and thermistor wires. Then I check the temperature and it was cooling down, despite the set temperature being higher (210 ºC). I turned i...
<p>I recently had similar problem with my Prusa i3 MK2.5. It was not able to maintain the set tempereature. I measured the heater catridge (which was new) and its resistance was correct (about 4 ohms). So I changed the hotend MOSFET on the stock board with no result. So I changed the heater catridge for the older one a...
<p>I recently had similar problem with my Prusa i3 MK2.5. It was not able to maintain the set tempereature. I measured the heater catridge (which was new) and its resistance was correct (about 4 ohms). So I changed the hotend MOSFET on the stock board with no result. So I changed the heater catridge for the older one a...
1,761
<p>I am setting up a development server in my flat. I have set up an Ubuntu DNS server on it and have added the zone weddinglist (just weddinglist - no <a href="http://en.wikipedia.org/wiki/Top-level_domain" rel="noreferrer">TLD</a>. It's just an internal domain.)</p> <p>This works fine on my Ubuntu laptop.</p> <p>On...
<p>It's possible that the Windows internal resolver is adding '.local' to the domain name because there's no dots in it. <code>nslookup</code> wouldn't do that.</p> <p>To verify this possiblity, install 'Wireshark' (previously aka Ethereal) on your client machine and observe any DNS request packets leaving it when yo...
<p>If you can ping the FQDN, look at how DNS devolution is set up the PC.</p> <p>Winsock API which MS ping will automatically use the FQDN of the client PC if append primary and connection specific DNS suffix is checked in TCP/IP advanced DNS settings. If the host is in another domain, the client must perform DNS dev...
42,802
<p>In Java you can define a new class inline using anonymous inner classes. This is useful when you need to rewrite only a single method of the class.</p> <p>Suppose that you want create a subclass of <code>OptionParser</code> that overrides only a single method (for example <code>exit()</code>). In Java you can write...
<p>You can use the <a href="http://docs.python.org/library/functions.html#type" rel="noreferrer"><code>type(name, bases, dict)</code></a> builtin function to create classes on the fly. For example:</p> <pre><code>op = type("MyOptionParser", (OptionParser,object), {"foo": lambda self: "foo" }) op().foo() </code></pre>...
<p>You can always hide class by variables:</p> <pre><code> class var(...): pass var = var() </code></pre> <p>instead of</p> <pre><code> var = new ...() {}; </code></pre>
46,682
<p>I have an MVC-based site, which is using a Repository/Service pattern for data access. The Services are written to be using in a majority of applications (console, winform, and web). Currently, the controllers communicate directly to the services. This has limited the ability to apply proper caching.</p> <p>I se...
<p>The easiest way would be to handle caching in your repository provider. That way you don't have to change out any code in the rest of your app; it will be oblivious to the fact that the data was served out of a cache rather than the repository.</p> <p>So, I'd create an interface that the controllers use to communi...
<p>Based on answer provided by <a href="https://stackoverflow.com/users/22381/brendan-enrick">Brendan</a>, I defined a generic cached repository for <strong>the special case of relatively small lists that are rarely changed, but heavily read</strong>.</p> <p><strong>1. The interface</strong></p> <pre><code>public int...
12,852
<p>I need to remove temp files on Tomcat startup, the pass to a folder which contains temp files is in applicationContext.xml.</p> <p>Is there a way to run a method/class only on Tomcat startup?</p>
<p>You could write a <code>ServletContextListener</code> which calls your method from the <code>contextInitialized()</code> method. You attach the listener to your webapp in web.xml, e.g.</p> <pre><code>&lt;listener&gt; &lt;listener-class&gt;my.Listener&lt;/listener-class&gt; &lt;/listener&gt; </code></pre> <p>and...
<p>I'm sure there must be a better way to do it as part of the container's lifecycle (edit: Hank has the answer - I was wondering why he was suggesting a <code>SessonListener</code> before I answered), but you could create a Servlet which has no other purpose than to perform one-time actions when the server is started:...
19,143
<p>I need a way to update the month value on a dateTime field in my db. I'm being past an int value for the month and need to use that for the update. Is it possible to do this in the sql statement or would I be best doing it in c# in the webservice?</p>
<p>Shift down and then up again:</p> <pre><code>UPDATE table SET datecol = DATEADD(m, @newmonth, DATEADD(m, -MONTH(datecol), datecol)) WHERE id = @id </code></pre> <p>or, more simply:</p> <pre><code>UPDATE table SET datecol = DATEADD(m, @newmonth - MONTH(datecol), datecol) WHERE id = @id </code></pre>
<p>You can do this all in TSQL in Sql Server. Check out the <a href="http://msdn.microsoft.com/en-us/library/ms186819.aspx" rel="nofollow noreferrer">DateDiff</a> and <a href="http://msdn.microsoft.com/en-us/library/ms186819.aspx" rel="nofollow noreferrer">DateAdd</a> functions.</p> <p>I expect this would work:</p> ...
19,657
<p>I'm working on a Google App Engine project. </p> <p>My app is working and looking correct locally, but when I try to upload images in an image directory, they're not being displayed at appspot.</p> <p>As a little troubleshoot, I put a HTML page in "/images/page2.html" and I can load that page at the appspot, but m...
<p>I'll bet your problem is that you're using Windows. </p> <p>If that's the case, I believe you need a preceding slash for your static_dir value. </p>
<p>@jamtoday The preceding slash didn't make a difference, but it did get me started figuring out what each app needs to be told what about my directory structure. </p> <p>So, I have nothing very conclusive to add, but I wanted to follow up, because I got it working, but I didn't explore all the issues after I got it ...
19,426
<p>Is it possible to nest html forms like this</p> <pre><code>&lt;form name="mainForm"&gt; &lt;form name="subForm"&gt; &lt;/form&gt; &lt;/form&gt; </code></pre> <p>so that both forms work? My friend is having problems with this, a part of the <code>subForm</code> works, while another part of it does not.</p>
<p>In a word, no. You can have several forms in a page but they should not be nested.</p> <p>From the <a href="https://www.w3.org/TR/html5/forms.html#the-form-element" rel="noreferrer">html5 working draft</a>:</p> <blockquote> <p><strong>4.10.3 The <code>form</code> element</strong></p> <p><strong>Content mode...
<p>[see the<a href="https://i.stack.imgur.com/emBW4.png" rel="nofollow noreferrer">code..</a> code format below ]<a href="https://i.stack.imgur.com/bltYG.png" rel="nofollow noreferrer">2</a>simple trick simply dont use other <strong></strong> inside another form tag, please use the same elements without using form tag....
49,739
<p>Per the Java documentation, the <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html#hashCode()" rel="noreferrer">hash code</a> for a <code>String</code> object is computed as:</p> <blockquote> <pre><code>s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] </code></pre> <p>using <code>int</code> arith...
<p>According to Joshua Bloch's <a href="https://rads.stackoverflow.com/amzn/click/com/0321356683" rel="noreferrer" rel="nofollow noreferrer">Effective Java</a> (a book that can't be recommended enough, and which I bought thanks to continual mentions on stackoverflow):</p> <blockquote> <p>The value 31 was chosen beca...
<p>A big expectation from hash functions is that their result's uniform randomness survives an operation such as <code>hash(x) % N</code> where N is an arbitrary number (and in many cases, a power of two), one reason being that such operations are used commonly in hash tables for determining slots. Using prime number m...
38,339
<p>I want to warn users of Internet Explorer 6 using my site, that IE6 has had serious compatibility issues with my site in the past. What is the best way to do this?</p> <p>Ideally, I want to have a message appear (not a new window, but a message box, if possible) that warns IE6 users of the issues and reccommends th...
<p>The best way to target IE is through the use of conditional comments. You can then add some specific HTML that will only display in Internet Explorer.</p> <pre><code>&lt;!--[if IE 6]&gt; &lt;h1&gt;Please upgrade your browser!&lt;/h1&gt; &lt;![endif]--&gt; </code></pre> <p>More on the subject:</p> <p><a href="http...
<p>My suggestion would be to fix your site ;) No seriously, I would use a small banner on top of the page, like the small unobtrusive dialogs in Firefox and IE. Not a messagebox or something that would actually interfere to much.</p>
45,309
<p>How do I add an instance method to a class using a metaclass (yes I do need to use a metaclass)? The following kind of works, but the func_name will still be "foo":</p> <pre><code>def bar(self): print "bar" class MetaFoo(type): def __new__(cls, name, bases, dict): dict["foobar"] = bar retur...
<p>Try dynamically extending the bases that way you can take advantage of the mro and the methods are actual methods:</p> <pre><code>class Parent(object): def bar(self): print "bar" class MetaFoo(type): def __new__(cls, name, bases, dict): return type(name, (Parent,) + bases, dict) class Foo(...
<p>I think what you want to do is this:</p> <pre><code>&gt;&gt;&gt; class Foo(): ... def __init__(self, x): ... self.x = x ... &gt;&gt;&gt; def bar(self): ... print 'bar:', self.x ... &gt;&gt;&gt; bar.func_name = 'foobar' &gt;&gt;&gt; Foo.foobar = bar &gt;&gt;&gt; f = Foo(12) &gt;&gt;&gt; f.foobar() bar: 12 ...
9,111
<p>Is there any difference between website and web application project? What if you are working on a project that is sort of hybrid of site and application? which project should you chose?</p>
<p>As for which project to choose, I would go with the Web Application Project, regardless of size. Having all of your code behind compile down into a single DLL is a major benefit for maintenance and security on the hosting end. I know there are precompile options for web site projects, but they seemed like more troub...
<p>I'm used to create websites when I want to create a new webapplication.</p> <p>My current project had some problems on compiling, so I switched to a webapplication project. The step isn't very hard. Visual Studio helps you to change all necessary lines.</p>
44,808
<p>Has anyone experienced issues with Java's default garbage collector while running apps on VmWare instances?</p> <p>I am experiencing issues where full garbage collections are not running as often as I would expect and am curious if the VmWare variable has anything to do with it.</p>
<p>In general, the garbage collector will only run a full GC when it really needs to. The reason is that it takes a lot of time. It will try to do more smaller GCs that take a lot less time. Fo the most part, this seems to be a good strategy.</p> <p>There are some extra GC flags you can add to the VM if you want to...
<p>Haven't seen this myself, but depending on which version of VMware you're running, and your type of processor, the virtual machine clock may run significantly faster (or slower) than real-time, which can of course impact the interval garbage collection runs at.</p> <p>For a high-level overview of timekeeping issues...
14,143
<p>I imported a series of blogger posts (via xml) into WordPress, and the YouTube embed tags were removed. YouTube URLs in posts are not identified. Instead, just the text of the url is left. Possibly as opposed to full embed tags. I'm trying to restore the embed codes so it's seen.</p> <p>Another fact that is notable ...
<blockquote> <blockquote> <p>…by default, WordPress filters imported XML by removing possible troublesome tags…unfortunateely, including things like <code>&lt;embed&gt;</code> and <code>&lt;iframe&gt;</code> and other instances where you’ve included content in your posts. WordPress does so via a file you can find...
<p>When I moved from blogger to wordpress my YouTube videos moved over just fine. Martin is right, a view of the post source code is probably required to be helpful.</p> <p>One thing to note on a side issue though. When you use the wordpress "blogger importer" the image links will not be updated. When you view your bl...
13,676
<p>My current project is to write a web application that is an equivalent of an existing desktop application. </p> <p>In the desktop app at certain points in the workflow the user might click on a button and then be shown a form to fill in. Even if it takes a little time for the app to display the form, expert users...
<p>Keystrokes won't have an effect until the page has loaded, javascript has been processed and the text field is then focused.</p> <p>Basically what you are really asking is; <strong>how do I speed up a web application to increase response times?</strong> Your anwser is AJAX! </p> <p>Carefully think about the most c...
<p>AJAX or plugin are your only chances.</p>
8,693
<p>I'm looking for the BEST asp.net calendar/schedule component that it out there. I like the look of google calendar, and it absolutely needs to be a native .net component, which can be customized.</p> <p>I don't mind if it is part of a bigger framework (like telerik, for example). Links to samples would be great.</p...
<p>If you are really looking for the best one you need to see mine ;-)</p> <p>DayPilot Lite (open-source):</p> <p><a href="http://www.daypilot.org/demo/Lite/" rel="noreferrer">http://www.daypilot.org/demo/Lite/</a></p> <p>DayPilot Pro (commercial):</p> <p><a href="http://www.daypilot.org/demo/Calendar/GoogleLike.as...
<p>Check out ComponentOne's WebSchedule and WebCalendar Live demo: <a href="http://helpcentral.componentone.com/c1webexamples/" rel="nofollow noreferrer">http://helpcentral.componentone.com/c1webexamples/</a></p>
42,001
<p>I have a list control in Flex that has been data bound to an e4x xml object from an HTTPService. </p> <p>I would now like to have a button that clears the list, how can I do this?</p> <p>I have tried:</p> <pre> <code> list.dataProvider = null; </code> </pre> <p>which does not seem to work, I have also tried:</p>...
<p>If your software is open source you can use <a href="http://launchpad.net" rel="nofollow noreferrer">Launchpad</a> for translating.</p>
<p>I don't have any experience crowd-sourcing translations, but my advice would be to find some dependable freelance translators in your target languages (check out Proz.com), and keep going back to them every time you have new content. Application UIs are notoriously difficult to localize because of lack of context in...
41,101
<p>Can anyone recommend a decent SFTP library for use with Windows C++ apps? If a cross-platform one is available then all the better, but it's not essential. It's for use with a commercial application, so paying for something isn't an issue.</p> <p>I am using the superb <a href="http://www.codeproject.com/KB/MFC/Ul...
<p>Check out <a href="http://curl.haxx.se/libcurl/" rel="noreferrer">libcurl</a>.</p> <blockquote> <p>libcurl is a free and easy-to-use client-side URL transfer library, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP up...
<p><a href="http://www.openssh.com/" rel="noreferrer">OpenSSH</a> would be a good option. It's cross-platform and comes with a BSD license, so you can use it in your commercial application without having to disclose your source code.</p>
47,015
<p>I am trying to get a DataGrid under CE 5.0 / .NET CF 2.0 that a user can edit. The document at <a href="http://msdn.microsoft.com/en-us/library/ms838165.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms838165.aspx</a> indicates that some environments do not support editing - </p> <blockquo...
<p>No, it is not directly editable. MSDN has samples for using the DataGrid, including suggestions for data editing, for both <a href="http://msdn.microsoft.com/en-us/library/ms229684.aspx" rel="nofollow noreferrer">Pocket PC</a> and <a href="http://msdn.microsoft.com/en-us/library/ms229659.aspx" rel="nofollow norefer...
<p>Aye, in my opinion its a joke. God knows why they've left it like this since 1.0. On my first ever CF project I assumed it was available and spent an age implementing a read-write one cause i'd put it in the agreed spec.... :(</p> <p>I learnt a very important lesson that day : Don't expect anything from the FF to b...
11,225
<p>!!! This is not a duplicate question since the solutions offered in the other topics didn't work for me.</p> <p>When I try to commit:</p> <p>Error: Working copy 'D:\Webs\Drupal 6' locked<br> Error: Please execute the "Cleanup" command.</p> <p>When I try to do a cleanup:</p> <p>Cleanup failed to process the follo...
<p>Does it work if you do </p> <ul> <li>a new "clean" checkout </li> <li>merge the files that you have modified into the new checkout folder(s) using a merge / diff tool</li> <li>commit</li> </ul> <p>?</p> <p>EDIT: Updated point 2 according to derobert comment.</p>
<p>I just went through and deleted all the relevant .svn folders, and then ran a cleanup. works perfectly!</p>
44,840
<p>I'm still fairly new to 3D printing; got my Ender 3 V2 for Christmas last year. Recently the tension arm in the stock extruder snapped, so I bought and installed an all-aluminum replacement. My first successful(ish) print since installing it lasted two to three hours before I noticed the filament wasn't feeding. It ...
<p>You could still get heat creep with a Bowden tube. It has different characteristics. Instead of jamming up in the direct drive, the filament can melt too far upwards into the heat break where it can refreeze and jam. The characteristic, if you can pull out the filament, is widened filament extending into the heat...
<p><em>Answer created from octopus8's comments. If octopus8 wants to post their own answer, this wiki answer can be deleted.</em></p> <hr /> <p>185 °C is quite ok for several PLAs I have when printing slow.</p> <p>Honestly, I couldn't believe that the heat can go up the heatsink and Bowden tube to make extruder frame h...
1,887
<p>I'm creating a <a href="http://msdn.microsoft.com/en-us/library/bb760250&#40;VS.85&#41;.aspx" rel="noreferrer">ToolTip</a> window and adding tools to it using the flags TTF_IDISHWND | TTF_SUBCLASS. (c++, win32)</p> <p>I have a manifest file such that my program uses the new WindowsXP themes (comctrl32 version 6).</...
<p>You're not the only one who has hit compatablity issues with tooltips between these DLLS. </p> <p>I too have had <strong>nothing but trouble</strong> with the new tooltips in the themable common controls. We have already been monkeying with mouse messages and active/deactivating the tips before adding the manifest ...
<p>I don't know, but this sounds like a really "hard" problem (in the sense that all real-world) problems are really hard. I bet the underlying problem is something to do with the setting of the focus. Windows that manually do that are evil and generally suffer from all manner of bugs.</p>
7,408
<p>can you recommend some good ASP.NET tutorials or a good book? Should I jump right to ASP.NET MVC/html/javascript or learn web forms first? </p> <p>Thanks</p>
<p>A great book if you're just beginning is Matthew MacDonald's <a href="https://rads.stackoverflow.com/amzn/click/com/1590598911" rel="nofollow noreferrer" rel="nofollow noreferrer">Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional</a>. Once you're done with that a great reference (also by MacDonald) is <a...
<p>MVC www.asp.net/mvc great videos Asp.net www.asp.net </p>
4,264
<p>In the linux file system, where should user scripts be placed?</p> <p>I'm thinking specifically python scripts to be called by cron.</p>
<p>the information i got:</p> <pre><code>/usr/local/sbin custom script meant for root /usr/local/bin custom script meant for all users including non-root </code></pre> <p>chatlog snips from irc.debian.org #debian:</p> <pre><code>(02:48:49) c33s: question: where is the _correct_ location, to put custom scri...
<p>You can also add paths to your crontab file as shown in a <a href="https://stackoverflow.com/questions/13204/why-doesnt-my-cron-job-work-properly#13220">previous cron-related question</a>.</p>
3,595
<p>I'm getting lost in pointer land, I believe. I've got this (code syntax might be a little off, I am not looking at the machine with this code on it...but all the pertinent details are correct):</p> <pre><code>NSMutableArray *tmp = [[NSMutableArray alloc] init]; </code></pre> <p>I them pass that to a routine in an...
<p>You don't need to call retain in this case. [[NSMutableArray alloc] init] creates the object with a retain count of 1, so it won't get released until you specifically release it.</p> <p>It would be good to see more of the code. I don't think the error is in the very small amount you've posted so far..</p>
<p>NSMutableArray retains objects added to it, but have you retained the array itself?</p>
15,775
<p>I have an Ender 3 V1 with a glass Creality plate. I was having difficulty using manual levelling and my prints were struggling, so I ordered a 3DTouch. I have installed the 3DTouch and used Creality's BLTouch firmware. But my bed is still not level.</p> <p>So my build is an Ender 3 V1 with:</p> <ul> <li>Extruder upg...
<p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can ...
<p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p> <ul> <li>2-Phase stepping motor peak current of 2A</li> <li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li> <li>Internal 256 micro steps</li> <li>Quiet mode</li> <li>Fast mode</li> <li>HS Rdson 0.29 Ω...
2,074
<p>As the title says really. I've had a look at inheriting from TextBox, but the only sensible override was "OnKeyDown", but that just gives me a key from the Key enum (with no way to use Char.IsNumeric()).</p>
<p>Take a look at NumericUpDown in the Toolkit <a href="http://codeplex.com/Silverlight" rel="noreferrer">http://codeplex.com/Silverlight</a> and maybe you can use that or look at the source to implement your own numeric textbox.</p>
<p>Why is everyone not doing the hard work of just handling them all?</p> <p>Here (this is perfection):</p> <pre><code>&lt;TextBox KeyDown="TextBox_KeyDown" /&gt; private void TextBox_KeyDown(object sender, KeyEventArgs e) { var _Letter = string.Empty; switch (e.Key) { case Key.A: _Letter = "A"; ...
33,654
<p>I'd like to write a Silverlight app that has 2 or more browser windows that "interact". </p> <p>An example would be a parent/details display where selecting an item in the "Parent" list (in one browser window) will display the details of the item in another window. </p> <p>The main point is so that on a multiple...
<p>You should be able to accomplish this by using the javascript bridge support in Silverlight. With this method you could use javascript to spawn a new window with the url of the child window. At that point you could continue to use javascript to communicate between the two windows. Something like this: <a href="ht...
<p>In ScottGu's <a href="http://weblogs.asp.net/scottgu/archive/2010/12/02/announcing-silverlight-5.aspx" rel="nofollow" title="Announcing Silverlight 5">Announcing Silverlight 5</a> blog entry he says that OOB apps will have support for child windows. </p> <p>Thought I'd share and also bump this question as it's been...
33,498
<p>(This is related to <a href="https://stackoverflow.com/questions/85373/floor-a-date-in-sql-server">Floor a date in SQL server</a>.)</p> <p>Does a deterministic expression exist to floor a DATETIME? When I use this as a computed column formula:</p> <pre><code>DATEADD(dd, DATEDIFF(dd, 0, [datetime_column]), 0) </cod...
<p>My guess is that this is a bug of some sorts. In SQL 2005 I was able to create such an indexed view without a problem (code is below). When I tried to run it on SQL 2000 though I got the same error as you are getting.</p> <p>The following seems to work on SQL 2000, but I get a warning that the index will be ignored...
<p>Look at <a href="https://stackoverflow.com/questions/309492/user-defined-functions-sql-server-2005-flagged-incorrectly-as-non-deterministic">that question asked and answered by Cade Roux</a>. Perhaps the solution would be to create a function using WITH SCHEMABINDING and then use it in the computed column</p> <p><s...
39,876
<p>The MySQL database used by my Rails application currently has the default collation of <code>latin1_swedish_ci</code>. Since the default charset of Rails applications (including mine) is UTF-8, it seems sensible to me to use the <code>utf8_general_ci</code> collation in the database.</p> <p>Is my thinking correct?...
<p>UTF-8, as well as any other Unicode encoding scheme, can store characters in any language, so it is an excellent choice of codepage for your database.</p> <p>The collation setting, on the other hand, is a completely separate issue from the encoding scheme. It involves sort orders, upper/lowercase conversions, strin...
<p>Use below mysql query to convert your column :</p> <pre><code>ALTER TABLE users MODIFY description VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci; </code></pre> <p>To see full details about your table :</p> <pre><code>SHOW FULL COLUMNS FROM users; </code></pre>
23,997
<p>What is the simplest way to read a full line in a C console program The text entered might have a variable length and we can't make any assumption about its content.</p>
<p>You need dynamic memory management, and use the <code>fgets</code> function to read your line. However, there seems to be no way to see how many characters it read. So you use fgetc:</p> <pre><code>char * getline(void) { char * line = malloc(100), * linep = line; size_t lenmax = 100, len = lenmax; int c...
<p>On BSD systems and Android you can also use <code>fgetln</code>:</p> <pre><code>#include &lt;stdio.h&gt; char * fgetln(FILE *stream, size_t *len); </code></pre> <p>Like so:</p> <pre><code>size_t line_len; const char *line = fgetln(stdin, &amp;line_len); </code></pre> <p>The <code>line</code> is not null termina...
40,561
<p>I have heard that LINQ2SQL has been written to support multiple database vendor providers however for internal political reasons at MS, only SQL Server has been supported.</p> <p>Is this a fair summary of the situation, and if so has a timetable been released as to when other databases will be supported?</p> <p>I ...
<p>Check the <a href="http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx" rel="nofollow noreferrer">ADO.NET Entity Framework</a> (and <a href="http://msdn.microsoft.com/en-us/library/bb386964.aspx" rel="nofollow noreferrer">Linq to Entities</a>), you can look here also a <a href="http://code.msdn.microsoft.co...
<p>Entity Framework has support for multiple database providers. There are no plans to expose or implement additional LINQ to SQL database providers.</p>
30,949
<p><strong>Thermal conductivity</strong> is how well a plastic conducts heat. Most plastics don't conduct heat very well at all, which is what allows them to be 3D printed. That being said, there are a lot of potential use cases for highly thermally conductive filament, assuming you could print them. A commonly discuss...
<p>All values are in W/(m*K).</p> <ul> <li>PLA: 0.13</li> <li>HIPS: 0.20</li> <li>ABS: 0.25</li> <li>PETG: 0.29</li> <li>PEEK: 0.25</li> <li>PLA with copper: 0.25 (<a href="https://www.3dhubs.com/talk/t/thermal-conductivity-of-copper-based-filament-and-ceramic-resin/8798/7" rel="nofollow noreferrer">see discussion</a>...
<p>Trimet3d has a Nano diamond PLA with a claimed thermal conductivity 3-5 times that of PLA. The diamonds are sub-microscopic and smooth. See <a href="https://www.tiamet3d.com/product-page/ultra-diamond-pla-1kg" rel="nofollow noreferrer">https://www.tiamet3d.com/product-page/ultra-diamond-pla-1kg</a> Primarily they se...
1,471
<p>I have looked at the SQL Server 2008 feature comparison matrix and it lists the express/web and workgroup editions as having the SSIS runtime. Does this mean it is possible to develop SSIS packages using the developer edition, and then deploy and run them on a server running one of the lowly SQL Server editions such...
<p>The workgroup edition only has primitive import and export capabilities. As far as I can confirm, if you want to create SSIS packages using any data transformations you need to get SQL standard edition or higher.</p>
<p>You need dtexec to run SSIS packages from command line. </p> <p>In SQL2005 Express you got dtexec and necessary tools with </p> <ul> <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=4C6BA9FD-319A-4887-BC75-3B02B5E48A40&amp;displaylang=en" rel="noreferrer">SQL Server 2005 Express Edition with A...
37,331
<p>I use SourceGear Vault and applyLabel="true" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are</p> <p>I have a nightly builds so what if i don't have any changes made to that project for that day then how do I define my settings....</p> <pre><...
<p>In your project definition there should be a <code>&lt;triggers&gt;</code> section. For our nightly builds we use the following:</p> <pre><code> &lt;triggers&gt; &lt;scheduleTrigger time="00:30" buildCondition="IfModificationExists"/&gt; &lt;/triggers&gt; </code></pre> <p>This tells CCNet to build at 00...
<p>So scott you mean you have different definitions for nightly and normal builds or different triggers? </p>
36,026
<p>Apology for a lengthy post, but I needed to post some code to illustrate the problem.</p> <p>Inspired by the question *<a href="https://stackoverflow.com/questions/321299">What is the reason not to use select <em>?</a></em>, I decided to point out some observations of the select * behaviour that I noticed some time...
<p><a href="http://msdn.microsoft.com/en-us/library/ms187821(SQL.90).aspx" rel="noreferrer">sp_refreshview</a> to fix the view, or use WITH SCHEMABINDING in the view definition</p> <blockquote> <p>If a view is not created with the SCHEMABINDING clause, sp_refreshview should be run when changes are made to the ...
<p>This is pretty standard behavior for views under <strong>any</strong> RDBMS, not just MSSQL, and the reason why the usage of views comprising "select * from" must be treated with caution. </p> <p>The SQL Engine will compile each view - which is basically the lexicographical/parsing steps and store the result of th...
41,610
<p>I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something?</p>
<p>Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire.</p> <p>Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)</p>
<p>Check this out: <a href="http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs" rel="nofollow noreferrer">http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs</a></p> <p>Also, you can find a utility to reset your ubiquity...
5,685
<p>I have a <code>QTreeView</code> class with a context menu installed as follows:</p> <pre><code>m_ui.tree-&gt;setContextMenuPolicy(Qt::CustomContextMenu); connect(m_ui.tree, SIGNAL(customContextMenuRequested(const QPoint&amp;)), this, SLOT(ShowTreeContextMenu(const QPoint&amp;))); ... void ShowTreeContextMen...
<p>A possible solution which I haven't verified would be to capture the click event of the right click, manually make the selection in the tree view and then invoking the parent click event which will in turn activate the context menu.</p>
<p>Subclass the QTreeView and add the protected method void contextMenuEvent(QContextMenuEvent *event); In this method you execute a QMenu:</p> <pre><code>class TreeView : public QTreeView{ Q_OBJECT public: TreeView(QWidget *parent); ~TreeView(); protected: void contextMenuEvent(QContextMenuEvent *event); }; ...
20,881
<p>The existing application is in C#. During startup the application calls a virtual method to make changes to the database (for example a new revision may need to calculate a new field or something). An open OleDb connection is passed into the method. </p> <p>I need to change a field width. The ALTER TABLE statement ...
<p>Not sure if I understand your question completely.<br> But you could query the table for 0 rows (SELECT 1 FROM myTable WHERE 1= 0)</p> <p>And you could use recordet's field collection, refer to that field by name or index and use field's property like size, type etc.<br></p> <p>Does that help?</p>
<p>Not sure if I understand your question completely.<br> But you could query the table for 0 rows (SELECT 1 FROM myTable WHERE 1= 0)</p> <p>And you could use recordet's field collection, refer to that field by name or index and use field's property like size, type etc.<br></p> <p>Does that help?</p>
23,618
<p>I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working.</p>
<p>Why not just add a CSS class to each TextBox and use a jQuery selector to find them?</p> <pre><code>&lt;asp:GridView runat="server"&gt; &lt;Columns&gt; &lt;asp:BoundField ControlStyle-CssClass="someclass" DataField="xxx" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>Then you should be able ...
<p>If you have many textboxes (which it sounds like you do) better to delegate the event to some parent container rather than attach lots of events (event delegation) Start reading <a href="http://www.danwebb.net/2008/2/8/event-delegation-made-easy-in-jquery" rel="nofollow noreferrer">here</a></p>
44,272
<p>I'm still trying to get my head around using Java's generics. I have no problems at all with using typed collections, but much of the rest of it just seems to escape me.</p> <p>Right now I'm trying to use the JUnit "PrivateAccessor", which requires a Class[] argument with a list of all the argument types for the p...
<p>The first problem you have is that you should be using</p> <pre><code>Class&lt;?&gt;[] args = new Class[] </code></pre> <p>instead of</p> <pre><code>Class&lt;? extends Object&gt;[] args = new Class&lt;? extends Object&gt;[] </code></pre> <p><a href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/Parameter...
<p>This is the correct syntax:</p> <pre><code>Class&lt;?&gt;[] paramTypes = new Class[]{ Collection.class, ArrayList.class }; </code></pre>
37,996
<p>We're running a custom application on our intranet and we have found a problem after upgrading it recently where IIS hangs with 100% CPU usage, requiring a reset.</p> <p>Rather than subject users to the hangs, we've rolled back to the previous release while we determine a solution. The first step is to reproduce t...
<p>You can find some information about troubleshooting this kind of problem at <a href="http://blogs.msdn.com/tess/archive/2008/05/21/debugdiag-1-1-or-windbg-which-one-should-i-use-and-how-do-i-gather-memory-dumps.aspx" rel="nofollow noreferrer">this blog entry</a>. Her blog is generally a good debugging resource.</p>
<p>Is your test env the same really as live? i.e 2 separate vm instances on 2 physical servers - with the network connection and account types?</p> <p>Is there any other instances on the Database?</p> <p>Is there any other web applications in IIS?</p> <p>Is the .Net Config right?</p> <p>Is the App Pool Config righ...
3,091
<p>I want to upload some of my works to <a href="http://www.thingiverse.com/">Thingiverse</a> without making my real name public (displaying it on the profile page).</p> <p>I think it is OK to register my name to the site unless the make it public, and it is required by the terms to provide truthful and accurate infor...
<p>To change your displayed name (as opposed to username) in Thingiverse:</p> <ol> <li>Go to your profile page</li> <li>Click "Edit Profile" on the info column on the left</li> <li>At the top, next to "Thingiverse Settings" is another link/tab called "Makerbot Settings". Click that.</li> <li>Change the First Name and ...
<p>You can put whatever name you want in when you make an account - You decide what your name is, people go by pseudonyms in 'real life' all the time, this is perfectly acceptable. There are actually very few places where you have a legal obligation to provide your name as it appears on your birth certificate. Opening ...
193
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow noreferrer">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow noreferrer">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow noreferrer">GW-BASIC</a>, and <a href="h...
<p>[This may come off sounding more negative than it really is. I'm not saying Basic is the root of all evil, <a href="http://en.wikiquote.org/wiki/Edsger_Dijkstra" rel="noreferrer">others have said that</a>. I'm saying it's a legacy we can afford to leave behind.]</p> <p><strong>"because it was so easy to understan...
<p>I used to program in BASIC in the QBasic days. QBASIC had subroutines, functions, structures (they used to be called types), and I guess that's it. Now, this seems limited compared to all the features that Python has - OO, lambdas, metaclasses, generators, list comprehensions, just to name a few off the top of my he...
30,262
<p>If I read or write to a file and receive a 33 or 32 error, I would like to log a message containing the name of the other process(es) that have the file opened. There must be a Win32 API I could use to get this info. Process Explorer displays it. Of course, Process Explorer also has info about all processes in memor...
<p>As of Windows Vista, the Restart Manager can be used to determine which process(es) have a file open.</p> <p>This page has sample code: <a href="https://devblogs.microsoft.com/oldnewthing/20120217-00/?p=8283" rel="nofollow noreferrer">https://devblogs.microsoft.com/oldnewthing/20120217-00/?p=8283</a></p> <p>From tha...
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx" rel="nofollow noreferrer">The Handle program from SysInternals does this as well</a>, but I'm not sure how. I don't think there is a single documented API to do this. I think you have to iterate over the processes, enumerate each of the handle...
22,241
<p>We are using the standard method for our controls to report broken BO rules. This is done via the interface IDataError in our BO’s and in XAML the control is bound to the BO’s property etc. This approach works OK. But we need to show 2 types of visuals in the UI depending on the type (or category if you like) of the...
<p>Would it be possible to derive an interface IDataError that adds an extra property which is an enumeration of the error type. Then you could try and bind against it.</p>
<p>If you're okay with an (untested)approach that suffers a little bit of clarity, then you could do the following: throw an exception instead of returning an string with the IDataErrorInfo Interface. In your ErrorTemplate, you can access the ValidationErrors (and the ValidationError.Exception Property).</p> <p>Then, ...
16,500
<p>I don't even know if I'm using the correct terms but here goes:</p> <p>Is there a way to map the tables and their relations in a SQL Server to domain (C# code) automatically, by means of a tool or something?</p> <p>I've used the nhibernate plugin, but it creates a file in .cs and another in xml, that has the mappi...
<p>You could always use the <a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx" rel="nofollow noreferrer">Entity Framework</a> or maybe <a href="http://msdn.microsoft.com/en-us/library/bb386976.aspx" rel="nofollow noreferrer">Linq2SQL</a>, but I'm not familiar with how that works.</p> <p>Tho, out of EF and...
<p>Use LLBLgen of Linq 2 Sql (available in VS 2008). Or use Entity Framework (in VS 2008 SP1). Linq 2 sql allows you to drag and drop a table from sql server to the canvas and it creates a domain class for you with properties mapped to columns.</p>
46,843
<p>I would like to be able to add a hook to my setup.py that will be run post-install (either when easy_install'ing or when doing python setup.py install).</p> <p>In my project, <a href="http://code.google.com/p/pysmell" rel="noreferrer">PySmell</a>, I have some support files for Vim and Emacs. When a user installs Py...
<p>It depends on how the user installs your package. If the user actually runs "setup.py install", it's fairly easy: Just add another subcommand to the install command (say, install_vim), whose run() method will copy the files you want in the places where you want them. You can add your subcommand to install.sub_comman...
<p>As a work-around, you could set the zip_ok option to false so that your project is installed as an unzipped directory, then it will be a little easier for your users to find the editor config file.</p> <p>In distutils2, it will be possible to install things to more directories, including custom directories, and to ...
31,103
<p>I want to set the background of an <code>NSBox</code> to be a gradient. In Interface Builder it is possible to set the background color of an <code>NSBox</code> to <code>selectedMenuColor</code> which is a gradient. </p> <p><code>NSBox</code> only has a <code>setFillColor</code> method so how is Interface Builder f...
<p><code>selectedMenuColor</code> is a "magic" color that is not displayed as a solid color. Many of these "magic" colors exist in the system.</p> <p>I have used <code>colorWithPatternImage:</code> for this before. But note that the image you use as the pattern will get tiled, so you will probably have to resize the...
<p>Probably the closest you could come would be to use an NSColor created with <code>colorWithPatternImage:</code>, then create the gradient you want as an image and load that in. Ugly, but should work. I think subclassing is your best bet.</p>
35,668
<p>Folks,</p> <p>TIBCO has announced support for WCF channels back in April - has anything of that materialized by now??</p> <p>Where and how can I download either these new WCF channel bits, or where can I get my hands on a current .NET 2.0/3.5 version of the "TIBCO.EMS .NET client library" ?? </p> <p>We're a small...
<p>Your communication stack will be a lot simpler if you simply use Tibco EMS .NET client directly. It's styled after JMS, which is widely used in enterprise software development. Hence there are a lot of tech books on how to do JMS programming. Java and C# are so similar that it's easy to do the mental translation to ...
<p>For tibco and wcf you need to be running at least version 4.4.3 as the minimum that tibco supports. Otherwise you will have to use there standard protocol. They do have .net so you should not have to do interop. I have not used the WCF component as of yet as the place where I work is still on 4.3.0 and while they...
40,290
<p>I've seen some posts where jQuery has been favored vs ExtJS. I haven't looked at jQuery in detail, but from what I read so far, jQuery doesn't provide the kind of UI which comes with ExtJS. Am I correct? Why would some of you prefer jQuery in ASP.NET?</p> <p>Thanks</p>
<p>There are two schools of javascript frameworks, ones that focus on widgets (Yui, ext, etc) , and ones that focus on behavior (jquery, prototype, moo, etc)</p> <p>JQuery just makes life easier to build dynamic, sexy sites. If you are just doing system.draggy.droppy asp development, you can ignore both, since you pro...
<p>jQuery does have a widgets library - it's fairly new, but pretty cool. It can only get better! <a href="http://ui.jquery.com/" rel="nofollow noreferrer">jQuery UI</a></p>
42,980
<p>How can you import a foxpro DBF file in SQL Server?</p>
<p>Use a linked server or use openrowset, example</p> <pre><code>SELECT * into SomeTable FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver; SourceDB=\\SomeServer\SomePath\; SourceType=DBF', 'SELECT * FROM SomeDBF') </code></pre>
<p>This tools allows you to import to and from SQL Server.</p> <ul> <li><a href="http://www.download3000.com/download_17933.html" rel="nofollow noreferrer">http://www.download3000.com/download_17933.html</a></li> </ul>
7,615
<p>I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted.</p> <p>Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief expl...
<p>When working with XNA, everything (even 2d primitives) have to be expressed in a way that a 3d card can understand, which means that a line is just a set of vertices.</p> <p>MSDN has a pretty good walkthrough here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb196414.aspx#ID2EEF" rel="noreferrer">http:...
<p>Here is a simple way that I use to make lines by specifying a start coordinate, an end coordinate, width, and color of them:</p> <p>NOTE: you must add a file named "dot" to the content directory (the line will be made out of these).</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; ...
33,949
<p>I have a web service in C# and would like to have a nested inner class, that abstracts away the session collection, something like this: </p> <pre> <code> public class Service : System.Web.Services.WebService { [WebMethod] public string Foo(string ticket) { SessionPool.getSession(ticket); } ...
<p>Nested classes in C# aren't like (non-static) inner classes in Java. There is no implicit reference to an instance of the containing class - so you can't use any instance members of the containing class without an explicit reference.</p> <p>However, you do have access to all private members of the containing class ...
<pre><code>System.Web.HttpContext.Current </code></pre> <p>?</p>
28,033
<p>Where should I point someone to learn the basics of HTML/CSS? I personally got my start from <a href="http://htmlgoodies.com/" rel="nofollow noreferrer">HTMLGoodies</a> way back in the day, but while I thank Ken Burns for getting me going, I'm loathed to send someone out to that site nowadays as I think it's dated. ...
<p>I can't believe how many people are answering with w3schools. I couldn't recommend enough that people never EVER mention this place again. It is a terrible resource.</p> <p>A few good places:</p> <p><strong>Addition for HTML5:</strong> <a href="http://diveintohtml5.ep.io/" rel="noreferrer">http://diveintohtml5.e...
<blockquote> <p>I can't believe that people here are recommending W3Schools. That's the last place I would recommend anyone to go. For me its a great... Maybe isn't "the" reference website, but is a very good and practical cheatsheat about html and stuff...</p> </blockquote> <p>The htmldom section is one o...
49,173
<p>On my rails app I have a list of items (like a task list) and for each item there is a couple of check box to set parameters.</p> <p>When I submit the form, the checked box are stored as zero and the unchecked as null on DB. </p> <p>the question is: Is there a way to configure it? To store the data on a more tradi...
<p>Let's assume that the attribute you are working with is <code>club_member</code> as in "are you a club_member?".</p> <p>Note that in Ruby/Rails, the way it is working now, <code>if model.club_member</code> will return false if it is not checked (value is null or in Ruby, nil) and true if it is checked (value is 0)....
<p>From the rails documentation:</p> <p>An object is blank if it’s false, empty, or a whitespace string. For example, “”, “ “, nil, [], and {} are blank.</p> <p>This simplifies: if !address.nil? &amp;&amp; !address.empty?</p> <p>…to: if !address.blank?</p>
15,255
<p>I am printing minis and other very detailes stuff and I find that 0.04 mm layer height gives the best looking (smoothest) result. However it takes a long time, so I am looking for ways to speed it up. Is there any slicer which offers different layer heights for the outer perimiter? So you can print your model at 0.1...
<p>In Ultimaker Cura, unless you print a single perimeter outline and add extra wall infill support you are not going to have different outer perimeter layer heights.</p> <p>However, Cura is able to reduce the printing time, E.g. you can have fine layers for the wall (all perimeters), and coarse layers for the infill....
<p>In Ultimaker Cura, unless you print a single perimeter outline and add extra wall infill support you are not going to have different outer perimeter layer heights.</p> <p>However, Cura is able to reduce the printing time, E.g. you can have fine layers for the wall (all perimeters), and coarse layers for the infill....
1,528
<p>What factors determine which approach is more appropriate?</p>
<p>I think both have their places.</p> <p>You shouldn't simply use <code>DoSomethingToThing(Thing n)</code> just because you think "Functional programming is good". Likewise you shouldn't simply use <code>Thing.DoSomething()</code> because "Object Oriented programming is good".</p> <p>I think it comes down to what yo...
<p>Not nearly enough information here. It depends if your language even supports the construct "Thing.something" or equivalent (ie. it's an OO language). If so, it's far more appropriate because that's the OO paradigm (members should be associated with the object they act on). In a procedural style, of course, DoSometh...
10,242
<p>What is the longest string that can be created in .NET? The docs for the <code>String</code> class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of internals. Would the maximum change on a 64-bit system?</p> <p>[This is asked more for curiosity than for pra...
<p>The theoretical limit may be 2,147,483,647, but the practical limit is nowhere near that. Since no single object in a .NET program may be over 2GB and the string type uses UTF-16 (2 bytes for each character), the best you could do is 1,073,741,823, but you're not likely to ever be able to allocate that on a 32-bit m...
<p>String allocates dynamic memory size in the heap of your RAM. But string address is stored in stack that occupies 4 bytes of memory.</p>
16,986
<p>I want to create an ini file to store some settings for my application. Is it a good idea to find where the jar file is located and create an ini file there? If yes, then how can I find the location of the jar file? </p> <p>But if you know a better solution for something like this, I would like to hear some of them...
<p>You can locate your application directory using the ClassLoader. See: <a href="http://illegalargumentexception.blogspot.com/2008/04/java-finding-application-directory.html" rel="noreferrer">Java: finding the application directory</a>. Rather than an <em>.INI</em> file, use a <em>.properties</em> file - you can load ...
<p>You should not be storing temp files in the install directory of an application. Remember, the user running the application may not have write access to that directory. The safest place to put stuff like that is in C:\Documents and Settings\username\Application Data\ApplicationName folder (adjusting the name as ne...
23,516
<p>I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance.</p> <p>What is the general practice for this?</p> <p>Real-world-scenario - I have several html pages that need client-side form validation. For this I use a jQuery p...
<p>At the time this answer was originally posted (2008), the rule was simple: All script should be external. Both for maintenance and performance.</p> <p>(Why performance? Because if the code is separate, it can easier be cached by browsers.)</p> <p>JavaScript doesn't belong in the HTML code and if it contains specia...
<p>Always try to use external Js as inline js is always difficult to maintain. </p> <p>Moreover, it is professionally required that you use an external js since majority of the developers recommend using js externally.</p> <p>I myself use external js.</p>
16,812
<p>I need to build a simple HTTP server in C. Any guidance? Links? Samples?</p>
<p>I suggest you take a look at <a href="http://tinyhttpd.sourceforge.net/" rel="nofollow noreferrer">tiny httpd</a>. If you want to write it from scratch, then you'll want to <em>thoroughly</em> read <a href="https://www.rfc-editor.org/rfc/rfc2616" rel="nofollow noreferrer">RFC 2616</a>. Use <a href="http://en.wikip...
<p>Use platform specific socket functions to encapsulate the HTTP protocol, just like guys behind <a href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" rel="nofollow noreferrer">Apache</a> did.</p>
21,251