qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
15,979 | <p>I use solr to search for documents and when trying to search for documents using this query "<code>id:*</code>", I get this query parser exception telling that it cannot parse the query with * or ? as the first character. </p>
<pre><code>HTTP Status 400 - org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery
type Status report
message org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery
description The request sent by the client was syntactically incorrect (org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*': '*' or '?' not allowed as first character in WildcardQuery).
</code></pre>
<p>Is there any patch for getting this to work with just * ? Or is it very costly to do such a query?</p>
| [
{
"answer_id": 17458,
"author": "cnu",
"author_id": 1448,
"author_profile": "https://Stackoverflow.com/users/1448",
"pm_score": 1,
"selected": false,
"text": "id:A*"
},
{
"answer_id": 23554,
"author": "dlamblin",
"author_id": 459,
"author_profile": "https://Stackoverf... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448/"
] |
15,995 | <p>Does anyone here have any useful code which uses reduce() function in python? Is there any code other than the usual + and * that we see in the examples?</p>
<p>Refer <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=98196" rel="noreferrer">Fate of reduce() in Python 3000</a> by GvR</p>
| [
{
"answer_id": 16049,
"author": "Brendan",
"author_id": 199,
"author_profile": "https://Stackoverflow.com/users/199",
"pm_score": 2,
"selected": false,
"text": "reduce()"
},
{
"answer_id": 16091,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448/"
] |
16,007 | <p>Basically I have some code to check a specific directory to see if an image is there and if so I want to assign a URL to the image to an ImageControl.</p>
<pre><code>if (System.IO.Directory.Exists(photosLocation))
{
string[] files = System.IO.Directory.GetFiles(photosLocation, "*.jpg");
if (files.Length > 0)
{
// TODO: return the url of the first file found;
}
}
</code></pre>
| [
{
"answer_id": 16032,
"author": "Robin Robinson",
"author_id": 1629,
"author_profile": "https://Stackoverflow.com/users/1629",
"pm_score": -1,
"selected": false,
"text": "string url = Request.ApplicationPath + \"/\" + photosLocation + \"/\" + files[0];\n"
},
{
"answer_id": 16039,... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1762/"
] |
16,067 | <p>I have been mulling over writing a peak-fitting library for a while. I know Python fairly well and plan on implementing everything in Python to begin with but envisage that I may have to re-implement some core routines in a compiled language eventually.</p>
<p>IIRC, one of Python's original remits was as a prototyping language, however Python is pretty liberal in allowing functions, functors, objects to be passed to functions and methods, whereas I suspect the same is not true of say C or Fortran.</p>
<p>What should I know about designing functions/classes which I envisage will have to interface into the compiled language? And how much of these potential problems are dealt with by libraries such as cTypes, bgen, <a href="http://www.swig.org/" rel="nofollow noreferrer">SWIG</a>, <a href="http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html" rel="nofollow noreferrer">Boost.Python</a>, <a href="http://cython.org/" rel="nofollow noreferrer">Cython</a> or <a href="http://www.riverbankcomputing.co.uk/software/sip/intro" rel="nofollow noreferrer">Python SIP</a>?</p>
<p>For this particular use case (a fitting library), I imagine allowing users to define mathematical functions (Guassian, Lorentzian etc.) as Python functions which can then to be passed an interpreted by the compiled code fitting library. Passing and returning arrays is also essential.</p>
| [
{
"answer_id": 28467,
"author": "Moe",
"author_id": 3051,
"author_profile": "https://Stackoverflow.com/users/3051",
"pm_score": 3,
"selected": false,
"text": "Image* unary(boost::python::object op, Image& im)\n{\n Image* out = new Image(im.width(), im.height(), im.channels());\n fo... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/199/"
] |
16,074 | <p>Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may not even need open. I have searched through the settings and cannot find anything to stop this behavior. </p>
| [
{
"answer_id": 16251,
"author": "travis",
"author_id": 1414,
"author_profile": "https://Stackoverflow.com/users/1414",
"pm_score": 3,
"selected": false,
"text": "Options > Environment > Keyboard"
},
{
"answer_id": 57848,
"author": "Ryan Lundy",
"author_id": 5486,
"aut... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749/"
] |
16,096 | <p>In WPF, how would I apply multiple styles to a <code>FrameworkElement</code>? For instance, I have a control which already has a style. I also have a separate style which I would like to add to it without blowing away the first one. The styles have different TargetTypes, so I can't just extend one with the other.</p>
| [
{
"answer_id": 16108,
"author": "Arcturus",
"author_id": 900,
"author_profile": "https://Stackoverflow.com/users/900",
"pm_score": 5,
"selected": false,
"text": "<Style TargetType=\"TextBlock\">\n <Setter Property=\"Margin\" Value=\"3\" />\n</Style>\n\n<Style x:Key=\"AlwaysVerticalS... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93/"
] |
16,097 | <p>Here is the scenario that I have. I have a cvs repository in one location (A) and I want to replicate it and keep it in sync with a repository in another location(B). This would be a single directional sync from A to B. What is the best way to do this? If it is not really feasible in CVS then which source code control system would you recommend to accomplish this? Thanks</p>
| [
{
"answer_id": 16101,
"author": "Vincent Robert",
"author_id": 268,
"author_profile": "https://Stackoverflow.com/users/268",
"pm_score": 3,
"selected": true,
"text": "rsync"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1353/"
] |
16,100 | <p>What's the best way to convert a string to an enumeration value in C#?</p>
<p>I have an HTML select tag containing the values of an enumeration. When the page is posted, I want to pick up the value (which will be in the form of a string) and convert it to the corresponding enumeration value.</p>
<p>In an ideal world, I could do something like this:</p>
<pre><code>StatusEnum MyStatus = StatusEnum.Parse("Active");
</code></pre>
<p>but that isn't a valid code.</p>
| [
{
"answer_id": 16103,
"author": "DavidWhitney",
"author_id": 1297,
"author_profile": "https://Stackoverflow.com/users/1297",
"pm_score": 7,
"selected": false,
"text": "SomeEnum enum = (SomeEnum)Enum.Parse(typeof(SomeEnum), \"EnumValue\");\n"
},
{
"answer_id": 16104,
"author":... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203/"
] |
16,110 | <p>I have a user that want to be able to select a textbox and have the current text selected so that he doesn't have to highlight it all in order to change the contents. </p>
<p>The contents need to be handle when enter is pushed. That part I think I have figured out but any suggestions would be welcome. </p>
<p>The part I need help with is that once enter has been pushed, any entry into the textbox should clear the contents again.</p>
<p><strong>Edit:</strong> The textbox controls an piece of RF hardware. What the user wants to be able to do is enter a setting and press enter. The setting is sent to the hardware. Without doing anything else the user wants to be able to type in a new setting and press enter again.</p>
| [
{
"answer_id": 16130,
"author": "Greg Hurlman",
"author_id": 35,
"author_profile": "https://Stackoverflow.com/users/35",
"pm_score": 3,
"selected": true,
"text": "TextBox1.Select(0, TextBox1.Text.Length);\n"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1629/"
] |
16,113 | <p>Can I get some recommendations (preferably with some reasons) for good log analysis software for Apache 2.2 access log files?</p>
<p>I have heard of <a href="http://www.webalizer.org/" rel="noreferrer">Webalizer</a> and <a href="http://awstats.sourceforge.net/" rel="noreferrer">AWStats</a>, but have never really used any of them, and would like to know:</p>
<ul>
<li>What they can do</li>
<li>Why they are useful</li>
<li>Interesting uses for them</li>
</ul>
<p>Any and all comments and thoughts are welcome.</p>
| [
{
"answer_id": 677965,
"author": "cdonner",
"author_id": 58880,
"author_profile": "https://Stackoverflow.com/users/58880",
"pm_score": 2,
"selected": false,
"text": " Google Woopra Awstats\nSunday, March 1, 2009 10 11 69\nMonday, March 2, ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] |
16,142 | <p>I've seen these words a lot around Subversion (and I guess general repository) discussions.<br>
I have been using <strong>SVN</strong> for my projects for the last few years, but I've never grasped the complete concept of these directories.</p>
<p>What do they mean?</p>
| [
{
"answer_id": 16151,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 5,
"selected": false,
"text": "branch"
},
{
"answer_id": 16203,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stac... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/914/"
] |
16,155 | <p><strong>Is there a way in PHP to overwrite a method declared by one interface in an interface extending that interface?</strong></p>
<p>The Example:</p>
<p>I'm probably doing something wrong, but here is what I have:</p>
<pre><code>interface iVendor{
public function __construct($vendors_no = null);
public function getName();
public function getVendors_no();
public function getZip();
public function getCountryCode();
public function setName($name);
public function setVendors_no($vendors_no);
public function setZip($zip);
public function setCountryCode($countryCode);
}
interface iShipper extends iVendor{
public function __construct($vendors_no = null, $shipment = null);
public function getTransitTime($shipment = null);
public function getTransitCost($shipment = null);
public function getCurrentShipment();
public function setCurrentShipment($shipment);
public function getStatus($shipment = null);
}
</code></pre>
<p>Normally in PHP, when you extend something, you can overwrite any method contained therein (right?). However, when one interface extends another, it won't let you. Unless I'm thinking about this wrong... When I implement the iShipper interface, I don't have to make the Shipper object extend the Vendor object (that implements the iVendor interface). I just say:</p>
<pre><code>class FedEx implements iShipper{}
</code></pre>
<p>and make FedEx implement all of the methods from iVendor and iShipper. However, I need the <code>__construct</code> functions in iVendor and iShipper to be unique. I know I could take out the <code>$shipment = null</code>, but then it wouldn't be as convenient to create Shippers (by just passing in the vendors_no and the shipment while instantiating).</p>
<p>Anyone know how to make this work? My fallback is to have to set the shipment by calling <code>$shipper->setShipment($shipment);</code> on the Shipper after I instantiate it, but I'm hoping for a way to get around having to do that...</p>
<p><em>A little more explanation for the curious:</em><br>
<em>The FedEx Object has methods that go to the FedEx site (using cURL) and gets an estimate for the Shipment in question. I have a UPS Object, a BAXGlobal Object, a Conway Object, etc. Each one has COMPLETELY different methods for actually getting the shipping estimate, but all the system needs to know is that they are a "shipper" and that the methods listed in the interface are callable on them (so it can treat them all exactly the same, and loop through them in a "shippers" array calling <code>getTransitX()</code> to find the best shipper for a shipment).</em> </p>
<p><em>Each "Shipper" is also a "Vendor" though, and is treated as such in other parts of the system (getting and putting in the DB, etc. Our data design is a pile of crap, so FedEx is stored right alongside companies like Dunder Mifflin in the "Vendors" table, which means it gets to have all the properties of every other Vendor, but needs the extra properties and methods supplied by iShipper).</em></p>
| [
{
"answer_id": 16245,
"author": "Ryan Ahearn",
"author_id": 75,
"author_profile": "https://Stackoverflow.com/users/75",
"pm_score": 4,
"selected": true,
"text": "interface iVendor{\n public function getName();\n public function getVendors_no();\n public function getZip();\n p... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58/"
] |
16,178 | <p>I need to programatically determine whether .NET 3.5 is installed. I thought it would be easy:</p>
<pre><code><% Response.Write(Environment.Version.ToString()); %>
</code></pre>
<p>Which returns "2.0.50727.1434" so no such luck...</p>
<p>In my research I have that there are some rather obscure registry keys I can look at but I'm not sure if that is the route to go. Does anyone have any suggestions?</p>
| [
{
"answer_id": 16187,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": false,
"text": "System.Web.Extensions\n"
},
{
"answer_id": 16202,
"author": "sestocker",
"author_id": 285,
"author_profi... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285/"
] |
16,233 | <p>The collection of fonts available to a web developer is depressingly limited. I remember reading long ago about TrueDoc, as a way of shipping fonts alongside a website - but it seems to have languished. Has anybody used this, or something similar? Is it supported by enough browsers? Am I missing a good solution?</p>
<p>Note that a responsible web developer does not use fonts that are only available on Windows (and <em>especially</em> ones that are only available on Vista), nor do they use a technology that isn't supported by at least the majority of browsers.</p>
<hr>
<p><strong>Update:</strong> As several people have pointed out, there's nothing wrong with providing a list of fallback fonts for people who don't have the specific font you use. I do in fact always do this, and didn't mean to suggest that this was wrong.</p>
<p>While my question was badly phrased, what I meant was that a designer should not make too many assumptions about what the client will have available. You should plan for how all users will see your site, not just for people using your own preferred setup.</p>
| [
{
"answer_id": 16247,
"author": "Sven Hecht",
"author_id": 1168,
"author_profile": "https://Stackoverflow.com/users/1168",
"pm_score": 1,
"selected": false,
"text": "@font-face {\n font-family: Garamond;\n src: url(garamond.eot), url(garamond.pfr);\n}\n"
},
{
"answer_id": 1... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1000/"
] |
16,248 | <p>I'd like to implement a way of recording the version of a project within code, so that it can be used when testing and to help track bugs.
It seems the best version number to use would just be the current revision number from Subversion. Is there an easy way to hook this number into a (C++ in my case) header file or something, which I can then get at in code? I guess this is a post commit hook or something?</p>
<p>Does anyone have any experience of implementing this (with code to share, please?), or can suggest a better alternative?
Thanks.</p>
| [
{
"answer_id": 16264,
"author": "Vincent Robert",
"author_id": 268,
"author_profile": "https://Stackoverflow.com/users/268",
"pm_score": 3,
"selected": false,
"text": "svn:keywords"
},
{
"answer_id": 16276,
"author": "jmanning2k",
"author_id": 1480,
"author_profile": ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169/"
] |
16,265 | <p>I'm working with LINQ for the first time and wanted to get the Mapping to work when I have a money type in SQL, but my domain object property is of type double. How can I express this in the XML file, or in code so that the mapping does not throw the usual "invalid cast" exception?</p>
| [
{
"answer_id": 16335,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": true,
"text": " <Column Name=\"Table1.Amount\" DbType=\"smallint\" Type=\"System.Int32\" \n Expression=\"CAST(Table1.Amount as in... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
16,298 | <p>I have 2 hosts and I would like to point a subdomain on host one to a subdomain on host two:</p>
<pre><code>subdomain.hostone.com --> subdomain.hosttwo.com
</code></pre>
<p>I added a CNAME record to host one that points to subdomain.hosttwo.com but all I get is a '<strong>400 Bad Request</strong>' Error.</p>
<p>Can anyone see what I'm doing wrong?</p>
| [
{
"answer_id": 16311,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 5,
"selected": true,
"text": "CNAME"
},
{
"answer_id": 16630,
"author": "Brian G Swanson",
"author_id": 1795,
"author_profile": "ht... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/117/"
] |
16,306 | <p>What would be the easiest way to separate the directory name from the file name when dealing with <code>SaveFileDialog.FileName</code> in C#?</p>
| [
{
"answer_id": 16313,
"author": "rjzii",
"author_id": 1185,
"author_profile": "https://Stackoverflow.com/users/1185",
"pm_score": 0,
"selected": false,
"text": "string filename = dialog.Filename;\nstring path = filename.Substring(0, filename.LastIndexOf(\"\\\"));\nstring file = filename.... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41/"
] |
16,320 | <p>I've seen projects where the classes in the DB layer have just static functions in them and other projects where those classes need to be instantiated to get access to the member functions. </p>
<blockquote>
<p>Which is "better" and why?</p>
</blockquote>
| [
{
"answer_id": 16342,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 1,
"selected": false,
"text": "DbController acrhive = new DbController(\"dev\");\nDbController prod = new DbController(\"prod\");\n"
},
{
"answer_id": ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
16,330 | <p>If you had to provide a wizard like form entry experience in mvc how would you abstract the page flow?</p>
| [
{
"answer_id": 41878,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 0,
"selected": false,
"text": "public class CreateAccountWizardController : Controller\n{\n public ActionRresult Step1()\n {\n }\n\n\n public ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] |
16,340 | <p>Say I have an object that stores a byte array and I want to be able to efficiently generate a hashcode for it. I've used the cryptographic hash functions for this in the past because they are easy to implement, but they are doing a lot more work than they should to be cryptographically oneway, and I don't care about that (I'm just using the hashcode as a key into a hashtable).</p>
<p>Here's what I have today:</p>
<pre><code>struct SomeData : IEquatable<SomeData>
{
private readonly byte[] data;
public SomeData(byte[] data)
{
if (null == data || data.Length <= 0)
{
throw new ArgumentException("data");
}
this.data = new byte[data.Length];
Array.Copy(data, this.data, data.Length);
}
public override bool Equals(object obj)
{
return obj is SomeData && Equals((SomeData)obj);
}
public bool Equals(SomeData other)
{
if (other.data.Length != data.Length)
{
return false;
}
for (int i = 0; i < data.Length; ++i)
{
if (data[i] != other.data[i])
{
return false;
}
}
return true;
}
public override int GetHashCode()
{
return BitConverter.ToInt32(new MD5CryptoServiceProvider().ComputeHash(data), 0);
}
}
</code></pre>
<p>Any thoughts?</p>
<hr>
<p>dp: You are right that I missed a check in Equals, I have updated it. Using the existing hashcode from the byte array will result in reference equality (or at least that same concept translated to hashcodes).
for example:</p>
<pre><code>byte[] b1 = new byte[] { 1 };
byte[] b2 = new byte[] { 1 };
int h1 = b1.GetHashCode();
int h2 = b2.GetHashCode();
</code></pre>
<p>With that code, despite the two byte arrays having the same values within them, they are referring to different parts of memory and will result in (probably) different hash codes. I need the hash codes for two byte arrays with the same contents to be equal.</p>
| [
{
"answer_id": 16381,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 6,
"selected": false,
"text": "Equals"
},
{
"answer_id": 425184,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackove... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1948/"
] |
16,363 | <p>Starting with 2005, VS started this behavior of when starting debugging session it spawns up a webserver for every project in a solution. I have a solution with 15 projects so it takes a while and is a waste of resources. Is there a way to configure it differently besides just using IIS?</p>
| [
{
"answer_id": 5235353,
"author": "EBarr",
"author_id": 215068,
"author_profile": "https://Stackoverflow.com/users/215068",
"pm_score": 2,
"selected": false,
"text": "Always Start When Debugging"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1940/"
] |
16,402 | <p>I have a bunch of files that I need to be able to <em>transport</em> and <em>install</em> quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome.</p>
<p>My idea for a solution would be to write up a quick script to move files around that I could just click on. I've done some <strong><em>bash</em></strong> scripting before but <strong><em>batch</em></strong> scripting is a little odd to me. Does anyone have a good online reference guide I could use?</p>
<p>An alternative soulution I could accept would be a program that makes an installer for you, though I'm a bit against that as I would lose a lot of control. However, I'd be alright with it if it was extremely simple,</p>
| [
{
"answer_id": 16416,
"author": "Martin",
"author_id": 770,
"author_profile": "https://Stackoverflow.com/users/770",
"pm_score": 3,
"selected": true,
"text": "robocopy"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/652/"
] |
16,413 | <p>Problem: I have an address field from an Access database which has been converted to SQL Server 2005. This field has everything all in one field. I need to parse out the address's individual sections into their appropriate fields in a normalized table. I need to do this for approximately 4,000 records, and it needs to be repeatable.</p>
<p>Assumptions:</p>
<ol>
<li><p>Assume an address in the US (for now)</p>
</li>
<li><p>assume that the input string will sometimes contain an addressee (the person being addressed) and/or a second street address (i.e. Suite B)</p>
</li>
<li><p>states may be abbreviated</p>
</li>
<li><p>zip code could be standard 5 digits or zip+4</p>
</li>
<li><p>there are typos in some instances</p>
</li>
</ol>
<p>UPDATE: In response to the questions posed, standards were not universally followed; I need need to store the individual values, not just geocode and errors means typo (corrected above)</p>
<p>Sample Data:</p>
<ul>
<li><p>A. P. Croll & Son 2299 Lewes-Georgetown Hwy, Georgetown, DE 19947</p>
</li>
<li><p>11522 Shawnee Road, Greenwood DE 19950</p>
</li>
<li><p>144 Kings Highway, S.W. Dover, DE 19901</p>
</li>
<li><p>Intergrated Const. Services 2 Penns Way Suite 405 New Castle, DE 19720</p>
</li>
<li><p>Humes Realty 33 Bridle Ridge Court, Lewes, DE 19958</p>
</li>
<li><p>Nichols Excavation 2742 Pulaski Hwy Newark, DE 19711</p>
</li>
<li><p>2284 Bryn Zion Road, Smyrna, DE 19904</p>
</li>
<li><p>VEI Dover Crossroads, LLC 1500 Serpentine Road, Suite 100 Baltimore MD 21</p>
</li>
<li><p>580 North Dupont Highway Dover, DE 19901</p>
</li>
<li><p>P.O. Box 778 Dover, DE 19903</p>
</li>
</ul>
| [
{
"answer_id": 16819,
"author": "Rob Allen",
"author_id": 149,
"author_profile": "https://Stackoverflow.com/users/149",
"pm_score": 4,
"selected": false,
"text": "Public Function parseAddress(ByVal input As String) As Collection\n input = input.Replace(\",\", \"\")\n input = input.... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149/"
] |
16,432 | <p>Let's say that you want to output or concat strings. Which of the following styles do you prefer?</p>
<ul>
<li><p><code>var p = new { FirstName = "Bill", LastName = "Gates" };</code></p></li>
<li><p><code>Console.WriteLine("{0} {1}", p.FirstName, p.LastName);</code></p></li>
<li><p><code>Console.WriteLine(p.FirstName + " " + p.LastName);</code></p></li>
</ul>
<p>Do you rather use format or do you simply concat strings? What is your favorite? Is one of these hurting your eyes?</p>
<p>Do you have any rational arguments to use one and not the other?</p>
<p>I'd go for the second one.</p>
| [
{
"answer_id": 16449,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 3,
"selected": false,
"text": "Console.Write"
},
{
"answer_id": 16452,
"author": "Mike",
"author_id": 1573,
"author_profile": "https:/... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/920/"
] |
16,443 | <p>Is it possible (in Vb.Net 2005), without manually parsing the dataset table properties, to create the table and add it to the database?</p>
<p>We have old versions of our program on some machines, which obviously has our old database, and we are looking for a way to detect if there is a missing table and then generate the table based on the current status of the table in the dataset. We were re-scripting the table every time we released a new version (if new columns were added) but we would like to avoid this step if possible.</p>
| [
{
"answer_id": 16840,
"author": "Yaakov Ellis",
"author_id": 51,
"author_profile": "https://Stackoverflow.com/users/51",
"pm_score": 3,
"selected": false,
"text": "SqlCommand.ExecuteNonQuery()"
},
{
"answer_id": 13625295,
"author": "Prahalad Gaggar",
"author_id": 1841054,... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1936/"
] |
16,447 | <p>I am trying to generate a report by querying 2 databases (Sybase) in classic ASP.</p>
<p>I have created 2 connection strings:<br></p>
<blockquote>
<p>connA for databaseA<br>
connB for databaseB</p>
</blockquote>
<p>Both databases are present on the same server (don't know if this matters)<br></p>
<p>Queries:</p>
<p><code>q1 = SELECT column1 INTO #temp FROM databaseA..table1 WHERE xyz="A"</code></p>
<p><code>q2 = SELECT columnA,columnB,...,columnZ FROM table2 a #temp b WHERE b.column1=a.columnB</code></p>
<p>followed by:</p>
<pre><code>response.Write(rstsql) <br>
set rstSQL = CreateObject("ADODB.Recordset")<br>
rstSQL.Open q1, connA<br>
rstSQL.Open q2, connB
</code></pre>
<p>When I try to open up this page in a browser, I get error message:</p>
<blockquote>
<p>Microsoft OLE DB Provider for ODBC Drivers error '80040e37'</p>
<p>[DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]#temp not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).</p>
</blockquote>
<p>Could anyone please help me understand what the problem is and help me fix it?</p>
<p>Thanks.</p>
| [
{
"answer_id": 16474,
"author": "Forgotten Semicolon",
"author_id": 1960,
"author_profile": "https://Stackoverflow.com/users/1960",
"pm_score": 2,
"selected": false,
"text": "\nSELECT a.columnA, a.columnB,..., a.columnZ\nFROM table2 a\nINNER JOIN (SELECT databaseA..table1.column1 \n ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311/"
] |
16,451 | <p>I need to call a web service written in .NET from Java. The web service implements the WS-Security stack (either WSE 2 or WSE 3, it's not clear from the information I have). </p>
<p>The information that I received from the service provider included WSDL, a policyCache.config file, some sample C# code, and a sample application that can successfully call the service.</p>
<p>This isn't as useful as it sounds because it's not clear how I'm supposed to use this information to write a Java client. If the web service request isn't signed according to the policy then it is rejected by the service. I'm trying to use Apache Axis2 and I can't find any instructions on how I'm supposed to use the policyCahce.config file and the WSDL to generate a client.</p>
<p>There are several examples that I have found on the Web but in all cases the authors of the examples had control of both the service and the client and so were able to make tweaks on both sides in order to get it to work. I'm not in that position.</p>
<p>Has anyone done this successfully?</p>
| [
{
"answer_id": 16979,
"author": "ScArcher2",
"author_id": 1310,
"author_profile": "https://Stackoverflow.com/users/1310",
"pm_score": 2,
"selected": false,
"text": "import java.io.IOException;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.security.auth.callback.Callba... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1958/"
] |
16,458 | <p>I'm using <code>ColdFusion</code> to return a result set from a SQL database and turn it into a list.</p>
<p>I need some way to generate an alphabetical navigation bar for that list. I have ColdFusion and the jQuery library available.</p>
<p>I'm looking to generate something like this:</p>
<pre><code>A | B | C | ...
- A
- A
- B
- B
- B
- C
- D
</code></pre>
<p>Where clicking on one of the letters drops you down the page to the first item for that letter. Not all 26 letters of the alphabet are necessarily in use.</p>
| [
{
"answer_id": 16555,
"author": "Patrick McElhaney",
"author_id": 437,
"author_profile": "https://Stackoverflow.com/users/437",
"pm_score": 3,
"selected": false,
"text": "<cfoutput>\n<cfloop from=\"#asc('A')#\" to=\"#asc('Z')#\" index=\"i\">\n <a href=\"###chr(i)#\">#chr(i)#</a>\n ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/666/"
] |
16,460 | <p>I was writing some <strong>ASP.NET</strong> control when I came to the scenario where I needed to remove items from a list, only when they matched a certain condition.</p>
<p>The <code>RemoveAll</code> method of the generic <code>List</code> class does a good job, but removes <em>all</em> items that match the condition, specified by the predicate.</p>
<p>What if I want to only remove a certain number of items specifying the condition? What do you think is the best way to do this?</p>
| [
{
"answer_id": 16466,
"author": "Serhat Ozgel",
"author_id": 31505,
"author_profile": "https://Stackoverflow.com/users/31505",
"pm_score": 1,
"selected": false,
"text": "list.RemoveAll(item => ShouldIRemoveThis(item));\n"
},
{
"answer_id": 16493,
"author": "Adam Wright",
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1801/"
] |
16,473 | <p>Say we have the following method:</p>
<pre><code>private MyObject foo = new MyObject();
// and later in the class
public void PotentialMemoryLeaker(){
int firedCount = 0;
foo.AnEvent += (o,e) => { firedCount++;Console.Write(firedCount);};
foo.MethodThatFiresAnEvent();
}
</code></pre>
<p>If the class with this method is instantiated and the <code>PotentialMemoryLeaker</code> method is called multiple times, do we leak memory?</p>
<p>Is there any way to unhook that lambda event handler after we're done calling <code>MethodThatFiresAnEvent</code>? </p>
| [
{
"answer_id": 16484,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 5,
"selected": true,
"text": "DelegateType evt = (o, e) => { firedCount++; Console.Write(firedCount); };\nfoo.AnEvent += evt;\nfoo.MethodThatFiresAnE... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
16,487 | <p>I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on other forums suggesting that the only approach is to write a Wagon specifically for SourceForge.</p>
<p>Has anybody had any recent experience with this?</p>
| [
{
"answer_id": 1449595,
"author": "Rich Seller",
"author_id": 123582,
"author_profile": "https://Stackoverflow.com/users/123582",
"pm_score": 4,
"selected": true,
"text": "SourceForge username: foo\nSourceForge user password: secret\nSourceForge project name: bar\nPath: /home/frs/project... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1969/"
] |
16,491 | <p>How do you restore a database backup using SQL Server 2005 over the network? I recall doing this before but there was something odd about the way you had to do it.</p>
| [
{
"answer_id": 10236311,
"author": "RSOLY777",
"author_id": 1345056,
"author_profile": "https://Stackoverflow.com/users/1345056",
"pm_score": 3,
"selected": false,
"text": "SQL services"
},
{
"answer_id": 14894743,
"author": "coussej",
"author_id": 1682515,
"author_pr... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1545/"
] |
16,501 | <p>For a person without a comp-sci background, what is a lambda in the world of Computer Science?</p>
| [
{
"answer_id": 16504,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 6,
"selected": false,
"text": "λ : λ → λ"
},
{
"answer_id": 16509,
"author": "mk.",
"author_id": 1797,
"author_profile": "https://St... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1344/"
] |
16,529 | <p>I've been developing a "Form Builder" in Javascript, and coming up to the part where I'll be sending the spec for the form back to the server to be stored. The builder maintains an internal data structure that represents the fields, label, options (for select/checkbox/radio), mandatory status, and the general sorting order of the fields.</p>
<p>When I want to send this structure back to the server, which format should I communicate it with?</p>
<p>Also, when restoring a server-saved form back into my Javascript builder, should I load in the data in the same format it sent it with, or should I rebuild the fields using the builder's <code>createField()</code> functions?</p>
| [
{
"answer_id": 16535,
"author": "juan",
"author_id": 1782,
"author_profile": "https://Stackoverflow.com/users/1782",
"pm_score": 0,
"selected": false,
"text": "text serialization"
},
{
"answer_id": 16547,
"author": "t3rse",
"author_id": 64,
"author_profile": "https://... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1951/"
] |
16,550 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/476163">NAnt or MSBuild, which one to choose and when?</a> </p>
</blockquote>
<p>What is the best build tool for <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a>?</p>
<p>I currently use <a href="http://en.wikipedia.org/wiki/NAnt" rel="nofollow noreferrer">NAnt</a> but only because I have experience with <a href="http://en.wikipedia.org/wiki/Apache_Ant" rel="nofollow noreferrer">Ant</a>. Is <a href="http://en.wikipedia.org/wiki/MSBuild" rel="nofollow noreferrer">MSBuild</a> preferred?</p>
| [
{
"answer_id": 17316,
"author": "Lee",
"author_id": 1954,
"author_profile": "https://Stackoverflow.com/users/1954",
"pm_score": 3,
"selected": false,
"text": "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" DefaultTargets=\"Build\">\n <UsingTask AssemblyFile=\"$(M... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1464/"
] |
16,557 | <p>I have always thought that the .equals() method in java should be overridden to be made specific to the class you have created. In other words to look for equivalence of two different instances rather than two references to the same instance. However I have encountered other programmers who seem to think that the default object behavior should be left alone and a new method created for testing equivalence of two objects of the same class. </p>
<p>What are the argument for and against overriding the equals method?</p>
| [
{
"answer_id": 16574,
"author": "Michael Sharek",
"author_id": 1958,
"author_profile": "https://Stackoverflow.com/users/1958",
"pm_score": 0,
"selected": false,
"text": "equals()"
},
{
"answer_id": 16922,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile"... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1104/"
] |
16,563 | <p>So I'm working on a project that will allow users to enter <strong>poker hand histories</strong> from sites like PokerStars and then display the hand to them.</p>
<p>It seems that regex would be a great tool for this, however I rank my regex knowledge at "slim to none".</p>
<p>So I'm using PHP and looping through this block of text line by line and on lines like this:</p>
<pre><code>Seat 1: fabulous29 (835 in chips)
Seat 2: Nioreh_21 (6465 in chips)
Seat 3: Big Loads (3465 in chips)
Seat 4: Sauchie (2060 in chips)
</code></pre>
<p>I want to extract seat <code>number, name, & chip count</code> so the format is</p>
<pre><code>Seat [number]: [letters&numbers&characters] ([number] in chips)
</code></pre>
<p>I have NO IDEA where to start or what commands I should even be using to optimize this.</p>
<p>Any advice is greatly appreciated - even if it is just a link to a tutorial on PHP regex or the name of the command(s) I should be using.</p>
| [
{
"answer_id": 16583,
"author": "Brian Warshaw",
"author_id": 1344,
"author_profile": "https://Stackoverflow.com/users/1344",
"pm_score": 2,
"selected": false,
"text": "/Seat (\\d+): ([^ ]+) \\((\\d+)/\n"
},
{
"answer_id": 16592,
"author": "Kibbee",
"author_id": 1862,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428190/"
] |
16,568 | <p>I'm interested in learning some (ideally) database agnostic ways of selecting the <em>n</em>th row from a database table. It would also be interesting to see how this can be achieved using the native functionality of the following databases: </p>
<ul>
<li>SQL Server</li>
<li>MySQL</li>
<li>PostgreSQL</li>
<li>SQLite</li>
<li>Oracle</li>
</ul>
<p>I am currently doing something like the following in SQL Server 2005, but I'd be interested in seeing other's more agnostic approaches:</p>
<pre><code>WITH Ordered AS (
SELECT ROW_NUMBER() OVER (ORDER BY OrderID) AS RowNumber, OrderID, OrderDate
FROM Orders)
SELECT *
FROM Ordered
WHERE RowNumber = 1000000
</code></pre>
<p>Credit for the above SQL: <a href="https://web.archive.org/web/20101103031717/http://weblogs.asp.net/Firoz/archive/2005/06/12/411949.aspx" rel="noreferrer">Firoz Ansari's Weblog</a></p>
<p><strong>Update:</strong> See <a href="https://stackoverflow.com/questions/16568/how-to-select-the-nth-row-in-a-sql-database-table#42765">Troels Arvin's answer</a> regarding the SQL standard. <em>Troels, have you got any links we can cite?</em></p>
| [
{
"answer_id": 16570,
"author": "Andrew G. Johnson",
"author_id": 428190,
"author_profile": "https://Stackoverflow.com/users/428190",
"pm_score": 2,
"selected": false,
"text": "LIMIT n,1\n"
},
{
"answer_id": 16584,
"author": "Greg Hurlman",
"author_id": 35,
"author_pr... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1944/"
] |
16,610 | <p>Every now and then in a high volume .NET application, you might see this exception when you try to execute a query:</p>
<blockquote>
<p>System.Data.SqlClient.SqlException: A transport-level error has
occurred when sending the request to the server.</p>
</blockquote>
<p>According to my research, this is something that "just happens" and not much can be done to prevent it. It does not happen as a result of a bad query, and generally cannot be duplicated. It just crops up maybe once every few days in a busy OLTP system when the TCP connection to the database goes bad for some reason.</p>
<p>I am forced to detect this error by parsing the exception message, and then retrying the entire operation from scratch, to include using a new connection. None of that is pretty.</p>
<p>Anybody have any alternate solutions?</p>
| [
{
"answer_id": 156388,
"author": "Daniel Fortunov",
"author_id": 5975,
"author_profile": "https://Stackoverflow.com/users/5975",
"pm_score": 2,
"selected": false,
"text": "Number"
},
{
"answer_id": 22389658,
"author": "Phillip Deneka",
"author_id": 1721229,
"author_pr... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] |
16,615 | <p>I'm new to windows programming and I'm trying to get notified of all changes to the file system (similar to the information that FileMon from SysInternals displays, but via an API). Is a FindFirstChangeNotification for each (non-network, non-substed) drive my best bet or are there other more suitable C/C++ APIs?</p>
| [
{
"answer_id": 22910,
"author": "Mat Noguchi",
"author_id": 1799,
"author_profile": "https://Stackoverflow.com/users/1799",
"pm_score": 6,
"selected": true,
"text": "FindFirstChangeNotification"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1849/"
] |
16,616 | <p>In .NET, is it more appropriate to throw an argument null exception for an Integer if the value is Integer.MinValue or Integer = 0 (assuming that 0 is not a valid value)?</p>
| [
{
"answer_id": 16627,
"author": "bradtgmurray",
"author_id": 1546,
"author_profile": "https://Stackoverflow.com/users/1546",
"pm_score": 0,
"selected": false,
"text": "ArgumentNullException"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1989/"
] |
16,634 | <p>We used the "undocumented" xp_fileexist stored procedure for years in SQL Server 2000 and had no trouble with it. In 2005, it seems that they modified the behavior slightly to always return a 0 if the executing user account is not a sysadmin. It also seems to return a zero if the SQL Server service is running under the LocalSystem account and you are trying to check a file on the network. </p>
<p>I'd like to get away from xp_fileexist. Does anyone have a better way to check for the existence of a file at a network location from inside of a stored procedure?</p>
| [
{
"answer_id": 18000,
"author": "Paul G",
"author_id": 162,
"author_profile": "https://Stackoverflow.com/users/162",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Data;\nusing System.Data.SqlClient;\nusing System.Data.SqlTypes;\nusing Microsoft.SqlServer.Server;\... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162/"
] |
16,638 | <p>I am having some trouble with the <a href="http://code.google.com/apis/maps/documentation/reference.html" rel="nofollow noreferrer">Google Maps API</a>. I have an array which holds a ojbect I created to store points.</p>
<p>My array and class:</p>
<pre><code>var tPoints = [];
function tPoint(name) {
var id = name;
var points = [];
var pointsCount = 0;
...
this.getHeadPoint = function() { return points[pointsCount-1]; }
}
</code></pre>
<p>tPoint holds an array of <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLng" rel="nofollow noreferrer">GLatLng</a> points. I want to write a function to return a <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds" rel="nofollow noreferrer">GLatLngBounds</a> object which is extended from the current map bounds to show all the HeadPoints.</p>
<p>Heres what I have so far..</p>
<pre><code>function getBounds() {
var mBound = map.getBounds();
for (var i = 0; i < tPoints.length; i++) {
alert(mBound.getSouthWest().lat() + "," + mBound.getSouthWest().lng());
alert(mBound.getNorthEast().lat() + "," + mBound.getNorthEast().lng());
currPoint = trackMarkers[i].getHeadPoint();
if (!mBound.containsLatLng(currPoint)) {
mBound.extend(currPoint);
}
}
return mBound;
}
</code></pre>
<p>Which returns these values for the alert. (Generally over the US)<br /></p>
<blockquote>
<p>"19.64258,NaN"<br /> "52.69636,NaN"<br /> "i=0"<br />
"19.64258,NaN"<br /> "52.69636,-117.20701"<br /> "i=1"<br /></p>
</blockquote>
<p>I don't know why I am getting NaN back.
When I use the bounds to get a zoom level I think the NaN value is causing the map.getBoundsZoomLevel(bounds) to return 0 which is incorrect. Am I using <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds" rel="nofollow noreferrer">GLatLngBounds</a> incorrectly?</p>
| [
{
"answer_id": 18000,
"author": "Paul G",
"author_id": 162,
"author_profile": "https://Stackoverflow.com/users/162",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Data;\nusing System.Data.SqlClient;\nusing System.Data.SqlTypes;\nusing Microsoft.SqlServer.Server;\... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992/"
] |
16,656 | <p>I am working on a program that needs to create a multiple temporary folders for the application. These will not be seen by the user. The app is written in VB.net. I can think of a few ways to do it such as incremental folder name or random numbered folder names, but I was wondering, how other people solve this problem?</p>
| [
{
"answer_id": 16672,
"author": "juan",
"author_id": 1782,
"author_profile": "https://Stackoverflow.com/users/1782",
"pm_score": 4,
"selected": false,
"text": "System.IO.Path.GetTempFileName()"
},
{
"answer_id": 16685,
"author": "Adam Wright",
"author_id": 1200,
"auth... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1632/"
] |
16,727 | <p>In GWT I have to specify what locales are supported in my application. The code get compiled in various files, one for each locale (beside other versions), but I have to give my clients one only URL. This URL is supposed to be a page that should be displayed according to the locale preferred by the browser.
I dont't want to have an HTTP parameter for the locale since I want to forse the locale preferred by the browser.
How can this be coded in GWT?</p>
<p>Should I try to to this using apache rewrite rules? I thied it, but I think I cannot access such parameter easely in a rewrite rule.</p>
<p>Thanks a lot,
Giuseppe</p>
| [
{
"answer_id": 40521,
"author": "Lloyd Meinholz",
"author_id": 4229,
"author_profile": "https://Stackoverflow.com/users/4229",
"pm_score": 3,
"selected": false,
"text": "<inherits name=\"com.google.gwt.i18n.I18N\"/>\n"
},
{
"answer_id": 1343216,
"author": "Community",
"au... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
16,747 | <p>I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.</p>
| [
{
"answer_id": 25606,
"author": "Daniel Pollard",
"author_id": 2758,
"author_profile": "https://Stackoverflow.com/users/2758",
"pm_score": 6,
"selected": true,
"text": "public JsonResult CheckUserName(string username)\n{\n return Json(CheckValidUsername(username));\n}\n"
},
{
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1549/"
] |
16,762 | <p>I have a couple CSS files with overlapping CSS selectors that I'd like to programmatically merge (as in not just appending one file to the end of the other). Is there any tool to do this online? or a Firefox extension perhaps?</p>
| [
{
"answer_id": 11005246,
"author": "Ben23",
"author_id": 1452316,
"author_profile": "https://Stackoverflow.com/users/1452316",
"pm_score": 1,
"selected": false,
"text": "font"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2007/"
] |
16,770 | <p>I'm trying to fully understand all of Haskell's concepts.</p>
<p>In what ways are algebraic data types similar to generic types, e.g., in C# and Java? And how are they different? What's so algebraic about them anyway? </p>
<p>I'm familiar with universal algebra and its rings and fields, but I only have a vague idea of how Haskell's types work.</p>
| [
{
"answer_id": 16810,
"author": "olliej",
"author_id": 784,
"author_profile": "https://Stackoverflow.com/users/784",
"pm_score": 6,
"selected": true,
"text": " data List a = Cons a (List a) | Nil\n"
},
{
"answer_id": 16825,
"author": "Timbo",
"author_id": 1810,
"autho... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1659/"
] |
16,792 | <p>Came across this error today. Wondering if anyone can tell me what it means:</p>
<blockquote>
<blockquote>
<p>Cannot sort a row of size 9522, which is greater than the allowable maximum of 8094.</p>
</blockquote>
</blockquote>
<p>Is that 8094 bytes? Characters? Fields? Is this a problem joining multiple tables that are exceeding some limit?</p>
| [
{
"answer_id": 2547872,
"author": "Kevin Albrecht",
"author_id": 10475,
"author_profile": "https://Stackoverflow.com/users/10475",
"pm_score": 2,
"selected": false,
"text": "DBCC CLEANTABLE (0,[dbo.TableName])\n"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1975282/"
] |
16,795 | <p>PHP has a great function called <a href="http://us2.php.net/manual/en/function.htmlspecialchars.php" rel="noreferrer">htmlspecialcharacters()</a> where you pass it a string and it replaces all of HTML's special characters with their safe equivalents, it's <em>almost</em> a one stop shop for sanitizing input. Very nice right?</p>
<p>Well is there an equivalent in any of the .NET libraries?</p>
<p>If not, can anyone link to any code samples or libraries that do this well?</p>
| [
{
"answer_id": 16802,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 5,
"selected": true,
"text": "var encodedHtml = HttpContext.Current.Server.HtmlEncode(...);\n"
},
{
"answer_id": 16807,
"author": "Jason Should... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1366/"
] |
16,804 | <p>What options are there in the industry for enterprise reporting? I'm currently using SSRS 2005, and know that there is another version coming out with the new release of MSSQL.</p>
<p>But, it seems like it might also be a good time to investigate the market to see what else is out there.</p>
<p>What have you encountered? Do you like it/dislike it? Why?</p>
<p>Thank you.</p>
| [
{
"answer_id": 144531,
"author": "Peter Wone",
"author_id": 1715673,
"author_profile": "https://Stackoverflow.com/users/1715673",
"pm_score": 5,
"selected": false,
"text": "SELECT COUNT(*) FROM sometable WHERE 1=0\n"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/733/"
] |
16,815 | <p>I'm trying to do a simple test php script for sessions. Basically it increments a counter (stored in <code>$_SESSION</code>) every time you refresh that page. That works, but I'm trying to have a link to destroy the session which reloads the page with the <code>?destroy=1</code> parameter. I've tried a couple of if statements to see if that parameter is set and if so to destroy the session but it doesn't seem to work.</p>
<p>I've even put an if statement in the main body to pop-up a message if the parameter is set - but it doesn't seem to be picked up.</p>
<p>I know I'm doing something silly (I'm a PHP newbie) but I can't seem to find what it is...</p>
<p>See code here:</p>
<pre><code><?php
if ($_POST['destroy']) {
session_destroy();
} else {
session_start();
}
?>
<html>
<head>
<title>Session test</title>
</head>
<body>
<?php
if (isset($_POST['destroy'])) {
echo "Destroy set";
}
$_SESSION['counter']++;
echo "You have visited this page " . $_SESSION['counter'] . " times" . "<BR>";
echo "I am tracking you using the session id " . session_id() . "<BR>";
echo "Click <a href=\"" . $_SERVER['PHP_SELF'] . "?destroy=1\">here</a> to destroy the session.";
?>
</code></pre>
| [
{
"answer_id": 16818,
"author": "Andrew G. Johnson",
"author_id": 428190,
"author_profile": "https://Stackoverflow.com/users/428190",
"pm_score": 4,
"selected": true,
"text": "$_POST['destroy']\n"
},
{
"answer_id": 16826,
"author": "ftdysa",
"author_id": 2016,
"author... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1912/"
] |
16,828 | <p>It seems like the only way to do this is to pass the -i parameter in when you initially run less. Does anyone know of some secret hack to make something like this work</p>
<pre><code>/something to search for/i
</code></pre>
| [
{
"answer_id": 16837,
"author": "Juha Syrjälä",
"author_id": 1431,
"author_profile": "https://Stackoverflow.com/users/1431",
"pm_score": 10,
"selected": true,
"text": "-I"
},
{
"answer_id": 26069,
"author": "sanmiguel",
"author_id": 24,
"author_profile": "https://Stac... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1797/"
] |
16,829 | <p>I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just OK, but never great.</p>
<p>Just to get the ball rolling, here is a review of things I've seen.</p>
<p>This example is SVN-based, but applies to most VCS's (not so much to distributed version control).</p>
<ol>
<li><p>branch the individual projects that are part of site
/division/web/projectName/vb/src/[trunk|branches|tags]</p></li>
<li><p>branch the whole site, in the case I've seen, the whole site except for core components was branched.
/division/[trunk|branches|tags]/web/projectName/vb/src/</p></li>
<li><p>Use main-line a default, only branch when necessary for <strong>huge</strong> changes.</p></li>
</ol>
| [
{
"answer_id": 16915,
"author": "Boris Terzic",
"author_id": 1996,
"author_profile": "https://Stackoverflow.com/users/1996",
"pm_score": 3,
"selected": false,
"text": "svnrepo/\n trunk/\n modules/\n m1/ --> will result in jar file\n m2/\n ...\n assemblies/\n a1... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2017/"
] |
16,832 | <p>I am looking for a lightweight source control system for use on "hobby" projects with only one person (myself) working on the project. Does anyone have any suggestions? Ideally it should interface with Visual Studio either naively or through another plug-in, outside of that, anything that works would be nice to be replace Gmail as source control.</p>
| [
{
"answer_id": 16835,
"author": "prakash",
"author_id": 123,
"author_profile": "https://Stackoverflow.com/users/123",
"pm_score": 3,
"selected": false,
"text": "Svn1ClickSetup-1.3.3.exe"
},
{
"answer_id": 16844,
"author": "Greg Hewgill",
"author_id": 893,
"author_prof... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185/"
] |
16,833 | <p>I need to periodically download, extract and save the contents of <a href="http://data.dot.state.mn.us/dds/det_sample.xml.gz" rel="noreferrer">http://data.dot.state.mn.us/dds/det_sample.xml.gz</a> to disk. Anyone have experience downloading gzipped files with C#?</p>
| [
{
"answer_id": 16852,
"author": "Adam Haile",
"author_id": 194,
"author_profile": "https://Stackoverflow.com/users/194",
"pm_score": 3,
"selected": false,
"text": "WebClient Client = new WebClient ();\nClient.DownloadFile(\"http://data.dot.state.mn.us/dds/det_sample.xml.gz\", \" C:\\mygz... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1786/"
] |
16,861 | <p>What is the best way to sanitize user input for a Python-based web application? Is there a single function to remove HTML characters and any other necessary characters combinations to prevent an <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" rel="noreferrer">XSS</a> or SQL injection attack?</p>
| [
{
"answer_id": 25136,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 5,
"selected": false,
"text": "onclick"
},
{
"answer_id": 248933,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https:/... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019/"
] |
16,891 | <p>As you may know, in <code>VS 2008</code> <kbd>ctrl</kbd>+<kbd>tab</kbd> brings up a nifty navigator window with a thumbnail of each file. I love it, but there is one tiny thing that is annoying to me about this feature: <em>the window stays around after releasing the <kbd>ctrl</kbd> key</em>. When doing an <kbd>alt</kbd>+<kbd>tab</kbd> in windows, you can hit tab to get to the item you want (while still holding down the <kbd>alt</kbd> key), and then when you find what you want, <em>lifting up</em> on the <kbd>alt</kbd> key selects that item.</p>
<p>I wish <code>VS 2008</code> would do the same. For me, when I lift off of <kbd>ctrl</kbd>, the window is still there. I have to hit <kbd>enter</kbd> to actually select the item. I find this annoying.</p>
<p>Does anyone know how to make <code>VS 2008</code> dismiss the window on the <em>release</em> of the <kbd>ctrl</kbd> key?</p>
| [
{
"answer_id": 6413653,
"author": "SliverNinja - MSFT",
"author_id": 175679,
"author_profile": "https://Stackoverflow.com/users/175679",
"pm_score": 2,
"selected": false,
"text": "Window.NextDocumentWindow"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1789/"
] |
16,926 | <p>My HTML is all marked up, ready to make it rain CSS. The problem is that I have to go back and find out what all my id and class names are so I can get started. What I need is a tool that parses my HTML and spits out a stylesheet with all the possible elements ready to be styled (maybe even with some defaults). Does such a tool exist?</p>
| [
{
"answer_id": 16989,
"author": "danb",
"author_id": 2031,
"author_profile": "https://Stackoverflow.com/users/2031",
"pm_score": 3,
"selected": false,
"text": "<script type=\"text/javascript\">\n $(document).ready(function() {\n\n $('*[@id]').each(function() {\n cons... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/744/"
] |
16,935 | <p>I'm trying to compile over 100 java classes from different packages from a clean
directory (no incremental compiles) using the following ant tasks:</p>
<pre><code><target name="-main-src-depend">
<depend srcdir="${src.dir}"
destdir="${bin.dir}"
cache="${cache.dir}"
closure="true"/>
</target>
<target name="compile" depends="-main-src-depend"
description="Compiles the project.">
<echo>Compiling</echo>
<javac target="${javac.target}"
source="${javac.source}"
debug="${javac.debug}"
srcdir="${src.dir}"
destdir="${bin.dir}">
<classpath>
<path refid="runtime.classpath"/>
<path refid="compile.classpath"/>
</classpath>
</javac>
</target>
</code></pre>
<p>However, the first time I run the compile task I always get a StackOverflowException. If I run the task again the compiler does an incremental build and everything works fine. This is undesirable since we are using <a href="http://cruisecontrol.sourceforge.net/" rel="noreferrer">CruiseControl</a> to do an automatic daily build and this is causing false build failures.</p>
<p>As a quick-and-dirty solution I have created 2 separate tasks, compiling portions of the project in each. I really don't think this solution will hold as more classes are added in the future, and I don't want to be adding new compile tasks every time we hit the "compile limit".</p>
| [
{
"answer_id": 16955,
"author": "jmanning2k",
"author_id": 1480,
"author_profile": "https://Stackoverflow.com/users/1480",
"pm_score": 1,
"selected": false,
"text": "javac"
},
{
"answer_id": 16982,
"author": "Kieron",
"author_id": 588,
"author_profile": "https://Stack... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2024/"
] |
16,939 | <p>I am reading a binary file into a parsing program. I will need to iterate through the file and look for certain markers so I can split the file up and pass those parts into their respective object’s constructors.</p>
<p>Is there an advantage to holding the file as a stream, either MemoryStream or FileStream, or should it be converted into a byte[] array?</p>
<p>Keith</p>
| [
{
"answer_id": 16967,
"author": "denis phillips",
"author_id": 748,
"author_profile": "https://Stackoverflow.com/users/748",
"pm_score": 6,
"selected": true,
"text": "byte[]"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] |
16,945 | <p>I would like to rename files and folders recursively by applying a string replacement operation.</p>
<p>E.g. The word "shark" in files and folders should be replaced by the word "orca".</p>
<p><code>C:\Program Files\Shark Tools\Wire Shark\Sharky 10\Shark.exe</code> </p>
<p>should be moved to:</p>
<p><code>C:\Program Files\Orca Tools\Wire Orca\Orcay 10\Orca.exe</code></p>
<p>The same operation should be of course applied to each child object in each folder level as well.</p>
<p>I was experimenting with some of the members of the <code>System.IO.FileInfo</code> and <code>System.IO.DirectoryInfo</code> classes but didn't find an easy way to do it.</p>
<pre><code>fi.MoveTo(fi.FullName.Replace("shark", "orca"));
</code></pre>
<p>Doesn't do the trick.</p>
<p>I was hoping there is some kind of "genius" way to perform this kind of operation.
</p>
| [
{
"answer_id": 17028,
"author": "EBGreen",
"author_id": 1358,
"author_profile": "https://Stackoverflow.com/users/1358",
"pm_score": 1,
"selected": false,
"text": "function Move-Stuff($folder)\n{\n foreach($sub in [System.IO.Directory]::GetDirectories($folder))\n {\n Move-S... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
16,963 | <p>Curious if others feel the same as me. To me, controls such as datagrid/gridview/formview/etc. are great for presentations or demo's only. To take the time and tweak this controls, override their default behavior (hooking into their silly events etc.) is a big headache. The only control that I use is the repeater, since it offers me the most flexibility over the others.</p>
<p><strong>In short, they are pretty much bloatware.</strong></p>
<p>I'd rather weave my own html/css, use my own custom paging queries. </p>
<p>Again, if you need to throw up a quick page these controls are great (especially if you are trying to woo people into the ease of <code>.NET</code> development).</p>
<p>I must be in the minority, otherwise MS wouldn't dedicated so much development time on these types of controls...
</p>
| [
{
"answer_id": 16978,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": false,
"text": "<asp:GridView ...>\n <Columns>\n <my:AutoField HeaderText=\"Type\" \n DataField=\"TypeId\"\n ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368/"
] |
16,964 | <p>I'm trying to implement something like this:</p>
<pre><code><div>
<table>
<thead>
<tr>
<td>Port name</td>
<td>Current port version</td>
<td>New port version</td>
<td>Update</td>
</tr>
</thead>
<% foreach (var ip in Ports) { %>
<tr>
<td>
<%= ip.PortName %>
</td>
<td>
<%= ip.CurrentVersion %>
</td>
<td>
<%= ip.NewVersion %>
</td>
<td>
<asp:Button ID="btnUpdate" runat="server" Text="Update" CommandArgument="<% ip.PortName %>" />
</td>
</tr>
<% } %>
</table>
</div>
</code></pre>
<p>The button's <code>CommandArgument</code> property is where my code complains about not being able to resolve symbol <code>ip</code>. Is there any way to do what I'm trying to do?
</p>
| [
{
"answer_id": 594544,
"author": "Spoike",
"author_id": 3713,
"author_profile": "https://Stackoverflow.com/users/3713",
"pm_score": 1,
"selected": false,
"text": "HtmlHelper"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/16964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614/"
] |
16,971 | <p>I would like to have a nice template for doing this in development. How do I reset an increment identity's starting value in SQL Server?</p>
| [
{
"answer_id": 16977,
"author": "Ryan Sampson",
"author_id": 1375,
"author_profile": "https://Stackoverflow.com/users/1375",
"pm_score": 8,
"selected": true,
"text": "DBCC CHECKIDENT('TableName', RESEED, 0)\n"
},
{
"answer_id": 16983,
"author": "Keith",
"author_id": 905,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1976/"
] |
16,991 | <p>I've been using Eclipse with RDT (not RadRails) a lot lately, and I'm quite happy with it, but I'm wondering if you guys know any decent alternatives. I know NetBeans also supports Ruby these days, but I'm not sure what it has to offer over Eclipse.</p>
<p>Please, list any features you think are brilliant or useful when suggesting an IDE, makes it easier to compare.</p>
<p>Also, I said Ruby, not Rails. While Rails support is a plus, I prefer things to be none Rails-centric. It should also be available on Linux and optionally Solaris.</p>
| [
{
"answer_id": 4040692,
"author": "so_mv",
"author_id": 186858,
"author_profile": "https://Stackoverflow.com/users/186858",
"pm_score": 3,
"selected": false,
"text": "code completion"
},
{
"answer_id": 5790859,
"author": "Michael De Silva",
"author_id": 449342,
"autho... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2018/"
] |
16,998 | <p>I'm having trouble reading a "chunked" response when using a StreamReader to read the stream returned by GetResponseStream() of a HttpWebResponse:</p>
<pre><code>// response is an HttpWebResponse
StreamReader reader = new StreamReader(response.GetResponseStream());
string output = reader.ReadToEnd(); // throws exception...
</code></pre>
<p>When the <code>reader.ReadToEnd()</code> method is called I'm getting the following System.IO.IOException: <strong>Unable to read data from the transport connection: The connection was closed.</strong></p>
<p>The above code works just fine when server returns a "non-chunked" response.</p>
<p>The only way I've been able to get it to work is to use HTTP/1.0 for the initial request (instead of HTTP/1.1, the default) but this seems like a lame work-around.</p>
<p>Any ideas?</p>
<hr>
<p>@Chuck</p>
<p>Your solution works pretty good. It still throws the same IOExeception on the last Read(). But after inspecting the contents of the StringBuilder it looks like all the data has been received. So perhaps I just need to wrap the Read() in a try-catch and swallow the "error".</p>
| [
{
"answer_id": 17236,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "StringBuilder sb = new StringBuilder();\nByte[] buf = new byte[8192];\nStream resStream = response.GetResponseStream();\nstring ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/16998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2047/"
] |
17,017 | <p>How do I convert a DateTime structure to its equivalent <a href="http://www.ietf.org/rfc/rfc3339.txt" rel="noreferrer">RFC 3339</a> formatted string representation and/or parse this string representation back to a <a href="http://msdn.microsoft.com/en-us/library/system.datetime.aspx" rel="noreferrer">DateTime</a> structure? The RFC-3339 date-time format is used in a number of specifications such as the <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php#date.constructs" rel="noreferrer">Atom Syndication Format</a>.</p>
| [
{
"answer_id": 17021,
"author": "Oppositional",
"author_id": 2029,
"author_profile": "https://Stackoverflow.com/users/2029",
"pm_score": 6,
"selected": true,
"text": "using System;\nusing System.Globalization;\n\nnamespace DateTimeConsoleApplication\n{\n /// <summary>\n /// Provide... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029/"
] |
17,020 | <p>I have a new 1 TB drive coming in tomorrow. What is the best way to divide this space for a development workstation?</p>
<p>The biggest problem I think I'm going to have is that some partitions (probably /usr) will become to small after a bit of use. Other partitions are probably to huge. The swap drive for example is currently 2GB (2x 1GB RAM), but it is almost never used (only once that I know of).</p>
| [
{
"answer_id": 30415,
"author": "palm3D",
"author_id": 2686,
"author_profile": "https://Stackoverflow.com/users/2686",
"pm_score": 2,
"selected": false,
"text": "quota"
},
{
"answer_id": 30419,
"author": "palm3D",
"author_id": 2686,
"author_profile": "https://Stackove... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1633/"
] |
17,032 | <p><a href="http://resharper.blogspot.com/2008/03/varification-using-implicitly-typed.html" rel="noreferrer">Resharper</a> certainly thinks so, and out of the box it will nag you to convert</p>
<pre><code>Dooberry dooberry = new Dooberry();
</code></pre>
<p>to</p>
<pre><code>var dooberry = new Dooberry();
</code></pre>
<p>Is that really considered the best style?</p>
| [
{
"answer_id": 17042,
"author": "Jon Galloway",
"author_id": 5,
"author_profile": "https://Stackoverflow.com/users/5",
"pm_score": 6,
"selected": true,
"text": "var result = GetUserID();\n"
},
{
"answer_id": 17044,
"author": "Mark Cidade",
"author_id": 1659,
"author_p... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] |
17,054 | <p>How do you use network sockets in Pascal?
</p>
| [
{
"answer_id": 17062,
"author": "Mickey",
"author_id": 1494,
"author_profile": "https://Stackoverflow.com/users/1494",
"pm_score": 4,
"selected": true,
"text": "program daytime;\n\n{ Simple client program }\n\nuses\n sockets, inetaux, myerror;\n\nconst\n RemotePort : Word = 13;\n\nva... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/868/"
] |
17,056 | <p>I'm currently working on an application where we have a SQL-Server database and I need to get a full text search working that allows us to search people's names.</p>
<p>Currently the user can enter a into a name field that searches 3 different varchar cols. First, Last, Middle names</p>
<p>So say I have 3 rows with the following info.</p>
<p>1 - Phillip - J - Fry</p>
<p>2 - Amy - NULL - Wong</p>
<p>3 - Leo - NULL - Wong</p>
<p>If the user enters a name such as 'Fry' it will return row 1. However if they enter Phillip Fry, or Fr, or Phil they get nothing.. and I don't understand why its doing this. If they search for Wong they get rows 2 and 3 if they search for Amy Wong they again get nothing.</p>
<p>Currently the query is using CONTAINSTABLE but I have switched that with FREETEXTTABLE, CONTAINS, and FREETEXT without any noticeable differences in the results. The table methods are be preferred because they return the same results but with ranking.</p>
<p>Here is the query.</p>
<pre><code>....
@Name nvarchar(100),
....
--""s added to prevent crash if searching on more then one word.
DECLARE @SearchString varchar(100)
SET @SearchString = '"'+@Name+'"'
SELECT Per.Lastname, Per.Firstname, Per.MiddleName
FROM Person as Per
INNER JOIN CONTAINSTABLE(Person, (LastName, Firstname, MiddleName), @SearchString)
AS KEYTBL
ON Per.Person_ID = KEYTBL.[KEY]
WHERE KEY_TBL.RANK > 2
ORDER BY KEYTBL.RANK DESC;
....
</code></pre>
<p>Any Ideas...? Why this full text search is not working correctly ?</p>
| [
{
"answer_id": 18072,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 2,
"selected": false,
"text": "INNER JOIN FREETEXTTABLE(Person, (LastName, Firstname, MiddleName), @SearchString) \n"
},
{
"answer_id": 18226,
"autho... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1925/"
] |
17,085 | <p>I have a simple CAML query like</p>
<pre><code><Where><Eq><Field="FieldName"><Value Type="Text">Value text</Value></Field></Eq></Where>
</code></pre>
<p>And I have a variable to substitute for <code>Value text</code>. What's the best way to validate/escape the text that is substituted here in the .NET framework?
I've done a quick web search on this problem but all what I found was <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.aspx" rel="nofollow noreferrer"><code>System.Xml.Convert</code></a> class but this seems to be not quite what I need here.</p>
<p>I know I could have gone with an <code>XmlWriter</code> here, but it seems like a lot of code for such a simple task where I just need to make sure that the <code>Value text</code> part is formatted well.</p>
| [
{
"answer_id": 17093,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 0,
"selected": false,
"text": "System.Xml.Linq.XElement"
},
{
"answer_id": 17137,
"author": "Dale Ragan",
"author_id": 1117,
"author_pro... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/578/"
] |
17,106 | <p>We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an easy/free way to do that?</p>
<p><strong>Edit</strong></p>
<p>There are apparently no free tools for this, and I agree that OxygenXML is one of the best tools for this.</p>
| [
{
"answer_id": 374256,
"author": "falko",
"author_id": 47010,
"author_profile": "https://Stackoverflow.com/users/47010",
"pm_score": 3,
"selected": false,
"text": "xmlgen.zip"
},
{
"answer_id": 6209865,
"author": "Michal Rames",
"author_id": 780439,
"author_profile": ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] |
17,117 | <p>Is Boost the only way for VS2005 users experience TR2? Also is there a idiot proof way of downloading only the TR2 related packages?</p>
<p>I was looking at the boost installer provided by BoostPro Consulting. If I select the options for all the threading options with all the packages for MSVC8 it requires 1.1GB. While I am not short of space, it seems ridiculous that a <strong>library</strong> needs over a gigabyte of space and it takes BPC a long time to catch up with the current release.</p>
<p>What packages do I need? I'm really only interested in those that comprise std::tr2 and can find that out by comparing those on offer to those in from the TR2 report and selecting those from the list but even then it isn't clear what is needed and the fact that it is a version behind annoys me. </p>
<p>I know from previous encounters with Boost (1.33.1) that self compiling is a miserable experience: A lot of time wasted to get it started and then a hoard of errors passes across your screen faster than you can read, so what you are left with is an uneasy feeling that something is broken but you don't quite know what. </p>
<p>I've never had these problems with any Apache library but that is another rant...</p>
| [
{
"answer_id": 38226,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 0,
"selected": false,
"text": "bjam --help"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/17117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] |
17,125 | <p>I know what <code>yield</code> does, and I've seen a few examples, but I can't think of real life applications, have you used it to solve some specific problem?</p>
<p>(Ideally some problem that cannot be solved some other way)</p>
| [
{
"answer_id": 17133,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 3,
"selected": false,
"text": "public override IEnumerator<T> GetEnumerator()\n{\n // goes through the collection and only returns the ones that are vis... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
17,140 | <p>How do you run an external program and pass it command line parameters using C? If you have to use operating system API, include a solution for Windows, Mac, and Linux.</p>
| [
{
"answer_id": 17148,
"author": "wilhelmtell",
"author_id": 456,
"author_profile": "https://Stackoverflow.com/users/456",
"pm_score": 4,
"selected": false,
"text": "#include <stdlib.h>\n\nint main()\n{\n system(\"echo HAI\");\n\n return 0;\n}\n"
},
{
"answer_id": 17150,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] |
17,170 | <p>I know that IList is the interface and List is the concrete type but I still don't know when to use each one. What I'm doing now is if I don't need the Sort or FindAll methods I use the interface. Am I right? Is there a better way to decide when to use the interface or the concrete type?</p>
| [
{
"answer_id": 17177,
"author": "swilliams",
"author_id": 736,
"author_profile": "https://Stackoverflow.com/users/736",
"pm_score": 2,
"selected": false,
"text": "Person"
},
{
"answer_id": 17179,
"author": "Dan Herbert",
"author_id": 392,
"author_profile": "https://St... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1560/"
] |
17,172 | <p>I've tried to do this several times with no luck. After reading <a href="https://stackoverflow.com/questions/1451/what-is-the-best-way-to-handle-multiple-permission-types#1477">this post</a>, it made me interested in doing this again. So can anyone tell me why the following doesn't work?</p>
<pre><code><?php
$guest = 1;
$editor = 2;
$admin = 4;
$user = $editor;
if( $user == ($editor | $admin) ) {
echo "Test";
}
?>
</code></pre>
| [
{
"answer_id": 17173,
"author": "Espen Herseth Halvorsen",
"author_id": 1542,
"author_profile": "https://Stackoverflow.com/users/1542",
"pm_score": 2,
"selected": false,
"text": "<?php\n\n $guest = 1;\n $editor = 2;\n $admin = 4;\n\n $user = $editor;\n\n if( ($user == $edi... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40/"
] |
17,175 | <p>I'll take away the obvious one here: mic and webcam support. Other than that, if you ran the Silverlight team, what would your highest priority be for Silverlight v.Next?</p>
<p>Disclaimer: If we get some good responses, I'll pass them along to folks I know on the Silverlight team.</p>
<p><strong>UPDATE</strong>: The best place to report Silverlight feature requests now is the UserVoice site: <a href="http://silverlight.uservoice.com/pages/4325-feature-suggestions" rel="nofollow noreferrer">http://silverlight.uservoice.com/</a></p>
| [
{
"answer_id": 33962,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 1,
"selected": false,
"text": "*"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/17175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5/"
] |
17,181 | <p>In my most C++ project I heavily used ASSERTION statement as following:</p>
<pre><code>int doWonderfulThings(const int* fantasticData)
{
ASSERT(fantasticData);
if(!fantasticData)
return -1;
// ,,,
return WOW_VALUE;
}
</code></pre>
<p>But TDD community seems like to enjoy doing something like this:</p>
<pre><code>int doMoreWonderfulThings(const int* fantasticData)
{
if(!fantasticData)
return ERROR_VALUE;
// ...
return AHA_VALUE;
}
TEST(TDD_Enjoy)
{
ASSERT_EQ(ERROR_VALUE, doMoreWonderfulThings(0L));
ASSERT_EQ(AHA_VALUE, doMoreWonderfulThings("Foo"));
}
</code></pre>
<p>Just with my experiences first approaches let me remove so many subtle bugs.
But TDD approaches are very smart idea to handle legacy codes.</p>
<p>"Google" - they compare "FIRST METHOD" to "Walk the shore with life-vest, swim ocean without any safe guard".</p>
<p>Which one is better?
Which one makes software robust?</p>
| [
{
"answer_id": 17229,
"author": "Huppie",
"author_id": 1830,
"author_profile": "https://Stackoverflow.com/users/1830",
"pm_score": 2,
"selected": false,
"text": "int doWonderfulThings(const int* fantasticData)\n{\n ASSERT(fantasticData);\n ASSERTNOTEQUAL(0, fantasticData)\n\n re... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1556/"
] |
17,194 | <p>I have a Monthly Status database view I need to build a report based on. The data in the view looks something like this:</p>
<pre><code>Category | Revenue | Yearh | Month
Bikes 10 000 2008 1
Bikes 12 000 2008 2
Bikes 12 000 2008 3
Bikes 15 000 2008 1
Bikes 11 000 2007 2
Bikes 11 500 2007 3
Bikes 15 400 2007 4
</code></pre>
<p><br/>
... And so forth</p>
<p>The view has a product category, a revenue, a year and a month. I want to create a report comparing 2007 and 2008, showing 0 for the months with no sales. So the report should look something like this:</p>
<pre><code>Category | Month | Rev. This Year | Rev. Last Year
Bikes 1 10 000 0
Bikes 2 12 000 11 000
Bikes 3 12 000 11 500
Bikes 4 0 15 400
</code></pre>
<p><br/>
The key thing to notice is how month 1 only has sales in 2008, and therefore is 0 for 2007. Also, month 4 only has no sales in 2008, hence the 0, while it has sales in 2007 and still show up.</p>
<p>Also, the report is actually for financial year - so I would love to have empty columns with 0 in both if there was no sales in say month 5 for either 2007 or 2008.</p>
<p>The query I got looks something like this:</p>
<pre><code>SELECT
SP1.Program,
SP1.Year,
SP1.Month,
SP1.TotalRevenue,
IsNull(SP2.TotalRevenue, 0) AS LastYearTotalRevenue
FROM PVMonthlyStatusReport AS SP1
LEFT OUTER JOIN PVMonthlyStatusReport AS SP2 ON
SP1.Program = SP2.Program AND
SP2.Year = SP1.Year - 1 AND
SP1.Month = SP2.Month
WHERE
SP1.Program = 'Bikes' AND
SP1.Category = @Category AND
(SP1.Year >= @FinancialYear AND SP1.Year <= @FinancialYear + 1) AND
((SP1.Year = @FinancialYear AND SP1.Month > 6) OR
(SP1.Year = @FinancialYear + 1 AND SP1.Month <= 6))
ORDER BY SP1.Year, SP1.Month
</code></pre>
<p>The problem with this query is that it would not return the fourth row in my example data above, since we didn't have any sales in 2008, but we actually did in 2007.</p>
<p>This is probably a common query/problem, but my SQL is rusty after doing front-end development for so long. Any help is greatly appreciated!</p>
<p>Oh, btw, I'm using SQL 2005 for this query so if there are any helpful new features that might help me let me know.</p>
| [
{
"answer_id": 17277,
"author": "Jonas Follesø",
"author_id": 1199387,
"author_profile": "https://Stackoverflow.com/users/1199387",
"pm_score": 1,
"selected": false,
"text": "SELECT \n SP1.Program,\n SP1.Year,\n SP1.Month,\n SP1.TotalRevenue AS ThisYearRevenue,\n SP2.Total... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199387/"
] |
17,225 | <p>In Perl, you can execute system commands using system() or `` (backticks). You can even capture the output of the command into a variable. However, this hides the program execution in the background so that the person executing your script can't see it. </p>
<p>Normally this is useful but sometimes I want to see what is going on behind the scenes. How do you make it so the commands executed are printed to the terminal, and those programs' output printed to the terminal? This would be the <code>.bat</code> equivalent of "@echo on".</p>
| [
{
"answer_id": 17245,
"author": "mk.",
"author_id": 1797,
"author_profile": "https://Stackoverflow.com/users/1797",
"pm_score": 3,
"selected": false,
"text": "open(LS,\"|ls\");\nprint LS;\n"
},
{
"answer_id": 17293,
"author": "Daniel Fone",
"author_id": 1848,
"author_... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] |
17,228 | <p>I develop C++ applications in a Linux environment. The tools I use every day include Eclipse with the CDT plugin, gdb and valgrind.<br>
What tools do other people use? Is there anything out there for Linux that rivals the slickness of Microsoft Visual Studio?</p>
| [
{
"answer_id": 563490,
"author": "Zan Lynx",
"author_id": 13422,
"author_profile": "https://Stackoverflow.com/users/13422",
"pm_score": 6,
"selected": false,
"text": "strace"
},
{
"answer_id": 1955392,
"author": "Community",
"author_id": -1,
"author_profile": "https:/... | 2008/08/19 | [
"https://Stackoverflow.com/questions/17228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1449/"
] |
17,231 | <p>I was looking at <a href="http://tldp.org/LDP/abs/html/why-shell.html" rel="nofollow noreferrer">http://tldp.org/LDP/abs/html/why-shell.html</a> and was struck by:</p>
<blockquote>
<p>When not to use shell scripts</p>
<p>...</p>
<ul>
<li>Mission-critical applications upon which you are betting the future of the company</li>
</ul>
</blockquote>
<p>Why not?</p>
| [
{
"answer_id": 92305,
"author": "David Webb",
"author_id": 3171,
"author_profile": "https://Stackoverflow.com/users/3171",
"pm_score": 2,
"selected": false,
"text": "critical-business-logic.sh"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/17231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] |
17,250 | <p>I am creating an ZIP file with <code>ZipFile</code> in Python 2.5, it works OK so far:</p>
<pre><code>import zipfile, os
locfile = "test.txt"
loczip = os.path.splitext (locfile)[0] + ".zip"
zip = zipfile.ZipFile (loczip, "w")
zip.write (locfile)
zip.close()
</code></pre>
<p>But I couldn't find how to encrypt the files in the ZIP file.
I could use system and call <code>PKZIP -s</code>, but I suppose there must be a more "Pythonic" way. I'm looking for an open source solution.</p>
| [
{
"answer_id": 17287,
"author": "Harley Holcombe",
"author_id": 1057,
"author_profile": "https://Stackoverflow.com/users/1057",
"pm_score": -1,
"selected": false,
"text": "import chilkat\n\n# Demonstrates how to create a WinZip-compatible 128-bit AES strong encrypted zip\nzip = chilkat.C... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394/"
] |
17,274 | <p>Although I've done programming, I'm not a programmer. I've recently agreed to coordinate getting a Website up for a club. The resources are--me, who has done Web content maintenance (putting content into HTML and ColdFusion templates via a gatekeeper to the site itself; doing simple HTML and XML coding); a serious Web developer who does database programming, ColdFusion, etc., and talks way over the heads of the rest of us; two designers who use Dreamweaver; the guy who created the original (and now badly broken) site in Front Page and wants to use Expression Web; and assorted other club members who are even less technically inclined.</p>
<p>What we need up first is some text and graphics (a gorgeous design has been created in Dreamweaver), some links (including to existing PDF newsletters for download), and maybe hooking up an existing Blogspot blog. Later (or earlier if it's not hard), we may add mouseover menus to the links, a gallery, a calendar, a few Mapquest hotlinks, and so on.</p>
<p>My question--First, is there any real problem with sticking with HTML and jpegs for the initial site? Second, for the "later" part of the site development, what's the simplest we can go with? Third, are there costs in doing this the simple way that will make us regret it down the road? Also, is there a good site/resource where I can learn more about this from a newbie perspective?
</p>
| [
{
"answer_id": 18385,
"author": "Kevin",
"author_id": 40,
"author_profile": "https://Stackoverflow.com/users/40",
"pm_score": 1,
"selected": false,
"text": "<!--#include virtual=\"navigation.html\" -->\n"
}
] | 2008/08/20 | [
"https://Stackoverflow.com/questions/17274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1110/"
] |
17,299 | <p>I am trying to build a function in C/C++ to sort an array and replace each value with its "score" or rank. It takes in a double pointer array to an array of ints, and sorts the double pointers based on the dereferenced value of the integers. I have tried quite a few times to make it work, but can't get it down. Once again, it must sort the double pointers based on the values they point to. This is what I have:</p>
<pre><code>void SortArray( int ** pArray, int ArrayLength )
{
int i, j, flag = 1; // set flag to 1 to begin initial pass
int * temp; // holding variable orig with no *
for(i = 1; (i <= ArrayLength) && flag; i++)
{
flag = 0;
for (j = 0; j < (ArrayLength -1); j++)
{
if (*pArray[j+1] > *pArray[j]) // ascending order simply changes to <
{
temp = &pArray[j]; // swap elements
pArray[j] = &pArray[j+1];
pArray[j+1] = &temp;
flag = 1; // indicates that a swap occurred.
}
}
}
}
</code></pre>
| [
{
"answer_id": 17312,
"author": "OJ.",
"author_id": 611,
"author_profile": "https://Stackoverflow.com/users/611",
"pm_score": 4,
"selected": true,
"text": "void SortArray( int ** pArray, int ArrayLength )\n{\n int i, j, flag = 1; // set flag to 1 to begin initial pass\n int * te... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/522/"
] |
17,333 | <p>What would be the most efficient way to compare two <code>double</code> or two <code>float</code> values?</p>
<p>Simply doing this is not correct:</p>
<pre><code>bool CompareDoubles1 (double A, double B)
{
return A == B;
}
</code></pre>
<p>But something like:</p>
<pre><code>bool CompareDoubles2 (double A, double B)
{
diff = A - B;
return (diff < EPSILON) && (-diff < EPSILON);
}
</code></pre>
<p>Seems to waste processing.</p>
<p>Does anyone know a smarter float comparer?</p>
| [
{
"answer_id": 17341,
"author": "OJ.",
"author_id": 611,
"author_profile": "https://Stackoverflow.com/users/611",
"pm_score": 8,
"selected": false,
"text": "bool AreSame(double a, double b)\n{\n return fabs(a - b) < EPSILON;\n}\n"
},
{
"answer_id": 17412,
"author": "fulmic... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2057/"
] |
17,352 | <p>In relation to this question on <a href="https://stackoverflow.com/questions/14413/using-opengl-extensions-on-windows">Using OpenGL extensions</a>, what's the purpose of these extension functions? Why would I want to use them? Further, are there any tradeoffs or gotchas associated with using them?</p>
| [
{
"answer_id": 23908,
"author": "spate",
"author_id": 2276,
"author_profile": "https://Stackoverflow.com/users/2276",
"pm_score": 3,
"selected": false,
"text": "NV_vertex_program"
}
] | 2008/08/20 | [
"https://Stackoverflow.com/questions/17352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/803/"
] |
17,359 | <p>I've created a script that runs every night on my Linux server that uses <code>mysqldump</code> to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file. The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping. I've been able to send the raw script in the body an email by piping the backup text file to <code>mailx</code> like so:</p>
<pre><code>$ cat mysqldbbackup.sql | mailx backup@email.example
</code></pre>
<p><code>cat</code> echoes the backup file's text which is piped into the <code>mailx</code> program with the recipient's email address passed as an argument.</p>
<p>While this accomplishes what I need, I think it could be one step better, <strong>Is there any way, using shell scripts or otherwise, to send the compressed .tar file to an outgoing email message as an <em>attachment</em>?</strong> This would beat having to deal with very long email messages which contain header data and often have word-wrapping issues etc.</p>
| [
{
"answer_id": 17365,
"author": "Chris N",
"author_id": 1653,
"author_profile": "https://Stackoverflow.com/users/1653",
"pm_score": 5,
"selected": false,
"text": "man mailx"
},
{
"answer_id": 17366,
"author": "David Schlosnagle",
"author_id": 1750,
"author_profile": "... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339/"
] |
17,370 | <p>I've been using OpenGL extensions on Windows the <a href="https://stackoverflow.com/questions/14413/using-opengl-extensions-on-windows">painful way</a>. Is GLEW the easier way to go? How do I get started with it?</p>
| [
{
"answer_id": 17371,
"author": "Ashwin Nanjappa",
"author_id": 1630,
"author_profile": "https://Stackoverflow.com/users/1630",
"pm_score": 6,
"selected": true,
"text": "#pragma comment(lib, \"glew32.lib\")\n"
},
{
"answer_id": 17429,
"author": "graham.reeds",
"author_id"... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630/"
] |
17,373 | <p>How do I open the default mail program with a Subject and Body in a cross-platform way?</p>
<p>Unfortunately, this is for a a client app written in Java, not a website.</p>
<p>I would like this to work in a cross-platform way (which means Windows and Mac, sorry Linux). I am happy to execute a VBScript in Windows, or AppleScript in OS X. But I have no idea what those scripts should contain. I would love to execute the user's default program vs. just searching for Outlook or whatever.</p>
<p>In OS X, I have tried executing the command:</p>
<pre><code>open mailto:?subject=MySubject&body=TheBody
</code></pre>
<p>URL escaping is needed to replace spaces with <code>%20</code>.</p>
<p><strong>Updated</strong> On Windows, you have to play all sorts of games to get <code>start</code> to run correctly. Here is the proper Java incantation:</p>
<pre><code>class Win32 extends OS {
public void email(String subject, String body) throws Exception {
String cmd = "cmd.exe /c start \"\" \"" + formatMailto(subject, body) + "\"";
Runtime.getRuntime().exec(cmd);
}
}
</code></pre>
| [
{
"answer_id": 17389,
"author": "Dhaust",
"author_id": 242,
"author_profile": "https://Stackoverflow.com/users/242",
"pm_score": 2,
"selected": false,
"text": "<a href=\"mailto:someone@yoursite.com?subject=Mail from Our Site\">Email Us</a> \n"
},
{
"answer_id": 17394,
"author... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338/"
] |
17,376 | <p>I have a PHP script that runs as a CGI program and the HTTP <code>Authenticate</code> header gets eaten and spit out. So I would like to implement some kind of FORM based authentication. As an added constraint, there is no database so no session data can be stored.</p>
<p>I am very open to having a master username and password. I just need to protect the application from an intruder who doesn't know these credentials.</p>
<p>So how would you implement this?</p>
<p>Cookies?</p>
<p>I could present the form and if it validates, I can send back a cookie that is a hash of the IP address come secret code. Then I can prevent pages from rendering unless the thing decrypts correctly. But I have no idea how to implement that in PHP.</p>
| [
{
"answer_id": 31869,
"author": "John Douthat",
"author_id": 2774,
"author_profile": "https://Stackoverflow.com/users/2774",
"pm_score": 1,
"selected": false,
"text": "// At the top of your 'private' page(s):\nif($_SESSION['authenticated'] !== TRUE) {\n header('Location: /login.php');... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338/"
] |
17,387 | <p>I have a blogengine.net install that requires privatization.</p>
<p>I'm doing research work at the moment, but I have to keep my blog/journal private until certain conditions are met.</p>
<p>How can I privatize my blogEngine.net install so that readers must log in to read my posts?</p>
| [
{
"answer_id": 17392,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 0,
"selected": false,
"text": "<system.web>\n <authorization>\n <allow roles=\"Admin\" />\n <deny users=\"*\" />\n </authorization>\n</system.w... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209/"
] |
17,411 | <p>How can you make the display frames per second be independent from the game logic? That is so the game logic runs the same speed no matter how fast the video card can render. </p>
| [
{
"answer_id": 17415,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 2,
"selected": false,
"text": "int lastTime = GetCurrentTime();\nwhile(1) {\n // how long is it since we last updated?\n int currentTime = GetCurren... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
17,434 | <p>I have been reading through the <a href="http://yosefk.com/c++fqa/" rel="noreferrer">C++ FAQ</a> and was curious about the <a href="http://yosefk.com/c++fqa/friend.html" rel="noreferrer"><code>friend</code></a> declaration. I personally have never used it, however I am interested in exploring the language. </p>
<p>What is a good example of using <code>friend</code>?</p>
<hr>
<p>Reading the FAQ a bit longer I like the idea of the <code><<</code> <code>>></code> operator overloading and adding as a friend of those classes. However I am not sure how this doesn't break encapsulation. When can these exceptions stay within the strictness that is OOP?</p>
| [
{
"answer_id": 17443,
"author": "Andrew Grant",
"author_id": 1043,
"author_profile": "https://Stackoverflow.com/users/1043",
"pm_score": 9,
"selected": true,
"text": "friend"
},
{
"answer_id": 17505,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "ht... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716/"
] |
17,483 | <p>Is anyone aware of a language feature or technique in C++ to prevent a child class from over riding a particular method in the parent class?</p>
<pre><code>class Base {
public:
bool someGuaranteedResult() { return true; }
};
class Child : public Base {
public:
bool someGuaranteedResult() { return false; /* Haha I broke things! */ }
};
</code></pre>
<p>Even though it's not virtual, this is still allowed (at least in the Metrowerks compiler I'm using), all you get is a compile time warning about hiding non-virtual inherited function X.</p>
| [
{
"answer_id": 17485,
"author": "Ryan Fox",
"author_id": 55,
"author_profile": "https://Stackoverflow.com/users/55",
"pm_score": 0,
"selected": false,
"text": "Parent* obj = new Child();\n"
},
{
"answer_id": 17487,
"author": "Frank Krueger",
"author_id": 338,
"author_... | 2008/08/20 | [
"https://Stackoverflow.com/questions/17483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1366/"
] |
17,500 | <p>The <code>System.Windows.Threading.DispatcherObject</code> class (which <code>DependencyObject</code> is based on) contains a useful function, called <code>CheckAccess()</code>, that determines whether or not the code is running on the UI thread.</p>
<p>When I wanted to use it yesterday, I was puzzled to find out that Intellisense didn't show the function (nor <code>VerifyAccess()</code>, which throws an exception when not on the UI thread), even though the MSDN library lists it. I decided to investigate the class using Reflector. It seems that the function in question has an <code>EditorBrowsable(EditorBrowsableState.Never)</code> attribute attached to it. The <code>Dispatcher</code> class, which is used by <code>DispatcherObject</code>, has the same attribute attached to <code>CheckAccess()</code> and <code>VerifyAccess()</code>:</p>
<pre><code>public abstract class DispatcherObject
{
// ...
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CheckAccess();
[EditorBrowsable(EditorBrowsableState.Never)]
public void VerifyAccess();
// ...
[EditorBrowsable(EditorBrowsableState.Advanced)]
public Dispatcher Dispatcher { get; }
}
public sealed class Dispatcher
{
// ...
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CheckAccess();
[EditorBrowsable(EditorBrowsableState.Never)]
public void VerifyAccess();
// ...
}
</code></pre>
<p>I don't believe that the application of that attribute is random (or a joke), so my question is: why is it there? Should those methods not be called directly? Then why aren't they <code>protected</code> (or <code>internal</code>, like some of the most useful methods in the WPF)?</p>
| [
{
"answer_id": 17507,
"author": "Eric Haskins",
"author_id": 100,
"author_profile": "https://Stackoverflow.com/users/100",
"pm_score": 0,
"selected": false,
"text": "[EditorBrowsable(EditorBrowsableState.Never)]\npublic bool CheckAccess()\n{\n//CODE\n}\n"
}
] | 2008/08/20 | [
"https://Stackoverflow.com/questions/17500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2074/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.