instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm just starting out with WiX as I need to be able to automate building an MSI on our CI server. Is there anyway to automatically include all the dependencies of a project?</p>
| <p>The "proj" extension to heat.exe is getting better. <a href="http://wixtoolset.org/documentation/manual/v3/overview/heat.html" rel="nofollow noreferrer">Heat</a> isn't quite ready to be used for production in an automated fashion. It's a very reasonable way to get the initial structure put together but doesn't qui... | <p>In my experience, Wix is a still a very manual process. You have to add each dependency singly - I think the idea was that you would build the Wix installer at the same time you are building your project and add each item in as you are adding it in the code. This way it seems less daunting than having to go back a... | 38,825 |
<p>How would you use set! in a simple procedure f such that evaluating (+ (f 0) (f 1)) will return 0 if the arguments to + are evaluated from left to right but will return 1 if the arguments are evaluated from right to left?</p>
| <p>Easiest approach is probably to store some external state and have the implementation of f affect it's contents.</p>
<pre><code>(define x 0)
(define (f n) (let ((tmp x)) (set! x n) tmp))
</code></pre>
<p>Thus, x is initially 0 and each call to f will return the current value of x and save the argument as the new v... | <p>With <a href="http://community.schemewiki.org/?call-with-current-continuation" rel="nofollow noreferrer">call/cc</a>.</p>
<pre><code>(define (f)
(call/cc
(lambda (c) (+ (c 0) (c 1)))))
(write (f))
</code></pre>
<p>Invoking c within either argument to <code>+</code> causes <code><em>f</em></code> to return i... | 38,549 |
<p>I am kinda repeating this question bit the 1st time it was asked incorrectly.</p>
<p>I have this:</p>
<pre><code><xsd:complexType name="A">
<xsd:sequence>
<xsd:element name="options" type="options"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType n... | <p>Just stick with elements of type B and then use then decorate your instance document elements as described below with the appropriate <code>xsi:type</code> attribute value.</p>
<pre><code><xsd:complexType name="B">
<xsd:complexContent>
<xsd:element name="options" type="ex_opti... | <p>You could make the <code>options</code> sequence open-ended so you can have any number of options and then validate the existing options based on an attribute value. For example, in the following schema, the <code>options</code> list has a <code>type</code> attribute of either <code>A</code> or <code>B</code>, indi... | 25,595 |
<p>When I first started programming, I wrote everything in main. But as I learned, I tried to do as little as possible in my <code>main()</code> methods.</p>
<p>But where do you decide to give the other Class/Method the responsibility to take over the program from <code>main()</code>? How do you do it?</p>
<p>I've se... | <p>In my opinion, the "main" of a sizable project should contain around 3 function calls:</p>
<ul>
<li>Calling an Initialization function that sets up all the required settings, preferences, etc. for the application.</li>
<li>Starting up the main "controller" of the application</li>
<li>Waiting for the main controller... | <p>I think the main method should explain, what the program does at starting up.
So it may call initialzing methods, but the logic should be extracted into methods.</p>
<p>In your example, I would not create a Main() method, but put it into the original one.</p>
| 42,145 |
<p>Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I used OpenSSL to convert to a PEM; opening that as text I see it contains both a <code>BEGIN/END CERTIFICATE</code> section as well as <code>BEGIN/END RSA PRIVATE KEY</code>. The .NET Framework <code>X509Certificate</code> class ... | <p>Oops, I'm behind the times! Looks like <code>X509Certificate2</code> can read PKCS#12 files so there's no need for any conversion.</p>
| <p>Certificates and keys are generally stored separately. Cut the PEM file into two files, one with the certificate and one with the key. You can then use the openssl toolkit to convert each file separately into a DER file.</p>
| 26,254 |
<p>I get the message that the namespace can't be found when I use the code below. Where does the AccessDeniedException live?</p>
<pre><code>try { ... }
catch (SomeKindOfException ex)
{
MessageBox.Show(ex.Message);
}
catch (AccessDeniedException ex)
{
//Do something else
}
</code></pre>
<p>Thanks</p>
| <p>I don't think that's the exception you're looking for. The only one with this name (that I can find) is in a Sharepoint namespace. Try attaching the debugger and seeing exactly what the type of the thrown exception is.</p>
<p>The type of the exception is going to vary depending on your context. So for example, i... | <p>You may need to give the full namespace on the exception, or have a using statement at the top of your code file so .NET knows where to find the exception you're talking about. If that doesn't work, maybe you need to add the DLL that contains that exception to the "REFERENCES" list in your project.</p>
| 37,812 |
<p>I am using attribute_fu to render a nice block of rows for a particular table.</p>
<pre><code><%= f.render_associated_form(@foo.bars, :new => 5) %>
</code></pre>
<p>I would like to have the <code>bar</code> partial have some notion of a bit of state. (Because the notion is specific to the view, I do not ... | <p>I ended up solving this in a thoroughly Rails fashion -- patching :attribute_fu to meet my needs. Hopefully I'll be able to release my patches to the community fairly soon.</p>
| <p>The behavior you describe above seems like it must be a bug in attribute_fu, since the local isn't getting properly passed along, which it definitely should. I'd be interested to know what you did to patch it.</p>
| 33,186 |
<p>I'd love to know if there is a module to parse "human formatted" dates in Perl. I mean things like "tomorrow", "Tuesday", "next week", "1 hour ago".</p>
<p>My research with CPAN suggest that there is no such module, so how would you go about creating one? NLP is way over the top for this.</p>
| <p><a href="http://search.cpan.org/perldoc?Date::Manip" rel="noreferrer">Date::Manip</a> does exactly this.</p>
<p>Here is an example program:</p>
<pre><code>#!/usr/bin/perl
use strict;
use Date::Manip;
while (<DATA>)
{
chomp;
print UnixDate($_, "%Y-%m-%d %H:%M:%S"), " ($_)\n";
}
__DATA__
today
yesterda... | <p>I assume you have context.
how could NLP help here ?
as a wild guess you could just find the nearest date that is an exact date(not relative to today) and use today/tommorow/yesterday to relate to that.</p>
| 37,947 |
<p>I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in Flash using AS3</p>
<p>I'm sure it'll be a right pain...</p>
<p>I have no idea where to start, can anyone offer any pointers? reference material?</p>
<p>----much later---
Thank you all very much for your input... It seems I have a lon... | <p>See <a href="http://lame.sourceforge.net/" rel="nofollow noreferrer">LAME MP3 Encoder</a>. You can checkout their source code and their <a href="http://lame.sourceforge.net/links.php" rel="nofollow noreferrer">link page</a>. <a href="http://www.mpeg.org/" rel="nofollow noreferrer">Mpeg.org</a> should have documents ... | <p>It's going to be <strong>VERY</strong> slow doing this in AS3. You really need a C/C++ implementation if you care at all about how long it will take.</p>
| 7,684 |
<p>Right now I'm not sure...</p>
| <p>I'd say yes. I'm using it. I know for a fact that Universal are using it on some of their (thousands of) sites. I will add some caveats, however: </p>
<ol>
<li>There are serious problems with setting it up, especially if you want to debug into the libraries. </li>
<li>The helper functions favour prototype, as ... | <p>We have been building a fairly large application with it for the past year and a half. Its been nice not to have to deal with the old ASP/Page based model and use the better Model/View/Controller design pattern.</p>
<p>To get the new stuff you really need to work off the trunk of development because they don't do r... | 32,975 |
<p>I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting & setting.</p>
<p>For example (where Foo is a PHP class of my making):</p>
<pre><code>$foo = new Foo();
$foo['fooKey'] = 'foo value';
echo $foo['fooKey'];
</code></pre>
<p>I know that PHP has the _ge... | <p>If you extend <code>ArrayObject</code> or implement <code>ArrayAccess</code> then you can do what you want.</p>
<ul>
<li><a href="http://php.net/arrayobject" rel="noreferrer">ArrayObject</a></li>
<li><a href="http://php.net/arrayaccess" rel="noreferrer">ArrayAccess</a></li>
</ul>
| <p>Nope, casting just results in a normal PHP array -- losing whatever functionality your ArrayObject-derived class had. Check this out:</p>
<pre><code>class CaseInsensitiveArray extends ArrayObject {
public function __construct($input = array(), $flags = 0, $iterator_class = 'ArrayIterator') {
if (is... | 9,083 |
<p>I run (and am presently completely overhauling) a website that deals with theater (njtheater.com if you're interested).</p>
<p>When I query a list of plays from the database, I'd like "The Merchant of Venice" to sort under the "M"s. Of course, when I display the name of the play, I need the "The" in front.</p>
<p... | <p>You are on the right track with two columns, but I would suggest storing the entire displayable title in one column, rather than concatenating columns. The other column is used purely for sorting. This gives you complete flexibility over sorting and display, rather than being stuck with a simple prefix.</p>
<p>This... | <p>I agree with doofledorfer, but I would recommend storing spaces entered as part of the prefix instead of assuming it's a single space. It gives your users more flexibility. You may also be able to do some concatenation in your query itself, so you don't have to merge the fields as part of your business logic. </p... | 35,202 |
<p>I have an application that depends on gpsd and ntpd to accurately set the system time on a linux machine.</p>
<p>gpsd is fed NMEA + PPS</p>
<p>The application is punping ~25MB per second over the network and I think the loading on the system is causing jitter in the time somehow. (loaded PCI express bus causing ir... | <p>Best info I could find on <a href="https://web.archive.org/web/20100414014404/http://www.netcordia.com/community/blogs/terrys_blog/archive/2008/01/07/ntp-accuracy.aspx" rel="nofollow noreferrer">NTP accuracy</a>, seems to point at 1-2 ms in a LAN setting:</p>
<blockquote>
<p>NTP v4 with kernel mods to support it,... | <p>The stratum level of the NTP server in question has no relation to the accuracy of the clock/server. It purely means the distance away from the "reference clock" you are.</p>
<p>What matters more, in regards to NTP accuracy (in regards to time, of course) is network latency between servers, type of server being use... | 15,412 |
<p><a href="https://stackoverflow.com/questions/189925/password-encryption-in-iphone-apps">This question discusses encrypting data on the iPhone</a> using the crypt() function. As an alternative, is there a keychain on the iPhone and if so, what code would I use to access it in order to store login details and then ret... | <p>There is a keychain you can use - for code, the best bet is to check out the GenericKeychain sample application from Apple:</p>
<p><a href="https://developer.apple.com/library/ios/DOCUMENTATION/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html" rel="nofollow noreferrer">GenericKeychain sample</a... | <p>Here is one more good wrapper class from Mr.Granoff
<a href="https://github.com/granoff/Lockbox" rel="nofollow">https://github.com/granoff/Lockbox</a>
Thanks</p>
| 23,185 |
<p>What is the difference between display:block and display:inline</p>
| <p>Block elements will typically stack vertically whereas inline elements will line up horizontally. </p>
<p>Two Divs will stack on top of each other, but if you set them to display:inline, they will be next to each other horizontally. Vise-versa with Span tags.</p>
| <p>Block uses the full width available, with a new line before and after. Inline uses only the width it needs without forcing new lines.</p>
| 13,069 |
<p>I am using a Cursor in my stored procedure. It works on a database that has a huge number of data. for every item in the cursor i do a update operation. This is taking a huge amount of time to complete. Almost 25min. :( .. Is there anyway i can reduce the time consumed for this?</p>
| <p>When you need to do a more complex operation to each row than what a simple update would allow you, you can try:</p>
<ul>
<li>Write a User Defined Function and use that in the update (probably still slow)</li>
<li>Put data in a temporary table and use that in an UPDATE ... FROM:</li>
</ul>
<p>Did you know about th... | <p>Are you updating the same data that the cursor is operating over?</p>
<p>What type of cursor? forward only? static? keyset? dynamic?</p>
| 27,737 |
<p>Im using Prusa Slicer 2.1 for my FlyingBear Ghost 4.</p>
<p>I just changed my 0.4 mm nozzle for a 0.2 mm but it seems to jam in the heater probably due to too much filament trying to get out by the nozzle. Where is the setting to reduce the filement speed and how much I should reduce it?</p>
<p>Here are my settings:... | <p>0.2 mm and 0.4 mm are half the diameter, but the maximum flow is not just half: Flow scales with the area. The 0.4 mm nozzle has an area 4 times as the 0.2 mm one:</p>
<p><span class="math-container">$\frac{A_1} {A_2}=\frac {0.2^2}{0.1^2}=4$</span></p>
<p>You need to reduce <code>print speed</code> or the <code>volu... | <p>The discussion about slowing the print speed is important, but in my experience it is not at the root of the problem, and slowing down printing may make it worse.</p>
<p>If ny "heater" you mean the complete hot-end, then I suspect you are jamming in the cooler part of the hot-end. This cooler part is sepa... | 1,743 |
<p>I'm working on a query that needs to have some data rows combined based on date ranges. These rows are duplicated in all the data values, except the date ranges are split. For example the table data may look like</p>
<pre><code>StudentID StartDate EndDate Field1 Field2
1 9/3/2007 10/20/2007 ... | <p>The following code should work. I've made a few assumptions as follows: there are no overlaps of date ranges, there are no NULL values in any of the fields, and the start date for a given row is always less than the end date. If your data doesn't fit these criteria, you'll need to adjust this method, but it should p... | <p>This is a classic problem in SQL (the language) e.g. covered in Joe Celko's books 'SQL for Smarties" (chapter 23, Regions, Runs, Gaps, Sequences and Series) and his latest book "Thinking in Sets" (chapter 15). </p>
<p>While it's 'fun' to fix the data at run time with a monster query, for me this is one of those sit... | 16,965 |
<p>I was looking at <a href="http://tldp.org/LDP/abs/html/why-shell.html" rel="nofollow noreferrer">http://tldp.org/LDP/abs/html/why-shell.html</a> and was struck by:</p>
<blockquote>
<p>When not to use shell scripts</p>
<p>...</p>
<ul>
<li>Mission-critical applications upon which you are betting the fut... | <p>Using shell scripts is fine when you're using their strengths. My company has some class 5 soft switches and the call processing code and the provisioning interface is written in java. Everything else is written in KSH - DB dumps for backups, pruning, log file rotation, and all the automated reporting. I would ar... | <p>Scripts are inappropriate for implementing certain mission-critical functions, since they must have both +r and +x permissions to function. Executables need only have +x.</p>
<p>The fact that a script has +r means users might be able to make a copy of the script, edit/subvert it, and execute their edited Cuckoo's-E... | 3,793 |
<p>Which is faster, python webpages or php webpages?</p>
<p>Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php? </p>
<p>I know that serving a python base webpage via cgi is slower than php because of its long start up every time.</p>
<p>I enjoy usin... | <p>It sounds like you don't want to compare the two <strong>languages</strong>, but that you want to compare two <strong>web systems</strong>.</p>
<p>This is tricky, because there are many variables involved.</p>
<p>For example, Python web applications can take advantage of <a href="http://code.google.com/p/modwsgi/"... | <p>I had to come back to web development at my new job, and, if not Pylons/Python, maybe I would have chosen to live in jungle instead :) In my subjective opinion, PHP is for kindergarten, I did it in my 3rd year of uni and, I believe, many self-respecting (or over-estimating) software engineers will not want to be bot... | 10,268 |
<p>I develop and manage about 45 WindowsCE5 devices. Updating applications on the devices is a nightmare. Is it possible/feasible to do Click-Once on the CF?</p>
<p>I take the lack of answers to be "No". :)</p>
<p><strong>EDIT</strong>: This is a duplicate of <a href="https://stackoverflow.com/questions/116713">qu... | <p>We do a lot of work with CF apps here. If your devices are wireless capable, you can build auto-update functionality into your app without a lot of trouble. Basically when the app starts up, it checks a predefined URL for a manifest file, parses it to find out what version of the .exe is sitting on the server and ... | <p>Not sure, if not you could always try something like <a href="http://www.modaco.com/category/332/apptodate/" rel="nofollow noreferrer">http://www.modaco.com/category/332/apptodate/</a></p>
| 26,113 |
<p>Authorize.net offers a "Silent POST" feature for their Automated Recurring Billing. It's supposed to POST data to a url of your choosing, telling you whether they were able to charge the customer, how much, etc. The problem is, it isn't very well documented.</p>
<ul>
<li>Is there any way to test a post to that URL?... | <p>Better late then never: <a href="http://www.johnconde.net/blog/all-about-authorize-nets-silent-post/" rel="noreferrer">All About Authorize.Net’s Silent Post</a></p>
| <p>You still have to call your account rep for them to activate Silent Post URL with your account because that is not something that is enabled automatically</p>
| 12,950 |
<p>I must implement a web service which expose a list of values (integers, custom classes etc).
My working solution returns a <code>List<T></code>, and according to FxCop it is better to return a <code>Collection<T></code> or <code>ReadOnlyCollection<T></code>.</p>
<p>If I choose to return a <code>Re... | <p>List<T> or Collection<T> are fine in this case.</p>
<p>In terms of the original question, you can wrap a List<T> in a Collection<T> very simply:</p>
<pre><code>List<Foo> list = new List<Foo>();
// ...
Collection<Foo> col = new Collection<Foo>(list);
</code></pre>
<p... | <p>I usually return IList<T> from a WCF web service: FxCop is happy enough with this.
Not sure if this works with ASMX web services.</p>
| 24,039 |
<p>Are delegates the same thing as callbacks? Or are they related somehow?</p>
| <p>A "callback" is a term that refers to a coding design pattern, available in any language that has function pointers, or an analogue to function pointers (which is kinda what a delegate is) </p>
<p>In this pattern, you pass a pointer to a function to another function, so that within the called function, it can "cal... | <p>The service class has a variable function called a delegate.
The calling class has a preferred function that it wants run called a callback.</p>
<p>The calling class sets the delegate to it's callback.</p>
<p>The difference between a delegate and a callback is the perspective: The service class calls the delegate ... | 37,084 |
<p>I need to add role based permissions to my Rails application, and am wondering what the best plugins out there are to look into. I am currently using the RESTful authentication plugin to handle user authentication. Why is the plug in you suggest better than the other ones out there?</p>
| <p>I use, and really like, role_requirement:
<a href="http://code.google.com/p/rolerequirement/" rel="nofollow noreferrer">http://code.google.com/p/rolerequirement/</a></p>
| <p>We've put role_requirement into <a href="http://github.com/fudgestudios/bort/tree/master" rel="nofollow noreferrer">Bort</a> too, as it's probably the best solution out there at the moment.</p>
| 10,477 |
<p>I have some code which needs to ensure some data is in a mysql enum prior to insertion in the database. The cleanest way I've found of doing this is the following code:</p>
<pre><code>sub enum_values {
my ( $self, $schema, $table, $column ) = @_;
# don't eval to let the error bubble up
my $columns = $... | <p>No need to be so heroic. Using a reasonably modern version of <a href="http://search.cpan.org/dist/DBD-mysql/" rel="noreferrer">DBD::mysql</a>, the hash returned by <a href="http://search.cpan.org/dist/DBI/" rel="noreferrer">DBI</a>'s <a href="http://search.cpan.org/dist/DBI/DBI.pm#column_info" rel="noreferrer">col... | <p>I spent part of the day asking the #dbix-class channel over on MagNet the same question and came across this lack of answer. Since I found the answer and nobody else seems to have done so yet, I'll paste the transcript below the TL;DR here:</p>
<pre><code>my $cfg = new Config::Simple( $rc_file );
my $mysql = $cfg-... | 28,372 |
<p>Excluding the Micro Framework Emulator ;)</p>
| <p>A well known one is <a href="http://devicesolutions.net/Products/Tahoe/tabid/55/Default.aspx" rel="nofollow noreferrer">Tahoe</a>. Others are</p>
<ul>
<li><a href="http://www.sjjmicro.com/EDK.html" rel="nofollow noreferrer">http://www.sjjmicro.com/EDK.html</a></li>
<li><a href="http://www.ghielectronics.com/details... | <p><strong><a href="http://www.tinyclr.com/hardware/1/fez-domino" rel="nofollow">Domino</a></strong> and <strong><a href="http://www.ghielectronics.com/catalog/product/135/" rel="nofollow">Panda</a></strong> with it's many Arduino compatible shields are highly affordable and well supported.</p>
| 13,591 |
<p>I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of .NET examples, but no success unmanaged). Thanks.</p>
| <p>The following works great for printing with the win32api from C++</p>
<pre><code>char szPrinterName[255];
unsigned long lPrinterNameLength;
GetDefaultPrinter( szPrinterName, &lPrinterNameLength );
HDC hPrinterDC;
hPrinterDC = CreateDC("WINSPOOL\0", szPrinterName, NULL, NULL);
</code></pre>
<p>In the future ins... | <p>Unmanaged C++ doesn't exist (and managed C++ is now C++/CLI), if you are referring to C++, using unmanaged as a tag is just sad...</p>
| 13,042 |
<p>I would like to redirect <code>www.example.com</code> to <code>example.com</code>. The following htaccess code makes this happen:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
</code></pre>
<p>But, is there a way to do this in a generic fashion w... | <pre><code>RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</code></pre>
<p>Same as <a href="https://stackoverflow.com/a/235064/662581">Michael's</a> except this one works :P</p>
| <p>Hi you can use following rules on your htaccess file:</p>
<pre><code>RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
</code></pre>
| 29,052 |
<p>Can somebody point me at a <strong>good</strong> tutorial for py2exe? I've read over the <a href="http://www.py2exe.org/index.cgi/Tutorial" rel="nofollow noreferrer">official tutorial</a> but it is rather light on details, compared to all the options one can use when building an executable out of a python script. ... | <p>Regarding "Py2EXE and wxPython", the page mentions the import statement "from wxPython.wx import *". This is the old wxPython (several years old, I think). In my app, I just do "import wx", and I don't have any major troubles.</p>
<p>I have one tip for wxPython and py2exe: you need a manifest if you want your app... | <p>Don't know about a better tutorial, but there is some information to be found at the news list.</p>
<p><a href="http://news.gmane.org/gmane.comp.python.py2exe" rel="nofollow noreferrer">http://news.gmane.org/gmane.comp.python.py2exe</a></p>
| 21,242 |
<p>I have seen sample source code around that uses different ways of releasing/dealloc'ing objects, so I was wondering which way is deemed the "best" one. A few options on <code>-dealloc</code>:</p>
<p>1) Release objects</p>
<pre><code>- (void)dealloc {
[obj1 release];
[obj2 release];
[super dealloc];
}
<... | <p>Method 1 is the only recommended method. It's also good practice to set them to nil AFTER you've released them.</p>
<p>Method 2 only works for properties that manage their own object/value retaining, so it's not universally applicable. And if you implement your own setter method that performs other actions when the... | <p>If obj1 and obj2 are properties using @synthesize-d accessors, then method 1 and method 2 are equivalent. If either of those two conditions is not true then the effect is rather different. If they're not properties, then method 2 just sets the pointers to nil without doing anything that would deallocate the object... | 47,505 |
<p>I have up to 4 files based on this structure (note the prefixes are dates)</p>
<ul>
<li>0830filename.txt</li>
<li>0907filename.txt</li>
<li>0914filename.txt</li>
<li>0921filename.txt</li>
</ul>
<p>I want to open the the most recent one (0921filename.txt). how can i do this in a batch file?</p>
<p>Thanks.</p>
| <p>This method uses the actual file modification date, to figure out which one is the latest file:</p>
<pre><code>@echo off
for /F %%i in ('dir /B /O:-D *.txt') do (
call :open "%%i"
exit /B 0
)
:open
start "dummy" "%~1"
exit /B 0
</code></pre>
<p>This method, however, chooses the last file in alphabetic ... | <p>Use regular expression to parse the relevant integer out and compare them.</p>
| 7,504 |
<p>In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. I... | <p>I have a dialog that I wrote called an OpenFileOrFolder dialog that allows you to open either a folder or a file.</p>
<p>If you set its AcceptFiles value to false, then it operates in only accept folder mode.</p>
<p><a href="https://github.com/scottwis/OpenFileOrFolderDialog" rel="noreferrer">You can download the ... | <p>I know the question was on configuration of <code>OpenFileDialog</code> but seeing that Google brought me here i may as well point out that if you are ONLY looking for folders you should be using a <code>FolderBrowserDialog</code> Instead as answered by another SO question below</p>
<p><a href="https://stackoverflo... | 5,093 |
<p>We're moving a solution with 20+ projects from .net 2.0 to 3.5 and at the same time moving from Visual Studio 2005 to 2008. We're also at the same time switching from MS Entlib 2.0 to 4.0. </p>
<ul>
<li>Is there any reasons not to let the
Visual Studio wizard convert the
solution for us?</li>
<li>Is 3.5 fully backw... | <p>We upgrade a rather large solution (20+ projects) from 2005 to 2008 but it was really trivial. Project upgrade only basically. The underlying framework is still the same since both 3.0/3.5 and 2.0 share the same core framework.</p>
<p>As was said above, even though you are upgrading, you don't need to change the ... | <ul>
<li>Is there any reasons not to let the Visual Studio wizard convert the solution for us?</li>
</ul>
<p>No.</p>
<ul>
<li>Is 3.5 fully backwards compatible with 2.0?</li>
</ul>
<p>No. There are new features in 3.5 that wouldn't port backwards natively. And (IIRC) there are some deprecations going from 2.0 to 3.5... | 19,502 |
<p>my machine did an automatic reboot, due to patch applied by my network in my company, and last error i saw reported something with the csproj.user file. Now each time i try to launch my solution, it opens and then brings the dialog to send the report to MS. If i look at the error log in event viewer it shows this</p... | <p>I believe the .user file just has your personal IDE settings so they can be restored when you re-open VS. Apparently, your .user file became corrupted. It shouldn't hurt anything to delete it other than you will lose any personal settings in the IDE and have to redo them.</p>
| <p>Hmmm, some file got deleted. I hope it was part of your project and not a .net framework file. Try and recreate your project and solution and copy your file back into it. </p>
<p>Hopefully this is not happening when you create a new solution or project. If it is you may need to reinstall Visual Studio.</p>
| 46,097 |
<p>What is the best way to find if an object is in an array?</p>
<p>This is the best way I know:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function include(arr, obj) ... | <p>As of ECMAScript 2016 you can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes" rel="noreferrer"><code>includes()</code></a></p>
<pre><code>arr.includes(obj);
</code></pre>
<p>If you want to support IE or other older browsers:</p>
<pre><code>function includ... | <p>Here's some meta-knowledge for you - if you want to know what you can do with an Array, check the documentation - here's the Array page for Mozilla</p>
<p><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/J... | 17,357 |
<p>Every time that I change a value in the designer after saving it, the .designer.cs file will be deleted. </p>
<p>Can anyone tell me how can I fix this problem?</p>
| <p>Move <code>using</code> directives in your <code>DataContext.cs</code> and <code>DataContext.designer.cs</code> files into the <code>namespace</code> scope.</p>
| <p>Don't place your own code in the designer file, instead use a separate file leveraging the partial classes concept.</p>
| 37,323 |
<p>I create new ASP.NET web application that use SMTP to send message. The problem is the smtp was not authenticated from who send the message. </p>
<p>How can I make SMTP authenticated in my program? does C# have a class that have attribute for enter username and password?</p>
| <pre><code>using System.Net;
using System.Net.Mail;
using(SmtpClient smtpClient = new SmtpClient())
{
var basicCredential = new NetworkCredential("username", "password");
using(MailMessage message = new MailMessage())
{
MailAddress fromAddress = new MailAddress("from@yourdomain.com");
sm... | <p>In my case even after following all of the above. I had to upgrade my project from .net 3.5 to .net 4 to authorize against our internal exchange 2010 mail server.</p>
| 38,192 |
<p>In order to merge independant HTML changes, I'm looking for recomendations for a 3-way comparison / merge library for HTML. The common 3-way text merge algorithms perform poorly because they do not understand the tree like structure of HTML and XML. Of course, such a library must understand the looser syntax of HT... | <p>You could also just go cheep: Run the files through <a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer">tidy</a> and then compare. This will result in similar structures, where new / deleted children will show up with traditional diff tools. It breaks down on removal / addition of surrounding nodes - go... | <p>A simple google search offered up: <a href="http://www.codeproject.com/KB/cs/differ.aspx" rel="nofollow noreferrer">Differ</a>. I've never used it so I can't vouch for the quality of that :-)</p>
| 9,120 |
<p>I'm using VSTS Database Edition GDR Version 9.1.31024.02</p>
<p>I've got a project where we will be creating multiple databases with identical schema, on the fly, as customers are added to the system. It's one DB per customer. I thought I should be able to use the deploy script to do this. Unfortunately I always ge... | <p>Better late than never, I know how to get the <code>$(DefaultDataPath)$(DatabaseName)</code> file names from your second example. </p>
<p>The SQL you're showing in your first code snippet suggests that you don't have scripts for creating the database files in your VSTS:DB project, perhaps by deliberately excluded ... | <p>Hmm, well it seems that the best answer so far (given the over whelming response) is to edit the file after the fact... Still looking</p>
| 43,588 |
<p>I have a requirement on my current project (a Flex app which will be run in Flash player) to display an arbitrary subset of the components on a form while hiding all the other components based on certain aspects of the application state. There are about a dozen different text boxes and drop downs, but some become i... | <p>I don't know if this is a good solution or not, but when I was in exactly the same situation, I did basically your first method. Set <code>visible = false</code> and also set <code>includeInLayout = false</code> to prevent those "gaps" you were talking about. It's a very simple solution, very easy and quick to imp... | <p>If states won't do, check out articles that explain the components life cycle.</p>
<p>If you create a class that extends a flex component like Canvas, you will define all components in a function that override createChildren. You will revisit the layout in another function that override updateDisplayList</p>
<ul>
... | 25,780 |
<p>What is the resolution of the image for the tab bar item?</p>
<p>And also, please provide some other useful information regarding that tab item image.</p>
<p>Thanks in advance.</p>
| <p>The documentation says that the tab bar image is usually 30x30, but I've found that the best size to setup the images is 48x32 pixels. This size still renders and gives you a bit more space.</p>
<p>The image is a PNG with transparency, only the mask is used. The UI renders the mask gray when unselected or blue/chro... | <p>Check the "UITabBarItem Class Reference" in the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UITabBarItem_Class/Reference/Reference.html" rel="nofollow noreferrer">SDK documentation</a></p>
| 18,286 |
<p>Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.)</p>
| <p>If you want to store a pickled object, you'll need to use a blob, since it is binary data. However, you can, say, base64 encode the pickled object to get a string that can be stored in a text field.</p>
<p>Generally, though, doing this sort of thing is indicative of bad design, since you're storing opaque data you ... | <p>See this solution at SourceForge:</p>
<p>y_serial.py module :: warehouse Python objects with SQLite</p>
<p>"Serialization + persistance :: in a few lines of code, compress and annotate Python objects into SQLite; then later retrieve them chronologically by keywords without any SQL. Most useful "standard" module fo... | 24,212 |
<p>Does anybody knows why this snippet returns <code>false</code> even if the passed string is "Active"?</p>
<pre><code>if ($('status_'+id).getText()=="Active")
</code></pre>
<p>I've also tried changing the code to</p>
<pre><code>if ($('status_'+id).getText()==String("Active"))
</code></pre>
<p>and</p>
<pre><code>... | <p>A key difference between C++ and .NET/Java is the automatic reclaiming of memory that is no longer required. This is known as <strong>garbage collection</strong>. For this property, they are known as <strong>managed</strong> platforms.</p>
<p>Both Java/.NET delay the compilation of bytecode into native code until... | <p>It depends, if you are talking about the fact they run on a virtual machine then they are regarded as JIT-compiled (Just-In-Time) or bytecode (logically 1/2 compiled and 1/2 interpreted).</p>
<p>If you are talking about the garbage collection then they are simply referred to as garbage collected.</p>
<p>The key po... | 24,430 |
<p>Here's some code I saw once. Can you see what's wrong with it?</p>
<p>[updated]</p>
<pre><code>public class ResourceManager1
{
private final String mutex = "";
Object resource = null;
public Object getResource()
{
synchronized (mutex)
{
if (resource == null)
... | <p>Never synchronize on strings, particularly string literals which are interned. You've basically just got a single lock.</p>
<p>In general, never synchronize on any reference that might be visible outside your class (including "this") <em>unless</em> the purpose of the external visibility is precisely for locking pu... | <p>mutex is not final and resource is not private.</p>
<p>Besides, you need a getResource method that returns resource, but I suppose this is just a typo.</p>
| 44,669 |
<p>Like the title says, how can I remove GAC assembly file using vbscript?</p>
| <p>You can run this to uninstall it from GAC:</p>
<pre><code>gacutil /u YourAssembly
</code></pre>
| <p>As I remember gacutil in a .NET enabled shell. </p>
<pre><code>C:\>gacutil
Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.21022.8
Copyright (c) Microsoft Corporation. All rights reserved.
Usage: Gacutil <command> [ <options> ]
Commands:
/i <assembly_path> [ /r <...> ] ... | 36,486 |
<p>I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?</p>
| <p>You can use <a href="http://msdn.microsoft.com/en-us/library/7c5fyk1k.aspx" rel="noreferrer"><code>HttpUtility.HtmlDecode</code></a></p>
<p>If you are using .NET 4.0+ you can also use <a href="http://msdn.microsoft.com/en-us/library/ee388354.aspx" rel="noreferrer"><code>WebUtility.HtmlDecode</code></a> which does n... | <p>Write static a method into some utility class, which accept string as parameter and return the decoded html string.</p>
<p>Include the <code>using System.Web.HttpUtility</code> into your class</p>
<pre><code>public static string HtmlEncode(string text)
{
if(text.length > 0){
return HttpU... | 14,918 |
<p>I'm using the Accessibility API to detect when a certain application opens windows, closes windows, when the windows are moved or resized, or made main and/or focused. However the client app seems to move a window to front without an Accessibility API notification being
fired.</p>
<p>How can my application detect w... | <p>I've been unable to subscribe to current window changes, but you can ask the accessibility API for the current application, and the current applications most foreground window. </p>
<p>Imagine you have a class called CurrentAppData, with the following data:</p>
<pre><code>@interface CurrentAppData : NSObject {
... | <p>What about <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/uid/20000945-DontLinkElementID_287" rel="nofollow noreferrer">NSAccessibilityFocusedUIElementChangedNotification</a>?</p>
| 45,201 |
<p>Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?</p>
| <p>I prefer the <a href="http://www.php.net/gd" rel="nofollow noreferrer">GD library</a> - check out <a href="http://www.php.net/manual/en/image.examples.php" rel="nofollow noreferrer">the Examples</a>, and this example:</p>
<pre><code><?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
... | <p>MagickWand is pretty good for that as well, and pretty powerful.</p>
<p><a href="http://www.bitweaver.org/doc/magickwand/index.html" rel="nofollow noreferrer">http://www.bitweaver.org/doc/magickwand/index.html</a></p>
<p>This snippet will take an image, wrie the 'rose' in Vera, or whatever fonts are available, and... | 4,473 |
<p>We attempt to do agile development at my current job and we succeed for the most part. The main problem seems to be that the developers on the project are always waiting for requirements at the beginning of the sprint and rushing to get get things down by the end. The business analysts who are delivering the require... | <p>Don't wait. Build a prototype based on whatever minimal requirements you do have and get feedback ASAP from the product owner. More often than not they don't know what they want anyway - if you can show them something tangible as a starting point you're more likely to get useful feedback. Also, once you have a be... | <p>I see a few ways to handle this: </p>
<p>Option 1, Under SCRUM, you should have a Product Owner who is managing your product backlog, which is supposed to contain requests for features of the software. If the feature consists of something vague like 'Customize screen X' and you decide to add that to your sprint, th... | 14,982 |
<p>What is the regular expression for a decimal with a precision of 2?</p>
<p><em>Valid examples</em>:</p>
<pre><code>123.12
2
56754
92929292929292.12
0.21
3.1
</code></pre>
<p><em>Invalid examples:</em></p>
<pre><code>12.1232
2.23332
e666.76
</code></pre>
<p>The decimal point may be optional, and integers may als... | <p>Valid regex tokens vary by implementation. A generic form is:</p>
<pre><code>[0-9]+(\.[0-9][0-9]?)?
</code></pre>
<p>More compact:</p>
<pre><code>\d+(\.\d{1,2})?
</code></pre>
<p>Both assume that both have at least one digit before and one after the decimal place.</p>
<p>To require that the whole string is a nu... | <pre><code> function DecimalNumberValidation() {
var amounttext = ;
if (!(/^[-+]?\d*\.?\d*$/.test(document.getElementById('txtRemittanceNumber').value))){
alert('Please enter only numbers into amount textbox.')
}
else
{
alert('Right Number'... | 39,677 |
<p>Since I keep showing up late for answering questions tagged php where i actually know the answer i figured i'd try asking a question myself.</p>
<p>I've been working on so many complete rewrites of a custom template engine in php for so long and so many times that i thought i'd ask for opinions.</p>
<p>In short, t... | <p>Why not just use PHP as your templating system. PHP <em>IS</em> the template system.</p>
<p>What is wrong with just dumping <code><?php=$variable;?></code> in an HTML template? You can use foreach loops, etc.
Just make sure that you run it from within a scope that cannot access any variables you do not want.... | <p>Here's an article on templating engines: <a href="http://massassi.com/php/articles/template_engines/" rel="nofollow noreferrer">http://massassi.com/php/articles/template_engines/</a></p>
<p>You're doing it wrong.</p>
| 23,850 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/61320/svn-plugins-for-eclipse-subclipse-vs-subversive">SVN plugins for Eclipse - Subclipse vs. Subversive</a> </p>
</blockquote>
<p>I've been using Subclipse (an SVN plugin for Eclipse), for quite a while, but ... | <p><a href="https://stackoverflow.com/questions/61320/svn-plugins-for-eclipse-subclipse-vs-subversive#61328"><strong>SVN plugins for Eclipse - Subclipse vs. Subversive</strong></a></p>
| <p>I use tortiseSVN and have had nothing but a positive experience. </p>
| 24,082 |
<p>I need to find a good Lua to JavaScript converter; lua2js on luaforge.org is out of date (3 or so years old and looks like it doesn't work on Lua 5.1) and I haven't yet found anything on Google.</p>
<p>Does anyone have any experience with any other converters out there? It should work on Lua 5.1 and preferably be .... | <p>This is a recurrent question on the Lua list, i guess because of the superficial similarity of the two languages.</p>
<p>Unfortunately, there are many important differences that are not so obvious. Making it work need either a full-blown compiler targeting JS instead of Lua's bytecode, or rewriting the Lua VM in Ja... | <p>Translation to javascript is interesting to allow for a javascript replacement on the browser-side. We could take a little type safety on the browser too. Targeting javascript as a platform is targeting one of the most pervasive platform, the browsers of the planet. GWT does java2js but I am not sure if I want to in... | 21,229 |
<p>This only happens with IE (all versions), on line 1120 in
jquery-1.2.6.js I get the following error:</p>
<pre><code>Line 1120:
Invalid Property Value
</code></pre>
<p>The line in the js file is the following:</p>
<pre><code>elem[name] = value;
</code></pre>
<p>It is inside attr: <code>function( elem, name, value... | <p>If <a href="http://groups.google.com/group/jquery-en/browse_thread/thread/3ef3a830916b2fbb" rel="nofollow noreferrer">this</a> is also you, it sounds like you're trying to change the CSS of the element rather than give it an attribute.</p>
<p>If that is the case then try this instead;</p>
<pre><code>jQuery.css('co... | <p>This error can also occur if you call jQuery.css with an invalid attribute value, such as: </p>
<pre><code>$('div.foo').css('padding-left', 'NaNpx');
</code></pre>
| 41,595 |
<p>I have created a webservice in .net 2.0, C#. I need to log some information to a file whenever different methods are called by the web service clients. </p>
<p>The problem comes when one user process is writing to a file and another process tries to write to it. I get the following error:</p>
<blockquote>
<p>The... | <p>The locking is probably failing because your webservice is being run by more than one worker process.
You could protect the access with a named mutex, which is shared across processes, unlike the locks you get by using <code>lock(someobject) {...}</code>:</p>
<pre><code>Mutex lock = new Mutex("mymutex", false);
lo... | <p>Maybe write a "queue line" of sorts for writing to the file, so when you try to write to the file it keeps checking to see if the file is locked, if it is - it keeps waiting, if it isn't locked - then write to it.</p>
| 14,536 |
<p>I've seen (and used) on various projects this layout, with a group of fields followed by a group of properties:</p>
<pre><code>private int MyIntField;
private string MyStringField;
public int MyInt {
get { return MyIntField; }
set { MyIntField = value; }
}
public string MyString {
get { return My... | <p>I think it is whatever the team feels comfortable with. Settle on a standard for the project/company/language and stick to it. I prefer the private variables all together, the methods/interfaces together, the private members....I think you get the point.</p>
| <p>To reiterate what Kenny said above, it's really all about the coding standards of your organization. It's hard to objectively classify one style over the other, although everyone seems to have their own opinion.</p>
<p>I generally tend to prefer having data and methods groups by access modifier, and so in this cas... | 34,616 |
<p>I began build LCD printer and I want make some modifications.</p>
<p>What if I will place LCD below VAT<a href="https://i.stack.imgur.com/Tznt5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tznt5.jpg" alt="enter image description here"></a>? Will the display break when printing? what are the ri... | <p>Your calculations about the theoretical extruder resolution are spot on. I did a similar calculation to evaluate which extruder to use with different hot ends, I paste the results. The dark cells are the input cells, the rest is calculated. You can see that for some lines I entered directly the mm/microstep value, s... | <h2>Short answer</h2>
<p><em>Usually</em> no.</p>
<h2>Long answer</h2>
<p>There are several big factors that limit how small things you can print. The bigger ones are pretty much:</p>
<ul>
<li>Positional accuracy and settings (limited by steps/mm in X, Y, Z)</li>
<li>Nozzle diameter</li>
</ul>
<p>Now, why don't you nee... | 1,603 |
<p>I have made some prints with the Ultimaker 2+ and Ultimaker 2 Extended+. The prints are in PLA. For slicing, I use Cura and I check the support checkbox (haven't gone to advanced settings to adjust support yet). I can clearly see that there is a little space between the support and the print. The supports often look... | <p>The Ultimaker 2+ is a single extruder 3D printer. Without changing the PLA spool and PVA spool continuously during the print you practically cannot make water soluble supports on the Ultimaker 2+ which can be done on the Ultimaker 3. Note that PVA (from experience) is strange material to print, the filament is very ... | <p>PLA and ABS are hard plastics. They are not water-soluble. If you print with these materials, just snap printed support materials off and clean the interface layer with a knife and sanding.</p>
<p>To remove the support, it is best to use strong tweezers or a pair of pliers to grip and then apply some force. General... | 1,491 |
<p>Do you guys keep track of stored procedures and database schema in your source control system of choice?</p>
<p>When you make a change (add a table, update an stored proc, how do you get the changes into source control? </p>
<p>We use SQL Server at work, and I've begun using darcs for versioning, but I'd be curio... | <p>We choose to script everything, and that includes all stored procedures and schema changes. No wysiwyg tools, and no fancy 'sync' programs are necessary.</p>
<p>Schema changes are easy, all you need to do is create and maintain a single file for that version, including all schema and data changes. This becomes your... | <p>If you're looking for an easy, ready-made solution, our <a href="http://tessik.com/sqlhistorian" rel="nofollow">Sql Historian</a> system uses a background process to automatically synchronizes DDL changes to TFS or SVN, transparent to anyone making changes on the database. In my experience, the big problem is maint... | 10,276 |
<p>I need to edit (using javascript) an SVG document embedded in an html page.</p>
<p>When the SVG is loaded, I can access the dom of the SVG and its elements. But I am not able to know if the SVG dom is ready or not, so I cant' perform default actions on the SVG when the html page is loaded.</p>
<p>To access the SVG... | <p>On your embedding element (e.g 'embed', 'object', 'iframe') in the main document add an <code>onload</code> attribute which calls your function, or add the event listener in script, e.g <code>embeddingElm.addEventListener('load', callbackFunction, false)</code>. Another option might be to listen for <code>DOMContent... | <p>You can assign an onload event handler to an element within your SVG document and have it call a javascript function in the html page. onload maps to SVGLoad.</p>
<p><a href="http://www.w3.org/TR/SVG11/interact.html#LoadEvent" rel="nofollow noreferrer">http://www.w3.org/TR/SVG11/interact.html#LoadEvent</a></p>
<bl... | 43,763 |
<p>Brand new to Slic3r, I've been using Cura for a while, so not sure is happening. I tried to load <a href="https://www.shapeways.com/product/YDCPJF8KV/knight" rel="nofollow noreferrer">this Knight model</a> into Slic3er (v1.2.9 running on OS X), and it's reporting "Manifold: auto-repaired (11430 errors)", and the mo... | <p>Dimensional accuracy is not as important as dimensional uniformity. I can print with undersized (or oversized) filament, adjusting the flow appropriately, provided the filament has a consistent diameter. When creating filament in-house, without expensive equipment, it is difficult to maintain the same diameter throu... | <p>Put it simply: they say 1.75 mm with a ± error of 0.05 mm. Which means your flow may vary ±2.9 % while you are printing creating blobs and such. </p>
<p>The smaller the filament tolerance, the more expensive the production costs.</p>
| 501 |
<p>Will learning C++ help me build native applications with good speed? Will it help me as a programmer, and what are the other benefits?</p>
<p>The reason why I want to learn C++ is because I'm disappointed with the UI performances of applications built on top of JVM and .NET. They feel slow, and start slow too. Of c... | <p>If you want to build Windows applications that will run without frameworks such as .NET or virtual machines/interpreters, then your only really viable choices are going to be Visual Basic or C/C++</p>
<p>I've written some small Windows apps before in C++ code, and there is definitely a benefit in terms of speed and... | <p>C++ will indeed potentially get you a leaner, meaner and faster application (if you do it right). </p>
<p>However, the .NET framework is built for comfort from a developer point of view; a vast improvement over Win32 API or MFC, which may seem like hard work in comparison, So consider how you will implement the a... | 20,322 |
<p>You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation.</p>
<p>So an example Perl problem:</p>
<p>A simple script which recursively i... | <p>This sounds like a job for <a href="http://search.cpan.org/perldoc?File::Find::Rule" rel="nofollow noreferrer">File::Find::Rule</a>:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
use autodie; # Causes built-ins like open to succeed or die.
# You can 'use Fatal qw(open)' if autodie is not i... | <p>I write a subroutine that reads a directory with <code>readdir</code>, throws out the "." and ".." directories, recurses if it finds a new directory, and examines the files for what I'm looking for (in your case, you'll want to use <code>utime</code> or <code>stat</code>). By time the recursion is done, every file ... | 19,548 |
<p>For example, if I have a network spec like 172.20.10.0/24, "24" is the bitcount. What's the best way to convert that to a netmask like 0xffffff00 ?</p>
| <p>Assuming 32-bit mask and 32-bit int.</p>
<pre><code>int keepBits = 24; /* actually get it from somewhere else? */
int mask = (0xffffffff >> (32 - keepBits )) << (32 - keepBits);
</code></pre>
<p>Note: this isn't necessarily the answer to the question "What's the best way to get the network mask for a... | <p>You could try something simple, like taking the bitcount and dividing by 4. That'd give you the leading F's in the mask. And then take the remainder and have a switch from 0 bits to 3 bits.</p>
| 26,896 |
<p>I'd like to print a cylinder, 50 mm diameter, 200 mm long, with 1.5 mm diameter holes tightly fit like this:</p>
<p><a href="https://i.stack.imgur.com/i11dN.png" rel="nofollow noreferrer" title="3D rendering of a cylinder with holes"><img src="https://i.stack.imgur.com/i11dN.png" alt="3D rendering of a cylinder with... | <h1>That's a hell of a print!</h1>
<p>You are printing a model that has a highly complex structure there, with about 650ish holes, assuming there is space for about 2 perimeters between each hole.</p>
<p><a href="https://i.stack.imgur.com/gcrSm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gcrSm.pn... | <p>Holes, circles, and curves are slow to print, and get slower as the number of wall segments increase.</p>
<p>Ideally you'd use square holes, but hexagonal-sided ones would be a fair compromise too.</p>
<p>Your slicer should be able to give a breakdown on the times for each kind of line in the part. Check and see ho... | 2,077 |
<p>Why is it that they decided to make <code>String</code> immutable in Java and .NET (and some other languages)? Why didn't they make it mutable?</p>
| <p>According to <a href="http://www.oracle.com/technetwork/java/effectivejava-136174.html" rel="noreferrer">Effective Java</a>, chapter 4, page 73, 2nd edition:</p>
<blockquote>
<p>"There are many good reasons for this: Immutable classes are easier to
design, implement, and use than mutable classes. They are less ... | <p>It's largely for security reasons. It's much harder to secure a system if you can't trust that your <code>String</code>s are tamperproof.</p>
| 11,858 |
<p>When you're using Tiles with Struts and do...</p>
<pre><code>request.getRequestURL()
</code></pre>
<p>...you get the URL to e.g. <code>/WEB-INF/jsp/layout/newLayout.jsp</code> instead of the real URL that was entered/clicked by the user, something like <code>/context/action.do</code>.</p>
<p>In newer Struts versi... | <p>I use this, which also works on Spring:</p>
<pre><code><% out.println(request.getAttribute("javax.servlet.forward.request_uri")); %>
</code></pre>
<p>If you also need the query string (contributed by <a href="https://stackoverflow.com/users/638649/matchew">matchew</a>):</p>
<pre><code><% out.println(requ... | <p>You just need to do this in your action:</p>
<pre><code> request.getAttribute("javax.servlet.forward.request_uri")
</code></pre>
| 16,018 |
<p>I need to be able to lock down the valid characters in a textbox, I presently have a regex which I can check each character against such as </p>
<blockquote>
<p>[A-Za-z]</p>
</blockquote>
<p>would lock down to just Alpha characters. </p>
<pre><code>protected override void OnKeyPress(KeyPressEventArgs e)
{
if ... | <p>What if you put the validation in OnTextChanged instead of OnKeyPress, but each time it passes validation you save the value to a variable? Then you can revert if the user pastes or types an incorrect string, as well as give some other UI hint that something was invalid (e.g. set a Label's text).</p>
| <p>The solution that I have come up with is to check the keys in the OnKeyDown event and then setting a flag if the keypress should be handled, which is then check in the OnKeyPress event.</p>
<pre><code>protected override void OnKeyDown(KeyEventArgs e)
{
Keys keyCode = (Keys)e.KeyValue;
base.OnKeyDown(e);
... | 31,471 |
<p>I've a web service running on server which return data either in XML format or JSON format.
I wanted to request a JSON format but using HTTP Post method.</p>
| <p>This is the code which work for JSON post request,
TouchJSON Framework is used for parsing the JSON, thanks 'schwa'.</p>
<pre><code>NSArray *keys = [NSArray arrayWithObjects:@"username", @"password", @"preference", @"uid", nil];
NSArray *objects = [NSArray arrayWithObjects:@"accuser", @"accpass", @"abc_region", @"... | <p>Sorry for errors and memory leaks, but how about something like:</p>
<pre><code>CFURLRef url = CFURLCreateWithString(NULL, CFSTR("http://example.com/post"), NULL);
CFHTTPMessageRef msg = CFHTTPMessageCreateRequest(
NULL,
CFSTR("POST"),
url,
kCFHTTPVersion1_1);
const char *body = "key=value&id=3... | 33,079 |
<p>I'm looking for a syntax highlighter cum code formatter for my blog on BlogSpot. I've tried several today, but the all want to include <code><style></code> tags, or reference a stylesheet. I'm looking for one that is ideal for segments of code, and includes styling inline. Any suggestions?</p>
| <p>You can always copy the extra few bytes of styling for, say, a <a href="http://pygments.org/" rel="nofollow noreferrer">Pygments</a> highlighter (which really is quite excellent) into the <code><head></code> of your blog. You don't even need to install any software; just copy the HTML from the online service.... | <p>I had this exact problem.</p>
<p>I wrote an image formatter for <a href="http://pygments.org" rel="nofollow noreferrer">Pygments</a> (included in the core distribution).</p>
<p>Please don't hate me for such an abomination, but yes, it renders the highlighted code as a png or jpg or whatever you want. So it has no ... | 41,960 |
<p>Besides open-sourcing your project and legislation, are there ways to prevent, or at least minimize the damages of code leaking outside your company/group?</p>
<p>We obviously can't block Internet access (to prevent emailing the code) because programmer's need their references. We also can't block peripheral device... | <p>You can't stop it getting out. So two solutions - stop people wanting to hurt you, and have legal precautions. To stop people hating you treat them right (saying more is probably off topic for stack overflow).</p>
<p>I'm not a lawyer, but to give yourself legal protection, if you believe in it, patent the ideas, pu... | <p>The best step starts from reruting guys with strong ethical behaviour.
Various other steps can be taken like all communication being scanned. There are places where email and all information going out is scanned. The desktop/laptop does not have hard-disk or the access is restricted and all work is on network folder... | 20,955 |
<p>What SQL Server Alerts do you always setup for every database? What do you always monitor regardless of the database?</p>
| <p>You should monitor and be alerted for severity levels 17 to 25. <br></p>
<p>Severity levels from 17 through 19 will require intervention from a DBA, they're not as serious as 20-25 but the DBA needs to be alerted.<br>
17 Insufficient Resources<br>
18 Nonfatal Internal Error Detected<br>
19 Error in Resource<br>
<br... | <blockquote>
<p>What do you always monitor regardless of the database? </p>
</blockquote>
<p>We always turn on hardware alerts for all of our servers, in addition to log alerts. Hardware errors, such as inode errors, can take down servers just as fast as 5xx errors, for example. We've seen customers' PDF export capa... | 43,390 |
<p>I'm wondering how to make a release build that includes all necessary dll files into the .exe so the program can be run on a non-development machine without it having to install the microsoft redistributable on the target machine.</p>
<p>Without doing this you get the error message that the application configuratio... | <ol>
<li>Choose Project -> Properties</li>
<li>Select Configuration -> General</li>
<li>In the box for how you should link MFC, choose to statically link it.</li>
<li>Choose Linker -> Input. Under <strong>Additional Dependencies</strong>, add any libraries you need your app to statically link in.</li>
</ol>
| <p>You'd be looking to static link (as opposed to dynamically link)</p>
<p>I'm not sure how many of the MS redistributables statically link in.</p>
| 2,540 |
<p>Not wanting to re-invent the wheel or anything, I was wondering if there's a plugin out there a field or form validation plugin that works with Prototype that you can recommend from your own experience and why?</p>
| <p>I like Ben Keen's Really Simple Validation component. </p>
<p>Features I like:</p>
<p>All the validation rules can be kept within javascript so you're not adding class="required" to your HTML code.</p>
<p>You can display error messages in a javascript alert box or with HTML text.</p>
<p>Adding your own extensio... | <p>I like <a href="http://www.formassembly.com/wForms/" rel="nofollow noreferrer">wforms</a>. Example:</p>
<pre><code><input type="text" name="myDate" class="validate-date"/>
</code></pre>
| 33,287 |
<p>If I have a variable in C# that needs to be checked to determine if it is equal to one of a set of variables, what is the best way to do this?</p>
<p>I'm not looking for a solution that stores the set in an array. I'm more curious to see if there is a solution that uses boolean logic in some way to get the answer.<... | <pre><code> bool b = new int[] { 3,7,12,5 }.Contains(5);
</code></pre>
| <p>Since you did not specify what type of data you have as input I'm going to assume you can partition your input into powers of 2 -> 2,4,8,16... This will allow you to use the bits to determine if your test value is one of the bits in the input.</p>
<p>4 => 0000100<br>
16 => 0010000<br>
64 => 1000000</p>
<p>using s... | 3,897 |
<p>What is the best way to verify/test that a text string is serialized to a byte array with a certain encoding?</p>
<p>In my case, I want to verify that an XML structure is serialized to a byte array with the UTF-8 encoding which is of variable character length. As an example, my current ugly procedure is to inject a... | <p>Perhaps you could deserialise the byte array using a known encoding and ensure that (a) it doesn't throw any exceptions, and (b) deserialises to the original string. It seems that from your description of the scenario, you may not have the original string readily available. Might there be a way to create it?</p>
| <p>That's good.
You're right, I don't have the original string, since I'm testing a module that creates an XML document as a byte array. I didn't think about deserializing to a String with an expected encoding. That will do the trick.</p>
| 2,928 |
<p>I've got a somewhat dated Java EE application running on Sun Application Server 8.1 (aka SJSAS, precursor to Glassfish). With 500+ simultaneous users the application becomes unacceptably slow and I'm trying to assist in identifying where most of the execution time is spent and what can be done to speed it up. So f... | <p>There is a number of ways to do this. </p>
<p>On jquery.com it is part of background image applied the body tag. </p>
<p>You can have a header section which has background aligned to the bottom as an image and bottom padding that prevents text/content from overlaying that part. Finally you could use thick border i... | <p>Its a <a href="http://static.jquery.com/files/rocker/images/bg_home_tile_sml.jpg" rel="nofollow noreferrer">BG image</a> that's applied to the body tag.</p>
<pre><code>body {
background: #2a3139 url(../images/bg_home_tile_sml.jpg) repeat-x 50% 0;
}
</code></pre>
<p>IMO it's the best way to achieve this effect.... | 37,014 |
<p>In a JSF dataTable I want to display the row index next to the rows... like:</p>
<pre><code>Column A Column B
1 xxx
2 yyy
</code></pre>
<p>I thought that I could use an implicit el variable like #{rowIndex} but this is not working.</p>
<p>A solution I found is to create a binding for the da... | <p>The existing solution does not strike me as a bad one. The rowIndex should work in nested tables so long as you're referencing the model of the nested table.</p>
<pre><code> <h:dataTable border="1" value="#{nestedDataModel}" var="nested">
<h:column>
<h:dataTable border="1" valu... | <p>Since JSF 2.0 (introduced in 2009) the current <a href="https://jakarta.ee/specifications/platform/9/apidocs/jakarta/faces/component/uicomponent" rel="nofollow noreferrer"><code>UIComponent</code></a> instance in the view is available via implicit EL variable <code>#{component}</code>. See also <a href="https://stac... | 38,152 |
<p>I began printing the parts for the Ultrascope DIY telescope designed by the Open Space Agency. See <a href="http://www.openspaceagency.com/ultrascope" rel="noreferrer">http://www.openspaceagency.com/ultrascope</a>.</p>
<p>All of the STL files for the 3D printable parts are canted 45 degrees. Brackets, tubes, ever... | <p>The orientation of the part in the STL file depends on the Software that creates the file. I had a software that would export the parts standing upright instead of laying flat. Depending on the CAD software it can be beneficial for the creator of the model to create in in a different orientation as the one you want ... | <p>Layer lines are failure lines.</p>
<p>Sometimes I choose to print a part in a weird or sub-optimal orientation just to minimise the load across layer lines when in use.</p>
<p>That may mean more support material and longer print time, but a completed part that fails is no use at all.</p>
| 244 |
<p>What mysql functions are there (if any) to trim leading zeros from an alphanumeric text field? </p>
<p>Field with value "00345ABC" would need to return "345ABC".</p>
| <p>You are looking for the <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim" rel="noreferrer">trim() function</a>.</p>
<p>Alright, here is your example</p>
<pre><code>SELECT TRIM(LEADING '0' FROM myfield) FROM table
</code></pre>
| <p>simply perfect:</p>
<pre><code>SELECT TRIM(LEADING '0' FROM myfield) FROM table
</code></pre>
| 12,245 |
<p>I have a header file like this:</p>
<pre><code>#ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#ifdef _DEBUG
// macros for turning a number into a string
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#ifdef TRIAGE_MESG_AS_WARNING
#defin... | <p>I believe they just <strong><em>forgot</em></strong> about adding additional category: info.
At least it is not specified in output format for external tools.</p>
<p>Citation: "Category must be either '<em>error</em>' or '<em>warning</em>'. Case does not matter. Like origin, category must not be localized."</p>
<p... | <p>Could you not use "Trace" command within your code? This will just place whatever text that you tell it within the Output window. So for placing of error messages you'll need to format them first probably.</p>
| 26,115 |
<p>I have an application that displays an image inside of a Windows Forms <code>PictureBox</code> control. The <code>SizeMode</code> of the control is set to <code>Zoom</code> so that the image contained in the <code>PictureBox</code> will be displayed in an aspect-correct way regardless of the dimensions of the <code... | <p>Depending on the scaling, the relative image pixel could be anywhere in a number of pixels. For example, if the image is scaled down significantly, pixel 2, 10 could represent 2, 10 all the way up to 20, 100), so you'll have to do the math yourself and take full responsibility for any inaccuracies! :-)</p>
| <p>Depending on the scaling, the relative image pixel could be anywhere in a number of pixels. For example, if the image is scaled down significantly, pixel 2, 10 could represent 2, 10 all the way up to 20, 100), so you'll have to do the math yourself and take full responsibility for any inaccuracies! :-)</p>
| 2,494 |
<p>I have the following scenario:
1. .NET UI side uses Logging App Block to write to a flat file
2. Unmanaged Windows Service uses a proprietary logger to write to the same file as 1.</p>
<p>Question: Is there a way to enable FlatFile TraceListener to close it's file handle once the entry is logged so that the Windows... | <p>I've had to deal with this using log4net. I wasn't able to make use of the logging framework's file logging support at all, and had to roll my own log appender that catches sharing violations. At that point, your choices are either to buffer events in memory and write them out later or to block until you can get a... | <p>I think that your choice is the best way to take care of it - just dispose the writer after you're done, which should finalize and release all of the resources that the writer still holds.</p>
<p>Also, I'd be worried about both processing trying to write at the same time and it causing an exception, but perhaps the... | 48,351 |
<p>I need to make an AJAX request from a website to a REST web service hosted in another domain.</p>
<p>Although this is works just fine in Internet Explorer, other browsers such as Mozilla and Google Chrome impose far stricter security restrictions, which prohibit cross-site AJAX requests.</p>
<p>The problem is that... | <p>maybe <a href="http://en.wikipedia.org/wiki/JSONP" rel="noreferrer">JSONP</a> can help.</p>
<p>NB youll have to change your messages to use json instead of xml</p>
<p>Edit</p>
<p>Major sites such as flickr and <a href="http://apiwiki.twitter.com/Search+API+Documentation" rel="noreferrer">twitter</a> support jsonp... | <p>This can also be done using a webserver setup localy that calls curl with the correct arguments and returns the curl output.</p>
<p>app.rb</p>
<pre><code>require 'sinatra'
require 'curb'
set :views,lambda {"views/"+self.name.to_s.downcase.sub("controller","")}
set :haml, :layout => :'../layout', :format => ... | 43,234 |
<p>Suppose you have an XElement or an XmlElment or even a string containing xml that you want to send via WCF. Are there any special precautions you have to take? The question just came up, what happens when, within the xml message, you transmit an xml document declaration (<?xml version=’1.0’ ?>), which may happe... | <p>I hade no problem sending XML as a string with WCF. If your XML exceed a few Kb, you must make changes in client&server to allow larger data amounts.</p>
| <p>Just thought I'd add that in most cases these will be configuration changes, unless you're doing all your binding setup through code. </p>
<p>Specifically, you'll probably need to adjust the MaxReceivedMessageSize property of the binding and the reader quotas on the receiving side.</p>
<p>This is not related speci... | 17,147 |
<p><code>NSInteger</code>/<code>NSUInteger</code> are Cocoa-defined replacements for the regular built-in types.</p>
<p>Is there any benefit to using the NS* types over the built-ins? Which do you prefer and why? Are <code>NSInteger</code> and <code>int</code> the same width on 32-bit / 64-bit platforms?</p>
| <p>The way I understand it is that NSInteger et al. are architecture safe versions of the corresponding C types. Basically their size vary depending on the architecture, but NSInteger, for example, is guaranteed to hold any valid pointer for the current architecture.</p>
<p>Apple recommends that you use these to work ... | <p>I prefer the standard c style declarations but only because I switch between several languages and I don't have to think too much about it but sounds like I should start looking at nsinteger</p>
| 3,466 |
<p>At a new job I started, we have both a Java application that handles most of the heavy lifting in the core business logic, and we also have a Rails application that of course handles the web interface to this server. Both of these access the same database.</p>
<p>Up until now, most of the focus has been on the Jav... | <p>One approach is to use the rails migration tools, generate the DDL files for the database and use Hibernate to update the Java objects that relate to specific database entities. You don't really say how you manage database changes on the Java side or whether you use an ORM, but you can certainly synchronize the two... | <p>Thanks Steve</p>
<p>On the Java side, they are using Hibernate, but with a manual SQL updating process. </p>
<p>I agree, that it should be one or the other. The more I think about it, adding yet another application / module / codebase to manage just the database is definitely the wrong idea.</p>
<p>Thanks</p>
| 26,878 |
<p>Out of order execution in CPUs means that a CPU can reorder instructions to gain better performance and it means the CPU is having to do some very nifty bookkeeping and such. There are other processor approaches too, such as hyper-threading.</p>
<p>Some fancy compilers understand the (un)interrelatedness of instru... | <p>Given optimizing compilers and pipelined processors, I would suggest you just write clear, readable code.</p>
| <p>Take a look at <a href="http://supertech.csail.mit.edu/cilk/" rel="nofollow noreferrer">cilk</a>. It's an extension to ANSI C that has some nice constructs for writing parallelized code in C. However, since it's an extension of C, it has very limited compiler support, and can be tricky to work with.</p>
| 17,196 |
<p>How can I strip out extra whitespace from jsp pages' output? Is there a switch I can flip on my web.xml? Is there a Tomcat specific setting?</p>
| <p>There is a trimWhiteSpaces directive that should accomplish this,</p>
<p>In your JSP:</p>
<pre><code><%@ page trimDirectiveWhitespaces="true" %>
</code></pre>
<p>Or in the jsp-config section your web.xml (Note that this works starting from servlet specification 2.5.):</p>
<pre><code><jsp-config>
&l... | <p>Add/edit your tomcat <code>catalina.properties</code> file with </p>
<pre><code>org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
</code></pre>
<p>See also: <a href="https://confluence.sakaiproject.org/display/BOOT/Install+Tomcat+7" rel="nofollow">https://confluence.sakaiproject.org/display/BOOT/Instal... | 25,611 |
<p>I want to programmatically disable the notification I get when I connect to a wireless network. I know there is a way to disable ALL notifications (see <a href="http://www.howtogeek.com/howto/windows/disable-notification-balloons-in-xp/" rel="nofollow noreferrer">here</a>) but is there a way to only disable the one ... | <p>I don't think this is possible, except in Windows 7 when it's available. (It apparently includes a much more configurable tray-program manager).</p>
| <pre><code>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
New \ DWORD
EnableBalloonTips
Hexadecimal
0
</code></pre>
| 35,699 |
<p>I need to search a string in the string array. I dont want to use any for looping in it</p>
<pre><code>string [] arr = {"One","Two","Three"};
string theString = "One"
</code></pre>
<p>I need to check whether theString variable is present in arr.</p>
| <p>Well, something is going to have to look, and looping is more efficient than recursion (since tail-end recursion isn't fully implemented)... so if you just don't want to loop yourself, then either of:</p>
<pre><code>bool has = arr.Contains(var); // .NET 3.5
</code></pre>
<p>or</p>
<pre><code>bool has = Array.Inde... | <p>it is old one ,but this is the way i do it ,</p>
<p><code>enter code here</code>var result = Array.Find(names, element => element == "One");</p>
| 33,201 |
<p>I have 3 projects in my solution that I want to deploy. Is there a nice and quick way of using Visual Studio's setup projects to deploy all three apps using one MSI and letting the user decide which apps he wants to install during the install process? </p>
<p>I have setup projects for the 3 individual apps, I also ... | <p>I think you probably want merge modules. Accrding to MSDN:</p>
<blockquote>
<p>A merge module is a standard feature of Microsoft Windows Installer that packages components together with any related files, resources, registry entries, and setup logic. You can use merge modules to install components that multiple a... | <p>I also have a similar requirement, however i used merge modules but cant seem to find a way of selecting which specific msm to install and which not to. As i understand there is a no condition property which can be set on msm's while integrating them with msi's. Please let me know if there is some alternate way of d... | 37,705 |
<p>I have a very simple question. I want to test whether a particular port is currently under use or not. For this, I want to bind a TCP socket to the port, if the connection is refused means the port is in use and if not that mean the port is free.</p>
<p>Can someone please tell me how can I write the TCP socket code... | <p>The call to bind function will return -1 if there is an error. This includes the case where the address is already in use.</p>
<pre><code>#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define PORT 12345
int main()
{
struct sockaddr_in addr;
int fd;
fd = socket(AF_INET... | <p>You might want to look at the source code of netstat. I believe there is a netstat in Solaris as well.</p>
| 24,977 |
<blockquote>
<p>char *strtok(char *s1, const char *s2)</p>
<p>repeated calls to this function break string s1 into "tokens"--that is
the string is broken into substrings,
each terminating with a '\0', where
the '\0' replaces any characters
contained in string s2. The first call
uses the string to be to... | <p>What did you initialize the <code>char *</code> to?</p>
<p>If something like</p>
<pre><code>char *text = "foobar";
</code></pre>
<p>then you have a pointer to some read-only characters</p>
<p>For </p>
<pre><code>char text[7] = "foobar";
</code></pre>
<p>then you have a seven element array of characters that yo... | <p>In brief:</p>
<pre><code>char *s = "HAPPY DAY";
printf("\n %s ", s);
s = "NEW YEAR"; /* Valid */
printf("\n %s ", s);
s[0] = 'c'; /* Invalid */
</code></pre>
| 34,362 |
<p>Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following.</p>
<pre><code>Action1 VIEW
Action1 EDIT
Action2 VIEW
Action3 VIEW
Action3 EDIT ... | <p>Remember that the MAX aggregate function will work on text as well as numbers. This query will only require the table to be scanned once.</p>
<pre><code>SELECT Action,
MAX( CASE data WHEN 'View' THEN data ELSE '' END ) ViewCol,
MAX( CASE data WHEN 'Edit' THEN data ELSE '' END ) EditCol
FROM t
GROU... | <p>I had a situation where I was parsing strings and the first two positions of the string in question would be the field names of a healthcare claims coding standard. So I would strip out the strings and get values for F4, UR and UQ or whatnot. This was great on one record or a few records for one user. But when I wan... | 4,408 |
<p>I would like to upload a file asynchronously with jQuery. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
$("#uploadbutton").click(f... | <p>With <a href="http://en.wikipedia.org/wiki/HTML5" rel="noreferrer">HTML5</a> you can make file uploads with Ajax and jQuery. Not only that, you can do file validations (name, size, and MIME type) or handle the progress event with the HTML5 progress tag (or a div). Recently I had to make a file uploader, but I didn't... | <p>You can use the following code.</p>
<pre><code>async: false(true)
</code></pre>
| 20,075 |
<p>When using <code>G1</code> command in G-code, what is the difference between <code>Z</code>- axis and <code>E</code>- axis?</p>
<p>I see all <code>E</code>, <code>F</code> and <code>Z</code> in</p>
<pre><code>G1 Z0.350 F7800.000
G1 E-2.00000 F2400.00000
G92 E0
G1 X96.753 Y95.367 F7800.000
G1 E2.00000 F2400.00000
<... | <p>G-CODE can be confusing as historically it was <a href="http://ws680.nist.gov/publication/get_pdf.cfm?pub_id=823374" rel="noreferrer">developed for machining tools</a> rather than FDM printers, and thus:</p>
<ul>
<li>not all available commands make sense for a 3D printer</li>
<li>some of the command do slightly dif... | <p>z-axis refers typically to vertical movement</p>
<p>F references are feed rates/movement rates</p>
<p>E references are for the extruder, referencing the amount and speed to eject filament, negative e-values are retraction commands</p>
| 816 |
<p>How can I search for specific value in the registry keys?</p>
<p>For example I want to search for XXX in </p>
<pre><code>HKEY_CLASSES_ROOT\Installer\Products
</code></pre>
<p>any code sample in C# will be appreciated,</p>
<p>thanks</p>
| <p>Help <a href="http://bytes.com/forum/thread279622.html" rel="nofollow noreferrer">here</a>...</p>
<p>Microsoft has a great (but not well known) tool for this - called <a href="https://www.microsoft.com/en-us/download/details.aspx?id=24659" rel="nofollow noreferrer">LogParser</a></p>
<p>It uses a SQL engine to quer... | <p>@Caltor your solution gave me the answer I was looking for. I welcome improvements or a completely different solution that does not involve the registry. I am working with enterprise applications on Windows 10 with devices joined to Azure AD. I want/need to use Windows Hello for devices and for HoloLens 2 in a UWP a... | 37,725 |
<p>Good morning,</p>
<p>Apologies for the newbie question. I'm just getting started with ASP.NET internationalization settings.</p>
<p>Background info:</p>
<p>I have a website which displays a <code><table></code> HTML object. In that <code><table></code> HTML object, I have a column which displays dat... | <p>A couple of points:</p>
<ul>
<li><p>The <globalization> element also needs the attribute culture="auto". The uiCulture attribute affects the language used to retrieve resources. The culture attribute affects the culture used for formatting numbers an dates.</p></li>
<li><p>As noted in <a href="http://msdn.m... | <p>You could also accept a query string parameter for overriding the culture settings.</p>
<p>Culture initialization should go in the Page.InitializeCulture method.</p>
<pre><code>protected override void InitializeCulture ( )
{
Thread.CurrentThread.CurrentCulture
= Thread.CurrentThread.CurrentUICulture
= Re... | 38,790 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.