instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this?</p>
<p>I... | <p>A random number generator has a state -- that's actually a necessary feature. The next "random" number is a function of the previous number and the seed/state. The purists call them pseudo-random number generators. The numbers will pass statistical tests for randomness, but aren't -- actually -- random.</p>
<p>T... | <p>Well, as long as they are seeded differently each time they're created, then no, I don't think there'd be any difference; however, if it depended on something like the time, then they'd probably be non-uniform, due to the biased seed.</p>
| 24,883 |
<p>I'm doing some research on the feasibility of an iPhone application, and can't find any indication in Apple's documentation that an iPhone app can read the call history of the phone, specifically the number/address book entry called, when, and the duration.</p>
<p>Does anyone know if this is possible, and how?</p>
... | <p>Unfortunately you can't access the call history. The only User Data you have API access to is the address book. You can also access photos/pictures but only by starting an iPhone-controlled dialog that allows the user to choose a single image.</p>
<p>It's a bit sucky, hopefully this will be expanded in future versi... | <p>AFAIK you can't access call history. The address book is a database of contacts, not call information.</p>
<p>You can read more about the address book in the SDK's "Address Book Programming Guide for iPhone OS."</p>
| 17,472 |
<p>I'm writing a function that gets the path environment variable of a system, splits up each path, then concats on some other extra characters onto the end of each path.</p>
<p>Everything works fine until I use the <code>strcat()</code> function (see code below).</p>
<pre><code>char* prependPath( char* exeName )
{
... | <p>strtok() does not give you a new string.<br>
It mutilates the input string by inserting the char '\0' where the split character was.</p>
<p>So your use of strcat(token[j],"/") will put the '/' character where the '\0' was.<br>
Also the last token will start appending 'which' past the end of your allocated memory in... | <p>replace that with</p>
<p>strcpy(pathDeepCopy, path);</p>
<pre><code> //parse and split
token[0] = strtok(pathDeepCopy, ":");//get pointer to first token found and store in 0
//place in array
while(token[i]!= NULL) { //ensure a pointer was found
i++;
token[i] = strtok(NULL, ":"); //continue to ... | 20,475 |
<p>I have some local changes to an open source project which uses Subversion as its source control. (I do not have commit access on the original project repository.)</p>
<p>My change adds a file, but this file is not included in the output of "svn diff". (It may be worth noting that the new file is a binary, not pla... | <p>I experienced similar behavior to Pozsar. And his answer worked for me better than the normal svn diff --force. However, if running on a DOS machine (e.g. via Cygwin), you may need to modify his answer slightly. The following diff + patch worked for patching my text + binary files in Cygwin using the --binary arg... | <p>If you're building a patch, you might want to use plain old 'diff' with the --new-file option which treats the missing file as empty.</p>
<p>Note that the syntax for this option may actually vary depending on what version of plain old diff you're using. </p>
| 19,330 |
<p>I would like to send a (as yet undetermined) SIGnal from a bash script to a Gambas program when a specific file has been changed. </p>
<p>How can I get my Gambas program to process this SIGnal?</p>
| <p>The <code>gb.signal</code> component allows you to manage signals. You can intercept them, ignore them, and so on. See <a href="http://gambaswiki.org/wiki/comp/gb.signal" rel="nofollow noreferrer">http://gambaswiki.org/wiki/comp/gb.signal</a> for the details.</p>
| <p>If the documentation is anything to go by, this doesn't seem possible. However, I would suggest asking the same question on the Gambas mailing list (and/or link to this question on Stack Overflow). Please report back if you get an answer via the mailing list.</p>
| 21,983 |
<p>I´m looking for a unit tests framework for database development. I´m currently developing for SQL Server 2000, 2005 and 2008. Do you know of any good frameworks with similar functionality as JUnit and NUnit?<br>
Perhaps it´s better to ask, what do you use to unit test your stored procedures and user defined functio... | <p>There is TSQLUnit... Link here: <a href="http://tsqlunit.sourceforge.net/" rel="nofollow noreferrer">http://tsqlunit.sourceforge.net/</a></p>
| <p>I'm currently using DBUnit in my project. It's quite a good tool to test a database to see if the results you expect are there, but also it can alter the data in a database to predefined values, for example, it will reset a database to the data you were using before the tests, leaving the tables unchanged.</p>
<p><... | 24,820 |
<p>This is a follow up question to <a href="https://stackoverflow.com/questions/85815/how-to-tell-if-a-javascript-function-is-defined">This Question</a>. </p>
<p>I like (and understand) the solution there. However, in the code I am working in, another way to solve the same problem is used:</p>
<pre><code>function exi... | <p>Your condition is checking the existence of the "sFN" property in the "self" object. Anything that isn't null, undefined, 0, and "" will evaluate to true. </p>
<p>As others have said, you can use typeof, or instanceof to see if it's actually a function. </p>
<p>Looking at your linked example, you should read up on... | <p>I read somewhere (<a href="http://www.electrictoolbox.com/check-javascript-function-exists/" rel="nofollow noreferrer">here</a> and <a href="http://bytes.com/forum/thread90633.html" rel="nofollow noreferrer">here</a>) that functions are properties of the window object, so you can do the following:</p>
<pre><code>if... | 11,412 |
<p>Announced today. Descriptions so far are confusing. Let's put together a good starting point for understanding Windows Azure.</p>
<p>Strongly related to <a href="https://stackoverflow.com/questions/280037/what-is-a-cloud-os">What is a "Cloud OS"?</a>, but not enough to warrant closing.</p>
| <h2>Description</h2>
<p>The Azure™ Services Platform (Azure) <strong>is an internet-scale cloud services platform hosted in Microsoft data centers</strong>, which provides an operating system and a set of developer services that can be used individually or together. Azure’s flexible and interoperable platform can be us... | <p>Azure is a cloud hosting, if we have a web app application we can hosting on it.
Azure also support various script languages (C#, PHP, Phyton etc).
Today Azure also support for wordpress and various databases.
We can subscribe azure by period or "pay as you go".</p>
| 29,766 |
<p>I know of the following:</p>
<ul>
<li>The venerable <code>getopt(3)</code></li>
<li>The extended <code>getopt_long</code></li>
<li>glibc's <a href="http://www.gnu.org/software/libtool/manual/libc/Argp.html" rel="noreferrer"><code>argp</code></a> parser for Unix-style argument vectors</li>
<li><a href="http://develo... | <p>GNU has <A href="http://www.gnu.org/software/gengetopt/" rel="noreferrer">gengetopt</A> which generates code for an options data structure and the <code>getopt_long</code> code to parse the command line and fill the structure.. It's fairly easy to learn and works well.</p>
<p>As a bonus you can pass the options str... | <p>I really like the <a href="http://tclap.sourceforge.net/" rel="nofollow noreferrer">TCLAP</a> library, because it is very flexible and easy to use. It is also completely template-based, so it is a header-only library.</p>
<p>My mistake: you said C and I posted a C++ library...</p>
| 23,049 |
<p>I have discovered through trial and error that the MATLAB engine function is not completely thread safe.</p>
<p>Does anyone know the rules?</p>
<p>Discovered through trial and error:</p>
<p>On Windows, the connection to MATLAB is via COM, so the COM Apartment threading rules apply. All calls must occur in the sa... | <p>When I first started using the engine, I didn't run across any documentation on thread safety, so I assumed that it was not thread-safe.</p>
<p>I use a C++ class to synchronize access to an engine instance. For more parallel processing designs, I instantiate multiple instances of the engine class.</p>
<p>(edit) I'... | <p>You can use <code>engOpenSingleUse</code> instead of using <code>engOpen</code> to make more than one thread working separately. (Only Windows)</p>
| 30,868 |
<p>Is there a way set flags on a per-file basis with automake?<br>
In particular, if I have a c++ project and want to compile with -WAll all the files except one for which I want to disable a particular warning, what could I do?</p>
<p>I tried something like:</p>
<pre><code>CXXFLAGS = -WAll ...
bin_PROGRAMS = test
te... | <p>Automake only supports per-target flags, while you want per-object flags. One way around is to create a small library that contains your object: </p>
<pre><code>CXXFLAGS = -Wall ...
bin_PROGRAMS = test
test_SOURCES = main.cpp
test_LDADD = libutility.a
noinst_LIBRARIES = libutility.a
libutility_a_SOURCES = utility.... | <p>You've got confused - that section is referring to options to automake itself.</p>
<p>It's a way of setting the automake command-line options:</p>
<blockquote>
<p>-W CATEGORY
--warnings=category
Output warnings falling in category. category can be one of:</p>
<pre><code>gnu
warnings related to the G... | 17,997 |
<p>One of the best tips for using vim that I have learned so far has been that one can press <kbd>Ctrl</kbd>+<kbd>C</kbd> or <kbd>Ctrl</kbd>+<kbd>[</kbd> instead of the <kbd>Esc</kbd> key. However I use a dvorak keyboard so <kbd>Ctrl</kbd>+<kbd>[</kbd> is a little out of reach for me as well so I mostly use <kbd>Ctrl</... | <p>According to Vim's documentation, <kbd>Ctrl</kbd>+<kbd>C</kbd> does not check for abbreviations and does not trigger the <code>InsertLeave</code> autocommand event while <kbd>Ctrl</kbd>+<kbd>[</kbd> does.</p>
<p>One option is to use the following to remap <kbd>Ctrl</kbd>+<kbd>C</kbd></p>
<pre><code>inoremap <C-... | <p>As it turns out, <code><C-[></code> is exactly identical to Esc, they are the same character. So no need to wonder about any difference there. :)</p>
| 10,619 |
<p>Any ideas on how i get MVP working with Silverlight? How Do I get around the fact there is no load event raised?</p>
<p>This the view I have:</p>
<pre><code> public partial class Person: IPersonView
{
public event RoutedEventHandler Loaded;
public Person()
{
new PersonP... | <p><a href="http://timross.wordpress.com/2008/03/16/implementing-the-mvp-pattern-in-silverlight/" rel="nofollow noreferrer">Tim Ross</a> has a good introduction to Silverlight MVP implementation, with source code.</p>
| <h2>You may consider using <a href="http://www.mvcsharp.org" rel="nofollow noreferrer">MVC#</a> - a Model View Presenter framework with Silverlight 2.0 support.</h2>
<p>Oleg Zhukov</p>
| 16,438 |
<p>I'm learning some PowerShell. Is it possible to see the source code for a built-in cmdlet like <a href="http://technet.microsoft.com/en-us/library/hh849800.aspx" rel="noreferrer">Get-ChildItem</a>?</p>
| <p>Actually, your best bet is to go check out <a href="https://github.com/Pscx/Pscx" rel="nofollow noreferrer">PowerShell Community Extensions</a>. This open source software community project is "aimed at providing a widely useful set of additional cmdlets...". The developers on the project are PowerShell MVP... | <p>I do not believe that the source code for PowerShell has ever been released.</p>
| 33,382 |
<p>I just wrote a new web part and now I am getting this error when I try to deploy them on my non-dev servers:</p>
<blockquote>
<p>the default namespace
'<a href="http://schemas.microsoft.com/WebPart/v2" rel="nofollow noreferrer">http://schemas.microsoft.com/WebPart/v2</a>'
is a reserved namespace for base Web
... | <p>Well, it looks like your webpart definition file si somehow broken. The wey i do it is to put webpart into page and then export it. You can do this just by opening webpart galery, which can be located in site settings of root site collection and add your webpart there. </p>
<p>After that just place webpart to any p... | <p>A bit of a educated guess here but anyway :-</p>
<p>First check that you have XmlRoot attribute like this in your web part</p>
<pre><code>[XmlRoot(Namespace = "Your.Namespace")]
public class YourWebPart: WebPart
{
...
</code></pre>
<p>and XmlElement attribute on your custom properties</p>
<pre><code> [Default... | 25,438 |
<p>From time to time, I run into communications issue with other programmers, when we talk about NULL. Now NULL could be
<BR>
<BR> a NULL pointer
<BR> the NUL character
<BR> an empty data element in some sort of database.</p>
<p><BR> NUL seems to be the most confusing. It is the ASCII character 0x00.
<BR> I tend ... | <p>I use <code>'\0'</code> for the nul-character and <code>NULL</code> for pointers because it is clearest in both cases. </p>
<p>BTW, both <code>0</code> and <code>'\0'</code> are <code>int</code>s in C and either one will be converted to <code>char</code> when stored in a <code>char</code> variable.</p>
| <p>For communication I use NULL. If I'm working with a developer who cannot grasp the concept of NULL for different data-types then I'd be concerned.</p>
<p>For implementation it's case-specific. Numbers are 0 (post-fixed f for floating-point), pointers are NULL and character strings are 0.</p>
| 27,145 |
<p>I've been benchmarking the performance of a framework I'm writing in Perl and I'm getting a 50% decrease in requests per second over our existing codebase (some hit is understandable, because we're going from procedural spaghetti code to an OOP MVC framework).</p>
<p>The application is running under mod_perl, and I... | <p>Assuming your applications don't change the config at all, move it into a begin block:</p>
<pre><code># this code goes at file scope
my $config;
BEGIN {
$config = { Config::General->new( ... )->getall }
}
# when creating a new instance
$self->config( $config );
</code></pre>
<p>And make sure all your... | <p>JackM has the right idea. </p>
<p>By loading all of your classes and instantiating your Application-level objects (in your case, the configuration) in the "<em>Mother</em>" Apache process, You Don't have to compile them each time a new worker spawns, since they're already available and in memory. The very meticul... | 44,525 |
<p>In terms of general operating system concepts, what is the difference between a file and a record?</p>
<p>How the OS will manage them? I know what a file is and what a record is but how it is distinguished in an
OS?</p>
| <p>yeap <p>I got the answer
<p>A file is a collection or set of records. </p>
<p><p>Typically, In database sense, A Group of records makes a file. </p>
<p><p>A group of attributes makes a record</p>
| <p>The Good answer is that 1
""A collection of related fields treated as a single unit is called a record. A collection of related record treated as a single unit is called a file or a data set""</p>
| 31,463 |
<p>How do I figure out if an array contains an element?
I thought there might be something like <code>[1, 2, 3].includes(1)</code> which would evaluate as <code>true</code>.</p>
| <p>Some syntax sugar</p>
<pre><code>1 in [1,2,3]
</code></pre>
| <p>You can also use matches with regular expression like this:</p>
<pre><code>boolean bool = List.matches("(?i).*SOME STRING HERE.*")
</code></pre>
| 7,514 |
<p>What ist most concise way to read the contents of a file or input stream in Java? Do I always have to create a buffer, read (at most) line by line and so on or is there a more concise way? I wish I could do just</p>
<pre><code>String content = new File("test.txt").readFully();
</code></pre>
| <p>Use the <a href="http://commons.apache.org/io/description.html" rel="noreferrer">Apache Commons IOUtils</a> package. In particular the <code>IOUtils</code> class provides a set of methods to read from streams, readers etc. and handle all the exceptions etc. </p>
<p>e.g.</p>
<pre><code>InputStream is = ...
String c... | <p>You have to create your own function, I suppose. The problem is that Java's read routines (those I know, at least) usually take a buffer argument with a given length.</p>
<p>A solution I saw is to get the size of the file, create a buffer of this size and read the file at once. Hoping the file isn't a gigabyte log ... | 27,805 |
<p>I have some code documentation in MS Powerpoint 2003 that I'm revision-controlling in an SVN repository. I'd like to auto-insert the latest revision number into this document whenever I open it. I am using TortoiseSVN. I've been able to google up a macro or two that might work but wanted advice from experts. :) Than... | <p>I think it should be possible to use the $Rev$ macro inside it with the Office 2007 XML formats, but I am not too sure what will happen with older formats that might contain binary data. You might need to tweak svn settings a bit so it sees .ppt files as text and not binary for this to work, I am not sure what is th... | <p>A little late but I consider that the original question is still relevant today.</p>
<p>Did you ever try <a href="https://insights.oetiker.ch/windows/SvnProperties4MSOffice/" rel="nofollow noreferrer">SvnProperties4MSOffice</a>? The second version (V2) seemed to be designed exactly as an alternative to keyword repl... | 10,898 |
<p>The company I work for has recently been hit with many header injection and file upload exploits on the sites we host and while we have fixed the problem with respect to header injection attacks, we have yet to get the upload exploits under control.</p>
<p>I'm trying to set up a plug-and-play-type series of upload ... | <p>The best solution, IMHO, is to put the directory containing the uploaded files outside of the "web" environment and use a script to make them downloadable. In this way, even if somebody uploads a script it can not be executed by calling it from the browser and you don't have to check the type of the uploaded file.</... | <p>Use and configure <a href="http://www.hardened-php.net/suhosin/a_feature_list.html" rel="nofollow noreferrer">Hardened-PHP</a> create a plain script using <a href="http://www.php.net/move_uploaded_file" rel="nofollow noreferrer">move_uploaded_file</a> and the <a href="http://es.php.net/features.file-upload" rel="nof... | 31,965 |
<p>What do you use to validate an email address on a ASP.NET form. I want to make sure that it contains no XSS exploits.</p>
<p>This is ASP.NET 1.1</p>
| <p>Any script tags posted on an ASP.NET web form will cause your site to throw and unhandled exception.</p>
<p>You can use a asp regex validator to confirm input, just ensure you wrap your code behind method with a if(IsValid) clause in case your javascript is bypassed.
If your client javascript is bypassed and script... | <pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
using System.Text.RegularExpressions;
/// <summary>
/// Summary description for RegexUtilities
/// </summary>
public class RegexUtilities
{
bool InValid = false;
public bool ... | 22,058 |
<p>Does anyone know about a Docking Control like Visual Studio for WPF, where Databinding for the Panes is supported?
I tried the DockManager from Infragistics and from Actipro, but they lack this support.
For example, the Panes for the content need to be bound through Databinding, so removing the Entity on the other s... | <p>You might consider <a href="http://www.codeplex.com/AvalonDock/" rel="nofollow noreferrer">AvalonDock on Codeplex</a>. If it doesn't have the functionality you are looking for you can add it yourself since you get full source code!</p>
| <p>I know this won't help the original poster but in case someone else comes across this with a similar question, there is a <a href="http://blogs.infragistics.com/blogs/andrew_smith/archive/2010/01/12/itemssource-for-xamdockmanager-elements.aspx" rel="nofollow noreferrer">blog post</a> with a sample using an attached ... | 46,413 |
<p>I just wrote the following C++ function to programmatically determine how much RAM a system has installed. It works, but it seems to me that there should be a simpler way to do this. Am I missing something?</p>
<pre><code>getRAM()
{
FILE* stream = popen("head -n1 /proc/meminfo", "r");
st... | <p>On Linux, you can use the function <code>sysinfo</code> which sets values in the following struct:</p>
<pre><code> #include <sys/sysinfo.h>
int sysinfo(struct sysinfo *info);
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minu... | <p>Even <code>top</code> (from <code>procps</code>) parses <code>/proc/meminfo</code>. See <a href="http://procps.cvs.sourceforge.net/viewvc/procps/procps/proc/sysinfo.c?revision=1.40&view=markup" rel="nofollow noreferrer">here</a>.</p>
| 45,530 |
<p>In my browsings amongst the Internet, I came across <a href="http://www.reddit.com/r/programming/comments/6y6lr/ask_proggit_which_is_more_useful_to_know_c_or_java/" rel="nofollow noreferrer">this post</a>, which includes this</p>
<blockquote>
<p>"(Well written) C++ goes to great
lengths to make stack automatic
... | <p>Stack objects are handled automatically by the compiler.</p>
<p>When the scope is left, it is deleted.</p>
<pre><code>{
obj a;
} // a is destroyed here
</code></pre>
<p>When you do the same with a 'newed' object you get a memory leak :</p>
<pre><code>{
obj* b = new obj;
}
</code></pre>
<p>b is not destro... | <p>Variables in C++ can either be declared on the stack or the heap. When you declare a variable in C++, it automatically goes onto the stack, unless you explicitly use the new operator (it goes onto the heap).</p>
<pre><code>MyObject x = MyObject(params); // onto the stack
MyObject * y = new MyObject(params); // ont... | 4,997 |
<p>I'm wondering how to use a VideoDisplay object (defined in MXML) to display video streamed from FMS via a NetStream.</p>
<p>The <a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/VideoDisplay.html" rel="noreferrer">Flex3 docs</a> suggest this is possible:</p>
<blockquote>
<p>The Video Display ... supp... | <p>Unfortunately you can attachNetStream() only on Video object. So you are doomed to use em if you want to get data from FMS.</p>
<p>By the way attachCamera() method <strong>publishes</strong> local camera video to the server so be careful ;)</p>
| <p>it works.</p>
<p>mx:VideoDisplay live="true" autoPlay="true" source="rtmp://server.com/appname/streamname" /></p>
<p>that will give you live video through a videodisplay... problem is it won't use an existing netconnection object, it creates it's own... which is what I'm trying to find a work around for.</p>
| 6,377 |
<p>I have always made a point of writing nice code comments for classes and methods with the C# xml syntax. I always expected to easily be able to export them later on.</p>
<p>Today I actually have to do so, but am having trouble finding out how. Is there something I'm missing? I want to go <em>Menu->Build->Build Code... | <p>Actually it's in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.</p>
<p>After that you can build the actual help with <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A487... | <p>The original NDoc project (mentioned by others) is dead, but there is a new project called <a href="https://sourceforge.net/projects/ndoc3/" rel="nofollow noreferrer">NDoc3</a>.</p>
<p>NDoc3 supports .NET 2.0 - 3.5. It is currently available as a beta version and worked great for me. I'm not sure if the project is... | 7,498 |
<p>what's the quickest way to extract a 5 digit number from a string in c#. </p>
<p>I've got </p>
<pre><code>string.Join(null, System.Text.RegularExpressions.Regex.Split(expression, "[^\\d]"));
</code></pre>
<p>Any others?</p>
| <p>The regex approach is probably the quickest to implement but not the quickest to run. I compared a simple regex solution to the following manual search code and found that the manual search code is ~2x-2.5x faster for large input strings and up to 4x faster for small strings:</p>
<pre><code>static string Search(str... | <p>If you have a simple test case like "12345" or even "12345abcd" don't use regex at all. They are not known by they speed.</p>
| 32,858 |
<p>A lot of programs log things into a text file in a format something like this:</p>
<p>11/19/2008 13:29:01 DEBUG Opening connection to localhost.</p>
<p>11/19/2008 13:29:01 DEBUG Sending login message for user 'ADMIN'.</p>
<p>11/19/2008 13:29:03 DEBUG Received login response 'OK' for user 'ADMIN'.</p>
<p>...</p>
... | <p>I'm not sure of any products that do that, but you could use <a href="http://www.ondotnet.com/pub/a/dotnet/2003/06/16/log4net.html" rel="nofollow noreferrer">log4net</a> and write your own <a href="http://logging.apache.org/log4net/release/features.html" rel="nofollow noreferrer">appender</a> (output handler).</p>
| <p>Enteprise library Logging block provides different loggings formats such as xml but it is a long way to configure and deal with it</p>
| 39,009 |
<p>I'm trying to host a python script using an apache web server, but the server tries to run the script instead of just offering it for download.</p>
<p>I do not have direct access to server, and adding the line</p>
<pre><code>AddType text/plain .py
</code></pre>
<p>to .htaccess in the root folder does not appear t... | <p>In your .htaccess:</p>
<blockquote>
<p>RemoveHandler .py </p>
</blockquote>
| <p>One option is to change the extention and make clear that it should be renamed. IE python.py.safe or python.py.dl. The user would then need to remove the extra bit.</p>
<p>You could also Zip it up.</p>
| 16,451 |
<p>I have the following construction:</p>
<pre><code>typedef struct bucket {
char *key;
ENTRY *data;
struct bucket *next;
} bucket;
typedef struct {
size_t size;
bucket **table;
} hash_table;
</code></pre>
<p>But I have no idea how to allocate memory for that. I tried: </p>
<pre><code>hash_table... | <p>It doesn't make sense to allocate all 101 (or however many) buckets upfront, you'd typically allocate them one at a time, when inserting new data into the table.</p>
<p>It <em>does</em> make sense to pre-allocate the hash array, which will have a fixed size, but that is an <em>array of bucket pointers</em>, not an ... | <p>The <code>hash_table</code> will always be only <code>sizeof(hash_table)</code> bytes big. The <code>table</code> element is a pointer to an array of poiinters to <code>bucket</code> elements. So you'd need something like this:</p>
<pre><code>hash_table* ht = malloc(sizeof(hash_table));
ht->size = 101;
ht->ta... | 48,436 |
<p>Linq To SQL or Entity framework both integrate nicely with SQL Server 2005.</p>
<p>The SQL Server 2008 spec sheet promises even better integration - but I can't see it.</p>
<p>What are some examples of what you can do Linq-wise when talking to a 2008 server that you can't when talking to SQL Server 2005?</p>
| <p>There is a problem of paging over a joined set that SQL 2005 mis-interprets.</p>
<pre><code>var orders = (
from c in Customers
from o in c.Orders
select new {c, o}
).Skip(10).Take(10).ToList();
</code></pre>
<p>LINQ generates a ROW_Number against the joined set. SQL2005 generates a bad plan from that code. Here'... | <p>it has full support for the new data types. lol. beyond that you got me, other than possibilities of optimised queries (like the merge command, etc).</p>
| 3,621 |
<p>Does anyone know of a way to store values as NVARCHAR in a manually created query in ColdFusion using the querynew() function? I have multiple parts of a largish program relying on using a query as an input point to construct an excel worksheet (using Ben's POI) so it's somewhat important I can continue to use it a... | <p>When creating a ColdFusion query with queryNew(), you can pass a list of datatypes as a second argument. For example:</p>
<pre><code><cfset x = queryNew("foo,bar","integer,varchar") />
</code></pre>
<p>Alternatively, you can use cf_sql_varchar (which you would use in queryparam tags). According to the live... | <p>This is pretty much all you need: </p>
<pre><code><cfprocessingdirective pageEncoding="utf-8">
</code></pre>
<p>ColdFusion (& java) stores string in UTF-8 by default. All you need is to tell CF that the encoding of the page is UTF8. The alternative way is to save the Byte-order mark (BOM), but Eclipse... | 35,692 |
<p>A problem that we need to solve regularly at my workplace is how to build sql statements based on user supplied table/column names. The issue I am trying to address is the commas between column names. </p>
<p>One technique looks something like this.</p>
<pre><code>selectSql = "SELECT ";
for (z = 0; z < colu... | <p>In your case it is probably safe to assume that there is at least one column since otherwise there is no point in doing the select. In that case you could do:</p>
<pre><code>selectSql = "SELECT ";
selectSql += columns[0]._name;
for (z = 1; z < columns.size(); z++) {
selectSql += ", ";
selectSql += colum... | <p>I would suggest building a generic join function to do this. You can use the e.g. accumulate algorithm to join columns.</p>
<p>EDIT: <strong>See <a href="https://stackoverflow.com/questions/327010/using-a-vector-of-column-names-to-generate-a-sql-statement#327862">litb's implementation</a></strong>; it's much less ... | 42,368 |
<p>[This is a community Wiki so do <strong>not</strong> bother voting it down if it seems like a poll question. It is.]</p>
<p>Will Adobe be able to translate its success in Flash Penetration (although also questionable, see my post <a href="http://compileyouidontevenknowyou.blogspot.com/2008/01/flash-penetration-and-... | <p>Unfortunately no, until they sort out, at the least, the following issue:</p>
<p>When you visit a site that needs Flash and you haven't got Flash installed, you get a very standard looking popup asking you if you to install it, and mentioning in the notes that it may not be safe to install an untrusted plugin.</p>
... | <p>No.<br>
The competition on desktop application market is much bigger, and users are expectiong more functionality and performance from desktop application than from web application, and AIR is just not there yet wrt performance and desktop capabilities.</p>
| 44,773 |
<p>A database that stores a lot of credit card information is an inevitable part of the system we have just completed. What I want though is ultimate security of the card numbers whereby we setup a mechanism to encrypt and decrypt but of ourselves cannot decrypt any given number. </p>
<p>What I am after is a way to se... | <p>Unless you are a payment processor you don't really need to store any kind of CC information.</p>
<p>Review your requirements, there really is not many cases where you need to store CC information</p>
| <p>It would be helpful to know the DB server and language/platform types so we could get more specific, but I would be looking into <a href="http://en.wikipedia.org/wiki/SHA" rel="nofollow noreferrer">SHA</a>.</p>
| 8,374 |
<p>I have a large database and would like to select table names that have a certain column name. I have done something like this in MySQL, but can't find any info on SQL Server.</p>
<p>I want to do something like:</p>
<pre><code>select [table]
from [db]
where table [has column 'classtypeid']
</code></pre>
<p>How c... | <p>Use the ANSI information_schema views, this will also work in MySQL</p>
<pre><code>select table_name
from information_schema.columns
where column_name = 'classtypeid'
</code></pre>
| <p>Here you go:</p>
<pre><code>SELECT C.TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS AS C
INNER JOIN INFORMATION_SCHEMA.TABLES AS T ON C.TABLE_NAME = T.TABLE_NAME
AND C.TABLE_SCHEMA = T.TABLE_SCHEMA
WHERE C.COLUMN_NAME = 'classtypeid'
AND T.TABLE_TYPE = 'BASE TABLE'
</code></pre>
<hr>
<p><strong>Edit</strong>:... | 4,768 |
<p>Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby.</p>
<p>Doing a google search yielded outdated answers.</p>
<p>Edit: Since there has been some concern about the 'meri... | <p><img src="https://i.stack.imgur.com/YayAV.png" alt="Real programmers set the universal constants at the start such that the universe evolves to contain the disk with the data they want."></p>
<p><a href="http://xkcd.com/378/" rel="noreferrer">http://xkcd.com/378/</a></p>
| <p>You can try Emacs with ruby-mode, <a href="http://rinari.rubyforge.org/" rel="nofollow noreferrer">Rinari</a> (for Rails) and <a href="http://code.google.com/p/yasnippet/" rel="nofollow noreferrer">yasnippet</a> which provides automatic snippets like Textmate.</p>
| 2,504 |
<p>I have recently bought a spool of eSun PETG. So far I really like the filament. My only complaint is, I get lumps of charred filament deposited on my object. The slicer I used is Craft Ware and I have played with the Far Travel -> Elevation settings. I have noticed that this helps but then I have little to no adhesi... | <p>Different brands and blends of PET filaments seem to do this to different degrees. Esun's PETG is definitely one that tends to glob onto the nozzle. Basically, the nozzle plows through the top surface of the filament and lifts up some plastic, much like the bow of a ship lifting up some water at high speeds. PET's v... | <p>For me, none of the classic solutions to PETG zits worked; these include extra retraction, slower/faster retraction, lower extrusion width, lower extrusion multiplier, avoid perimeters etc. It was especially disappointing to see lower extrusion multiplier making no difference whatsoever in reducing the zits, but onl... | 216 |
<p>Is there some simple way to calculate a Weeknumber value from a date value stored in XML?</p>
<p>It needs to be pure XSLT solution. I cannot use any code :(</p>
| <p>If you can use EXSLT, there are <a href="http://www.exslt.org/date/index.html" rel="nofollow noreferrer">several date functions</a> available. All of them are implemented in Saxon, but if you're using MSXSL, Chris Bayes has implemented them as extension functions, which you can actually place within your transform ... | <p>I program in Visual Basic, so I know how to do it using VB.NET. Read your XML date into a variable (let's call it <em>SomeDate</em>). Then you construct a new date that you <strong>know</strong> is the beginning of the year that contains your unknown date. Then, you let the <em>DateDiff</em> function do its work ... | 21,559 |
<p>I want to do some pattern matching on lists in Python. For example, in Haskell, I can do something like the following:</p>
<pre><code>fun (head : rest) = ...
</code></pre>
<p>So when I pass in a list, <code>head</code> will be the first element, and <code>rest</code> will be the trailing elements.</p>
<p>Likewise... | <p>So far as I know there's no way to make it a one-liner in current Python without introducing another function, e.g.:</p>
<pre><code>split_list = lambda lst: (lst[0], lst[1:])
head, rest = split_list(my_func())
</code></pre>
<p>However, in Python 3.0 the specialized syntax used for variadic argument signatures and ... | <p>there was a reciepe in the python cookbook to do this. i cant seem to find it now but here is the code (i modified it slightly)</p>
<pre><code>
def peel(iterable,result=tuple):
'''Removes the requested items from the iterable and stores the remaining in a tuple
>>> x,y,z=peel('test')
>>> print repr(x),... | 29,453 |
<p>I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not for jEdit, and unfortunately I'm just starting on Objective-J so can't make my own. If anyone has got one of them lying around it would be greatly appreciated.</p>
| <p>According to the JEdit <a href="http://jedit.org/index.php?page=features" rel="nofollow noreferrer">features page</a> it already supports Objective C.</p>
| <p>One of my favorite things about JEdit is how easy it is to define a new syntax highlighting mode. I work in a land in which every fool wants to create his own custom configuration file language and I've gotten to where I can create a new approximate syntax highlighting mode in about 5 minutes. I start by copying a... | 14,093 |
<p>Does anyone know of any way to convert a simple gif to xaml? E.G. A tool that would look at an image and create elipses, rectangles and paths based upon a gif / jpg / bitmap?</p>
| <p>Illustrator has a trace tool which will do this</p>
<p>a cheaper option might be </p>
<p><a href="http://vectormagic.com" rel="noreferrer">http://vectormagic.com</a></p>
<p>it will export a svg that you should be able to convert to xaml</p>
| <p>With this online converter you can convert an image to SVG Format. then download Converted File and open it in a text File Editor then you can easily copy path data</p>
<p><a href="http://image.online-convert.com/convert-to-svg" rel="nofollow noreferrer">image.online-convert</a> </p>
| 15,787 |
<p>Can someone please let me know how to get the different segments of the three rows that are intersecting in different ways using SQL? The three rows in #t2 represent sets A,B, C - I am looking for A I B, A I C, B I C, A I B I C, A' , B', C' etc., (7 possible segments with 3 rows as in a Venn diagram) where I is the ... | <p>If I have understood the problem correctly, I think you may have to resort to using a loop to cope with 'n' number of rows</p>
<pre><code>DECLARE @Key2 INT
DECLARE @Subset VARCHAR(1000)
DECLARE @tblResults TABLE
(
Key2 INT,
Subset VARCHAR(1000)
)
SET @Subset = ''
SELECT @Key2 = MIN(Key2) FROM #t1
WHILE @K... | <p>How about this?</p>
<pre><code>SELECT key2,
CASE
WHEN InA = 1 and InB = 1 and InC = 1 THEN 'ABC'
WHEN InA = 0 and InB = 1 and InC = 1 THEN 'BC'
WHEN InA = 1 and InB = 0 and InC = 1 THEN 'AC'
WHEN InA = 1 and InB = 1 and InC = 0 THEN 'AB'
WHEN InA = 1 and InB = 0 and InC = 0 THEN 'A'
WHEN InA = 0 and I... | 27,104 |
<p>I am actually trying to start a process for winzip and zip a folder. This i am doing using the below code in vb.</p>
<pre><code>Dim startInfo As New System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
Dim tempFileName As String
Try
startInfo = New System.Diagnostics.ProcessStartInfo(... | <p>I believe that the .Net framework has built in zip capabilities. I would try using those first. Your zip program probably isn't running because of permissions on the web server.</p>
<p>Edit</p>
<p>I just checked and there seems to be limited zip support in System.IO.Compression. But according to <a href="http://so... | <p>It might be something to do with the user that IIS is running as; try changing the app-pool to run in your identity to see if it works. Of course, winzip is a UI tool - you might do better using a command-line zip utility... pkzip ;-p</p>
<p>Personally, I'd look at using <a href="http://www.icsharpcode.net/OpenSour... | 47,355 |
<p>Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process.</p>
<p>Soon the update frequency will increase by an order of magnitude (maybe two).
Someone suggested that committing every N... | <p>A commit results in Oracle writing stuff to the disk - i.e. in the redo log file so that whatever the transaction being commited has done can be recoverable in the event of a power failure, etc.
Writing in file is slower than writing in memory so a commit will be slower if performed for many operations in a row rath... | <blockquote>
<p>Faster/Slower? </p>
</blockquote>
<p>It will probably be a little faster. However, you run a greater risk of running into deadlocks, losing uncommitted changes should something catastrophic happen (cleaning lady unplugs the server), FUD, Fire, Brimstone, etc.</p>
<blockquote>
<p>Why would it help... | 5,319 |
<p>Is there an equivalent schema & data export/dumping tool for SQL Server as there is for MySQL with mysqldump. Trying to relocate a legacy ASP site and I am way out of happy place with working on a windows server.</p>
<p>Note: The DTS export utility own seems to export data, without table defs.
Using the Ente... | <h2>To do this really easily with SQL Server 2008 Management Studio:</h2>
<p>1.) Right click on the database (not the table) and select Tasks -> Generate Scripts</p>
<p><img src="https://i.stack.imgur.com/9MnoI.jpg" alt="location of tool"></p>
<p>2.) Click Next on the first page</p>
<p>3.) If you want to copy the w... | <p>easiest would be a backup and restore or detach and attach</p>
<p>or script out all the tables and BCP out the data then BCP in the data on the new server</p>
<p>or use DTS/SSIS to do this</p>
| 11,077 |
<p>i am trying to find the best way to display results on my page via an Ajax call using jQuery, do you think the best way is to pass it as JSON or plain text? I have worked with ajax calls before, but not sure which is preferred over the other and for the JSON version what is the best way to read from a JSON file gene... | <p>Something like this:</p>
<pre><code>$.getJSON("http://mywebsite.com/json/get.php?cid=15",
function(data){
$.each(data.products, function(i,product){
content = '<p>' + product.product_title + '</p>';
content += '<p>' + product.product_short_description + '&... | <p>You can create a jQuery object from a JSON object:</p>
<pre><code>$.getJSON(url, data, function(json) {
$(json).each(function() {
/* YOUR CODE HERE */
});
});
</code></pre>
| 42,402 |
<p>I'm trying to write a Selenium test for a web page that uses an onbeforeunload event to prompt the user before leaving. Selenium doesn't seem to recognize the confirmation dialog that comes up, or to provide a way to hit OK or Cancel. Is there any way to do this? I'm using the Java Selenium driver, if that's relevan... | <p>You could write a user extension (or just some JavaScript in a storeEval etc) that tests that window.onbeforeunload is set, and then replaces it with null before continuing on from the page. Ugly, but ought to get you off the page.</p>
| <p>When I was confronted with limited control which I had over browser using Selenium, I turned to <a href="http://hyperstruct.net/projects/mozlab" rel="nofollow noreferrer">MozLab</a> plugin which solved my problem if only for one browser platform.</p>
| 19,837 |
<p>This is what I'd like to do, but it doesn't seem possible:
(edit: changed single to double quotes)</p>
<pre><code>function get_archives($limit, $offset)
{
$query = $this->db->query("
SELECT archivalie.id,
archivalie.signature,
type_of_source.description AS type_... | <pre><code>$query = $this->db->query('
SELECT archivalie.id,
archivalie.signature,
type_of_source.description AS type_of_source_description,
media_type.description AS media_type_description,
origin.description AS origin_description
FROM archivalie,
type_of_source,
... | <p>If you used double quotes instead of single quotes it would work, but you'd be open to an injection attack if the variables weren't sanitized properly.</p>
| 22,770 |
<p>How can I do this fast?</p>
<p>Sure I can do this:</p>
<pre><code>static bool ByteArrayCompare(byte[] a1, byte[] a2)
{
if (a1.Length != a2.Length)
return false;
for (int i=0; i<a1.Length; i++)
if (a1[i]!=a2[i])
return false;
return true;
}
</code></pre>
<p>But I'm look... | <p>You can use <a href="http://msdn.microsoft.com/en-us/library/bb348567.aspx" rel="noreferrer">Enumerable.SequenceEqual</a> method.</p>
<pre><code>using System;
using System.Linq;
...
var a1 = new int[] { 1, 2, 3};
var a2 = new int[] { 1, 2, 3};
var a3 = new int[] { 1, 2, 4};
var x = a1.SequenceEqual(a2); // true
var... | <p>If you are looking for a very fast byte array equality comparer, I suggest you take a look at this STSdb Labs article: <a href="http://stsdb.com/forum/stsdb-4-x/sts-labs/466-byte-array-equality-comparer.html#post1249" rel="nofollow">Byte array equality comparer.</a> It features some of the fastest implementations fo... | 6,488 |
<p>I have a Panel with a collection of controls in it. How can I get the index of a specific control when iterating through them? I'm using <code>foreach</code> to iterate, but there's no Index property. Should I use <code>for x = 0...</code> and return <code>x</code> when my match is made, or what?</p>
| <p>You could use:</p>
<pre><code>panel.Controls.IndexOf(control);
</code></pre>
<p>Or you could iterate over them with a for loop instead of a foreach loop. Or you could just create an index that you increment inside of the foreach loop.</p>
| <p>You can just use the IndexOf method. Something like panel1.Controls.IndexOf(textBox1);</p>
| 49,097 |
<p>I have a bunch of JSP files and backend in Tomcat. I have 3 different versions of JSP with same logic inside but with different layouts. So if I change some logic I have three JSP file to fix.</p>
<p>What is the proper soution for such a scenario? I thought of some XML and XSLT stack: backend gives only data in XML... | <p>Learn about MVC (Model View Controller) and the idea that JSP should be the View part of it and should not contain any logic whatsoever. Logic belongs in a Model class.</p>
| <p>Take a look at Tiles.</p>
| 16,092 |
<p>I'm learning ASP.NET MVC Framework, From some articles like <a href="http://weblogs.asp.net/stephenwalther/archive/2008/03/17/asp-net-mvc-in-depth-the-life-of-an-asp-net-mvc-request.aspx" rel="nofollow noreferrer">this</a>, it seems that MvcHandler has only Execute() implemented, there is no asynchronous API impleme... | <p>At the moment, async support is not built into MVC. It's on the feature list, but no guarantees as to exactly when it might be released (and in what form).</p>
| <p>As Brad mentioned, Microsoft is working on a solution as part of MVC futures. There is also an implementation at: <a href="http://code.msdn.microsoft.com/AsyncMvc/Wiki/View.aspx?id=11350" rel="nofollow noreferrer">http://code.msdn.microsoft.com/AsyncMvc/Wiki/View.aspx?id=11350</a></p>
| 34,733 |
<p>I want to read a string value from the registry and concatenate it with another certain string. I'm calling RegQueryValueEx() , like this: </p>
<pre><code>Dim lResult As Long
Dim sLength As Long
Dim sString As String
sString = Space$(256)
sLength = 256
lResult = RegQueryValueEx(hKey, "MyKey", 0, REG_SZ, ByVal sSt... | <p>There is probably a null-character in the string, because VB strings store the length of the string in memory just before the contents of the string. In your case that length is 256. When you load the content using RegQueryValueEx, it null-terminates the string (C-style), but does not change its indicated length, so... | <p>Perhaps the string contains a 0-character so that it ends prematurely?</p>
| 43,870 |
<p>I have an SSIS package that exports data to a couple of Excel files for transfer to a third party. To get this to run as a scheduled job on a 64-bit server I understand that I need to set the step as a CmdExec type and call the 32-bit version of DTExec. But I don't seem to be able to get the command right to pass in... | <p>This step-by-step example is for others who might stumble upon this question. This example uses <em>SSIS 2005</em> and uses <em>SQL Server 2005 64-bit edition server</em> to run the job.</p>
<p>The answer here concentrates only on fixing the error message mentioned in the question. The example will demonstrate the ... | <p>I kinda did what Dr Zim did but I copied the DTExec file <code>C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe</code> to <code>C:\Program Files\Microsoft SQL Server\90\DTS\Binn\</code> folder but named the 32 bit one to DTExec32.exe</p>
<p>then I was able to run my SSIS script through a stored pr... | 4,160 |
<p>I know that IList is the interface and List is the concrete type but I still don't know when to use each one. What I'm doing now is if I don't need the Sort or FindAll methods I use the interface. Am I right? Is there a better way to decide when to use the interface or the concrete type?</p>
| <p>There are two rules I follow:</p>
<ul>
<li>Accept the most basic type that will work</li>
<li>Return the richest type your user will need</li>
</ul>
<p>So when writing a function or method that takes a collection, write it not to take a List, but an IList<T>, an ICollection<T>, or IEnumerable<T>.... | <p>In situations I usually come across, I rarely use IList directly.</p>
<p>Usually I just use it as an argument to a method </p>
<pre><code>void ProcessArrayData(IList almostAnyTypeOfArray)
{
// Do some stuff with the IList array
}
</code></pre>
<p>This will allow me to do generic processing on almost any arra... | 3,786 |
<p>Lets say that you have websites www.xyz.com and www.abc.com.</p>
<p>Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. </p>
<p>Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.... | <p>Try using FormAuthentication by setting the web.config authentication section like so:</p>
<pre><code><authentication mode="Forms">
<forms name=".ASPXAUTH" requireSSL="true"
protection="All"
enableCrossAppRedirects="true" />
</authentication>
</code></pre>
<p>Generate a machine ke... | <p>Alternatively if you want to roll your own and the sites in question are not on the same servers or don't have access to a shared database (in which case see the above responses) then you could place a <a href="http://en.wikipedia.org/wiki/Web_beacon" rel="nofollow noreferrer">web beacon</a> on each of the sites whi... | 9,772 |
<p>All of my methods are failing me in various ways.
different lighting can mess it all up too.</p>
<p>has anyone every trying to return a name given a rgb value? "red" "green" "blue" would be enough to satisfy my needs for today.</p>
<p>i have unsafe byte processing of images from my web cam.</p>
<p><a href="https:... | <p>If you have a list of known colors with names, you can see which of those known colors a given target color is 'closest' to, using a 'closeness' function along the lines of (F# code):</p>
<pre><code>let Diff (c1:Color) (c2:Color) =
let dr = (c1.R - c2.R) |> int
let dg = (c1.G - c2.G) |> int
let db... | <p>Well, Red/Green/Blue are fairly easy to identify by inspection; what range of values do you need to support?</p>
<p>The problem is that unless you start with a named color, it is very hard to get <em>back</em> to one; <code>IsNamedColor</code> will return false even if you create an obvious color via FromArgb.</p>
... | 47,769 |
<p>I am having a similar issue to <a href="https://stackoverflow.com/questions/28387/sql-server-2k5-memory-consumption">this person</a>. The primary difference being the application is NOT meant for a developer environment, and therefore I need to know how to optimize the space used by Sql Server (possibly per machine... | <p>Some applications allocate a lot of memory at startup, and then run their own memory management system on it.
This can be good for applications that have particular allocation patterns, and that feel they can do a better job than the more generic memory manager provided by the runtime system.</p>
<p>Many games do t... | <p>Each time you create a new object, you are asking the .NET garbage collector to give you memory. If the GC has insufficient memory on the managed heap then it will ask the OS for more.
As the other question says, although SQL server is meant to give the memory back it doesn't seem to do it very well. There is not ... | 37,694 |
<p>I am working on a rails project. Using the tag observe_field, I am taking text typed into a text area, processing it in a control, and displaying the result in a div (very similar to the preview in stack overflow). Everything works fine until I type certain special chars.</p>
<ol>
<li>? => causes the variable not t... | <p>This is an escaping issue (as stated by others).</p>
<p>You'll want to change your observe_field :with statement to something like:</p>
<pre><code> :with => "'postbody=' + encodeURIComponent(value)"
</code></pre>
<p>Then in your controller:</p>
<pre><code>def textile_to_html
text = URI.unescape(params['pos... | <p>Can you provide a code sample?</p>
<p>More likely than not you'll just need to escape your HTML entities using <a href="http://www.w3schools.com/jsref/jsref_encodeURI.asp" rel="nofollow noreferrer">encodeuri</a> or something like that.</p>
| 5,124 |
<p>I am building a <a href="https://andypi.co.uk/2017/09/17/dolly-build-notes-prusa-i3-mk2-clone-3d-printer/" rel="nofollow noreferrer">dolly</a> and I am confused as to which proximity sensor to use. </p>
<p>Should I go for M8 or M12 and 5 V or 6-36 V? </p>
<p>What should be the best detecting distance? Sh... | <p>Tomas Sanladerer has produced a nice video on this topic: <a href="https://www.youtube.com/watch?v=il9bNWn66BY" rel="nofollow noreferrer">https://www.youtube.com/watch?v=il9bNWn66BY</a></p>
<p>@ 7:31 you see an overview of the precision of various sensors, including the ones you mention. It appears that the M12-4 a... | <p>As always cost will be a factor. I found the M4 sensors to be be just not good enough, they have to be too close, and eventually it's going to catch on your print and damage sensor mounting and/or the hot-end assembly.</p>
<p>The 8mm range sensors seem like a good distance, but you'll need to decide between a wide... | 851 |
<p>I know there's no standard C function to do this. I was wondering what are the techniques to to this on Windows and *nix? (Windows XP is my most important OS to do this on right now.)</p>
| <p>glibc provides <code>backtrace()</code> function.</p>
<p><a href="http://www.gnu.org/software/libc/manual/html_node/Backtraces.html" rel="nofollow noreferrer">http://www.gnu.org/software/libc/manual/html_node/Backtraces.html</a></p>
| <p>You can do it by walking the stack backwards. In reality, though, it's frequently easier to add an identifier onto a call stack at the beginning of each function and pop it at the end, then just walk that printing the contents. It's a bit of a PITA, but it works well and will save you time in the end.</p>
| 13,116 |
<p>Greetings!</p>
<p>I'm scratching my head, wondering why when I do the following:</p>
<pre><code>Response.Redirect(@"http://www.example.com/file.exe?id=12345");
</code></pre>
<p>Both IE6 and IE7 will download the file as "file" (with no extension), but Firefox, Opera, Google Chrome and Safari have no problems at a... | <p>Have You tried to set correct content-type in Your response headers? For example:</p>
<pre><code>Content-Type: application/octet-stream
Content-Disposition: attachment; filename="file.exe"
</code></pre>
| <p>You will probably need to get the filesize remotely and add it to Content-Length on the header section.</p>
| 37,928 |
<p>Let's say I have the following simple enum:</p>
<pre><code>enum Response
{
Yes = 1,
No = 2,
Maybe = 3
}
</code></pre>
<p>How can I bind this enum to a DropDownList control so that the descriptions are displayed in the list as well as retrieve the associated numeric value (1,2,3) once an option has been... | <p>I probably wouldn't <strong>bind</strong> the data as it's an enum, and it won't change after compile time (unless I'm having one of those <em>stoopid</em> moments). </p>
<p>Better just to iterate through the enum: </p>
<pre><code>Dim itemValues As Array = System.Enum.GetValues(GetType(Response))
Dim itemNames A... | <p>This is my solution for Order an Enum and DataBind(Text and Value)to Dropdown using LINQ</p>
<pre><code>var mylist = Enum.GetValues(typeof(MyEnum)).Cast<MyEnum>().ToList<MyEnum>().OrderBy(l => l.ToString());
foreach (MyEnum item in mylist)
ddlDivisao.Items.Add(new ListItem(item.ToString(), ((int)... | 8,728 |
<p>Let's assume we've got the following Java code:</p>
<pre><code>public class Maintainer {
private Map<Enum, List<Listener>> map;
public Maintainer() {
this.map = new java.util.ConcurrentHashMap<Enum, List<Listener>>();
}
public void addListener( Listener listener, Enum eve... | <p>What would be wrong with doing something like the following:</p>
<p>Defining a 'Maintainer' interface with the addListener(Listener, Enum) method.</p>
<p>Create a DefaultMaintainer class (as above) which implements Maintainer.</p>
<p>Then, in each Listener class, 'inject' the Maintainer interface (constructor inj... | <blockquote>
<p>You said "... you can't have java.lang.Enum as"
annotation param ..."</p>
</blockquote>
<p>I think you are wrong on that. I have recently used on a project something like this :</p>
<pre><code>public @interface MyAnnotation {
MyEnum value();
}
</code></pre>
| 9,696 |
<p>I'm using polar plots (POLAR(THETA,RHO)) in MATLAB.</p>
<p>Is there an easy way to fix the range for the radial axis to say, 1.5?</p>
<p>I'm looking for something analogous to the xlim, ylim commands for cartesian axes. Haven't found anything in the docs yet.</p>
| <p>Here's how I was able to do it. </p>
<p>The MATLAB polar plot (if you look at the Handle Graphics options available) does not have anything like xlim or ylim. However, I realized that the first thing plotted sets the range, so I was able to plot a function with radius range [-.5 .5] on a [-1 1] plot as follows:</... | <p>In case anyone else comes across this, here's <em>the</em> solution:</p>
<p>As <strong><em>Scottie T</em></strong> and <strong><em>gnovice</em></strong> pointed out, Matlab basically uses the polar function as an interface for standard plots, but with alot of formatting behind the scenes to make it look polar. Loo... | 27,981 |
<p>Does anyone know of an already implemented money type for the .NET framework that supports i18n (currencies, formatting, etc)? I have been looking for a well implemented type and can't seem to find one.</p>
| <p>Check this article <a href="http://www.codeproject.com/KB/recipes/MoneyTypeForCLR.aspx" rel="noreferrer">A Money type for the CLR</a></p>
<blockquote>
<p>A convenient, high-performance money
structure for the CLR which handles
arithmetic operations, currency types,
formatting, and careful distribution
and... | <p>i would use integer/long, and use a very low denomination like cents (or pence) - then there would be no decimal to work with, and all calculations can be rounded to the nearest cent. </p>
<p>or, take a look at Martin Fowler's book "Patterns of Enterprise Application Architecture". In that book, he talked about how... | 34,551 |
<p>Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it.</p>
<p>A quick google has found <a href="http://flatpack.sourceforge.net/" rel="noreferrer">http://flatpack.sourceforge.net/</a> which looks promising.</p>
<p>I just wanted to check... | <h1>Apache Commons CSV</h1>
<p>Check out <a href="http://commons.apache.org/proper/commons-csv/" rel="nofollow noreferrer"><em>Apache Common CSV</em></a>.</p>
<p>This library reads and writes <a href="http://commons.apache.org/proper/commons-csv/archives/1.6/apidocs/index.html" rel="nofollow noreferrer">several variati... | <p>If you intend to read csv from excel, then there are some interesting corner cases. I can't remember them all, but the apache commons csv was not capable of handling it correctly (with, for example, urls).</p>
<p>Be sure to test excel output with quotes and commas and slashes all over the place.</p>
| 12,647 |
<p>This is truly a beginner question, so I apologize in advance.</p>
<p>I have Visual Studio 2008 Standard installed and would like to create a small Windows application that does NOT require any .NET framework when run on computers. Does VS 2008 Standard support such a feature? Any pointers on how to accomplish this ... | <p>Sure, you can definitely do this. You'll have to write your application in C++, though.</p>
<p>To get started, go to File | New, and under Project Types pick one of the options under Visual C++. For the minimal dependencies, I would suggest one of the Win32 options. Both the "Win32 Console Application" and the "Win... | <p>VB 6 is not based on the .NET framework. VB**.NET** is.</p>
| 34,114 |
<p>I have recently written a dynamic querying tool using expression trees and as I went the power of expression trees began to dawn on me. My querying tool could also form the basis of a reporting tool, a dynamic decision engine and maybe other cases where you need to work with dynamic objects in abstract ways. </p>
<... | <p><a href="http://www.pobox.com/~skeet/csharp/miscutil/usage/genericoperators.html" rel="nofollow noreferrer">Generic operators</a> (in <a href="http://www.pobox.com/~skeet/csharp/miscutil/" rel="nofollow noreferrer">MiscUtil</a>) is a pretty well utilised bit of code based on expression trees; very simple, but very v... | <p>Have you looked at LINQ and the IQueryable interface? That's how they implemented LINQ to SQL, etc.</p>
| 44,050 |
<p>I've always been using the cookie-based session store, and never even knew about <a href="http://api.rubyonrails.com/classes/ActionController/Cookies.html" rel="nofollow noreferrer">Cookies</a> until now. So is there any situation where I'd need the cookies hash?</p>
| <p>The cookies hash definitely has value in Rails apps. <strong>You should use cookies to store values on the client side that you want to remember between sessions.</strong> </p>
<p>A 'remember me' token is a great example. If you want to allow a user to be auto logged in when they visit your site, just store a pe... | <p>You shouldn't store anything you don't want the user to see or change in cookie. If you store a member ID then the user could easily change the value and pretend to be someone else. Cookies are also sent with every single request to your web server including image, JS and CSS requests. If you are storing lots of inf... | 40,006 |
<p>Multithread algorithms are notably hard to design/debug/prove. Dekker's algorithm is a prime example of how hard it can be to design a correct synchronized algorithm. Tanenbaum's Modern operating systems is filled with examples in its IPC section. Does anyone have a good reference (books, articles) for this? Thanks!... | <p>It is impossible to prove anything without building upon guarentees, so the first thing you want to do is to get familiar with the memory model of your target platform; Java and x86 both have solid and standardized memory models - I'm not so sure about CLR, but if all else fails, you'll have build upon the memory mo... | <p>@Just in case: I is. But from what i learnt, doing so for a non trivial algorithm is a major pain. I leave that sort of a thing for brainier people. I learnt what i know from Parallel Program Design: A Foundation (1988)
by K M Chandy, J Misra </p>
| 10,003 |
<p>As developers and as professional engineers have you been exposed to the tenants of Extreme Programming as defined in the "version 1" by Kent Beck.
Which of those 12 core principles do you feel you have been either allowed to practice or at least be a part of in your current job or others?</p>
<pre><code>* Pair pro... | <p>We are following these practices you've mentioned:</p>
<ul>
<li>Planning game</li>
<li>Test driven development</li>
<li>Whole team (being empowered to
deliver)</li>
<li>Continuous integration</li>
<li>Refactoring or design improvement</li>
<li>Small releases</li>
<li>Coding standards</li>
<li>Collective code owners... | <ul>
<li>Whole team (being empowered to deliver)</li>
<li>Small releases</li>
<li>Coding standards</li>
<li>Collective code ownership</li>
</ul>
<p>But then, I do work in a mission-critical development team that's quite conservative. I don't necessarily thing XP is a good way to develop, you must find a way that's rig... | 10,207 |
<p>Is there a good <code>.Net</code> implementation of the <code>NNTP</code> protocol?</p>
| <p>Try libraries like <a href="http://sourceforge.net/projects/dougnewsnntp/" rel="nofollow noreferrer">http://sourceforge.net/projects/dougnewsnntp/</a> and <a href="http://www.codeplex.com/nntpclientlib" rel="nofollow noreferrer">http://www.codeplex.com/nntpclientlib</a></p>
| <p>There is a C# tutorial for reading posts using NNTP <a href="http://www.geekpedia.com/tutorial212_Developing-an-NNTP-Newsgroup-Reader.html" rel="nofollow noreferrer">here</a>. It should be enough to get you started but if you wish to start getting into processing binary posts, you're probably going to have to deal ... | 9,000 |
<p>I can't figure out how to compile thrift files for C#. I've read, "thrift files which can then be compiled down to language-specific interfaces for a wide variety of different programming platforms (Java, PHP, C/C++, Cocoa, Perl, C#, Ruby, etc.)."</p>
<p>I was looking here: <a href="http://www.markhneedham.com/blog... | <p>Yes, that's right, you first compile the Win32 compiler using a <a href="http://www.cygwin.com/" rel="nofollow noreferrer">Cygwin</a> environment and then in turn use that compiler to create Thrift language interfaces.</p>
| <p>I was searching your question and I found <a href="http://www.robertsindall.co.uk/blog/how-to-generate-cassandra-0-8-1-thrift-api/" rel="nofollow">this useful topic</a>. May this helping :)</p>
| 19,791 |
<p>A couple of years ago the media was rife with all sorts of articles on
how the idea of code reuse was a simple way to improve productivity
and code quality.</p>
<p>From the blogs and sites I check on a regular basis it seems as though
the idea of "code reuse" has gone out of fashion. Perhaps the 'code
reuse' advoca... | <p>The title of the article you are referring to is misleading, and is actually a very good read. Code reuse is very beneficial, but there are downsides with everything. Basically, if I remember correctly, the gist of the article is that you are sealing the code in a black box and not revisiting it, so as the origina... | <p>Maven has solved code reuse. I'm completely serious.</p>
| 46,449 |
<p>Is there a way using the Google Maps API to get back an "optimized" route given a set of waypoints (in other words, a "good-enough" solution to the traveling salesman problem), or does it always return the route with the points in the specified order?</p>
| <p>There is an option in Google Maps API DirectionsRequest called optimizeWaypoints, which should do what you want. This can only handle up to 8 waypoints, though.</p>
<p>Alternatively, there is an open source (MIT license) library that you can use with the Google Maps API to get an optimal (up to 15 locations) or pre... | <p>Just found <a href="http://gebweb.net/optimap/" rel="nofollow">http://gebweb.net/optimap/</a> It looks nice and easy. Online version using google maps. </p>
| 43,809 |
<p>What are all the problem that you foresee in doing that.</p>
| <ol>
<li><strong>VC 6 is no longer supported by Microsoft</strong>, in any way. If something goes wrong and for whatever reason we were not able to compile, we would be completely on our own unable to get any assistance from Microsoft. It seems unlikely that something could go wrong in this way, but if the code in qu... | <p>How big of a code base are you talking about?</p>
<p>Porting a little program (that is mostly non-templated C++ code) should be fairly trivial.</p>
<p>However I once had to convert 100.000 lines of template-using code from VC6 to VC2005, and it was a nightmare week(5 days of work), the main problem was that I had ... | 38,141 |
<p>I've always struggled with how to best include classes into my php code. Pathing is usually an issue but a few minutes ago i found <a href="https://stackoverflow.com/questions/4369/how-to-include-php-files-that-require-an-absolute-path">this question</a> which dramatically helps that. Now I'm reading about __autoloa... | <p>__autoload is great, but the cost of stating all the files in a recursive search function is expensive. You might want to look at building a tree of files to use for autoloading. In my framework, I consistently name files for their classes and use a map that is cached for the data.</p>
<p>Check out <strike><a href... | <p>Hunting for files all over the place will make things slower (many more disk hits). Loading all of your classes in case you might need them will make things take more memory. Specifying which classes you need in every file is difficult to maintain (i.e. they don't get removed if they're no longer used).</p>
<p>The ... | 16,398 |
<p>I have been assigned a project to develop a set of classes that act as an interface to a storage system. A requirement is that the class support a get method with the following signature:</p>
<pre><code>public CustomObject get(String key, Date ifModifiedSince)
</code></pre>
<p>Basically the method is supposed to ... | <p>It sounds like you actually want to return two items: the response code and the object found. You might consider creating a lightweight wrapper that holds both and return them together.</p>
<pre><code>public class Pair<K,V>{
public K first;
public V second;
}
</code></pre>
<p>Then you can create a new P... | <p>If it is acceptable, you may return an amplified CustomObject (a wrapper), which contained values which represented the object and its modification state, if any, etc.</p>
| 44,971 |
<p>I have been studying the differences between version 2.x and version 4 of the <a href="https://reprap.org/wiki/P3Steel" rel="nofollow noreferrer">P3Steel frames</a> - in particular the AC08 bracket at the top of the frame which secures the top of the smooth bars and threaded rods of the Z axis on both the left and r... | <p>I've just seen this right now, I'm Alvaro Rey, the designer of the p3steel v4 mod. The change was made, because with previous versions with the extruder homed, if you go up in the Z axis, the extruder motor could hit the Z axis top plate. So, in order to avoid that, I just changed the design.</p>
<p>The bearing in ... | <p><em>This is mere supposition on my part, and not a definitive answer. This was posted prior to Alvaro's answer.</em></p>
<hr />
<p>In response, or - rather - with respect to, to the comments under the question by <a href="https://3dprinting.stackexchange.com/questions/3015/z-axis-top-brackets-of-p3steel-differ-betwe... | 420 |
<p>I am currently running my Tronxy X5s with a MKS Gen L board. So far I have not ran the heat bed over 50 degrees C since I have only printed with PLA so far. I plan to try PETG and/or ABS in the near future and I have a spare power supply 12V/360W laying around. </p>
<p>When I first got my printer I purchased <a hre... | <p>Short answer YES. You can run it from a different power supply at a higher voltage. Also it has a PC817 Optical isolator (for some reason) therefore the second power supply and your main board should not be electrically connected at all.</p>
| <p>For reference,I done tracing this module as shown.
<a href="https://i.stack.imgur.com/ols3z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ols3z.jpg" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/r8ao6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.c... | 1,261 |
<p>let us have a situation in which the following program prints some 10 lines of #</p>
<pre><code>for(i=0;i<10;i++)
prinf("\n#");
</code></pre>
<p>now how to go back to 5 th line and edit that # and change the color of it without clearing the screen or clearing the below 5 lines?
<p>I have tried </p>
<pre><code>... | <p>It looks like you are mixing printf and another output library - this isn't recommended. Printf expects to be sent to a character terminal, while the output library in question may falsly assume that it has exclusive access (and might misbehave.)</p>
<p>Based on one function, you're likely using conio.h. The docu... | <p>maybe- </p>
<pre><code>cprintf("\b#");
</code></pre>
<p>'b' is for backspace</p>
| 33,109 |
<p>I'm an email n00b but I am working on an application that sends HTML email with Unicode characters (as my friend noted "enjoy encoding hell").</p>
<p>The <code>Subject:</code> header comes from user input and therefore may contain Unicode characters. Some mail clients (like GMail and Outlook 2007) are OK with this,... | <p>Ahah! <code>ActionMailer::Quoting</code> has a <code>quoted_printable</code> method.</p>
<p>So here's what I did:</p>
<pre><code>def my_email(foo)
...
@subject = quoted_printable(foo.some_subject_with_accented_chars, 'utf-8')
...
end
</code></pre>
<p>Doing this convinced Mail.app to display the rest of the ... | <p>Since none of the answers tells about whole message with pure Ruby, here it is.</p>
<pre><code>Net::SMTP.start("localhost") do |smtp|
smtp.open_message_stream opts[:sender_address], opts[:receiver_address] do |f|
f.puts "Content-type: text/plain; charset=UTF-8"
f.puts from
f.puts to
... | 44,417 |
<p>I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an <a href="http://msdn.microsoft.com/en-us/library/aa392726(VS.85).aspx" rel="nofo... | <p>You didn't mention for what OS, but the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=013BB284-3946-44A9-AC3C-BF2A569EAA72&displaylang=en" rel="nofollow noreferrer" title="Microsoft Download Center">WMI Redistributable Components version 1.0</a> definitely exists.</p>
<p>For Windows Server 2... | <p>Wouldn't the normal approach for a Windows component be that the administrators of a set of servers use whatever their local software push technology (i.e. SMS) to ensure that component is installed? This is not that uncommon of a requirement for the remote management of servers via WMI.</p>
<p>By the way, the WMI ... | 2,581 |
<p>I've got a .NET 3.5 class lib that I am trying to write some automated tests for but I'm getting the following error when running any tests in the solution:</p>
<blockquote>
<p>Test method Common.Tests.CommonTests.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Library... | <p>Found the problem, I had set the <em>AssemblyCultureAttribute</em> in the AssemblyInfo.cs file in my Library.Common project. Once removing it the tests run.</p>
<p>Now to actually learn how to use that attribute!</p>
| <p>Can you rebuild the solution? And do you reference to that Library.Common? </p>
<p>You may want to provide more details ( such as what is Library.Common).</p>
| 24,351 |
<p>I'm a long time hobbyist programmer interested in getting into web application development. I have a fair amount of personal experience with various non-web languages, but have never really branched over to web applications.</p>
<p>I don't usually have any issues learning new languages or technologies, so I'm not w... | <p>There is a wide variety of web application languages you could get into. The ones I have most experience with (and therefore will be talking about here) are PHP, eRuby and Ruby on Rails. All of these have good tutorials available on the internet - I'll link to some of them below.</p>
<p>Which to choose depends on e... | <p><a href="http://eloquentjavascript.net/" rel="nofollow noreferrer">Eloquent JavaScript</a> and <a href="http://appjet.com/learn-to-program/lessons/intro" rel="nofollow noreferrer">AppJet</a> offer great tutorials that allow you to follow along while you learn.</p>
<p>Once you cover all the basics, <a href="http://a... | 3,888 |
<p>How do I get a list of all the headings in a word document by using VBA?</p>
| <p>You mean like this <a href="http://msdn.microsoft.com/en-us/library/bb960898.aspx" rel="nofollow noreferrer">createOutline</a> function (which actually copy all headings from a source word document into a new word document):</p>
<p>(I believe the <code>astrHeadings = docSource.<strong><a href="http://msdn.microsoft.... | <p>You can also create a Table of Contents in the doc and copy that. This separates out the para ref from the title, which is handy if you need to present that in another context.
If you do not want the ToC in your doc, just delete that after the Copy n Paste. JK.</p>
| 34,624 |
<p>How to get the phone number of the device in Symbian?</p>
| <p>According to the GSM specs, only the <a href="http://en.wikipedia.org/wiki/IMSI" rel="nofollow noreferrer">IMSI</a> is required to be available on the <a href="http://en.wikipedia.org/wiki/Subscriber_Identity_Module#Data" rel="nofollow noreferrer">SIM</a> card.</p>
<p>The actual phone number <a href="http://en.wiki... | <p>You can't. Afaik.</p>
<p>Check this discussion:
<a href="http://discussion.forum.nokia.com/forum/showthread.php?t=65117" rel="nofollow noreferrer">http://discussion.forum.nokia.com/forum/showthread.php?t=65117</a></p>
| 8,534 |
<p>On my Vista machine I cannot install the .Net framework 3.5 SP1. Setup ends few moments after ending the download of the required files, stating in the log that: </p>
<pre><code>[08/26/08,09:46:11] Microsoft .NET Framework 2.0SP1 (CBS): [2] Error: Installation failed for component Microsoft .NET Framework 2.0SP1 (C... | <p><a href="http://blogs.msdn.com/astebner/archive/2007/08/24/4548657.aspx" rel="nofollow noreferrer">Here is an article describing what might be your problem.</a></p>
| <p>I also experienced it on my XP.</p>
<p>I searched for it, and the result was that some kind of beta .NET remained on my PC.</p>
<p>There is a <a href="http://blogs.msdn.com/astebner/archive/2005/04/08/406671.aspx" rel="nofollow noreferrer">tool to remove all</a> .NET framework from the system. I run it and after i... | 4,731 |
<p>I have a CakePHP 1.2 application.</p>
<p>I'm running into the case where I need to do some logic to render things correctly in the view. </p>
<p>Example:
I have a table called Types. There are flags for various types, so each row has one or more BOOL fields set. For one type of type, I store the contents of an RTF... | <p>i'd suggest keeping that logic in the view, building HTML in your model breaks the whole view/model separation. i don't think there's anything wrong with view logic, personally i tend to constrain it to basic conditionals.</p>
<p>ultimately i think the idea is figuring out where this logic best fits. in this case, ... | <p>Build your own AppHtmlHelper which extends HtmlHelper and does the check for you.</p>
| 16,344 |
<p>In the following code, both the INPUT and TEXTAREA elements render wider than they should. How can I limit them to 100% of the usable area within the div?</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="h... | <p>Inputs and textareas both have borders by default</p>
<pre><code><style>
.mywidth{
width:100%;
border:0;
}
</style>
</code></pre>
<p>will render all the elements within your container.</p>
<p><strong>Update</strong></p>
<p>IE also has left and right padding on each element and the ... | <p>You could try using this DOCTYPE instead</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
</code></pre>
| 32,414 |
<p>When I try to create a new task in the task scheduler via the Java ProcessBuilder class I get an access denied error an Windows Vista. On XP it works just fine.</p>
<p>When I use the "Run as adminstrator" option it runs on Vista as well..</p>
<p>However this is a additional step requeried an the users might not kn... | <p>Have you considered wrapping your Java application in an .exe using launch4j? By doing this you can embed a manifest file that allows you to specify the "execution level" for your executable. In other words, you control the privileges that should be granted to your running application, effectively telling the OS t... | <p>I haven't found the best solution yet. But I have an alternative work-around comparing to "James Van Huis". Use RUNASINVOKE instead so you don't have to see the prompt Allow/Deny everytime you run the app.</p>
<p>Note: you always have to be Admin, that what I am trying to solve</p>
| 32,300 |
<p>This question follows on from <a href="https://stackoverflow.com/questions/299114/can-i-search-for-php-class-members-and-methods-with-vim-star-search">this vim search question</a></p>
<p>I have a setting in my .vimrc which excludes $ as a valid part of a word:</p>
<pre><code>set iskeyword-=$
</code></pre>
<p>This... | <p>I would probably just add <code>set isk-=$</code> to my syntax highlighting auto command in <code>$VIMRUNTIME\filetype.vim</code>. Don't know if it is the nicest way to do it, though.</p>
<p>Thinking about it... I think it would be enough to have an appropriate autocommand in your <code>vimrc</code>.</p>
<pre><cod... | <p>Make a copy of your .vimrc, e.g. .vimrc.ref </p>
<p>Make the copy in another directory.</p>
<p>Then find out why the plugin authors really need to just clobber your .vimrc without:</p>
<ol>
<li>letting you know that they're clobbering it, and</li>
<li>saving a copy of your .vimrc file so you can easily roll back.... | 39,310 |
<p>Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like:</p>
<pre><code>Process.Start("Sample.xls");
</code></pre>
<p>However, I need to pass some command line arguments as well. I c... | <p>Using my code from <a href="https://stackoverflow.com/questions/24954/windows-list-and-launch-applications-associated-with-an-extension#24974">this</a> answer you can get command associated with xls extension. Then you can pass this command to <code>Process.Start</code> method.</p>
| <p>If you query the registry, you can retrieve the data about the registered file type and then call the app directly passing the command line arguments. See <a href="http://www.blackwasp.co.uk/ProgrammaticFileTypes.aspx" rel="nofollow noreferrer">Programmatically Checking and Setting File Types</a> for an example of ... | 5,651 |
<p>I'm trying to use class names to change the color of a link after it has been selected, so that It will remain the new color, but only until another link is selected, and then it will change back.</p>
<p>I'm using this code that was posted by Martin Kool in <a href="https://stackoverflow.com/questions/206689/changi... | <p>You're looping through the siblings. If the links are in separate <code><td></code>'s then they're no longer siblings.</p>
<p>You can loop through all the links like this:</p>
<pre><code>document.onclick = function(evt)
{
var el = window.event? event.srcElement : evt.target;
if (el && el.cla... | <p>Is there an error or is there just nothing happening? A good first step if you are a javascript beginner is to use a tool like Firebug so you see detailed error messages, and you can add in console.log statements to see what's going on while you run your code.</p>
| 31,957 |
<p>How can I capture enter keypresses anywhere on my form and force it to fire the submit button event?</p>
| <p>If you set your <code>Form</code>'s <code>AcceptButton</code> property to one of the <code>Button</code>s on the <code>Form</code>, you'll get that behaviour by default.</p>
<p>Otherwise, set the <code>KeyPreview</code> property to <code>true</code> on the <code>Form</code> and handle its <code>KeyDown</code> event... | <pre><code> if (e.KeyCode.ToString() == "Return")
{
//do something
}
</code></pre>
| 19,931 |
<p>When I'm working on a project, sometimes I'll design the GUI first and then write the backend code to make it work, but other times I'll do the opposite and make the GUI once I have the system working. How do you choose which way round to code and are there any particular types of project or circumstances that would... | <p>You need to create something which would let your testers start immediately. Try to think from that prospective.</p>
<p>If they are working on manual UI testing give them a shell of UI with stubs for all the functionality. If there is an interface to be tested make sure it works (even if it returns dummy data) so t... | <p>My way is:</p>
<ol>
<li>Write on paper very specifically what I want the app to do</li>
<li>Draw on paper the basic views of the app, based on what I want the app to do</li>
<li>Think of the basic elements that are needed to be on the app</li>
<li>Prototype a basic view of the app, either on the SDK I am using or a... | 22,580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.