instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In the vein of <em>programming questions</em>: suppose there's a collection of objects that can be compared to each other and sorted. What's the most efficient way to keep track of the smallest element in the collection as objects are added and the current smallest occasionally removed?</p>
| <p>Using a min-heap is the best way.</p>
<p><a href="http://en.wikipedia.org/wiki/Heap_(data_structure)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Heap_(data_structure)</a></p>
<p>It is tailor made for this application.</p>
| <blockquote>
<p>If you need random insert and removal,
the best way is probably a sorted
array. Inserts and removals should be
O(log(n)).</p>
</blockquote>
<p>Yes, but you will need to re-sort on each insert and (maybe) each deletion, which, as you stated, is O(log(n)). </p>
<p>With the solution proposed by ... | 5,414 |
<p>I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?</p>
| <p>jQuery doesn't have a convenient function for this. You need to combine <code>contents()</code>, which will give just child nodes but includes text nodes, with <code>find()</code>, which gives all descendant elements but no text nodes. Here's what I've come up with:</p>
<pre><code>var getTextNodesIn = function(el) ... | <p>if you want to strip all tags, then try this</p>
<p><strong>function:</strong></p>
<pre><code>String.prototype.stripTags=function(){
var rtag=/<.*?[^>]>/g;
return this.replace(rtag,'');
}
</code></pre>
<p><strong>usage:</strong> </p>
<pre><code>var newText=$('selector').html().stripTags();
</code></pr... | 38,256 |
<p>I have 2 tables, an active table and an inactive table. I want to <em>move</em> rows from the active to the inactive table. My first thought was</p>
<pre><code>insert into inactive select * from active where ...
delete from active active where ...
</code></pre>
<p>However about .42 seconds later I noticed this wil... | <p>Status flags are your friend.</p>
<pre><code>UPDATE old_data SET move="MARKED";
INSERT INTO somewhere... SELECT where move="MARKED";
DELETE FROM old_data WHERE move="MARKED";
</code></pre>
<p>If you do this with Autocommit off, it will seize locks all over the place.</p>
<p>You can COMMIT after each step, if you ... | <p>This is how I preserve my where clauses:</p>
<pre><code>DECLARE @MyTable TABLE
(
TheKey int PRIMARY KEY
)
--
INSERT INTO @MyTable(TheKey)
SELECT TheKey FROM SourceTable WHERE rows I want
--
INSERT INTO Inactive(fieldlist)
SELECT fieldlist
FROM Active
WHERE TheKey IN (SELECT TheKey FROM @MyTable)
--
DELETE
FROM Ac... | 38,463 |
<p>After answering on <a href="https://stackoverflow.com/questions/45650/common-files-in-visual-studio-solution#45664">this question</a> I thought it would be nice to collect some tips & tricks for working with MSVS solutions and projects. </p>
<p>Here is my list: </p>
<ul>
<li><p>How to avoid saving new projec... | <p>First rule of working with Visual Studio:</p>
<ul>
<li><strong>Install <a href="http://www.jetbrains.com/resharper/" rel="noreferrer">ReSharper</a></strong></li>
</ul>
| <p>I have a tip regarding the "Track Active Item" option mentioned above, for when working with big projects. It's posted here:</p>
<p><a href="https://stackoverflow.com/questions/31163/forcing-the-solution-explorer-to-select-the-file-in-the-editor-in-visual-studio#46193">Forcing the Solution Explorer to select the fi... | 6,793 |
<p>How can I send a DELETE request with delphi 7 and the ICS component so that I can access a REST api?</p>
| <p>We have used "PEG", the C++ version, from Swellsoftware for many years. It is commercial software, not free, but the underlying screen driver can use just a pointer to graphics memory and they provide many sample drivers for different types of graphics hardware. We wrote our own custom driver(s) for our proprietar... | <p>512kb is small. Good luck!</p>
<p>You might want to try a <a href="http://www.damnsmalllinux.org/" rel="nofollow noreferrer">dsl</a> combined with <a href="http://www.mplayerhq.hu/" rel="nofollow noreferrer">mplayer</a>. The latter does not need a GUI to display a movie. I guess it could also display images.</p>
<... | 47,814 |
<p>Most programming houses / managers i know of can only define quality in terms of the no of bugs made / resolved in retrospect. </p>
<p>However most good programmers can innately sense quality once they start meddling with the code.(right?) </p>
<p>Has any programming houses that you know of, successfully translate... | <p>There is no standard API for reading fingerprint data as far as I'm aware since it is a fairly new field and there's no standard way of doing it. Each manufacturer will provide their own API for reading the hardware. The API could just be IO specification to the hardware and there's no library whatsoever, which make... | <p>Symbol has an api for their MC75 handheld devices:</p>
<p><a href="http://support.symbol.com/support/search.do?cmd=displayKC&docType=kc&externalId=12364&sliceId=&dialogID=104336066&stateId=1%200%20104330426" rel="nofollow noreferrer">http://support.symbol.com/support/search.do?cmd=displayKC&... | 35,000 |
<p>We are contracting an external consultant out to generate XHTML (Transitional) and CSS for most of the major pages of a new project we are currently working on.</p>
<p>I've been asked to put together a list of guidelines for them so that we can be sure that a certain level of quality can be expected. As a bit of te... | <p>From a technical standpoint, pages must <a href="http://validator.w3.org/" rel="nofollow noreferrer">pass validation</a> is probably the first test I'd have.</p>
<p>I would expect the site to be able to be used by someone with JavaScript disabled, and someone using a screen reader (this is quite a good one as it sh... | <p>Apart from validation the following points should be keep in mind
- Accessibility (Who are the audience)
- CSS based design (Where semantics are well designed)
- Be consistent with your naming convention (css and id naming. This will be beneficial in the long run when any change needs to be made, when a new css ha... | 42,230 |
<p>So, simple procedure, calculate a factorial number. Code is as follows.</p>
<pre><code>int calcFactorial(int num)
{
int total = 1;
if (num == 0)
{
return 0;
}
for (num; num > 0; num--)
{
total *= num;
}
return total;
}
</code></pre>
<p>Now, this works fine and ... | <p>2^32 doesn't give you the limit for signed integers. </p>
<p>The signed integer limit is actually <a href="http://msdn.microsoft.com/en-us/library/296az74e(VS.80).aspx" rel="noreferrer">2147483647</a> (if you're developing on Windows using the MS tools, other toolsuites/platforms would have their own limits that ar... | <p>If i remember well:</p>
<p>unsigned short int = max 65535</p>
<p>unsigned int = max 4294967295</p>
<p>unsigned long = max 4294967295</p>
<p>unsigned long long (Int64 )= max 18446744073709551615</p>
<h3>Edited source:</h3>
<p><a href="http://home.att.net/%7Ejackklein/c/inttypes.html#int" rel="nofollow noreferrer">Int... | 29,246 |
<p>Here's the situation:</p>
<p>A user of our program suddenly started receiving an error from the Borland Database Engine (BDE) when attempting to start the application. The error message says that it was unable to initialize the BDE and gives error code $251e. User is on BDE 5.2.0.2.</p>
<p>I cannot find any offi... | <p>You might have better luck searching for the error here..</p>
<p><a href="http://www.fulltextsearch.com/" rel="nofollow noreferrer">http://www.fulltextsearch.com/</a></p>
<p>A common culprit seems to be a conflicting device driver.</p>
<p>Good luck</p>
| <p>look on codegear's web site. some time ago i saw an article about the memory layout for this shared memory and ways to resolve a problem like this. it's an ugly business but there was a good article on this. sorry, i can't find it offhand.</p>
| 48,647 |
<p>Ok, so i'm working on a regular expression to search out all the header information in a site.</p>
<p>I've compiled the regular expression:</p>
<pre><code>regex = re.compile(r'''
<h[0-9]>\s?
(<a[ ]href="[A-Za-z0-9.]*">)?\s?
[A-Za-z0-9.,:'"=/?;\s]*\s?
[A-Za-z0-9.,:'"=/?;\s]?
''', re.X)
... | <p>This question has been asked in several forms over the last few days, so I'm going to say this very clearly.</p>
<h1>Q: How do I parse HTML with Regular Expressions?</h1>
<h1>A: Please Don't.</h1>
<p>Use <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow noreferrer">BeautifulSoup</a>, <a href="... | <p>As has been mentioned, you should use a parser instead of a regex.</p>
<p>This is how you could do it with a regex though:</p>
<pre><code>import re
html = '''
<body>
<h1>Dog </h1>
<h2>Cat </h2>
<h3>Fancy </h3>
<h1>Tall cup of lemons</h1>
<h1><a href=... | 11,545 |
<p>Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can use to submit any visited URL to a 3rd party site when that's possible by URL. Suggestions?</p>
<p>For example, I've been using </p>
<pre><code>javascript:void(location.href="http://www.yacktrack.com/home?query="+encodeURI... | <p>Do you want something exactly like the Delicious bookmarklet (as in, something the user actively clicks on to submit the URL)? If so, you could probably just copy their code and replace the target URL:</p>
<pre><code>javascript:(function(){
location.href='http://example.com/your-script.php?url='+
encodeURIC... | <p>Another option would be to something like this:</p>
<pre><code><form action="http://www.yacktrack.com/home" method="get" name="f">
<input type="hidden" name="query" />
</form>
</code></pre>
<p>then your javascript would be:</p>
<pre><code>f.query.value=location.href; f.submit();
</code></pre>
... | 7,805 |
<p>I have a large resistor that goes in my J-Head extruder. It's grey, and it came with the extruder. I'm uncertain as to what grade of wire I need to solder to it. It being one of the elements of the system that heats the hottest, I would think that it would be important to find out what sort of wire is the correct ... | <p>There are a number of things to consider:</p>
<ul>
<li><p>Wire Gauge: a typical 40W, 12V heater draws around 3A. 24 AWG or lower would be appropriate (copper wire, CCA will require thicker gauge).</p></li>
<li><p>Insulation: the part of the wire close to the resistor leads might get too hot for conventional PVC ins... | <p>The physical size of the resistor is irrelevant. What matters is the total power (and in particular, current) the head will draw. Once you know that, there are plenty of tables on the web that'll list max amperage vs. wire gauge. When in doubt, use a larger wire :-) since we're only talking about a couple of feet... | 438 |
<p>Our company uses Citrix to remote into a terminal server for remote users to launch smart client apps within a virtual window on their machine.</p>
<p>The problem is that smartclient apps are being downloaded each time the user launches them eventhough the version on the remote citrix server has not change. This i... | <p>I can't speak to details on Citrix servers. However, with ClickOnce you have no say over where an application is installed. It's installed under the user profile, no ifs, ands, or buts. One of the major goals with ClickOnce was improved security and installing apps to the profile makes that easier. So, if you'r... | <p>The way to do this in the Citrix environment is to use the Citrix URL Content redirection feature (in Feature Release 2) to redirect the ClickOnce URL to the local machine (<a href="http://xxx.xxx/myapplication.application" rel="nofollow noreferrer">http://xxx.xxx/myapplication.application</a>). This will cause the... | 19,154 |
<p>I want to be able to launch a third party process from within an Adobe AIR application (actually a command line process). Is there a security context that AIR apps run in that prevents this?</p>
| <p>Two of the most requested features for Adobe AIR have been the ability to launch native executables from an AIR application, and the ability to integrate native libraries into an AIR application. Unfortunately, neither feature is included in Adobe AIR 1.0.</p>
<p>However. Check out:</p>
<p><a href="http://blog.one... | <p>Actually with the latest version of <a href="http://shu-player.com" rel="nofollow noreferrer">Shu</a> you have the ability to create a standard AIR file with <em>additional</em> commands which breaks no intentions of AIR at all.</p>
| 33,242 |
<p>I'm making list of items in categories, problem is that item can be in multiple categories.
What is your best practice to store items in categories and how list all items within category and its child categories? I am using Zend Framework and MySQL to solve this issue.</p>
<p>Thanks for your replies.</p>
<p>Sorry ... | <p>So, you have a hierarchy in the categories, yes? Is it one level (category and child category) or any number (children can have children, etc)? That will impact what the solution is. </p>
<p>Generally, you'd model something like this with a many-to-many relationship, like:</p>
<pre><code>CREATE TABLE Item(
item_... | <p>Typically, the best solution I've found that works in most situations is simply using a parent_id field in your categories table. That way you will only need one categories table. This will support any number of levels or just one if you want (in which case, the ability to create a third level of category would ne... | 48,320 |
<p>Recent versions of PHP have a cache of filenames for knowing the real path of files, and <code>require_once()</code> and <code>include_once()</code> can take advantage of it.</p>
<p>There's a value you can set in your <em>php.ini</em> to set the size of the cache, but I have no idea how to tell what the size should... | <p>You've probably already found this, but for those who come across this question, you can use realpath_cache_size() and realpath_cache_get() to figure out how much of the realpath cache is being used on your site and tune the settings accordingly.</p>
| <p>the 16K is the # of files not activity.</p>
<p>Set to 1k for most sites. Very similar to settings in APC, xcache ea etc.</p>
| 24,061 |
<p>Is there an efficient method of converting an integer into the written numbers, for example:</p>
<pre><code>string Written = IntegerToWritten(21);
</code></pre>
<p>would return "Twenty One".</p>
<p>Is there any way of doing this that doesn't involve a massive look-up table?</p>
| <p>This should work reasonably well:</p>
<pre><code>public static class HumanFriendlyInteger
{
static string[] ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen",... | <p>Here is a <a href="http://forums.exchangecore.com/topic/684-convert-number-to-words-c-console-application/" rel="nofollow">C# Console Application</a> that will return whole numbers as well as decimals.</p>
| 2,538 |
<p>IIS does not work when I start applications like Skype since it also uses port 80.</p>
<p>Which port can I use to run IIS other than 80? (8080 does not work)</p>
| <p>You can run IIS on any port you like, as long as it does not conflict with other applications. I am using 88, 8888 and other easy to remember ports.</p>
<p>You can find the common used port here: <a href="http://www.iana.org/assignments/port-numbers" rel="noreferrer">PORT NUMBERS</a>, and it is safer to choose an u... | <p>you can configure IIS in IIS Mgr to use EVERY port between 1 and 65535 as long it is not used by any other application</p>
| 46,294 |
<p>I'm relatively new to .NET programming (and OOP in general) and I want to make sure I'm not developing bad beginner habits when designing my applications.</p>
<p>If you were hiring a new .NET developer and had to get him up to speed relatively quickly, but also wanted to make sure he adopts best practices (e.g., si... | <p>There are two separate, though related, goals:</p>
<ul>
<li>To be a good OO developer</li>
</ul>
<p>and</p>
<ul>
<li>To be a good .NET Developer</li>
</ul>
<p>Being excellent at the latter will require being at least good at the former, but both will require hard work. Don't get locked into the Microsoft mindset... | <p>Coincidentally, I'm halfway through reading a VB.net book (published by Apress) which is pretty good.</p>
<p>Although there are a wealth of great tutorials on the web, I thouroughly recommend buying a book, they are generally a lot more professional in their approach.</p>
<p>And as crazy as it sounds I find it muc... | 37,410 |
<p>Say I have a blogging app in Django. How can i re-order the posts using a draggable table in the default admin?</p>
<p>It would be best if i didn't have to add any extra fields to the model, but if i really have to i can.</p>
| <p>For working code to do this, check out <a href="http://www.djangosnippets.org/snippets/1053/" rel="noreferrer">snippet 1053</a> at <a href="http://www.djangosnippets.org" rel="noreferrer">djangosnippets.org</a>.</p>
| <p>The order can only be determined if you add a field in your model.Let's add a position field in your model. </p>
<pre><code>In your models.py
class MainModel(models.Model):
name = models.CharField(max_length=255)
position = models.PositiveSmallIntegerField(null=True)
class Meta:
ordering = (... | 13,596 |
<p>I changed the filament, and to adjust filament temperature, I printed a test model and it looked good: </p>
<p><a href="https://i.stack.imgur.com/90rop.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/90rop.jpg" alt="enter image description here"></a></p>
<p>But printing another part did not go s... | <p>It definitely looks like the temperature is too high</p>
<p>but it can also mean that </p>
<ul>
<li>the speed is too low and/or</li>
<li>the cooling fan is not driven correctly and/or</li>
<li>over extrusion could play a role here</li>
</ul>
<p>this is the scenario with all these issues together</p>
<p>too high ... | <p>From third picture - moisture!</p>
<p>Is new filament cheap? I guess it was too long on stash and/or bad package.</p>
<p>Look for <a href="https://www.youtube.com/channel/UCxQbYGpbdrh-b2ND-AfIybg" rel="nofollow noreferrer">Maker's Muse</a>'s video on Youtube about this topic. </p>
| 1,279 |
<p>I have read several places that the difference between <code>c_str()</code> and <code>data()</code> (in STL and other implementations) is that <code>c_str()</code> is always null terminated while <code>data()</code> is not.
As far as I have seen in actual implementations, they either do the same or <code>data()</cod... | <p>The documentation is correct. Use <a href="http://en.cppreference.com/w/cpp/string/basic_string/c_str" rel="noreferrer"><code>c_str()</code></a> if you want a null terminated string.</p>
<p>If the implementers happend to implement <a href="http://en.cppreference.com/w/cpp/string/basic_string/data" rel="noreferrer">... | <p>Quote from <code>ANSI ISO IEC 14882 2003</code> (C++03 Standard):</p>
<pre><code> 21.3.6 basic_string string operations [lib.string.ops]
const charT* c_str() const;
Returns: A pointer to the initial element of an array of length size() + 1 whose first size() elements
equal the corresponding elements of... | 23,652 |
<p>The data model for my Core Data document-based app (10.5 only) is in a
framework, so automatic schema upgrades using a Core Data mapping
model don't appear to work. It appears that the Core Data machinery
doesn't find the appropriate data models or mapping model when they
are not in the app's main bundle. So, instea... | <p>I haven't run across this particular situation, but I have a few guesses. First, instead of using -removeItemAtPath: and -moveItemAtPath: when you want to switch files, use the FSExchangeObjects() function instead. NSDocument uses FSRefs to track the file and unless you use FSExchangeObjects(), it'll realize that ... | <p>10 years later...
I encountered the same issue, and with the new API for NSDocument, you can update the document's fileModificationDate with the new date of the updated file after doing the migration</p>
<pre><code>migrate()
if let newModificationDate = try? NSFileManager.defaultManager().attributesOfItemAtPath(url... | 49,809 |
<p>that's it</p>
<p>isn't there a way to see the raw text file that my browser sends to a website when I do a POST method?</p>
<p>something like:</p>
<p>
POST /path/script.cgi HTTP/1.0 <br>
From: frog@jmarshall.com<br>
User-Agent: HTTPTool/1.0<br>
Content-Type: application/x-www-form-urlencoded<br>
Content-Length: 3... | <p>You need a proxy such as <a href="http://www.fiddlertool.com/" rel="noreferrer">Fiddler</a>. Fiddler is a freeware HTTP Debugging Proxy which allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data.</p>
| <p>Also there is <a href="https://addons.mozilla.org/en-US/firefox/addon/966" rel="nofollow noreferrer">Tamper Data</a> plugin for Firefox</p>
| 33,530 |
<p>One of the biggest issues currently holding me back from diving full steam into unit testing is that a really large percentage of the code I write is heavily dependent on third-party COM objects from different sources that also tend to interact with each other (I'm writing add-ins for Microsoft Office using several ... | <p>The traditional approach says that your client code should use a wrapper, which is responsible for instantiating the COM object. This wrapper can then be easily mocked.</p>
<p>Because you've got parts of your code instantiating the COM objects directly, this doesn't really fit. If you can change that code, you coul... | <p>It comes down to 'designing for testability'. Ideally, you should not instantiate those COM objects directly but should access them through a layer of indirection that can be replaced by a mock object.</p>
<p>Now, COM itself does provide a level of indirection and you could provide a mock object that provided a sub... | 9,588 |
<p>I use div tags to define areas within my web pages. I set all the obvious things like background, size, padding, etc. But it is all very square.</p>
<p>How can I use <strong>only</strong> CSS to round the corners?</p>
| <p>You would use the border-radius property. However, this is only supported in CSS3, which no browser implements yet. If you only need it to work in a couple browsers you could use -webkit-border-radius and -moz-border-radius which would let it work in Safari and Firefox respectively.</p>
<p>If you are not opposed ... | <p>Ask google about "css rounded corners no images" and you'll find many, many examples of how to do it.</p>
<p>Personally, I like the methods based on manipulating margins to draw the curve line-by-line, despite the amount of noise they produce in the page source, because they're the most flexible and can draw any sh... | 32,879 |
<p>I have written a lot of code in Python, and I am very used to the syntax, object structure, and so forth of Python because of it.</p>
<p>What is the best online guide or resource site to provide me with the basics, as well as a comparison or lookup guide with equivalent functions/features in VBA versus Python.</p>
... | <p>VBA is quite different from Python, so you should read at least the "Microsoft Visual Basic Help" as provided by the application you are going to use (Excel, Access…).</p>
<p>Generally speaking, VBA has the equivalent of Python modules; they're called "Libraries", and they are not as easy to create as Python module... | <blockquote>
<p>"I'm having trouble equating a simple
List in Python with something in
VBA..."</p>
</blockquote>
<p>This isn't the best way to learn the language. In a way, you're giving up large pieces of Python because there isn't something like it in VBA.</p>
<p>If there's nothing like a Python list in VBA,... | 10,248 |
<p>I use ls to obtain my filename which has white space so it looks something like: </p>
<p><code>my file with whitespace.tar.bz2</code></p>
<p>I want to pipe this to tar similar to:</p>
<pre><code>ls | grep mysearchstring | tar xvjf
</code></pre>
<p>How can I insert double quotes before piping it to tar?</p>
| <p>A good tool for this is find and xargs. For example, you might use:</p>
<pre><code>find . -name '*.tar.bz2' -print0 | xargs -0 -n1 tar xjf
</code></pre>
<p>As pixelbeat suggested you can also use the shell like this:</p>
<pre><code>for archive in *.tar.bz2; do tar xvjf "$archive"; done
</code></pre>
| <p>What's wrong with shell-wildcard expansion? (Assuming there is only one filename.)</p>
<pre><code>% tar -cvf *mysearchstring*
% tar -xvf *mysearchstring*
</code></pre>
<p>Sure, the filename that matches *mysearchstring* will have spaces. But the shell [tcsh,bash] will assign that filename, <strong>including ... | 48,808 |
<p>Shouldn't this be a pretty straightforward operation? However, I see there's neither a <code>size()</code> nor <code>length()</code> method.</p>
| <p>Do a <code>SELECT COUNT(*) FROM ...</code> query instead.</p>
<p>OR</p>
<pre><code>int size =0;
if (rs != null)
{
rs.last(); // moves cursor to the last row
size = rs.getRow(); // get row id
}
</code></pre>
<p>In either of the case, you won't have to loop over the entire data.</p>
| <p>Give column a name..</p>
<pre><code>String query = "SELECT COUNT(*) as count FROM
</code></pre>
<p>Reference that column from the ResultSet object into an int and do your logic from there..</p>
<pre><code>PreparedStatement statement = connection.prepareStatement(query);
statement.setString(1, item.getProductId())... | 23,337 |
<p>In the application I am developing I have to store the time some particular users remain logged into the application, unfortunately, in web applications, there are several ways the user can log off.</p>
<ol>
<li>User clicks log off.</li>
<li>User session expires.</li>
<li>User closes the window.</li>
<li>User types... | <p>On each page view, update your count. If they log out, then you've got an accurate measure. If they navigate away, or any other method, then the most that you're out is the length of time they were on one page.</p>
<p>If it were <em>really really</em> important to have an accurate measure, then perhaps an AJAX "hea... | <p>Well for #3 and #4 you can attach something to the window.onunload event that gets you the time for calcuations, but be careful that your code is fast enough that the page doesn't completely unload before your AJAX request can be sent.</p>
<p>As far as #2 goes, the "heartbeat" suggested by nickf is probably the bes... | 24,835 |
<p>I am printing ABS in an enclosure and most of the prints have worked out well with minor tweaking. However, the top layer always seems to split or skip a step (not sure which).</p>
<p><a href="https://i.stack.imgur.com/ZtGE7.jpg" rel="nofollow noreferrer" title="Split top layer"><img src="https://i.stack.imgur.com/Z... | <p>Since it happens in the same place each time, it's either G-code or mechanical. I've seen things like this happen with dirty gantries, or a dirty Z-axis guide.</p>
<p>If it's not mechanical, there may be something in the G-code that causes it, such as too many retractions in one area, or similar.</p>
| <p>Personally, I have dealt with this problem myself! I messed around with the slicer a little bit, and I found that if you make the print layer height 0.15 or 0.10 mm, it will be better. The image you attached looks as though the printer was splitting a step and only printing that part. I can't think of a reason why i... | 1,499 |
<p>Ok, heres my issue: I have a JSF application and some JSP files. Let's say i have main.jsp which has a view and includes sub.jsp. This works fine. sub.jsp contains a subview. As a result all the ID's of the form elements in sub.jsp follow the form of 'subview:component'. Now suppose I'm using some ajax and want to f... | <p>AJAX is tricky to do with JSF. If the JSF framework you're using doesn't support it, you'll run into many view state problems.</p>
<p>I'm surprised an exception isn't thrown when you address <em>sub.jsp</em> directly - there should be no h:view in <em>sub.jsp</em> and without a UIViewRoot, I'm not sure how a UI tre... | <p>Have you looked at ajax4Jsf (aka Richfaces) ?</p>
| 38,318 |
<p>Often times I need a collection of non-sequential objects with numeric identifiers. I like using the KeyedCollection for this, but I think there's a serious drawback. If you use an int for the key, you can no longer access members of the collection by their index (collection[index] is now really collection[key]). Is... | <p>Basically you need to decide if users of the class are likely to be confused by the fact that they can't, for example, do:</p>
<pre><code>for(int i=0; i=< myCollection.Count; i++)
{
... myCollection[i] ...
}
</code></pre>
<p>though they can of course use foreach, or use a cast:</p>
<pre><code>for(int i=0; ... | <p>The key in a KeyedCollection should be unique and quickly derivable from the object being collected. Given a person class, for example, it could be the SSN property or perhaps even concatenating FirstName and LastName properties (if the result is known to be unique). If an ID is legitimately a field of the objec... | 24,675 |
<p>This is probably a very simple question, but what is the technical term for this class of language? </p>
<p>They use an "intermediate" assembly type language which is sent through the JVM or CLR. They both are object oriented and they both depend on an intermediary such as the Java Virtual Machine or the Common L... | <p>A key difference between C++ and .NET/Java is the automatic reclaiming of memory that is no longer required. This is known as <strong>garbage collection</strong>. For this property, they are known as <strong>managed</strong> platforms.</p>
<p>Both Java/.NET delay the compilation of bytecode into native code until... | <p>It depends, if you are talking about the fact they run on a virtual machine then they are regarded as JIT-compiled (Just-In-Time) or bytecode (logically 1/2 compiled and 1/2 interpreted).</p>
<p>If you are talking about the garbage collection then they are simply referred to as garbage collected.</p>
<p>The key po... | 24,429 |
<p>I would like to write a macro for Notepad++ which should replace char1, char2, char3 with char4, char5, char6, respectively.</p>
| <p>Macros in Notepad++ are just a bunch of encoded operations: you start recording, operate on the buffer, perhaps activating menus, stop recording then play the macro.<br>
After investigation, I found out they are saved in the file shortcuts.xml in the Macros section. For example, I have there:</p>
<pre class="lang-x... | <p>Actually, the shortcuts.xml file does <em>not</em> store user-generated macros and no obvious candidates contain this info. These instructions are out of date. </p>
<p>Contrary to various websites' tips, storing user-generated macros isn't enabled for v.5.4.2. That XML file is there, but your macro does not get sto... | 47,304 |
<p>On the user pages of Stack Overflow where the tabs are (Stats, Recent, Responses, etc.) you get the illusion that the tabs are extensions of the line they're sitting on. Stack Overflow creates this effect by defining pure CSS borders. I want to achieve the same effect but I have images both for the tabs and for the ... | <p>May be the <a href="http://www.alistapart.com/articles/slidingdoors2/" rel="nofollow noreferrer">sliding doors technique</a> could come in handy</p>
<p>This <a href="http://www.alistapart.com/d/slidingdoors2/v1/ex9.html" rel="nofollow noreferrer">example</a> does work in Firefox and IE</p>
| <p>This <a href="http://www.pagecolumn.com/tool/top_tabs_generator.htm" rel="nofollow noreferrer">tab generator</a> may be help.</p>
| 38,513 |
<p>What do I have to consider <strong>in database design</strong> for a new application which should be able to support the most common relational database systems (SQL Server, MySQL, Oracle, PostgreSQL ...)?</p>
<p>Is it even worth the effort? What are the pitfalls?</p>
| <p>The short answer is to stick to features that are standardly, or close to standardly implemented. What this means in more detail is:</p>
<ul>
<li><p>Avoid anything that uses the database's procedural language (stored procedures or triggers) since this is where the huge differences between the systems come in. You m... | <ol>
<li>Don't use stored procedures</li>
<li>Don't use vendor specific SQL</li>
</ol>
<p>Or, use a persistence technology such as hibernate / nHibernate that abstracts away the differences between different DBs.</p>
| 24,959 |
<p>I need to get just the first item (actually, just the first key) off a rather large associative array in JavaScript. Here's how I'm doing it currently (using jQuery):</p>
<pre><code>getKey = function (data) {
var firstKey;
$.each(data, function (key, val) {
firstKey = key;
return false;
... | <p>There isn't really a <strong>first</strong> or <strong>last</strong> element in associative arrays (i.e. objects). The only order you can hope to acquire is the order the elements were saved by the parser -- and no guarantees for consistency with that.</p>
<p>But, if you want <strong><em>the first to come up</em></... | <p>In addition to Jonathan's solution, we can also extend the default array functionality:</p>
<pre><code>Array.prototype.getKey = function() {
for (var prop in this)
if (this.propertyIsEnumerable(prop))
return prop;
}
</code></pre>
| 21,340 |
<p>I'd like to format a duration in seconds using a pattern like H:MM:SS. The current utilities in java are designed to format a time but not a duration.</p>
| <p>If you're using a version of Java prior to 8... you can use <a href="http://joda-time.sourceforge.net/" rel="noreferrer">Joda Time</a> and <a href="http://joda-time.sourceforge.net/api-release/org/joda/time/format/PeriodFormatter.html" rel="noreferrer"><code>PeriodFormatter</code></a>. If you've really got a duratio... | <p>in scala, no library needed:</p>
<pre><code>def prettyDuration(str:List[String],seconds:Long):List[String]={
seconds match {
case t if t < 60 => str:::List(s"${t} seconds")
case t if (t >= 60 && t< 3600 ) => List(s"${t / 60} minutes"):::prettyDuration(str, t%60)
case t if (t >... | 33,455 |
<p>I am using Firefox 3 to debug my ASP.NET applications in Visual Studio 2008. How can I configure either FF3 or VS2008 so that when I 'x' out of Firefox I don't have to hit the stop debugging button in Visual Studio? (The behavior you get with IE)</p>
| <p>My solution to this has been to manually attach the debugger to the relevant browser and the aspnet_wp process. When I'm finished, I simply detach all.</p>
| <p>I have the same thing. I assume you're working with Cassini (the integrated web server).</p>
<p>I've yet to find an answer to that (I just go back to VS and press <em>Shift+F5</em> to stop the debugger), but I can tell you that if you check the <em>"Edit and Continue"</em> box in the project's properties (web tab),... | 8,447 |
<blockquote>
<p>If f is a numerical function and n is a positive integer, then we can form the nth repeated application of f, which is defined to be the function whose value at x is f(f(...(f(x))...)). For example, if f is the function x + 1, then the nth repeated application of f is the function x + n. If f is the ope... | <pre><code>(define (repeated f n)
(if (= n 1)
f
(compose f (repeated f (- n 1)))))
</code></pre>
| <p>Did you just delete and reask this question? I'm copying my former answer here (thankfully, my browser had cached it):</p>
<p>Well, you probably want something like this, right?</p>
<pre><code>((repeated square 3) 5)
-> (square ((repeated square 2) 5))
-> (square (square ((repeated square 1) 5)))
-> (squ... | 31,026 |
<p>I'm using SQL Server 2008 Management studio viewing a 2005 server and have just added 2 users. For some reason they both have slightly different icons and I'm not sure why.</p>
<p>Anyone have a definitive list of the icons and their meaning or a link to microsoft's doc on it as I can't find anything anywhere.</p>
... | <p>One icon for user account, another icon is for group account. </p>
| <p>Connect permission has been revoked and Connect permission has been denied are both correct. The only way I've found to cause the red arrow is for the user to NOT have connect access to the database. </p>
<p>Source SQL Server QOTD - 2 July 2014 (Andy Warren)</p>
| 49,867 |
<p>I am working on a project that I want to implement AJAX, and I have decided on jQuery as a JavaScript Library. Here is the HTML:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtm... | <p>Use:</p>
<pre><code>$("#result").html(msg.d)
</code></pre>
| <p>Why are you using "json" as dataType, while you are returning html? Use "html" as dataType and replace msg.d with msg</p>
| 38,760 |
<p>I am using the standard .Net 2.0 DataGridView with sort mode of automatic on the column. It is very very slow (which should probably be another question on how to speed it up) but I can't seem to find an event or combination of events that will maintain a WaitCursor while this sort operation is being performed.</p>... | <p>Hook "MouseDown" event, check with "HitTest" method where user clicked. If user clicked on the column header set "Cursor.Current = Cursors.Wait" and set some flag "isSorting" to true.</p>
<p>Hook "MouseUp" event, check if "isSorting" flag true, then set "Cursor.Current = Cursors.Default".</p>
<p><strong>EDIT:</str... | <p>Anno 2021, necromancy at it's best :) I was still looking for a way to do this correctly.</p>
<p><strong>What I tried and what didn't work</strong></p>
<p>The <code>CellMouseDown</code> event is also fired when a user starts dragging (reordering column headers). So that's a compromise.</p>
<p>The <code>CellMouseClic... | 35,607 |
<p>Is there a specific pattern that developers generally follow? I never really gave it much thought before in my web applications, but the ASP.NET MVC routing engine pretty much forces you to at least take it into consideration.</p>
<p>So far I've liked the controller/action/index structure (e.g. Products/Edit/1), b... | <p>I like RESTful, user friendly and hackable URLs.</p>
<p>What does this mean? Lets start with <em>user friendly URLs</em>. To me a user friendly URL is something easy to type and easy to remember <code>/Default.aspx?action=show&userID=140</code> doesn't meet any of these requirements. A URL like `/users/troethom... | <p>Bill de hÓra wrote a very good essay entitled <a href="http://www.dehora.net/journal/2007/08/web_resource_mapping_criteria_for_frameworks.html" rel="nofollow noreferrer">Web resource mapping criteria for frameworks</a> that is well worth a read.</p>
| 14,530 |
<p>Looking for tips, tutorials, books and other resources to get started with Constraint Programming.</p>
| <p>There is a lot of excellent material available on the web once you get in the groove, but the links below are (IMO) good starting points (the ones I used).</p>
<p><a href="https://people.eng.unimelb.edu.au/pstuckey/book/course.html" rel="nofollow noreferrer">Programming with Constraints: An Introduction - (Course w... | <p>The <a href="http://books.google.com.au/books?id=Kjap9ZWcKOoC" rel="nofollow noreferrer">handbook of constraint programming</a> is well thought of. </p>
<p>In trivia, <a href="http://portal.acm.org/author_page.cfm?id=81100589552" rel="nofollow noreferrer">my supervisor from fourth year</a> university (which was ... | 41,620 |
<p>I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering. </p>
<p>I seem to recall a call to determine this, but can't lay my hands on it right now.</p>
<p>Also, is there an easy, code based way to force one rendering pipeline over ... | <p>Check RenderCapability.Tier</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/graphics-rendering-tiers" rel="nofollow noreferrer">Graphics Rendering Tiers</a></li>
<li><a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.rendercapability" rel="nofollow noreferr... | <p>To answer the second half of your question, there is no way I believe really to force one way over the other. Hardware rendering is automatically used if available, otherwise, software is.</p>
<p>If you need to test it in Software mode, you'll need to use a low spec machine or use Remote Desktop to view the applica... | 18,042 |
<p>I have a requirement in my application that I think can be met by using thread local storage, but I'm wondering if it's one of those things that's best to avoid.</p>
<p>I have read a few articles on the subject:</p>
<p><a href="http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=58" rel="nofollow nor... | <p>A gotcha for asp.net applications: the processing of a single request might switch threads, namely if there are parallel requests in the same session. Because of this, anything you put in TLS before the HttpApplication.PostRequireRequestState event might not be there later, because you are on a different thread.</p>... | <p>Have a look at new .net 4 <a href="http://msdn.microsoft.com/en-us/library/dd642243.aspx" rel="nofollow">ThreadLocal<T></a> class with an example, more info <a href="http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/" rel="nofollow">here</a>.</p>
| 21,116 |
<p>I'm trying to find an efficient C++ interval tree implementation (mostly likely based on red black trees) without a viral or restrictive license. Any pointers to a clean lightweight standalone implementation? For the use case I have in mind, the set of intervals is known at the outset (there would be say a million) ... | <p>I've written a template-based interval tree implementation in C++, <a href="https://github.com/ekg/intervaltree" rel="noreferrer">https://github.com/ekg/intervaltree</a>. MIT license. Enjoy.</p>
| <p>There's also a C# implementation of Interval tree at <a href="http://code.google.com/p/intervaltree/" rel="nofollow noreferrer">this link</a>. It's easy enough to translate to C++ for those in need</p>
| 26,155 |
<p>I am trying to print the 3 jaw lathe chuck on <a href="https://www.thingiverse.com/thing:624625" rel="nofollow noreferrer">Thingiverse</a>. This specific piece is the scroll.stl, but it applies on every big piece. The print material is (transparent) PLA, that I print on custom glass bed, which is heated by a regular... | <p>Several things I've done to stop warping when it occurred:</p>
<ol>
<li><p>Use a wider brim.</p></li>
<li><p>If the brim isn't sticking, use a higher bed temperature for the first layer.</p></li>
<li><p>If the brim comes up only on one side or warping is only on one side, make sure the bed is level. </p></li>
<li>... | <p>Glass is tricky. Try using a glue stick. It makes the problem getting it off more than keeping it on. Magigoo and Aquanet also come highly recommended for glass. Another thing would be printing with a raft. Raft's stick pretty well, and most prints stick to a raft, and those prints won't lift. A third trick would be... | 1,289 |
<p>I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi.</p>
<p>Reading the example code, I noticed there are some functions whose signatures are followed by the <strong>safecall</strong> keyword. Here's an example:</p>
<pre><code>function AddSymbol(ASymbol: Ol... | <p>Safecall passes parameters from right to left, instead of the pascal or register (default) from left to right </p>
<p>With safecall, the procedure or function removes parameters from the stack upon returning (like pascal, but not like cdecl where it's up to the caller) </p>
<p>Safecall implements exception 'fir... | <p><a href="https://stackoverflow.com/questions/96042/whats-safecall#96231">What Francois said</a> and if it wasn't for safecall your COM method call would have looked like below and you would have to do your own error checking instead of getting exceptions.</p>
<pre><code>function AddSymbol(ASymbol: OleVariant; out R... | 12,161 |
<p>Ok, this is not a CSS issue, I removed all styling from the page. This is a calendar extender that has a target id of a textbox and the popupbutton is the same text box. </p>
<p>The month name is displaying lower than the
days, so it's not usable. </p>
<p>it's fine in IE. </p>
<p>I am using Safari in Windows Vis... | <p>I think it was voted down because you didn't entered any code in your question, so it looks like you are asking support to your Safari browser instead of asking for help on a particularity of how safari treats AJAX.
In other words you need to be more specific and clear.</p>
| <p>I came across the same problem today.</p>
<p>The solution, while somewhat difficult to find on the web, is rather trivial</p>
<p>Create a new Div with its position set to relative (style="position:relative;")</p>
<p>and place your textbox and calendarExtender inside the Div.</p>
<p>That fixed the problem i was f... | 48,724 |
<p>I need to import a csv file into <strong>Firebird</strong> and I've spent a couple of hours trying out some tools and none fit my needs.</p>
<p>The main problem is that all the tools I've been trying like <a href="http://www.sqlmanager.net/products/ibfb/dataimport" rel="noreferrer">EMS Data Import</a> and <a href="... | <p>It's a bit crude - but for one off jobs, I sometimes use Excel.</p>
<p>If you import the CSV file into Excel, you can create a formula which creates an INSERT statement by using string concatenation in the formula. So - if your CSV file has 3 columns that appear in columns A, B, and C in Excel, you could write a fo... | <p>A tool I recently tried that worked outstandingly well is <a href="http://www.volny.cz/iprenosil/interbase/fsql.htm" rel="nofollow noreferrer">FSQL</a>.</p>
<p>You write an IMPORT command, paste it into <code>FSQL</code> and it imports the CSV file into the Firebird table.</p>
| 2,966 |
<p>I have a page that renders slowly. The trip across the net is quick. The initial load of the page is quick. You can actually see (if your machine is slow enough), the initial layout of the html components. Then some javascript stuff runs, making some of those components all ajaxy. Then finally the css gets appl... | <p>Show the throbber before the code is run and hide it after.</p>
<p>Using JQuery:</p>
<pre><code>$("#throbber").show();
/* Your AJAX calls */
$("#throbber").hide();
</code></pre>
| <p>Take a look on: <a href="http://plugins.jquery.com/project/throbber" rel="nofollow">http://plugins.jquery.com/project/throbber</a></p>
| 46,590 |
<p>I use the app.config file to store some values (path to a mapping database, data connection selections). These settings differ on the user machines and I would like the installer to set them right. Is there an installer that can work with .NET config files during setup and allow me to create some dialogs that would ... | <p>We use WIX to change the application's configuration file. It works really well, you'll need to add wixUtilExtension.dll in the reference.</p>
<p>WIX sample:</p>
<pre><code><Component Id="ChangeConfig" Guid="[YOUR_GUID_HERE]">
<File Id="App.config" Name="MyApplication.exe.config" Vital="yes" KeyPath="... | <p>I've used the WIX toolset to produce an msi. The tool allows you to declaratively specify changes to XML files like app.config during installation. Problem is though there is a significant learning curve. Search sourceforge for wix. </p>
| 36,917 |
<p>I have defined an interface in C++, i.e. a class containing only pure virtual functions.</p>
<p>I want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so I declared a protected and non-virtual destructor for the interface, something like:</p>
<pre><code>class IT... | <p>It's more or less a bug in the compiler. Note that in more recent versions of the compiler this warning does not get thrown (at least in 4.3 it doesn't). Having the destructor be protected and non-virtual is completely legitimate in your case.</p>
<p>See <a href="http://www.gotw.ca/publications/mill18.htm" rel="nor... | <p>If the destructor is virtual it makes sure that the base class destructor is also called fore doing the cleanup, otherwise some leaks can result from that code. So you should make sure that the program has no such warnings (prefferably no warnings at all).</p>
| 15,506 |
<p>I am wondering what server control people generally use for surrounding and separating blocks of related controls and content in a Web Forms scenario. Often times I need to surround a block of HTML and related Server controls with a 'panel' that I can show or hide based upon some UI logic in the code behind. I am ... | <p>I don't think there is a single answer that is true for all scenarios - we don't have hundreds of tools so that we can always use a hammer.</p>
<p>Panels are great for when a resulting div will work just fine. PlaceHolder inherits from Control instead of WebControl so you could make the argument that it uses less ... | <p>Even with the PlaceHolder control, Visual Studio will complain that you don't have valid HTML.</p>
<p>You might grit your teeth and do it via server side code blocks that access properties on the code behind:</p>
<pre><code><table>
<tr>
....
</tr>
<% if( ShowSecretRow ) { %>
... | 28,091 |
<p>I have a simple interface:</p>
<pre><code>public interface IVisitorsLogController
{
List<VisitorsLog> GetVisitorsLog();
int GetUniqueSubscribersCount();
int GetVisitorsCount();
string GetVisitorsSummary();
}
</code></pre>
<p>the class VisitorsLogController implements this interface.</p>
<p... | <p>Out of interest, can you compile the following line:</p>
<pre><code>ctl = VisitorsLogController.Instance;
</code></pre>
<p>? I'm just wondering if somehow you've got two interfaces named the same thing.</p>
<p>What does Intellisense prompt you with when you type <code>ctl.</code> and press <kbd>Ctrl</kbd>-<kbd>Space... | <p>I would start by checking the namespaces on each of the files involved and make sure that you don't have a conflict or a namespace that you are not expecting.</p>
| 27,494 |
<p>Let's say you have a solution with two website projects, Website A and Website B. Now inside Website A's App_Code folder, there is a Class X defined in a ClassX.cs file. What do you do if Website B also needs access to ClassX.cs? </p>
<p>Is there any way to share this file across App_Code folders? Assume that m... | <p>Please please don't use these unholy website projects. Use Web Application projects instead, pack your shared classes into a library project and reference it from all your Web Applications.</p>
| <p>I don't believe that there is a way without moving ClassX into a new code library project. .NET requires all an assembly's dependencies to exist in the same folder as the assembly itself, or in the GAC, to be automatically detected. </p>
<p>You could try loading the assembly manually via the Reflection classes, a... | 11,384 |
<p>I've saved an entire webpage's html to a string, and now <b>I want to grab the "href" values</b> from the links, preferably with the ability to save them to different strings later. What's the best way to do this?</p>
<p>I've tried saving the string as an .xml doc and parsing it using an XPathDocument navigator, bu... | <p>I can recommend the <a href="http://www.codeplex.com/htmlagilitypack" rel="noreferrer">HTML Agility Pack</a>. I've used it in a few cases where I needed to parse HTML and it works great. Once you load your HTML into it, you can use <a href="http://msdn.microsoft.com/en-us/library/ms256115.aspx" rel="noreferrer">XPat... | <p>You might have more luck using xml if you know or can fix the document to be at least well-formed. If you have <em>good</em> html (or rather, xhtml), the xml system in .Net should be able to handle it. Unfortunately, good html is extremely rare.</p>
<p>On the other hand, regular expressions are <em>really bad</em... | 38,481 |
<p>I have a Duplicator i3 mini, which has yet to make it a month without breaking. This time it is extra broken because the filament is not extruding properly. the most successful print I've had yet had about a centimeter before turning into an absolute mess. I have a picture. It was not stringy, and had the exact shap... | <p>Underextrusion and clogs can also be caused by insufficient temperature in the hot end. You've not reference your temperatures, so consider to use a test model and print at different temperatures. Too low temps can result in the problem you present, while too hot temps will increase stringing and peculiar blobs on t... | <p>That looks like underextrusion as a result of a clog. Try cleaning the nozzle or replacing it.</p>
<p>See this link for more information about clogged nozzles.
<a href="https://3dprinting.stackexchange.com/questions/5191/if-i-have-a-nozzle-clog-can-i-easily-get-rid-of-it-by-simply-replacing-the-nozz">If I have a no... | 1,416 |
<p>In emacs there is a handy way to launch the gdb and gui options for gdb, the C debugger.</p>
<p>Is there a similar option in gvim?</p>
| <p>Have a look at the <a href="http://www.vim.org/scripts/script_search_results.php?keywords=gdb" rel="noreferrer">Vim script search</a>. I see at least 5 plugins that do what you want.</p>
| <p>I don't think there is. I use different windows.</p>
<p>The only thing I can think of is</p>
<pre><code>!gdb blah blah blah
</code></pre>
<p>but that may not be what you are looking for. It tends to be used to generate batch text that gets plugged back into the file you are editing.</p>
<p>Hope this helps.</p>... | 22,376 |
<p>I have an instance of Windows Web Server 2008. Do you know if it is possible to upgrade it toward "Windows Standard Server 2008"? (I mean without a complete reinstall and considering that I have the license to do that)</p>
| <p>it is possible if your server is x64:
<a href="https://serverfault.com/questions/10299/upgrading-windows-server-2008">https://serverfault.com/questions/10299/upgrading-windows-server-2008</a></p>
<p>and for vista is not a complete reinstall, what about <a href="http://en.wikipedia.org/wiki/Windows_Anytime_Upgrade" ... | <p>I'd be very surprised if it did. Even upgrades in Vista between versions is pretty much a complete reinstall.</p>
| 33,407 |
<p>do you know any not strict xpath for java? (I want it to not check dtd and schema) and it would be cool if it dont care about correct xml.</p>
| <p>You don't need to schema valid XML to use XPath. For non-well-formed XML, then I think you have two options:</p>
<ul>
<li>generate a valid DOM tree from the file. Suggest sucking the file through JTidy or TagSoup. Once you have that, you can use XPath as normal.</li>
<li>generate some other tree shaped model, then ... | <p>Ok, first of all, "correct xml" can be interpreted in a couple of ways. If you mean "non-well-formed" (missing angle brackets, overlapping elements, etc.), no version of xpath would likely do anything useful with that. You'd be better off with some sort of regular expressions. If your XML isn't well-formed, I hop... | 30,201 |
<p>What's a good method of programatically generating etag for web pages, and is this practice recommended? Some sites recommend turning etags off, others recommend producing them manually, and some recommend leaving the default settings active - what's the best way here?</p>
| <p>I recommend generating a hash of the the content, e.g. <code>md5($content)</code>.<br>
Additionally, to prevent hash collision, you might want to add e.g. the ID of the content element to it (if this is appropriate).</p>
| <p>ETags do help when you use some kind of caching mechanism in front of your website-generator. Browsers themselves do not use them, they listen to "(if) modified since" or "age" header structs, afaik.</p>
<p>Anyway, due to its simple nature it is no problem to provide a http-header with an ETag. I heard that many we... | 19,606 |
<p>How do I perform a network login, to access a shared driver for instance, programmatically in c#? The same can be achieved by either attempting to open a share through the explorer, or by the net use shell command.</p>
| <p>P/Invoke call to <a href="http://msdn.microsoft.com/en-us/library/aa385413(VS.85).aspx" rel="noreferrer">WNetAddConnection2</a> will do the trick. Look <a href="http://cticoder.wordpress.com/2008/08/11/msbuild-custom-task-drive-mapper/" rel="noreferrer">here</a> for more info.</p>
<pre><code>[DllImport("mpr.dll")]
... | <p>You'll need to use Windows Identity Impersonation, take a look at these links
<a href="http://blogs.msdn.com/shawnfa/archive/2005/03/21/400088.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/shawnfa/archive/2005/03/21/400088.aspx</a>
<a href="http://blogs.msdn.com/saurabhkv/archive/2008/05/29/windowsidentity-i... | 19,167 |
<p>At present it seems that VS2008 still isn't supported either in the 5.1.5 release or in the STLPort CVS repository. If someone has already done this work then it would be useful to share, if possible :)</p>
<p>Likewise it would be useful to know about the changes required for a VS2005 or 2008 x64 build.</p>
| <p><a href="http://blog.narahome.com/archive/200806" rel="nofollow noreferrer">Seems so</a>.</p>
| <p>It turns out that x64 support, whilst not explicitly stated, just works. If you set your environment up to use the x64 tools by running <code>\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat</code> then run configure.bat for your compiler and build as normal you end up with appropriate l... | 14,833 |
<p>What are some of the lesser know, but important and useful features of Windows batch files?</p>
<p>Guidelines:</p>
<ul>
<li>One feature per answer</li>
<li>Give both a short <strong>description</strong> of the feature and an <strong>example</strong>, not just a link to documentation</li>
<li>Limit answers to <stro... | <p>Line continuation:</p>
<pre><code>call C:\WINDOWS\system32\ntbackup.exe ^
backup ^
/V:yes ^
/R:no ^
/RS:no ^
/HC:off ^
/M normal ^
/L:s ^
@daily.bks ^
/F daily.bkf
</code></pre>
| <p>Extract random lines of text</p>
<pre><code>@echo off
:: Get time (alas, it's only HH:MM xM
for /f %%a in ('time /t') do set zD1=%%a
:: Get last digit of MM
set zD2=%zD1:~4,1%
:: Seed the randomizer, if needed
if not defined zNUM1 set /a zNUM1=%zD2%
:: Get a kinda random number
set /a zNUM1=zNUM1 * 214... | 30,443 |
<p>I'm working with an application that logs to Windows Application Log regularly (viewable through the Event Viewer administrative tool), and I'm looking for a way to back it up on a daily basis. This is important because we sometimes discover a problem with the application - and to investigate further we need informa... | <p>Here is a WMI script that I found a while ago. This could be what you're searching!</p>
<pre><code>dim strComputer = "." 'Define here the Remote IP Address or Computername
dim objWMIService
dim colLogFiles
dim objLogfile
dim errBackupLog
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=imperso... | <p>You might want to consider setting up one of the tools to forward windows events to a syslog server. Then instead of having to run a process that does the backup you will get all the log entries forwarded to a second location nearly at the same time they are added to the windows event log.</p>
<p><a href="http://n... | 49,068 |
<p>There is a similar question <a href="https://stackoverflow.com/questions/203495/testing-rest-webservices">here</a> but it only covers some of the issues below.</p>
<p>We have a client who requires web services using REST.</p>
<p>We have tons of experience using SOAP and over time have gathered together a really go... | <p>In terms of Java, there is the JAX-RS API, which is the Java Api for Xml using Restful Services or something like that. Basically, JAX-RS provides a more standard way to build RESTful services in Java.</p>
<p>There is also Restlet, which allows easily development of Restful services and is based on the JAX-RS speci... | <p>SoapUI, despite its name, can also support REST requests. Because REST usually does not supply anything like a WSDL, you are on your own creating the requests needed for your web interface though. Depending on the complexity of the REST webservice, this could be anything from trivial to demanding, but it should at l... | 39,048 |
<p>We have a common problem of moving our development SQL 2005 database onto shared web servers at website hosting companies.</p>
<p>Ideally we would like a system that transfers the database structure and data as an exact replica.</p>
<p>This would be commonly achieved by restoring a backup. But because they are sha... | <p>Scott Gu had written few posts on this topic :</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2007/04/19/update-of-sql-server-database-publishing-toolkit-for-web-hosting.aspx" rel="nofollow noreferrer">SQL Server Database Publishing Toolkit for Web Hosting</a> </p>
| <p>Check whether the webhsoting company provides <a href="http://mylittlebackup.com/mlb/en/spotlight.aspx" rel="nofollow">myLittleBackup</a>
This is definitively the easiest solution to "install" a db from the development server to the shared sql server</p>
| 30,423 |
<p>Tried to map it from Preferences -> Settings -> Keyboard, but the "key" combo box has only "forward delete" but no "delete". My keyboard on the other hand has only "delete" and no "forward delete"!</p>
<p>Is there some other way to do it except from the preferences?</p>
| <h1>Enable option key as meta key</h1>
<ol>
<li>Go to <code>Terminal</code> > <code>Preferences</code> > <code>Profiles</code> > <code>Keyboard</code></li>
<li>Check <code>Use option key as meta key</code>.</li>
</ol>
<h3>Image</h3>
<p>On macOS High Sierra 10.13.6, captured on October 23, 2018.</p>
<p><a href="http... | <p>With <code>Natural Text Editing</code> preset enabled in Profile -> Keys.
You can simply remove the word</p>
<ul>
<li>Backward with <code>alt + delete</code></li>
<li>Forward with <code>fn + alt + delete</code></li>
</ul>
| 42,470 |
<p>I am using the webbrowser control in visual studio. I think it is a wrapper around internet explorer. Anyway all is going well I am using it in edit mode however I can't get he document's keydown event to fire (in order to catch ctrl+v) anyone had similar problems with it?</p>
<p>Anyone have a solution?</p>
| <p>Indeed the webbrowser control is just a wrapper of the IE browser control.
Is your problem that the controls PreviewKeyDown not working? Seems to be working for me as long as the control has focus.</p>
<pre><code> webBrowser1.PreviewKeyDown += new PreviewKeyDownEventHandler(webBrowser1_PreviewKeyDown);
...... | <p><a href="http://support.microsoft.com/kb/320584" rel="nofollow noreferrer">How to trap keystrokes in controls by using Visual C#</a></p>
<p>e.g.</p>
<pre><code>protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if ... | 28,044 |
<p>How can my app get a valid "last time connected to domain" timestamp from Windows, even when the app is running offline?</p>
<p>Background:
I am writing an application that is run on multiple client machines throughout my company. All of these client machines are on one of the AD domains implemented by my company.... | <p>I don't believe this value is stored on the client machine. It's stored in Active Directory, and you can get a list of inactive machines using the <a href="http://technet.microsoft.com/en-us/library/cc730720.aspx" rel="nofollow noreferrer">Dsquery</a> tool.</p>
<p>The best option is to have your program do a simple... | <p>IMHO i dont think the client machine would store a timestamp of the last time it communicated with AD. This information is stored in active directory itself (ie. on the DC)</p>
<p>Once a user logs into say a Windows machine the credentials are cached. If that machine is disconnected from the network the credential... | 8,883 |
<p>How can I determine when the control key is held down during button click in a C# Windows program? I want one action to take place for Ctrl/Click and a different one for Click.</p>
| <p>And a little bit more:</p>
<pre><code>private void button1_Click ( object sender, EventArgs e )
{
if( (ModifierKeys & Keys.Control) == Keys.Control )
{
ControlClickMethod();
}
else
{
ClickMethod();
}
}
private void ControlClickMethod()
{
MessageBox.Sh... | <p>Assuming WinForms, use Control.ModifierKeys, eg:</p>
<pre><code>private void button1_Click(object sender, EventArgs e) {
MessageBox.Show(Control.ModifierKeys.ToString());
}
</code></pre>
<p>Assuming WPF, use Keyboard.Modifiers, eg:</p>
<pre><code>private void Button_Click(object sender, RoutedEventArgs e) {
... | 46,082 |
<p>I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ?</p>
<p>The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to... | <p>Databinding expects an IEnumerable object, because it enumorates over it just like a foreach loop does.</p>
<p>So to do this, just wrap your single object in an IEnumerable.</p>
<p>Even this would work:</p>
<pre><code>DataBindObject.DataSource = new List<YourObject>().Add(YourObjectInstance);
</code></pre>
| <p>Using this in my formView:</p>
<pre><code>databoundControl.DataSource = new [] { singleObject };
databoundControl.DataBind();
</code></pre>
| 7,099 |
<p>I have a pseudo-realtime data processing application where I would like to use <code>LazyInit<double></code> so I don't do calculations I don't need, but <code>LazyInit<T></code> restricts T to classes. I can work around it, but I'd obviously prefer not to.</p>
<p>Does anybody know why this is?</p>
| <p>The reason why is an underyling API choice in the LazyInit. It uses Interlocked.CompareExchange in order to do a thread safe value set. CompareExchange while generic is constrained to only use class types. Therefore the T value of LazyInit must also be a class. </p>
<p>You can view the implementation here: <a h... | <p>I believe it is because value types are automatically initialized and LazyInit determines if something needs initializing based on if it is null or not. You can get around it by using nullable types.</p>
<pre><code>LazyInit<double?>
</code></pre>
| 34,369 |
<p>I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this <code>program.exe -file.txt</code>) , but this way I can't debug. Is there somewhere I can specify the arguments for de... | <p>Yes, it's in the <em>Debugging</em> section of the properties page of the project.</p>
<p>In Visual Studio since 2008: right-click the <em>project</em>, choose <em>Properties</em>, go to the <em>Debugging</em> section -- there is a box for "Command Arguments". (Tip: not solution, but project).</p>
| <p>For those using VS2022 and you don't have launchSchema.json, as someone mentioned above, there is a solution for inserting <code>args</code> using <code>launchSettings.json</code>.</p>
<p>enter the file and insert your args using <code>"commandLineArgs": "</code>argument here<code>",</code></p>
<... | 38,247 |
<p>I am using BSD style pty/tty pairs to implement running a sub shell. When the user exits the sub shell, how do I detect in the master process that this has occurred? I am using select(nfds, &read_fds, NULL, NULL, &timeout); with the master pty file descriptor set in the read_fds on the master side.</p>
| <p>I've found the answer to this question by examining the telnetd source code found in the GNU inetutils package. In telnetd, they use a SIGCHLD handler like this:</p>
<pre><code>int status;
pid_t pid = waitpid((pid_t)-1, &status, WNOHANG);
syslog (LOG_INFO, "child process %ld exited: %d",
(long) pid, WEXITS... | <p>The subshell is typically created by a <code>fork()</code> of some sort. The PID of the child is returned to the master, which can check (with <code>waitpid()</code>, perhaps) if it's still running.</p>
| 33,122 |
<p>Consider these classes.</p>
<pre><code>class Base
{
...
};
class Derived : public Base
{
...
};
</code></pre>
<p>this function</p>
<pre><code>void BaseFoo( std::vector<Base*>vec )
{
...
}
</code></pre>
<p>And finally my vector</p>
<pre><code>std::vector<Derived*>derived;
</code></pre>
<p... | <p><code>vector<Base*></code> and <code>vector<Derived*></code> are unrelated types, so you can't do this. This is explained in the C++ FAQ <a href="http://www.parashift.com/c++-faq-lite/proper-inheritance.html#faq-21.3" rel="nofollow noreferrer">here</a>.</p>
<p>You need to change your variable from a <co... | <p>They are unrelated types -- you can't. </p>
| 14,012 |
<p>Right now I have the following in my <code>.vimrc</code>:</p>
<pre><code>au BufWritePost *.c,*.cpp,*.h !ctags -R
</code></pre>
<p>There are a few problems with this:</p>
<ol>
<li>It's slow -- regenerates tags for files that haven't changed since the last tag generation.</li>
<li>I have to push the enter button <e... | <p><code>au BufWritePost *.c,*.cpp,*.h silent! !ctags -R &</code></p>
<p>The downside is that you won't have a useful tags file until it completes. As long as you're on a *nix system it should be ok to do multiple writes before the previous ctags has completed, but you should test that. On a Windows system it won'... | <p>Auto Tag is a vim plugin that updates existing tag files on save.</p>
<p>I've been using it for years without problems, with the exception that it enforces a maximum size on the tags files. Unless you have a really large set of code all indexed in the same tags file, you shouldn't hit that limit, though.</p>
<p>No... | 18,802 |
<p>I'm looking for the best way to tell if an <code><mx:Image></code> has already fired the 'Event.COMPLETE' event. I want to do something if it has shown, or attach an event handler if it hasnt yet.</p>
<p>something like :</p>
<pre><code>if (newBackground.percentLoaded < 100)
</code></pre>
<p>or</p>
<pre... | <p>I'm assuming you for some reason can't attach an <code>Event.COMPLETE</code> event listener to the Image before it starts loading. If this is the case, you could always subclass <code>mx.controls.Image</code> and add your own property <code>"loadingCompleted"</code> or <code>"complete"</code> that is initially <code... | <p>Have you not subscribed to the Complete Event. Or the Progress Event? Are you using a Loader? I am sure in flex you can attach Event Handlers in the markup of the image for at least the Complete and progress. The Progress will give you totalBytes and bytesLoaded. </p>
<p>Cheers,
Andrew</p>
| 26,585 |
<p>What's proper way to connect ODBC datasources and execute some SQL statements?</p>
<p>TQuery and other BDE components can do it, but if I understood correctly they are now deprecated?</p>
| <p>You can use the ADO components:</p>
<p>1) Drag a TAdoConnection from the dbGo tab.</p>
<p>2) Right click and choose Edit connection string.</p>
<p>3) Click build</p>
<p>4) Select Microsoft OLE DB Provider for ODBC</p>
<p>5) Click Next</p>
<p>Then you will be able to select a database.</p>
<p>You can drag a TA... | <p>ADO (under the dbGo components component group) as well as dbExpress (under the dbExpress component group) come to mind.</p>
| 23,424 |
<p>Occasionally, on a ASP (classic) site users will get this error:</p>
<pre><code>[DBNETLIB][ConnectionRead (recv()).]General network error.
</code></pre>
<p>Seems to be random and not connected to any particular page. The SQL server is separated from the web server and my guess is that every once and a while the "... | <p>Using the same setup as yours (ie separate web and database server), I've seen it from time to time and it has always been a connection problem between the servers - typically when the database server is being rebooted but sometimes when there's a comms problem somewhere in the system. I've not seen it triggered by ... | <p>I'd seen this error many times. It could be caused by many things including network errors too :).</p>
<p>But one of the reason could be built-in feature of MS-SQL. </p>
<p>The feature detects DoS attacks -- in this case too many request from web server :).</p>
<p>But I have no idea how we fixed it :(.</p>
| 6,899 |
<p>I have a Product Class which has a one to many relationship to a Price class.
So a product can have multiple prices.</p>
<p>I need to query the db to get me 10 products which have Price.amount < $2. In this case its to populate a UI with 10 items in a page.
so i writ the following code:</p>
<pre><code>ICriteria... | <p>That would be up to the SQL to decide, depending on what happens in the methods that gets the list you need to change the SQL so that it behaves as you like.</p>
<p>But being Distinct, you shouldnt get any duplicates.</p>
| <p>Would the order of the statements make a difference? It looks like it's setting the maximum count early, and weeding out duplicates at the end, which applied in that order could end up with less than what you limited it to, consistent with what you described happening.</p>
<p>I would think you would need to effect... | 47,998 |
<p>Is there a way to force the flash garbage collector to clean up freed memory? I've seen that it takes a lot of time for flash to clean up not referenced memory...</p>
| <p>Unfortunately there isn't. It's something Grant Skinner has written lots about, so check <a href="http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html" rel="nofollow noreferrer">his blog</a>.</p>
| <p>You can add things to your own garbage collector and then whipe them as they complete.</p>
<pre><code>var antiGC:Dictionary = new Dictionary(false);
var loaderwidth:Tween = new Tween(maskbox, "width", Regular.easeIn, 1, 1000, 25, false);
antiGC[loaderwidth] = loaderwidth;
loaderwidth.addEventListener(TweenEvent... | 35,744 |
<p>I am currently looking for a way to be notified when a child is added to the visual or logical children.</p>
<p>I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event.</p>
<p>So, is there a way for th... | <p>Isn't it easier to extend </p>
<pre><code>System.Windows.Controls.UIElementCollection
</code></pre>
<p>to do the notification and use</p>
<pre><code>protected override UIElementCollection CreateUIElementCollection(FrameworkElement logicalParent)
</code></pre>
<p>?</p>
| <p>I believe that <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.loaded.aspx" rel="nofollow noreferrer">FrameworkElement.Loaded</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.unloaded.aspx" rel="nofollow noreferrer">FrameworkElement.Unloaded</a... | 24,559 |
<p>Any ideas how to determine the number of active threads currently running in an <a href="https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/ExecutorService.html" rel="noreferrer"><code>ExecutorService</code></a>?</p>
| <p>Use a <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html" rel="noreferrer">ThreadPoolExecutor</a> implementation and call <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html#getActiveCount()" rel="noreferrer">getActiveCount()</a> on it:... | <p>Place a static volatile counter on the thread which is updated whenever the thread is activated and deactivated.
Also, see the API.</p>
| 10,632 |
<p>Could anyone explain me finally what is the best strategy to implement transparent and fluent support of multi-tenant functionality in NHibernate powered domain model?</p>
<p>Im looking for the way, how to keep the domain logic as isolated as possible from the multi-tenant stuff like filtering by TenantID etc</p>
| <p>The simplest approach is to use different databases for each client.</p>
<p>Implementing multi-tenanting in this manner allows you to effectively write a single tenant application and only worry about the multi-tenanting at the point where you create / retrieve the session.</p>
<p>I haven't delved deep into the de... | <p><a href="http://www.ayende.com/Blog/archive/2008/08/06/Multi-Tenancy.aspx" rel="nofollow noreferrer">Ayende</a> has some good blog posts about building multi-tenancy apps. How NHibernate is used for it would depend on the type of multi-tenancy you are going for. </p>
| 11,731 |
<p>When querying with LDAP against our Active Directory structure to look up user accounts, some records (but not all) are missing certain key fields, specifically memberOf and userAccountControl (which has a bit flag that indicates whether the account is disabled or not).</p>
<p>Here's a few refining details:</p>
<u... | <p>You can check the permission on the specific field of the specific users with adsi edit. Somehow thay must have been changed, and you will have to restore them to default. Maybe they where changed in the ou level of some of the users. In this case you can mass fix them.</p>
| <p>What is of interest is that both the attributes you suggested are sort of read only. Member (attribute on a group) is maintained in Active Directory. The MemberOf value on a User is calculated based on a query, and is not actually statically stored on the user object. </p>
<p>I am pretty sure userAccountControl ... | 36,332 |
<p>I'm not at all familiar with VB.NET or ASP. I need to create a simple page which makes a call to a remote web service. I used the wsdl utility which comes with the DotNet SDK to generate a service proxy and write it to a VB file. Unfortunately I have no idea how to reference this code in either my ASPX file or the c... | <p>You need to add this code into your project so that it can be consumed. </p>
<p>Right click on your App_Code folder and select "Add Existing Item". This will bring up explorer. Use it to select the generated file and it will add it to your project.</p>
<p>Now you will be able to reference this code from within ... | <p>Or, instead of the wsdl utility:</p>
<p>In the solution explorer windows, r-click on the project, and select "add web reference". In the dialog that comes up, put in the url to the web service. In the web reference name box (lower right of that dialog), put in whatever you want to local alias for the service to be ... | 41,304 |
<p>How to run the first process from a list of processes stored in a file and immediately delete the first line as if the file was a queue and I called "pop"?</p>
<p>I'd like to call the first command listed in a simple text file with \n as the separator in a pop-like fashion:</p>
<p><em>Figure 1:</em></p>
<pre><cod... | <p>pop-cmd.py:</p>
<pre><code>#!/usr/bin/env python
import os, shlex, sys
from subprocess import call
filename = sys.argv[1]
lines = open(filename).readlines()
if lines:
command = lines[0].rstrip()
open(filename, "w").writelines(lines[1:])
if command:
sys.exit(call(shlex.split(command) + sys.argv[2... | <p>You can't write to the beginning of a file, so cutting out line 1 would be a lot of work (rewrite the rest of the file (which isn't actually that much work for the programmer (it's what every other answer post has written for you :) ) ) ).</p>
<p>I'd recommend keeping the whole thing in memory and using a classic s... | 47,838 |
<p>In java world you have log4j and a a pretty decent logging framework, is there anything like that for C#/.NET?</p>
| <p><a href="http://logging.apache.org/log4net/index.html" rel="nofollow noreferrer">log4net</a> would be the obvious answer.</p>
| <p>Look at TraceSources and TraceListeners. It is built into .NET and configured with the config file.</p>
| 22,444 |
<p>I am still at calibration stage and need some info from the PCB. I connected the USB and ran Repetier. The PCB wants to talk at a higher baud rate than my serial port says it can do. I tried setting the serial port to its highest setting 125k and reduced the PCB baud in Repetier setting to 125k. No joy. PC port reve... | <p>Sorted. Repetier Server was hijacking my com port. Uninstalled it and Repetier host worked fine. As I have no desire to monitor or control prints remotely I have no use for the server software.</p>
<p>Hope that helps others.</p>
| <p>My A8 just started doing this. </p>
<p>I shut down repetier server, and voila, all is good! Since I will go do OctoPi eventually, I just uninstalled RS.</p>
| 787 |
<p>I'm building a program that has a class used locally, but I want the same class to be used the same way over the network. This means I need to be able to make synchronous calls to any of its public methods. The class reads and writes files, so I think XML-RPC is too much overhead. I created a basic rpc client/server... | <p>If you're even considering Pyro, check out <a href="http://rpyc.wikidot.com/" rel="nofollow noreferrer">RPyC</a> first, and re-consider XML-RPC.</p>
<p>Regarding Twisted: try leaving the reactor up instead of stopping it, and just <code>ClientCreator(...).connectTCP(...)</code> each time.</p>
<p>If you <code>self.... | <p>If you are using Twisted you should probably know that:</p>
<ol>
<li>You will not be making synchronous calls to any network service</li>
<li>The reactor can only ever be run once, so do not stop it (by calling <code>reactor.stop()</code>) until your application is ready to exit.</li>
</ol>
<p>I hope this answers ... | 35,687 |
<p>Announced today at PDC. Initially made up of a Service Bus, the Workflow Service, and the Access Control Service. What are they? Why would I use them?</p>
| <p>I've looked at it a little. There's a few posts that convey a lot of meaning, I feel. This new wave of technologies really does look as 'big as NT' as is being reported in some circles.</p>
<p>In it's simplest form, map the current Microsoft server services for such solutions and imagine them hosted on Microsoft's ... | <p><a href="http://channel9.msdn.com/posts/Charles/John-Shewchuk-and-Dennis-Pilarinos-Inside-NET-Services/" rel="nofollow noreferrer">http://channel9.msdn.com/posts/Charles/John-Shewchuk-and-Dennis-Pilarinos-Inside-NET-Services/</a></p>
| 29,760 |
<p>How to set all the values in a <code>std::map</code> to the same value, without using a loop iterating over each value? </p>
| <p>Using a loop <em>is</em> by far the simplest method. In fact, it’s a one-liner:<sup>[C++17]</sup></p>
<pre><code>for (auto& [_, v] : mymap) v = value;
</code></pre>
<p>Unfortunately C++ algorithm support for associative containers isn’t great pre-C++20. As a consequence, we can’t directly use <code>std::fill</co... | <p>The boost::assign library has all sorts of neat stuff to help out initializing the contents of a container. My thought that this could be used to avoid explicitly iterating through the map. Unfortunately, maps are curious beasts difficult to initialize because the keys must be unique. The bottom line is that a si... | 16,856 |
<p>At <a href="http://java.sun.com/javase/downloads/index.jsp" rel="nofollow noreferrer">Java SE Downloads</a> I may for example download:</p>
<ul>
<li>Java SE Runtime Environment (JRE) 6 Update 10</li>
<li>Java SE Development Kit (JDK) 6 Update 10</li>
</ul>
<p>But I can't find any source code for update 10. If I cl... | <p>The asc(character) command will convert a character to it's ASCII value. </p>
<p>hex(asc(character)) will convert the character to it's HEX value.</p>
<p>Once you've done that you can easily do some comparisons to determine if the data is bad and toss the errors if required.</p>
<p>Here's some sample code:
<a hr... | <pre><code>Function IsGoodAscii(aString as String) as Boolean
Dim i as Long
Dim iLim as Long
i=1
iLim=Len(aString)
While i<=iLim
If Asc(Mid(aString,i,1))>127 then
IsGoodAscii=False
Exit Function
EndIf
i=i+1
Wend
IsGoodAscii=True
End Function
</code></pre>
| 32,866 |
<p>I have a project in subversion, which I'm developing using Eclipse. I did the original checkout from the svn repository from inside Eclipse. All was well for some weeks then for some unknown reason, Eclipse (specifically: subclipse in Ganymede) no longer recognizes my project as being under svn control. The team con... | <p>If you are using sublipse as your SVN provider I recommend doing the following</p>
<p>Team -> Share project is usually enough to connect the metadata.</p>
<p>(that is, assuming that the .svn files are still there which they seem to be if you can work on the command line).</p>
<p>Hope this helps as to why this wou... | <p>Same in my case: .svn dirs were there, but my project didn't support svn actions.</p>
<p>After a bit of poking it turned out that subversive plugin just disappeared after a forced quitting eclipse.</p>
<p>The solution was to (re)install subversive, and now everything is fine again.</p>
<p>Cheers
v.</p>
<p>UPDATE... | 20,074 |
<p>How can you create a C# Winforms control which goes out of the bounds of its region? Such as a drop down box. Kind of like if you had a DropDownBox in a Small Sized Panel.</p>
| <p>Windows Forms doesn't support windows like that well, it is pretty fundamentally incompatible with the designer. Here's some code to get you started. You can't use this control in the designer, it must be created at run-time. You also must call its Dispose() method yourself.</p>
<pre><code>using System;
using Sy... | <p>There is a good article here:</p>
<p><a href="http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/article.asp" rel="nofollow">http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/article.asp</a><a href="http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_... | 46,050 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.