instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>For all the RSS feeds I subscribe to I use <a href="http://www.google.com/reader/" rel="nofollow noreferrer">Google Reader</a>, which I love. I do however have a couple of specific RSS feeds that I'd like to be notified of as soon as they get updated (say, for example, an RSS feed for a forum I like to monitor and r... | <p>If you have access to Microsoft Outlook 2007 or Thunderbird, these email clients allow you to add RSS feeds in the same way you would add an email account.</p>
<p>I use Google Reader generally but when I want to keep up-to-date with something specific, I add the RSS feed to Outlook and it arrives in my inbox as if ... | <p>I've used <a href="http://www.pingie.com" rel="nofollow noreferrer">Pingie</a> to send me an SMS when a new item appears in an RSS feed. Perhaps, it will be useful for you, if you have a cellphone text messaging plan.</p>
| 2,427 |
<p>Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles?</p>
<p>e.g.</p>
<pre><code>mvn -P debug
mvn -P release
</code></pre>
<p>I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same ... | <p>To quote the <a href="http://maven.apache.org/pom.html#Profiles" rel="noreferrer">Maven documentation on this</a>:</p>
<blockquote>A profile element contains both an optional activation (a profile trigger) and the set of changes to be made to the POM if that profile has been activated. For example, a project built ... | <p>Your groupId, artifactId should be tokenized in your profiles as properties and you can move your dependencies to the generic section.</p>
| 20,156 |
<p>I was reading some 3rd party code and I found this:</p>
<pre><code>x.Flags = x.Flags ^ Flags.Hidden;
</code></pre>
<p>What does it do?</p>
<p>I've used '&' and '|' for bitwise 'and' and 'or' with enums, but it's the first time I see the that symbol...</p>
| <p>^ is the bitwise XOR operator in C#. </p>
<p>EDIT: a ^ b returns true if a is true and b is false or if a is false and b is true, but not both.</p>
| <p>Taken from <a href="http://msdn.microsoft.com/en-us/library/zkacc7k1(VS.71).aspx" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>For integral types, ^ computes the
bitwise exclusive-OR of its operands.
For bool operands, ^ computes the
logical exclusive-or of its operands;
that is, the result is ... | 29,058 |
<p>I'm looking for some help with creating a horizontal menubar in HTML. The menubar will have menus such as File, Edit, View and when you mouseover or click on the File menu (for example), the menu will be displayed showing menu items such as New, Open, etc.</p>
<p>Ideally, I'd like to create the menubar and menus us... | <p>I've found <a href="http://www.alistapart.com/articles/horizdropdowns" rel="nofollow noreferrer">this menu tutorial</a> on A List Apart to be helpful. If you search around on that site you can find a lot of good design tutorials and templates.</p>
| <p>I think the most robust out there is this one "DHTML Menu"
<a href="http://www.milonic.com/" rel="nofollow noreferrer">http://www.milonic.com/</a> By Milonic.</p>
<p>It handles theming and a whole pile of options.</p>
| 27,893 |
<p>Is there any good resource (book, reference, web site, application...) which explains how to compute time complexity of an algorithm?</p>
<p>Because, it is hard to make the things concrete in my mind. Sometimes it is talking about an iteration has time complexity of lg n; and then according to the another loop it b... | <p>I think the best book is <a href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=11866" rel="nofollow noreferrer">Introduction to Algorithms</a> by Cormen, Leiserson, Rivest and Stein.</p>
<p>Here is it <a href="https://rads.stackoverflow.com/amzn/click/com/0262033844" rel="nofollow noreferrer" re... | <p>The classic set of books on the subject is Knuth's <a href="https://rads.stackoverflow.com/amzn/click/com/0201896834" rel="nofollow noreferrer" rel="nofollow noreferrer">Art of Computer Programming</a> series. They're heavy on theory and formal proofs, so brush up on your calculus before you tackle them.</p>
| 31,527 |
<p>I'm trying to combine a list of functions like so.</p>
<p>I have this:</p>
<pre><code>Func<int, bool>[] criteria = new Func<int, bool>[3];
criteria[0] = i => i % 2 == 0;
criteria[1] = i => i % 3 == 0;
criteria[2] = i => i % 5 == 0;
</code></pre>
<p>And I want this:</p>
<pre><code>Func<int... | <p>This was a guess, as I know little about this stuff, but this seems to fix it:</p>
<pre><code>Func<int, bool>[] criteria = new Func<int, bool>[3];
criteria[0] = i => i % 2 == 0;
criteria[1] = i => i % 3 == 0;
criteria[2] = i => i % 5 == 0;
Expression<Func<int, bool>>[] results = ... | <p>This was a guess, as I know little about this stuff, but this seems to fix it:</p>
<pre><code>Func<int, bool>[] criteria = new Func<int, bool>[3];
criteria[0] = i => i % 2 == 0;
criteria[1] = i => i % 3 == 0;
criteria[2] = i => i % 5 == 0;
Expression<Func<int, bool>>[] results = ... | 19,415 |
<p>I need to reformat my machine but I have so many user/passwords stored in FF2 that I just keep putting it off. Yes I know about backing up the entire profile and restoring it. But for some reason my profile has many issues and I want to start fresh with that as well.</p>
<p>Are the username and passwords stored in ... | <p>There is a Firefox add-on called <a href="https://addons.mozilla.org/en-US/firefox/addon/2848" rel="nofollow noreferrer">Password Exporter</a>. It can export to XML or CSV files that can be imported in another browser or computer.</p>
| <p>Alas, this won't solve the re-importing problem, but check out <a href="http://wejn.org/stuff/moz-export.html" rel="nofollow noreferrer">http://wejn.org/stuff/moz-export.html</a></p>
<p>They have a single html page with a small javascript section that exports your passwords. Save the html to your desktop, read thro... | 6,161 |
<p>How do the full text search systems of PostgreSQL and MySQL compare? Is any clearly better than the oder? In which way are they different?</p>
| <blockquote>
<p><strong>Update:</strong> Starting in MySQL 5.6, InnoDB <a href="https://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html" rel="nofollow noreferrer">supports fulltext search</a></p>
</blockquote>
<p>I'm not well versed in PostgreSQL unfortunately, but if you use the FULL TEXT search in MySQL you'r... | <p>I think you can use Sphinx with both MySQL and Postgres.
Here is <a href="http://www.khussein.com/wordpress/?p=38" rel="nofollow noreferrer">an article</a> to explain how to use Sphinx with MySQL (you can add it as a plugin)</p>
| 17,162 |
<p>I plan on using MySQL and it's built-in encryption functionality to encrypt / decrypt certain columns in certain tables. The concern I have is that I need to store the key somewhere. I could certainly store the key in a file and control the permissions of that file and the permissions of the application that acces... | <p>I'm not sure if using MySQL build in encryption would be the best solution to your problem.</p>
<p>PHP's <a href="http://www.php.net/manual/en/intro.mcrypt.php" rel="noreferrer">M_CRYPT</a> package is thought to be quite good and it gives you the flexibility to choose the algorithm that is best suited for your need... | <p>It seems that you are considering the use of a 'column-specific' key to use with 'AES_ENCRYPT' and 'AES_DECRYPT'. As the commenter said, this is a bad idea, because any intrusion will have access to all the data.</p>
<p>If you use a 'user-supplied' password, with/without a salt, you are being much more secure.</p>... | 28,742 |
<p>I am hosting a service within a Windows Service. </p>
<p>The following snippet instantiates the ServiceHost object:</p>
<pre><code>Host = new ServiceHost(typeof(Services.DocumentInfoService));
</code></pre>
<p>The DocumentInfoService class implements a contract interface that has methods that invoke business obj... | <p>ServiceHost will create the service instances based on the binding and behaviors configured for the endpoint. There's no particular point in time, where you can rely there is a service instance. Hence, ServiceHost does not expose the service instances.</p>
<p>What you could do is add code to your service object con... | <p>Implement your own <code>ServiceHost</code>. See also <a href="http://hyperthink.net/blog/servicehostfactory-vs-servicehostfactorybase/" rel="nofollow noreferrer">http://hyperthink.net/blog/servicehostfactory-vs-servicehostfactorybase/</a></p>
| 21,791 |
<p>Actually I will want to use that JeOS for our webserver. Is it a good choice?</p>
| <p>Here you have the 'Next' behavior. For 'Previous' I leave as exercise for you: :-)</p>
<pre><code>procedure TForm8.btn1Click(Sender: TObject);
var
crt: TTreeNode;
begin
with tv1 do //this is our tree
begin
if Selected=nil then
crt:=Items[0] //the first one
else
crt:=Selected.GetNext; ... | <p>here is another way to do this:</p>
<pre><code>type TfrmMain = class(TForm)
...
public
DLLHandle : THandle;
function GetNodePath(node: TTreeNode; delimiter: string = '\') : String;
...
function TfrmMain.GetNodePath(node: TTreeNode; delimiter: string = '\') : String;
begin
Result:='';
while As... | 20,685 |
<p>I have a WPF Window which has a among other controls hosts a Frame. In that frame I display different pages. Is there way to make a dialog modal to only a page? When I'm showing the dialog it should not be possible to click on any control on the page but it should be possible to click on a control on the same window... | <p>If I am correct in interpreting your message, you want something that works similar to what
<a href="http://www.dnrtv.com/default.aspx?showNum=115" rel="noreferrer">Billy Hollis demonstrates in his StaffLynx application</a>.</p>
<p>I recently built a similar control and it turns out that this sort of idea is relat... | <p>You are not looking for a modal dialog here. You need a function that will disable the "page" control, show a dialog, and re-enable it when the dialog closes.</p>
<p>I'm not too sure whether you understand what a modal dialog is meant to do though?</p>
| 20,924 |
<p>If a user saves the password on the login form, ff3 is putting the saved password in the change password dialoge on the profile page, even though its <strong>not the same input name</strong> as the login. how can I prevent this?</p>
| <p>Try using autocomplete="off" as an attribute of the text box. I've used it in the past to stop credit card details being stored by the browser but i dont know if it works with passwords. e.g. <code>print("<input type="text" name="cc" autocomplete="off" />");</code></p>
| <p>Some sites have 3 inputs for changing a password, one for re-entering the current password and two for entering the new password. If the re-entering input was first and got auto-filled, it wouldn't be a problem. </p>
| 9,892 |
<p>I load some XML from a servlet from my Flex application like this:</p>
<pre><code>_loader = new URLLoader();
_loader.load(new URLRequest(_servletURL+"?do=load&id="+_id));
</code></pre>
<p>As you can imagine <code>_servletURL</code> is something like <a href="http://foo.bar/path/to/servlet" rel="nofollow norefe... | <p>My friend Luis figured it out:</p>
<p>You should use encodeURI does the UTF8URL encoding
<a href="http://livedocs.adobe.com/flex/3/langref/package.html#encodeURI()" rel="noreferrer">http://livedocs.adobe.com/flex/3/langref/package.html#encodeURI()</a></p>
<p>but not unescape because it unescapes to ASCII see
<a hr... | <p>From the livedocs: <a href="http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html</a></p>
<blockquote>
<p>Creates a URLRequest object. If System.useCodePage is true, the request is encoded using the system c... | 8,787 |
<p>does anyone know why user.identity.name becames blank after a while about (10 mins), i am using .Net Framework 1.1</p>
<p>Edit: <br>
Session Timeout is set to 20 min
<br>
no timeout is set under system.web/authentication/forms in web.config</p>
<p>Thanks,<br>
Oscar</p>
| <p>Session expiry is not related to ASP.NET authentication.</p>
<p>It could be your forms authentication is timing out: the default is 30 minutes, and it's configured using the timeout attribute of the system.web/authentication/forms element in web.config.</p>
| <p>Have you checked to see how often the application pool is recycling? If its not set to recycle after certain time, it could be experiencing heavy load and therefore reaching the limit and recycling. At this point you would lose your session.</p>
<p>Also, how are you assigning the user.identity.name? If its via auth... | 47,447 |
<p>Ok another WPF question, well I guess this is just general .NET. I have an xml document retreived from a URL.</p>
<p>I want to get multiple values out of the document (weather data, location, some other strings).</p>
<p>When I use the XmlTextReader I can call my method to pull the values out. The first time I pass... | <p>XmlTextReader cannot be reset to the beginning.
Download you content first and then use multiple XmlTextReaders (if you have to).</p>
<p>If the document you are downloading is small, I would just use an XmlDocument (or XDocument if you are using .NET 3.5)</p>
| <p>Isn't XMLTextReader a SAX reader? Don't you have to rewind the stream to read the file in again?</p>
| 45,818 |
<p>I have two models one is Employee and other is Asset, with Many to one relation between Asset and Employee. And Asset is added as StackedInline field to Employee Admin interface, Is there anyway I can make Asset as read only field in the Employee Admin. </p>
<p>My intention was to show all the assets the employee i... | <p>Edit: Actually, I don't think this will work for inline models..</p>
<p>Django will be adding native read-only fields in Django 1.1, which should be released around the middle of March.</p>
<p><a href="http://www.djangosnippets.org/snippets/937/" rel="nofollow noreferrer">Read Only Admin Fields</a> (<a href="http:... | <p>I don't think there is a flag in django-admin for that, check out Chapter 18 of the Django book for more details, you'll need to hack the templates by hand</p>
<p><a href="http://www.djangobook.com/en/beta/chapter18/" rel="nofollow noreferrer">http://www.djangobook.com/en/beta/chapter18/</a></p>
| 44,159 |
<p>Harking back to the days of "singing disk drives," I am wondering if anyone's written music to be performed on a 3D printer. Most of us have noticed in passing that the servo motors for X and Y drive generate a different pitch depending on motion speed. With some care and experimentation, one could write g-code to p... | <p>Yes, it has been done before, see <a href="https://github.com/forflo/gCodeMusic" rel="noreferrer">here</a> and <a href="https://github.com/yeokm1/midi-to-simple-metal-gcode" rel="noreferrer">here.</a></p>
<p>The README file of the first repository linked above contains a detailed explanation of the basic idea/calcu... | <p>I actually did this, on my Malyan M150. </p>
<p>After not that much experimentation at all it turned out that the frequency of the produced tone scales linearly with the speed of the motors. Due to the nature of the way humans perceive music, the actual frequencies do not matter at all, just the relative difference... | 853 |
<p>How are people unit testing their business applications? I've seen a lot of examples of unit testing with "simple to test" examples. Ex. a calculator. How are people unit testing data-heavy applications? How are you putting together your sample data? In many cases, data for one test may not work at all for another t... | <p>I have to second the comment by @Phil Bennett as I try to approach these integration tests with a rollback solution.</p>
<p>I have a very detailed post about integration testing your data access layer <a href="https://stackoverflow.com/questions/12374/has-anyone-had-any-success-in-unit-testing-sql-stored-procedures... | <p>For lots of different runs over the same logic but with different data you can use CSV, as many columns as you like for the input and the last for the output etc.</p>
| 5,949 |
<p>Working in an AIX environment, I'm issuing the following tar command and receive errors on sockets. </p>
<p>Question 1. How can I avoid the socket errors?</p>
<p>Question 2. Can I rely on the tar file to contain all files excluding the ones in error?</p>
<pre><code> $ tar -cvf /post_patches.tar /xyz
tar: /x... | <ol>
<li>You should probably avoid including the absolute path - GNU <code>tar</code> does that automatically. It makes it hard to restore onto other machines where the <code>/xyz</code> may already exist and perhaps should not be tampered with.</li>
<li>You probably should not be writing in the root directory - it is... | <p>I don't have AIX at hand to take a look, but the 'tar' on Mac OSX supports the '<strong>--ignore-failed-read</strong>' switch. Have you taken a look at it?</p>
| 38,870 |
<p>How do I create a branch in subversion that is deeper' than just the 'branches' directory?</p>
<p>I have the standard <code>trunk</code>, <code>tags</code> and <code>branches</code> structure and I want to create a branch that is several directories deeper than the 'branches' tag.</p>
<p>Using the standard svn mov... | <pre><code>svn copy --parents http://url/to/subproject http://url/to/repository/branches/version_1/project/subproject
</code></pre>
<p>That should create the directory you want to put the subproject in (<code>--parents</code> means "create the intermediate directories for me").</p>
| <p>If you're using <code>TortoiseSVN</code>, you can use its <strong>Repository Explorer</strong> to do such things. Makes it all pretty <code>WYSIWYG</code> simple.</p>
| 7,610 |
<p>Is there an elegant way in Perl to find the newest file in a directory (newest by modification date)?</p>
<p>What I have so far is searching for the files I need, and for each one get it's modification time, push into an array containing the filename, modification time, then sort it.</p>
<p>There must be a better ... | <p>Your way is the "right" way if you need a sorted list (and not just the first, see Brian's answer for that). If you don't fancy writing that code yourself, use <a href="http://search.cpan.org/~tpaba/File-DirList-0.04/lib/File/DirList.pm" rel="noreferrer">this</a></p>
<pre><code>use File::DirList;
my @list = File::... | <p>Subject is old, but maybe someone will try it - it isn't portable (Unix-like systems only), but it's quite simple and works:</p>
<blockquote>
<p>chdir $directory or die "cannot change directory";</p>
<p>my $newest_file = <code>bash -c 'ls -t | head -1'</code>;</p>
<p>chomp $newest_file;</p>
<p>print "... | 42,583 |
<p>I'm building my first ASP.NET MVC application and I am having some troubles with Partial Views.</p>
<p>If I, as an example, want to put a "Footer" as a Partial I create an "MVC View User Control" in "/Views/Shared/Footer.ascx". (I leave it empty for now)</p>
<p>What is the correct way for adding it to my Layout? <... | <p>In this case don't use the <%= syntax. Just use the <% %> syntax. Then the first form in your examples should work.</p>
<p>For more info, check here:
<a href="http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html" rel="nofollow noreferrer">http://bradwilson.typepad.com/blog/2008/08/partial-renderi... | <p>Do what @BenScheirman said, and add a semi-colon at the end of your statement :)</p>
<pre><code><% Html.RenderPartial("~/Views/Shared/Footer.ascx"); %>
</code></pre>
<p>Update: I guess VB doesn't require the semi-colon. So you would only need that if you are programming in C#.</p>
| 17,331 |
<p>In through <code>php_info()</code> where the WSDL cache is held (<code>/tmp</code>), but I don't necessarily know if it is safe to delete all files starting with WSDL. </p>
<p>Yes, I <em>should</em> be able to just delete everything from <code>/tmp</code>, but I don't know what else this could effect if I delete an... | <p>You can safely delete the WSDL cache files. If you wish to prevent future caching, use:</p>
<pre><code>ini_set("soap.wsdl_cache_enabled", 0);
</code></pre>
<p>or dynamically:</p>
<pre><code>$client = new SoapClient('http://somewhere.com/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );
</code></pre>
| <p>Edit your <code>php.ini</code> file, search for <code>soap.wsdl_cache_enabled</code> and set the value to <code>0</code></p>
<pre><code>[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=0
</code></pre>
| 38,991 |
<p>I used to have a class in 1.1 for the Datagrid that inherited from the DataGridColumn class. This allowed me to create a check box column with a client-side un/check-all box in the header. Then as I designed my grid I would just add my custom column.</p>
<p>I am currently on a project where I need similar functiona... | <p>I derived classes from System.Web.UI.WebControls.BoundField and .HyperLinkField
You might be interested in inheriting from CheckBoxField class <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxfield.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.ui... | <p>Could you just use a TemplateColumn with an ItemTemplate containing your CheckBox in your DataGrid Columns?</p>
<p>Something like:</p>
<pre><code><asp:DataGrid id="DG1" runat = "server" DataKeyField = "ID">
<Columns>
<asp:TemplateColumn HeaderText="ProductName">
<ItemTemplate>
<asp:Check... | 29,831 |
<p>Any domain name registrars out there that support domain name registration using a web service or a similar functionality without them telling you to become a reseller?</p>
<p>I don't register that many domain names and I am not interested in paying reseller fees.</p>
<p>If I can become a reseller without paying u... | <p><a href="http://www.opensrs.com" rel="nofollow noreferrer">www.opensrs.com</a> charge a one-off $95 setup fee (which converts into $95 credit on the account). That's not quite what you asked for, but it is pretty low. You get access to a well documented, functional API. However you need to pay for domains by making ... | <p><a href="http://www.dotster.com/resources/partnerships/" rel="nofollow noreferrer">Dotster</a> Actually has a free reseller program, and they used to have an API that you could use to register domain names. Something to look into anyway, if you want to automatically register domain names.</p>
| 23,426 |
<p>We have a number of very old data entry forms that were made in Access that link to our SQL Server database. Each form may have any number of sub-forms.</p>
<p>We'd like to move away from using these access frontends but don't have the time to create a new app or web app to replace every form that we've got.</p>
<... | <p>From experience, I don't think you will find any product, tool or technology any easier than Access for creating forms with a DB behind them. </p>
<p>Do you have a copy of <a href="https://rads.stackoverflow.com/amzn/click/com/0782140114" rel="noreferrer" rel="nofollow noreferrer">Access Developer's Handbook</a>? ... | <p>I concur with other commenters.</p>
<p>The WORST thing about Access front-ends are deployment issues (although lightly used Access apps can run ok off a network file share which eases things a bit.)</p>
<p>But if development speed is a goal Access is still a great tool. So for in-house applications Access can wor... | 39,204 |
<p>In the Java collections framework, the Collection interface declares the following method:</p>
<blockquote>
<p><a href="http://java.sun.com/javase/6/docs/api/java/util/Collection.html#toArray(T%5B%5D)" rel="noreferrer"><code><T> T[] toArray(T[] a)</code></a></p>
<p>Returns an array containing all of the elemen... | <p>Use the static method</p>
<pre><code>java.lang.reflect.Array.newInstance(Class<?> componentType, int length)
</code></pre>
<p>A tutorial on its use can be found here:
<a href="http://java.sun.com/docs/books/tutorial/reflect/special/arrayInstance.html" rel="noreferrer">http://java.sun.com/docs/books/tutorial/... | <p>To create a new array of a generic type (which is only known at runtime), you have to create an array of Objects and simply cast it to the generic type and then use it as such. This is a limitation of the generics implementation of Java (erasure).</p>
<pre><code>T[] newArray = (T[]) new Object[X]; // where X is the... | 10,290 |
<p>When my IronPython program gets to the line </p>
<pre><code>import wx
</code></pre>
<p>I get this message:</p>
<pre><code>A first chance exception of type
'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll
Additional information: No module named _core_
</code></pre>
<p>althou... | <p>No, this won't work. Wx bindings (like most other "python bindings") are actually compiled against CPython.</p>
<p>In this regards they are not just packages on sys.path to be found, as you have tried. They actually depend on CPython itself. <a href="http://www.python.org/doc/2.5.2/ext/ext.html" rel="nofollow noref... | <p>While wxPython is unavailable for the reasons listed by @Ali, you may want to take a look at <a href="http://wxnet.sourceforge.net/" rel="noreferrer">wx.NET</a>. You could use IronPython to call these assemblies instead, and it should be cross-platform (I'm assuming that's what you're after, or you would just use Wi... | 35,929 |
<p>I have a div with a <code><h1></code> tag in a div, with no margins. If I define any doctype, a white space appears above the div.</p>
<p>If I remove the <code><h1></code> tags, or remove the doctype definition, there is no space (as there should be. Why?</p>
<p>Example HTML:</p>
<pre><code><!DOCTY... | <p>The space above the green div is the correct behaviour according to the <a href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" rel="noreferrer">CSS spec</a>. This is because the top margin of the h1 adjoins the top margin of the div.</p>
<p>One way to keep the margin of the h1 inside the div is to add a b... | <p>See <a href="http://www.opera.com/docs/specs/doctype/" rel="nofollow noreferrer">http://www.opera.com/docs/specs/doctype/</a> and <a href="http://hsivonen.iki.fi/doctype/" rel="nofollow noreferrer">http://hsivonen.iki.fi/doctype/</a>.</p>
| 29,230 |
<p>I have the following JSP code, that protects my web page and displays it only to know IP's</p>
<pre><code>String ip_h = request.getRemoteAddr();
String host_h = request.getRemoteHost();
String iplist[] = new String[1];
iplist[0] = "127.0.0.1";
iplist[1] = "10.217.106.248";
int count = iplist.length;
bo... | <p>IP addresses (at least, IPv4 addresses) are really intended to be represented as 32-bit integers. If you convert the IP address to an integer first, checking subnet ranges becomes a relatively simple matter of checking (in your example) whether the first 16 bits match the first 16 bits of the range. </p>
| <p>Try the <code>Subnet</code> class from this <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4262187" rel="nofollow noreferrer">bug report</a>.</p>
| 21,470 |
<p>What's a simple way to implement a c++ Win32 program to...<br />
- display an 800x600x24 uncompressed bitmap image<br />
- in a window without borders (the only thing visible is the image)<br />
- that closes after ten seconds<br />
- and doesn't use MFC</p>
| <p>If you're targeting modern versions of Windows (Windows 2000) and above, you can use the <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-updatelayeredwindow" rel="nofollow noreferrer">UpdateLayeredWindow</a> function to display any bitmap (including one with an alpha channel, if so de... | <p>It's a Win32 api FAQ</p>
<p>See professional Win32api forum
news://194.177.96.26/comp.os.ms-windows.programmer.win32
where it has been answered hundreds of times for 20 years..</p>
| 20,261 |
<p>I have an application that uses Forms Authentication to authenticate one type of user. There is a section in this application that needs to be authenticated for another type of user using a different table in the database. The problem happens if the second type of user's session times out, she is taken to the login ... | <p>IIRC, the authentication works per folder. So you should be able to do it if all of the pages that require the 2nd type of authentication live in a specific sub-folder with it's own config.</p>
<p>Not 100% sure on this, though, so if someone more knowledgeable can contradict me I'll just delete the response.</p>
| <p>You cannot have an <authentication> section inside of a <location> tag, so you must have the subfolder set up as an IIS (and ASP.NET) application of it's own. So, you should be able to run the subsection on it's own.</p>
<p>I think 500.19 is the "can't read or parse web.config" error - does it have deta... | 17,983 |
<p>I am using an AnyCubic Photon Resin Printer. I have used the (<a href="https://wowmodelviewer.net" rel="nofollow noreferrer">WoW model viewer</a> to export a miniture that I am hoping to 3D print.</p>
<p>However, when I look at the model in photon workshop, certain parts appear in a different colour, and those parts... | <p>Aligning build surfaces isn't the main issue with 1 mm thick surfaces when aligning four 200 x 200 mm surfaces to make one 400 x 400 surface. The main issue is slight bucking at the seams from thermal mismatch. Using this with PETG tends to tear up the build surface at the seams. The image shows aligned surfaces.... | <p>I haven't tried such a thing, but a speculative answer covering the constraints and expected failure modes may suffice here.</p>
<p>Unless the sheets have squared (rather than rounded) corners, the corners will almost certainly be a problem. In particular you'd end up with a hole right at the middle of the bed.</p>
... | 1,756 |
<p>I notice that Windows XP Event Viewer show a list of typical actions under System logs every time I start or shutdown Windows, and I can tell when my day starts and ends. </p>
<p>Is there anyways I can record the time every time I lock my screen and every time I re-login? There maybe a way to fool System Event Logg... | <p>I thought <a href="http://www.eggheadcafe.com/software/aspnet/31913289/screen-saver-lock-event-i.aspx" rel="nofollow noreferrer">this post</a> had some interesting thoughts about this subject. You might want to take a look at it.</p>
| <p>You can definitely schedule a task to run when you log on or off. Just write a little script to append a file with the system time and schedule it to run when you log on or off.</p>
| 28,996 |
<p>I have some Python code that works correctly when I use python.exe to run it, but fails if I use pythonw.exe.</p>
<pre>
def runStuff(commandLine):
outputFileName = 'somefile.txt'
outputFile = open(outputFileName, "w")
try:
result = subprocess.call(commandLine, shell=True, st... | <p><code>sys.stdin</code> and <code>sys.stdout</code> handles are invalid because pythonw does not provide console support as it runs as a deamon, so default arguments of <code>subprocess.call()</code> are failing.</p>
<p>Deamon programs close stdin/stdout/stderr purposedly and use logging instead, so that you have to... | <p>This is an old question, but the same problem happened with pyInstaller too. </p>
<p>In the truth, this will happen with any framework that converts code in python for exe without console.</p>
<p>In my tests, I observed that if I use the flag "console=True" into my spec file (pyInstaller) the error no longer occur... | 43,852 |
<p>From my understanding of the CSS spec, a table above or below a paragraph should collapse vertical margins with it. However, that's not happening here:</p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class... | <p>Margin collapsing is only defined for block elements. Try it - add <code>display: block</code> to the table styles, and suddenly it works (and alters the display of the table...)</p>
<p>Tables are special. In the CSS specs, they're not <em>quite</em> block elements - special rules apply to size and position, both of... | <p>My understanding is that the vertical margins only collapse between the table and caption [1]. Otherwise a table should behave as any other block element [2] (ie 2 elements both with 100px margins = 200px between them).</p>
<ol>
<li><a href="http://www.w3.org/TR/CSS2/tables.html#q5" rel="nofollow noreferrer">http:/... | 16,544 |
<p>I have a command which includes an includegraphics command - I can pass an image to my command, and it will do some standard formatting for me before actually including the image. Some of the images that I'm including via this command are smaller than \textwidth, while some are larger. I'd like to scale the larger... | <p>To get the width of the image you can use this code:</p>
<pre><code>\newlength{\imgwidth}
\settowidth{\imgwidth}{\includegraphics{img}}
</code></pre>
<p>You could use this in the document preamble to create a new command to automatically set the width:</p>
<pre><code>\usepackage{graphicx}
\usepackage{calc}
\newl... | <p>After a few minutes of searching through CTAN manuals and Google results, I think I can safely say that what you want to do is either impossible or very hard. My only recommendation is that you have two commands, one for small images and one for large, or one command with an option.</p>
<p>There may be a way, but I... | 14,882 |
<p>I have Windows Vista MCML app, and I need to figure out the current name of the file playing.</p>
<p>The Media Center SDK alludes to using MediaMetadata["Title"] to get this information, unfortunately this does not work with playlists (.wpl) files as there is no method for getting the position in the playlist. </p>... | <p>Turns out this <a href="http://discuss.mediacentersandbox.com/forums/thread/8436.aspx" rel="nofollow noreferrer">can not be easily done</a>.</p>
<p>There are 4 options. </p>
<ol>
<li>Never use play lists, in that case MediaMetadata["Title"] is good enough.</li>
<li>Examine remote file handles in ehshell.exe.</li>
... | <p>Have you tried:</p>
<pre><code>MediaContext.GetProperty(TrackTitle)
</code></pre>
<p>I've also seen samples that in the markup for the media display layout file they specify an element such as:</p>
<pre><code><music-title duration = "2000" x="69" y="29" width="187" height="20"/>
</code></pre>
<p>Good Luck!... | 19,998 |
<p>My boss loves VB (we work in a Java shop) because he thinks it's easy to learn and maintain. We want to replace some of the VB with java equivalents using the Eclipse SWT editor, because we think it is almost as easy to maintain. To sell this, we'd like to use an aerith style L&F.</p>
<p>Can anyone provide an e... | <p>In JavaScript you can encode single quotes as "\x27" and double quotes as "\x22". Therefore, with this method you can, once you're inside the (double or single) quotes of a JavaScript string literal, use the \x27 \x22 with impunity without fear of any embedded quotes "breaking out" of your string. </p>
<p>\xXX is f... | <p>Is the answers here that you can't escape quotes using JavaScript and that you need to start with escaped strings.</p>
<p>Therefore. There's no way of JavaScript being able to handle the string 'Marge said "I'd look that was" to Peter' and you need your data be cleaned before offering it to the script?</p>
| 12,308 |
<p>I was discussing neural networks (NN) with a friend over lunch the other day and he claimed the the performance of a NN written in Java would be similar to one written in C++. I know that with 'just in time' compiler techniques Java can do very well, but somehow I just don't buy it. Does anyone have any experience... | <p>The Hotspot JIT can now produce code <em>faster</em> than C++. The reason is run-time empirical optimization.</p>
<p>For example, it can see that a certain loop takes the "false" branch 99% of the time and reorder the machine code instructions accordingly.</p>
<p>There's lots of articles about this. If you want ... | <p>In the grand scheme of things, you're debating maybe a 5% performance difference where you'd get several orders of magnitude increase by moving to CUDA or dedicated hardware.</p>
| 9,016 |
<p>Everyone is aware of Dijkstra's <a href="http://portal.acm.org/citation.cfm?doid=362947" rel="noreferrer">Letters to the editor: go to statement considered harmful</a> (also <a href="http://www.cs.utexas.edu/%7EEWD/transcriptions/EWD02xx/EWD215.html" rel="noreferrer">here</a> .html transcript and <a href="http://www... | <p>The following statements are generalizations; while it is always possible to plead exception, it usually (in my experience and humble opinion) isn't worth the risks.</p>
<ol>
<li>Unconstrained use of memory addresses (either GOTO or raw pointers) provides too many opportunities to make easily avoidable mistakes.</li... | <p>The basic idea is that goto gives you too much freedom to do something you didn't intend to. It can cause errors in places that don't appear to be related to the goto statement, so it makes code maintenance more difficult. If you think you need a goto statement, you're wrong :) and you should instead rethink your co... | 6,877 |
<p>I don't use Eclipse as an IDE, and have no interest in doing so. However, I do like its source-level debugging.</p>
<p>Is there any way I can use it to debug a C++ Linux app without going through the ritual of creating a project? (In effect, can I just use it like a frontend to gdb?)</p>
<p>If not, what are the ... | <p>Take a look at <a href="https://stackoverflow.com/questions/204345/how-to-setup-a-linux-c-project-in-eclipse#204353">this question</a>. Create a C/C++-project, use your project's source directory as project directory, select to use the external builder, and change "make" to whatever tool you want.</p>
<p>The tricky... | <p>Configuration for debugging in Eclipse.</p>
<p>In eclipse,</p>
<ol>
<li>Go to Window->preferences</li>
<li>A popup will appear then select C/C++ , click on drop down arrow ,then select Debug and click on drop down arrow.</li>
<li>Select Source Lookup Path and then click on Add.</li>
<li>After clicking on Add, clic... | 30,825 |
<p>I am using RRDTool (<a href="http://oss.oetiker.ch/rrdtool/" rel="nofollow noreferrer">http://oss.oetiker.ch/rrdtool/</a>) as a graphing back-end for storing performance metrics. This is done via the RRDTool CLI from a Python script.</p>
<p>My problem is that the script is multithreaded and each thread updates the... | <p>An exclusive lock ought to be enough for this problem : </p>
<ul>
<li><a href="http://docs.python.org/lib/lock-objects.html" rel="nofollow noreferrer">Python doc page</a></li>
<li><a href="http://effbot.org/zone/thread-synchronization.htm" rel="nofollow noreferrer">Use example</a></li>
</ul>
<p>Define your lock o... | <p>I would suggest using <code>rrdcached</code>, which will also improve the performance of your data collector. The latest versions of <code>rrdtool</code> (1.4.x) have greatly improved the functionality and performance of <code>rrdcached</code>; you can tune the caching behaviour according to your data to optimise, ... | 16,190 |
<p>I need to specify path to dlls referenced by assembly in .config file.
Problem is that path can be found in env. variable.
Is it possible to use some sort of %DLLPATH% macro in .config file?</p>
| <p>Yes, that's possible! Suppose you have something like that in your config:</p>
<pre><code><configuration>
<appSettings>
<add key="mypath" value="%DLLPATH%\foo\bar"/>
</appSettings>
</configuration>
</code></pre>
<p>Then you can easily get the path with:</p>
<pre><code>var pat... | <p>Is this a configuration entry that <em>you're</em> reading, or is .NET reading it? If you're reading it yourself, you can do the appropriate substitution yourself (using <a href="http://msdn.microsoft.com/en-us/library/system.environment.expandenvironmentvariables.aspx" rel="noreferrer">Environment.ExpandEnvironment... | 46,767 |
<p>Consider the following signature in C#:</p>
<pre><code>double Divide(int numerator, int denominator);
</code></pre>
<p>Is there a performance difference between the following implementations?</p>
<pre><code>return (double)numerator / denominator;
return numerator / (double)denominator;
return (double)numerator ... | <p>Have you tried comparing the IL (for example, with <a href="http://www.red-gate.com/products/reflector/" rel="nofollow noreferrer">Reflector</a>)?</p>
<pre><code>static double A(int numerator, int denominator)
{ return (double)numerator / denominator; }
static double B(int numerator, int denominator)
{ return nume... | <p>Even if you use VB.NET, both numerator and denominator are converted to doubles before doing the actual division, so your examples are the same.</p>
| 35,919 |
<p>I'm trying to do some abstraction in Haskell98 but doen't know how to do it.</p>
<p>What I want to do is to define a class for types that may be converted into lists.</p>
<pre><code>toList :: a -> [b]
</code></pre>
<p>But I don't know how to define a class for this method. I brought up the following three idea... | <p>See also <a href="http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Foldable.html" rel="noreferrer">Data.Foldable</a> in the standard library, which provides a <code>toList</code> function for any <code>Foldable</code> instance. <code>Foldable</code> takes a bit of sophistication to instantiate, but i... | <p>You probably want to choose the last option for class ToList, and make <code>(HTree a)</code> instance of ToList. Then <code>toList</code> has type
<code>(HTree a b) -> [b]</code>, not for example <code>(HTree a b) -> [(a,b)]</code>. I assume you are thinking a as "key" and b as "value" type. </p>
<pre><code>... | 39,835 |
<p>In a multi-threaded application I'm working on, we occasionally see <code>ConcurrentModificationExceptions</code> on our Lists (which are mostly <code>ArrayList</code>, sometimes Vectors). But there are other times when I think concurrent modifications are happening because iterating through the collection appears ... | <p>Depending on your update frequency one of my favorites is the CopyOnWriteArrayList or CopyOnWriteArraySet. They create a new list/set on updates to avoid concurrent modification exception. </p>
| <p><a href="http://java.sun.com/javase/6/docs/api/java/util/Collections.html#synchronizedList(java.util.List)" rel="nofollow noreferrer">Collections.synchronizedList()</a> will render a list nominally thread-safe and java.util.concurrent has more powerful features.</p>
| 10,064 |
<p>What's the <strong>easiest</strong>, <strong>tersest</strong>, and most <strong>flexible</strong> method or library for parsing Python command line arguments?</p>
| <p><strong>This answer suggests <code>optparse</code> which is appropriate for older Python versions. For Python 2.7 and above, <code>argparse</code> replaces <code>optparse</code>. See <a href="https://stackoverflow.com/questions/3217673/why-use-argparse-rather-than-optparse">this answer</a> for more information.</str... | <p>I extended Erco's approach to allow for required positional arguments and for optional arguments. These should precede the -d, -v etc. arguments.</p>
<p>Positional and optional arguments can be retrieved with PosArg(i) and OptArg(i, default) respectively.
When an optional argument is found the start position of sea... | 4,042 |
<p>My dev team is getting ready to start a new project. The shop has been a "VB shop" since the days of VB3, but the prevailing opinion now is that we're a ".NET shop" and since C# was created specifically for .NET, whereas VB.NET was a retrofit, we've decided to move forward writing C# only. The controversy revolves a... | <p><strong>Microsoft.VisualBasic.dll <> Microsoft.VisualBasic.Compatibility.dll</strong> !!!</p>
<p>(or, if you prefer, <em>Microsoft.VisualBasic.dll != Microsoft.VisualBasic.Compatibility.dll;</em> )</p>
<p>The <strong>Microsoft.VisualBasic.Compatibility</strong> namespace is exclusively for use by the VB6 upg... | <p>There is a bunch of .NET code that Microsoft actually just wraps COM functionality. I'm not a licensing guru, but you could always grab Reflector and take a look at that namespace and see for yourself.</p>
| 28,014 |
<p>I need to set the onload attribute for a newly popped-up window.
The following code works for Firefox:</p>
<pre><code><a onclick="printwindow=window.open('www.google.com');printwindow.document.body.onload=self.print();return false;" href='www.google.com'>
</code></pre>
<p>However, when I try this in IE, I ge... | <p>While earlier answers correctly stated the new window must be from the same domain, they incorrectly answered why he got the error 'printwindow.document.body null or not defined'. It's because IE doesn't return any status from window.open() which means you can open a page and try to access it BEFORE onload is avail... | <p>The final (admittedly, poor) solution that worked for all browsers was to use setTimeout and call print() that way, instead of modifying the onload attribute:</p>
<pre><code><a onclick="self.printwindow=window.open('print.html');setTimeout('self.printwindow.print()',3000);return false;" href='print.html'>
</c... | 30,408 |
<p>In Joel's article for Inc. entitled <a href="http://www.inc.com/magazine/20081101/how-hard-could-it-be-the-unproven-path.html" rel="nofollow noreferrer">How Hard Could It Be?: The Unproven Path</a>, he wrote:</p>
<blockquote>
<p>...it turns out that Jeff and his
programmers were so good that they
built a site... | <p>Benchmarking your software is often a lot harder than it seems. Sure, it's easy to produce some numbers that say something about the performance of your software, but unless it was calculated using a very accurate representation of the actual usage patterns of your end users, it might be completely different from th... | <p>Apache has a tool called <code>ab</code> that you can use to benchmark a server. It can simulate loads requests and concurrency situations for you.</p>
| 34,036 |
<p>I have an application into which users can upload an XSD to describe certain kinds of user data. The application needs to parse this XSD to correctly initialise various bits of database metadata (e.g. translating xs:enumerations into lists of permitted values that will populate drop-down lists). The same user-entere... | <p>You find it here: <a href="http://www.w3.org/2001/XMLSchema.xsd" rel="nofollow noreferrer">http://www.w3.org/2001/XMLSchema.xsd</a></p>
<p>Just a hint, a schema starts with xsd:schema tag. And if correct, contains an attribute:</p>
<pre><code>xmlns:xsd="http://www.w3.org/2001/XMLSchema"
</code></pre>
<p>Follow th... | <p>I think you'll find this problem much easier if you ignore that the user-supplied files are XSD files and just consider them as XML. After all, XSD files are just XML so you can enforce schema rules on them just like any other.</p>
<p>I would start by looking at the <a href="http://www.w3.org/2001/XMLSchema.xsd" re... | 45,699 |
<p>Currently I am working with a <strong>custom</strong> regular expression validator <em>(unfortunately)</em>.</p>
<p>I am trying to set the Regex pattern using a server side inline script like this:</p>
<pre><code>ValidationExpression="<%= RegExStrings.SomePattern %>"
</code></pre>
<p>However, the script is ... | <p>This has now been cleared up my MS. The issue I discovered was caused by the fact that the "action" attribute in server forms had no effect prior to .NET 2 SP2, but now can be set. Code render blocks have never worked in attribute values - this is explained towards the end of this post.</p>
<p>This was a conseque... | <p>Values in a web control do not render server side code.
Rather set that from the Code Behind</p>
<pre><code>RegExValidator1.ValidationExpression = RegExStrings.SomePattern;
</code></pre>
| 27,849 |
<p>I'm building an application in C# using WPF. How can I bind to some keys?</p>
<p>Also, how can I bind to the <a href="http://en.wikipedia.org/wiki/Windows_key" rel="noreferrer">Windows key</a>?</p>
| <p>I'm not sure of what you mean by "global" here, but here it goes (I'm assuming you mean a command at the application level, for example, <em>Save All</em> that can be triggered from anywhere by <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd>.)</p>
<p>You find the global <code>UIElement</code> of your cho... | <p><code>RegisterHotKey()</code> suggested by John could work - the only catch is that it requires an HWND (using <code>PresentationSource.FromVisual()</code>, and casting the result to an HwndSource). </p>
<p>However, you'll also need to respond to the <code>WM_HOTKEY</code> message - I'm not sure if there is a way t... | 7,138 |
<p>I have a largish Mercurial repository that I've decided would be better as several smaller repositories. Is there a way that I can split the repository and have each piece retain its revision history?</p>
| <p>The best way to do this is using the <a href="https://www.mercurial-scm.org/wiki/ConvertExtension" rel="nofollow noreferrer">'convert' extension</a>. You'll use mercurial and both source and destination type and then use a <code>--filemap</code> with entries like:</p>
<pre><code>exclude path/you/do/not/want
rename... | <p>Just clone it and delete the unwanted stuff out of each copy.</p>
| 32,167 |
<p>I have the following html</p>
<pre><code> <div id="menu">
<ul class="horizMenu">
<li id="active"><a href="#" id="current">About</a></li>
<li><a href="#">Archive</a></li>
<li><a href="#">C... | <p>Not sure who -1ed, but Mauro's answer is essentially correct: you can't trivially make an item with automatic width depend on what the width would have been if the font inside weren't bold.</p>
<p>However, a 'float: left;' rule will also be necessary as you can't set the width of an inline-display element. And 'em'... | <p>try using this
menutext {
line-height: 10px; /* or whatever */
}</p>
<p>and also, to set the width of a inline element, use display: inline-block;</p>
<p>float:left might be not so friendly, if you do use it and it messes things up use clear:both</p>
| 26,757 |
<p>Say there are two possible solutions to a problem: the first is quick but hacky; the second is preferable but would take longer to implement. You need to solve the problem fast, so you decide to get the hack in place as quickly as you can, planning to start work on the better solution afterwards. The trouble is, a... | <p>Write a test case which the hack fails.</p>
<p>If you can't write a test which the hack fails, then either there's nothing wrong with the hack after all, or else your test framework is inadequate. If the former, run away quick before you waste your life on needless optimisation. If the latter, seek another approach... | <p>We had to do this once - make a short term demo version that we knew we did not want to keep. The customer wanted it on a winTel box, so we developed the prototype in SGI/XWindows. (We were fluent in both, so it wasn't a problem). </p>
| 20,279 |
<p>I'm writing an application that is basically just a preferences dialog, much like the tree-view preferences dialog that Visual Studio itself uses. The function of the application is simply a pass-through for data from a serial device to a file. It performs many, many transformations on the data before writing it to ... | <p>A tidier way is to create separate forms for each 'pane' and, in each form constructor, set</p>
<pre><code>this.TopLevel = false;
this.FormBorderStyle = FormBorderStyle.None;
this.Dock = DockStyle.Fill;
</code></pre>
<p>That way, each of these forms can be laid out in its own designer, instantiated one or more tim... | <p>I would probably create several panel classes based on a base class inheriting CustomControl. These controls would then have methods like Save/Load and stuff like that. If so I can design each of these panels separately.</p>
<p>I have used a Wizard control that in design mode, handled several pages, so that one cou... | 2,577 |
<p>Can someone suggest a good module in perl which can be used to store collection of objects?</p>
<p>Or is ARRAY a good enough substitute for most of the needs?</p>
<p><strong>Update:</strong>
I am looking for a collections class because I want to be able to do an operation like compute collection level property fro... | <p>There are collection modules for more complex structures, but it is common style in Perl to use Arrays for arrays, stacks and lists. Perl has built in functions for using the array as a stack or list : push/pop, shift/unshift, splice (inserting or removing in the middle) and the foreach form for iteration.</p>
<p>... | <p>i would stick with an ARRAY or a HASH.</p>
<pre><code> @names = ('Paul','Michael','Jessica','Megan');
</code></pre>
<p>and</p>
<pre><code>my %petsounds = ("cat" => "meow",
"dog" => "woof",
"snake" => "hiss");
</code></pre>
<p><a href="http://en.wikibooks.org/wiki/Programming:Pe... | 15,763 |
<p>I have an abstract base class and derived class:</p>
<pre><code>type TInterfaceMethod = class
public
destructor Destroy; virtual; abstract;
procedure Calculate; virtual; abstract;
procedure PrepareForWork; virtual; abstract;
end;
type ConcreteMethod = class(TInterfaceMethod)
private
matrix: TMin... | <p>Override is correct - you are redefining a virtual method.</p>
<p>If you really want TInterfaceMethod's destructor to throw EAbstractError, you'll have to mark it as 'override; abstract;'. (I'm surprised that it works, but I tested with D2007 and it does.) But why would you want to do that?</p>
<p>BTW, there is no... | <p>Just to nitpick ;-).</p>
<p>The virtual destructor destroy already exists (and is used by Free). So if you declare a class like this you will get some problems.</p>
<p>But to summarize some method directives:</p>
<ul>
<li>virtual is used to define a virtual method (uses runtime binding).</li>
<li>override is used... | 42,296 |
<p>I am writing a java program that needs a file open dialog. The file open dialog isn't difficult, I'm hoping to use a <code>JFileChooser</code>. My problem is that I would like to have a dual pane <code>JFrame</code> (consisting of 2 <code>JPanels</code>). The left panel would have a <code>JList</code>, and the ri... | <p>JFileChooser extends JComponent and Component so you should be able to add it directly to your frame.</p>
<pre><code>JFileChooser fc = ...
JPanel panel ...
panel.add(fc);
</code></pre>
| <p>If you are adding the JFileChooser on the fly, you will need to call revalidate().</p>
<p>Steve's answer is correct. You can add a JFileChooser to other containers.</p>
| 32,436 |
<p>I have an application built in Flex Builder 3. It has a fair amount of mxml and as3 code which uses some other custom compenents. I have looked at the documentation on building components which shows how to make a simple mxml or action script component that extends something like a combobox, but I'm lost as to how... | <p>The easy thing to do is to swap the Application mxml tag with a VBox tag...thus making it act like a component. </p>
<p>e.g. If this were your application:</p>
<pre>
<code>
//Foo.mxml
<mx:Appliction xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Label text = "foo" />
</mx:Appliction>
</code>
</pre>
<... | <p>If you simply want some "parent" Flex application to embed several instances of this autonomous child application, then you should see Adobe's <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html" rel="nofollow noreferrer">"Embedding Asset Types"</a> documentation, which describes how to emb... | 30,786 |
<p>Is there a way to find all web pages that implement a specific master page in Visual Studio?</p>
<p>I'm looking for a shortcut like shift F12 that will find all usages of a master page. When I do it on the master page class name it only takes me to the design view instead of showing all pages that use it.</p>
<p>I... | <p>You mention that the FindDialog isn't that good... and I would agree if I'm was just using the Find Next dialog. But the "Find All" will display a list of all of the pages, then you can double click on each item in the list (as it stays open).</p>
<p><kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd> (or press th... | <p>That would be <em>very</em> hard to do. You can set master pages in the aspx-files, web.config or in the Page_PreInit event, which make it impossible to know exactly which master page is going to be used.</p>
<p>What MasterPage to you think is used here?</p>
<pre><code>protected void Page_PreInit(object o)
{
thi... | 36,447 |
<p>Is it possible using <a href="https://jquery.com/" rel="noreferrer">jQuery</a> to select all <code><a></code> links which href ends with "ABC"?</p>
<p>For example, if I want to find this link <code><a href="http://server/page.aspx?id=ABC"></code></p>
| <pre><code> $('a[href$="ABC"]')...
</code></pre>
<p>Selector documentation can be found at <a href="http://docs.jquery.com/Selectors" rel="noreferrer">http://docs.jquery.com/Selectors</a></p>
<p>For attributes:</p>
<pre><code>= is exactly equal
!= is not equal
^= is starts with
$= is ends with
*= is contains
~= is... | <pre><code>$("a[href*=ABC]").addClass('selected');
</code></pre>
| 39,056 |
<p>What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?</p>
<p>I know that from outside of the object you should use a getter/setter, but from within would you just do:</p>
<p>Java:</p>
<pre><code>String property = this.property;
</co... | <p>This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. somebody adds code to a setter that <em>needs</em> to run every time that property is set, and the property is being set i... | <p>Well, it seems with C# 3.0 properties' default implementation, the decision is taken for you; you HAVE to set the property using the (possibly private) property setter.</p>
<p>I personally only use the private member-behind when not doing so would cause the object to fall in an less than desirable state, such as wh... | 2,258 |
<p>I am working with a cvs repository at a clients site, and I do a checkin via ssh (CVS_RSH=ssh).</p>
<p>My default group is "foo", and I am also a member of "bar".</p>
<p>The repository should be accessible by members of group "bar". However, whenever I do a checkin, it changes the group of the file I checked in t... | <p>Well, CVS has really no file metadata out of binary and executable.</p>
<p>There are a few things you can do</p>
<ul>
<li>do a chmod g+s bar on the server directory where you want it to stay bar</li>
<li>write a small shell wrapper which will replace the real cvs, do a chgrp and call the real cvs afterwards.</li>
... | <p>Possible answers:</p>
<ul>
<li>use sg or newgrp to switch groups on login</li>
<li>use chmod -R g+s on the repository in advance to arrange proper access</li>
<li>switch to using the pserver and map everyone to the same user under the skin (implies some maintenance though)</li>
</ul>
<p>The first answer is the onl... | 49,676 |
<p>This is a Windows Console application (actually a service) that a previous guy built 4 years ago and is installed and running. I now need to make some changes but can't even build the current version! Here is the build output:</p>
<pre><code>--------------------Configuration: MyApp - Win32 Debug--------------------... | <p>Sorry, this turns out to be an internal problem. A combination of a maverick coder 4 years ago and a rusty no-nothing (me!) now.</p>
<p>The code does not use <code>_socket_noblock</code> but it <strong>does</strong> use <code>socket_noblock</code> and I just need to link to one of our own libraries.</p>
| <p><strong>defaultlib "LIBCMTD" conflicts with use of other libs</strong> is a warning that indicates that your program uses a different version of the run time library that one or more of your libraries.
Use the same runtime across the program and libraries, to make the warning go away.</p>
<p>(project settings)
(c++... | 42,815 |
<p>I'm looking for an add-in to VS2008 that can enable structural highlighting (<strong>vertical</strong> lines in blocks of code) in the C# code editor. </p>
<p>I tried out CodeRush, but while the structural highlighting was great, I was annoyed with all the other stuff in CodeRush. No matter how much I disabled in t... | <p>While browsing the <a href="http://viemu.com" rel="noreferrer">ViEmu</a> site, I saw the <a href="http://codekana.com" rel="noreferrer">Codekana</a> product which looks like it may do what you want.</p>
| <p>I'm using a JetBrains resharper to handle this as well (<a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">http://www.jetbrains.com/resharper/</a>) and found it to be a great tool for much more tasks.</p>
<p>If you need just highlighting, that may be npt your case though</p>
| 20,052 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/16991/what-ruby-ide-do-you-prefer">What Ruby IDE do you prefer?</a> </p>
</blockquote>
<p>I'm making a <strong>simple</strong> script using ruby on a Windows 2003 Server.
My questions are:</p>
<ul>
<li>How can... | <p>There is an ODBC package for the <a href="http://ruby-dbi.rubyforge.org/" rel="nofollow noreferrer">Ruby DBI module</a> available, or you can try to use the <a href="http://www.ch-werner.de/rubyodbc/" rel="nofollow noreferrer">ODBC binding for Ruby</a>, which also includes a Win32 binary.</p>
<p>Here an example tha... | <p>For a Ruby IDE, try NetBeans. </p>
| 35,518 |
<p>I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays.</p>
<p>This is what I'm supposed to do,</p>
<p>Write a table_diff function that compares two arrays of integers an... | <p>I think you want to change your code to the following:</p>
<pre><code>while((r = scanf("%i", &value)) != 1 && ptra < endptra)
{
*(ptra++) = value;
if (r==1)
printf("No room after reading values\n\n");
else if(r != EOF)
printf("invalid char");
} ... | <p>This doesn't really answer your question, but in your "while" condition, you already check for "r != 1", so within the while block, checking "if(r == 1) ..." is unnecessary, and technically unreachable code.</p>
<p>What is the point of the program? The way it looks now, you read into array ptra until a blank line, ... | 35,806 |
<p>I would like to use Python to script an application that advertises itself as providing an OLE component. How should I get started?</p>
<p>I don't yet know what methods I need to call on the COMponents I will be accessing. Should I use win32com to load those components, and then start pressing 'tab' in IPython?</p>... | <p>"<a href="http://www.boddie.org.uk/python/COM.html" rel="nofollow noreferrer">Python and COM</a>" contains an example. OLE is related to COM and ActiveX so you should look for those terms. </p>
<p>"<a href="http://oreilly.com/catalog/9781565926219/" rel="nofollow noreferrer">Python Programming on Win32</a>" is a us... | <p>Please take a look at the <a href="http://sourceforge.net/projects/pywin32/" rel="nofollow noreferrer">python-win32</a> package, and, in particular, at its win32com API.</p>
| 35,246 |
<p>Has anybody got this to actually work? Documentation is non existent on how to enable this feature and I get missing attribute exceptions despite having a 3.5 SP1 project. </p>
| <p>I found that it doesn't work with internal/private types, but making my type public it worked fine. This means no anonymous types either :(</p>
<p>Using reflector I found the method ClassDataContract.IsNonAttributedTypeValidForSerialization(Type) that seems to make the decision. It's the last line that seems to be ... | <p>There are several serialization options in WCF: Data contract, XML Serialization and and raw data payload. Which of these are you trying to use? From the question, it seems you are trying to use something other than objects decorated with datacontact attributes. Is that what you are asking?</p>
| 8,859 |
<p>Has anyone come up with a good way to share a set of Visual Studio Code Snippets (actual .snippet files that Visual studio uses) amongst a team of developers automatically? It would be great for other developers on my team to benefit from shortcuts I've created for myself, and vice versa.</p>
| <p>I know this post is very old, but I found another good way (IMO) for sharing snippets, maybe in addition to the solution @Kevin Dente provided: <strong>using git</strong>!!</p>
<p>I shared successfully snippets and project templates creating an ad hoc git repository named <strong>snippets.git</strong>, I cloned it ... | <p>It's 2018 now and the VS Code team has added this feature (currently in preview)</p>
<p>See <a href="https://github.com/Microsoft/vscode/issues/8102" rel="nofollow noreferrer">this ticket for more info</a></p>
| 28,273 |
<p>Say I have some javascript that if run in a browser would be typed like this...</p>
<pre><code><script type="text/javascript"
src="http://someplace.net/stuff.ashx"></script>
<script type="text/javascript">
var stuff = null;
stuff = new TheStuff('myStuff');
</script>
</code></pre>
... | <p>It seems like you're asking:</p>
<blockquote>
<p>How can I get <code>ScriptEngine</code> to evaluate the contents of a URL instead of just a string?</p>
</blockquote>
<p>Is that accurate?</p>
<p><code>ScriptEngine</code> doesn't provide a facility for downloading and evaluating the contents of a URL, but it's f... | <p>Are you trying to access the javascript object in the browser page from a java 1.6 applet? If so, you're going about it in the wrong way. That's not what the scripting engine's for. It's for running javascript within a jvm, not for an applet to accesses javascript from with in a browser.</p>
<p>Here's a <a href="ht... | 12,016 |
<p>Is it better to use NOT or to use <> when comparing values in VBScript?<br>
is this:</p>
<pre><code>
If NOT value1 = value2 Then
</code></pre>
<p>or this:</p>
<pre><code>
If value1 <> value2 Then
</code></pre>
<p>better?<br></p>
<p>EDIT:
Here is my counterargument. <br>
When looking to logically negate... | <p>The latter (<code><></code>), because the meaning of the former isn't clear unless you have a perfect understanding of the order of operations as it applies to the <code>Not</code> and <code>=</code> operators: a subtlety which is easy to miss.</p>
| <p>The second example would be the one to go with, not just for readability, but because of the fact that in the first example, If NOT value1 would return a boolean value to be compared against value2. IOW, you need to rewrite that example as</p>
<pre><code>If NOT (value1 = value2)
</code></pre>
<p>which just makes ... | 48,265 |
<p>Trying to make a generic PL/SQL procedure to export data in specific XML format, e.g. Excel XML. Let's say the procedure accepts a string with the SELECT query to EXECUTE IMMEDIATE. </p>
<p>This requires access to data types of each column of the resulting rowset, which -- seeing as the procedure is to be generic -... | <p>You can't do that with EXECUTE IMMEDIATE. You'll have to use the more powerful (and more complex) <a href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#i1026120" rel="noreferrer">DBMS_SQL package</a> - I've linked you to the DESCRIBE_COLUMNS procedure, which is especially relevant.</p>
| <p>Or query ALL_TAB_COLS to get the column datatype.</p>
| 49,137 |
<p>It seems that Microsoft wants Silverlight to take off, yet I cannot find an easy way to develop in it without buying Visual Studio 2008. Has anyone out there found a way to get the silverlight development environment in the express editions of Visual Studio? Any other tools?</p>
| <p>They just released <a href="http://www.eclipse4sl.org/" rel="nofollow noreferrer">Eclipse tools for Silverlight (eclipse4SL)</a> and I remembered this thread!</p>
| <p>Depending on what you consider "productive", you could work with XAMLPad for a lot of the basic declarative stuff. <br />
The Moonlight project is working on an IDE called Lunar Eclipse, that I think they're eventually going to be integrating into MonoDevelop. Wikipedia says it's in the SVN repository already, but ... | 10,167 |
<p>I have a class <code>isSearching</code> with a single boolean property in a 'functions' file in my webapp. On my search page, I have a variable <code>oSearchHandler</code> declared as a <code>Public Shared</code> variable. How can I access the contents of <code>oSearchHandler</code> on other pages in my webapp?</p... | <p>sorry for the late answer, I've been struck with a serious case of weekenditis.</p>
<p>As for utilizing a third table to include PKs from both client and system tables - I don't like that as that just overly complicates synchronization and still requires my app to know of the third table.</p>
<p>Another issue that... | <p>You probably need a table say tblItems that simply store all the primary keys of the two tables. Inserting items would require two steps to ensure that when an item is entered into the tblSystemItems table that the PK is entered into the tblItems table.</p>
<p>The third table then has a FK to tblItems. In a way tbl... | 33,738 |
<p>Please give me the direction of the best guidance on the Entity Framework.</p>
| <p>Currently I have the following in my Global Ignore Pattern:<br></p>
<pre><code>bin obj CVS .cvsignore *.user *.suo Debug Release *.pdb test.* Thumbs.db
</code></pre>
<p>Works really well to ignore several hidden or temp files/folders....</p>
<p>So for your specific requirements:</p>
<ul>
<li>Folders: <code>bin o... | <p>This is one I use for .NET. Note that I use VB6 as well as other packages so there are extra entries. Also it is case sensitive. </p>
<p>*.chm *.dat *.dll *.ini *.err *.exe *.DLL *.INI *.ERR *.EXE *.backup *.zip *.ZIP *.vbw *.scc *.vbg *.log *.exp *.lib <em>.vrs</em>.SCC *.PRF *.prf *.NIP *.NOP *.nip *.nop *.out *.... | 22,052 |
<p>So we have a winforms app that in the task manager should anywhere from 250 - 450 MB of memory. We are trying to figure out the best place to focus on to reduce memory footprint. </p>
<p>what is the best place to start?</p>
| <p>I would suggest profiling so you can understand what is using the memory. CLR Profiler and ANTS Profiler are two profilers you may want to check out.</p>
| <p><a href="http://yourkit.com/" rel="nofollow noreferrer">Yourkit</a> is better than the other suggested profilers. </p>
| 40,962 |
<p>I have tried what seems like everything - I've done similiar things many times before, but I'm obviously missing something.</p>
<p>I have a UserControl (ucA) - on ucA is a LinkButton that loads a different UserControl (ucB) programatically into a panel on ucA. ucB has TextBoxes, etc. </p>
<p>Why isn't my control... | <p>I just tried to recreate what you have setup and I dont seem to experience the same problem. Would you like me to send you my Solution somehow?</p>
<p>Final Edit, I promised -</p>
<p>Try this solution: <a href="http://www.vyrotek.com/code/ControlTest2.zip" rel="nofollow noreferrer">http://www.vyrotek.com/code/Cont... | <p>I am installing express edition as I type. By that time, why should you clear the controls on click of the button? cant you just add/load the uc once control on click of the link?</p>
<p>By doing this, you would not be clearing the old controls and they would retain the value.</p>
| 28,229 |
<p>Would anyone happen to know how to convert type <code>LPTSTR</code> to <code>char *</code> in C++?</p>
| <p>Depends if it is Unicode or not it appears. LPTSTR is char* if not Unicode, or w_char* if so.</p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/1b994ff3-da28-46a8-90ef-6c7fab8dcd21/" rel="noreferrer">Discussed better here</a> (accepted answer worth reading)</p>
| <p>no doubt many (eg, us unix folk) will recoil in horror at the mad-hatter Microserf doublespeak - "if your compiler is in Unicode mode, use LPWSTR or stick a "T_" in front of it, but only if it's a static string, which is the same as an "L", or use T2A() if using ATL, but that's now outdated, or use VARIANT but not i... | 44,566 |
<p>Is there C# look-alike for Linux? What about a compiler?</p>
| <p>You could actually use C# with <a href="http://www.mono-project.com/" rel="nofollow noreferrer">Mono</a>.</p>
| <p>You could always use <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">Boo DSL</a> on Mono to construct a C# clone. But then again it would probably be easier to use C# directly on Mono itself I guess ;)</p>
| 41,008 |
<p>I'm trying to find out what the performance of a large directory structure would be if deep directories were to be accessed on a shared, nfs filesystem. The structure would be excessively large, with 4 levels of nested directories, each level containing 1024 directories. (1024 at root, 1024 in a given subdirectory, ... | <p>I did that at my work once. Don't remember the exact numbers offhand, but I think it was 8 levels deep, 10 subdirectories in each level (user id 87654321 maps to directory 8/7/6/5/4/3/2/1/. Turned out that was not such a great idea, started running into problems with filesystem inode number limits, iirc (10^10 = 100... | <p>The answer here is going to be highly dependent on your operating system, can you provide more information? I have found that file open times under Linux have been reasonable up to directory sizes in the small tens of thousands, but I have not tried any tests with directory structures as large as yours (you do know... | 10,593 |
<p>I recently asked a question (<a href="https://3dprinting.stackexchange.com/questions/5699/is-there-any-public-and-reasonably-accurate-3d-scan-from-a-cray-2-computer">Is there any public and reasonably accurate 3D scan from a Cray-2 computer?</a>) about where to find (if there is any, because I tried and there seems ... | <p>This topic is actually up for debate <em>possibly</em>. I don't personally know if this sort of question has been actually <em>troublesome</em>. I remember your question well and whilst it didn't fit into the scope <em>as it is currently defined</em>, it seemed (IMHO) a reasonable question nevertheless. It was unfor... | <p>mostly this is an off-topic question, as per <a href="https://3dprinting.stackexchange.com/help/dont-ask">question rules - click</a> </p>
<p>That means your question is not about solving a technical problem.</p>
| 46 |
<p>I was curiious to know what type of structures you use for your project references?</p>
<p>Where I work the developers have a shared folder called AssemblyCache (\\MACHINENAME\AssemblyCache) which is mapped to an R:\ via GPO in Windows 2008 AD (tied to the Developers AD group).</p>
<p>Our shared components have po... | <ul>
<li>Store all the reference assemblies in source control.</li>
<li>Always fetch such that the code has the same <em>relative</em> path to the assemblies (e.g. ../../CommonLibraries)</li>
<li>Everyone fetches to a local drive</li>
</ul>
<p>Having to refer to a network drive causes various issues:</p>
<ul>
<li>No ... | <p>In one project we added assemblies to the source code repository. This is also not perfect, but it prevents from accidentally getting a newer version of a reference which could happen easily when using a file share.</p>
| 45,897 |
<p>I recall seeing that it's possible to "bake" or "anneal" or even "remelt" PLA prints to strengthen them. As I understand it, the main effect is improving layer adhesion, which is the main source of weakness in tension in the original Z-axis direction.</p>
<p>Yes, I can print with a hot... | <p>I've only annealed PEEK personally, but a quick search returns varying recommendations:</p>
<ul>
<li><p><a href="https://all3dp.com/2/annealing-pla-prints-for-strength-easy-ways/" rel="nofollow noreferrer">All3DP</a>
recommends 1 hour at 70 °C.</p>
</li>
<li><p><a href="https://x3d.com.au/blogs/tips-and-tricks/pla-b... | <p>I've only annealed PEEK personally, but a quick search returns varying recommendations:</p>
<ul>
<li><p><a href="https://all3dp.com/2/annealing-pla-prints-for-strength-easy-ways/" rel="nofollow noreferrer">All3DP</a>
recommends 1 hour at 70 °C.</p>
</li>
<li><p><a href="https://x3d.com.au/blogs/tips-and-tricks/pla-b... | 1,988 |
<p>There are important features of Emacs which are missing in Vim, such as the comint mode, and there are no scripts/plugins which can replace them.</p>
<p>There are also benefits of Vim over Emacs, such as modal editing and generally better default shortcuts. However, Viper mode gets me both. Vimpulse also enables vi... | <p>I'm a regular vim user but not an emacs user and haven't used <code>vimpulse</code> to confirm this.</p>
<p>But browsing the vimpulse code below I see no mention of text objects. </p>
<p><a href="http://www.emacswiki.org/cgi-bin/wiki/vimpulse.el" rel="nofollow noreferrer">http://www.emacswiki.org/cgi-bin/wiki/vimp... | <p>Vim macros don't seem to work with viper/vimpulse:</p>
<p><a href="https://stackoverflow.com/questions/98225/vim-macros-dont-work">Vim macros don't work when using viper + vimpulse in Emacs</a></p>
<p>(Btw, the killer emacs feature that makes me care about vim/vimpulse is that different frames can edit the sam... | 42,449 |
<p>What is the syntax to declare a type for my compare-function generator in code like the following?</p>
<pre><code>var colName:String = ""; // actually assigned in a loop
gc.sortCompareFunction = function() : ??WHAT_GOES_HERE??
{
var tmp:String = colName;
return function(a:Object,b:Object):int { return compare... | <p>Isn't "Function" a data type?</p>
| <p>In order to understand what the data type is, we must know what the intended outcome of the return is. I need to see the code block for compareGeneral, and I still don't believe this will help. You have two returns withing the same function "gc.sortCompareFunction", I believe this is incorrect as return gets a val... | 10,031 |
<p>I'm using ctypes to load a DLL in Python. This works great.</p>
<p>Now we'd like to be able to reload that DLL at runtime. </p>
<p>The straightforward approach would seem to be:
1. Unload DLL
2. Load DLL</p>
<p>Unfortunately I'm not sure what the correct way to unload the DLL is.</p>
<p>_ctypes.FreeLibrary is ... | <p>you should be able to do it by disposing the object</p>
<pre><code>mydll = ctypes.CDLL('...')
del mydll
mydll = ctypes.CDLL('...')
</code></pre>
<p><strong>EDIT:</strong> Hop's comment is right, this unbinds the name, but garbage collection doesn't happen that quickly, in fact I even doubt it even releases the loa... | <p>If you need this functionality, you could write 2 dlls where dll_A loads/Unloads library from dll_B. Use dll_A as as python interface-loader and passthrough for functions in dll_B. </p>
| 46,897 |
<p>I am an absolute beginner having issues with my Monoprice Maker select v2 printer.
The left half of my prints look fine but the right half always gets messed up. When I watch it print the right half of an object it seems that the PLA isn't sticking even though I level the bed thoroughly beforehand. I don't think th... | <p>I found the problem. This model of printer Monoprice Select v2 has bed warping issues so when the bed heated up it would warp severely. I bought a glass bed and all my problems were solved. </p>
| <ul>
<li>Try cleaning bed with isopropyl alcohol to remove grease from the bed. (increases stickyness)</li>
<li>Try increasing bed temp to 70°C (increases stickyness)</li>
<li>If this is not enough, do a fresh bed leveling.</li>
</ul>
| 1,566 |
<p>I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mouse movement outside of the rectangle of the control.</p>
<p>I ... | <p>Yeah, it is messy, I can't think of a way to avoid it though.<br>
You could hide some of the messiness from the client by putting the temporary table creation in a stored procedure (and using "execute immediate" to create they table)<br>
One thing you will need to watch out for is left over temporary tables (should ... | <p>Do you have a specific scenario in mind?
For example, if the LOB holds files, and you are on a company intranet, perhaps you can write a stored procedure to extract the files to a known directory on the network and access them from there.</p>
| 5,902 |
<p>How can I make my compilation optimized for Windows 64 bit?</p>
| <p>A managed project is automatically built according to the architecture selected => default C# project created on AMD64 will be AMD64, X86 on X86. The native one is always 32-bit by default.</p>
<p>To explicitly set a platform:</p>
<p>1 open the solution explorer, select solution, right click->Configuration Manage... | <p>You can compile for 64bit through the <code>/platform</code>-flag. Note that <strong>visual studio Express</strong> has no straightforward 64bit compile setting.</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/ms241064%28v=vs.80%29.aspx" rel="nofollow">here</a> for more information, and <a href="http://... | 24,841 |
<p>Is it possible to do a simple count(*) query in a PHP script while another PHP script is doing insert...select... query? </p>
<p>The situation is that I need to create a table with ~1M or more rows from another table, and while inserting, I do not want the user feel the page is freezing, so I am trying to keep upda... | <p>Without reducing performance? Not likely. With a little performance loss, maybe...</p>
<p>But why are you regularily creating tables and inserting millions of row? If you do this only very seldom, can't you just warn the admin (presumably the only one allowed to do such a thing) that this takes a long time. If you'... | <p>The other users can't see the insertion until it's committed. That's normally a good thing, since it makes sure they can't see half-done data. However, if you want them to see intermediate data, you could throw in an occassional call to "commit" while you're inserting.</p>
<p>By the way - don't let anybody tell y... | 42,968 |
<p>I have the following values being returned in a column.. 0.250000 and 13.000000. I'd like to round the 0.250000 up to 1 and leave the 13 as is. Any easy way to do this since they both fall within the same column?</p>
| <p>Your DBMS probably has a CEILING function. Try that.</p>
| <p>select CEILING( columnname ) from tablename</p>
| 48,235 |
<p>Anyone got a good explanation of "combinators" (Y-combinators etc. and <strong>NOT</strong> <a href="https://en.wikipedia.org/wiki/Y_Combinator_(company)" rel="noreferrer">the company</a>)?</p>
<p>I'm looking for one for the practical programmer who understands recursion and higher-order functions, but doesn't have... | <p>Unless you're deeply into theory, you can regard the Y combinator
as a neat trick with functions, like monads.</p>
<p>Monads allow you to chain actions, the Y combinator allows you to
define self-recursive functions.</p>
<p>Python has built-in support for self-recursive functions, so you
can define them without Y:... | <p>Shortly, Y combinator is a higher order function that is used to implement recursion on lambda expressions (anonymous functions). Check the article <a href="http://mvanier.livejournal.com/2897.html" rel="nofollow noreferrer">How to Succeed at Recursion Without Really Recursing</a> by Mike Vanier - it's one of best p... | 12,313 |
<p>Seems like rel-license only applies to pages not to specific elements... anyone spotted usage for page elements in the wild?</p>
| <p>Have a look here and see if this is along the lines of what you're needing...</p>
<p><a href="http://microformats.org/wiki/rel-license" rel="nofollow noreferrer">Microsoftmats rel-license information</a></p>
| <p>I've never personally run into a situation that required this yet, but would be inclined to do something like this:</p>
<pre><code><p id="someparagraph">Lorum ipsum dolor sit amet.</p>
<div about="#someparagraph">
<a href="http://creativecommons.org/licenses/by/2.0/" rel="license">cc by 2.0&... | 30,767 |
<p>The expected probability of randomly selecting an element from a set of n elements is P=1.0/n .
Suppose I check P using an unbiased method sufficiently many times. What is the distribution type of P? It is clear that P is not normally distributed, since cannot be negative. Thus, may I correctly assume that P is <a h... | <p>With repetitions, your distribution will be binomial. So let X be the number of times you select some fixed object, with M total selections</p>
<p>P{ X = x } = ( M choose x ) * (1/N)^x * (N-1/N)^(M-x)</p>
<p>You may find this difficult to compute for large N. It turns out that for sufficiently large N, this actual... | <p>Is your distribution a <a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28discrete%29" rel="nofollow noreferrer">discrete uniform distribution</a>?</p>
| 27,605 |
<p>In a Java application (JRE 1.5.0_12) on Windows XP, I call a native method:</p>
<pre><code>public native int attachImage( ... );
</code></pre>
<p>... which lives in a Visual C++ 6.0 .dll. It displays an application-modal window. Problem is, the application's tray icon doesn't respond to mouseclicks while this wind... | <p>What GUI package are you using?</p>
<p>You should be able to implement this without resorting to JNI calls.</p>
<p>For instance, in SWT, you can open an application modal shell like this:</p>
<pre><code>Shell shell = new Shell(display,SWT.APPLICATION_MODAL);
</code></pre>
<p>For swing, this would be:</p>
<pre><... | <p>Does your attachImage method not properly set the parent window to your java application window? Getting a hwnd for that could be tricky (GetForegroundWindow/etc?) but it might be necessary?</p>
<p>Also, why does the image part need to be JNI? that might help us find you a solution that avoids the JNI part altoge... | 39,019 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.