qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
24,528 | <p>I'm curious to hear the experiences of those who are currently running their SVN server on Windows. </p>
<p>Jeff Atwood has a post on <a href="https://blog.codinghorror.com/setting-up-subversion-on-windows/" rel="nofollow noreferrer">how to setup SVN as a Windows service</a>. It's a great first step, but it doesn't touch on other topics, such as:</p>
<ul>
<li>What to use for a web-based repository browser? <a href="http://websvn.tigris.org/" rel="nofollow noreferrer">WebSVN</a> <em>can</em> work on Windows, but it ain't pretty.</li>
<li>How to manage the passwd file?</li>
<li>Is it possible to integrate with Active Directory without running Apache?</li>
<li>Strategies for backing up the repository.</li>
<li>Useful global ignore patterns for Visual Studio development (suggestions <a href="http://blog.jasonhoekstra.com/2008/07/useful-net-subversion-global-ignore.html" rel="nofollow noreferrer">here</a>, <a href="http://www.thushanfernando.com/?p=12" rel="nofollow noreferrer">here</a>, and <a href="http://blog.donnfelker.com/2007/08/10/SubVersionTortoiseSVNGlobalIgnorePattern.aspx" rel="nofollow noreferrer">here</a> for example).</li>
</ul>
<p>Our company switched from SourceGear Vault to Subversion about one month ago. We've got the basics down pat, but would love to discover people's tips and tricks for running SVN in a MSFT world.</p>
| [
{
"answer_id": 24564,
"author": "Portman",
"author_id": 1690,
"author_profile": "https://Stackoverflow.com/users/1690",
"pm_score": 2,
"selected": false,
"text": "Repo 1: 652 files, 273 directories, 60.1MB\n 23 seconds for VisualSVN over http:// \n 16 seconds for SVN over svn://\n\nRep... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1690/"
] |
24,542 | <p>Is there any reason not to use the bitwise operators &, |, and ^ for "bool" values in C++? </p>
<p>I sometimes run into situations where I want exactly one of two conditions to be true (XOR), so I just throw the ^ operator into a conditional expression. I also sometimes want all parts of a condition to be evaluated whether the result is true or not (rather than short-circuiting), so I use & and |. I also need to accumulate Boolean values sometimes, and &= and |= can be quite useful.</p>
<p>I've gotten a few raised eyebrows when doing this, but the code is still meaningful and cleaner than it would be otherwise. Is there any reason NOT to use these for bools? Are there any modern compilers that give bad results for this?</p>
| [
{
"answer_id": 24560,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 7,
"selected": true,
"text": "||"
},
{
"answer_id": 25220,
"author": "genix",
"author_id": 2714,
"author_profile": "https://Stackoverflow.... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1891/"
] |
24,546 | <p>I'm trying to fetch Wikipedia pages using <a href="http://search.cpan.org/dist/libwww-perl" rel="noreferrer">LWP::Simple</a>, but they're not coming back. This code:</p>
<pre><code>#!/usr/bin/perl
use strict;
use LWP::Simple;
print get("http://en.wikipedia.org/wiki/Stack_overflow");
</code></pre>
<p>doesn't print anything. But if I use some other webpage, say <code><a href="http://www.google.com" rel="noreferrer">http://www.google.com</a></code>, it works fine. </p>
<p>Is there some other name that I should be using to refer to Wikipedia pages? </p>
<p>What could be going on here?</p>
| [
{
"answer_id": 24574,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 5,
"selected": true,
"text": "#!/usr/bin/perl\nuse strict;\nuse LWP::UserAgent;\n\nmy $url = \"http://en.wikipedia.org/wiki/Stack_overflow\";\n\nmy $ua = ... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112/"
] |
24,551 | <p>I've been programming in C# and Java recently and I am curious where the best place is to initialize my class fields.</p>
<p>Should I do it at declaration?:</p>
<pre><code>public class Dice
{
private int topFace = 1;
private Random myRand = new Random();
public void Roll()
{
// ......
}
}
</code></pre>
<p>or in a constructor?:</p>
<pre><code>public class Dice
{
private int topFace;
private Random myRand;
public Dice()
{
topFace = 1;
myRand = new Random();
}
public void Roll()
{
// .....
}
}
</code></pre>
<p>I'm really curious what some of you veterans think is the best practice. I want to be consistent and stick to one approach.</p>
| [
{
"answer_id": 24558,
"author": "kokos",
"author_id": 1065,
"author_profile": "https://Stackoverflow.com/users/1065",
"pm_score": 9,
"selected": true,
"text": "null"
},
{
"answer_id": 32011236,
"author": "Miroslav Holec",
"author_id": 794117,
"author_profile": "https:... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2635/"
] |
24,556 | <p>In LINQ to SQL, is it possible to check to see if an entity is already part of the data context before trying to attach it?</p>
<p>A little context if it helps...</p>
<p>I have this code in my <code>global.asax</code> as a helper method. Normally, between requests, this isn't a problem. But right after signing in, this is getting called more than once, and the second time I end up trying to attach the <code>Member</code> object in the same unit of work where it was created.</p>
<pre><code>private void CheckCurrentUser()
{
if (!HttpContext.Current.User.Identity.IsAuthenticated)
{
AppHelper.CurrentMember = null;
return;
}
IUserService userService = new UserService();
if (AppHelper.CurrentMember != null)
userService.AttachExisting(AppHelper.CurrentMember);
else
AppHelper.CurrentMember = userService.GetMember(
HttpContext.Current.User.Identity.Name,
AppHelper.CurrentLocation);
}
</code></pre>
| [
{
"answer_id": 24558,
"author": "kokos",
"author_id": 1065,
"author_profile": "https://Stackoverflow.com/users/1065",
"pm_score": 9,
"selected": true,
"text": "null"
},
{
"answer_id": 32011236,
"author": "Miroslav Holec",
"author_id": 794117,
"author_profile": "https:... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595/"
] |
24,579 | <p>Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?</p>
| [
{
"answer_id": 348596,
"author": "Tim Knight",
"author_id": 43043,
"author_profile": "https://Stackoverflow.com/users/43043",
"pm_score": 3,
"selected": false,
"text": "before_save"
}
] | 2008/08/23 | [
"https://Stackoverflow.com/questions/24579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1632/"
] |
24,580 | <p>How do you turn a Visual Studio build that you'd perform in the IDE into a script that you can run from the command line?</p>
| [
{
"answer_id": 24583,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 2,
"selected": false,
"text": "msbuild"
},
{
"answer_id": 24584,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https:/... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2541/"
] |
24,620 | <p>What can be reasons to prevent a class from being inherited? (e.g. using sealed on a c# class)
Right now I can't think of any.</p>
| [
{
"answer_id": 24665,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 0,
"selected": false,
"text": "sealed"
}
] | 2008/08/23 | [
"https://Stackoverflow.com/questions/24620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2374/"
] |
24,622 | <p>I can set the PHP include path in the <code>php.ini</code>:</p>
<pre><code>include_path = /path/to/site/includes/
</code></pre>
<p>But then other websites are affected so that is no good.</p>
<p>I can set the PHP include in the start of every file:</p>
<pre><code>$path = '/path/to/site/includes/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
</code></pre>
<p>But that seems like bad practice and clutters things up. </p>
<p>So I can make an include of that and then include it into every file:</p>
<pre><code>include 'includes/config.php';
</code></pre>
<p>or</p>
<pre><code>include '../includes/config.php';
</code></pre>
<p>This is what I'm doing right now, but the include path of <code>config.php</code> will change depending on what is including it. </p>
<p>Is there a better way? Does it matter?</p>
| [
{
"answer_id": 24631,
"author": "Erik van Brakel",
"author_id": 909,
"author_profile": "https://Stackoverflow.com/users/909",
"pm_score": 5,
"selected": true,
"text": "ini"
},
{
"answer_id": 24695,
"author": "Gary Richardson",
"author_id": 2506,
"author_profile": "htt... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2118/"
] |
24,626 | <p>Can you tell me what is the difference between <strong>abstraction</strong> and <strong>information hiding</strong> in software development?</p>
<p>I am confused. Abstraction hides detail implementation and
information hiding abstracts whole details of something.</p>
<p><strong>Update:</strong> I found a good answer for these three concepts. <a href="https://stackoverflow.com/a/8694874/240733">See the separate answer below</a> for several citations taken from <a href="http://web.archive.org/web/20080906224409/http://www.itmweb.com/essay550.htm" rel="noreferrer">there</a>.</p>
| [
{
"answer_id": 24728,
"author": "Zooba",
"author_id": 891,
"author_profile": "https://Stackoverflow.com/users/891",
"pm_score": 1,
"selected": false,
"text": "private"
},
{
"answer_id": 24748,
"author": "rp.",
"author_id": 2536,
"author_profile": "https://Stackoverflo... | 2008/08/23 | [
"https://Stackoverflow.com/questions/24626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1556/"
] |
24,644 | <p>Is there any way, in any language, to hook my program when a user renames a file?</p>
<p>For example:
A user renames a file and presses enter (or clicks away) to confirm the rename action. BEFORE the file is actually renamed, my program "listens" to this event and pops up a message saying "Are you sure you want to rename C:\test\file.txt to C:\test\test.txt?".</p>
<p>I'm thinking/hoping this is possible with C++, C# or .NET.. But I don't have any clue where to look for.</p>
| [
{
"answer_id": 24781,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 0,
"selected": false,
"text": "IFileOperationProgressSink.PreRenameItem"
}
] | 2008/08/23 | [
"https://Stackoverflow.com/questions/24644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
24,675 | <p>Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques.</p>
<hr>
<p>I'm developing a tool in <strong>PHP</strong> that could attain quite a lot of users, if it works out right. However while I'm fully capable of developing the program I'm pretty much clueless when it comes to making something that can deal with huge traffic. So here's a few questions on it (feel free to turn this question into a resource thread as well).</p>
<h2>Databases</h2>
<p>At the moment I plan to use the MySQLi features in PHP5. However how should I setup the databases in relation to users and content? Do I actually <em>need</em> multiple databases? At the moment everything's jumbled into one database - although I've been considering spreading user data to one, actual content to another and finally core site content (template masters etc.) to another. My reasoning behind this is that sending queries to different databases will ease up the load on them as one database = 3 load sources. Also would this still be effective if they were all on the same server?</p>
<h2>Caching</h2>
<p>I have a template system that is used to build the pages and swap out variables. Master templates are stored in the database and each time a template is called it's cached copy (a html document) is called. At the moment I have two types of variable in these templates - a static var and a dynamic var. Static vars are usually things like page names, the name of the site - things that don't change often; dynamic vars are things that change on each page load.</p>
<p>My question on this:</p>
<p>Say I have comments on different articles. Which is a better solution: store the simple comment template and render comments (from a DB call) each time the page is loaded or store a cached copy of the comments page as a html page - each time a comment is added/edited/deleted the page is recached.</p>
<h2>Finally</h2>
<p>Does anyone have any tips/pointers for running a high load site on PHP. I'm pretty sure it's a workable language to use - Facebook and Yahoo! give it great precedence - but are there any experiences I should watch out for?</p>
| [
{
"answer_id": 31191,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "ob_start()"
}
] | 2008/08/23 | [
"https://Stackoverflow.com/questions/24675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] |
24,680 | <p>My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in Visual Basic 6.0, so I have a couple of questions:</p>
<ul>
<li>What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...)</li>
<li>Are there any best practices for using Subversion with Visual Basic 6.0? (file types to ignore, etc.)</li>
</ul>
| [
{
"answer_id": 1530193,
"author": "awe",
"author_id": 109392,
"author_profile": "https://Stackoverflow.com/users/109392",
"pm_score": 3,
"selected": false,
"text": "*.vbw"
}
] | 2008/08/23 | [
"https://Stackoverflow.com/questions/24680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217/"
] |
24,715 | <p>I'm implementing a tagging system for a website. There are multiple tags per object and multiple objects per tag. This is accomplished by maintaining a table with two values per record, one for the ids of the object and the tag.</p>
<p>I'm looking to write a query to find the objects that match a given set of tags. Suppose I had the following data (in [object] -> [tags]* format)</p>
<pre><code>apple -> fruit red food
banana -> fruit yellow food
cheese -> yellow food
firetruck -> vehicle red
</code></pre>
<p>If I want to match (red), I should get apple and firetruck. If I want to match (fruit, food) I should get (apple, banana).</p>
<p>How do I write a SQL query do do what I want?</p>
<p>@Jeremy Ruten,</p>
<p>Thanks for your answer. The notation used was used to give some sample data - my database does have a table with 1 object id and 1 tag per record.</p>
<p>Second, my problem is that I need to get all objects that match all tags. Substituting your OR for an AND like so:</p>
<pre><code>SELECT object WHERE tag = 'fruit' AND tag = 'food';
</code></pre>
<p>Yields no results when run.</p>
| [
{
"answer_id": 24720,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": -1,
"selected": false,
"text": " apple -> fruit\n apple -> red\n apple -> food\n banana -> fruit\n banana -> yellow\n banana -> food\n"
},
{
"answ... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658/"
] |
24,723 | <p>Jeff actually posted about this in <a href="http://refactormycode.com/codes/333-sanitize-html" rel="noreferrer">Sanitize HTML</a>. But his example is in C# and I'm actually more interested in a Java version. Does anyone have a better version for Java? Is his example good enough to just convert directly from C# to Java?</p>
<p>[Update] I have put a bounty on this question because SO wasn't as popular when I asked the question as it is today (*). As for anything related to security, the more people look into it, the better it is!</p>
<p>(*) In fact, I think it was still in closed beta</p>
| [
{
"answer_id": 535022,
"author": "Chase Seibert",
"author_id": 7679,
"author_profile": "https://Stackoverflow.com/users/7679",
"pm_score": 7,
"selected": true,
"text": "<HTML><BODY>\n<?xml:namespace prefix=\"t\" ns=\"urn:schemas-microsoft-com:time\">\n<?import namespace=\"t\" implementat... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1406/"
] |
24,730 | <p>I'm doing a little bit of work on a horrid piece of software built by Bangalores best.</p>
<p>It's written in mostly classic ASP/VbScript, but "ported" to ASP.NET, though most of the code is classic ASP style in the ASPX pages :(</p>
<p>I'm getting this message when it tries to connect to my local database:</p>
<p><strong>Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.</strong></p>
<pre><code>Line 38: MasterConn = New ADODB.Connection()
Line 39: MasterConn.connectiontimeout = 10000
Line 40: MasterConn.Open(strDB)
</code></pre>
<p>Anybody have a clue what this error means? Its connecting to my local machine (running SQLEXPRESS) using this connection string:</p>
<pre><code>PROVIDER=MSDASQL;DRIVER={SQL Server};Server=JONATHAN-PC\SQLEXPRESS\;DATABASE=NetTraining;Integrated Security=true
</code></pre>
<p>Which is the connection string that it was initially using, I just repointed it at my database.</p>
<p><strong>UPDATE:</strong></p>
<p>The issue was using "Integrated Security" with ADO. I changed to using a user account and it connected just fine.</p>
| [
{
"answer_id": 24744,
"author": "Dale Ragan",
"author_id": 1117,
"author_profile": "https://Stackoverflow.com/users/1117",
"pm_score": 3,
"selected": true,
"text": "DRIVER={SQL Server};\n"
},
{
"answer_id": 887833,
"author": "Amadiere",
"author_id": 7828,
"author_prof... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
24,734 | <p>I'm trying to add support for stackoverflow feeds in my rss reader but <strong>SelectNodes</strong> and <strong>SelectSingleNode</strong> have no effect. This is probably something to do with ATOM and xml namespaces that I just don't understand yet.</p>
<p>I have gotten it to work by removing all attributes from the <strong>feed</strong> tag, but that's a hack and I would like to do it properly. So, how do you use <strong>SelectNodes</strong> with atom feeds?</p>
<p>Here's a snippet of the feed.</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:thr="http://purl.org/syndication/thread/1.0">
<title type="html">StackOverflow.com - Questions tagged: c</title>
<link rel="self" href="http://stackoverflow.com/feeds/tag/c" type="application/atom+xml" />
<subtitle>Check out the latest from StackOverflow.com</subtitle>
<updated>2008-08-24T12:25:30Z</updated>
<id>http://stackoverflow.com/feeds/tag/c</id>
<creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
<entry>
<id>http://stackoverflow.com/questions/22901/what-is-the-best-way-to-communicate-with-a-sql-server</id>
<title type="html">What is the best way to communicate with a SQL server?</title>
<category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="c" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="c++" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="sql" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="mysql" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="database" />
<author><name>Ed</name></author>
<link rel="alternate" href="http://stackoverflow.com/questions/22901/what-is-the-best-way-to-communicate-with-a-sql-server" />
<published>2008-08-22T05:09:04Z</published>
<updated>2008-08-23T04:52:39Z</updated>
<summary type="html">&lt;p&gt;I am going to be using c/c++, and would like to know the best way to talk to a MySQL server. Should I use the library that comes with the server installation? Are they any good libraries I should consider other than the official one?&lt;/p&gt;</summary>
<link rel="replies" type="application/atom+xml" href="http://stackoverflow.com/feeds/question/22901/answers" thr:count="2"/>
<thr:total>2</thr:total>
</entry>
</feed>
</code></pre>
<p><br/></p>
<h2>The Solution</h2>
<pre><code>XmlDocument doc = new XmlDocument();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("atom", "http://www.w3.org/2005/Atom");
doc.Load(feed);
// successful
XmlNodeList itemList = doc.DocumentElement.SelectNodes("atom:entry", nsmgr);
</code></pre>
| [
{
"answer_id": 24740,
"author": "Julio César",
"author_id": 2148,
"author_profile": "https://Stackoverflow.com/users/2148",
"pm_score": 3,
"selected": false,
"text": "XmlDocument document = new XmlDocument();\nXmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);\nnsmg... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147/"
] |
24,797 | <p>What is the best way to convert a UTC datetime into local datetime. It isn't as simple as a getutcdate() and getdate() difference because the difference changes depending on what the date is.</p>
<p>CLR integration isn't an option for me either.</p>
<p>The solution that I had come up with for this problem a few months back was to have a daylight savings time table that stored the beginning and ending daylight savings days for the next 100 or so years, this solution seemed inelegant but conversions were quick (simple table lookup)</p>
| [
{
"answer_id": 25073,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 6,
"selected": true,
"text": "TimeZones e.g.\n--------- ----\nTimeZoneId 19\nName Eastern (GMT -5)\nOffset -5\n"
},
{
... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1950/"
] |
24,816 | <p>Does anyone know of an easy way to escape HTML from strings in <a href="http://jquery.com/" rel="noreferrer">jQuery</a>? I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks). I'm sure it's possible to extend jQuery to do this, but I don't know enough about the framework at the moment to accomplish this.</p>
| [
{
"answer_id": 24870,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 6,
"selected": false,
"text": "html.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n"
},
{
"answer_id": 25207,
"author":... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2657/"
] |
24,821 | <p>This problem started <a href="http://forums.asp.net/t/1304033.aspx" rel="nofollow noreferrer">on a different board</a>, but <a href="https://stackoverflow.com/users/60/dave-ward">Dave Ward</a>, who was very prompt and helpful there is also here, so I'd like to pick up here for hopefully the last remaining piece of the puzzle.</p>
<p>Basically, I was looking for a way to do constant updates to a web page from a long process. I thought AJAX was the way to go, but Dave has <a href="http://encosia.com/2007/10/03/easy-incremental-status-updates-for-long-requests/" rel="nofollow noreferrer">a nice article about using JavaScript</a>. I integrated it into my application and it worked great on my client, but NOT my server WebHost4Life. I have another server @ Brinkster and decided to try it there and it DOES work. All the code is the same on my client, WebHost4Life, and Brinkster, so there's obviously something going on with WebHost4Life.</p>
<p>I'm planning to write an email to them or request technical support, but I'd like to be proactive and try to figure out what could be going on with their end to cause this difference. I did everything I could with my code to turn off Buffering like <code>Page.Response.BufferOutput = False</code>. What server settings could they have implemented to cause this difference? Is there any way I could circumvent it on my own without their help? If not, what would they need to do?</p>
<p>For reference, a link to the working version of a simpler version of my application is located @ <a href="http://www.jasoncomedy.com/javascriptfun/javascriptfun.aspx" rel="nofollow noreferrer">http://www.jasoncomedy.com/javascriptfun/javascriptfun.aspx</a> and the same version that isn't working is located @ <a href="http://www.tabroom.org/Ajaxfun/Default.aspx" rel="nofollow noreferrer">http://www.tabroom.org/Ajaxfun/Default.aspx</a>. You'll notice in the working version, you get updates with each step, but in the one that doesn't, it sits there for a long time until everything is done and then does all the updates to the client at once ... and that makes me sad.</p>
| [
{
"answer_id": 26483,
"author": "Dave Ward",
"author_id": 60,
"author_profile": "https://Stackoverflow.com/users/60",
"pm_score": 3,
"selected": false,
"text": "protected void Page_Load(object sender, EventArgs e)\n{\n for (int i = 0; i < 10; i++) \n {\n Response.Write(i + \"<br />\... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1953/"
] |
24,829 | <pre><code>public class MyClass
{
public int Age;
public int ID;
}
public void MyMethod()
{
MyClass m = new MyClass();
int newID;
}
</code></pre>
<p>To my understanding, the following is true:</p>
<ol>
<li>The reference m lives on the stack and goes out of scope when MyMethod() exits.</li>
<li>The value type newID lives on the stack and goes out of scope when MyMethod() exits.</li>
<li>The object created by the new operator lives in the heap and becomes reclaimable by the GC when MyMethod() exits, assuming no other reference to the object exists. </li>
</ol>
<p>Here is my question:</p>
<ol>
<li>Do value types within objects live on the stack or the heap?</li>
<li>Is boxing/unboxing value types in an object a concern?</li>
<li>Are there any detailed, yet understandable, resources on this topic?</li>
</ol>
<p>Logically, I'd think value types inside classes would be in the heap, but I'm not sure if they have to be boxed to get there.</p>
<p>Edit:</p>
<p>Suggested reading for this topic:</p>
<ol>
<li><a href="http://www.microsoft.com/MSPress/books/6522.aspx" rel="nofollow noreferrer">CLR Via C# by Jeffrey Richter</a></li>
<li><a href="http://books.google.com/books?id=Kl1DVZ8wTqcC&dq=essential+.net&pg=PP1&ots=5a-UEHSLVJ&sig=D2_xn2kzMnP8zLXDVIV6AJtfbCY&hl=en&sa=X&oi=book_result&resnum=1&ct=result#PPP1,M1" rel="nofollow noreferrer">Essential .NET by Don Box</a></li>
</ol>
| [
{
"answer_id": 24876,
"author": "icelava",
"author_id": 2663,
"author_profile": "https://Stackoverflow.com/users/2663",
"pm_score": 4,
"selected": true,
"text": "public class EmbeddedValues\n{\n public int NumberField;\n}\n"
},
{
"answer_id": 21390848,
"author": "supercat",
... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1880/"
] |
24,849 | <p>Is there any JavaScript method similar to the jQuery <code>delay()</code> or <code>wait()</code> (to delay the execution of a script for a specific amount of time)?</p>
| [
{
"answer_id": 24852,
"author": "Abhinav",
"author_id": 2617,
"author_profile": "https://Stackoverflow.com/users/2617",
"pm_score": 9,
"selected": true,
"text": "setTimeout(function, milliseconds);\n"
},
{
"answer_id": 24934,
"author": "Polsonby",
"author_id": 137,
"a... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] |
24,853 | <p>In C, what is the difference between using <code>++i</code> and <code>i++</code>, and which should be used in the incrementation block of a <code>for</code> loop?</p>
| [
{
"answer_id": 24856,
"author": "Ryan Fox",
"author_id": 55,
"author_profile": "https://Stackoverflow.com/users/55",
"pm_score": 6,
"selected": false,
"text": "++i"
},
{
"answer_id": 24858,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stacko... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] |
24,866 | <p>I am using Java back end for creating an XML string which is passed to the browser. Currently I am using simple string manipulation to produce this XML. Is it essential that I use some XML library in Java to produce the XML string?
I find the libraries very difficult to use compared to what I need.</p>
| [
{
"answer_id": 24897,
"author": "Telcontar",
"author_id": 518,
"author_profile": "https://Stackoverflow.com/users/518",
"pm_score": 0,
"selected": false,
"text": "public String DOM2String(Document doc)\n{\n TransformerFactory transformerFactory =TransformerFactory.newInstance();\n ... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] |
24,881 | <p>I'm trying to solve <a href="http://uva.onlinejudge.org/external/1/100.pdf" rel="noreferrer">the 3n+1 problem</a> and I have a <code>for</code> loop that looks like this: </p>
<pre><code>for(int i = low; i <= high; ++i)
{
res = runalg(i);
if (res > highestres)
{
highestres = res;
}
}
</code></pre>
<p>Unfortunately I'm getting this error when I try to compile with GCC:</p>
<blockquote>
<p>3np1.c:15: error: 'for' loop initial
declaration used outside C99 mode</p>
</blockquote>
<p>I don't know what C99 mode is. Any ideas?</p>
| [
{
"answer_id": 24882,
"author": "OysterD",
"author_id": 2638,
"author_profile": "https://Stackoverflow.com/users/2638",
"pm_score": 8,
"selected": true,
"text": "i"
},
{
"answer_id": 24884,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackov... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] |
24,886 | <p>Is there a performance difference between <code>i++</code> and <code>++i</code> if the resulting value is not used?</p>
| [
{
"answer_id": 24887,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 10,
"selected": true,
"text": "i++"
},
{
"answer_id": 25077,
"author": "Jason Z",
"author_id": 2470,
"author_profile": "https://Stac... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] |
24,891 | <p>I've always heard that in C you have to really watch how you manage memory. And I'm still beginning to learn C, but thus far, I have not had to do any memory managing related activities at all.. I always imagined having to release variables and do all sorts of ugly things. But this doesn't seem to be the case.</p>
<p>Can someone show me (with code examples) an example of when you would have to do some "memory management" ?</p>
| [
{
"answer_id": 24893,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 3,
"selected": false,
"text": " char *string = malloc(stringlength); // stringlength is the number of bytes to allocate\n\n // Do something with the strin... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] |
24,901 | <p>We have the question <a href="/q/24886">is there a performance difference between <code>i++</code> and <code>++i</code> <strong>in C</strong>?</a></p>
<p>What's the answer for C++?</p>
| [
{
"answer_id": 24904,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 10,
"selected": true,
"text": "++i"
},
{
"answer_id": 24910,
"author": "wilhelmtell",
"author_id": 456,
"author_profile": "https://S... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] |
24,929 | <p>What is the difference between the <code>EXISTS</code> and <code>IN</code> clause in SQL?</p>
<p>When should we use <code>EXISTS</code>, and when should we use <code>IN</code>?</p>
| [
{
"answer_id": 24930,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 6,
"selected": false,
"text": "SELECT *\nFROM Customers\nWHERE EXISTS (\n SELECT *\n FROM Orders\n WHERE Orders.CustomerID = Customers.ID\n)... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2528/"
] |
24,931 | <ol>
<li>Is it possible to capture Python interpreter's output from a Python script?</li>
<li>Is it possible to capture Windows CMD's output from a Python script?</li>
</ol>
<p>If so, which librar(y|ies) should I look into?</p>
| [
{
"answer_id": 24939,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 0,
"selected": false,
"text": "somescript.py | your-capture-program-here\n"
},
{
"answer_id": 24949,
"author": "Henrik Gustafsson",
"... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1670/"
] |
24,941 | <p>I am using <a href="http://www.simpletest.org/" rel="nofollow noreferrer">Simpletest</a> as my unit test framework for the PHP site I am currently working on. I like the fact that it is shipped with a simple HTML reporter, but I would like a bit more advanced reporter.</p>
<p>I have read the reporter API documentation, but it would be nice to be able to use an existing reporter, instead of having to do it yourself.</p>
<p>Are there any good extended HTML reporters or GUI's out there for Simpletest?</p>
<p>Tips on GUI's for PHPUnit would also be appreciated, but my main focus is Simpletest, for this project. I have tried <a href="http://cool.sourceforge.net/" rel="nofollow noreferrer">Cool PHPUnit Test Runner</a>, but was not convinced.</p>
| [
{
"answer_id": 24939,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 0,
"selected": false,
"text": "somescript.py | your-capture-program-here\n"
},
{
"answer_id": 24949,
"author": "Henrik Gustafsson",
"... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276/"
] |
24,954 | <p>How to determine the applications associated with a particular extension (e.g. .JPG) and then determine where the executable to that application is located so that it can be launched via a call to say System.Diagnostics.Process.Start(...).</p>
<p>I already know how to read and write to the registry. It is the layout of the registry that makes it harder to determine in a standard way what applications are associated with an extension, what are there display names, and where their executables are located.</p>
| [
{
"answer_id": 24974,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 4,
"selected": true,
"text": "using System;\nusing Microsoft.Win32;\n\nnamespace GetAssociatedApp\n{\n class Program\n {\n static void Main(string[... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2669/"
] |
24,991 | <p>I have defined a Java function:</p>
<pre><code>static <T> List<T> createEmptyList() {
return new ArrayList<T>();
}
</code></pre>
<p>One way to call it is like so:</p>
<pre><code>List<Integer> myList = createEmptyList(); // Compiles
</code></pre>
<p>Why can't I call it by explicitly passing the generic type argument? :</p>
<pre><code>Object myObject = createEmtpyList<Integer>(); // Doesn't compile. Why?
</code></pre>
<p>I get the error <code>Illegal start of expression</code> from the compiler.</p>
| [
{
"answer_id": 24997,
"author": "Cheekysoft",
"author_id": 1820,
"author_profile": "https://Stackoverflow.com/users/1820",
"pm_score": 5,
"selected": false,
"text": "static <T> List<T> createEmptyList( Class<T> type ) {\n return new ArrayList<T>();\n}\n\n@Test\npublic void createStringL... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/755/"
] |
24,993 | <p>I have a WCF Web Service which is referenced from a class library. After the project is run, when creating the service client object from inside a class library, I receive an InvalidOperationException with message:</p>
<blockquote>
<p>Could not find default endpoint element that references contract
'MyServiceReference.IMyService' in the ServiceModel client
configuration section. This might be because no configuration file was
found for your application, or because no endpoint element matching
this contract could be found in the client element.</p>
</blockquote>
<p>The code I am using to create the instance is:</p>
<pre><code>myServiceClient = new MyServiceClient();
</code></pre>
<p>where MyServiceClient inherits from</p>
<p>System.ServiceModel.ClientBase</p>
<p>How do I solve this?</p>
<p>Note: I have a seperate console application which simply creates the same service object and makes calls to it and it works without no problems.</p>
| [
{
"answer_id": 25004,
"author": "Richard Morgan",
"author_id": 2258,
"author_profile": "https://Stackoverflow.com/users/2258",
"pm_score": 0,
"selected": false,
"text": "<endpoint>"
},
{
"answer_id": 1711550,
"author": "NealWalters",
"author_id": 160245,
"author_profi... | 2008/08/24 | [
"https://Stackoverflow.com/questions/24993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] |
25,007 | <p>What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%?</p>
<p>I'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't really matter that much.</p>
<p>Based on Marius and Andy's answers I'm using the following solution:</p>
<pre><code>double red = (percent < 50) ? 255 : 256 - (percent - 50) * 5.12;
double green = (percent > 50) ? 255 : percent * 5.12;
var color = Color.FromArgb(255, (byte)red, (byte)green, 0);
</code></pre>
<p>Works perfectly - Only adjustment I had to make from Marius solution was to use 256, as (255 - (percent - 50) * 5.12 yield -1 when 100%, resulting in Yellow for some reason in Silverlight (-1, 255, 0) -> Yellow ...</p>
| [
{
"answer_id": 25012,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 1,
"selected": false,
"text": "#F00"
},
{
"answer_id": 25014,
"author": "Cade",
"author_id": 565,
"author_profile": "https://Stac... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199387/"
] |
25,033 | <p>I am using the code snippet below, however it's not working quite as I understand it should. </p>
<pre><code>public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
try {
line = br.readLine();
while(line != null) {
System.out.println(line);
line = br.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
}
</code></pre>
<p>From reading the Javadoc about <code>readLine()</code> it says: </p>
<p>Reads a line of text. A line is considered to be terminated by any one of a line feed (<code>\n</code>), a carriage return (<code>\r</code>), or a carriage return followed immediately by a linefeed. </p>
<p><strong>Returns</strong>:
A <code>String</code> containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached </p>
<p><strong>Throws</strong>:
<code>IOException</code> - If an I/O error occurs</p>
<p>From my understanding of this, <code>readLine</code> should return null the first time no input is entered other than a line termination, like <code>\r</code>. However, this code just ends up looping infinitely. After debugging, I have found that instead of null being returned when just a termination character is entered, it actually returns an empty string (""). This doesn't make sense to me. What am I not understanding correctly?</p>
| [
{
"answer_id": 25043,
"author": "Tom Lokhorst",
"author_id": 2597,
"author_profile": "https://Stackoverflow.com/users/2597",
"pm_score": 4,
"selected": true,
"text": "readLine"
},
{
"answer_id": 36438,
"author": "Bartosz Bierkowski",
"author_id": 3666,
"author_profile... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2628/"
] |
25,041 | <p>Using CSS,</p>
<p>I'm trying to specify the height of a <code>span</code> tag in Firefox, but it's just not accepting it (IE does).</p>
<p>Firefox accepts the <code>height</code> if I use a <code>div</code>, but the problem with using a <code>div</code> is the annoying line break after it, which I can't have in this particular instance. </p>
<p>I tried setting the CSS style attribute of: <pre>display: inline</pre> for the <code>div</code>, but Firefox seems to revert that to <code>span</code> behavior anyway and ignores the <code>height</code> attribute once again.</p>
| [
{
"answer_id": 25047,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 4,
"selected": false,
"text": "display: inline"
},
{
"answer_id": 25049,
"author": "Ross",
"author_id": 2025,
"author_profile": "... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693/"
] |
25,046 | <p>I've just started learning Lisp and I can't figure out how to compile and link lisp code to an executable.</p>
<p>I'm using <code>clisp</code> and <code>clisp -c</code> produces two files:</p>
<ul>
<li>.fas</li>
<li>.lib</li>
</ul>
<p>What do I do next to get an executable?</p>
| [
{
"answer_id": 25435,
"author": "thekidder",
"author_id": 1631,
"author_profile": "https://Stackoverflow.com/users/1631",
"pm_score": 7,
"selected": true,
"text": "(EXT:SAVEINITMEM \"executable.exe\"\n :QUIET t\n :INIT-FUNCTION 'main\n :EXE... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2450/"
] |
25,116 | <p>In Python you can use <a href="https://docs.python.org/library/struct.html" rel="noreferrer">StringIO</a> for a file-like buffer for character data. <a href="https://docs.python.org/library/mmap.html" rel="noreferrer">Memory-mapped file</a> basically does similar thing for binary data, but it requires a file that is used as the basis. Does Python have a file object that is intended for binary data and is memory only, equivalent to Java's <a href="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html" rel="noreferrer">ByteArrayOutputStream</a>?</p>
<p>The use-case I have is I want to create a ZIP file in memory, and <a href="https://docs.python.org/library/zipfile.html" rel="noreferrer">ZipFile</a> requires a file-like object.</p>
| [
{
"answer_id": 25123,
"author": "mmattax",
"author_id": 1638,
"author_profile": "https://Stackoverflow.com/users/1638",
"pm_score": 2,
"selected": false,
"text": "\nimport struct\nf = open(filename, \"rb\")\ns = f.read(8)\nx, y = struct.unpack(\">hl\", s)\n"
},
{
"answer_id": 251... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2679/"
] |
25,128 | <p>Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?</p>
| [
{
"answer_id": 25139,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 5,
"selected": true,
"text": "<?php\nheader (\"Content-type: image/png\");\n$im = @imagecreatetruecolor(120, 20)\n or die(\"Cannot Initialize new GD image... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
25,132 | <p>I did a lot of PHP programming in the last years and one thing that keeps annoying me is the weak support for Unicode and multibyte strings (to be sure, natively there is none). For example, "htmlentities" seems to be a much used function in the PHP world and I found it to be absolutely annoying when you've put an effort into keeping every string localizable, only store UTF-8 in your database, only deliver UTF-8 webpages etc. Suddenly, somewhere between your database and the browser there's this hopelessly naive function pretending every byte is a character and messes everything up.</p>
<p>I would just <i>love</i> to just dump this kind of functions, they seem totally superfluous. <b>Is it still necessary these days to write '&auml;' instead of 'ä'?</b> At least my Firefox seems perfectly happy to display even the strangest Asian glyphs as long as they're served in a proper encoding.</p>
<p><b>Update:</b> To be more precise: Are named entities necessary for <i>anything else than displaying HTML tags</i> (as in "&lt;" for "<")</p>
<h3>Update 2:</h3>
<p>@Konrad: Are you saying that, no, named entities are not needed?</p>
<p>@Ross: But wouldn't it be better to sanitize user input when it's entered, to keep my output logic free from such issues? (assuming of course, that reliable sanitizing on input is possible - but then, if it isn't, can it be on output?)</p>
| [
{
"answer_id": 25173,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 4,
"selected": true,
"text": "application/xhtml+xml"
}
] | 2008/08/24 | [
"https://Stackoverflow.com/questions/25132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] |
25,147 | <p>I have two arrays of animals (for example).</p>
<pre><code>$array = array(
array(
'id' => 1,
'name' => 'Cat',
),
array(
'id' => 2,
'name' => 'Mouse',
)
);
$array2 = array(
array(
'id' => 2,
'age' => 321,
),
array(
'id' => 1,
'age' => 123,
)
);
</code></pre>
<p>How can I merge the two arrays into one by the ID?</p>
| [
{
"answer_id": 25155,
"author": "Erik van Brakel",
"author_id": 909,
"author_profile": "https://Stackoverflow.com/users/909",
"pm_score": 2,
"selected": false,
"text": "$array = array(\n 1 => array(\n 'name' => 'Cat',\n ),\n 2 => array(\n 'name' => 'Mouse',\n )\... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2118/"
] |
25,158 | <p>I'm rewriting an old application and use this as a good opportunity to try out C# and .NET development (I usually do a lot of plug-in stuff in C).</p>
<p>The application is basically a timer collecting data. It has a start view with a button to start the measurement. During the measurement the app has five different views depending on what information the user wants to see.</p>
<p>What is the best practice to switch between the views?
From start to running?
Between the running views?</p>
<p>Ideas:</p>
<ul>
<li>Use one form and hide and show controls</li>
<li>Use one start form and then a form with a TabControl</li>
<li>Use six separate forms</li>
</ul>
| [
{
"answer_id": 25512,
"author": "Chris Karcher",
"author_id": 2773,
"author_profile": "https://Stackoverflow.com/users/2773",
"pm_score": 4,
"selected": true,
"text": "tabControl1.Top = tabControl1.Top - tabControl1.ItemSize.Height;\ntabControl1.Height = tabControl1.Height + tabControl1.... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2703/"
] |
25,161 | <p>I have an image and on it are logos (it's a map), I want to have a little box popup with information about that logo's location when the user moves their mouse over said logo.</p>
<p>Can I do this without using a javascript framework and if so, are there any small libraries/scripts that will let me do such a thing?</p>
| [
{
"answer_id": 25165,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 3,
"selected": false,
"text": "title"
},
{
"answer_id": 25211,
"author": "travis",
"author_id": 1414,
"author_profile": "https://St... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
25,174 | <p>I've used the PHP MVC framework Symfony to build an on-demand web app.</p>
<p>It has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as <a href="http://robrosenbaum.com/php/howto-disable-session-timeout-in-symfony/" rel="nofollow noreferrer">this one</a> did not help me.</p>
<p>I intend not to migrate to Symfony 1.1 (which fixes this bug) in the foreseeable future.</p>
<p>Has anyone been there and solved it? I would be most grateful for a hint or two!</p>
| [
{
"answer_id": 483374,
"author": "deresh",
"author_id": 11851,
"author_profile": "https://Stackoverflow.com/users/11851",
"pm_score": 0,
"selected": false,
"text": "all:\n .settings:\n timeout: 864000\n"
},
{
"answer_id": 1438989,
"author": "Community",
"author_id"... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2706/"
] |
25,200 | <p>I don't like the AutoSize property of the Label control. I have a custom Label that draws a fancy rounded border among other things. I'm placing a <code>AutoSize = false</code> in my constructor, however, when I place it in design mode, the property always is True. </p>
<p>I have overridden other properties with success but this one is happily ignoring me. Does anybody has a clue if this is "by MS design"?</p>
<p>Here's the full source code of my Label in case anyone is interested.</p>
<pre><code>using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Dentactil.UI.WinControls
{
[DefaultProperty("TextString")]
[DefaultEvent("TextClick")]
public partial class RoundedLabel : UserControl
{
private static readonly Color DEFAULT_BORDER_COLOR = Color.FromArgb( 132, 100, 161 );
private const float DEFAULT_BORDER_WIDTH = 2.0F;
private const int DEFAULT_ROUNDED_WIDTH = 16;
private const int DEFAULT_ROUNDED_HEIGHT = 12;
private Color mBorderColor = DEFAULT_BORDER_COLOR;
private float mBorderWidth = DEFAULT_BORDER_WIDTH;
private int mRoundedWidth = DEFAULT_ROUNDED_WIDTH;
private int mRoundedHeight = DEFAULT_ROUNDED_HEIGHT;
public event EventHandler TextClick;
private Padding mPadding = new Padding(8);
public RoundedLabel()
{
InitializeComponent();
}
public Cursor TextCursor
{
get { return lblText.Cursor; }
set { lblText.Cursor = value; }
}
public Padding TextPadding
{
get { return mPadding; }
set
{
mPadding = value;
UpdateInternalBounds();
}
}
public ContentAlignment TextAlign
{
get { return lblText.TextAlign; }
set { lblText.TextAlign = value; }
}
public string TextString
{
get { return lblText.Text; }
set { lblText.Text = value; }
}
public override Font Font
{
get { return base.Font; }
set
{
base.Font = value;
lblText.Font = value;
}
}
public override Color ForeColor
{
get { return base.ForeColor; }
set
{
base.ForeColor = value;
lblText.ForeColor = value;
}
}
public Color BorderColor
{
get { return mBorderColor; }
set
{
mBorderColor = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_BORDER_WIDTH)]
public float BorderWidth
{
get { return mBorderWidth; }
set
{
mBorderWidth = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_ROUNDED_WIDTH)]
public int RoundedWidth
{
get { return mRoundedWidth; }
set
{
mRoundedWidth = value;
Invalidate();
}
}
[DefaultValue(DEFAULT_ROUNDED_HEIGHT)]
public int RoundedHeight
{
get { return mRoundedHeight; }
set
{
mRoundedHeight = value;
Invalidate();
}
}
private void UpdateInternalBounds()
{
lblText.Left = mPadding.Left;
lblText.Top = mPadding.Top;
int width = Width - mPadding.Right - mPadding.Left;
lblText.Width = width > 0 ? width : 0;
int heigth = Height - mPadding.Bottom - mPadding.Top;
lblText.Height = heigth > 0 ? heigth : 0;
}
protected override void OnLoad(EventArgs e)
{
UpdateInternalBounds();
base.OnLoad(e);
}
protected override void OnPaint(PaintEventArgs e)
{
SmoothingMode smoothingMode = e.Graphics.SmoothingMode;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
int roundedWidth = RoundedWidth > (Width - 1)/2 ? (Width - 1)/2 : RoundedWidth;
int roundedHeight = RoundedHeight > (Height - 1)/2 ? (Height - 1)/2 : RoundedHeight;
GraphicsPath path = new GraphicsPath();
path.AddLine(0, roundedHeight, 0, Height - 1 - roundedHeight);
path.AddArc(new RectangleF(0, Height - 1 - 2*roundedHeight, 2*roundedWidth, 2*roundedHeight), 180, -90);
path.AddLine(roundedWidth, Height - 1, Width - 1 - 2*roundedWidth, Height - 1);
path.AddArc(new RectangleF(Width - 1 - 2*roundedWidth, Height - 1 - 2*roundedHeight, 2*roundedWidth, 2*roundedHeight), 90, -90);
path.AddLine(Width - 1, Height - 1 - roundedHeight, Width - 1, roundedHeight);
path.AddArc(new RectangleF(Width - 1 - 2*roundedWidth, 0, 2*roundedWidth, 2*roundedHeight), 0, -90);
path.AddLine(Width - 1 - roundedWidth, 0, roundedWidth, 0);
path.AddArc(new RectangleF(0, 0, 2*roundedWidth, 2*roundedHeight), -90, -90);
e.Graphics.DrawPath(new Pen(new SolidBrush(BorderColor), BorderWidth), path);
e.Graphics.SmoothingMode = smoothingMode;
base.OnPaint(e);
}
protected override void OnResize(EventArgs e)
{
UpdateInternalBounds();
base.OnResize(e);
}
private void lblText_Click(object sender, EventArgs e)
{
if (TextClick != null)
{
TextClick(this, e);
}
}
}
}
</code></pre>
<p>(there are some issues with Stack Overflow's markup and the Underscore, but it's easy to follow the code).</p>
<hr>
<p>I have actually removed that override some time ago when I saw that it wasn't working. I'll add it again now and test. Basically I want to replace the Label with some new label called: IWillNotAutoSizeLabel ;)</p>
<p>I basically hate the autosize property "on by default".</p>
| [
{
"answer_id": 699553,
"author": "ESRogs",
"author_id": 88,
"author_profile": "https://Stackoverflow.com/users/88",
"pm_score": 0,
"selected": false,
"text": "this.AutoSize = false"
},
{
"answer_id": 1651394,
"author": "iard68",
"author_id": 199835,
"author_profile": ... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2684/"
] |
25,224 | <p>I have a postgres database with a user table (userid, firstname, lastname) and a usermetadata table (userid, code, content, created datetime). I store various information about each user in the usermetadata table by code and keep a full history. so for example, a user (userid 15) has the following metadata:</p>
<pre><code>15, 'QHS', '20', '2008-08-24 13:36:33.465567-04'
15, 'QHE', '8', '2008-08-24 12:07:08.660519-04'
15, 'QHS', '21', '2008-08-24 09:44:44.39354-04'
15, 'QHE', '10', '2008-08-24 08:47:57.672058-04'
</code></pre>
<p>I need to fetch a list of all my users and the most recent value of each of various usermetadata codes. I did this programmatically and it was, of course godawful slow. The best I could figure out to do it in SQL was to join sub-selects, which were also slow and I had to do one for each code.</p>
| [
{
"answer_id": 27159,
"author": "Neall",
"author_id": 619,
"author_profile": "https://Stackoverflow.com/users/619",
"pm_score": 2,
"selected": false,
"text": "SELECT DISTINCT ON (code) code, content, createtime\nFROM metatable\nWHERE userid = 15\nORDER BY code, createtime DESC;\n"
},
... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2462/"
] |
25,225 | <p>I have a couple of files containing a value in each line.</p>
<p><strong>EDIT :</strong></p>
<p>I figured out the answer to this question while in the midst of writing the post and didn't realize I had posted it by mistake in its incomplete state.</p>
<p>I was trying to do:</p>
<pre><code>paste -d ',' file1 file2 file 3 file 4 > file5.csv
</code></pre>
<p>and was getting a weird output. I later realized that was happening because some files had both a carriage return and a newline character at the end of the line while others had only the newline character. I got to always remember to pay attention to those things.
</p>
| [
{
"answer_id": 25229,
"author": "sparkes",
"author_id": 269,
"author_profile": "https://Stackoverflow.com/users/269",
"pm_score": 0,
"selected": false,
"text": "cat filetwo >> fileone\n"
},
{
"answer_id": 25231,
"author": "Bjorn Reppen",
"author_id": 1324220,
"author_... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1582/"
] |
25,238 | <blockquote>
<p>What's the best way to make an element of 100% minimum height across a
wide range of browsers ?</p>
</blockquote>
<p>In particular if you have a layout with a <code>header</code> and <code>footer</code> of fixed <code>height</code>,</p>
<p>how do you make the middle content part fill <code>100%</code> of the space in between with the <code>footer</code> fixed to the bottom ?</p>
| [
{
"answer_id": 25249,
"author": "ollifant",
"author_id": 2078,
"author_profile": "https://Stackoverflow.com/users/2078",
"pm_score": 7,
"selected": false,
"text": "html,body {\n margin:0;\n padding:0;\n height:100%; /* needed for container min-height */\n background:gray;\n\n... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1725/"
] |
25,240 | <p>FCKeditor has InsertHtml API (<a href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API" rel="nofollow noreferrer">JavaScript API document</a>) that inserts HTML in the current cursor position. How do I insert at the very end of the document?</p>
<p>Do I need to start browser sniffing with something like this</p>
<pre><code>if ( element.insertAdjacentHTML ) // IE
element.insertAdjacentHTML( 'beforeBegin', html ) ;
else // Gecko
{
var oRange = document.createRange() ;
oRange.setStartBefore( element ) ;
var oFragment = oRange.createContextualFragment( html );
element.parentNode.insertBefore( oFragment, element ) ;
}
</code></pre>
<p>or is there a blessed way that I missed?</p>
<p>Edit: Of course, I can rewrite the whole HTML, as answers suggest, but I cannot believe that is the "blessed" way. That means that the browser should destroy whatever it has and re-parse the document from scratch. That cannot be good. For example, I expect that to break the undo stack.</p>
| [
{
"answer_id": 720544,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "var oEditor = FCKeditorAPI.GetInstance('Editor_instance') ;\n OldText=oEditor.GetXHTML( true );\n\n oEditor.SetData( Old... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2515/"
] |
25,252 | <p>I'm using <a href="http://www.zend.com/en/products/studio/" rel="nofollow noreferrer">Zend Studio</a> to do remote debugging of my php scripts on a dev server. It works great for web code, but can I make it work with command line scripts?</p>
<p>I have several helper apps to make my application run. It would be really useful to fire up the remote debugger through command line instead of a web browser so I can test these out. </p>
<p>I assume it's possible, since I think Zend is using xdebug to talk to Eclipse. Apparently, it adds some parameters to the request to wake the Zend code up on a request. I'm guessing I'd need to tap into that?</p>
<p><em>UPDATE</em></p>
<p>I ended up using xdebug with <a href="http://protoeditor.sourceforge.net/" rel="nofollow noreferrer">protoeditor</a> over X to do my debugging.</p>
| [
{
"answer_id": 3091577,
"author": "Ramon Poca",
"author_id": 117188,
"author_profile": "https://Stackoverflow.com/users/117188",
"pm_score": 0,
"selected": false,
"text": "export QUERY_STRING=start_debug=1&debug_host=<host name or IP of the local machine>&debug_port=<the port that is con... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2506/"
] |
25,259 | <p>What is a good complete <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expression</a> or some other process that would take the title:</p>
<blockquote>
<p>How do you change a title to be part of the URL like Stack Overflow?</p>
</blockquote>
<p>and turn it into </p>
<pre class="lang-none prettyprint-override"><code>how-do-you-change-a-title-to-be-part-of-the-url-like-stack-overflow
</code></pre>
<p>that is used in the SEO-friendly URLs on Stack Overflow?</p>
<p>The development environment I am using is <a href="http://en.wikipedia.org/wiki/Ruby_on_Rails" rel="noreferrer">Ruby on Rails</a>, but if there are some other platform-specific solutions (.NET, PHP, <a href="http://en.wikipedia.org/wiki/Django_%28web_framework%29" rel="noreferrer">Django</a>), I would love to see those too. </p>
<p>I am sure I (or another reader) will come across the same problem on a different platform down the line. </p>
<p>I am using custom routes, and I mainly want to know how to alter the string to all special characters are removed, it's all lowercase, and all whitespace is replaced.</p>
| [
{
"answer_id": 25263,
"author": "Dale Ragan",
"author_id": 1117,
"author_profile": "https://Stackoverflow.com/users/1117",
"pm_score": 4,
"selected": false,
"text": "def permalink_for(str)\n str.gsub(/[^\\w\\/]|[!\\(\\)\\.]+/, ' ').strip.downcase.gsub(/\\ +/, '-')\nend\n"
},
{
... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1632/"
] |
25,268 | <p>Has anybody out there used the <a href="http://www.swig.org/exec.html" rel="noreferrer">SWIG</a> library with C#? If you have, what pitfalls did you find and what is the best way to use the library? I am thinking about using it as a wrapper for a program that was written in C and I want to wrap the header files where I can use them in my .NET application.</p>
Edit: Some clarification on target OS's.
<p>I plan on running the application on Linux and Windows, therefore the reason I am looking into SWIG. P/Invoke is not an option.</p>
| [
{
"answer_id": 1067011,
"author": "Roark Fan",
"author_id": 25362,
"author_profile": "https://Stackoverflow.com/users/25362",
"pm_score": 4,
"selected": true,
"text": "Examples/csharp/class"
},
{
"answer_id": 1070469,
"author": "Marc Bernier",
"author_id": 23569,
"aut... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1117/"
] |
25,269 | <p>I'm having an amazing amount of trouble starting and stopping a service on my remote server from my msbuild script.</p>
<p>SC.EXE and the ServiceController MSBuild task don't provide switches to allow a username/password so they won't authenticate, so I'm using RemoteService.exe from www.intelliadmin.com</p>
<p>-Authenticating with \xx.xx.xx.xxx
-Authentication complete
-Stopping service
-Error: Access Denied</p>
<p>The user account details I'm specifying are for a local admin on the server, so whats up?! I'm tearing my hair out!</p>
<h3>Update:</h3>
<p>OK here's a bit more background. I have an an XP machine in the office running the CI server. The build script connects a VPN to the datacentre, where I have a Server 2008 machine. Neither of them are on a domain.</p>
| [
{
"answer_id": 25326,
"author": "Brad Wilson",
"author_id": 1554,
"author_profile": "https://Stackoverflow.com/users/1554",
"pm_score": 3,
"selected": false,
"text": "C:\\> net use \\\\xx.xx.xx.xx\\ipc$ * /user:username\n"
}
] | 2008/08/24 | [
"https://Stackoverflow.com/questions/25269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086/"
] |
25,277 | <p>There is a <a href="https://web.archive.org/web/20081014140251/http://stackoverflow.uservoice.com:80/pages/general/suggestions/16644" rel="nofollow noreferrer">request</a> to make the SO search default to an AND style functionality over the current OR when multiple terms are used.</p>
<p>The official response was:</p>
<blockquote>
<p>not as simple as it sounds; we use SQL Server 2005's <a href="https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2005/ms176078%28v=sql.90%29" rel="nofollow noreferrer">FREETEXT()</a> function, and I can't find a way to specify AND vs. OR -- can you?</p>
</blockquote>
<p>So, is there a way?</p>
<p>There are a <a href="https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2005/ms142519%28v=sql.90%29" rel="nofollow noreferrer">number of resources</a> on it I can find, but I am not an expert.</p>
| [
{
"answer_id": 25287,
"author": "Martin Marconcini",
"author_id": 2684,
"author_profile": "https://Stackoverflow.com/users/2684",
"pm_score": 2,
"selected": false,
"text": "WHERE FREETEXT('You gotta love MS-SQL') > 0\n AND FREETEXT('You gotta love MySQL too...') > 0\n"
},
{
"ans... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2134/"
] |
25,282 | <p>The point of this question is to collect a list of examples of hashtable implementations using arrays in different languages. It would also be nice if someone could throw in a pretty detailed overview of how they work, and what is happening with each example. </p>
<p><strong>Edit:</strong> </p>
<p>Why not just use the built in hash functions in your specific language? </p>
<p>Because we should know how hash tables work and be able to implement them. This may not seem like a super important topic, but knowing how one of the most used data structures works seems pretty important to me. If this is to become the wikipedia of programming, then these are some of the types of questions that I will come here for. I'm not looking for a CS book to be written here. I could go pull Intro to Algorithms off the shelf and read up on the chapter on hash tables and get that type of info. More specifically what I am looking for are <strong>code examples</strong>. Not only for me in particular, but also for others who would maybe one day be searching for similar info and stumble across this page. </p>
<p>To be more specific: If you <strong>had</strong> to implement them, and could not use built-in functions, how would you do it? </p>
<p>You don't need to put the code here. Put it in pastebin and just link it. </p>
| [
{
"answer_id": 25365,
"author": "SemiColon",
"author_id": 1994,
"author_profile": "https://Stackoverflow.com/users/1994",
"pm_score": 4,
"selected": false,
"text": "int ComputeHash(char* key)\n{\n int hash = 5381;\n while (*key)\n hash = ((hash << 5) + hash) + *(key++);\n ret... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1797/"
] |
25,297 | <p>I would like to use <code>as</code> and <code>is</code> as members of an enumeration. I know that this is possible in VB.NET to write it like this:</p>
<pre><code>Public Enum Test
[as] = 1
[is] = 2
End Enum
</code></pre>
<p>How do I write the equivalent statement in C#?
The following code does not compile:</p>
<pre><code>public enum Test
{
as = 1,
is = 2
}
</code></pre>
| [
{
"answer_id": 25300,
"author": "Brad Wilson",
"author_id": 1554,
"author_profile": "https://Stackoverflow.com/users/1554",
"pm_score": 6,
"selected": true,
"text": "public enum Test\n{\n @as = 1,\n @is = 2\n}\n"
}
] | 2008/08/24 | [
"https://Stackoverflow.com/questions/25297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717/"
] |
25,349 | <p>I have a string that has some Environment.Newline in it. I'd like to strip those from the string and instead, replace the Newline with something like a comma. </p>
<p>What would be, in your opinion, the best way to do this using C#.NET 2.0?</p>
| [
{
"answer_id": 25350,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 0,
"selected": false,
"text": "string.Replace"
},
{
"answer_id": 25351,
"author": "Bjorn Reppen",
"author_id": 1324220,
"author_p... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2684/"
] |
25,376 | <p>I've read that Lambda Expressions are an incredibly powerful addition to C#, yet I find myself mystified by them. How can they improve my life or make my code better? Can anyone point to a good resource for learning such expressions?</p>
<p>They seem cool as hell, but how do they relate to my day-to-day life as an asp.net developer?</p>
<p>Edit: Thanks for the examples, and thanks for the link to Eric White's articles. I'm still digesting those now. One quick question: are lambda expressions useful for anything other than querying? Every example I've seen has been a query construct.</p>
| [
{
"answer_id": 25385,
"author": "Brian Leahy",
"author_id": 580,
"author_profile": "https://Stackoverflow.com/users/580",
"pm_score": 3,
"selected": false,
"text": "List<int> myInts = GetAll();\nIEnumerable<int> evenNumbers = myInts.Where(x => x % 2 == 0);\n"
},
{
"answer_id": 25... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2757/"
] |
25,396 | <p>I'm working on a website built with pure HTML and CSS, and I need a way to restrict access to pages located within particular directories within the site. The solution I came up with was, of course, ASP.NET Forms Authorization. I created the default Visual Studio log in form and set up the users, roles, and access restrictions with Visual Studio's wizard. The problem is, I can't log in to the website with the credentials that I have set.</p>
<p>I'm using IIS 7.
</p>
| [
{
"answer_id": 25451,
"author": "Steve",
"author_id": 1857,
"author_profile": "https://Stackoverflow.com/users/1857",
"pm_score": 0,
"selected": false,
"text": "<authentication mode=\"Forms\" />\n"
},
{
"answer_id": 872068,
"author": "Brad Crandell",
"author_id": 97949,
... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1857/"
] |
25,449 | <p>I want to create a Java program that can be extended with plugins. How can I do that and where should I look for?</p>
<p>I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow.</p>
<hr>
<p>Although I do like Eclipse RCP, I think it's too much for my simple needs.</p>
<p>Same thing goes for Spring, but since I was going to look at it anyway, I might as well try it.</p>
<p>But still, I'd prefer to find a way to create my own plugin "framework" as simple as possible.</p>
| [
{
"answer_id": 25492,
"author": "Steve M",
"author_id": 1693,
"author_profile": "https://Stackoverflow.com/users/1693",
"pm_score": 7,
"selected": true,
"text": "File dir = new File(\"put path to classes you want to load here\");\nURL loadPath = dir.toURI().toURL();\nURL[] classUrl = new... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
25,450 | <p>Many frameworks seek to abstract away from HTML (custom tags, JSFs component system) in an effort to make dealing with that particular kettle of fish easier.</p>
<p>Is there anything you folks have used that has a similar concept applied to CSS? Something that does a bunch of cross-browser magic for you, supports like variables (why do I have to type #3c5c8d every time I want that colour), supports calculated fields (which are 'compiled' into CSS and JS), etc.</p>
<p>Alternatively, am I even thinking about this correctly? Am I trying to push a very square block through a very round hole? </p>
| [
{
"answer_id": 25467,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stackoverflow.com/users/486",
"pm_score": 4,
"selected": true,
"text": "template engine"
},
{
"answer_id": 25534,
"author": "Kevin",
"author_id": 40,
"author_profile": "https://Stacko... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
25,455 | <p>While plenty of solutions exist for entering dates (such as calendars, drop-down menus, etc.), it doesn't seem like there are too many "standard" ways to ask for a time (or time range).</p>
<p>I've personally tried drop-down menus for the hour, minute, and second fields (and sometimes an "AM/PM" field, as well). I've also tried several clock-like input devices, most of which are too hard to use for the typical end-user. I've even tried "pop-out" time selection menus (which allow you to, for example, hover over the hour "10" to receive a sub-menu that contains ":00",":15",":30", and ":45") -- but none of these methods seem natural.</p>
<p>So far, the best (and most universal) method I have found is just using simple text fields and forcing a user to manually populate the hour, minute, and second. Alternatively, I've had good experiences creating something similar to Outlook's "Day View" which allows you to drag and drop an event to set the start and end times.</p>
<p>Is there a "best way" to ask for this information? Is anybody using some type of time input widget that's really intuitive and easy to use? Or is there at least a way that's more efficient than using plain text boxes?
</p>
| [
{
"answer_id": 25467,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stackoverflow.com/users/486",
"pm_score": 4,
"selected": true,
"text": "template engine"
},
{
"answer_id": 25534,
"author": "Kevin",
"author_id": 40,
"author_profile": "https://Stacko... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1581/"
] |
25,458 | <p>I constantly hear how bad reflection is to use. While I generally avoid reflection and rarely find situations where it is impossible to solve my problem without it, I was wondering... </p>
<p>For those who have used reflection in applications, have you measured performance hits and, is it really so bad?</p>
| [
{
"answer_id": 25472,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 2,
"selected": false,
"text": "FillObject"
},
{
"answer_id": 4440657,
"author": "grenade",
"author_id": 68115,
"author_profile": "https://S... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
25,461 | <p>In a project I am interfacing between C++ and a C library that uses stdbool.h defined as such.</p>
<pre><code>#ifndef _STDBOOL_H
#define _STDBOOL_H
/* C99 Boolean types for compilers without C99 support */
/* http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */
#if !defined(__cplusplus)
#if !defined(__GNUC__)
/* _Bool builtin type is included in GCC */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
#endif
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif
#endif
</code></pre>
<p>Some structures have <code>bool</code> members. So if I have one of these structures defined as local variables within a C++ function and pass it to a C function the sizes are inconsistent between C++ and C as bool is one bye in C++ and 4 in C.</p>
<p>Does anyone have any advice to how to overcome this without resorting to my current solution which is</p>
<pre><code>//#define bool _Bool
#define bool unsigned char
</code></pre>
<p>Which is against the C99 standard for <a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/stdbool.h.html" rel="noreferrer">stdbool.h</a></p>
| [
{
"answer_id": 25658,
"author": "Josh",
"author_id": 257,
"author_profile": "https://Stackoverflow.com/users/257",
"pm_score": 0,
"selected": false,
"text": "union boolean {\n bool value_cpp;\n int value_c;\n}; \n"
},
{
"answer_id": 29300,
"author": "JProgrammer",
"a... | 2008/08/24 | [
"https://Stackoverflow.com/questions/25461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1675/"
] |
25,481 | <p>I'm trying to call an Antlr task in my Ant build.xml as follows:</p>
<pre><code><path id="classpath.build">
<fileset dir="${dir.lib.build}" includes="**/*.jar" />
</path>
...
<target name="generate-lexer" depends="init">
<antlr target="${file.antlr.lexer}">
<classpath refid="classpath.build"/>
</antlr>
</target>
</code></pre>
<p>But Ant can't find the task definition. I've put all of the following in that <code>dir.lib.build</code>:</p>
<ul>
<li>antlr-3.1.jar</li>
<li>antlr-2.7.7.jar</li>
<li>antlr-runtime-3.1.jar</li>
<li>stringtemplate-3.2.jar</li>
</ul>
<p>But none of those seems to have the task definition. (I've also tried putting those jars in my Ant classpath; same problem.)</p>
| [
{
"answer_id": 4515467,
"author": "Terence Parr",
"author_id": 275496,
"author_profile": "https://Stackoverflow.com/users/275496",
"pm_score": 2,
"selected": false,
"text": "<path id=\"classpath\">\n <pathelement location=\"${antlr3.jar}\"/>\n <pathelement location=\"${ant-antlr3.j... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] |
25,499 | <p>I'm using Visual C++ 2005 and would like to know the simplest way to connect to a MS SQL Server and execute a query.</p>
<p>I'm looking for something as simple as ADO.NET's SqlCommand class with it's ExecuteNonQuery(), ExecuteScalar() and ExecuteReader().</p>
<p>Sigh offered an answer using CDatabase and ODBC.</p>
<p>Can anybody demonstrate how it would be done using ATL consumer templates for OleDb?</p>
<p>Also what about returning a scalar value from the query?</p>
| [
{
"answer_id": 25544,
"author": "Sigh",
"author_id": 1866,
"author_profile": "https://Stackoverflow.com/users/1866",
"pm_score": 2,
"selected": false,
"text": "CDatabase db(ODBCConnectionString);\ndb.Open();\ndb.ExecuteSQL(blah);\ndb.Close();\n"
},
{
"answer_id": 154431,
"aut... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2768/"
] |
25,532 | <p>What would be the Master Pages equivalent in the Java web development world? I've heard of Tiles, Tapestry and Velocity but don't know anything about them. Are they as easy to use as Master Pages? </p>
<p>I want something as easy as set up one template and subsequent pages derive from the template and override content regions, similar to Master Pages.</p>
<p>Any examples would be great!!</p>
| [
{
"answer_id": 33270,
"author": "tonygambone",
"author_id": 3344,
"author_profile": "https://Stackoverflow.com/users/3344",
"pm_score": 4,
"selected": false,
"text": "<ui:insert/>"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2572/"
] |
25,552 | <p>I'm currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows.</p>
<p>Has anyone been able to successfully extract information such as the current disk space used, CPU utilisation and memory used in the underlying OS? What about just what the Java app itself is consuming?</p>
<p>Preferrably I'd like to get this information without using JNI.</p>
| [
{
"answer_id": 25596,
"author": "William Brendel",
"author_id": 2405,
"author_profile": "https://Stackoverflow.com/users/2405",
"pm_score": 9,
"selected": true,
"text": "public class Main {\n public static void main(String[] args) {\n /* Total number of processors or cores available ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693/"
] |
25,561 | <p>I am attempting to parse a string like the following using a .NET regular expression:</p>
<pre><code>H3Y5NC8E-TGA5B6SB-2NVAQ4E0
</code></pre>
<p>and return the following using Split:
H3Y5NC8E
TGA5B6SB
2NVAQ4E0</p>
<p>I validate each character against a specific character set (note that the letters 'I', 'O', 'U' & 'W' are absent), so using string.Split is not an option. The number of characters in each group can vary and the number of groups can also vary. I am using the following expression:</p>
<pre><code>([ABCDEFGHJKLMNPQRSTVXYZ0123456789]{8}-?){3}
</code></pre>
<p>This will match exactly 3 groups of 8 characters each. Any more or less will fail the match.
This works insofar as it correctly matches the input. However, when I use the Split method to extract each character group, I just get the final group. RegexBuddy complains that I have repeated the capturing group itself and that I should put a capture group around the repeated group. However, none of my attempts to do this achieve the desired result. I have been trying expressions like this:</p>
<pre><code>(([ABCDEFGHJKLMNPQRSTVXYZ0123456789]{8})-?){4}
</code></pre>
<p>But this does not work.</p>
<p>Since I generate the regex in code, I could just expand it out by the number of groups, but I was hoping for a more elegant solution. </p>
<hr>
<p>Please note that the character set does not include the entire alphabet. It is part of a product activation system. As such, any characters that can be accidentally interpreted as numbers or other characters are removed. e.g. The letters 'I', 'O', 'U' & 'W' are not in the character set.</p>
<p>The hyphens are optional since a user does not need top type them in, but they can be there if the user as done a copy & paste.</p>
| [
{
"answer_id": 25569,
"author": "Mark Glorie",
"author_id": 952,
"author_profile": "https://Stackoverflow.com/users/952",
"pm_score": 0,
"selected": false,
"text": "Dim stringArray As Array = someString.Split(\"-\")\n"
},
{
"answer_id": 25591,
"author": "aku",
"author_id"... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2754/"
] |
25,566 | <p>I wrote an O(n!) sort for my amusement that can't be trivially optimized to run faster without replacing it entirely. [And no, I didn't just randomize the items until they were sorted]. </p>
<p>How might I write an even worse Big-O sort, without just adding extraneous junk that could be pulled out to reduce the time complexity?</p>
<p><a href="http://en.wikipedia.org/wiki/Big_O_notation#Orders_of_common_functions" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Big_O_notation</a> has various time complexities sorted in growing order.</p>
<p>Edit: I found the code, here is my O(n!) deterministic sort with amusing hack to generate list of all combinations of a list. I have a slightly longer version of get_all_combinations that returns an iterable of combinations, but unfortunately I couldn't make it a single statement. [Hopefully I haven't introduced bugs by fixing typos and removing underscores in the below code]</p>
<pre><code>def mysort(somelist):
for permutation in get_all_permutations(somelist):
if is_sorted(permutation):
return permutation
def is_sorted(somelist):
# note: this could be merged into return... something like return len(foo) <= 1 or reduce(barf)
if (len(somelist) <= 1): return True
return 1 > reduce(lambda x,y: max(x,y),map(cmp, somelist[:-1], somelist[1:]))
def get_all_permutations(lst):
return [[itm] + cbo for idx, itm in enumerate(lst) for cbo in get_all_permutations(lst[:idx] + lst[idx+1:])] or [lst]
</code></pre>
| [
{
"answer_id": 25605,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": 2,
"selected": false,
"text": "def never_sort(array)\n while(true)\n end\n return quicksort(array)\nend\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2775/"
] |
25,637 | <p>Is there a way to shutdown a computer using a built-in Java method?</p>
| [
{
"answer_id": 25644,
"author": "David McGraw",
"author_id": 568,
"author_profile": "https://Stackoverflow.com/users/568",
"pm_score": 8,
"selected": true,
"text": "public static void main(String arg[]) throws IOException{\n Runtime runtime = Runtime.getRuntime();\n Process proc = ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2598/"
] |
25,642 | <p>I want to catch the NavigationService.Navigating event from my Page, to prevent the user from navigating forward. I have an event handler defined thusly:</p>
<pre><code>void PreventForwardNavigation(object sender, NavigatingCancelEventArgs e)
{
if (e.NavigationMode == NavigationMode.Forward)
{
e.Cancel = true;
}
}
</code></pre>
<p>... and that works fine. However, I am unsure exactly where to place this code:</p>
<pre><code>NavigationService.Navigating += PreventForwardNavigation;
</code></pre>
<p>If I place it in the constructor of the page, or the Initialized event handler, then NavigationService is still null and I get a NullReferenceException. However, if I place it in the Loaded event handler for the Page, then it is called every time the page is navigated to. If I understand right, that means I'm handling the same event multiple times. </p>
<p>Am I ok to add the same handler to the event multiple times (as would happen were I to use the page's Loaded event to hook it up)? If not, is there some place in between Initialized and Loaded where I can do this wiring?</p>
| [
{
"answer_id": 25644,
"author": "David McGraw",
"author_id": 568,
"author_profile": "https://Stackoverflow.com/users/568",
"pm_score": 8,
"selected": true,
"text": "public static void main(String arg[]) throws IOException{\n Runtime runtime = Runtime.getRuntime();\n Process proc = ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615/"
] |
25,646 | <p>The following code writes no data to the back buffer on Intel integrated video cards,for example, on a MacBook. On ATI cards, such as in the iMac, it draws to the back buffer. The width and height are correct (and 800x600 buffer) and m_PixelBuffer is correctly filled with 0xAA00AA00.</p>
<p>My best guess so far is that there is something amiss with needing glWindowPos set. I do not currently set it (or the raster position), and when I get GL_CURRENT_RASTER_POSITION I noticed that the default on the ATI card is 0,0,0,0 and the Intel it's 0,0,0,1. When I set the raster pos on the ATI card to 0,0,0,1 I get the same result as the Intel card, nothing drawn to the back buffer. Is there some transform state I'm missing? This is a 2D application so the view transform is a very simple glOrtho.</p>
<pre><code>glDrawPixels(GetBufferWidth(), GetBufferHeight(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, m_PixelBuffer);
</code></pre>
<p>Any more info I can provide, please ask. I'm pretty much an OpenGL and Mac newb so I don't know if I'm providing enough information.</p>
| [
{
"answer_id": 154444,
"author": "Adrian",
"author_id": 23624,
"author_profile": "https://Stackoverflow.com/users/23624",
"pm_score": 1,
"selected": false,
"text": "GLint valid;\nglGet(GL_CURRENT_RASTER_POSITION_VALID, &valid);\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1329401/"
] |
25,652 | <p>I want to programatically create an NSTextView. How can I determine the correct frame height so that the view displays one line of text in the current default font?</p>
| [
{
"answer_id": 90694,
"author": "Ken",
"author_id": 17320,
"author_profile": "https://Stackoverflow.com/users/17320",
"pm_score": 2,
"selected": false,
"text": "[textField setFont:myFont];\n[textField sizeToFit];\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2140/"
] |
25,653 | <p>Is there any way to apply an attribute to a model file in ASP.NET Dynamic Data to hide the column?</p>
<p>For instance, I can currently set the display name of a column like this:</p>
<pre><code>[DisplayName("Last name")]
public object Last_name { get; set; }
</code></pre>
<p>Is there a similar way to hide a column?</p>
<p><strong>Edit</strong>: Many thanks to Christian Hagelid for going the extra mile and giving a spot-on answer :-)</p>
| [
{
"answer_id": 25667,
"author": "Christian Hagelid",
"author_id": 202,
"author_profile": "https://Stackoverflow.com/users/202",
"pm_score": 5,
"selected": true,
"text": "[ScaffoldColumn(false)]\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364/"
] |
25,665 | <p>Is there any python module to convert PDF files into text? I tried <a href="http://code.activestate.com/recipes/511465/" rel="noreferrer">one piece of code</a> found in Activestate which uses pypdf but the text generated had no space between and was of no use. </p>
| [
{
"answer_id": 48154,
"author": "Tony Meyer",
"author_id": 4966,
"author_profile": "https://Stackoverflow.com/users/4966",
"pm_score": 6,
"selected": false,
"text": "import pyPdf\npdf = pyPdf.PdfFileReader(open(filename, \"rb\"))\nfor page in pdf.pages:\n print page.extractText()\n"
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448/"
] |
25,672 | <p>Been going over my predecessor's code and see usage of the "request" scope frequently. What is the appropriate usage of this scope?</p>
| [
{
"answer_id": 26725,
"author": "Adam Tuttle",
"author_id": 751,
"author_profile": "https://Stackoverflow.com/users/751",
"pm_score": 5,
"selected": true,
"text": "<cfif not structKeyExists(application, \"dsn\")>\n <cflock scope=\"application\" type=\"exclusive\" timeout=\"30\">\n ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
25,746 | <p>I'm learning objective-C and Cocoa and have come across this statement:</p>
<blockquote>
<p>The Cocoa frameworks expect that global string constants rather than string literals are used for dictionary keys, notification and exception names, and some method parameters that take strings.</p>
</blockquote>
<p>I've only worked in higher level languages so have never had to consider the details of strings that much. What's the difference between a string constant and string literal?</p>
| [
{
"answer_id": 25750,
"author": "Brad Wilson",
"author_id": 1554,
"author_profile": "https://Stackoverflow.com/users/1554",
"pm_score": 2,
"selected": false,
"text": "const std::string mystring = \"my string\";\n"
},
{
"answer_id": 25798,
"author": "Chris Hanson",
"author... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2799/"
] |
25,749 | <p>I'm learning objective-c and keep bumping into the @ symbol. It is used in different scenarios, for example at the start of a string or to synthesise accessor methods. </p>
<p>What's does the @ symbol mean in objective-c?</p>
| [
{
"answer_id": 25784,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 8,
"selected": true,
"text": "@"
},
{
"answer_id": 9107765,
"author": "pabloelustondo",
"author_id": 1173878,
"author_profile": "http... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2799/"
] |
25,752 | <p>In a drop down list, I need to add spaces in front of the options in the list. I am trying</p>
<pre><code><select>
<option>&#32;&#32;Sample</option>
</select>
</code></pre>
<p>for adding two spaces but it displays no spaces. How can I add spaces before option texts?</p>
| [
{
"answer_id": 25754,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": 2,
"selected": false,
"text": " \n"
},
{
"answer_id": 25758,
"author": "Rob Cooper",
"author_id": 832,
"author_profile": "https://Sta... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] |
25,765 | <p>I'm in the process of weeding out all hardcoded values in a Java library and was wondering what framework would be the best (in terms of zero- or close-to-zero configuration) to handle run-time configuration? I would prefer XML-based configuration files, but it's not essential. </p>
<p>Please do only reply if you have practical experience with a framework. I'm not looking for examples, but experience...</p>
| [
{
"answer_id": 25819,
"author": "Anders Sandvig",
"author_id": 1709,
"author_profile": "https://Stackoverflow.com/users/1709",
"pm_score": 2,
"selected": false,
"text": "java.util.Properties"
},
{
"answer_id": 34397,
"author": "John Meagher",
"author_id": 3535,
"autho... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448983/"
] |
25,767 | <p>What is the quickest way to get a large amount of data (think golf) and the most efficient (think performance) to get a large amount of data from a MySQL database to a session without having to continue doing what I already have:</p>
<pre><code>$sql = "SELECT * FROM users WHERE username='" . mysql_escape_string($_POST['username']) . "' AND password='" . mysql_escape_string(md5($_POST['password'])) . "'";
$result = mysql_query($sql, $link) or die("There was an error while trying to get your information.\n<!--\n" . mysql_error($link) . "\n-->");
if(mysql_num_rows($result) < 1)
{
$_SESSION['username'] = $_POST['username'];
redirect('index.php?p=signup');
}
$_SESSION['id'] = mysql_result($result, '0', 'id');
$_SESSION['fName'] = mysql_result($result, '0', 'fName');
$_SESSION['lName'] = mysql_result($result, '0', 'lName');
...
</code></pre>
<p>And before anyone asks yes I do really need to 'SELECT </p>
<p>Edit: Yes, I am sanitizing the data, so that there can be no SQL injection, that is further up in the code.</p>
| [
{
"answer_id": 25776,
"author": "Marius",
"author_id": 1585,
"author_profile": "https://Stackoverflow.com/users/1585",
"pm_score": 0,
"selected": false,
"text": "$_SESSION['data'] = json_encode(mysql_fetch_array($result));\n"
},
{
"answer_id": 25782,
"author": "Anders Sandvig... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] |
25,771 | <p>How can I insert compilation timestamp information into an executable I build with Visual C++ 2005? I want to be able to output something like this when I execute the program:</p>
<blockquote>
<p>This build XXXX was compiled at dd-mm-yy, hh:mm.</p>
</blockquote>
<p>where date and time reflect the time when the project was built. They should not change with each successive call of the program, unless it's recompiled.</p>
| [
{
"answer_id": 25780,
"author": "sparkes",
"author_id": 269,
"author_profile": "https://Stackoverflow.com/users/269",
"pm_score": 3,
"selected": false,
"text": "__DATE__ \n__TIME__\n"
},
{
"answer_id": 25802,
"author": "Eric Scrivner",
"author_id": 2594,
"author_profi... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
25,785 | <p>Is there a simple way, in a pretty standard UNIX environment with bash, to run a command to delete all but the most recent X files from a directory?</p>
<p>To give a bit more of a concrete example, imagine some cron job writing out a file (say, a log file or a tar-ed up backup) to a directory every hour. I'd like a way to have another cron job running which would remove the oldest files in that directory until there are less than, say, 5.</p>
<p>And just to be clear, there's only one file present, it should never be deleted.</p>
| [
{
"answer_id": 25789,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 7,
"selected": false,
"text": "rm `ls -t | awk 'NR>5'`\n"
},
{
"answer_id": 25790,
"author": "thelsdj",
"author_id": 163,
"author_profile":... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] |
25,794 | <p>Without local access to the server, is there any way to duplicate/clone a MySQL db (with content and without content) into another without using <code>mysqldump</code>?</p>
<p>I am currently using MySQL 4.0.</p>
| [
{
"answer_id": 26091,
"author": "Gary Richardson",
"author_id": 2506,
"author_profile": "https://Stackoverflow.com/users/2506",
"pm_score": 7,
"selected": false,
"text": "CREATE TABLE x LIKE y;\n"
},
{
"answer_id": 1995186,
"author": "jozjan",
"author_id": 1843623,
"a... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/211/"
] |
25,803 | <p>For a given class I would like to have tracing functionality i.e. I would like to log every method call (method signature and actual parameter values) and every method exit (just the method signature). </p>
<p>How do I accomplish this assuming that: </p>
<ul>
<li>I don't want to use any 3rd party
AOP libraries for C#,</li>
<li>I don't want to add duplicate code to all the methods that I want to trace, </li>
<li>I don't want to change the public API of the class - users of the class should be able to call all the methods in exactly the same way. </li>
</ul>
<p>To make the question more concrete let's assume there are 3 classes: </p>
<pre><code> public class Caller
{
public static void Call()
{
Traced traced = new Traced();
traced.Method1();
traced.Method2();
}
}
public class Traced
{
public void Method1(String name, Int32 value) { }
public void Method2(Object object) { }
}
public class Logger
{
public static void LogStart(MethodInfo method, Object[] parameterValues);
public static void LogEnd(MethodInfo method);
}
</code></pre>
<p>How do I invoke <em>Logger.LogStart</em> and <em>Logger.LogEnd</em> for every call to <em>Method1</em> and <em>Method2</em> without modifying the <em>Caller.Call</em> method and without adding the calls explicitly to <em>Traced.Method1</em> and <em>Traced.Method2</em>?</p>
<p>Edit: What would be the solution if I'm allowed to slightly change the Call method?</p>
| [
{
"answer_id": 25808,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 1,
"selected": false,
"text": "LogStart"
},
{
"answer_id": 25810,
"author": "Steen",
"author_id": 1448983,
"author_profile": "htt... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2800/"
] |
25,807 | <p>If I have Python code</p>
<pre><code>class A():
pass
class B():
pass
class C(A, B):
pass
</code></pre>
<p>and I have class <code>C</code>, is there a way to iterate through it's super classed (<code>A</code> and <code>B</code>)? Something like pseudocode:</p>
<pre><code>>>> magicGetSuperClasses(C)
(<type 'A'>, <type 'B'>)
</code></pre>
<p>One solution seems to be <a href="http://docs.python.org/lib/module-inspect.html" rel="noreferrer">inspect module</a> and <code>getclasstree</code> function.</p>
<pre><code>def magicGetSuperClasses(cls):
return [o[0] for o in inspect.getclasstree([cls]) if type(o[0]) == type]
</code></pre>
<p>but is this a "Pythonian" way to achieve the goal?</p>
| [
{
"answer_id": 25815,
"author": "John",
"author_id": 2168,
"author_profile": "https://Stackoverflow.com/users/2168",
"pm_score": 6,
"selected": true,
"text": "C.__bases__"
},
{
"answer_id": 35111,
"author": "cdleary",
"author_id": 3594,
"author_profile": "https://Stac... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2679/"
] |
25,841 | <p>How do you get the maximum number of bytes that can be passed to a <code>sendto(..)</code> call for a socket opened as a UDP port?</p>
| [
{
"answer_id": 25853,
"author": "Kristof Provost",
"author_id": 1466,
"author_profile": "https://Stackoverflow.com/users/1466",
"pm_score": 2,
"selected": false,
"text": "SO_MAX_MSG_SIZE"
},
{
"answer_id": 25976,
"author": "diciu",
"author_id": 2811,
"author_profile":... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/842/"
] |
25,846 | <p>I know that MAC OS X 10.5 comes with Apache installed but I would like to install the latest Apache without touching the OS Defaults incase it causes problems in the future with other udpates. So I have used the details located at: <a href="http://diymacserver.com/installing-apache/compiling-apache-on-leopard/" rel="nofollow noreferrer">http://diymacserver.com/installing-apache/compiling-apache-on-leopard/</a> But I'm unsure how to make this the 64 Bit version of Apache as it seems to still install the 32 bit version.</p>
<p>Any help is appreciated</p>
<p>Cheers</p>
| [
{
"answer_id": 25851,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 2,
"selected": false,
"text": "export CFLAGS=\"-arch x86_64\"\n"
},
{
"answer_id": 25854,
"author": "Brian Warshaw",
"author_id": 1344,
"au... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2196/"
] |
25,865 | <p>My good friend, Wikipedia, <a href="http://en.wikipedia.org/wiki/Language_binding" rel="noreferrer">didn't give me a very good response</a> to that question. So:</p>
<ul>
<li>What are language bindings?</li>
<li>How do they work?</li>
</ul>
<p>Specifically accessing functions from code written in language X of a library written in language Y.</p>
| [
{
"answer_id": 25868,
"author": "Matt MacLean",
"author_id": 22,
"author_profile": "https://Stackoverflow.com/users/22",
"pm_score": -1,
"selected": false,
"text": "<mx:TextInput id=\"LNameInput\"></mx:TextInput>\n...\n<mx:Label text=\"{LNameInput.text}\"></mx:Label>\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/416/"
] |
25,871 | <p>We created several custom web parts for SharePoint 2007. They work fine. However whenever they are loaded, we get an error in the event log saying:</p>
<blockquote>
<p>error initializing safe control - Assembly: ...</p>
</blockquote>
<p>The assembly actually loads fine. Additionally, it is correctly listed in the <code>web.config</code> and <code>GAC</code>.</p>
<p>Any ideas about how to stop these (Phantom?) errors would be appreciated.
</p>
| [
{
"answer_id": 25882,
"author": "Daniel Pollard",
"author_id": 2758,
"author_profile": "https://Stackoverflow.com/users/2758",
"pm_score": 2,
"selected": false,
"text": "<SafeControls>\n <SafeControl\n Assembly = \"Text\"\n Namespace = \"Text\"\n Safe = \"TRUE\" | \"FALSE\"\n ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
25,914 | <p>I'm trying to setup CruiseControl.net webdashboard at the moment. So far it works nice, but I have a problem with the NAnt Build Timing Report.</p>
<p>Firstly, my current <code>ccnet.config</code> file looks something like this:</p>
<pre><code><project name="bla">
...
<prebuild>
<nant .../>
</prebuild>
<tasks>
<nant .../>
</tasks>
<publishers>
<nant .../>
</publishers>
...
</project>
</code></pre>
<p>As the build completes, NAnt timing report displays three duplicate summaries. Is there a way to fix this without changing the project structure?
</p>
| [
{
"answer_id": 392610,
"author": "cordis",
"author_id": 1085,
"author_profile": "https://Stackoverflow.com/users/1085",
"pm_score": 2,
"selected": false,
"text": "<buildresults>"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1085/"
] |
25,952 | <p>Back when I was at school, I remember tinkering with a Mac game where you programmed little robots in a sort of pseudo-assembler language which could then battle each other. They could move themselves around the arena, look for opponents in different directions, and fire some sort of weapon. Pretty basic stuff, but I remember it quite fondly, even if I can't remember the name.</p>
<p>Are there any good modern day equivalents?</p>
| [
{
"answer_id": 25959,
"author": "Pascal Paradis",
"author_id": 1291,
"author_profile": "https://Stackoverflow.com/users/1291",
"pm_score": 5,
"selected": false,
"text": " public class MyFirstRobot extends Robot {\n public void run() {\n while (true) {\n ahead(100)... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] |
25,969 | <p>I am trying to <code>INSERT INTO</code> a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the <code>SQL</code> engine of the day (<a href="http://en.wikipedia.org/wiki/MySQL" rel="noreferrer">MySQL</a>, <a href="http://en.wikipedia.org/wiki/Oracle_Database" rel="noreferrer">Oracle</a>, <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" rel="noreferrer">SQL Server</a>, <a href="http://en.wikipedia.org/wiki/IBM_Informix" rel="noreferrer">Informix</a>, and <a href="http://en.wikipedia.org/wiki/IBM_DB2" rel="noreferrer">DB2</a>).</p>
<p>Is there a silver-bullet syntax coming from an SQL standard (for example, <a href="http://en.wikipedia.org/wiki/SQL-92" rel="noreferrer">SQL-92</a>) that would allow me to insert the values without worrying about the underlying database?</p>
| [
{
"answer_id": 25971,
"author": "Claude Houle",
"author_id": 244,
"author_profile": "https://Stackoverflow.com/users/244",
"pm_score": 12,
"selected": true,
"text": "INSERT INTO table1 ( column1 )\nSELECT col1\nFROM table2 \n"
},
{
"answer_id": 26080,
"author": "travis",... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244/"
] |
25,975 | <p>The Compact Framework doesn't support Assembly.GetEntryAssembly to determine the launching .exe. So is there another way to get the name of the executing .exe?</p>
<p>EDIT: I found the answer on Peter Foot's blog: <a href="http://peterfoot.net/default.aspx" rel="nofollow noreferrer">http://peterfoot.net/default.aspx</a>
Here is the code:</p>
<pre><code>byte[] buffer = new byte[MAX_PATH * 2];
int chars = GetModuleFileName(IntPtr.Zero, buffer, MAX_PATH);
if (chars > 0)
{
string assemblyPath = System.Text.Encoding.Unicode.GetString(buffer, 0, chars * 2);
}
[DllImport("coredll.dll", SetLastError = true)]
private static extern int GetModuleFileName(IntPtr hModule, byte[] lpFilename, int nSize);
</code></pre>
| [
{
"answer_id": 117572,
"author": "Martin Liesén",
"author_id": 20715,
"author_profile": "https://Stackoverflow.com/users/20715",
"pm_score": 1,
"selected": false,
"text": "string exefile = Assembly.GetExecutingAssembly().GetName().CodeBase;\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/25975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1382/"
] |
25,977 | <p>I would like to compare a screenshot of one application (could be a Web page) with a previously taken screenshot to determine whether the application is displaying itself correctly. I don't want an exact match comparison, because the aspect could be slightly different (in the case of a Web app, depending on the browser, some element could be at a slightly different location). It should give a measure of how similar are the screenshots.</p>
<p>Is there a library / tool that already does that? How would you implement it?</p>
| [
{
"answer_id": 6801185,
"author": "Shachar",
"author_id": 859398,
"author_profile": "https://Stackoverflow.com/users/859398",
"pm_score": 4,
"selected": false,
"text": "O(n^2)"
},
{
"answer_id": 42481370,
"author": "cpwah",
"author_id": 7396273,
"author_profile": "htt... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2680/"
] |
25,982 | <p>Given that my client code knows everything it needs to about the remoting object, what's the simplest way to connect to it?</p>
<p>This is what I'm doing at the moment:</p>
<pre><code>ChannelServices.RegisterChannel(new HttpChannel(), false);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(IRemoteServer), "RemoteServer.rem", WellKnownObjectMode.Singleton);
MyServerObject = (IRemoteServer)Activator.GetObject(
typeof(IRemoteServer),
String.Format("tcp://{0}:{1}/RemoteServer.rem", server, port));
</code></pre>
| [
{
"answer_id": 27450,
"author": "Ishmaeel",
"author_id": 227,
"author_profile": "https://Stackoverflow.com/users/227",
"pm_score": 2,
"selected": true,
"text": "//obtain another marshalbyref object of the type ISessionManager:\nISessionManager = MyServerObject.GetSessionManager();\n"
}... | 2008/08/25 | [
"https://Stackoverflow.com/questions/25982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2373/"
] |
26,002 | <p>I want our team to develop against local instances of an Oracle database. With MS SQL, I can use SQL Express Edition. What are my options?</p>
| [
{
"answer_id": 38346,
"author": "morais",
"author_id": 2846,
"author_profile": "https://Stackoverflow.com/users/2846",
"pm_score": 3,
"selected": false,
"text": "ALTER SYSTEM SET PROCESSES=150 SCOPE=SPFILE;\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2676/"
] |
26,007 | <p>Is there an easy way to iterate over an associative array of this structure in PHP:</p>
<p>The array <code>$searches</code> has a numbered index, with between 4 and 5 associative parts. So I not only need to iterate over <code>$searches[0]</code> through <code>$searches[n]</code>, but also <code>$searches[0]["part0"]</code> through <code>$searches[n]["partn"]</code>. The hard part is that different indexes have different numbers of parts (some might be missing one or two).</p>
<p>Thoughts on doing this in a way that's nice, neat, and understandable?</p>
| [
{
"answer_id": 26013,
"author": "Re0sless",
"author_id": 2098,
"author_profile": "https://Stackoverflow.com/users/2098",
"pm_score": 3,
"selected": false,
"text": "/* foreach example 4: multi-dimensional arrays */\n$a = array();\n$a[0][0] = \"a\";\n$a[0][1] = \"b\";\n$a[1][0] = \"y\";\n$... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.