instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I noticed for a while now the following syntax in some of our code:</p>
<pre><code>if( NULL == var){
//...
}
</code></pre>
<p>or</p>
<pre><code>if( 0 == var){
//...
}
</code></pre>
<p>and similar things.</p>
<p>Can someone please explain why did the person who wrote this choose this notation instead of the... | <p>It's a mechanism to avoid mistakes like this:</p>
<pre><code>if ( var = NULL ) {
// ...
}
</code></pre>
<p>If you write it with the variable name on the right hand side the compiler will be able catch certain mistakes:</p>
<pre><code>if ( NULL = var ) { // not legal, won't compile
// ...
}
</code></pre>
<p>... | <p>Just by the way, I've observed over many years teaching C to new programmers that if you train yourself to read "=" as "gets" and "==" as equals, that in itself will save you from a lot of these bugs. Then you read</p>
<pre><code>if( x = 0){
</code></pre>
<p>as "if x gets 0 then" and that begins to sound weird.</p... | 48,383 |
<p>If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be?</p>
<p>Please explain how you arrived at your answer (since if all you did was pick a number, then I could have done that all by myself ;)</p>
| <p>This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!):</p>
<p><a href="http://www.artima.com/forums/flat.jsp?forum=106&thread=204677" rel="noreferrer">http://www.artima.com/forums/flat.jsp?forum=106&thread=204677</a></p>
<blockquote>
<p><strong>Testivus O... | <p>We were targeting >80% till few days back, But after we used a lot of Generated code, We do not care for %age, but rather make reviewer take a call on the coverage required.</p>
| 11,541 |
<p>In class, we are all 'studying' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access.</p>
<p>I have managed to create databases and tables, but now how do I make a relationship between two tables... | <p>If the tables are innodb you can create it like this: </p>
<pre><code>CREATE TABLE accounts(
account_id INT NOT NULL AUTO_INCREMENT,
customer_id INT( 4 ) NOT NULL ,
account_type ENUM( 'savings', 'credit' ) NOT NULL,
balance FLOAT( 9 ) NOT NULL,
PRIMARY KEY ( account_id ),
FOREIGN KEY (custo... | <pre><code>create table departement(
dep_id int primary key auto_increment,
dep_name varchar(100) not null,
dep_descriptin text,
dep_photo varchar(100) not null,
dep_video varchar(300) not null
);
create table newsfeeds(
news_id int primary key auto_increment,
... | 32,557 |
<p>Could anyone suggest a good packet sniffer class for c++? Looking for a easy insertable class I can use in my c++ program, nothing complicated.</p>
| <p>You will never be able to intercept network traffic just by inserting a class into your project. Packet capture functionality requires kernel mode support, hence you will at the very least need to have your application require or install libpcap/WinPcap, as Will Dean pointed out.</p>
<p>Most modern Unix-like distri... | <p>Microsoft Network Monitor has a packet capture and analysis API, see <a href="http://blogs.technet.com/netmon/archive/2008/10/29/intro-to-the-network-monitor-api.aspx" rel="nofollow noreferrer">the netmon blog</a> for some basic info.</p>
| 44,926 |
<p>It's been quite a while since I last used <a href="http://digitalmars.com/d" rel="nofollow noreferrer">D Programming Language</a>, and now I'm using it for some project that involves scientific calculations.</p>
<p>I have a bunch of floating point data, but when I print them using <code>writefln</code>, I get resul... | <p>Short answer: This can't be done with printf format specifiers.</p>
<p>Since D uses the same formatting as C99's <code>vsprintf()</code>, you find your answer in this thread: <a href="https://stackoverflow.com/questions/277772">Avoid trailing zeroes in printf()</a></p>
| <p>I see you are currently using Phobos, however what you are trying to do is supported in Tango.</p>
<pre><code>Stdout.formatln("{:f2}", 1.2);
</code></pre>
<p>will print "1.20"</p>
| 42,772 |
<p>The subversion concept of branching appears to be focused on creating an [un]stable fork of the entire repository on which to do development. Is there a mechanism for creating branches of individual files?</p>
<p>For a use case, think of a common header (*.h) file that has multiple platform-specific source (*.c) im... | <p>You don't have to branch the entire repository. You could make branches of folders in your project (such as an include folder). As others have noted, you can also do a "copy" of just a single file. Once you have a copy of a file or folder, you "switch" to the branched file or folder to work on the branch version.</p... | <p>A branch in SVN is just a copy. I believe that to do it the way you are hoping to, you'd have to have each version of the file in a separate directory in the repository, and check it out into your source folder. I.E. treat that file like a separate project.</p>
| 14,300 |
<p>I'm working on a little web project that needs to keeps to a <code>NumViews</code> counter for each object/row in a DB table. I'm concerning that all the updates to rows would start really degrade performance both the table grows in object count, and the site would grow in use.</p>
<p>I'm using .NET 3.5 with MSSQL... | <p>I'd suggest:</p>
<ol>
<li><p>Putting the row -> count data in another table (with fixed size columns) so that you're not continually writing to your main table just to maintain counts</p></li>
<li><p>Abstracting access to that so that as the application grows you can replace the DB table with some more efficient st... | <p>I think this could be a serious problem. Reads are 100% scalable, but writes require locking, so you're imposing a locking overhead implicitly on every read and thus serialising them. Do you have any idea what the rate of reads would be that you have to maintain? Have you looked at what auditing options are availabl... | 43,452 |
<p>I've seen some people use <code>EXISTS (SELECT 1 FROM ...)</code> rather than <code>EXISTS (SELECT id FROM ...)</code> as an optimization--rather than looking up and returning a value, SQL Server can simply return the literal it was given.</p>
<p>Is <code>SELECT(1)</code> always faster? Would Selecting a value fro... | <p>For google's sake, I'll update this question with the same answer as this one (<a href="https://stackoverflow.com/questions/1597442/subquery-using-exists-1-or-exists/">Subquery using Exists 1 or Exists *</a>) since (currently) an incorrect answer is marked as accepted. Note the SQL standard actually says that EXISTS... | <p>Select 1 should be better to use in your example. Select * gets all the meta-data assoicated with the objects before runtime which adss overhead during the compliation of the query. Though you may not see differences when running both types of queries in your execution plan.</p>
| 12,358 |
<p>I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. </p>
<p>In C#, I would use an out parameter for the string, but there is no equivalent in Python. I'm still very ne... | <pre><code>def f(in_str):
out_str = in_str.upper()
return True, out_str # Creates tuple automatically
succeeded, b = f("a") # Automatic tuple unpacking
</code></pre>
| <p>You can use return statement with multiple expressions</p>
| 5,941 |
<p>I have a situation where another developer is including source files from a project that I maintain in a project that he maintains. The nature of the files is such that each source file registers a "command" in an interpretive environment so all you have to do is link in a new source file to register a new "command... | <p>There is no reason a source file can't be in multiple projects. Just add it as an 'existing item' in VS.</p>
<p>If you are using precompiled headers then both projects will need equivalent set ups for this to work.</p>
<p>You can also use a #pragma in a lib to force a symbol to be included when the linker would o... | <p>Could you simply write a source file containing nothing but <code>#include</code> directives? I'm not sure if VS checks whether the dependent files have changed if they're not in the project proper, though.</p>
| 31,827 |
<p>It seems if I do something like</p>
<pre><code>$file = fopen($filepath, "w");
$CR = curl_init();
curl_setopt($CR, CURLOPT_URL, $source_path);
curl_setopt($CR, CURLOPT_POST, 1);
curl_setopt($CR, CURLOPT_FAILONERROR, true);
curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
curl... | <p>Note that functions like filesize() cache their result, try adding a call to clearstatcache() above 'print filesize(...);'. Here is an example:</p>
<pre><code>$file = '/tmp/test12345';
file_put_contents($file, 'hello');
echo filesize($file), "\n";
file_put_contents($file, 'hello world, this is a test');
echo filesi... | <p>Well, I have the same problem. curl is supposed to be synchronous, but, depending on how you're using it, it's not synchronous.<br>
If you call, after curl, a print, or echo, the content comes void. There's a strange delay.
But I'll try this approach - </p>
<pre><code>print_r(curls_getinfo($CR));
</code></pre>
<p>... | 33,515 |
<p>I want some of the items to be bold depending on a property of an object i'm putting into the listbox.</p>
<p>I think you can do it with changing templates but can't seem to find an example.</p>
<p>Thanks!</p>
| <p>You can do this using DataTriggers. For a simple example of using a DataTrigger you can check out <a href="http://manicprogrammer.com/cs/blogs/willeke/archive/2007/04/25/datatriggers-are-very-cool.aspx" rel="nofollow noreferrer">http://manicprogrammer.com/cs/blogs/willeke/archive/2007/04/25/datatriggers-are-very-co... | <p>You can do this using DataTriggers. For a simple example of using a DataTrigger you can check out <a href="http://manicprogrammer.com/cs/blogs/willeke/archive/2007/04/25/datatriggers-are-very-cool.aspx" rel="nofollow noreferrer">http://manicprogrammer.com/cs/blogs/willeke/archive/2007/04/25/datatriggers-are-very-co... | 44,515 |
<p>In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this:</p>
<pre><code>Dim ie
Set ie = CreateObject( "InternetExplorer.Application" )
ie.navigate "...to my dreamscript"
' Wait till IE is ready
Do While ie.Busy
(1)
... | <p>You can write a console applicaton and execute the console app in SQL agent job.</p>
| <p>You could execute the wscript by using a SQL Server Agent task with a type of "Operpating System (CmdExec)". This requires that xp_cmdshell be enabled and it is often disabled (by default) due to security concerns. However, it does allow you to initiate programs, such as wscript, that are run at the command prompt... | 49,056 |
<p>How do I set a property of a user control in <code>ListView</code>'s <code>LayoutTemplate</code> from the code-behind?</p>
<pre><code><asp:ListView ...>
<LayoutTemplate>
<myprefix:MyControl id="myControl" ... />
</LayoutTemplate>
...
</asp:ListView>
</code></pre>
<p>I want to do this:... | <p>To set a property of a control that is inside the LayoutTemplate, simply use the FindControl method on the ListView control.</p>
<pre><code>var control = (MyControl)myListView.FindControl("myControlId");
</code></pre>
| <p>The layout gets created, and fires a LayoutCreated event that says the layout has been created in the system.</p>
<p>Then, you can use listview.FindControl to get a reference to that control.</p>
| 7,109 |
<p>Two snippets of MySQL: </p>
<pre><code>SELECT * FROM annoyingly_long_left_hand_table
LEFT JOIN annoyingly_long_right_hand_table
ON annoyingly_long_left_hand_table.id = annoyingly_long_right_hand_table.id;
</code></pre>
<p>vs</p>
<pre><code>SELECT * FROM annoyingly_long_left_hand_table
LEFT JOIN... | <p>There is a small functional difference between the two, in that instead of getting 2 ID columns, you only get one. </p>
<p>SELECT * FROM foo JOIN bar ON ( foo.id == bar.id ) </p>
<p>id , fooname, id, barname </p>
<p>SELECT * FROM foo JOIN bar USING ( id )</p>
<p>id, fooname, barname </p>
<p>So there are at leas... | <p><code>USING</code> is a bit less flexible than a general-purpose <code>ON</code> clause:</p>
<ul>
<li><p>The column(s) in both tables must have the same name.</p></li>
<li><p>The comparison must be equality.</p></li>
<li><p>No other table in the query can have a column of the same name.</p></li>
</ul>
| 39,697 |
<p>I'm interested in hearing what technique(s) you're using to validate the internal state of an object during an operation that, from it's own point of view, only can fail because of bad internal state or invariant breach.</p>
<p>My primary focus is on C++, since in C# the official and prevalent way is to throw an ex... | <p>You can use a technique called NVI (<em>Non-Virtual-Interface</em>) together with the <code>template method</code> pattern. This probably is how i would do it (of course, it's only my personal opinion, which is indeed debatable):</p>
<pre><code>class Printer {
public:
// checks invariant, and calls the actual q... | <p>It's a fine and very relevant question. IMHO, any application architecture should provide a strategy to report broken invariants. One can decide to use exceptions, to use an 'error registry' object, or to explicitly check the result of any action. Maybe there are even other strategies - that's not the point.</p>... | 44,687 |
<p>Dynamically creating a radio button using eg </p>
<pre><code>var radioInput = document.createElement('input');
radioInput.setAttribute('type', 'radio');
radioInput.setAttribute('name', name);
</code></pre>
<p>works in Firefox but not in IE. Why not?</p>
| <p>Taking a step from what Patrick suggests, using a temporary node we can get rid of the try/catch:</p>
<pre><code>function createRadioElement(name, checked) {
var radioHtml = '<input type="radio" name="' + name + '"';
if ( checked ) {
radioHtml += ' checked="checked"';
}
radioHtml += '/>... | <p>My suggestion is not to use document.Create(). Better solution is to construct actual HTML of future control and then assign it like innerHTML to some placeholder - it allows browser to render it itself which is much faster than any JS DOM manipulations.</p>
<p>Cheers.</p>
| 14,452 |
<p>It's been a while since I was in college and knew how to calculate a best fit line, but I find myself needing to. Suppose I have a set of points, and I want to find the line that is the best of those points.</p>
<p>What is the equation to determine a best fit line?
How would I do that with PHP?</p>
| <p>Method of Least Squares
<a href="http://en.wikipedia.org/wiki/Least_squares" rel="noreferrer">http://en.wikipedia.org/wiki/Least_squares</a>.
This book <a href="https://rads.stackoverflow.com/amzn/click/com/0521880688" rel="noreferrer" rel="nofollow noreferrer">Numerical Recipes 3rd Edition: The Art of Scientific Co... | <p>An often used approach is to iteratively minimize the sum of squared y-differences between your points and the fit function.</p>
| 47,598 |
<p>What options are there for serialization when returning instances of custom classes from a WebService?</p>
<p>We have some classes with a number of child collection class properties as well as other properties that may or may not be set depending on usage. These objects are returned from an ASP.NET .asmx WebServic... | <p>If you don't use code-generated classes, you can decorate your properties with the <a href="http://msdn.microsoft.com/en-us/library/system.web.script.serialization.scriptignoreattribute.aspx" rel="nofollow noreferrer">ScriptIgnoreAttribute</a> to tell the serializer to ignore certain properties. Xml serialization h... | <p>You can use the <code>System.Runtime.Serialization.Json.</code><a href="http://pietschsoft.com/post/2008/02/NET-35-JSON-Serialization-using-the-DataContractJsonSerializer.aspx" rel="nofollow noreferrer"><strong><code>DataContractJsonSerializer</code></strong></a> class in the <code>System.ServiceModel.Web.dll</code>... | 19,314 |
<p>Any ideas what the average user's download speed is? I'm working on a site that streams video and am trying to figure out what an average download speed as to determine quality.</p>
<p>I know i might be comparing apples with oranges but I'm just looking for something to get a basis for where to start.</p>
| <p><a href="http://speedtest.net/global.php" rel="noreferrer">Speedtest.net</a> has a lot of stats broken down by country, region, city and ISP. Not sure about accuracy, since it's only based on the people using their "bandwidth measurement" service.</p>
| <p>There are a lot of factors involved (server bandwidth, local ISP, network in between, etc) which make it difficult to give a hard answer. With my current ISP, I typically get 200-300 kB/sec. Although when the planets align I've gotten as much as 2 MB/sec (the "quoted" peak downlink speed). That was with parallel ... | 7,370 |
<p>What would be the best WPF control in C# (VS 2008) that you can place on a form that would allow you to do drawing similar to the "Paint" function for the CWnd class in C++? Also, that could display bitmaps, have a scroll bar, and the ability to accept user inputs (ie. MouseMove, Button Clicks, etc...). Basically ... | <p>No. Full-trust is a .NET term used to indicate that it's not running in a reduced-priviledge .NET sandbox. In .NET prior to 3.5 SP1, this included running from a network share (in the default configuration). It also includes running as a ClickOnce application that has not requested additional permissions, or in s... | <p>Basically Full Trust means that the C# code has total control over the current (.Net) process and all processes running under the Application Pool account.</p>
<p>It is the same as running a C++ dll</p>
<p>Admin access will depend on the IIS settings (ie. if you run the website under System or an admin account)</p... | 12,785 |
<p>Greetings to all! This is my first question here on stackoverflow. I have a WPF application that I am writing for the fellow developers in my department, and there are a couple of settings that I need to check for at startup and update if they are not set (one is the location of an executable on the users computer... | <p>Have you looked into the ConfigurationManager class? It provides a more robust interface to the app.config file and you can do something like this:</p>
<pre><code>Configuration oConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
oConfig.AppSettings.Settings["PreferenceToRemember"].Valu... | <p>Take a look at the Configuration class and <a href="https://learn.microsoft.com/en-us/previous-versions/msp-n-p/ff648951%28v=pandp.10%29" rel="nofollow noreferrer">Enterprise Library</a>.
You can find detailed instructions <a href="https://web.archive.org/web/20200810043157/http://geekswithblogs.net:80/akraus1/artic... | 39,300 |
<p>How can I combine multiple PDFs into one PDF without a 3rd party component?</p>
| <p>I don't think you can.
Opensource component PDFSharp has that functionality, and a nice <a href="http://www.pdfsharp.com/PDFsharp/index.php?option=com_content&task=view&id=24&Itemid=35" rel="noreferrer" title="source sample">source code sample on file combining</a></p>
| <p>Although it has already been said, you can't manipulate PDFs with the built-in libraries of the .NET Framework. I can however recommend <a href="http://itextsharp.sourceforge.net/" rel="nofollow noreferrer">iTextSharp</a>, which is a .NET port of the Java iText. I have played around with it, and found it to be a v... | 9,966 |
<p>I wrote a savefile method to save an object to xml. But I am not sure how to test the method in NUnit. Do I need create a sample file manually and compare the string between the files? Are there any better ways to test the method?</p>
<p>Thanks for your answer.</p>
| <p>Ugh, validating XML output. Welcome to hell :)</p>
<p>A method that has worked for me was to generate an <code>XmlDocument</code> object in memory. Then run your SaveFile method, and load it into another <code>XmlDocument</code>. Walk both XmlDocuments recursively, comparing all elements and attributes.</p>
<p>... | <p>Here's what I do -- it works for me but it might not be to your specifications.</p>
<p>In the teardown I make sure I delete any files I might have created as part of the suite. So yes, make sure the file is a scratch file just for testing</p>
<p>In the test method I delete the file if it exists (it shouldn't as t... | 26,148 |
<p>I cannot understand how this is possible. Please help!!</p>
<p>I have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. The reason I don't want a singl... | <p>Have an additional boolean variable, "m_formUnderConstruction" which you test for before constructing the form, and which you set as soon as you've decided to construct it.</p>
<p>The re-entrancy makes all of this a little icky, unfortunately. I've removed the lock, as if this ever gets called from a different thre... | <p>Use Interlocked.Increment to change the nr of the tries. If it is 1, open the form, otherwise, don't. And use Interlocked.Decrement after the test or on form's close.</p>
<pre><code>private int openedForms = 0;
private Form1 m_form1;
private void ShowForm1()
{
if (Interlocked.Increment(ref openedForms) = 1)
... | 33,942 |
<p>I have a Windows Form that takes quite a bit of time to load initially. However, each subsequent request to load the Form doesn't take as long. Is there a way to optimize a Form's load time?</p>
| <p>You can use <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx" rel="noreferrer">ngen</a>.</p>
<p>I also use this tip to reduce the <a href="http://www.codeproject.com/KB/smart/rssfeeder.aspx#_Toc109841754" rel="noreferrer">Memory footprint on startup</a>.</p>
<p>The Native Image Generator (Ngen... | <p>You need to find out where the time is going before you can optimise it. Don't just ngen it without finding that out first, as if the problem is loading a 150MB background bitmap resource then you won't have done anything useful at all with ngen. </p>
<p>You should disregard all specific advice or hunches about o... | 8,410 |
<p>I need to have a set of overloaded functions in my code but I get convertion wanrings.
Here is a test code:</p>
<pre><code>#include windows.h
void f(DWORD arg){...}
//void f(SIZE_T arg){}
void main(void)
{
DWORD dword=0;
SIZE_T size_t=dword;
f(size_t);
}
</code></pre>
<p>The compiler gives warning:</p>
<pre><... | <p><code>size_t</code> is guaranteed to be an unsigned integral type, but the number of bits it has isn't specified. It could be equal to a <code>DWORD</code> (32 bits), or it could be 64 bits on a 64-bit platform. For maximal portability, you shouldn't assume it has a certain number of bits, which is what the compil... | <p>SIZE_T takes 8 bytes in 64bit system while DWORD takes 4 bytes</p>
<p>from <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx" rel="nofollow">Windows Data Types</a></p>
<pre><code>typedef ULONG_PTR SIZE_T;
#if defined(_WIN64)
typedef unsigned __int64 ULONG_PTR;
#else
typede... | 37,067 |
<p>I'm having a little bit of a problem scaling my images to a properly predefined size. I was wondering - since it is purely mathematics, if there's some sort of common logical algorithm that works in every language (PHP, ActionScript, Javascript etc.) to scale images proportionally.</p>
<p>I'm using this at the mome... | <pre><code>ratio = MIN( maxWidth / width, maxHeight/ height );
width = ratio * width;
height = ratio * height;
</code></pre>
<p>Make sure all divides are floating-point.</p>
| <p>Here's a function I've developed for my site, you might want to use. It's based on your answer above.</p>
<p>It does other things not only the image processing - <strong>please remove everything which is unnecessary</strong>.</p>
<pre><code><?php
$thumb_width = 500;
$thumb_height = 500;
if ($handle = ope... | 14,077 |
<p>I need to delete a regsitry key. It has a deny ACL on Set Value (I need this permission to delete it).</p>
<p>How do I change the ACLs in C++?</p>
| <p>You could use RegSetKeySecurity to adjust the security settings and then delete the key as usual.</p>
| <p>It's a Win32 FAQ.</p>
<p>See Win32 api ng news://194.177.96.26/comp.os.ms-windows.programmer.win32</p>
| 38,816 |
<p>For example if I have an auto-numbered field, I add new records without specifying this field and let DB engine to pick it for me.<br>
So, will it pick the number of the deleted record? If yes, when?</p>
<p>// SQL Server, MySQL. //</p>
<p>Follow-up question: <a href="https://stackoverflow.com/questions/253616/what... | <p>NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!)</p>
| <p>Yeah, it really depends on the way you generate the id.</p>
<p>For example if you are using a GUID as the primary key, most implementations of getting a random new Guid are not likely to pick another guid again, but it will given enough time and if the Guid is not in the table the insert statement will go fine, bu... | 31,604 |
<p>I read the part of <a href="http://docs.python.org/library/configparser.html" rel="noreferrer">the docs</a> and saw that the <code>ConfigParser</code> returns a list of key/value pairs for the options within a section. I figured that keys did not need to be unique within a section, otherwise the parser would just re... | <p>ConfigParser isn't designed to handle such conditions. Furthermore, your config file doesn't make sense to me.</p>
<p>ConfigParser gives you a dict-like structure for each section, so when you call parser.items(section), I'm expecting similar output to dict.items(), which is just a list of key/value tuples. I would... | <p>This deficiency of ConfigParser is the reason why pyglet used <a href="http://code.google.com/p/pyglet/source/diff?spec=svnffc4fe58bc2179a75d3338aa821eb04649609871&old=95d2cfa3167ddd5ca7eb0cd25c277902370fd7f1&r=ffc4fe58bc2179a75d3338aa821eb04649609871&format=unidiff&path=%2Ftools%2Fepydoc%2Fepydoc%2F... | 36,615 |
<p>I need to embed videos on a client's website and they have given the following guidelines:</p>
<ul>
<li>must be viewable as flash (FLV format)</li>
<li>if hosted by outside company (e.g. Youtube) the video can not link back to the outside company's website</li>
<li>if hosted by outside company (e.g. Youtube) the vi... | <p>Your client's requirements preclude using YouTube. You're probably better off hosting them on the client's site.</p>
<p>Flash will import your AVI movies and convert them to FLV. You can find the video import tool under File -> Import -> Import Video.</p>
| <p><a href="http://www.erightsoft.com/SUPER.html" rel="nofollow noreferrer">Super©</a> converts anything to anything .. couldnt live without it. Got a whacked out UI but I'm willing to deal with it.</p>
| 42,556 |
<p>Okay, I will shortly be starting down the path of windows mobile development. I know nothing about the subject really and I am looking for people with experience to let me know of any gottchas you may know of. </p>
<p>Right now I dont even have a breif of what is requied but the assumption is that the application w... | <p>Here a few words from my experience so far (about 9 months) of .net Windows Mobile development.</p>
<ol>
<li><p>Well you are occasionally connected. (Or more likely occasionally disconnected). You have to choose whether you are going to use messaging with queues (i.e. WCF/SOAP/XML or something like it) or databas... | <p>I had to do this once. Weird setup with Macs for development, and we were all Java programmers. And a short deadline. PowerPC macs too, so no chance to install Windows for Visual Studio development, never mind that the money for this would never have appeared.</p>
<p>We ended up writing applications using Java, run... | 49,446 |
<p>When slicing with Slic3r Prusa edition the top layer of most models turns out pretty bad. There are usually small gaps or weird patterns. This does not happen with Ultimaker Cura, it will have a nice smooth top layer. Is there anything settings wise that I can do in Slic3r to get the same quality of top layer as Ult... | <p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow... | <p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow... | 1,194 |
<p>I know it is easy to recommend several cross platform libraries. </p>
<p>However, are there benefits to treating each platform individually for your product? </p>
<p>Yes there will be some base libraries used in all platforms, but UI and some other things would be different on each platform.</p>
<p>I have no rest... | <p>I would say that the benefits of individual development for each platform are:
<P>- native look and feel
<P>- platform knowledge acquired by your developers
<P>-... i'm out of ideas</p>
<p>Seriously, the cost of developing and maintaining 3 separate copies of your application could be huge if you're not careful. </... | <p>For client programs (i.e. not web server programs) it's pretty hard to find to find good Mac and Linux developers, and not really easy to find good Windows developers.</p>
<p>The more platform independent code you have, the easier and faster it will be to complete to your project on all three platforms.</p>
<p>It'... | 18,283 |
<p>The question is in the title, why :</p>
<pre><code>return double.IsNaN(0.6d) && double.IsNaN(x);
</code></pre>
<p>Instead of</p>
<pre><code>return (0.6d).IsNaN && x.IsNaN;
</code></pre>
<p>I ask because when implementing custom structs that have a special value with the same meaning as NaN I tend... | <p>Interesting question; don't know the answer - but if it really bugs you, you could declare an extension method, but it would still use the stack etc.</p>
<pre><code>static bool IsNaN(this double value)
{
return double.IsNaN(value);
}
static void Main()
{
double x = 123.4;
bool isNan = x.IsNaN();
}
</co... | <p>The distinction between an instance and a <code>static</code> is a fundamental point which the C# language (and Java as you say) chooses to make clear (in C++, you can call a <code>static</code> method through an instance, but thats just syntax - under the hood instance.StaticX is the same saying instance Class.Stat... | 48,463 |
<p>In a webservice I see this code:</p>
<pre><code><WebMethod()> _
Public Function dosomething() As Boolean
Try
If successful Then
Return True
Else
Return False
End If
Catch ex As Exception
Throw ex
End Try
End Function
</code></pre>
<p>What's ... | <p><strong>Don't do this.</strong></p>
<p>If you absolutely need to rethrow the exception, just use <code>throw;</code> using <code>throw ex;</code> erases the stack trace and is absolutely wrong.</p>
| <p>You may want to do it if you want to catch an exception except a sub-class of it.</p>
<p>For example,</p>
<pre><code>try {
// Something stupid
}
catch(RuntimeException e) {
throw e; //Handle it outside
}
catch (Exception e) {
// I'm dead
}
</code></pre>
| 43,703 |
<p>In the <a href="https://docs.python.org/2/library/threading.html#thread-objects" rel="noreferrer">Python documentation</a>
it says:</p>
<blockquote>
<p>A thread can be flagged as a "daemon thread". The significance of this
flag is that the entire Python program exits when only daemon threads
are left. The ini... | <p>Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever. These are only useful when the main program is running, and it's okay to kill them off once the other, non-daemon, threads have exited.</p>
<p>Without daemon threads, you'd have to keep track of... | <p><strong>Create a Daemon thread when:</strong></p>
<ul>
<li>You want a low-priority thread</li>
<li>Your Thread does background-specific tasks, and more importantly,</li>
<li>When you want this thread to die as soon as all user threads accomplish their tasks.</li>
</ul>
<p><strong>Some Examples of Daemon Thread Servi... | 23,057 |
<p>All,</p>
<p>As part of an application I'm writing I need to have a HTTP PUT webservice which accepts incoming imagedata, which will by analyzed, validated, and added to a local file store.</p>
<p>My issue arises after the size validation as the </p>
<blockquote>
<p><code>$_SERVER['CONTENT_LENGTH']</code></p>
</... | <p>My best guess is that you need to alter httpd.conf to not deny PUT requests. Have you checked that?</p>
| <p>The <code>r</code> you've got as the second arg isn't right. <code>file_get_contents</code> doesn't use the <code>a/r/w/a+/r+/w+</code> arguments that <code>fopen</code> uses. You probably want to remove it and just do:</p>
<pre><code>file_get_contents('php://input');
</code></pre>
<p>See <a href="http://us3.php... | 17,582 |
<p>I am creating a downloading application and I wish to preallocate room on the harddrive for the files before they are actually downloaded as they could potentially be rather large, and noone likes to see "This drive is full, please delete some files and try again." So, in that light, I wrote this.</p>
<pre><code>//... | <p><a href="http://msdn.microsoft.com/en-us/library/system.io.filestream.setlength" rel="noreferrer">FileStream.SetLength</a> is the one you want. The syntax:</p>
<pre><code>public override void SetLength(
long value
)
</code></pre>
| <p>Unfortunately, you can't really do this just by seeking to the end. That will set the file length to something huge, but may not actually allocate disk blocks for storage. So when you go to write the file, it will still fail.</p>
| 12,410 |
<p>Is it possible with the accuracy of current 3D printers to print a sound trace? </p>
<p>On a vinyl record the grooves in the record are an encoded sound. Is something like this doable with 3D printers? </p>
<p>If Vinyl-like isn't possible, could a sound be printed at desktop scale? I mean printing the waves out th... | <h2>Sound Encoding basics</h2>
<p>Sound is a compression wave, and any depiction of it has to be an encoding of it. You can encode it so you can recreate the sound using a contraption that oscillates in the right way to compress air again in the right pattern, but you can't just "print it out" like you can sc... | <p>I think this is just about doable. In this answer, I will assume you want to produce a "rumble strip" style of object that will reproduce a recording of human speech. I'll assume you don't care about sound quality, you just want the words to be intelligible.</p>
<p>The main things to consider are the printer's reso... | 1,484 |
<p>I have to display marks of my students through my site. The database is created using <a href="http://en.wikipedia.org/wiki/Microsoft_Access" rel="noreferrer">Microsoft Access</a>. How can I display the marks of each student in a table, as they enter the registration number?</p>
| <p>I know this is an old question, but I happened to come across this project, AccessDB, at the same time as this question so I figured I'd post it. Note that it says it is for use with Internet Explorer. I'm guessing they are using a Microsoft only feature to access the file, but I really haven't looked into it.</p>... | <p>JavaScript (or any client-side language) has no ability to access something which is still located on the server. You're best option is to use an AJAX implementation and have a series of web services which you can query from your JavaScript and return the results in a usable format (most likely JSON).</p>
| 48,466 |
<p>I've been having a major issue... well maybe not major, but I've been trying to figure this out since yesterday lunchtime.<br>
I have the following code:</p>
<pre><code>Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Data!R7C1:R5000C40").CreatePivotTable Ta... | <p>Fixed it (earlier, Remou pointed out that posting the answer is a good thing).<br>
I messed up a bit.</p>
<p>My data was dynamic, on every reload another set. In my testing set, everything went awesomely fine. Then, as I loaded a new set, values changed, labels were added, others were left out... one of my pivot ta... | <p>Just guessing ... Is ActiveWorkbook still ok? Have you tried using a named workbook?</p>
| 48,439 |
<p>Please don't say EHCache or OSCache, etc. Assume for purposes of this question that I want to implement my own using just the SDK (learning by doing). Given that the cache will be used in a multithreaded environment, which datastructures would you use? I've already implemented one using <a href="http://docs.oracle.c... | <p>I like lots of these suggestions, but for now I think I'll stick with <code>LinkedHashMap</code> + <code>Collections.synchronizedMap</code>. If I do revisit this in the future, I'll probably work on extending <code>ConcurrentHashMap</code> in the same way <code>LinkedHashMap</code> extends <code>HashMap</code>.</p>
... | <p>Android offers an implementation of an <a href="http://developer.android.com/reference/android/util/LruCache.html" rel="nofollow">LRU Cache</a>. The <a href="https://android.googlesource.com/platform/frameworks/support.git/+/master/v4/java/android/support/v4/util/LruCache.java" rel="nofollow">code</a> is clean and s... | 27,310 |
<p>Scaffolding, what is it? Is it a Rails-only thing?</p>
| <p>Scaffolding generally refers to a quickly set up skeleton for an app. It's not rails-only since other platforms have it as well. It's also not generally meant to be a "final" system; merely the first, smallest way to do it.</p>
| <p>No, scaffolding is not the term for the specific platform, however many know this term in the context of Ruby on Rails or .NET</p>
<p>There are also plenty of tools that perform javascript scaffolding:</p>
<ul>
<li><a href="https://divjoy.com" rel="nofollow noreferrer">divjoy.com</a></li>
<li><a href="https://flatlo... | 29,087 |
<p>Apologies if this has been covered frequently, but I was wondering about how other people approach personal task management.</p>
<p>I've read (parts of) GTD, proceeded to get excited, installed a tonne of plug-ins all over the place, then let it all fall by the wayside. I've used todoist, outlook, google calendar,... | <p>Sorry to be the bearer of bad news, but a "simple and effective todo application" is so hard to find because you are using the tool as a substitute for self-discipline and commitment. Statements like 'I've read parts of this and tried that and that and that but minor interface issues cause me to drop it in a few day... | <p>In our company we use Google Docs Spread Sheet - it's great beacuse you put all tasks into cells and you can share and coedit this document with others. It's very easy to use and doesn't require you to fill a lot of forms.</p>
| 32,296 |
<p>I'm a big fan of Capistrano but I need to develop an automated deployment script for a Java-only shop. I've looked at Ant and Maven and they don't seem to be well geared towards remote administration the way Capistrano is - they seem much more focused on simply building and packaging applications. Is there a bette... | <p>I don't think there is a Capistrano-like application for Java Web Applications, but that shouldn't really keep you from using it (or alternatives like Fabric) to deploy your applications. As you've already said, Ant is more a replacement for GNU Make while Maven is primary a buildout/dependency-management applicatio... | <p>Capistrano could deploy all the web basic application. Deployments for the different language are almost the same:</p>
<ol>
<li>update code</li>
<li>push the code to production server</li>
<li>prepare the configuration files for this deployment</li>
<li>restart server. (thin, nginx, tomcat)</li>
</ol>
<p>in my com... | 22,132 |
<p>How do I get the history of commits that have been made to the repository for a particular user? </p>
<p>I am able to access CVS either through the command line or TortioseCVS, so a solution using either method is sufficient.</p>
| <pre><code>cvs history -u username
</code></pre>
<p>gives a history of changes the user has made</p>
| <p>Or try this one:</p>
<pre><code>cvs history -x AMR -D "your-desired-date"
</code></pre>
<p>Example </p>
<pre><code>cvs history -x AMR -D "2012-04-12"
</code></pre>
| 8,139 |
<p>We have a scenario where we want to display a list of items and indicate which is the "current" item (with a little arrow marker or a changed background colour).</p>
<p>ItemsControl is no good to us, because we need the context of "SelectedItem". However, we want to move the selection programattically and not allow... | <p>One option is to set <code>ListBoxItem.IsEnabled</code> to <code>false</code>:</p>
<pre><code><ListBox x:Name="_listBox">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsEnabled" Value="False"/>
</Style>
</ListBox... | <p>Is your ItemsControl/ListBox databound? </p>
<p>I'm just thinking you could make the Background Brush of each item bound to a property from the source data, or pass the property through a converter. Something like: </p>
<pre><code> <ItemsControl DataContext="{Binding Source={StaticResource Things}}" ItemsSou... | 19,477 |
<p>I have an application that reads a database and outputs alerts to any dependencies that are not being met. My thinking on this issue is "Give the minimum information that points the user to the issue." I have been told by a co-worker that I should be as verbose as possible, printing out the values of the database ... | <p>When writing, know your audience. </p>
<p>If you're logging warning/error messages for your own consumption, then it's fairly easy: what do <em>you</em> need to know when something goes wrong?</p>
<p>If you're logging warning/error messages for someone else, then things get tricky. What do they know? What does the... | <p>Dealing with errors Vs. warnings first: An error should be for something which violates the standard. A warning should be for something which is allowed, but quite likely isn't what the author intended.</p>
<p>For example, the W3C Markup Validator will warn about the use of the syntax <br /> in an HTML document.... | 13,425 |
<p>I accidentally committed too many files to an SVN repository and changed some things I didn't mean to. (Sigh.) In order to revert them to their prior state, the best I could come up with was </p>
<pre><code>svn rm l3toks.dtx
svn copy -r 854 svn+ssh://<repository URL>/l3toks.dtx ./l3toks.dtx
</code></pre>
<p>... | <pre><code>svn merge -r 854:853 l3toks.dtx
</code></pre>
<p>or</p>
<pre><code>svn merge -c -854 l3toks.dtx
</code></pre>
<p>The two commands <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.merge.html" rel="noreferrer">are equivalent</a>.</p>
| <p>Reverse merge is exactly what you want (see luapyad's answer). Just apply the merge to the erroneously-commited file instead of the entire directory.</p>
| 45,021 |
<p>Given a <code>DateTime</code> representing a person's birthday, how do I calculate their age in years?</p>
| <p>An easy to understand and simple solution.</p>
<pre class="lang-cs prettyprint-override"><code>// Save today's date.
var today = DateTime.Today;
// Calculate the age.
var age = today.Year - birthdate.Year;
// Go back to the year in which the person was born in case of a leap year
if (birthdate.Date > today.AddY... | <p>To calculate the age with nearest age:</p>
<pre class="lang-cs prettyprint-override"><code>var ts = DateTime.Now - new DateTime(1988, 3, 19);
var age = Math.Round(ts.Days / 365.0);
</code></pre>
| 2,232 |
<p>I don't know if it is possible to add a Flash banner into a Wordpress theme... Ideally, this banner would be in the header of the site always. Any ideas on how I might accomplish this?</p>
| <p>Yes, it's very much possible. What I would recommend is to use <a href="http://code.google.com/p/swfobject/" rel="nofollow noreferrer">swfobject</a> to replace the your current header with a Flash movie. This way it will degrade gracefully for everyone that lacks a proper flash player, and also you get the benefit o... | <p>You need to edit the corresponding .php file that contains your banner (I don't know what version of WordPress you're using). </p>
<p>The code will be resource-intensive and ugly, though.</p>
| 46,929 |
<p>I have a very simple Setup project that copies three dlls into the GAC. That's all it has to do. It works fine in XP, but on a Vista machine, it errors out stating that it cannot write to the file and to check permissions. I'm sure this has to do with some impersonation nonsense in Vista, but I'm not sure how to add... | <p>If you're using Windows Installer, are you putting your assemblies into the special <strong>Global Assembly Cache</strong> folder? That has always worked for me on Vista and Windows 7. There is no need to use GACUtil or anything else, just put the assemblies in the right folder in the installer project.</p>
| <p>I have had some (3rd party) MSI's which won't install correctly unless I force elevated mode from the start, even if they show a UAC prompt later in the process.</p>
<p>Troubleshooting... I assume you are installing from an administrator account. But, is UAC enabled? If it is, are you getting the UAC elevation prom... | 49,815 |
<p>I need a font that shows letters and function keys on a keyboard, so that I can show Ctrl+Alt+S as 3 separate keys on a keyboard, not as the text.</p>
<p>I've looked at two, and one of them had lots of missing keys (among other things, the Win key), the other one cost over $100.</p>
<p>Any good ideas?</p>
<p>Oh, ... | <p>This looks like it meets your requirements:
<a href="http://www.webpagepublicity.com/free-fonts/k/Keycaps%20Regular.ttf" rel="nofollow noreferrer">http://www.webpagepublicity.com/free-fonts/k/Keycaps%20Regular.ttf</a></p>
<p>I prefer sites that have fonts displayed in the page so I can see them directly since I don... | <p>For Windows keys (including the Windows flag and right-click menu keys), get Betsy Flanagan and Betsy Flanagan Two, both from larabiefonts, free for website use. </p>
<p>For Mac keys (including the Clover, Cmd, Opt, lights, and numeric keypad keys), use MacKeyCaps, but it does have copyright. Several web sites have... | 48,130 |
<p>I have an application where I'm dynamically loading routes by a model, and calling <code>ActionController::Routing::Routes.reload!</code> after creating/updating that model. The problem is that after doing this, I'm receiving the following error when I try to hit that new route:</p>
<pre><code>ActionController::Met... | <p>It turns out, the answer is that what I'm seeing is a <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark" rel="noreferrer">Byte Order Mark</a>, which is a character that tells whatever is loading the document what it is encoded in. In my case, it's encoded in utf-8, so the corresponding BOM was <code>EF BB BF</c... | <p>here's how you do it with vim:</p>
<pre><code># vim file.xml
:set nobomb
:wq
</code></pre>
| 37,172 |
<p>I'm currently studying Computer Science at College where they mainly teach Java standard edition, I see that in the industry this isn't used much, instead Java EE is used. If my College is teaching me Java SE rather than Java EE does this make me less employable?</p>
<p>And what exact are the differences? different... | <p>Java SE contains the standard Java libraries: all the basics, containers, network, GUI, and so on. It's meant mostly for desktop apps and browser applets.</p>
<p>Java EE adds a server framework. When you talk about Java in the server, this is what you're referring to. It's a <em>huge</em> library, with lots and l... | <p>Java EE is just a superset of Java SE (enterprise libraries such as servlets). Learn Java SE and you mostly know Java EE.</p>
| 23,848 |
<p>I'm in the process of trying to move our company from SalesForce to SugarCRM, but I've run in to a nasty bug (the moment I add a custom field to Accounts, all accounts stop showing up). We've paid for support from the SugarCRM people, but they only have take-forever-then-get-a-worthless-response-level tech support ... | <p>I worked with SugarCRM a couple years ago, and although I loved what I saw on the surface, I ended up rejecting it for our project because of what you are experiencing now. The internals of the product are woefully underdocumented. I had envisioned writing a bunch of slick modules for the product, but the resources ... | <p><code>$this</code> is a reference to the current object. </p>
<pre><code>class Test {
var $tmp;
function __construct() {
$this->tmp = 42;
}
}
</code></pre>
| 27,669 |
<p>When it comes to putting the <strong>submit and reset buttons</strong> on your forms, <strong>what order do you use?</strong></p>
<pre><code>[SUBMIT] [RESET]
</code></pre>
<p>or</p>
<pre><code>[RESET] [SUBMIT]
</code></pre>
<p>This issue has come up countless times at work...</p>
<p>So, in your opinion, which i... | <p>In addition to the suggestions given already, I would like to add that the submit button should be an actual button where as reset or cancel just a link making it different from the submit button hence highlighting the fact that they are functionally different and keeping it simple. Last thing you want is to make yo... | <p>It depends which platform background the user has, since dialogs and message boxes typically present buttons in a layout that conforms to the interface guidelines for that platform. Invariably, different platforms have different layouts for their dialogs.</p>
<p>I've accustomised already to the former, since I'm a ... | 45,460 |
<p>I am looking for an algorithm to hatch a rectangle with shortest overall line length, so that an object of given area can be passed through the hatching.</p>
<p>For example given a rectangle of 5x3 cm, and I hatch using parallel lines 1cm across, the biggest object I can pass through the hatch is a square of 1cm si... | <p>You need shapes that form a <a href="http://mathworld.wolfram.com/Tessellation.html" rel="nofollow noreferrer">tessellation</a>. Hexagon is probably your best bet. Though, what if the shape you are passing through doesn't fit the tessellation pattern exactly?</p>
<p>Look into tessellations and figure out if your pa... | <p>What does to hatch a rectangle mean?</p>
<p>Can you rephrase your question?</p>
<p>Also, during the rephrasing, state what the algorithm should receive as input and what it should produce as output.</p>
| 28,094 |
<p>Simple one really. In SQL, if I want to search a text field for a couple of characters, I can do:</p>
<pre><code>SELECT blah FROM blah WHERE blah LIKE '%text%'
</code></pre>
<p>The documentation for App Engine makes no mention of how to achieve this, but surely it's a common enough problem?</p>
| <p>BigTable, which is the database back end for App Engine, will scale to millions of records. Due to this, App Engine will not allow you to do any query that will result in a table scan, as performance would be dreadful for a well populated table.</p>
<p>In other words, every query must use an index. This is why you ... | <p>If the <code>LIKE '%text%'</code> always compares to a word or a few (think permutations) and your data changes slowly (slowly means that it's not prohibitively expensive - both price-wise and performance-wise - to create and updates indexes) then Relation Index Entity (RIE) may be the answer. </p>
<p>Yes, you will... | 7,004 |
<p>Edit:</p>
<p>I don't know what this user originally wanted, and hopefully they'll edit their question to let us know, but otherwise, let's use this question to answer (or give links to) the following common console window issues:</p>
<ul>
<li>How do you capture the output of a console application in your program (... | <p>Keeping the console window open in for C++ in a standard's compliant way (not platform specific):</p>
<pre><code>#include <iostream>
#include <limits>
int main() {
// Rest of the code
//Clean the stream and ask for input
std::cin.ignore ( std::numeric_limits<std::streamsize>::max(), '... | <p>If it's a graphical application that happens to write messages to standard output, open your favorite terminal application and type in the command there. If its output exceeds the output buffer of your terminal, pipe it through 'more' or 'less'.</p>
| 40,146 |
<p>How to truncate and shrink large log files in SQL Server 2005? How to apply truncation at regular intervals?</p>
<p>Is there any difference between truncation and shrinking?</p>
<p>Thanks in advance</p>
| <p>Use DBCC SHRINKFILE and schedule it as a job that runs regularly (preferably during off-hours). </p>
<p>Just be aware that there is a performance hit from regularly growing and shrinking the log file. If you have the space, you may want to set the file size to the maximum that it normally grows to and just leave ... | <p>Use the <code>DBCC SHRINKFILE</code> statement.</p>
| 49,481 |
<p>I have a scenario where I have to check whether user has already opened Microsoft Word. If he has, then I have to kill the winword.exe process and continue to execute my code. </p>
<p>Does any one have any straight-forward code for killing a process using vb.net or c#?</p>
| <p>You'll want to use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx" rel="noreferrer">System.Diagnostics.Process.Kill</a> method. You can obtain the process you want using
<a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.getprocessesbyname.aspx" re... | <p>Please see the example below <br /></p>
<pre><code>public partial class Form1 : Form
{
[ThreadStatic()]
static Microsoft.Office.Interop.Word.Application wordObj = null;
public Form1()
{
InitializeComponent();
}
public bool OpenDoc(string documentName)
{
bool bSuccss = f... | 14,149 |
<p>For a university project, my partner and I need to print the robot Poppy. This is an open source robotic project, <a href="https://www.poppy-project.org/fr/" rel="nofollow noreferrer">poppy-project.org</a>.</p>
<p>We are printing it with a double extruder SpiderBot with PLA and HIPS as support material. Our princip... | <p>Having a bit more experience since my comment post above, I can offer up a possible solution. If your printer is able to print ABS, it works great with HIPS as support material. I've been printing boatloads of ABS models. When support is needed, the HIPS supports will bond reasonably well to the ABS, but when cooled... | <p>Why not try using PVA(Polyvinyl alcohol) for support material.</p>
<p>I use it for my support material with PLA, and it dissolves in water.</p>
<p>here is a link to some on Amazon.<br>
<a href="https://smile.amazon.com/eSUN-1-75mm-filament-natural-0-5kg/dp/B00MVIQASU/ref=sr_1_3?s=industrial&ie=UTF8&qid=150... | 579 |
<p>I have downloaded Privoxy few weeks ago and for the fun I was curious to know how a simple version of it can be done.</p>
<p>I understand that I need to configure the browser (client) to send request to the proxy. The proxy send the request to the web (let say it's a http proxy). The proxy will receive the answer...... | <p>I wouldn't use HttpListener or something like that, in that way you'll come across so many issues. </p>
<p>Most importantly it'll be a huge pain to support:</p>
<ul>
<li>Proxy Keep-Alives</li>
<li>SSL won't work (in a correct way, you'll get popups)</li>
<li>.NET libraries strictly follows RFCs which causes some r... | <p>The browser is connected to the proxy so the data that the proxy gets from the web server is just sent via the same connection that the browser initiated to the proxy.</p>
| 28,047 |
<p>What are they and what are they good for?</p>
<p>I do not have a CS degree and my background is VB6 -> ASP -> ASP.NET/C#. Can anyone explain it in a clear and concise manner?</p>
| <p>Imagine if every single line in your program was a separate function. Each accepts, as a parameter, the next line/function to execute. </p>
<p>Using this model, you can "pause" execution at any line and continue it later. You can also do inventive things like temporarily hop up the execution stack to retrieve a val... | <p>Think of threads. A thread can be run, and you can get the result of its computation. A continuation is a thread that you can copy, so you can run the same computation twice.</p>
| 6,186 |
<p>Ok, let's see if I can make this make sense. </p>
<p>I have a program written that parses an Excel file and it works just fine. I use the following to get into the file:</p>
<pre><code>string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS";
string connectionString = "Provider=Microsoft.Jet.... | <p>It sounds like the XLS file generated by your third-party app may not really be in Excel format - it might actually be a tab-delimited text file with an .xls extension.</p>
<p>Try opening it with a text editor and see. </p>
<p>If it is tab delimited, you can ditch the OleDB adapter and open/parse it as a standard ... | <p>i solved the problem. The Excel file should be generated by MS EXCEL 2003, not from MS EXCEL 2007 "save as 97-2003".
so you have to download a file from any source. Then copy the data manually to the sheet. it worked with me.</p>
| 24,519 |
<p>I have a DAL that I want to return an ADODB.recordset when executed from a classic asp. The object is exposed as a com object and I have a complete dal workin but I am not sure how to return an object that is a recordset that .net can use.</p>
<p>Any help would be aprcitated. Thank you!</p>
<p>--Nicolas</p>
| <p>I think you both for your feedback, but what I was looking to do was probably misunderstood, due to a poorly written question. I found a link to a page that did exactly what I was looking for. </p>
<p>What I have is a DAL that is an Assembly that I wanted to expose to ASP but to do so, to prevent from having to rew... | <p>Ditto what Anthony said, if you can avoid this by all means do. If your DAL is a very generic DAL you can probally write one in .net or use someone elses like Application Block and spend less time then dealing with issues that might crop up. </p>
| 42,438 |
<p>I'm having trouble searching for a decent Java library that provides Markov chains, and other advanced distributions (as in, statistics).</p>
<p>I've found <a href="http://sourceforge.net/projects/hydra-mcmc/" rel="noreferrer">http://sourceforge.net/projects/hydra-mcmc/</a> on source forge, and it looks somewhat ... | <p>You can try to interface with R (r-project.org) in the same way that <a href="http://jgr.markushelbig.org/JGR.html" rel="nofollow noreferrer">http://jgr.markushelbig.org/JGR.html</a> uses Java to access the R-Language.</p>
| <p>It is not a library per say, but it can give you some pointers:</p>
<p><a href="http://www.lbreyer.com/java.html" rel="nofollow noreferrer">Java-mcmc</a> introduced some sophisticated applets illustrating:</p>
<ul>
<li>Common Metropolis-Hastings algorithms</li>
<li>Coupling constructions for Markov chains</li>
</u... | 42,823 |
<p>It seems like anything you can do with bytecode you can do just as easily and much faster in native code. In theory, you could even retain platform and language independence by distributing programs and libraries in bytecode then compiling to native code at installation, rather than JITing it.</p>
<p>So in general,... | <p>Hank Shiffman from SGI said (a long time ago, but it's till true):</p>
<blockquote>
<p>There are three advantages of Java
using byte code instead of going to
the native code of the system:</p>
<ol>
<li><p><strong>Portability</strong>: Each kind of computer has its unique instruction
set. While some p... | <p>Portability and platform independence are probably the most notable advantages of bytecode over native code. </p>
| 7,052 |
<p>Suppose you have a GridView with a few columns like:</p>
<p>| Foo | Bar | Total |</p>
<p>and you use a style sheet to make the alternating rows different colors, say light blue and white.</p>
<p>Is there a good way to make a particular column alternate in a different color? For example, I might want the Total co... | <p>If you're using jQuery, you can do it pretty easily.</p>
<pre><code>$("table#myTable col:odd").css("background-color:#ffe");
</code></pre>
<p>the <code>:odd</code> selector is not available in most current browsers, but jQuery gives it to us today.</p>
<p>For rows, you can do it with the built-in AlternatingRowSt... | <p>In addition to <a href="https://stackoverflow.com/questions/315091/interleave-rowcolumn-colors-in-a-gridview#315123">Ben's suggestion</a>, Matt Berseth also has quite a nice demo of how to do rollover highlighting of columns as well using the GridViewControlExtender which is quite nice:</p>
<p><a href="http://mattb... | 40,671 |
<p>I'm trying to confirm a user a unplugged my embedded device from a network before performing some maintenance. I'm considering "ping"ing all IP address on my sub-net, but that sounds crude. Is there a broadcast/ARP method that might work better?</p>
| <p>You can try a broadcast ping (this is from linux):</p>
<pre><code>ping -b 255.255.255.255
</code></pre>
<p>Another option is to download <a href="http://nmap.org/" rel="nofollow noreferrer">Nmap</a> and do a ping-scan.</p>
| <p>If there's a peer you know you were connected to recently you could try pinging or arping that first. That could cut down on the traffic you're generating.</p>
| 16,370 |
<p>I have a list of <code>Foo</code>. Foo has properties <code>Bar</code> and <code>Lum</code>. Some <code>Foo</code>s have identical values for <code>Bar</code>. How can I use lambda/linq to group my <code>Foo</code>s by <code>Bar</code> so I can iterate over each grouping's <code>Lum</code>s?</p>
| <p><a href="https://stackoverflow.com/questions/46130/how-do-i-group-in-memory-lists#46317">Deeno</a>,</p>
<p>Enjoy:</p>
<pre><code>var foos = new List<Foo> {
new Foo{Bar = 1,Lum = 1},
new Foo{Bar = 1,Lum = 2},
new Foo{Bar = 2,Lum = 3},
};
// Using language integrated queries:
var q = from foo in foo... | <pre><code>var q = from x in list
group x by x.Bar into g
select g;
foreach (var group in q)
{
Console.WriteLine("Group " + group.Key);
foreach (var item in group)
{
Console.WriteLine(item.Bar);
}
}
</code></pre>
| 6,816 |
<p>What would be the most efficient way to compare two <code>double</code> or two <code>float</code> values?</p>
<p>Simply doing this is not correct:</p>
<pre><code>bool CompareDoubles1 (double A, double B)
{
return A == B;
}
</code></pre>
<p>But something like:</p>
<pre><code>bool CompareDoubles2 (double A, dou... | <p>Be extremely careful using any of the other suggestions. It all depends on context.</p>
<p>I have spent a long time tracing bugs in a system that presumed <code>a==b</code> if <code>|a-b|<epsilon</code>. The underlying problems were:</p>
<ol>
<li><p>The implicit presumption in an algorithm that if <code>a==b</cod... | <p>It depends on how precise you want the comparison to be. If you want to compare for exactly the same number, then just go with ==. (You almost never want to do this unless you actually want exactly the same number.) On any decent platform you can also do the following:</p>
<pre><code>diff= a - b; return fabs(diff)&... | 3,800 |
<p>Exporting from c#.net
I am getting a problem I have a form that when I export to excel as a result in excel Any ideas why is this happening I am including the ASP code below.</p>
<pre><code><%@ Page Language="C#" MasterPageFile="~/masterpages/Admin.master" AutoEventWireup="true" CodeFile="members-search-adv.asp... | <p>That's not the sequence at all- it's just not how asp.net and the web work. </p>
<p>You don't fill the grid during the load phase: you retrieve the data and set it as the datasource for the table, but the grid (actually a repeater) isn't filled yet. That doesn't happen until the databinding phase. After the data... | <p>I found the solution to my problem. Thank you all for contributing. On the Load_Page Event I had the binding inside of an if !postback.</p>
| 49,579 |
<p>My company is trying to find a tool that will track serial keys for software we have purchased (such as Office), as well as software that we write and sell.</p>
<p>We want software that will allows us to associate a particular computer with the software on that computer and the serial key(s) and license(s) for that... | <p>A couple of options (including the one you don't want):</p>
<ol>
<li><p>Write your own database for this; Perhaps a simple app using SQLite. (Not very appealing, but not hard either)</p></li>
<li><p>You just need an application that lets you create name:value pairs and assign them into groups. A customizable addres... | <p><a href="http://www.productivecomputing.com/cart/productdetail.php?ID=36" rel="nofollow noreferrer">I've used this</a> in the past and been pretty happy with it. The downside is that it runs in FileMaker</p>
| 49,072 |
<p>I've got the following query to determine how many votes a story has received:</p>
<pre><code>SELECT s_id, s_title, s_time, (s_time-now()) AS s_timediff,
(
(SELECT COUNT(*) FROM s_ups WHERE stories.q_id=s_ups.s_id) -
(SELECT COUNT(*) FROM s_downs WHERE stories.s_id=s_downs.s_id)
) AS votes
FROM stories
</code>... | <p>Try this:</p>
<pre><code> SELECT s_id, s_title, log10(Z) + (Y * s_timediff)/45000 AS redditfunction
FROM (
SELECT stories.s_id, stories.s_title, stories.s_time,
stories.s_time - now() AS s_timediff,
count(s_ups.s_id) - count(s_downs.s_id) as X,
if(X>0,1,if(x<0,-1,0)) as Y,
if(a... | <p>y and z are the tricky ones. You want a specific return based on x's value. That sounds like a good reason to make a function.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/if-statement.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/if-statement.html</a></p>
<p>You should make 1 fu... | 18,579 |
<p><em>Preferred languages</em>: C/C++, Java, and Ruby.</p>
<p>I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby, so I prefer resources that involve one of those three, but any good resource is acceptable.</p>
| <h2>Big List of Resources:</h2>
<ul>
<li><a href="http://www.cs.indiana.edu/%7Edyb/pubs/nano-jfp.pdf" rel="noreferrer">A Nanopass Framework for Compiler Education</a> ¶</li>
<li><a href="http://www.amazon.com/gp/offer-listing/1558603204?tag=thecompilerconne&camp=14573&creative=327641&linkCode=am1&creati... | <p>Whenever I want to try out a new language idea, I just write a simple parser, and have it generate some language that's easy to get good compilers for, like C.</p>
<p>How do you think C++ was done?</p>
| 2,399 |
<p>Boost is meant to be <strong>the</strong> standard non-standard C++ library that every C++ user can use. Is it reasonable to assume it's available for an open source C++ project, or is it a large dependency too far?</p>
| <p>Basically your question boils down to “is it reasonable to have [free library xyz] as a dependency for a C++ open source project.”</p>
<p>Now consider the following quote from Stroustrup and the answer is really a no-brainer:</p>
<blockquote>
<p>Without a good library, most interesting tasks are hard to do in
... | <p>Unfortunately yes, for ubuntu they're readily available but for RHEL 4&5 I've almost always ended up making them from tarballs. They're great libraries, just really big... like using a rail spike when sometimes all you really need is a thumbtack.</p>
| 15,267 |
<p>Has anybody used the ATK Framework? It is claimed to be geared toward developing apps for business use. Manipulating data, knowledge bases, etc... This is what I primarily develop (on the side-for my own use). The site hasn't given me a great overview of why it may be better than other frameworks.</p>
<p>What ... | <p>First of all, let me say that I've been using ATK for only few days now, while my co-workers have been using it for almost 6 months.<br />
ATK Framework is really, excellent framework - but with quite special purpose.<br />
If your looking for framework to help you build Administration panel - ATK will save you load... | <p>We use the atk-framework in work and I must say this is the worst Framework I've ever used.
Nothing is like in other Framework - nothing works like it should be and the documentation - btw. What documentation? </p>
<p>This is not only bad it is totally unuseable </p>
| 39,849 |
<p>In PostgreSQL 8.3 database I have "bookings" table referencing "booking_transactions" table by ID. So that each booking belongs to a single transaction. It's possible to delete bookings from the database.</p>
<p>How can I make sure that a "booking_transactions" row is automatically deleted when all the "bookings" r... | <p>ls doesn't fork. The shell forks and execs in order to run any command that isn't built in, and one of the commands it can run is ls.</p>
<p>ls uses opendir() and readdir() to step through all the files in the directory. If it needs more information about one of them it calls stat().</p>
| <p>This is a old thread , but still I am commenting because I believe the answer which was upvoted and accepted is partially incorrect. @Mark says that ls is built into shell so shell doesn't exec and fork. When I studied the tldp document on bash(I have attached the link)
"<strong>ls</strong>" is not listed as a buil... | 24,987 |
<p>Is it worth to try to keep your GUI within the system looks ?</p>
<p>Every major program have their own anyways...
(visual studio, iexplorer, firefox, symantec utilities, adobe ...)</p>
<p>Or just the frame and dialogs should be left in the system look 'n feel range ?</p>
<p><strong>update:</strong></p>
<p>One e... | <p>I think, that unless your program becomes a very major part of the users life, you should strive to minimize "surprises" and maximimze recognizability (is that even a word?).</p>
<p>So, if you are making something that is used by 1.000 people for 10 minutes a day, go with system looks, and mechanisms.</p>
<p>If, o... | <p>If you are on (or develop for) a Mac, then definitely YES!</p>
<p>And this should be true for Windows also.</p>
| 34,989 |
<p>In cura one of the options under "build plate adhesion" is "skirt", which seems to simply print a loop around, but not touching, my print. How is this supposed to help my prints stick to the bed?</p>
| <p>These skirts they don't contribute at all to help your product adhere better to the build plate other than priming your nozzle so that it is ready to lay down filament for your product. </p>
<p>A skirt <strong>does</strong> give a good indication of the adhesion prior to printing your product, if the skirt does not... | <p>Skirts prime the nozzle- getting the filament to first adhere to the build platform is necessary for the entire print. Once the filament starts to stick it usually will continue to. </p>
<p>Skirts can also help block any air drafts that might blow the filament away from adhering in the 1st layer of the print</p>
| 918 |
<p>For the iPhone, is it possible to configure a UITableView such that it will allow multiple-selection?</p>
<p>I've tried overriding <code>-setSelected:animated:</code> for each UITableViewCell, but trying to fudge the required behavior is tricky as it's difficult to separate the real unselections from the ones where... | <p>The best way to do this would be to a checkmark per selected row.</p>
<p>You can do that by setting the accessoryType on the selected UITableViewCell instances to UITableViewCelAccessoryCheckmark.</p>
<p>To deselect the row, set it back to UITableViewCellAccessoryNone.</p>
<p>To enumerate which cells/rows were se... | <p>Tested with iOS4.3 - 6.0</p>
<pre><code>-(void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller {
if ([controller.searchResultsTableView respondsToSelector:@selector(allowsMultipleSelectionDuringEditing)]) {
controller.searchResultsTableView.allowsMultipleSelectionDuringEdi... | 39,670 |
<p>How you can read a file (text or binary) from a batch file? There is a way to read it in a binary mode or text mode?</p>
| <p>Under NT-style cmd.exe, you can loop through the lines of a text file with</p>
<pre><code>FOR /F %%i IN (file.txt) DO @echo %%i
</code></pre>
<p>Type "help for" on the command prompt for more information. (don't know if that works in whatever "DOS" you are using)</p>
| <p>Corrected code :</p>
<pre><code>setlocal enabledelayedexpansion
for /f "usebackq eol= tokens=* delims= " %%a in (`findstr /n ^^^^ "name with spaces.txt"`) do (
set line=%%a
set "line=!line:*:=!"
echo(!line!
)
endlocal
pause
</code></pre>
| 25,252 |
<p>Most of the work I do is with what could be considered enterprise Web applications. These projects have large budgets, longer timelines (from 3-12 months), and heavy customizations. Because as developers we have been touting the idea of the Web as the next desktop OS, customers are coming to expect the software runn... | <p>At <a href="http://smartbear.com" rel="nofollow noreferrer">my company</a> we have enterprise installations ranging into the thousands of seats. If we implemented an auto-upgrade, our customers would mutiny!</p>
<p>Large installations have peculiar issues that don't apply to small ones. For example, with 2000 use... | <p>One of the primary reasons to implement an application as a web application is that you get automatic upgrades for free. Why would users be getting prompted for upgrades on a web app?</p>
<p>For Windows applications, the "update is available, do you want to upgrade?" functionality is provided by Microsoft using Cl... | 7,234 |
<p>Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter?</p>
<p>Example 1 - separate parameters:
function... | <p>Go with the first option, but rather than allow literal strings (which are error prone), take constant values or an enumeration if your language supports it, like this:</p>
<pre><code>convertTemperature (TempScale.CELSIUS, TempScale.FAHRENHEIT, 22)
</code></pre>
| <p>My vote is two parameters for conversion types, one for the value (as in your first example). I would use enums instead of string literals, however.</p>
| 8,356 |
<p>I've recently switched to PETG , and I'm using Cura as slicer and Ender 3 as printer.</p>
<p>I'm printing a model which Cura declares to be <strong>35 g</strong>, but if I weigh the printed model it weighs <strong>23 g</strong>.</p>
<p>I'm printing with just 1 line of skirt, so its weight is negligible on total weig... | <p>The density of the filament can be specified in the material model of the filament in Cura (Preferences -> Configure Cura... -> Materials and click on the material/filament you are using to slice your model for PETG), look at the value behind <em>Density</em>, the PETG filament I use is using 1.28 g/cm³ (<a hr... | <p>The density of the filament can be specified in the material model of the filament in Cura (Preferences -> Configure Cura... -> Materials and click on the material/filament you are using to slice your model for PETG), look at the value behind <em>Density</em>, the PETG filament I use is using 1.28 g/cm³ (<a hr... | 1,923 |
<p>I recently downloaded the source tarball for a GTK application that I'd like to improve. It uses the standard <code>./configure</code> and <code>make</code> build sequence.</p>
<p>The first time through, <code>configure</code> reported a bunch of unmet build dependencies, such as <code>libgnomeui-2.0</code>. As I... | <p>You want <a href="http://packages.debian.org/search?keywords=auto-apt" rel="noreferrer"><code>auto-apt</code></a> (<a href="http://manpages.debian.net/cgi-bin/man.cgi?query=auto-apt&apropos=0&sektion=0&manpath=Debian+Sid&format=html&locale=en" rel="noreferrer">manpage</a>).</p>
| <p>short of writing your own script that does an apt-cache search for each package -dev you may be out of luck.</p>
| 25,790 |
<p>Is it more efficient for a class to access member variables or local variables? For example, suppose you have a (callback) method whose sole responsibility is to receive data, perform calculations on it, then pass it off to other classes. Performance-wise, would it make more sense to have a list of member variables ... | <p>Executive summary: In virtually all scenarios, it doesn't matter, but there is a slight advantage for local variables.</p>
<p>Warning: You are micro-optimizing. You will end up spending hours trying to understand code that is supposed to win a nanosecond.</p>
<p>Warning: In your scenario, performance shouldn't be ... | <p>Using the member variables should be marginally faster since they only have to be allocated once (when the object is constructed) instead of every time the callback is invoked. But in comparison to the rest of the work you're probably doing I expect this would be a very tiny percentage. Benckmark both and see which ... | 29,503 |
<p>I'm making a program which the user build directories (not in windows, in my app) and in these folders there are subfolders and so on; every folder must contain either folders or documents. What is the best data structure to use? Notice that the user may select a subfolder and search for documents in it and in its s... | <p>This is what I do:</p>
<p>Every record in the database has two fields: ID and ParentID. IDs are 4-5 characters (Base36, a-z:0-9 or something similar). Parent IDs are a concatenation of the parent's complete structure...</p>
<p>So...</p>
<p>This structure:</p>
<pre><code>Root
Folder1
Folder2
Folder3
... | <p>I know that the question is specifically asking for a data structure but...</p>
<p>If you are using an object oriented language maybe you can use the composite design pattern which is ideally suited for this type of hierarchical tree like structure. You get what you are asking for.</p>
| 31,918 |
<p>I'm seeing this error several times an hour on my production site and am not quite sure how to fix it. I've grepped the source code and I am not using "../" anywhere in my code to generate a path.</p>
<p>My application is running on IIS6 on Win2003 Server. It's using URLRewriter.Net to allow the site to have friend... | <p>It's probably due to using "~/something", probably on a Hyperlink control. When the physical file is at a different directory level from the friendly URL, ASP.NET uses too many ../'s in the relative URL that it generates, giving this error. If you can't just use an absolute URL instead, I believe that you can use Pa... | <p>Use reflector to dig into the URLRewriter.Net code. </p>
| 22,094 |
<p>We have a problem with the Euro character when saving and retrieving it from a Oracle 10g using the Oracle 10.2.0.3 JDBC driver. The problem only occurs during a JUnit test running under Linux. The Euro characters returned from database after saving are total screwed up. Oracle has been configured to use character s... | <p>It's not a Linux thing. It's a known Oracle bug in the retrieve code of the jdbc driver. There's a patch available but you'll need access to Oracle Metalink to download it. The other alternative suggested there is to use the OCI driver instead of the thin one. That may or may not be an option for you.</p>
<p>EDIT:<... | <p>It's quite possible; code page 1252 is Microsoft's own extension of ISO-8859-1 (a.k.a. Latin-1), and it's rarely used on Linux, which tends to use the latter. The euro symbol is not part of Latin-1, that may be why it can't be displayed properly on Linux. Can you not use UTF-8? It will work the same way on both s... | 49,470 |
<p>I have a DataRow and I am getting one of the elements which is a Amount with a dollar sign. I am calling a toString on it. Is there another method I can call on it to remove the dollar sign if present. </p>
<p><strong>So something like:</strong></p>
<p><em>dr.ToString.Substring(1, dr.ToString.Length);</em></p>
<p... | <pre><code>Convert.ToString(dr(columnName)).Replace("$", String.Empty)
</code></pre>
<p>--
If you are working with a data table, then you have to unbox the value (by default its Object) to a string, so you are already creating a string, and then another with the replacement. There is really no other way to get around ... | <p>Why don't you update the database query so that it doesn't return the dollar sign? This way you don't have to futz with it in your C# code.</p>
| 18,730 |
<p>I need a way to recursively delete a folder and its children.</p>
<p>Is there a prebuilt tool for this, or do I need to write one?</p>
<p><code>DEL /S</code> doesn't delete directories.</p>
<p><code>DELTREE</code> was removed from Windows 2000+</p>
| <p>RMDIR or RD if you are using the classic Command Prompt (cmd.exe):</p>
<pre><code>rd /s /q "path"
</code></pre>
<blockquote>
<p>RMDIR [/S] [/Q] [drive:]path</p>
<p>RD [/S] [/Q] [drive:]path</p>
<p>/S Removes all directories and files in the specified directory in addition to the directory itself. <stro... | <p>There is also deltree if you're on an older version of windows.</p>
<p>You can learn more about it from here:
<a href="https://ss64.com/nt/deltree.html" rel="nofollow noreferrer">SS64: DELTREE - Delete all subfolders and files.</a></p>
| 12,336 |
<p>I'm trying to learn GNUMake for a small project I'm working on. So far, even the "basic" tutorials seem pretty rough and I've yet to make sense of the makefile syntax.</p>
<p>Does anyone have some good resources for an absolute beginner to get familiar with GNUMake?</p>
| <p>The definitive guide is <a href="http://www.gnu.org/software/make/manual/make.html" rel="noreferrer">http://www.gnu.org/software/make/manual/make.html</a><br>
There is an o'reilly book "Managing Projects with GNU Make" which has more explanation.
You can also uses the earlier editions, they don't cover GnuMake speci... | <p>mgb: It's even worse that that. I once did write a complicated make system from scratch (a few thousand files, fifty or a hundred directories, four or five compilers and cross-compilation targets, 2 OS's, etc.). I sat down and learned gnu make inside and out first off, designed the system, played around with a prot... | 27,108 |
<p>We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that... | <p>Don't throw away your code!</p>
<p>It's the single worst mistake you can make (on a large codebase). See <a href="http://www.joelonsoftware.com/articles/fog0000000069.html" rel="nofollow noreferrer">Things You Should Never Do, Part 1</a>.</p>
<p>You've invested a lot of effort into that old code and worked out ma... | <p>I would not recommend JScript as that is definitely the road less traveled.
ASP.NET MVC is rapidly maturing, and I think that you could begin a migration to it, simultaneously ramping up on the ASP.NET MVC framework as its finalization comes through.
Another option would be to use something like ASP.NET w/Subsonic o... | 11,308 |
<p>I have a form without caption, using on double click to maximize : Code looks like this:</p>
<pre><code>procedure xxxxxx;
begin
if Form1.WindowState=wsNormal then
begin
Form1.WindowState:=wsMaximized;
Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfTaskBar);
end
e... | <p>Sounds okay but like Drejc pointed out, the taskbar can appear anywhere, so too could additional docked sidebars like Google Desktop, Winamp, etc.</p>
<p>Instead perhaps use something like Screen.WorkAreaRect to get the client area of the screen. E.g.</p>
<pre><code>with Screen.WorkAreaRect do
Form1.SetBounds(Le... | <p>One additional hint. The task bar can also be located on the right or the left of the screen (not only top and bottom). So you must additionally figure out where the task bar is.</p>
<p>I would suggest you look into the Delphi implementation of SetWidnowState. In Delphi7 it is this part of the code:</p>
<pre><code... | 49,828 |
<p>I would like to write a plug-in that will allow a custom written CRM to read and write to their local Outlook client. I know that this poses a security concern. But, my clients are asking that their CRM "be connected" to Outlook. They would like to be able to do the following:</p>
<p>A) When a contact sends them... | <p>I was part of the team that created the original Outlook Plug-In for Frankley Covey time management tools. It was quite an adventure!</p>
<p>The first thing I would do is make your client pick a version of Outlook, and stick with it. DO NOT let the client add support for additional Outlook versions, unless they are... | <p>Check out <a href="http://www.kayxo.com/products/qi_all.php" rel="nofollow noreferrer">Kayxo Insight</a>. It's a framework for creating the kind of solution you are describing. </p>
| 14,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.