instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm trying to connect from my Java application to a development server that has port 8088 closed which is used for RMI. I appreciate any help on how to open that port.</p>
| <p>Assuming </p>
<ul>
<li>you want to allow access from everywhere</li>
<li>you want to allow access via the first ethernet device (eth0) </li>
<li>you want to allow access to port 8088 using tcp</li>
</ul>
<p>then you could try running</p>
<blockquote>
<p>iptables -I INPUT -i eth0 -p tcp --dport 8088 -j ACCEPT</p... | <p>Slicehost have some good documentation on setting up iptables on Ubuntu:</p>
<ul>
<li><a href="http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1" rel="nofollow noreferrer">http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1</a></li>
<li><a href="http://articles.slicehost.com/2008/9/2/m... | 26,945 |
<p>I want to pass a reference type by value to a method in C#. Is there a way to do it.</p>
<p>In C++, I could always rely on the copy constructor to come into play if I wanted to pass by Value. Is there any way in C# except:
1. Explicitly creating a new object
2. Implementing IClonable and then calling Clone method.<... | <p>No, there is no copy-constructor equivalent in C#. What you are passing (by value) is a <em>reference</em>.</p>
<p><code>ICloneable</code> is also risky, since it is poorly defined whether that is deep vs shallow (plus it isn't very well supported). Another option is to use serialization, but again, that can quickl... | <p>take a look at <a href="http://www.codeproject.com/KB/cs/parameter_object_by_value.aspx" rel="nofollow">this</a></p>
<pre><code>public class Product
{
public string Name;
public string Color;
public string Category;
public Product(Product o)
{
this.Name=o.Name;
this.Color=o.Color;
... | 33,148 |
<p>Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language into Postgresql's PL/pgSQL stored procedure language?</p>
| <p>There is a tool available at <a href="http://ora2pg.darold.net/" rel="nofollow noreferrer">http://ora2pg.darold.net/</a> which can be used to transalate Oracle Schemas to Postgres schemas, but I'm not sure if it will also translate the stored procedures.
But it might provide a place to start.</p>
| <p>Use ora2pg to translate your schema. </p>
<p>For stored procedures: </p>
<ol>
<li>Manually convert all DECODE() to CASE statements and all old-style Oracle WHERE (+) outer joins to explicit LEFT OUTER JOIN statements. I haven't found a tool to do this.</li>
<li>Translate PL/SQL functions in PL/PGSQL (see below)... | 19,139 |
<p>We have a large C/C++ legacy source tree that has been around the block a few times. We expect there are a substantial number of methods no longer used. Is there a tool that can help us quickly identify the unused code?</p>
| <p>You should get a good static code analyzer.</p>
<p>Look around here for suitable option.</p>
<ol>
<li><a href="https://stackoverflow.com/questions/84109/is-there-any-free-c-code-coverage-tool-which-is-useful">Is there any free C++ code coverage tool which is useful?</a></li>
<li><a href="https://stackoverflow.com/... | <p>At work, we use <a href="http://www.automatedqa.com" rel="nofollow noreferrer">AQTime</a> for any profiling needs. It comes with a static analysis tool, which should be what you need. However, if you don't need the other profilers or run on a platform or compiler not supported by AQTime, it is overkill, money-wise a... | 18,108 |
<p>In c#</p>
<pre><code>double tmp = 3.0 * 0.05;
</code></pre>
<p>tmp = 0.15000000000000002</p>
<p>This has to do with money. The value is really $0.15, but the system wants to round it up to $0.16. 0.151 should probably be rounded up to 0.16, but not 0.15000000000000002</p>
<p>What are some ways I can get the corr... | <p>Use a fixed-point variable type, or a base ten floating point type like Decimal. Floating point numbers are always somewhat inaccurate, and binary floating point representations add another layer of inaccuracy when they convert to/from base two.</p>
| <p>'decimal' type was designed especially for this</p>
| 21,625 |
<p>I've got bunches of auxiliary files that are generated by code and LaTeX documents that I dearly wish <em>would not</em> be suggested by SpotLight as potential search candidates. I'm not looking for <code>example.log</code>, I'm looking for <code>example.tex</code>!</p>
<p>So can Spotlight be configured to ignore, ... | <p>@Will - these things that define types are called <a href="http://developer.apple.com/macosx/uniformtypeidentifiers.html" rel="nofollow noreferrer">uniform type identifiers</a>.</p>
<p>The problem is they are a combination of extensions (like .txt) and generic types (i.e. public.plain-text matches a txt file withou... | <p>The only option probably is to have them not indexed by spotlight as from some reason you cannot do negative searches. You can search for files with specifix file extension, but you cannot not search for ones that don't match.</p>
<p>You could try making those files invisible for Finder, Spotlight won't index invis... | 6,257 |
<p>Leaving aside the question of whether you should serve single or multiple stylesheets, assuming you're sending just one, what do you think of this as a basic structure?</p>
<p>/* Structure */</p>
<p>Any template layout stuff should be put into here, so header, footer, body etc.</p>
<p>/* Structure End */</p>
<p>... | <p>That's similar to how I structure mine, however, I find that using sub-headings is the best way to do it, so I use this structure:</p>
<p>/*************************
* GLOBAL *
*************************/</p>
<p>/* All of the common stuff goes here under the appropriate sub headings */</p>
<p>/* He... | <p>The structure you presented is exactly what I use. However, it seems to me that it still got too complex with new rules showing up and overriding each other... Perhaps I should try to stick to the solution suggested in the topic linked to by Adam instead.</p>
| 22,055 |
<p>Is there a way to check to see if an iPhone is online from a web app. That is, in mobile Safari, can I check the online status of the device to see if I should try an AJAX call or not.</p>
<p>In Firefox/regular WebKit, this would be:</p>
<pre><code>if(navigator.onLine)
{
onlineCode()
}
</code></pre>
| <p>That same code should work in the WebKit nightly build as of May 16th 2008. I guess that means you need to hope the 2.1 update included a new build of safari.</p>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=19105" rel="nofollow noreferrer">https://bugs.webkit.org/show_bug.cgi?id=19105</a></p>
| <p>That same code should work in the WebKit nightly build as of May 16th 2008. I guess that means you need to hope the 2.1 update included a new build of safari.</p>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=19105" rel="nofollow noreferrer">https://bugs.webkit.org/show_bug.cgi?id=19105</a></p>
| 9,201 |
<p>How do I send a cross-domain POST request via JavaScript?</p>
<p>Notes - it shouldn't refresh the page, and I need to grab and parse the response afterwards.</p>
| <p><strong>Update:</strong> Before continuing everyone should read and understand the <a href="http://www.html5rocks.com/en/tutorials/cors/">html5rocks tutorial</a> on CORS. It is easy to understand and very clear.</p>
<p>If you control the server being POSTed, simply leverage the "Cross-Origin Resource Sharing standa... | <p>Should be possible with a YQL custom table + JS XHR, take a look at:
<a href="http://developer.yahoo.com/yql/guide/index.html" rel="nofollow noreferrer">http://developer.yahoo.com/yql/guide/index.html</a></p>
<p>I use it to do some client side (js) html scraping, works fine
(I have a full audio player, with search... | 38,255 |
<p>This would be very handy as typecasting gets boring fast.</p>
| <p>If you use generics (java 5), you can avoid all casting with</p>
<pre><code> List<String> myList = new ArrayList<String>();
myList.add(" a test");
String temp = myList.get(0);
</code></pre>
<p>Unless I am missing something in your question that should cover both needs.</p>
| <p>I don't understand, what's so hard about:</p>
<pre><code>List<Foo> fooList = new ArrayList<Foo>();
</code></pre>
<p>I guess you could define a class:</p>
<pre><code>public class FooList extends ArrayList<Foo> {
...
}
</code></pre>
<p>if you want to avoid the angle brackets...</p>
| 48,955 |
<p>When trying to serialize a type (a generic <code>List<T></code> which T is a class marked with XmlRootAttribute) into XML using <code>XmlSerializer</code>, a <code>FileNotFoundException</code> is thrown (sometimes) and serialization fails.</p>
<p>It seems that <code>XmlSerializer</code> tries to create a temp... | <p>If you build with Visual Studio, there is an interesting option for you in the project properties.
On the Build-tab you chan choose to Generate Serialization Assemby (Yes, No, Auto).
If I remember correctly, I did not succeed in generating this assembly with 'Yes' to get rid of that exception. But once I had the imp... | <p>The last possibility here is that there is a big in the XML Serialization runtime. These were more common years ago, but it's possible there are still a few. What could happen was, given perfectly legal XML Serialization markup on your C# or VB (or other) code, creating an XmlSerializer for the type would cause i... | 42,633 |
<p>I have an Ant script that needs to checkout a directory from Subversion. This works using svnant/svnkit. However, Subversion access is authenticated, and I do not want to store my user password in a file.</p>
<p>Can I make svnkit pop up a password dialog?
Or even better, make it use the same credential caching tha... | <p>To answer my own question, I can use the Ant [input] task to ask the user for a password and store it in a property that can be passed to the [svn] task. </p>
<pre><code> <target name="checkout">
<input
message="Please enter subversion password for ${username}:"
addproperty="password"
... | <p>Use ant-dialog (<a href="http://sourceforge.net/projects/ant-dialog/" rel="nofollow noreferrer">http://sourceforge.net/projects/ant-dialog/</a>), it can display a java awt window so you can input properties. It also features a *** password like input field type. </p>
| 30,538 |
<p>What is the best way to structure a VB.NET <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">Windows Forms</a> application so that code can be reused and the application can be extended easily?</p>
<p>I used to create lots of new forms. This lead to lots of repeated code and forms which... | <p>I had great success with this <a href="http://www.martinfowler.com/eaaDev/PassiveScreen.html" rel="nofollow noreferrer">Passive Screen</a> pattern.</p>
<p>In my opinion, the big problem of the traditional MVC architecture is that people stuff way too much into the form classes. This increases the amount of manual t... | <p>I had great success with this <a href="http://www.martinfowler.com/eaaDev/PassiveScreen.html" rel="nofollow noreferrer">Passive Screen</a> pattern.</p>
<p>In my opinion, the big problem of the traditional MVC architecture is that people stuff way too much into the form classes. This increases the amount of manual t... | 33,171 |
<p>Do any apps/packages exist that will support writing to OS X's log database from external sources. I'm not too familiar with the specifics of the database, beyond the fact that you can view its contents from the Console app. I'm not even sure if it's just a version of some simple DB like SQLite or if it is some sort... | <p>I've never used OS X but you might want to look into the <a href="http://www.php.net/syslog" rel="nofollow noreferrer">syslog</a> function.</p>
| <p>OS X does use SQLite as part of CoreData. I am under the impressions that it is the primary means for storing data locally with OS X so I would expect it logs with it as well.</p>
| 21,055 |
<p>I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (<a href="https://stackoverflow.com/questions/247209/javascript-how-do-you-organize-this-mess">found in this question here</a>).</p>
<p>My problem is that the... | <p>Just want to add to what was mentioned previously that this:</p>
<pre><code>$.each(container.children(), function(j,w) {
$(w).unbind().change(function() { ... });
});
</code></pre>
<p>can be optimized to:</p>
<pre><code>container.children().unbind().change(function() { ... });
</code></pre>
<p>It's all about... | <p>Stick some of the anon functions into global scope functions (or your own "namespace" object), especially the re-used functions, and it begins to look less like what you posted. Kind of like what you linked to.</p>
| 31,373 |
<p>What non-GPL libraries are available for writing JSON-RPC servers and clients in native C++?</p>
<p>According to <a href="http://json-rpc.org/wiki/implementations" rel="noreferrer">http://json-rpc.org/wiki/implementations</a>, there seems to only exist one implementation of JSON-RPC for C++, namely <a href="http://... | <p><a href="http://sourceforge.net/projects/jsonrpc-cpp/" rel="nofollow noreferrer">JsonRpc-Cpp</a> is available as LGPLv3 since version 0.3 release 2011-05-06.</p>
| <p>I honestly know nothing about this, but came across it whilst searching for other serialization tools:</p>
<p><a href="http://realtimelogic.com/ba/doc/en/C/WebServices.html" rel="nofollow noreferrer">JSON-RPC and XML-RPC in C/C++</a></p>
| 31,842 |
<p>I want to parse a web page in Groovy and extract all of the href links and the associated text with it.</p>
<p>If the page contained these links:</p>
<pre><code><a href="http://www.google.com">Google</a><br />
<a href="http://www.apple.com">Apple</a>
</code></pre>
<p>the output would... | <p>Assuming well-formed XHTML, slurp the xml, collect up all the tags, find the 'a' tags, and print out the href and text.</p>
<pre><code>input = """<html><body>
<a href = "http://www.hjsoft.com/">John</a>
<a href = "http://www.google.com/">Google</a>
<a href = "http://www.stacko... | <p>Html parser + Regular expressions
Any language would do it, though I'd say Perl is the fastest solution.</p>
| 12,449 |
<p>I've got a form with a bunch of textboxes that are disabled by default, then enabled by use of a checkbox next to each one.</p>
<p>When enabled, the values in these textboxes are required to be a valid number, but when disabled they don't need a value (obviously). I'm using the jQuery Validation plugin to do this ... | <p>Using the "ignore" option (<a href="http://docs.jquery.com/Plugins/Validation/validate#toptions" rel="noreferrer">http://docs.jquery.com/Plugins/Validation/validate#toptions</a>) might be the easiest way for you to deal with this. Depends on what else you have on the form. For i.e. you wouldn't filter on disabled it... | <p>I don't know if this is what you were going for... but wouldn't changing .required to .wasReq (as a placeholder to differentiate this from one which maybe wouldn't be required) on checking the box do the same thing? If it's not checked, the field isn't required--you could also removeClass(number) to eliminate the er... | 49,768 |
<p><em>Information-Expert</em>, <em>Tell-Don't-Ask</em>, and <em>SRP</em> are often mentioned together as best practices. But I think they are at odds. Here is what I'm talking about.</p>
<p>Code that favors SRP but violates Tell-Don't-Ask & Info-Expert:</p>
<pre><code>Customer bob = ...;
// TransferObjectFactory... | <p>I don't think that they are so much at odds as they are emphasizing different things that will cause you pain. One is about structuring code to make it clear where particular responsibilities are and reducing coupling, the other is about reducing the reasons to modify a class.</p>
<p>We all have to make decisions e... | <p>I don't 100% agree w/ your two examples as being representative, but from a general perspective you seem to be reasoning from the assumption of two objects and only two objects.</p>
<p>If you separate the problem out further and create one (or more) specialized objects to take on the individual responsibilities you... | 20,456 |
<p>How can I change the class of an HTML element in response to an <code>onclick</code> or any other events using JavaScript?</p>
| <h2>Modern HTML5 Techniques for changing classes</h2>
<p>Modern browsers have added <a href="https://developer.mozilla.org/en-US/docs/DOM/element.classList" rel="noreferrer"><strong>classList</strong></a> which provides methods to make it easier to manipulate classes without needing a library:</p>
<pre><code>document.g... | <p>This is easiest with a library like jQuery:</p>
<pre><code><input type="button" onClick="javascript:test_byid();" value="id='second'" />
<script>
function test_byid()
{
$("#second").toggleClass("highlight");
}
</script>
</code></pre>
| 23,810 |
<p>When I add the textBox.TextChanged to watch list I get a message saying <pre>The event 'System.Windows.Forms.Control.TextChanged'
can only appear on the left hand side of += or -=</pre></p>
<p>Is there any way to check what event's are called on text change?</p>
| <p>We use Subversion for document management at work. It works great.</p>
<ul>
<li>Don't worry about the disk space. Revisions are stored compressed anyway.</li>
<li>Checking out a project with documentation doesn't take much more time than one without. Unless your documents are absolutely huge, this shouldn't be a pr... | <p>Subversion <strong>only</strong> stores the difference between revisions, which makes it very efficient. I'm not aware if this is true for binary files (such as Word or Excel files), however I believe it may be. If not, it may be to your advantage to use CSV files if possible instead of .XLS files and RTF files if p... | 30,061 |
<p>Is there a less resource intensive / faster way of performing this query (which is partly based upon: <a href="https://stackoverflow.com/questions/311390/mysql-a-search-a-select-of-multiple-rows-joining-and-all-in-one-query">This StackOverflow question</a> ). Currently it takes 0.008 seconds searching through only a... | <p>I would hope that the query optimizer would do this for you, but you might want to try doing the select on tags by user_id before doing the join just in case in the first subquery. This would reduce the number of rows that you would have to join across presumably. You also probably want to have indexes on auto_id ... | <p>It is difficult to be sure without the table definitions, but you might be able to rephrase the query as a simpler left join from LINKS to TAGS:</p>
<pre><code>select li.auto_id,
address,
title,
group_concat(ta.tag),
description,
keyword,
rating,
timestamp
... | 40,140 |
<p>I recently asked about <a href="https://stackoverflow.com/questions/39742/does-git-have-anything-like-svn-propset-svnkeywords-or-pre-post-commit-hooks">keyword expansion in Git</a> and I'm willing to accept the design not to really support this idea in Git. </p>
<p>For better or worse, the project I'm working on at... | <p>What's going on here: Git is optimized to switch between branches as quickly as possible. In particular, <code>git checkout</code> is designed to not touch any files that are identical in both branches.</p>
<p>Unfortunately, RCS keyword substitution breaks this. For example, using <code>$Date$</code> would require... | <p>You could set the ident attribute on your files, but that would produce strings like</p>
<pre><code>$Id: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef$
</code></pre>
<p>where <code>deadbeef...</code> is the sha1 of the blob corresponding to that file. If you really need that keyword expansion, and you need it in the gi... | 8,763 |
<p>I'm looking for clamps to fix the glass on my heatbed. After some search I found that some people use clamps printed of PLA. Can I use PLA clamps for a heated heatbed (~60 °C)? </p>
<p>I also tried foldback clips but they block my nozzle. The Anet A8 starts in the front left corner. When I start to print, the ... | <p>How about the Ultimaker clips? Ultimaker uses 2 mm heat bed and 4 mm glass, that should be within reach by bending the clips a bit. They have quite a low profile/footprint.</p>
<p><a href="https://i.stack.imgur.com/kdjTts.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kdjTts.jpg" alt="... | <p>Let's analyze the problem:</p>
<ul>
<li>We have a 5.5 mm total thickness.</li>
<li>We want to (semi)permanently affix the two layers together mechanically.</li>
<li>The clips shall not be higher than about 0.2 mm to allow the nozzle to pass over them.</li>
</ul>
<h1>(non)Solution attempt zero:</h1>
<p>Let's look at ... | 1,038 |
<p>If I try to insert data with a 20 digit primary key into a SQLite database I get an error with the second insert statement because it "is not unique".
If I select the values I can see from the SQLite commandprompt that the primary key is written in scientific notation.
The column type is decimal. Is there a way to ... | <p>insert it as a 'string', not a number.</p>
| <p>Strange, sounds like your wrapper is putting the number in as a float. I thought DECIMAL was mapped to an integer internally. Using a string would work but may be slow do to the indexing of the string rather than an int. </p>
| 24,794 |
<p>Ant has a nice way to select groups of files, most handily using ** to indicate a directory tree. E.g.</p>
<pre><code>**/CVS/* # All files immediately under a CVS directory.
mydir/mysubdir/** # All files recursively under mysubdir
</code></pre>
<p>More examples can be seen here:</p>
<p><a href="http:... | <p>As soon as you come across a <code>**</code>, you're going to have to recurse through the whole directory structure, so I think at that point, the easiest method is to iterate through the directory with os.walk, construct a path, and then check if it matches the pattern. You can probably convert to a regex by somet... | <p>Yup. Your best bet is, as has already been suggested, to work with 'os.walk'. Or, write wrappers around '<a href="http://docs.python.org/library/glob.html" rel="nofollow noreferrer">glob</a>' and '<a href="http://docs.python.org/library/fnmatch.html" rel="nofollow noreferrer">fnmatch</a>' modules, perhaps.</p>
| 19,557 |
<p>Is there a Python class that wraps the <code>file</code> interface (read, write etc.) around a string? I mean something like the <code>stringstream</code> classes in C++.</p>
<p>I was thinking of using it to redirect the output of <code>print</code> into a string, like this</p>
<pre><code>sys.stdout = string_wrapp... | <p>Yes, there is StringIO:</p>
<pre><code>import StringIO
import sys
sys.stdout = StringIO.StringIO()
print "foo", "bar", "baz"
s = sys.stdout.getvalue()
</code></pre>
| <p>For better performance, note that you can also use cStringIO. But also note that this isn't very portable to python 3.</p>
| 29,696 |
<p>In an effort to teach myself more about WPF, I'm trying to build a simple application. Where I work we have some hardware that has a bank of 8 dip switches used for setting an address from 0 to 255 (as an 8-bit number). It's a simple concept that I would like to build into a WPF windows application that would allow ... | <p>You can easily create a DIP switch control by replacing the template of a CheckBox, if you want to know how to create your own templatable controls read "Templates for Uncommon Controls" by Charles Petzold at <a href="http://msdn.microsoft.com/en-us/magazine/cc135986.aspx" rel="nofollow noreferrer">http://msdn.micro... | <p>One way you could do this is to use the Control Template to customize the appearance of the WPF RadioButton class. The code for the RadioButton Control Template is <a href="http://msdn.microsoft.com/en-us/library/ms751600.aspx" rel="nofollow noreferrer">available on msdn</a>.</p>
<p>You should be able to create yo... | 45,653 |
<p>I'm writing a reasonably complex web application. The Python backend runs an algorithm whose state depends on data stored in several interrelated database tables which does not change often, plus user specific data which does change often. The algorithm's per-user state undergoes many small changes as a user works w... | <p>Be cautious of premature optimization.</p>
<p>Addition: The "Python backend runs an algorithm whose state..." is the session in the web framework. That's it. Let the Django framework maintain session state in cache. Period. </p>
<p>"The algorithm's per-user state undergoes many small changes as a user works wi... | <p>Another option is to review the requirement for state, it sounds like if the serialisation is the bottle neck then the object is very large. Do you really need an object that large?</p>
<p>I know in the Stackoverflow podcast 27 the reddit guys discuss what they use for state, so that maybe useful to listen to. </... | 42,794 |
<p>Inspired by the question <a href="https://stackoverflow.com/questions/301546/whats-the-simplest-way-to-call-http-get-url-using-delphi">What’s the simplest way to call Http GET url using Delphi?</a>
I really would like to see a sample of how to use POST. Preferably to receive XML from the call.</p>
<p>Added: What ab... | <p>Using Indy. Put your parameters in a StringList (name=value) and simply call Post with the URL and StringList.</p>
<pre><code>function PostExample: string;
var
lHTTP: TIdHTTP;
lParamList: TStringList;
begin
lParamList := TStringList.Create;
lParamList.Add('id=1');
lHTTP := TIdHTTP.Create;
try
Resu... | <p>Again, <a href="http://synapse.ararat.cz/doku.php/download" rel="noreferrer">Synapse TCP/IP library</a> to the rescue. Use the HTTPSEND routine <a href="http://synapse.ararat.cz/doc/help/httpsend.html#HttpPostURL" rel="noreferrer">HTTPPostURL</a>.</p>
<pre><code>function HttpPostURL(const URL, URLData: string; con... | 38,763 |
<p>I have an application that needs to "poll" a webservice to see if the user has any new messages waiting. I have no control over the webservice so I cannot switch to a "push" mechanism, I'm stuck making a request every X number of seconds to see what's available.</p>
<p>I am using a System.Threading.Timer to make t... | <p>Hate to answer my own question, but I was pointed to <a href="http://blog.opennetcf.com/ctacke/PermaLink,guid,169fcc25-a42f-4a8f-b8af-6b6c85d8819d.aspx" rel="nofollow noreferrer" title="this">this</a>, which was able to perform even when the device is asleep. Looks like it's working perfectly.</p>
| <p>Although you can't modify the webservice, you might be able to add a second "shadow" webservice in between your clients and the original webservice. The shadow webservice could poll the original webservice and then "push" anything it finds out to the PDAs.</p>
<p>I think you might still have the same problem, thou... | 36,066 |
<p>Let's say I have a drive such as <strong>C:\</strong>, and I want to find out if it's shared and what it's share name (e.g. <strong>C$</strong>) is.</p>
<p>To find out if it's shared, I can use <a href="https://learn.microsoft.com/en-us/windows/desktop/api/Lmshare/nf-lmshare-netsharecheck" rel="nofollow noreferrer"... | <p>If all else fails, you could always use <a href="https://learn.microsoft.com/en-us/windows/win32/api/lmshare/nf-lmshare-netshareenum" rel="nofollow noreferrer">NetShareEnum</a> and call <a href="https://learn.microsoft.com/windows/desktop/api/lmshare/nf-lmshare-netsharegetinfo" rel="nofollow noreferrer">NetShareGetI... | <p>Use;</p>
<pre><code>SHGetFileInfo with SHGFI_ATTRIBUTES
</code></pre>
<p>upon return check the dwAttributes flag for SFGAO_SHARE.</p>
<p>I'm not sure how to find the actual path tho.</p>
| 3,365 |
<p>Why isn't there a logout button? Why no list of "websites you're logged into"? Is it because of some issue with the HTTP specs?</p>
<p>Life would be much easier for web developers if they could actually rely on HTTP auth ...</p>
| <p>As far as HTTP is concerned, it is <a href="http://www.webopedia.com/TERM/H/HTTP.html" rel="nofollow noreferrer">stateless</a>. One of the main reasons why Internet is scalable.</p>
| <p>Because it's not the browser that "knows" it's logged in. It's the server which authenticates the browser on every request. Every server can have different authentication mechanism - using different names and content for the authentication cookies, basic authentication, etc.</p>
| 29,128 |
<p>What fan speed should I use with PLA? Do I need to manually set the fan speed in ‘Control’?</p>
<p>Also, on the filament cartridge Bed Temp is listed: <em>"No heat/60-80 °C"</em>. Does this mean heating the bed is optional?</p>
| <p>Most commercial blow-molded fuel tanks for model airplane fuel (methanol or ethanol, nitromethane or nitroethane, and some combination of castor, mineral, or synthetic lubricating oil) are made from HDPE. This material isn't commonly seen as filament, in my limited experience, but it ought to be possible to arrive ... | <p>As a supplement to the answer (doesn't fit well in the comments). This site <a href="https://www.filamentive.com/chemical-resistance-of-3d-printing-filament/" rel="nofollow noreferrer">https://www.filamentive.com/chemical-resistance-of-3d-printing-filament/</a> lists PETG has have a very high restance to alcohol, a... | 1,949 |
<p>Anyone know if it is possible to write an app that uses the Java Sound API on a system that doesn't actually have a hardware sound device?</p>
<p>I have some code I've written based on the API that manipulates some audio and plays the result but I am now trying to run this in a server environment, where the audio w... | <p>Yes, assuming the HTTP server you're talking to supports/allows this:</p>
<pre><code>public long GetFileSize(string url)
{
long result = -1;
System.Net.WebRequest req = System.Net.WebRequest.Create(url);
req.Method = "HEAD";
using (System.Net.WebResponse resp = req.GetResponse())
{
if (... | <pre><code> HttpClient client = new HttpClient(
new HttpClientHandler() {
Proxy = null, UseProxy = false
} // removes the delay getting a response from the server, if you not use Proxy
);
public async Task<long?> GetContentSizeAsync(string url) {
using (HttpResponse... | 14,950 |
<p>In a C++ app, I have an hWnd pointing to a window running in a third party process. This window contains controls which extend the COM TreeView control. I am interested in obtaining the CheckState of this control.<br>
I use the hWnd to get an HTREEITEM using TreeView_GetRoot(hwnd) from commctrl.h</p>
<p>hwnd points... | <p>We have these definitions from CommCtrl.h:</p>
<pre><code>#define TreeView_SetItemState(hwndTV, hti, data, _mask) \
{ TVITEM _ms_TVi;\
_ms_TVi.mask = TVIF_STATE; \
_ms_TVi.hItem = (hti); \
_ms_TVi.stateMask = (_mask);\
_ms_TVi.state = (data);\
SNDMSG((hwndTV), TVM_SETITEM, 0, (LPARAM)(TV_ITEM *)&_ms_T... | <p>Why are you not using a Windows Forms TreeView control? If you are using this control, set the control's CheckBoxes property to true to enable check boxes, and set the Checked property on the nodes you want to display checked.</p>
<p>To get the collection of root nodes, use the TreeView's Nodes property. This retur... | 10,362 |
<p>I'm getting the following exception when saving an object:</p>
<blockquote>
<p>Found shared references to a collection</p>
</blockquote>
<p>Does anyone know what this means?</p>
| <p><a href="http://forum.hibernate.org/viewtopic.php?p=2273553" rel="nofollow noreferrer">quick google says</a> </p>
<pre><code> rel Group n --- 1 User
m ^
| | inh
| rel |
--------- n Member
</code></pre>
<blockquote>
<p>rel stands for relation ... | <p>Do you have a reference to any of the objects in the collection somewhere else? Another session, possibly, or even within the same session in another object? Make sure that when you access hibernate, you are controlling the ONLY reference to those objects within any hibernate session.</p>
| 47,364 |
<p>I am trying to get some XML data with LINQ, but running into a problem.</p>
<p>I am using a schema, which is set in the attribute xmlns ...</p>
<pre><code><CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd">
<CarForSale>
</code></pre>
<p>There are many CarForSale elements.</p>
<p>When t... | <p>You need to prepend the namespace:</p>
<pre><code>var ns = "http://schemas.sharplogic.net/CarSales.xsd";
var cars2 = from d in doc.Descendants(ns + "CarForSale")
select d;
</code></pre>
<p>otherwise search by local name:</p>
<pre><code>var cars2 = from d in doc.Descendants()
... | <p>To avoid hard coding the namespace you can use this:</p>
<pre><code>XNamespace ns = doc.Root.Name.Namespace;
</code></pre>
| 21,418 |
<p>I just want to create a C# program which will read a word template and create n number of copies of it with mail merge feature.The data to replace is Name and Address the rest of the things in the template should remains the same. Can any one tell me how to do this ?</p>
| <p>You can use Aspose.Word for handling the Word Object model without having to have office installed (to use interop) where the program is supposed to run, i'm using Aspose.Word to generate word documents.</p>
<p>Link to Aspose: <a href="http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-a... | <p>I am not sure whether you wish to run a mailmerge or to copy a template. I cannot help you with c#, but this snippet of VBA might give you some ideas.</p>
<pre><code> strDir = CurrentProject.Path
strMailmergeDataFilename = strDir & Format(Now, "yymmdd_hhnnss") & ".txt"
' Create CSV from database for us... | 38,204 |
<h3>Note</h3>
<p>This is not a REBOL-specific question. You can answer it in any language.</p>
<h3>Background</h3>
<p>The <a href="http://www.rebol.com" rel="nofollow noreferrer">REBOL</a> language supports the creation of domain-specific languages known as "dialects" in REBOL <em>parlance</em>. I've created such a ... | <p>How about something like this:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
my @list1 = qw(1 2);
my @list2 = qw(3 4);
my @list3 = qw(5 6);
# Calculate the Cartesian Product
my @cp = cart_prod(\@list1, \@list2, \@list3);
# Print the result
foreach my $elem (@cp) {
print join(' ', @$elem), "\n";
}
... | <p><strong>EDIT:</strong> This solution doesn't work. Robert Gamble's is the correct solution.</p>
<p>I brainstormed a bit and came up with this solution:</p>
<p>(I know most of you won't know REBOL, but it's a fairly readable language.)</p>
<pre>
REBOL []
sets: [[1 2 3] [4 5] [6]] ; Here's a set of sets
elems: 1
r... | 26,538 |
<p>I'm using GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu). And this command:</p>
<pre><code>echo "-e"
</code></pre>
<p>doesn't print anything. I guess this is because "-e" is one of a valid options of echo command because echo "-n" and echo "-E" (the other two options) also produce empty strings.</... | <p>This is a tough one ;)</p>
<p>Usually you would use double dashes to tell the command that it should stop interpreting options, but echo will only output those:</p>
<pre><code>$ echo -- -e
-- -e
</code></pre>
<p>You can use -e itself to get around the problem:</p>
<pre><code>$ echo -e '\055e'
-e
</code></pre>
<... | <pre><code>/bin/echo -e
</code></pre>
<p>works, but why?</p>
<pre><code>[resin@nevada ~]$ which echo
/bin/echo
</code></pre>
| 41,433 |
<p>Is there a way to speed up the rendering of Polylines in Google Maps when using Internet Explorer (7)? My map loads quickly in other browsers.</p>
<p>I've encoded the Polylines as described here - <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/" rel="nofollow noreferrer">http://facstaff.unca.e... | <p>The ie7 is slower than firefox3 (and ie6 is slower than ie7) to render large and complex polylines with Javascript.</p>
<p>There could be some minor tricks to speed up the rendering, (smooth the lines before rendering, adjusting for zoomlevel and such).</p>
<p>One trick is maybe to create a kml instead and leave o... | <p>This is probably because ie doesn't support canvas or svg or whatever it is that google maps uses to draw the lines. To get around this, the line data is sent to google, and they turn it into an image that is then downloaded and displayed.</p>
| 41,441 |
<p>Could someone tell me if its possible to add a policy to create default columns in a table schema using the SQL 2008 Policy management features</p>
<p>So for example I may have a desire to have a Date column in all of my tables called CreateDate and no DBA could create a table without a column of type datetime with... | <p>The Declarative Management Framework won't create a column for you (although that could be nifty!) </p>
<p>Also there isn't a facit for Column properties, like there is for Table. You might be able to make the Multipart Name facit do it, but nothing comes to me off the top of my head.</p>
<p>One thing to note ab... | <p>Im not familiar with using PBM to do this but you could definitely do such a check by using a database level DDL trigger. See BOL <a href="http://msdn.microsoft.com/en-us/library/ms190989.aspx" rel="nofollow noreferrer">here</a>.</p>
| 27,913 |
<p>As I put together each asp.net page It's clear that most of the time I could use the standard HTML tags just as easily as the web forms controls. When this is the case what is the lure of the webforms controls?</p>
| <p>HTML controls will be output a lot faster than server controls since there is nothing required on part of the server.. It just literally copies the markup in the ASPX page.</p>
<p>Server controls however require instantiation.. Parsing of the postback data and the like, this is obviously where the work comes in for... | <p>Webform controls have more server-side pre-built functionality (server side hooks, methods and attributes), I tend to use HTML controls only when I require a high degree of formatting (styling) as that bypasses the way .Net renders it's controls (which, at times, can be very strange).</p>
| 9,565 |
<p>Have just started using Visual Studio Professional's built-in unit testing features, which as I understand, uses MS Test to run the tests.</p>
<p>The .trx file that the tests produce is xml, but was wondering if there was an easy way to convert this file into a more "manager-friendly" format?</p>
<p>My ultimate go... | <p>Since this file is XML you could and should use xsl to transform it to another format. The <em>IAmUnkown</em> - blog has an entry about <a href="http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html" rel="noreferrer">decoding/transforming the trx file into html</a>. </p>
<p>You can also use <a href... | <p>Recently I wrote one trx to html convertor which is python based, have a look
<a href="https://github.com/avinash8526/Murgi" rel="nofollow">https://github.com/avinash8526/Murgi</a></p>
| 4,342 |
<p>I like the idea of CardSpace but unlike OpenID it seems like a real PITA
to support it in your ASP.NET web application. I've found many examples, even a tutorial
in one of the books I own... but it would seem a lot more is required than what they suggest.</p>
<p>Changes to the server and such? </p>
<p>Can someone ... | <p>I have blogged about that, but it is in Swedish. I hope we can rely on google translate. :-)</p>
<p><a href="http://translate.google.com/translate?u=http%3A%2F%2Fweblogs.asp.net%2Fmikaelsoderstrom%2Farchive%2F2008%2F09%2F08%2Fwindows-cardspace-kom-ig-229-ng.aspx&hl=sv&ie=UTF-8&sl=sv&tl=en" rel="nofo... | <p>Rob Conery is implementing CardSpace in his new project.<br>
<a href="http://blog.wekeroad.com/mvc-storefront/mvcstore-part-17/" rel="nofollow noreferrer">http://blog.wekeroad.com/mvc-storefront/mvcstore-part-17/</a></p>
<p>Hope it helps</p>
| 36,459 |
<p>When Mac OS X goes to sleep, due to closing a laptop or selecting "Sleep" from the Apple menu, how does it suspend an executing process?</p>
<p>I suppose non-windowed processes are simply suspended at an arbitrary point of execution. Is that also true for Cocoa apps, or does the OS wait until control returns to th... | <p>Your app is interrupted exactly where it is that moment if the CPU is actually currently executing code of your app. Your app constantly gets <em>execution time</em> by the task scheduler, that decides which app gets CPU time, on which core, and for how long. Once the system <em>really</em> goes to sleep, the schedu... | <p>And if you set the time it also appears to leap forward to the running programs. Nothing special either.</p>
| 14,245 |
<p>I want to create a combobox in flex which will take three values, Available, Unavailable, and Busy. The constraint is, I should not allow user to go directly from Unavailable to Busy. So when a User is selected Unavailable, I should keep the Busy item disabled (unselectable), but a user will be able to go directly f... | <p>I dislike rule CA1021: Avoid out parameters. Out parameters are useful for many different patterns (including the .Net Try* pattern). Out can certainly be overused but really it seems overkill to have an FxCop rule for it. </p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms182131(VS.80).aspx" rel="nofollo... | <p>It complains about "ID" and suggests "Id"... even though that follows the "two-character-abbreviations-are-all-capped" rule :O)</p>
| 32,105 |
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p>
<p>Just to avoid the "... | <p>You may also want to consider using <a href="http://www.pyglet.org/" rel="noreferrer">Pyglet</a> instead of PyOpenGL. It's a ctypes-wrapper around the native OpenGL libs on the local platform, along with windowing support (should handle most of the stuff you want to use GLUT for.) The <a href="http://groups.google.c... | <p>We have neither ideas about random segmentation faults. There is not enough information. What python libraries are you using for opengl? How do you use them? Can you show us your code? It's probably something trivial but my god -skill ends up to telling me just and only that.</p>
<p>Raytracer in python? I'd prefer ... | 29,963 |
<p>As a programmer I found it very hard to use my laptop and workstation with two different input devices, Can anyone suggest a good solution to use single mouse and keyboard to control my two machines</p>
<p>I am not looking for a Virtual Machine or RDP solution to see my machines in a single monitor,</p>
| <p><a href="http://synergy-foss.org/" rel="nofollow noreferrer">Synergy.</a></p>
<blockquote>
<p><em>Synergy lets you easily share a single mouse and keyboard between
multiple computers with different
operating systems, each with its own
display, without special hardware.
It's intended for users with multipl... | <p>I used to use a KVM switch, but lately I've started running all my computers as virtual machines on a single hardware platform. Each "system" is a window on my desktop!</p>
| 20,267 |
<p>As you may or may not know, this is the third iteration of a proposal site that covers 3D Printing. The first 2 made it to the beta phase, but did not graduate from the beta successfully:</p>
<ul>
<li><a href="http://area51.stackexchange.com/proposals/41850/digital-fabrication">Digital Fabrication</a></li>
<li><a ... | <p>If someone has a question from one of those older sites, they should go ahead and ask it. But a wholesale importing of content from elsewhere is not really a desirable way to build this site. </p>
<p>There is a lot of ownership and careful curation that goes with vetting the content of this site. Questions imported... | <p>Although I was sad to see the <a href="http://area51.stackexchange.com/proposals/41850/digital-fabrication">Digital Fabrication</a> beta close, I think there would be little to be gained by trying to import it's questions. The scope was different, and it was a very different group of comitters - only 1.8% of <a href... | 18 |
<p>Is there a list of 3D cards available that provide full scene antialiasing as well as which are able to do it in hardware (decent performance)?</p>
| <p>Pretty much all cards since DX7-level technology (GeForce 2 / Radeon 7000) can do it. Most notable exceptions are Intel cards (Intel 945 aka GMA 950 and earlier can't do it; I think Intel 965 aka GMA X3100 can't do it either).</p>
<p>Older cards (GeForce 2 / 4MX, Radeon 7000-9250) were using supersampling (render e... | <p>Having seen a pile of machines recently that don't do it, I don't think that's quite true. The GMA 950 integrated ones don't do it to start with, and I don't think that the 3100/X3100 do either (at least not in hardware... the 3100 was enormously slow in a demo). Also, I don't believe that the GeForce MX5200 suppo... | 4,896 |
<p>In a legacy project that I'm on, we have several processing that are preformed via DTS. DTS is not something I worked with a lot back in its hey day.... I was in college. </p>
<p>More specificity, these process are in ActiveX code blocks -- which is basically VBScript for database. It is really hard to debug. </p>
... | <p>I had a complex DTS package that imported some data, ran some batch scripts, made a CSV file and uploaded the resulting output via FTP. Sometimes the FTP process would fail.</p>
<p>I created a "DTS LOG" table and after each step I simply added a SQL insert task and wrote a time stamp and function name into the tabl... | <p>In the scripting portion, I have used the MsgBox to display "I got here" or "xfer worked" or whatever you want to indicate something happened which is not so obvious at run time.</p>
<p>You can also use conditional statements to branch off to an 'End' if you are testing a particular portion of the flow.</p>
<p>If ... | 40,627 |
<p>A <code>TextBox</code> is set to <code>AutoPostback</code> as changing the value should cause a number of (display-only) fields to be recalculated and displayed.<br>
That works fine.</p>
<p>However, when the field is tabbed out of, the focus briefly moves on to the next field, then disappears when the page is redra... | <p>This is "by design". If you are using ASP.NET 2.0+ you can try calling the Focus method of your TextBox once the postback occurs (preferably in the TextChanged event of the TextBox).</p>
<p>I am not sure if there is any built-in way to track focus but I found <a href="http://www.codeproject.com/KB/aspnet/MainatinFo... | <p>You could also consider refresh display-only fields using AJAX <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx" rel="nofollow noreferrer">UpdatePanel</a>. This way you won't lose focus from the new field.</p>
<p>Also I have proposed pure server-side <a href="https://stackoverflow.com... | 20,943 |
<p>We need to optimize the text rendering for a C# <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application displaying a large number of small strings in an irregular grid. At any time there can be well over 5000 cells visible that update 4 times per second. The font family ... | <p>A Microsoft developer has posted a <a href="http://blogs.msdn.com/cjacks/archive/2006/05/19/602021.aspx" rel="noreferrer">GDI vs. GDI+ Text Rendering Performance</a> article on his blog which answers the raw speed question: on his system, GDI DrawText was about 6 times faster than GDI+ DrawString.</p>
<p>If you nee... | <p>From recent experience, fastest text output is achieved via <code>ExtTextOut</code> with <code>ETO_GLYPH_INDEX</code> flag. This comes at a price, and it’s that you aren’t printing characters anymore, but font glyphs directly. This means that you need to translate your regular character strings to glyph indexes stri... | 9,686 |
<p>Maven 2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development.</p>
<p>I have a <code>pom.xml</code> file that defines the dependencies for the web-app framework I want to use, and I can quickly generate starter projects from that file. However, sometimes I want to link to a 3r... | <p><strong>For throw away code only</strong></p>
<p>set scope == system and just make up a groupId, artifactId, and version</p>
<pre class="lang-xml prettyprint-override"><code><dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>0.9.2&... | <p>This doesn't answer how to add them to your POM, and may be a no brainer, but would just adding the lib dir to your classpath work? I know that is what I do when I need an external jar that I don't want to add to my Maven repos. </p>
<p>Hope this helps.</p>
| 47,536 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/574463">Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine</a> </p>
</blockquote>
<p>Is there a way to have Internet Explorer 8 and Internet Explorer 6 side by side wi... | <p>I also use virtualisation. I've got <a href="http://en.wikipedia.org/wiki/Windows_Virtual_PC" rel="nofollow noreferrer">Virtual PC</a> 2007, which is a free download from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=04D26402-3199-48A3-AFA2-2DC0B40A73B6&displaylang=en" rel="nofollow noreferre... | <p>What I do is use VMware with other OS with IE6.</p>
<p>Not perfect, but it helps.</p>
| 16,359 |
<p>What is the best way to deal with XML documents, XSD etc in C# 2.0? </p>
<p>Which classes to use etc. What are the best practices of parsing and making XML documents etc. </p>
<p>EDIT: .Net 3.5 suggestions are also welcome.</p>
| <p>The primary means of reading and writing in C# 2.0 is done through the <strong>XmlDocument</strong> class. You can load most of your settings directly into the XmlDocument through the XmlReader it accepts.</p>
<h3>Loading XML Directly</h3>
<pre><code>XmlDocument document = new XmlDocument();
document.LoadXml("<... | <p>Cookey's answer is good... but here are detailed instructions on how to create a strongly typed object from an XSD(or XML) and serialize/deserialize in a few lines of code:</p>
<p><a href="http://www.stevehorn.cc/#!/blog/generate-code-from-xml-schema-xsdexe" rel="nofollow noreferrer" title="Instructions">Instructio... | 27,207 |
<p>One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done).</p>
<p>I'm having a hard time finding resources/guides that take you past writing a simple "Hello World" OS.</p>
<p>I know ... | <p>There are a lot of links after this <a href="http://www.osix.net/modules/article/?id=359" rel="noreferrer">brief overview</a> of what is involved in writing an OS for the X86 platform.</p>
<p>The link that appears to be most promising (www.nondot.org/sabre/os/articles) is no longer available, so you'll need to poke... | <p>Intresting Question for the programmers. See it will take long long long time to build OS like Windows or Mac but if you want build a simple ones then you can try your best</p>
<ol>
<li>You need to focus on Assembly Language,C and C++. You should be expert in these languages.</li>
<li>First read a good book on how ... | 6,475 |
<p>Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.</p>
<p>What methods can the calling window use to make sure the new window launched properly?</p>
| <p>If you use JavaScript to open the popup, you can use something like this:</p>
<pre><code>var newWin = window.open(url);
if(!newWin || newWin.closed || typeof newWin.closed=='undefined')
{
//POPUP BLOCKED
}
</code></pre>
| <p>By using onbeforeunload event we can check as follows</p>
<pre><code> function popup()
{
var chk=false;
var win1=window.open();
win1.onbeforeunload=()=>{
var win2=window.open();
win2.onbeforeunload=()=>{
chk=true;
};
wi... | 2,507 |
<p>Hopefully, I can explain this issue properly. I have 3 classes that deals with my entities.</p>
<pre><code>@MappedSuperclass
public abstract class Swab implements ISwab {
...
private Collection<SwabAccounts> accounts;
...
}
@Entity
@Table(name="switches")
@DiscriminatorColumn(name="type")
@Discriminator... | <p>define this entity in class tag inside the persistence.xml</p>
| <p>I had the same error and, complementing the information above, my case was a ClassLoader issue. My app has three files. A ejb-module.jar which depends on app-lib.jar (library that contains pojo and database entities) and a web-module.war which depends on app-lib.jar. </p>
<p>In the deployment, the app-lib.jar was l... | 19,287 |
<p>I'm using .Net 2.0 and this is driving me crazy but there's probably some easy thing I'm not doing that I am now too confused to see.</p>
<p>I have an application that has a bespoke collection of objects in it, only the main form should be able to change the contents of that collection and all other forms should be... | <p>If the main form needs read/write access but other forms don't, then I would make the collection a property of your main form that is read/write from within your form, but read only from outside your form. You can do this using something like:</p>
<p>C#</p>
<pre><code>private myCollection _MyCollection;
public m... | <p>All forms need read/write access to the collection? So is your only issue now how to give your child forms a reference to this collection? Can't you pass it to the constructor of the child form? Or make it a public property of your main form (which your child forms can presumably get a reference to from their <co... | 49,116 |
<p>I understand that an id must be unique within an HTML/XHTML page.</p>
<p>For a given element, can I assign multiple ids to it?</p>
<pre><code><div id="nested_element_123 task_123"></div>
</code></pre>
<p>I realize I have an easy solution with simply using a class. I'm just curious about using i... | <p>No. From the <a href="http://www.w3.org/TR/xhtml1/#h-4.10" rel="noreferrer">XHTML 1.0 Spec</a></p>
<blockquote>
<p>In XML, fragment identifiers are of
type ID, and there can only be a
single attribute of type ID per
element. Therefore, in XHTML 1.0 the
id attribute is defined to be of type
ID. In order ... | <p>I don´t think you can have two Id´s but it should be possible. Using the same id twice is a different case... like two people using the same passport. However one person could have multiple passports... Came looking for this since I have a situation where a single employee can have several functions. Say "sysadm" an... | 23,332 |
<p>I implemented a Lucene search solution awhile back, and it got me interested in compressed file indexes that are searchable. At the time I could not find any good information on how exactly you would go about creating a custom search index, so I wonder if anyone can point me in the right direction? </p>
<p>My prima... | <p>It all depends on what you're doing: animation, video, calculation, etc? There are <a href="http://www.tobinharris.com/2008/8/30/performance-of-silverlight-vs-flash-vs-javascript-vs-tracemonkey" rel="nofollow noreferrer">some tests that show Silverlight being faster for raw computation</a>, while Flash's graphics en... | <p>Actually, you have to assume that Flash is probably already installed on the user's browser, and SilverLight probably not. So the cost of installing silverlight (though a small download) has to be taken in to consideration as well.</p>
<p>Silverlight, however, does have some pretty neat out of the box multimedia su... | 9,141 |
<p>if you browse the internet it's relatively easy to find code that modifies existing script maps (to switch between .NET versions, for example). However, the relatively obvious code to actually add or remove a script map doesn't seem to work. Has anyone succeeded in writing something that can add or delete a script... | <p>Look here: <a href="https://stackoverflow.com/questions/265613/how-to-add-new-application-mapping-in-iis">how to add new application mapping in iis</a></p>
| <p>A better answer (that is, one more suitable to my requirements, which were the ability to administration remote machines and use .NET) can be found in a <a href="https://stackoverflow.com/questions/465548/adding-a-scriptmap-object-using-managementclasses">subseqent Stack Overflow question</a>.</p>
| 48,438 |
<p>I use FB1.5.3 and need to eventually add some FK to the database.
It happens that if I try to do it while anyone else is connected to the DB I get an exception.</p>
<p>Is there a way to add an FK while the system is running?</p>
| <p>There's no way.</p>
<p>It's a known limitation that has been removed in Firebird 2.0. You should either upgrade, or live with it.</p>
| <p>I believe this is a limitation on firebird 1.5 and earlier.<br>
Try google for (firebird foreign key "object is in use").<br>
hth</p>
| 19,633 |
<p>This has happened a few times whenever I print with the white PLA (Hatchbox 1.75 mm). It seems that the print job produces smooth sidewalls for most of the part but at a certain point and above, the walls become rough as if the alignment is off or something. I've attached a picture to show the issue. Does anybody ha... | <p>If you want to change settings on some area of your part check out <a href="http://slic3r.org/blog/modifier-meshes" rel="nofollow noreferrer">modifier meshes in Slic3r</a>.</p>
<p>It looks like to0 much heat is delivered when solid infill starts and some melting occurs. See <a href="https://all3dp.com/common-3d-pri... | <p>Slic3r has an option of</p>
<pre><code>Solid infill threshold area
</code></pre>
<p>which is the area that when you pass it (and start printing smaller than it), the infill becomes solid.</p>
<p>If you set it to a smaller number (or 0), then your infill won't become solid and the problem will vanish.</p>
<p>Sou... | 527 |
<p>I've got a tomcat instance with several apps running on it... I want the root of my new domain to go to one of these apps (context path of blah).. so I have the following set up:</p>
<pre><code><Location />
ProxyPass ajp://localhost:8025/blah
ProxyPassReverse ajp://localhost:8025/blah
</Location>... | <p>If you're wanting to server the app the /, Tomcat expects the app to be mounted at /, and have the name of ROOT. At least that's how I've always handled the situation personally. Even if you just symlink the app into ROOT, that should mitigate your problems. If you have an app placed in ${tomcat_home}/webapps/newapp... | <p>it looks like this is kind of a <a href="http://dltj.org/article/apache-httpd-and-tomcat/" rel="nofollow noreferrer">pain in the rear</a>.</p>
<p>apache is literally rewriting pages as it serves them... </p>
<p>I think I'll go a different route.</p>
| 28,551 |
<p>When I try to create a SQL Server Login by saying</p>
<pre><code>CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS;
</code></pre>
<p>I get this error</p>
<blockquote>
<p>The server principal 'ourdomain\SQLAccessGroup' already exists.</p>
</blockquote>
<p>However, when I try this code</p>
<pre><code>DROP LO... | <p>We are still struggling to understand the <em>HOW</em> of this issue, but it seems that [ourdomain\SQLAccessGroup] was aliased by a consultant to a different user name (this is part of an MS CRM installation). We finally were able to use some logic and some good old SID comparisons to determine who was playing the ... | <p>This happened to me when I installed SQL Server using a Windows username and then I renamed the computer name and the Windows username from Windows. SQL server still has the old "Computername\Username" in its node of Server->Security->Logins.</p>
<p>The solution is to go to Server->Security-><strong>Logins</strong>... | 4,136 |
<p>I want to have a <code>UIScrollView</code> with a set of subviews where each of these subviews has a <code>UITextView</code> with a different text. For this task, I have modified the <code>PageControl</code> example from the apple "iphone dev center" in order to add it a simple <code>UITextView</code> to the view wh... | <p>I resolved the problem forcing a "fake" scroll: </p>
<pre><code>textView.contentOffset = CGPointMake(0, 1);
textView.contentOffset = CGPointMake(0, 0);
</code></pre>
| <p>it works for me by placing the text value assignment into the <strong>scrollViewDidScroll</strong> method.</p>
<p>Sample snippets:</p>
<hr>
<p>SAMPLE.h</p>
<pre><code>...
@interface myRootUIViewController : UIViewController <UIScrollViewDelegate>
...
</code></pre>
<hr>
<p>Comment:
Just to remember: don't... | 16,131 |
<p>Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right.<br>
Supposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good).<br>
However, when I have two floated divs in the cell, they align themselves to the same top line.<br>
I... | <p>i've found this article to be extremely useful in understanding and troubleshooting vertical-align:</p>
<p><a href="http://phrogz.net/CSS/vertical-align/index.html" rel="noreferrer">Understanding vertical-align, or "How (Not) To Vertically Center Content"</a></p>
| <p>Add <code>clear: both</code> to the second element. If you want to @ to be below the yellow box, put it last in HTML code.</p>
| 14,865 |
<p>I'm playing around with BCEL. I'm not using it to generate bytecode, but instead I'm trying to inspect the structure of existing compiled classes.</p>
<p>I need to be able to point to an arbitrary .class file anywhere on my hard drive and load a <a href="http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/class... | <p>The straightforward way is to create a ClassParser with the file name and call parse(). Alternatively you can use SyntheticRepository and supply a classpath (that is not your classpath, IYSWIM).</p>
| <pre><code>new ClassParser(classfilebytearrayhere).parse()
</code></pre>
| 19,865 |
<p>I have a WinForms application with a DataGridView control and a column of DataGridViewButtonCell cells within that. When I click on one of these buttons, it starts a background task, and I'd like to disable the buttons until that task completes.</p>
<p>I can disable the DataGridView control, but it gives no visual ... | <p>Here's the best solution I've found so far. This <a href="http://msdn.microsoft.com/en-us/library/ms171619.aspx" rel="nofollow noreferrer">MSDN article</a> gives the source code for a cell class that adds an Enabled property. </p>
<p>It works reasonably well, but there are two gotchas:</p>
<ol>
<li>You have to inv... | <p>You could give this a try:</p>
<p>When you click on the cell...</p>
<ol>
<li>Check to see if the process with the current row identifier is running from a class-level list; if so, exit the cell click event.</li>
<li>Store the row identifier in the class-level list of running processes.</li>
<li>Change the button t... | 11,159 |
<p>I'm looking for a real time web log watcher that can visually display visitors as they browse around different pages etc. I'd like it to be a web application, it's going to be shown on a big screen in the office. Any tips?</p>
| <p>Check out glTail.rb </p>
<p><a href="http://www.fudgie.org/" rel="nofollow noreferrer">http://www.fudgie.org/</a> The site includes a video of it in operation too.</p>
<p>This is a great looking app that I would highly recommenced the link includes a video of it in action it really is a great thing to have on a bi... | <p><a href="http://www.reinvigorate.net/" rel="nofollow noreferrer">Reinvigorate</a> is a cool one. Not a web based app though. You include a js on the file you want monitored and that is reported to their servers, Then you can download an app that shows every visit. </p>
| 17,880 |
<p>I'm not committed to any particular GUI tookit or anything - just needs to be Java based. I want to do simple syntax highlighting ( XML and XQuery ) inside editable text areas.</p>
<p>My only candidate so far is Swing's JTextPane, as it supports seems to support the styling of text, but I have no idea how to implem... | <p>JSyntaxPane handles XML and can be extended</p>
<p><a href="http://code.google.com/p/jsyntaxpane/wiki/Using" rel="nofollow noreferrer">http://code.google.com/p/jsyntaxpane/wiki/Using</a></p>
<p>Or, it should be possible to extract the NetBeans editor, but that would probably be more work...</p>
<p>[edit] btw, I g... | <p>Why not check out Ostermiller's Syntax Highlighter.</p>
<p>Here's a <a href="http://ostermiller.org/syntax/editor.html" rel="nofollow noreferrer">simple code editor demo</a></p>
<p>It still uses JTextPane though.</p>
| 15,689 |
<p>The distinctions among Windows user permissions and any set of SQL Server GRANTs seem like unrelated concepts. As often as not, it seems to actually be implemented with pseudo-logins for database roles; but that doesn't map usefully back to Windows permissions. Assuming single-login identity verification, why not ju... | <p>Many of these have been said or are similar to previous answers... With AD integration:</p>
<p>a) I don't have to worry about the users who have access to any given application, I can pass that off to the security guys.</p>
<p>b) I can restrict access at a table by table level based on groups that already exists,... | <p>For an enterprise application which will run in an AD environment, using Windows integrated security is definitely the right approach. You don't want users who are already authenticated in the environment to have to manage a separate set of credentials just for your app. Note we are talking about <strong>authentic... | 43,945 |
<p>Is there a correct way in Windows Forms to flash a titlebar without having to drop to P/Invoking FlashWindow?</p>
<p>I'm using .NET 2.0 for compatibility and size reasons, so maybe I just missed the method because it's in newer versions of the .NET framework.</p>
| <p>No, I dont think so. PInvoking the <code>FlashWindowEx</code> method is the only way I think. </p>
| <p>@DrJokepu:</p>
<p>The .Activate() method, in 2.0, also brings the window to the front despite what the documentation says (i.e. other applications that are in front lose focus). Just tried this.</p>
<p>This is unfortunately exactly what I was trying to avoid.</p>
| 29,233 |
<p>Assuming a table of tags like the stackoverflow question tags:</p>
<blockquote>
<p>TagID (bigint), QuestionID (bigint), Tag (varchar)</p>
</blockquote>
<p>What is the most efficient way to get the 25 most used tags using LINQ? In SQL, a simple GROUP BY will do:</p>
<pre><code>SELECT Tag, COUNT(Tag) FROM Tags G... | <p>If you want Tag objects, why not create them directly from your Linq query?</p>
<pre><code>var groups = from t in DataContext.Tags
group t by t.Tag into g
select new Tag() { Tag = g.Key, Frequency = g.Count() };
return groups.OrderByDescending(g => g.Frequency).Take(25);
</code></pre>
| <p>I think you are also be unfair in that your SQL query does not do the same thing as your LINQ query - it doesn't return the top 25.</p>
| 31,229 |
<p>I have included <code><zlib.h></code> in my iphone application and the source code I was mocking up the sample code of Molecules provided by Brad Larson, however, when I build the project, it returns the error as below. Can anyone point out for me whether this is a library linking problem or am I missing some... | <p>In your Target's <code>Build Settings</code> tab, scroll down to the <code>Other Linker Flags</code> section and make sure <code>-lz</code> is in the field. This will link against the built-in zlib, and your error should go away.</p>
<p>After changing the Linker Flags you must select <code>Clean</code> from the <co... | <p>Add libz to your project. To do this, follow these steps in Xcode:</p>
<ol>
<li>Open your project, select your project target and then click the blue project info icon on your toolbar (or press ⌘I)<br>
<img src="https://lh3.ggpht.com/_iSbzrixSaec/SR0H8kAfFlI/AAAAAAAAAu8/qY58X4XyDrw/s640/Picture%201.png" alt="Exampl... | 36,831 |
<p>I know plenty about the different ways of handling parsing text for information. For parsing integers for example, what kind of performance can be expected. I am wondering if anyone knows of any good stats on this. I am looking for some real numbers from someone who has tested this.</p>
<p>Which of these offers the... | <p>Always use <strong>T.TryParse(string str, out T value)</strong>. Throwing exceptions is expensive and should be avoided if you can handle the situation <em>a priori</em>. Using a try-catch block to "save" on performance (because your invalid data rate is low) is an abuse of exception handling at the expense of maint... | <pre><code>Option 1: Will throw an exception on bad data.
Option 2: SomethingIsValid() could be quite expensive - particularly if you are pre-checking a string for Integer parsability.
Option 3: I like this. You need a null check afterwards, but it's pretty cheap.
Option 4 is definitely the worst.
</code></pre>
<p>Ex... | 18,089 |
<p>I'm currently considering the use of Reflection classes (ReflectionClass and ReflectionMethod mainly) in my own MVC web framework, because I need to automatically instanciate controller classes and invoke their methods without any required configuration ("convention over configuration" approach).</p>
<p>I'm concern... | <p>Don't be concerned. Install <a href="http://www.xdebug.org/" rel="noreferrer">Xdebug</a> and be sure where the bottleneck is. </p>
<p>There is cost to using reflection, but whether that matters depends on what you're doing. If you implement controller/request dispatcher using Reflection, then it's just one use per ... | <p>CodeIgniter defenitly uses Reflections. And i bet the others also do. Look into Controller class in the system/controller folder in ci installation. </p>
| 37,602 |
<p>I am attempting to devise a system for packing integer values greater than 65535 into a ushort. Let me explain.</p>
<p>We have a system which generates Int32 values using an IDENTITY column from SQL Server and are limited by an in-production client API that overflows our Int32 IDs to ushorts. Fortunately the clie... | <p>Regarding approach 2:</p>
<p>Your second approach is pretty much how NAT works. Every TCP/UDP client on the local network has up to 65535 ports in use (except port 0) and a private IP. The router knows only a single public IP. Since two clients may both have source port 300, it cannot simply just replace the privat... | <p>How much "more" than 65535 do you need? You could always just add a few bits from your "byte field" as the high-order bits of the ID. Just 2 bits would get you to 262,143, 3 bits would get you 524,287.</p>
| 15,004 |
<p>I have a collection of domain objects that I need to convert into another type for use by the .NET framework. What is the best practice for doing such a transformation?</p>
<p>Specifically, I have a type called ContentEntry and I need to convert it into a SyndicationItem for use in putting into a SyndicationFeed. T... | <p>As as cannot modify the SyndicationItem's constructors, I'd suggest you use the <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" rel="nofollow noreferrer">factory pattern</a>. Create a SyndicationItemFactory class that has the method CreateSyndicationItem(). This method returns a SyndicationItem object.... | <p>It depends ... do you just want a convenient way of hosting the conversion method? If you control one or both classes, you could simply add a cast operator overload so you can just cast one class to the other. If you want it to be obvious, you can make an explicit operator </p>
<p><code>SyndicationItem item = (Sy... | 38,005 |
<p>I'm looking for a tool that will reverse engineer Java into a sequence diagram BUT also provides the ability to filter out calls to certain libraries. </p>
<p>For example, the Netbeans IDE does a fantastic job of this but it includes all calls to String or Integer which clutter up the diagram to the point it is unu... | <p>I think <a href="http://code.google.com/p/jtracert/" rel="noreferrer">jtracert</a> is what you are looking for. It generates a sequence diagram from a running Java program. Also, because its output is a text description of the diagram (in the formats of several popular SD tools), you can use grep to filter for only... | <p>I have just started using the sequence diagram recording feature in Sparx Systems Enterprise Architect. It works very well for C#. You can create filters by class and by method. I'm actually trying to find out if it's possible to filter out an entire package. There is a checkbox for automatically excluding external ... | 11,264 |
<p>The resource definition in tomcat's <code>server.xml</code> looks something like this...</p>
<pre class="lang-xml prettyprint-override"><code><Resource
name="jdbc/tox"
scope="Shareable"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@yourDBserver.yourCompany.com:1521:yourDBsid"
driverClass... | <p>As said before encrypting passwords is just moving the problem somewhere else.</p>
<p>Anyway, it's quite simple.
Just write a class with static fields for your secret key and so on, and static methods to encrypt, decrypt your passwords.
Encrypt your password in Tomcat's configuration file (<code>server.xml</code> o... | <p>We use C#'s SHA1CryptoServiceProvider </p>
<pre><code>print(SHA1CryptoServiceProvider sHA1Hasher = new SHA1CryptoServiceProvider();
ASCIIEncoding enc = new ASCIIEncoding();
byte[] arrbytHashValue = sHA1Hasher.ComputeHash(enc.GetBytes(clearTextPW));
string HashData = System.BitConverter.T... | 15,704 |
<p>I'm looking for one line code examples in various languages for getting a valid MD5 result (as a string, not a bytehash or what have you). For instance:</p>
<p>PHP:
$token = md5($var1 . $var2);</p>
<p>I found VB especially troublesome to do in one line.</p>
| <p>C#:</p>
<pre><code>string hash = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(input, "md5");
</code></pre>
<p>VB is virtually the same.</p>
<p>Here it is not using the System.Web namespace:</p>
<pre><code>string hash = Convert.ToBase64String(new System.Security.Cryptography.MD5Crypt... | <p>Does it really matter if you can do MD5 in one line. If it's that much trouble that you can't do it in VB in 1 line, then write your own function. Then, when you need to do MD5 in VB in one line, just call that function.</p>
<p>If doing it all in 1 line of code is all that important, here is 1 line of VB. that do... | 32,597 |
<p>What is the upper limit for an autoincrement primary key in SQL Server?
What happens when an SQL Server autoincrement primary key reaches its upper limit?</p>
| <p>Joel's answer is correct, it is the upper limit of whatever datatype you use.</p>
<p>Here's an example of two of them:</p>
<ul>
<li>int: 2^31-1 (2,147,483,647) </li>
<li>bigint: 2^63-1 (9,223,372,036,854,775,807)</li>
</ul>
<p>I have actually hit the limit at a job I worked at. The actual error is:</p>
<pre>
... | <p>Data types descriptions:</p>
<pre><code>BIGINT Integer data from -2^63 through 2^63 - 1
INT Integer data from -2^31 through 2^31 - 1
SMALLINT Integer data from -2^15 through 2^15 - 1
TINYINT Integer data from 0 through 255
</code></pre>
<p>When you reach the upper limit the autoincrement goes to... | 32,750 |
<p>I would like to send some keystrokes from a C++ program into another window.</p>
<p>For that reason I would like to have the user select the target window similar to how it is done in the Spy++ utility that comes with Visual Studio (drag a crosshair cursor over target window and have target window highlighted by a ... | <p>Here's how it's usually done:</p>
<ol>
<li>Capture the mouse using <a href="http://msdn.microsoft.com/en-us/library/ms646262.aspx" rel="nofollow noreferrer">SetCapture</a>. This will cause all mouse messages to be routed toward your app's window.</li>
<li>Handle the <a href="http://msdn.microsoft.com/en-us/library/... | <p>Formers answers are wrong.</p>
<p>Spy++ source code has been given on G. Groups for years (see mainly Win32 api ng news://194.177.96.26/comp.os.ms-windows.programmer.win32)</p>
| 28,299 |
<p>Using an ORM approach in applications can often lead to the scenario where you have a collection of objects you've retrieved and would like to display them in a tabular view using a DataGridView.</p>
<p>In my (limited) experience, binding collections of objects using a custom BindingList to a DataGridView results i... | <p>The code by David will work fine, but this is an easier and shorter solution:</p>
<pre><code>foo = Proc.new { |prompt| prompt.echo = false }
new_pass = ask("Enter your new password: ", &foo)
verify_pass = ask("Enter again to verify: ", &foo)
</code></pre>
<p>You can also use an ampersand to assign a block ... | <p>I don't think the language supports a construct like this. The only way I can see to generalize this in any way is:</p>
<pre><code>def foo(prompt)
prompt.echo = false
end
new_pass = ask("Enter your new password: ") { |prompt| foo(prompt) }
verify_pass = ask("Enter again to verify: ") { |prompt| foo(prompt) }
</co... | 35,635 |
<p>Long story short, my wife and I are now the proud owners of an AnyCubic D, also known as the Predator. This is not our first 3D printer, but it is our first "delta" design, with the circular build plate and the extruder suspended by stepper-controlled tie rods (as opposed to the IMO more intuitive Cartesian designs ... | <p>I recently corrected a similar problem on a Robo3D R1+ printer. It is described as the z-offset setting.</p>
<p>An entry in the <a href="https://www.thingiverse.com/groups/anycubic-predator/forums/bigtreetech-skr-v13-tmc2280-swap/topic:41518" rel="nofollow noreferrer">Thingiverse forum</a> appears to reference this... | <p>The owners manual tells how to micro adjust the z while it is printing the 1st layer. See page 23. I did this and it works perfectly.</p>
| 1,553 |
<p>In the C language, using keyboard interrupt, how can I display an alternate key from what the user typed? E.g., when I press 'Q' on the keyboard, then the screen should display 'A'.</p>
| <p>Handling keyboard interrupt is not a good idea on any platform.
What about usb keyboards, there is no interrupt you can catch ?</p>
<p>For Windows OS's you probably want to write filter driver, you can find <a href="https://stackoverflow.com/questions/177804/nt-kernel-programming#177854">this</a> replay partly rel... | <p>We need a little more information about Your environment.</p>
<p>As far as I understand Your question, You want to replace the
keyboard interrupt handler with Your own in this way:</p>
<ul>
<li>Save the entry address of the original keyboard handler.</li>
<li>Install Your own that calls the original and manipulate... | 32,053 |
<p>My aim is to convert a stream of byte code sent from an Alesis synthesizer to a human readable format. I need to be able to take a "Program Dump" and read the 10 character string that makes up the patch name.</p>
<p>In order to receive the "Program Dump" from the synth, I sent the synth the following command via M... | <p>You are lucky, because some years ago I played a bit with Midi (with my Atari ST 520) so I had enough interest in the topic to investigate a bit...</p>
<p>For the record, I found the <a href="http://crystal.apana.org.au/ghansper/midi_introduction/midi_system_exclusive.html" rel="nofollow noreferrer" title="MIDI Sys... | <p>Thanks to your great work I came up with this as the pack algorithm.
It seems that the Alesis uses the same schema as the Moog Voyager.</p>
<pre><code>packSysex : function(midiData) {
var header = [0xF0, 0x04, 0x01, 0x00, 0x03, 0x00]; //Voyager Single Preset Dump.
var resultData = new Array();
var pack... | 42,763 |
<p>I am trying to do a file upload from gwt-ext without bringing up the dialog box. To do this, I created a FormPanel and added the appropriate fields to it. Then did a form.submit(). This doesn't seem to work. Any idea why? The code is shown below.</p>
<pre><code>final FormPanel uploadForm = new FormPanel();
uploadFo... | <p>If you write your management functionality as PowerShell cmdlets, then you can surface that functionality either by letting people run cmdlets directly, or by wrapping them in a GUI. Going with PowerShell probably gives you the most long-term flexibility, and as MS implements more PowerShell cmdlets, it means that m... | <p>When you are saying manage a data warehouse, what kind of tasks are you talking about?</p>
<p>Much of the management I would do in T-SQL (purging, archiving, transforming) - the interface to that can be very thin (even non-existent).</p>
<p>OK, based on your comment I would have the code which does all the work in... | 44,820 |
<p>I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to shut down the machine using software ... | <p>Try this:</p>
<p><code>shutdown /r /t 1 /f</code></p>
<p>Alex</p>
| <p>Try DShutdown.exe. It's flexible and can do all these things.</p>
| 9,983 |
<p>I can't connect to the default web site in IIS 6.0 using localhost or 127.0.0.1 or by server name. When I telnet to port 80 with one of these names, there's no connection.</p>
<p>However other web sites are running and I can telnet using any of the ip addresses.
I can ping to localhost where 127.0.0.1 is responding... | <p>httpcfg.exe did it.</p>
| <p>Stop all the sites under IIS, restart IIS and start the one you're interested in.</p>
<p>If this fails delete all the sites under IIS and create from scratch. If <em>this</em> fails, the problem is not with IIS and you'll need to look at what other services are running and start turning them off.</p>
| 46,316 |
<p>In a web app that support more than 5000 users, postgres is becoming the bottle neck.</p>
<p>It takes more than 1 minute to add a new user.(even after optimizations and on Win 2k3)</p>
<p>So, as a design issue, which other DB's might be better?</p>
| <p>Most likely, it's not PostgreSQL, it's your design. Changing shoes most likely will not make you a better dancer.</p>
<p>Do you know what is causing slowness? Is it contention, time to update indexes, seek times?
Are all 5000 users trying to write to the user table at the same exact time as you are trying to inser... | <p>If you do want to switch away from PostgreSQL, Sybase SQL Anywhere is number 5 in terms of price/performance on the <a href="http://www.tpc.org/tpcc/results/tpcc_price_perf_results.asp" rel="nofollow noreferrer">TPC-C benchmark list</a>. It's also the lowest price option (by far) on the top 10 list, and is the only ... | 25,155 |
<p>I haven't written any code yet, but I've encountered a similar problem before. Hopefully things have changed since the last time I visited it.</p>
<p>I'm trying to do my own image conversion for games into a special OpenGL image format.</p>
<p>In order to perform the conversion correctly, I need all pixel data and... | <p>System.Drawing supports any image formate GDI+ does (PNG-32 included), and getting that information is possible.</p>
<p>Look in to System.Drawing.Bitmap.GetPixel or LockBits</p>
| <p>Yes, it does. You should get an image with PixelFormat set to Format32bppArgb, then when you call LockBits, you can get to the data with the Scan0 property of the returned BitmapData object.</p>
| 26,064 |
<p>I have tried to print <a href="https://www.thingiverse.com/thing:2014307" rel="nofollow noreferrer">Baby Groot</a> , but every time I print the head, there are always layer shifts like the photos below. I have printed three heads and the layer shifts happened all in the same place.</p>
<p><a href="https://i.stack.im... | <p>Layer shifting has two basic causes: the partially printed part moves or flexes, or the bed or Y carriage (almost always -- they seem rather uncommon on the X axis) skips one or more steps in one direction or the other.</p>
<p>Permanent layer shifts -- that is, where the entire print above the shift is and remains s... | <p>Zeiss Ikon's answer is good - but just in case that doesn't solve it, have you printed larger / longer prints before? There's a well known problem with the Ender 3's 4.2.2 motherboard that causes layer shifts as it overheats on longer prints. You can try elevating the printer and putting a fan underneath to see if t... | 1,987 |
<p>Is it possible to get the text of an <code>OleDbCommand</code> with all parameters replaced with their values? E.g. in the code below I'm looking for a way to get the query text </p>
<pre><code>SELECT * FROM my_table WHERE c1 = 'hello' and c2 = 'world'
</code></pre>
<p>after I finished assigning the parameters.</p... | <p>No: you have to iterate through the parameters collection yourself, doing a string.Replace() to get the equivalent. It's particularly painful when you have to use the <code>?</code> syntax rather than the <code>@parametername</code> syntax.</p>
<p>The reason for this is that the full string is <em>never</em> asse... | <p>If you just need to see what query was executed and dont need to work with it programmatically, you can use SQL Profiler.</p>
| 21,561 |
<p>I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other doesn't. I am trying to use</p>
<pre><code>s=difflib.SequenceMatcher(isjunk,text1,text2)
ratio =s.ratio()
</code></pre... | <p>If you match all whitespaces the similarity is better:</p>
<pre><code>difflib.SequenceMatcher(lambda x: x in " \t\n", doc1, doc2).ratio()
</code></pre>
<p>However, difflib is not ideal to such a problem because these are two nearly identical documents, but typos and such produce differences for difflib where a hum... | <p>I haven't used Difflib.SequenceMatcher, but have you considered pre-processing the files to remove all blank lines and whitespace (perhaps via regular expressions) and then doing the compare?</p>
| 17,748 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.