qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
51,019 | <p>What does it mean when a <a href="http://en.wikipedia.org/wiki/PostgreSQL" rel="noreferrer">PostgreSQL</a> process is "idle in transaction"?</p>
<p>On a server that I'm looking at, the output of "ps ax | grep postgres" I see 9 PostgreSQL processes that look like the following:</p>
<pre><code>postgres: user db 127.0.0.1(55658) idle in transaction
</code></pre>
<p>Does this mean that some of the processes are hung, waiting for a transaction to be committed? Any pointers to relevant documentation are appreciated.</p>
| [
{
"answer_id": 51058,
"author": "Anonymoose",
"author_id": 2391,
"author_profile": "https://Stackoverflow.com/users/2391",
"pm_score": 7,
"selected": true,
"text": "idle in transaction"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] |
51,021 | <p>Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue.</p>
<p>Why do we have two?</p>
<p>When should you use one and not the other? </p>
| [
{
"answer_id": 8692077,
"author": "Jared Beck",
"author_id": 567762,
"author_profile": "https://Stackoverflow.com/users/567762",
"pm_score": 7,
"selected": false,
"text": "raise"
},
{
"answer_id": 27277044,
"author": "Mark Amery",
"author_id": 1709587,
"author_profile... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2653/"
] |
51,022 | <p>I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out there that I can use or should I just give happs another try?</p>
| [
{
"answer_id": 16232663,
"author": "agocorona",
"author_id": 2321205,
"author_profile": "https://Stackoverflow.com/users/2321205",
"pm_score": 2,
"selected": false,
"text": "module Main where\nimport MFlow.Wai.Blaze.Html.All\n\nmain= do\n addMessageFlows [(\"sum\", transient . runFlow... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] |
51,027 | <p>What are the other types of database systems out there. I've recently came across couchDB that handles data in a non relational way. It got me thinking about what other models are other people is using.</p>
<p>So, I want to know what other types of data model is out there. (I'm not looking for any specifics, just want to look at how other people are handling data storage, my interest are purely academic)</p>
<p>The ones I already know are:</p>
<ol>
<li>RDBMS (mysql,postgres etc..)</li>
<li>Document based approach (couchDB, lotus notes)</li>
<li>Key/value pair (BerkeleyDB) </li>
</ol>
| [
{
"answer_id": 2658647,
"author": "Stefano Borini",
"author_id": 78374,
"author_profile": "https://Stackoverflow.com/users/78374",
"pm_score": 1,
"selected": false,
"text": "start node ----relation----> end node \n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2976/"
] |
51,028 | <p>How do I create a background process with Haskell on windows without a visible command window being created?</p>
<p>I wrote a Haskell program that runs backup processes periodically but every time I run it, a command window opens up to the top of all the windows. I would like to get rid of this window. What is the simplest way to do this?</p>
| [
{
"answer_id": 51980,
"author": "Martin Del Vecchio",
"author_id": 5397,
"author_profile": "https://Stackoverflow.com/users/5397",
"pm_score": 0,
"selected": false,
"text": "SHELLEXECUTEINFO Info;\nBOOL b;\n\n// Execute it\nmemset (&Info, 0, sizeof (Info));\nInfo.cbSize = sizeof (Info);\... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] |
51,032 | <p>Consider these two function definitions:</p>
<pre><code>void foo() { }
void foo(void) { }
</code></pre>
<p>Is there any difference between these two? If not, why is the <code>void</code> argument there? Aesthetic reasons?</p>
| [
{
"answer_id": 51044,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 5,
"selected": false,
"text": "double atof();\n"
},
{
"answer_id": 51080,
"author": "DrPizza",
"author_id": 2131,
"author_profile": "h... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1597/"
] |
51,054 | <p>I am looking for a way to delete all files older than 7 days in a batch file. I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.</p>
<p>Similar things can be <a href="https://stackoverflow.com/questions/25785/delete-all-but-the-most-recent-x-files-in-bash">done in BASH</a> in just a couple lines of code. It seems that something at least remotely easy could be done for batch files in Windows. I'm looking for a solution that works in a standard Windows command prompt, without any extra utilities. Please no PowerShell or Cygwin either.</p>
| [
{
"answer_id": 51069,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 11,
"selected": true,
"text": "forfiles -p \"C:\\what\\ever\" -s -m *.* -d <number of days> -c \"cmd /c del @path\"\n"
},
{
"answer_id": 1322886,
"a... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862/"
] |
51,092 | <p>Consider the Oracle <code>emp</code> table. I'd like to get the employees with the top salary with <code>department = 20</code> and <code>job = clerk</code>. Also assume that there is no "empno" column, and that the primary key involves a number of columns. You can do this with:</p>
<pre><code>select * from scott.emp
where deptno = 20 and job = 'CLERK'
and sal = (select max(sal) from scott.emp
where deptno = 20 and job = 'CLERK')
</code></pre>
<p>This works, but I have to duplicate the test deptno = 20 and job = 'CLERK', which I would like to avoid. Is there a more elegant way to write this, maybe using a <code>group by</code>? BTW, if this matters, I am using Oracle.</p>
| [
{
"answer_id": 51103,
"author": "Mark Nold",
"author_id": 4134,
"author_profile": "https://Stackoverflow.com/users/4134",
"pm_score": 3,
"selected": true,
"text": "SELECT \n * \nFROM \n scott.emp\nWHERE \n (deptno,job,sal) IN\n (SELECT \n deptno,\n job,\n max(sal) \n FROM \n sco... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5295/"
] |
51,093 | <p>Jeff covered this a while back <a href="http://www.codinghorror.com/blog/archives/000811.html" rel="nofollow noreferrer">on his blog</a> in terms of 32 bit Vista.</p>
<p>Does the same 32 bit 4 GB memory cap that applies in 32 bit Vista apply to 32 bit Ubuntu? Are there any 32 bit operating systems that have creatively solved this problem?</p>
| [
{
"answer_id": 51100,
"author": "Rob Rolnick",
"author_id": 4798,
"author_profile": "https://Stackoverflow.com/users/4798",
"pm_score": 2,
"selected": false,
"text": "2^32 bits / 2^10 (bits per kb) / 2^10 (kb per mb) / 2^10 (mb per gb) = 2^2 = 4gb.\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] |
51,098 | <p>I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any concrete information on accessing and modifying another spreadsheet (this spreadsheet is located on a different LAN share also... the user has access to both, though).</p>
<p>Any help would be great. References on how to do this or something similar are just as good as concrete code samples.</p>
| [
{
"answer_id": 51111,
"author": "Michael Pryor",
"author_id": 245,
"author_profile": "https://Stackoverflow.com/users/245",
"pm_score": 4,
"selected": true,
"text": "Dim xl: Set xl = CreateObject(\"Excel.Application\")\nxl.Open \"\\\\the\\share\\file.xls\"\n\nDim ws: Set ws = xl.Workshee... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271/"
] |
51,108 | <p>I really enjoyed <a href="http://www.codinghorror.com/blog/archives/001148.html" rel="noreferrer">Jeff's post</a> on <a href="http://ssdl-wiki.cs.technion.ac.il/wiki/index.php/Spartan_programming" rel="noreferrer">Spartan Programming</a>. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with.</p>
<p>For years I have read about and adhered to the "one-expression-per-line" practice. I have fought the good fight and held my ground when many programming books countered this advice with example code like:</p>
<pre><code>while (bytes = read(...))
{
...
}
while (GetMessage(...))
{
...
}
</code></pre>
<p>Recently, I've advocated one expression per line for more practical reasons - debugging and production support. Getting a log file from production that claims a NullPointer exception at "line 65" which reads:</p>
<pre><code>ObjectA a = getTheUser(session.getState().getAccount().getAccountNumber());
</code></pre>
<p>is frustrating and entirely avoidable. Short of grabbing an expert with the code that can choose the "most likely" object that was null ... this is a real practical pain.</p>
<p>One expression per line also helps out quite a bit while stepping through code. I practice this with the assumption that most modern compilers can optimize away all the superfluous temp objects I've just created ...</p>
<p>I try to be neat - but cluttering my code with explicit objects sure feels laborious at times. It does not generally make the code easier to browse - but it really has come in handy when tracing things down in production or stepping through my or someone else's code.</p>
<p>What style do <em>you</em> advocate and can you rationalize it in a practical sense?</p>
| [
{
"answer_id": 51182,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 2,
"selected": false,
"text": "ObjectA a = getTheUser(session.getState().getAccount().getAccountNumber());\n"
},
{
"answer_id": 51484,
"author... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4910/"
] |
51,109 | <p>When using custom-draw (NM_CUSTOMDRAW) to draw the entire contents of a ListView SubItem (in Report/Details view), it would be nice to be able to apply the same left and right
padding in my custom paint method that is applied by the control itself for non-custom-drawn items.</p>
<p>Is there a way to programmatically retrieve this padding value? Is it
related to the width of a particular character (" " or "w" or something?) or
is it a fixed value (6px on left and 3px on right or something) or...?</p>
<p>EDIT: To clarify, <strong>I want to add the same padding to my NM_CUSTOMDRAWn SubItems that the control adds to items that it draws</strong>, and the metric that I'm looking for, for example, is the white space between the beginning of the 2nd column and the word "Siamese" in the following screenshot (<em>Note: screenshot from MSDN added to help explain my question</em>):</p>
<p><a href="https://i.stack.imgur.com/yTHoy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yTHoy.png" alt="List View in Report View" /></a><br />
<sub>(source: <a href="https://msdn.microsoft.com/Bb774735.lv_detailsview(en-us,VS.85).png" rel="nofollow noreferrer">microsoft.com</a>)</sub></p>
<p>Note that the word "Siamese" is aligned with the header item ("Breed"). I would like to be able to guarantee the same alignment for custom-drawn items.</p>
| [
{
"answer_id": 8448191,
"author": "Patrick",
"author_id": 1090057,
"author_profile": "https://Stackoverflow.com/users/1090057",
"pm_score": 1,
"selected": false,
"text": "LVCOLUMN myLVCOLUMN;\nmyLVCOLUMN.mask=LVCF_FMT;\nListView_GetColumn(hwnd,nCol,&myLVCOLUMN);\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309/"
] |
51,113 | <p>It seems like IDataReader.Read() is always true at least one time (If I'm wrong about this let me know.) So how do you tell if it has no records without just wrapping it in a try/catch?</p>
| [
{
"answer_id": 51120,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 5,
"selected": false,
"text": "if(dr.Read())\n{\n //do stuff\n}\nelse\n{\n //it's empty\n}\n"
},
{
"answer_id": 51121,
"author": "JamesS... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4541/"
] |
51,129 | <p>In C#, if I need to open an HTTP connection, download XML and get one value from the result, how would I do that?</p>
<p>For consistency, imagine the webservice is at www.webservice.com and that if you pass it the POST argument fXML=1 it gives you back </p>
<pre><code><xml><somekey>somevalue</somekey></xml>
</code></pre>
<p>I'd like it to spit out "somevalue".</p>
| [
{
"answer_id": 51143,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "var client = new WebClient();\nvar response = client.UploadValues(\"www.webservice.com\", \"POST\", new NameValueCollection {{\"f... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245/"
] |
51,139 | <p>I'm trying to create an SSIS package that takes data from an XML data source and for each row inserts another row with some preset values. Any ideas? I'm thinking I could use a DataReader source to generate the preset values by doing the following:</p>
<pre><code>SELECT 'foo' as 'attribute1', 'bar' as 'attribute2'
</code></pre>
<p>The question is, how would I insert one row of this type for every row in the XML data source?</p>
| [
{
"answer_id": 51158,
"author": "Tadmas",
"author_id": 3750,
"author_profile": "https://Stackoverflow.com/users/3750",
"pm_score": 2,
"selected": false,
"text": "\"foo\""
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4550/"
] |
51,148 | <p>I have C# winforms application that needs to start an external exe from time to time, but I do not wish to start another process if one is already running, but rather switch to it.</p>
<p>So how in C# would I so this in the example below?</p>
<pre><code>using System.Diagnostics;
...
Process foo = new Process();
foo.StartInfo.FileName = @"C:\bar\foo.exe";
foo.StartInfo.Arguments = "Username Password";
bool isRunning = //TODO: Check to see if process foo.exe is already running
if (isRunning)
{
//TODO: Switch to foo.exe process
}
else
{
foo.Start();
}
</code></pre>
| [
{
"answer_id": 51149,
"author": "DaveK",
"author_id": 4244,
"author_profile": "https://Stackoverflow.com/users/4244",
"pm_score": 6,
"selected": true,
"text": "//Namespaces we need to use\nusing System.Diagnostics;\n\npublic bool IsProcessOpen(string name)\n{\n //here we're going to g... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292/"
] |
51,150 | <p>When an application is behind another applications and
I click on my application's taskbar icon, I expect the entire application to
come to the top of the z-order, even if an app-modal, WS_POPUP dialog box is
open.</p>
<p>However, some of the time, for some of my (and others') dialog boxes, only the dialog box comes to the front; the rest of the application stays behind.</p>
<p>I've looked at Spy++ and for the ones that work correctly, I can see
WM_WINDOWPOSCHANGING being sent to the dialog's parent. For the ones that
leave the rest of the application behind, WM_WINDOWPOSCHANGING is not being
sent to the dialog's parent.</p>
<p>I have an example where one dialog usually brings the whole app with it and the other does not. Both the working dialog box and the non-working dialog box have the same window style, substyle, parent, owner, ontogeny.</p>
<p>In short, both are WS_POPUPWINDOW windows created with DialogBoxParam(),
having passed in identical HWNDs as the third argument.</p>
<p>Has anyone else noticed this behavioral oddity in Windows programs? What messages does the TaskBar send to the application when I click its button? Who's responsibility is it to ensure that <em>all</em> of the application's windows come to the foreground?</p>
<p>In my case the base parentage is an MDI frame...does that factor in somehow?</p>
| [
{
"answer_id": 1777881,
"author": "P Daddy",
"author_id": 36388,
"author_profile": "https://Stackoverflow.com/users/36388",
"pm_score": 3,
"selected": false,
"text": "INT_PTR DialogBox(\n HINSTANCE hInstance,\n LPCTSTR lpTemplate,\n HWND hWndParent, /* this is the owner */\... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5309/"
] |
51,156 | <p>Say I have a list as follows:</p>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<p>Is there a CSS selector that will allow me to directly select the last item of a list? In this case item 3.</p>
<p>Cheers!</p>
| [
{
"answer_id": 13222550,
"author": "OZZIE",
"author_id": 846348,
"author_profile": "https://Stackoverflow.com/users/846348",
"pm_score": 2,
"selected": false,
"text": "last-of-type"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/131/"
] |
51,165 | <p>I have a list of objects I wish to sort based on a field <code>attr</code> of type string. I tried using <code>-</code></p>
<pre><code>list.sort(function (a, b) {
return a.attr - b.attr
})
</code></pre>
<p>but found that <code>-</code> doesn't appear to work with strings in JavaScript. How can I sort a list of objects based on an attribute with type string?</p>
| [
{
"answer_id": 51169,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 11,
"selected": true,
"text": "String.prototype.localeCompare"
},
{
"answer_id": 51170,
"author": "airportyh",
"author_id": 5304,
"author_pr... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] |
51,180 | <p>I'm tearing my hair out with this one. If I start a block comment <code>/*</code> in VS.NET 2005+ then carriage return, Visual Studio insists that I have another asterisk <code>*</code>. I know there's an option to turn this off but I just can't find it. Anyone know how to turn this feature off?</p>
| [
{
"answer_id": 51194,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 6,
"selected": true,
"text": "Text Editor > C# > Advanced > Generate XML documentation comments for ///\n"
},
{
"answer_id": 8235889,
"author"... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4458/"
] |
51,185 | <p>Does javascript use immutable or mutable strings? Do I need a "string builder"?</p>
| [
{
"answer_id": 51199,
"author": "Ash",
"author_id": 5023,
"author_profile": "https://Stackoverflow.com/users/5023",
"pm_score": 5,
"selected": false,
"text": "Array.Join()"
},
{
"answer_id": 4717855,
"author": "Ruan Mendes",
"author_id": 227299,
"author_profile": "htt... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220/"
] |
51,195 | <p>I want to write a little "DBQuery" function in perl so I can have one-liners which send an SQL statement and receive back and an array of hashes, i.e. a recordset. However, I'm running into an issue with Perl syntax (and probably some odd pointer/reference issue) which is preventing me from packing out the information from the hash that I'm getting from the database. The sample code below demonstrates the issue.</p>
<p>I can get the data "Jim" out of a hash inside an array with this syntax:</p>
<pre><code>print $records[$index]{'firstName'}
</code></pre>
<p>returns "Jim"</p>
<p>but if I copy the hash record in the array to its own hash variable first, then I strangely can't access the data anymore in that hash:</p>
<pre><code>
%row = $records[$index];
$row{'firstName'};
</code></pre>
<p>returns "" (blank)</p>
<p>Here is the full sample code showing the problem. Any help is appreciated:</p>
<pre><code>
my @records = (
{'id' => 1, 'firstName' => 'Jim'},
{'id' => 2, 'firstName' => 'Joe'}
);
my @records2 = ();
$numberOfRecords = scalar(@records);
print "number of records: " . $numberOfRecords . "\n";
for(my $index=0; $index < $numberOfRecords; $index++) {
#works
print 'you can print the records like this: ' . $records[$index]{'firstName'} . "\n";
#does NOT work
%row = $records[$index];
print 'but not like this: ' . $row{'firstName'} . "\n";
}
</code></pre>
| [
{
"answer_id": 51205,
"author": "Commodore Jaeger",
"author_id": 4659,
"author_profile": "https://Stackoverflow.com/users/4659",
"pm_score": 6,
"selected": true,
"text": "# Will work (the -> dereferences the reference)\n$row = $records[$index];\nprint \"This will work: \", $row->{firstNa... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] |
51,210 | <p>I'm playing with the routing.rb code in Rails 2.1, and trying to to get it to the point where I can do something useful with the RoutingError exception that is thrown when it can't find the appropriate path.</p>
<p>This is a somewhat tricky problem, because there are some class of URLs which are just plain BAD: the /azenv.php bot attacks, the people typing /bar/foo/baz into the URL, etc... we don't want that.</p>
<p>Then there's subtle routing problems, where we do want to be notified: /artists/ for example, or ///. In these situations, we may want an error being thrown, or not... or we get Google sending us URLs which used to be valid but are no longer because people deleted them.</p>
<p>In each of these situations, I want a way to contain, analyze and filter the path that we get back, or at least some Railsy way to manage routing past the normal 'fallback catchall' url. Does this exist?</p>
<p>EDIT:</p>
<p>So the code here is: </p>
<pre><code># File vendor/rails/actionpack/lib/action_controller/rescue.rb, line 141
def rescue_action_without_handler(exception)
log_error(exception) if logger
erase_results if performed?
# Let the exception alter the response if it wants.
# For example, MethodNotAllowed sets the Allow header.
if exception.respond_to?(:handle_response!)
exception.handle_response!(response)
end
if consider_all_requests_local || local_request?
rescue_action_locally(exception)
else
rescue_action_in_public(exception)
end
end
</code></pre>
<p>So our best option is to override log_error(exception) so that we can filter down the exceptions according to the exception. So in ApplicationController</p>
<pre><code>def log_error(exception)
message = '...'
if should_log_exception_as_debug?(exception)
logger.debug(message)
else
logger.error(message)
end
end
def should_log_exception_as_debug?(exception)
return (ActionController::RoutingError === exception)
end
</code></pre>
<p>Salt for additional logic where we want different controller logic, routes, etc.</p>
| [
{
"answer_id": 71601,
"author": "0124816",
"author_id": 11521,
"author_profile": "https://Stackoverflow.com/users/11521",
"pm_score": 2,
"selected": false,
"text": "map.connect '*', :controller => 'error', :action => 'not_found'\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5266/"
] |
51,212 | <p>I am writing a little application to download files over http (as, for example, described <a href="https://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python#22776">here</a>).</p>
<p>I also want to include a little download progress indicator showing the percentage of the download progress.</p>
<p>Here is what I came up with:</p>
<pre>
sys.stdout.write(rem_file + "...")
urllib.urlretrieve(rem_file, loc_file, reporthook=dlProgress)
def dlProgress(count, blockSize, totalSize):
percent = int(count*blockSize*100/totalSize)
sys.stdout.write("%2d%%" % percent)
sys.stdout.write("\b\b\b")
sys.stdout.flush()
</pre>
<p>Output: MyFileName... 9%</p>
<p>Any other ideas or recommendations to do this? </p>
<p>One thing that's somewhat annoying is the blinking cursor in the terminal on the first digit of the percentage. Is there a way to prevent this? Is there a way to hide the cursor?</p>
<p><strong>EDIT:</strong></p>
<p>Here a better alternative using a global variable for the filename in dlProgress and the '\r' code:</p>
<pre>
global rem_file # global variable to be used in dlProgress
urllib.urlretrieve(rem_file, loc_file, reporthook=dlProgress)
def dlProgress(count, blockSize, totalSize):
percent = int(count*blockSize*100/totalSize)
sys.stdout.write("\r" + rem_file + "...%d%%" % percent)
sys.stdout.flush()
</pre>
<p>Output: MyFileName...9% </p>
<p>And the cursor shows up at the END of the line. Much better.</p>
| [
{
"answer_id": 51214,
"author": "hazzen",
"author_id": 5066,
"author_profile": "https://Stackoverflow.com/users/5066",
"pm_score": 2,
"selected": false,
"text": "curses"
},
{
"answer_id": 51218,
"author": "Commodore Jaeger",
"author_id": 4659,
"author_profile": "https... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386/"
] |
51,217 | <p>I work for a company whose primary business is not software related. Most documentation for using source control is written with a development team writing for commercial or open source projects in mind. As someone who writes in house software I can say that work is done differently then it would be in a commercial or open source setting. In addition there are stored procedures and database scripts that need to be kept in sync with the code.</p>
<p>In particular I am looking to get suggestions on how best to structure the repository with in house software in mind. Most documentation suggests trunk, branches, tags etc. And procedures for keeping production, test and development environments in sync with their respective sections in the repository etc. </p>
| [
{
"answer_id": 51248,
"author": "David Crow",
"author_id": 2783,
"author_profile": "https://Stackoverflow.com/users/2783",
"pm_score": 2,
"selected": false,
"text": "/first-project/trunk\n/first-project/branches\n/first-project/tags\n/another-project/trunk\n/another-project/branches\n/an... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] |
51,224 | <p>I'm trying to write a regular expression that validates a date. The regex needs to match the following</p>
<ul>
<li>M/D/YYYY</li>
<li>MM/DD/YYYY</li>
<li>Single digit months can start with a leading zero (eg: 03/12/2008)</li>
<li>Single digit days can start with a leading zero (eg: 3/02/2008)</li>
<li>CANNOT include February 30 or February 31 (eg: 2/31/2008)</li>
</ul>
<p>So far I have </p>
<pre><code>^(([1-9]|1[012])[-/.]([1-9]|[12][0-9]|3[01])[-/.](19|20)\d\d)|((1[012]|0[1-9])(3[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[-/.](3[01]|2\d|1\d|0[1-9])[-/.](19|20)\d\d)$
</code></pre>
<p>This matches properly EXCEPT it still includes 2/30/2008 & 2/31/2008.</p>
<p>Does anyone have a better suggestion?</p>
<p><strong>Edit:</strong> I found <a href="http://regexlib.com/REDetails.aspx?regexp_id=112" rel="noreferrer">the answer</a> on RegExLib</p>
<pre><code>^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$
</code></pre>
<p>It matches all valid months that follow the MM/DD/YYYY format.</p>
<p>Thanks everyone for the help.</p>
| [
{
"answer_id": 51231,
"author": "Chris Conway",
"author_id": 1412,
"author_profile": "https://Stackoverflow.com/users/1412",
"pm_score": 8,
"selected": true,
"text": "[0-9]{2}/[0-9]{2}/[0-9]{4}\n"
},
{
"answer_id": 51236,
"author": "Chris Conway",
"author_id": 1412,
"... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3742/"
] |
51,233 | <p>How can I retrieve the page title of a webpage (title html tag) using Python?</p>
| [
{
"answer_id": 51240,
"author": "Peter Hoffmann",
"author_id": 720,
"author_profile": "https://Stackoverflow.com/users/720",
"pm_score": 7,
"selected": true,
"text": "import lxml.html\nt = lxml.html.parse(url)\nprint(t.find(\".//title\").text)\n"
},
{
"answer_id": 51242,
"aut... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386/"
] |
51,238 | <p>I have a table in a MySql database that stores user accounts. One of the columns, expires, stores an expiration date but defaults to NULL. I need to be able to remove an expiration date and set it back to the default value.</p>
<p>Currently, all of my CRUD routines are written using MySqlCommand with parameters. Can this be done directly with a MySqlParameter, or do I have to create an alternate command object to handle this eventuality?</p>
| [
{
"answer_id": 51257,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 0,
"selected": false,
"text": "command.AddWithValue(\"@param\", DbNull.Value);\n\nor\n\ncommand.Parameters.Add(\"@param\", <data type>).Value = DBNull.Value;\n"... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249/"
] |
51,262 | <p>How can you find out what are the long running queries are on Informix database server? I have a query that is using up the CPU and want to find out what the query is.</p>
| [
{
"answer_id": 52121,
"author": "Jason Navarrete",
"author_id": 3920,
"author_profile": "https://Stackoverflow.com/users/3920",
"pm_score": -1,
"selected": false,
"text": "SELECT ELAPSED_TIME_MIN,SUBSTR(AUTHID,1,10) AS AUTH_ID, \nAGENT_ID, APPL_STATUS,SUBSTR(STMT_TEXT,1,20) AS SQL_TEXT\n... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486/"
] |
51,264 | <p>What object do you query against to select all the table names in a schema in Oracle?</p>
| [
{
"answer_id": 51265,
"author": "jatanp",
"author_id": 959,
"author_profile": "https://Stackoverflow.com/users/959",
"pm_score": -1,
"selected": false,
"text": "select tabname from tabs \n"
},
{
"answer_id": 51285,
"author": "Matthew Watson",
"author_id": 3839,
"autho... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] |
51,269 | <p>I am not sure whether is it possible to change attribute's parameter during runtime? For example, inside an assembly I have the following class</p>
<pre><code>public class UserInfo
{
[Category("change me!")]
public int Age
{
get;
set;
}
[Category("change me!")]
public string Name
{
get;
set;
}
}
</code></pre>
<p>This is a class that is provided by a third party vendor and <strong>I can't change the code</strong>. But now I found that the above descriptions are not accurate, and I want to change the "change me" category name to something else when i bind an instance of the above class to a property grid.</p>
<p>May I know how to do this?</p>
| [
{
"answer_id": 51282,
"author": "Glenn Slaven",
"author_id": 2975,
"author_profile": "https://Stackoverflow.com/users/2975",
"pm_score": 5,
"selected": false,
"text": "ASCII[] attrs1=(ASCII[])\n typeof(MyClass).GetCustomAttributes(typeof(ASCII), false);\n"
},
{
"answer_id": 27... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] |
51,283 | <p>How do you get around this Ajax cross site scripting problem on FireFox 3?</p>
| [
{
"answer_id": 679034,
"author": "Jose M Vidal",
"author_id": 8484,
"author_profile": "https://Stackoverflow.com/users/8484",
"pm_score": 3,
"selected": false,
"text": "try {\n if (netscape.security.PrivilegeManager.enablePrivilege)\n netscape.security.PrivilegeManager.enablePr... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5321/"
] |
51,296 | <p>So I'm running PPP under linux with a cellular modem. The program I'm writing needs to know if the link is active before sending any data.</p>
<p>What are my options to check</p>
<ul>
<li>if the link is available</li>
<li>if it routes to a server I control (it doesn't go to the internet as I said earlier)</li>
</ul>
<p>Also, what is the best way to restart it - I'd like to have program control over when it starts and stops, so I assume an init.d isn't appropriate. Using <code>system()</code> doesn't seem to give a PID, are there other options besides <code>fork()</code> and the gaggle of <code>exec??()</code> calls?</p>
<p>C on Linux on ARM (custom distribution using buildroot).</p>
| [
{
"answer_id": 51313,
"author": "T Percival",
"author_id": 954,
"author_profile": "https://Stackoverflow.com/users/954",
"pm_score": 2,
"selected": false,
"text": "/proc/net/route"
},
{
"answer_id": 160334,
"author": "camh",
"author_id": 23744,
"author_profile": "http... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] |
51,311 | <p>I am about to start a new project and would like to document its development in a very simple blog.</p>
<p>My requirements are:</p>
<ul>
<li>self-hosted on my Gentoo-based LAMP stack (that seems to rule out blogger)</li>
<li>Integration in a django based website (as in www.myproject.com/about, www.myproject.com/blog etc rather than www.myproject.com and a totally different site at blog.myproject.com)</li>
<li>very little or no learning curve <i>that's specific to the blog engine</i> (don't want to learn an API just to blog, but having to get deeper into Django to be able to roll my own would be OK) According to the answers so far, there is a chance that this excludes Wordpress</li>
</ul>
<p>Should I</p>
<p>a) install blog engine X (please specify X)</p>
<p>b) use django to hand-roll a way to post new entries and a page on my website to display the posts in descending chronological order</p>
| [
{
"answer_id": 51343,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 3,
"selected": false,
"text": "grep"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] |
51,320 | <p>For a project I'm working on. I need to look for an executable on the filesystem. For UNIX derivatives, I assume the user has the file in the mighty $PATH variable, but there is no such thing on Windows.</p>
<p>I can safely assume the file is at most 2 levels deep into the filesystem, but I don't know on what drive it will be. I have to try all drives, but I can't figure out how to list all available drives (which have a letter assigned to it).</p>
<p>Any help?</p>
<p><strong>EDIT:</strong> I know there is a %PATH% variable, but it is not as integrated as in UNIX systems. For instance, the application I'm looking for is OpenOffice. Such software would not be in %PATH%, typically.</p>
| [
{
"answer_id": 51327,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": -1,
"selected": false,
"text": "PATH"
},
{
"answer_id": 51331,
"author": "Tony BenBrahim",
"author_id": 80075,
"author_profile": "ht... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2018/"
] |
51,339 | <p>I'm a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL:</p>
<pre><code>SELECT f.*
FROM Foo f
WHERE f.FooId IN (
SELECT fb.FooId
FROM FooBar fb
WHERE fb.BarId = 1000
)
</code></pre>
<p>Any help would be gratefully received.</p>
| [
{
"answer_id": 51345,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 2,
"selected": false,
"text": "// create a Dictionary / Set / Collection fids first\nvar fids = (from fb in FooBar\n where fb.BarID = 1000\n... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1904/"
] |
51,352 | <p>I'm currently working on a web application which has a page which displays a single chart (a .png image). On another part of this page there are a set of links which, when clicked, the entire page reloads and looks exactly the same as before except for the chart in the middle of the page.</p>
<p>What I want to do is when a link is clicked on a page just the chart on the page is changed. This will speed things up tremendously as the page is roughly 100kb large, and don't really want to reload the entire page just to display this. </p>
<p>I've been doing this via JavaScript, which works so far, using the following code</p>
<pre><code>document.getElementById('chart').src = '/charts/10.png';
</code></pre>
<p>The problem is that when the user clicks on the link, it may take a couple of seconds before the chart changes. This makes the user think that their click hasn't done anything, or that the system is slow to respond.</p>
<p>What I want to happen is display a spinner / throbber / status indicator, in place of where the image is while it is loading, so when the user clicks the link they know at least the system has taken their input and is doing something about it. </p>
<p>I've tried a few suggestions, even using a psudo time out to show a spinner, and then flick back to the image. </p>
<p>A good suggestion I've had is to use the following</p>
<pre><code><img src="/charts/10.png" lowsrc="/spinner.gif"/>
</code></pre>
<p>Which would be ideal, except the spinner is significantly smaller than the chart which is being displayed.</p>
<p>Any other ideas?</p>
| [
{
"answer_id": 51368,
"author": "Ian",
"author_id": 4396,
"author_profile": "https://Stackoverflow.com/users/4396",
"pm_score": 3,
"selected": false,
"text": "<div> <img src=\"spinner.gif\" id=\"spinnerImg\" style=\"display: none;\" /></div>\n"
},
{
"answer_id": 52597,
"... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3847/"
] |
51,363 | <p>I've encountered multiple third party .Net component-vendors that use a licensing scheme. On an evaluation copy, the components show up with a nag-screen or watermark or some such indicator. On a licensed machine, a <strong>Licenses.licx</strong> is created - with what appears to be <em>just</em> the assembly full name/identifiers. This file has to be included when the client assembly is built.</p>
<ul>
<li>How does this model work? Both from component-vendors' and users' perspective.</li>
<li>What is the .licx file used for? Should it be checked in? <em>We've had a number of issues with the wrong/right .licx file being checked in and what not</em></li>
</ul>
| [
{
"answer_id": 8333581,
"author": "Denis",
"author_id": 400589,
"author_profile": "https://Stackoverflow.com/users/400589",
"pm_score": 3,
"selected": false,
"text": "TXTextControl.TextControl, TXTextControl, Version=15.0.700.500, Culture=neutral, PublicKeyToken=6b83fe9a75cfb638\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] |
51,380 | <p>The <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInput.html#skipBytes(int)" rel="noreferrer">Sun Documentation for DataInput.skipBytes</a> states that it "makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. However, it may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility."</p>
<ol>
<li><p>Other than reaching end of file, why might <code>skipBytes()</code> not skip the right number of bytes? (The <code>DataInputStream</code> I am using will either be wrapping a <code>FileInputStream</code> or a <code>PipedInputStream</code>.)</p></li>
<li><p>If I definitely want to skip n bytes and throw an <code>EOFException</code> if this causes me to go to the end of the file, should I use <code>readFully()</code> and ignore the resulting byte array? Or is there a better way?</p></li>
</ol>
| [
{
"answer_id": 3977877,
"author": "Will",
"author_id": 328178,
"author_profile": "https://Stackoverflow.com/users/328178",
"pm_score": 2,
"selected": false,
"text": "int byteOffsetX = someNumber; //n bytes to skip\nint nSkipped = 0;\n\nnSkipped = in.skipBytes(byteOffsetX);\nwhile (nSkipp... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4728/"
] |
51,407 | <p>I want to load a desktop application, via reflection, as a Control inside another application.</p>
<p>The application I'm reflecting is a legacy one - I can't make changes to it.</p>
<p>I can dynamically access the Form, but can't load it as a Control.</p>
<p>In .Net Form expands on Control, and I can assign the reflected Form as a Control, but it throws a run-time exception.</p>
<p>Forms cannot be loaded as controls.</p>
<p>Is there any way to convert the form to a control? </p>
| [
{
"answer_id": 51433,
"author": "Andrew",
"author_id": 826,
"author_profile": "https://Stackoverflow.com/users/826",
"pm_score": 4,
"selected": true,
"text": "// setup the new form\nform.TopLevel = false;\nform.FormBorderStyle = FormBorderStyle.None;\nform.Dock = DockStyle.Fill;\nform.Sh... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] |
51,412 | <p>Say I have the following methods:</p>
<pre><code>def methodA(arg, **kwargs):
pass
def methodB(arg, *args, **kwargs):
pass
</code></pre>
<p>In methodA I wish to call methodB, passing on the kwargs. However, it seems that if I define <code>methodA</code> as follows, the second argument will be passed on as positional rather than named variable arguments.</p>
<pre><code>def methodA(arg, **kwargs):
methodB("argvalue", kwargs)
</code></pre>
<p>How do I make sure that the **kwargs in methodA gets passed as **kwargs to methodB?</p>
| [
{
"answer_id": 51415,
"author": "Cristian",
"author_id": 680,
"author_profile": "https://Stackoverflow.com/users/680",
"pm_score": 6,
"selected": true,
"text": "methodB(\"argvalue\", **kwargs)\n"
},
{
"answer_id": 63943,
"author": "Sebastian Rittau",
"author_id": 7779,
... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3355/"
] |
51,420 | <p>I want to get the base 10 logarithm of a Fixnum using Ruby, but found that n.log or n.log10 are not defined. Math::log is defined but uses a different base than 10.</p>
<p>What is the easiest way to get the base 10 logarithm of a Fixnum?</p>
| [
{
"answer_id": 51423,
"author": "Wes Oldenbeuving",
"author_id": 4187,
"author_profile": "https://Stackoverflow.com/users/4187",
"pm_score": 2,
"selected": false,
"text": "Math::log10(n) \n"
},
{
"answer_id": 51426,
"author": "Slartibartfast",
"author_id": 4433,
"auth... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4187/"
] |
51,429 | <p>Can anyone give me some pointers on how to display the results of an XPath query in a textbox using code (C#)? My datascource <i>seems</i> to (re)bind correctly once the XPath query has been applied, but I cannot find how to get at the resulting data.<br /><br />
Any help would be greatly appreciated.</p>
| [
{
"answer_id": 51514,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "protected void ddl_SelectedIndexChanged(object sender, EventArgs e)\n{\n XMLds.XPath = \"/controls/control[@id='AuthorityTyp... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
51,438 | <p>How do you get a Media Type (MIME type) from a file using Java? So far I've tried JMimeMagic & Mime-Util. The first gave me memory exceptions, the second doesn't close its streams properly.</p>
<p>How would you probe the file to determine its actual type (not merely based on the extension)?</p>
| [
{
"answer_id": 847849,
"author": "Joshua Fox",
"author_id": 39242,
"author_profile": "https://Stackoverflow.com/users/39242",
"pm_score": 8,
"selected": false,
"text": "mimeType = file.toURL().openConnection().getContentType();\n"
},
{
"answer_id": 1902146,
"author": "Adam Ho... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1900/"
] |
51,462 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c">How to properly clean up Excel interop objects in C#</a> </p>
</blockquote>
<p>Suppose a ASP.NET web application generates automated Excel Reports on the server. How do we kill a server-side Excel.EXE once the processing is over. I am raising this purposely, because I believe that the Garbage Collecter does not clean the Excel executable even after the Excel file is closed.</p>
<p>Any pointers would be helpful?</p>
| [
{
"answer_id": 51467,
"author": "Mark Ingram",
"author_id": 986,
"author_profile": "https://Stackoverflow.com/users/986",
"pm_score": 2,
"selected": false,
"text": "> taskkill excel.exe\n"
},
{
"answer_id": 51468,
"author": "Biri",
"author_id": 968,
"author_profile": ... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4021/"
] |
51,470 | <p>In <a href="http://en.wikipedia.org/wiki/PostgreSQL" rel="noreferrer">PostgreSQL</a>, I can do something like this:</p>
<pre><code>ALTER SEQUENCE serial RESTART WITH 0;
</code></pre>
<p>Is there an Oracle equivalent?</p>
| [
{
"answer_id": 51482,
"author": "Mo.",
"author_id": 1870,
"author_profile": "https://Stackoverflow.com/users/1870",
"pm_score": 7,
"selected": false,
"text": "ALTER SEQUENCE serial INCREMENT BY -400;\nSELECT serial.NEXTVAL FROM dual;\nALTER SEQUENCE serial INCREMENT BY 1;\n"
},
{
... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/917/"
] |
51,492 | <p>For me <strong>usable</strong> means that:</p>
<ul>
<li>it's being used in real-wold</li>
<li>it has tools support. (at least some simple editor)</li>
<li>it has human readable syntax (no angle brackets please) </li>
</ul>
<p>Also I want it to be as close to XML as possible, i.e. there must be support for attributes as well as for properties. So, no <a href="http://en.wikipedia.org/wiki/YAML" rel="noreferrer">YAML</a> please. Currently, only one matching language comes to my mind - <a href="http://en.wikipedia.org/wiki/JSON" rel="noreferrer">JSON</a>. Do you know any other alternatives?</p>
| [
{
"answer_id": 2567924,
"author": "Ari",
"author_id": 307804,
"author_profile": "https://Stackoverflow.com/users/307804",
"pm_score": 7,
"selected": true,
"text": "<!-- XML -->\n<Director name=\"Spielberg\">\n <Movies>\n <Movie title=\"Jaws\" year=\"1975\"/>\n <Movie tit... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196/"
] |
51,499 | <p>One I am aware of is <a href="http://search.cpan.org/dist/Perl-Critic/" rel="nofollow noreferrer">Perl::Critic</a></p>
<p>And my googling has resulted in no results on multiple attempts so far. :-(</p>
<p>Does anyone have any recommendations here?</p>
<p>Any resources to configure Perl::Critic as per our coding standards and run it on code base would be appreciated.</p>
| [
{
"answer_id": 62714,
"author": "Elliot Shank",
"author_id": 6825,
"author_profile": "https://Stackoverflow.com/users/6825",
"pm_score": 5,
"selected": true,
"text": "perlcritic --profile-proto"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406/"
] |
51,502 | <p>I've been really enjoying Python programming lately. I come from a background of a strong love for C-based coding, where everything is perhaps more complicated than it should be (but puts hair on your chest, at least). So switching from C to Python for more complex things that don't require tons of speed has been more of a boon than a bane in writing projects.</p>
<p>However, coming from this land of brackets and parentheses and structs as far as the naked eye can see, I come across a small problem: I find Python difficult to read.</p>
<p>For example, the following block of text is hard for me to decipher unless I stare at it (which I dislike doing):</p>
<pre><code>if foo:
bar = baz
while bar not biz:
bar = i_am_going_to_find_you_biz_i_swear_on_my_life()
did_i_not_warn_you_biz()
my_father_is_avenged()
</code></pre>
<p>The problem occurs at the end of that if block: all the tabbing and then suddenly returning to a jarring block feels almost disturbing. As a solution, I've started coding my Python like this:</p>
<pre><code>if foo:
bar = baz
while bar not biz:
bar = i_am_going_to_find_you_biz_i_swear_on_my_life()
#-- while --
#-- if --
did_i_not_warn_you_biz()
my_father_is_avenged()
</code></pre>
<p>And this, for some odd reason, makes me more able to read my own code. But I'm curious: has anyone else with my strange problem found easier ways to make their tabbed-out code more readable? I'd love to find out if there's a better way to do this before this becomes a huge habit for me.</p>
| [
{
"answer_id": 51551,
"author": "Will Harris",
"author_id": 4702,
"author_profile": "https://Stackoverflow.com/users/4702",
"pm_score": 4,
"selected": false,
"text": "if foo:\n bar = baz\n\n while bar not biz:\n bar = i_am_going_to_find_you_biz_i_swear_on_my_life()\n\ndid_i_not_... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5342/"
] |
51,520 | <p>Given a path such as <code>"mydir/myfile.txt"</code>, how do I find the file's absolute path in Python? E.g. on Windows, I might end up with:</p>
<pre><code>"C:/example/cwd/mydir/myfile.txt"
</code></pre>
| [
{
"answer_id": 51523,
"author": "sherbang",
"author_id": 5026,
"author_profile": "https://Stackoverflow.com/users/5026",
"pm_score": 11,
"selected": true,
"text": ">>> import os\n>>> os.path.abspath(\"mydir/myfile.txt\")\n'C:/example/cwd/mydir/myfile.txt'\n"
},
{
"answer_id": 584... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974/"
] |
51,526 | <p>I have a list of structs and I want to change one element. For example :</p>
<pre><code>MyList.Add(new MyStruct("john");
MyList.Add(new MyStruct("peter");
</code></pre>
<p>Now I want to change one element:</p>
<pre><code>MyList[1].Name = "bob"
</code></pre>
<p>However, whenever I try and do this I get the following error:</p>
<blockquote>
<p>Cannot modify the return value of
System.Collections.Generic.List.this[int]‘ because it is not
a variable</p>
</blockquote>
<p>If I use a list of classes, the problem doesn't occur.</p>
<p>I guess the answer has to do with structs being a value type.</p>
<p>So, if I have a list of structs should I treat them as <em>read-only</em>? If I need to change elements in a list then I should use classes and not structs?</p>
| [
{
"answer_id": 51537,
"author": "Andrew",
"author_id": 1948,
"author_profile": "https://Stackoverflow.com/users/1948",
"pm_score": 6,
"selected": true,
"text": "MyList[1] = new MyStruct(\"bob\");\n"
},
{
"answer_id": 51585,
"author": "Gishu",
"author_id": 1695,
"autho... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3989/"
] |
51,548 | <p>We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository.</p>
<p>So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught them all. One way would be to manually move the project file by file to a new folder and see what sticks when compiling. That will take all week, so I need an automated tool.</p>
<p>What do people suggest?</p>
<p>Clarifications:<br>
1) It is C++.<br>
2) The files are mixed. I am looking for files that have been superseded by others but have left to rot in the repository - for instance file_iter.h is not referenced by any other file in the program but remains in the repository just in case someone wants to compile a version from 1996! Now we are moving to a fresh repository we can safely junk all the files that are no longer used.<br>
3) Lint only finds unused includes - not unused files (I have the 7.5 manual in front of me).</p>
| [
{
"answer_id": 52943,
"author": "mweerden",
"author_id": 4285,
"author_profile": "https://Stackoverflow.com/users/4285",
"pm_score": 1,
"selected": false,
"text": "-n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] |
51,553 | <p>I need a real DBA's opinion. Postgres 8.3 takes 200 ms to execute this query on my Macbook Pro while Java and Python perform the same calculation in under 20 ms (350,000 rows):</p>
<pre><code>SELECT count(id), avg(a), avg(b), avg(c), avg(d) FROM tuples;
</code></pre>
<p>Is this normal behaviour when using a SQL database?</p>
<p>The schema (the table holds responses to a survey):</p>
<pre><code>CREATE TABLE tuples (id integer primary key, a integer, b integer, c integer, d integer);
\copy tuples from '350,000 responses.csv' delimiter as ','
</code></pre>
<p>I wrote some tests in Java and Python for context and they crush SQL (except for pure python):</p>
<pre><code>java 1.5 threads ~ 7 ms
java 1.5 ~ 10 ms
python 2.5 numpy ~ 18 ms
python 2.5 ~ 370 ms
</code></pre>
<p>Even sqlite3 is competitive with Postgres despite it assumping all columns are strings (for contrast: even using just switching to numeric columns instead of integers in Postgres results in 10x slowdown)</p>
<p>Tunings i've tried without success include (blindly following some web advice):</p>
<pre><code>increased the shared memory available to Postgres to 256MB
increased the working memory to 2MB
disabled connection and statement logging
used a stored procedure via CREATE FUNCTION ... LANGUAGE SQL
</code></pre>
<p>So my question is, is my experience here normal, and this is what I can expect when using a SQL database? I can understand that ACID must come with costs, but this is kind of crazy in my opinion. I'm not asking for realtime game speed, but since Java can process millions of doubles in under 20 ms, I feel a bit jealous. </p>
<p>Is there a better way to do simple OLAP on the cheap (both in terms of money and server complexity)? I've looked into Mondrian and Pig + Hadoop but not super excited about maintaining yet another server application and not sure if they would even help.</p>
<hr>
<p>No the Python code and Java code do all the work in house so to speak. I just generate 4 arrays with 350,000 random values each, then take the average. I don't include the generation in the timings, only the averaging step. The java threads timing uses 4 threads (one per array average), overkill but it's definitely the fastest.</p>
<p>The sqlite3 timing is driven by the Python program and is running from disk (not :memory:)</p>
<p>I realize Postgres is doing much more behind the scenes, but most of that work doesn't matter to me since this is read only data.</p>
<p>The Postgres query doesn't change timing on subsequent runs.</p>
<p>I've rerun the Python tests to include spooling it off the disk. The timing slows down considerably to nearly 4 secs. But I'm guessing that Python's file handling code is pretty much in C (though maybe not the csv lib?) so this indicates to me that Postgres isn't streaming from the disk either (or that you are correct and I should bow down before whoever wrote their storage layer!)</p>
| [
{
"answer_id": 52006,
"author": "Matthew Watson",
"author_id": 3839,
"author_profile": "https://Stackoverflow.com/users/3839",
"pm_score": 5,
"selected": true,
"text": "create materialized view mv_so_x \nbuild immediate \nrefresh complete \nSTART WITH SYSDATE NEXT SYSDATE + 1/24/60\n as ... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5357/"
] |
51,561 | <p>Typically when writing new code you discover that you are missing a #include because the file doesn't compile. Simple enough, you add the required #include. But later you refactor the code somehow and now a couple of #include directives are no longer needed. How do I discover which ones are no longer needed? </p>
<p>Of course I can manually remove some or all #include lines and add them back until the file compiles again, but this isn't really feasible in a large project with thousands of files. Are there any tools available that will help automating task?</p>
| [
{
"answer_id": 8667351,
"author": "Gediminas",
"author_id": 1121061,
"author_profile": "https://Stackoverflow.com/users/1121061",
"pm_score": 0,
"selected": false,
"text": "Sub RemoveNotUsedIncludes()\n\n'Check if already processed; Exit if so\nActiveDocument.Selection.FindText \"//INCLU... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/988/"
] |
51,564 | <p>How can i format currency related data in a manner that is culture aware in JavaScript?</p>
| [
{
"answer_id": 14564724,
"author": "laktak",
"author_id": 52817,
"author_profile": "https://Stackoverflow.com/users/52817",
"pm_score": 0,
"selected": false,
"text": "var number = 3500;\nconsole.log(number.toLocaleString()); /* Displays \"3,500\" in English locale */\n"
},
{
"ans... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1360/"
] |
51,572 | <p>How does one <strong>reliably</strong> determine a file's type? File extension analysis is not acceptable. There must be a rubyesque tool similar to the UNIX file(1) command?</p>
<p>This is regarding MIME or content type, not file system classifications, such as directory, file, or socket.</p>
| [
{
"answer_id": 56933,
"author": "Patrick Ritchie",
"author_id": 4748,
"author_profile": "https://Stackoverflow.com/users/4748",
"pm_score": 5,
"selected": false,
"text": "mimetype = `file -Ib #{path}`.gsub(/\\n/,\"\")\n"
},
{
"answer_id": 901660,
"author": "Martin Carpenter",... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
51,574 | <p>Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried <a href="http://www.jgraph.com/jgraph.html" rel="noreferrer">JGraph</a> and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?</p>
<p>To clarify, I'm not looking for a library that produces graphs/charts, I'm looking for one that helps with Graph algorithms, eg minimum spanning tree, Kruskal's algorithm Nodes, Edges, etc. Ideally one with some good algorithms/data structures in a nice Java OO API.</p>
| [
{
"answer_id": 52062,
"author": "Joe Liversedge",
"author_id": 4552,
"author_profile": "https://Stackoverflow.com/users/4552",
"pm_score": 5,
"selected": false,
"text": "UndirectedGraph<String, DefaultEdge> g =\n new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);\n\n Stri... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346/"
] |
51,582 | <p>Let's say I have the following class:</p>
<pre><code>public class Test<E> {
public boolean sameClassAs(Object o) {
// TODO help!
}
}
</code></pre>
<p>How would I check that <code>o</code> is the same class as <code>E</code>?</p>
<pre><code>Test<String> test = new Test<String>();
test.sameClassAs("a string"); // returns true;
test.sameClassAs(4); // returns false;
</code></pre>
<p>I can't change the method signature from <code>(Object o)</code> as I'm overridding a superclass and so don't get to choose my method signature.</p>
<p>I would also rather not go down the road of attempting a cast and then catching the resulting exception if it fails.</p>
| [
{
"answer_id": 51603,
"author": "Slartibartfast",
"author_id": 4433,
"author_profile": "https://Stackoverflow.com/users/4433",
"pm_score": 2,
"selected": false,
"text": "public class Test<E> { \n\n private E e; \n\n public void setE(E e) { \n this.e = e; \n }\n\n p... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
51,586 | <p>Is there a way to collect (e.g. in a List) multiple 'generic' objects that don't share a common super class? If so, how can I access their common properties?</p>
<p>For example:</p>
<pre><code>class MyObject<T>
{
public T Value { get; set; }
public string Name { get; set; }
public MyObject(string name, T value)
{
Name = name;
Value = value;
}
}
var fst = new MyObject<int>("fst", 42);
var snd = new MyObject<bool>("snd", true);
List<MyObject<?>> list = new List<MyObject<?>>(){fst, snd};
foreach (MyObject<?> o in list)
Console.WriteLine(o.Name);
</code></pre>
<p>Obviously, this is pseudo code, this doesn't work.</p>
<p>Also I don't need to access the .Value property (since that wouldn't be type-safe).</p>
<p><strong>EDIT:</strong> Now that I've been thinking about this, It would be possible to use sub-classes for this. However, I think that would mean I'd have to write a new subclass for every new type.</p>
<hr>
<p>@<a href="https://stackoverflow.com/questions/51586/accessing-non-generic-members-of-a-generic-object#51621">Grzenio</a>
Yes, that exactly answered my question. Of course, now I need to duplicate the entire shared interface, but that's not a big problem. I should have thought of that...</p>
<p>@<a href="https://stackoverflow.com/questions/51586/accessing-non-generic-members-of-a-generic-object#51611">aku</a>
You are right about the duck typing. I wouldn't expect two completely random types of objects to be accessible.</p>
<p>But I thought generic objects would share some kind of common interface, since they are exactly the same, apart from the type they are parametrized by. Apparently, this is not the case automatically.</p>
| [
{
"answer_id": 51621,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 4,
"selected": true,
"text": "interface INamedObject\n{\n string Name {get;}\n}\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597/"
] |
51,589 | <p>I'm attempting to make a DTS package to transfer data between two databases on the same server and I'm getting the following errors. Iv read that the Multiple-step OLE DB operation generated error can occur when you are transferring between different database types and there is loss of precision, but this is not that case here. How do I examine the column meta data?</p>
<blockquote>
<p>Error: 0xC0202009 at Data Flow Task,
piTech [183]: An OLE DB error has
occurred. Error code: 0x80040E21. An
OLE DB record is available. Source:
"Microsoft SQL Native Client"
Hresult: 0x80040E21 Description:
"Multiple-step OLE DB operation
generated errors. Check each OLE DB
status value, if available. No work
was done.".</p>
<p>Error: 0xC0202025 at Data Flow Task,
piTech [183]: Cannot create an OLE DB
accessor. Verify that the column
metadata is valid.</p>
<p>Error: 0xC004701A at Data Flow Task,
DTS.Pipeline: component "piTech" (183)
failed the pre-execute phase and
returned error code 0xC0202025.</p>
</blockquote>
| [
{
"answer_id": 51606,
"author": "Michael Prewecki",
"author_id": 4403,
"author_profile": "https://Stackoverflow.com/users/4403",
"pm_score": 0,
"selected": false,
"text": "SELECT * FROM INFORMATION_SCHEMA.COLUMNS"
},
{
"answer_id": 52032,
"author": "Michael Prewecki",
"au... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230/"
] |
51,592 | <p>I assume that <code>char* = "string"</code> is the same to <code>char* = new char[6]</code>. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves?</p>
| [
{
"answer_id": 51595,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 1,
"selected": false,
"text": "const char* c = \"string\";\n"
},
{
"answer_id": 51598,
"author": "Andrew",
"author_id": 826,
"author_profile... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688440/"
] |
51,593 | <p>What is the easiest way to extract the original exception from an exception returned via Apache's implementation of XML-RPC?</p>
| [
{
"answer_id": 52995,
"author": "ScArcher2",
"author_id": 1310,
"author_profile": "https://Stackoverflow.com/users/1310",
"pm_score": 1,
"selected": false,
"text": "HTTP/1.1 200 OK\nConnection: close\nContent-Length: 426\nContent-Type: text/xml\nDate: Fri, 17 Jul 1998 19:55:02 GMT\nServe... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/279/"
] |
51,619 | <p>My server already runs IIS on TCP ports 80 and 443. I want to make a centralized "push/pull" Git repository available to all my team members over the Internet.</p>
<p>So I should use HTTP or HTTPS.</p>
<p>But I cannot use Apache because of IIS already hooking up listening sockets on ports 80 and 443! Is there any way to publish a Git repository over <em>IIS</em>? Does Git use WebDAV?</p>
<p><strong>Update.</strong> It seems that Git HTTP installation is read-only. That's sad. I intended to keep the stable branch on a build server and redeploy using a hook on push. Does anyone see a workaround besides using SVN for that branch?</p>
| [
{
"answer_id": 73271799,
"author": "Luke S",
"author_id": 19371365,
"author_profile": "https://Stackoverflow.com/users/19371365",
"pm_score": 0,
"selected": false,
"text": "git-http-backend.exe"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2313/"
] |
51,645 | <p>How can I discover any USB storage devices and/or CD/DVD writers available at a given time (using C# .Net2.0).</p>
<p>I would like to present users with a choice of devices onto which a file can be stored for physically removal - i.e. not the hard drive.</p>
| [
{
"answer_id": 51656,
"author": "sven",
"author_id": 46,
"author_profile": "https://Stackoverflow.com/users/46",
"pm_score": 1,
"selected": false,
"text": "Me.lstDrives.Items.Clear()\nFor Each item As DriveInfo In My.Computer.FileSystem.Drives\n If item.DriveType = DriveType.Removable... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5019/"
] |
51,653 | <p>This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation:
Let´s suppose that you have a query returning something that is not represented by any of your domain classes.
Do you create a specific class to represent that specific query?
Do you return the query in some other kind of object (array, map...)
Some other solutions?
I would like to know about your experiences and best practices.</p>
<p>P.S.
Actually I am creating specific objetcs for specific queries.</p>
| [
{
"answer_id": 51764,
"author": "Ivan Bosnic",
"author_id": 3221,
"author_profile": "https://Stackoverflow.com/users/3221",
"pm_score": 0,
"selected": false,
"text": "USER\nPROJECT\nTASK\nUSER to TASK 1:n\nPROJECT to TASK 1:n\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3221/"
] |
51,654 | <p>I have the situation where i use GIS software which stores the information about GIS objects into separate database table for each type/class of GIS object (road, river, building, sea, ...) and keeps the metadata table in which it stores info about the class name and its DB table.</p>
<p>Those GIS objects of different classes share some parameters, i.e. Description and ID. I'd like to represent all of these different GIS classes with one common C# class (let's call it GisObject), which is enough for what i need to do from the non-GIS part of the application which lists GIS objects of the given GIS class.</p>
<p>The problem for me is how to map those objects using NHibernate to explain to the NHibernate when creating a C# GisObject to receive and <strong>use the table name as a parameter</strong> which will be read from the meta table (it can be in two steps, i can manually fetch the table name in first step and then pass it down to the NHibernate when pulling GisObject data).</p>
<p>Has anybody dealt with this kind of situation, and can it be done at all?</p>
| [
{
"answer_id": 51934,
"author": "zappan",
"author_id": 4723,
"author_profile": "https://Stackoverflow.com/users/4723",
"pm_score": 2,
"selected": true,
"text": "string qs = getSession().getNamedQuery(queryName);\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4723/"
] |
51,658 | <p>I need a way to determine the space remaining on a disk volume using python on linux, Windows and OS X. I'm currently parsing the output of the various system calls (df, dir) to accomplish this - is there a better way?</p>
| [
{
"answer_id": 53170,
"author": "jfs",
"author_id": 4279,
"author_profile": "https://Stackoverflow.com/users/4279",
"pm_score": 2,
"selected": false,
"text": "from subprocess import PIPE, Popen\n\ndef free_volume(filename):\n \"\"\"Find amount of disk space available to the current us... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
51,673 | <p>The source database is quite large. The target database doesn't grow automatically. They are on different machines.</p>
<p>I'm coming from a MS SQL Server, MySQL background and IDS11 seems overly complex (I am sure, with good reason).</p>
| [
{
"answer_id": 488064,
"author": "calvinkrishy",
"author_id": 53949,
"author_profile": "https://Stackoverflow.com/users/53949",
"pm_score": 1,
"selected": false,
"text": "ontape -s -L 0 -F | rsh secondary_server \"ontape –p\"\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5374/"
] |
51,680 | <p>Does anyone have a decent algorithm for calculating axis minima and maxima? </p>
<p>When creating a chart for a given set of data items, I'd like to be able to give the algorithm: </p>
<ul>
<li>the maximum (y) value in the set </li>
<li>the minimum (y) value in the set </li>
<li>the number of tick marks to appear on the axis </li>
<li>an optional value that <strong>must</strong> appear as a tick (e.g. zero when showing +ve and -ve values)</li>
</ul>
<p>The algorithm should return</p>
<ul>
<li>the largest axis value </li>
<li>the smallest axis value (although that could be inferred from the largest, the interval size and the number of ticks)</li>
<li>the interval size </li>
</ul>
<p>The ticks should be at a regular interval should be of a "reasonable" size (e.g. 1, 3, 5, possibly even 2.5, but not any more sig figs). </p>
<p>The presence of the optional value will skew this, but without that value the largest item should appear between the top two tick marks, the lowest value between the bottom two. </p>
<p>This is a language-agnostic question, but if there's a C#/.NET library around, that would be smashing ;) </p>
| [
{
"answer_id": 152647,
"author": "Bart Read",
"author_id": 17786,
"author_profile": "https://Stackoverflow.com/users/17786",
"pm_score": 2,
"selected": false,
"text": " private float GetYMarkerSpacing()\n {\n YValueRange range = m_ScrollableCanvas.\n Tim... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2902/"
] |
51,684 | <p>I have a <a href="http://www.samurize.com/modules/news/" rel="noreferrer">Samurize</a> config that shows a CPU usage graph similar to Task manager. </p>
<p>How do I also display the name of the process with the current highest CPU usage percentage? </p>
<p>I would like this to be updated, at most, once per second. Samurize can call a command line tool and display it's output on screen, so this could also be an option.</p>
<hr>
<p>Further clarification: </p>
<p>I have investigated writing my own command line c# .NET application to enumerate the array returned from System.Diagnostics.Process.GetProcesses(), but the Process instance class does not seem to include a CPU percentage property. </p>
<p>Can I calculate this in some way?</p>
| [
{
"answer_id": 51743,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 1,
"selected": false,
"text": "Process.TotalProcessorTime\n"
},
{
"answer_id": 51789,
"author": "PabloG",
"author_id": 394,
"author_p... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5023/"
] |
51,686 | <p>Is it possible to deploy a native Delphi application with ClickOnce without a stub C# exe that would be used to launch the Delphi application?</p>
<p>The same question applies to VB6, C++ and other native Windows applications.</p>
| [
{
"answer_id": 1149048,
"author": "Sake",
"author_id": 77996,
"author_profile": "https://Stackoverflow.com/users/77996",
"pm_score": 4,
"selected": true,
"text": "MyApp-YYYY-MM-DD-HH-MM-SS.exe --update MyApp.EXE\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5362/"
] |
51,687 | <p>Has anyone implemented Lightbox style background dimming on a modal dialog box in a MFC/non .net app.<br>
I think the procedure would have to be something like:</p>
<p>steps:</p>
<ol>
<li><p>Get dialog parent HWND or CWnd* </p></li>
<li><p>Get the rect of the parent window and draw an overlay with a translucency over that window </p></li>
<li>allow the dialog to do it's modal draw routine, e.g DoModal()</li>
</ol>
<p>Are there any existing libraries/frameworks to do this, or what's the best way to drop a translucent overlay in MFC?<br>
<strong>edit</strong> Here's a mockup of what i'm trying to achieve if you don't know what 'lightbox style' means<br>
<strong>Some App</strong>:<br>
<img src="https://farm4.static.flickr.com/3065/2843243996_8a4536f516_o.png" alt="alt text"> </p>
<p>with a lightbox dialog box<br>
<img src="https://farm4.static.flickr.com/3280/2842409249_4a1c7f5810_o.png" alt="alt text"></p>
| [
{
"answer_id": 54341,
"author": "geocoin",
"author_id": 379,
"author_profile": "https://Stackoverflow.com/users/379",
"pm_score": 3,
"selected": true,
"text": "BOOL LightBoxDlg::Create(UINT nIDTemplate, CWnd* pParentWnd)\n{\n\n if(!CDialog::Create(nIDTemplate, pParentWnd))\n re... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/379/"
] |
51,741 | <p>I was given an .xml file that I needed to read into my code as a DataSet (as background, the file was created by creating a <code>DataSet</code> in C# and calling <code>dataSet.WriteXml(file, XmlWriteMode.IgnoreSchema)</code>, but this was done by someone else). </p>
<p>The .xml file was shaped like this:</p>
<pre><code> <?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Foo>
<Bar>abcd</Bar>
<Foo>efg</Foo>
</Foo>
<Foo>
<Bar>hijk</Bar>
<Foo>lmn</Foo>
</Foo>
</NewDataSet>
</code></pre>
<p>Using C# and .NET 2.0, I read the file in using the code below:</p>
<pre><code> DataSet ds = new DataSet();
ds.ReadXml(file);
</code></pre>
<p>Using a breakpoint, after this <code>line ds.Tables[0]</code> looked like this (using dashes in place of underscores that I couldn't get to format properly):</p>
<pre><code>Bar Foo-Id Foo-Id-0
abcd 0 null
null 1 0
hijk 2 null
null 3 2
</code></pre>
<p>I have found a workaround (I know there are many) and have been able to successfully read in the .xml, but what I would like to understand why <code>ds.ReadXml(file)</code> performed in this manner, so I will be able to avoid the issue in the future. Thanks.</p>
| [
{
"answer_id": 51867,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 3,
"selected": true,
"text": "<NewDataSet> \n <Foo> <!-- Foo-Id: 0 -->\n <Bar>abcd</Bar>\n <Foo>efg</Foo> <!-- Foo-Id: 1, Parent-Id: 0 --... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4660/"
] |
51,751 | <p>I have a ASP.Net website that is failing on AJAX postbacks (both with ASP.Net AJAX and a 3rd part control) in IE. FireFox works fine. If I install the website on another machine without .Net 3.5 SP1, it works as expected.</p>
<p>When it fails, Fiddler shows that I'm getting a 405 "Method Not Allowed". The form seems to be posting to pages other than page I'm viewing.</p>
<p>The form's action is "#" for the page on the broken website (with SP1). The form's action is "Default.aspx" for the same page on a website without SP1.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 51867,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 3,
"selected": true,
"text": "<NewDataSet> \n <Foo> <!-- Foo-Id: 0 -->\n <Bar>abcd</Bar>\n <Foo>efg</Foo> <!-- Foo-Id: 1, Parent-Id: 0 --... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5389/"
] |
51,768 | <p>As part of some error handling in our product, we'd like to dump some stack trace information. However, we experience that many users will simply take a screenshot of the error message dialog instead of sending us a copy of the full report available from the program, and thus I'd like to make some minimal stack trace information available in this dialog.</p>
<p>A .NET stack trace on my machine looks like this:</p>
<pre><code>at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at LVKWinFormsSandbox.MainForm.button1_Click(Object sender, EventArgs e) in C:\Dev\VS.NET\Gatsoft\LVKWinFormsSandbox\MainForm.cs:line 36
</code></pre>
<p>I have this question:</p>
<p>The format looks to be this:</p>
<pre><code>at <class/method> [in file:line ##]
</code></pre>
<p>However, the <em>at</em> and <em>in</em> keywords, I assume these will be localized if they run, say, a norwegian .NET runtime instead of the english one I have installed.</p>
<p>Is there any way for me to pick apart this stack trace in a language-neutral manner, so that I can display only the file and line number for those entries that have this?</p>
<p>In other words, I'd like this information from the above text:</p>
<pre><code>C:\Dev\VS.NET\Gatsoft\LVKWinFormsSandbox\MainForm.cs:line 36
</code></pre>
<p>Any advice you can give will be helpful.</p>
| [
{
"answer_id": 51803,
"author": "Curt Hagenlocher",
"author_id": 533,
"author_profile": "https://Stackoverflow.com/users/533",
"pm_score": 7,
"selected": true,
"text": "var trace = new System.Diagnostics.StackTrace(exception);\n"
},
{
"answer_id": 51821,
"author": "oglester",... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] |
51,771 | <p>I have a class with a <code>ToString</code> method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. </p>
<p><strong>Should I include the DTD as a string within the unit test to avoid a dependency</strong> on it, or is there a smarter way to do this?</p>
| [
{
"answer_id": 30647084,
"author": "R. Oosterholt",
"author_id": 1183010,
"author_profile": "https://Stackoverflow.com/users/1183010",
"pm_score": 0,
"selected": false,
"text": "XMLUnit.setIgnoreWhitespace(true);\nXMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);\n\nDiff diff = new Diff(ex... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1736/"
] |
51,781 | <p>I have a variable of type <code>Dynamic</code> and I know for sure one of its fields, lets call it <code>a</code>, actually is an array. But when I'm writing </p>
<pre><code>var d : Dynamic = getDynamic();
for (t in d.a) {
}
</code></pre>
<p>I get a compilation error on line two:</p>
<blockquote>
<p>You can't iterate on a Dynamic value, please specify Iterator or Iterable</p>
</blockquote>
<p>How can I make this compilable?</p>
| [
{
"answer_id": 51802,
"author": "Danny Wilson",
"author_id": 5364,
"author_profile": "https://Stackoverflow.com/users/5364",
"pm_score": 4,
"selected": true,
"text": "Dynamic"
},
{
"answer_id": 67059,
"author": "Michael Pliskin",
"author_id": 9777,
"author_profile": "... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
51,783 | <p>Flat files and relational databases give us a mechanism to serialize structured data. XML is superb for serializing un-structured tree-like data.</p>
<p>But many problems are best represented by graphs. A thermal simulation program will, for instance, work with temperature nodes connected to each others through resistive edges.</p>
<p>So what is the best way to serialize a graph structure? I know XML can, to some extent, do it---in the same way that a relational database can serialize a complex web of objects: it usually works but can easily get ugly.</p>
<p>I know about the dot language used by the graphviz program, but I'm not sure this is the best way to do it. This question is probably the sort of thing academia might be working on and I'd love to have references to any papers discussing this.</p>
| [
{
"answer_id": 51794,
"author": "jodonnell",
"author_id": 4223,
"author_profile": "https://Stackoverflow.com/users/4223",
"pm_score": 3,
"selected": false,
"text": "0: foo\n1: bar\n2: bat\n----\n0 1\n0 2\n1 2\n"
},
{
"answer_id": 51814,
"author": "Nick Fortescue",
"author... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] |
51,786 | <p>How can I generate UML diagrams (especially sequence diagrams) from existing Java code?</p>
| [
{
"answer_id": 8751193,
"author": "Thomas Ahle",
"author_id": 205521,
"author_profile": "https://Stackoverflow.com/users/205521",
"pm_score": 8,
"selected": false,
"text": "Name: ObjectAid UML Explorer\nLocation: http://www.objectaid.com/update/current\n"
},
{
"answer_id": 39... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772/"
] |
51,793 | <p>When you send an email using C# and the System.Net.Mail namespace, you can set the "From" and "Sender" properties on the MailMessage object, but neither of these allows you to make the MAIL FROM and the from address that goes into the DATA section different from each other. MAIL FROM gets set to the "From" property value, and if you set "Sender" it only adds another header field in the DATA section. This results in "From X@Y.COM on behalf of A@B.COM", which is not what you want. Am I missing something?</p>
<p>The use case is controlling the NDR destination for newsletters, etc., that are sent on behalf of someone else.</p>
<p>I am currently using <a href="http://www.aspnetemail.com/" rel="noreferrer">aspNetEmail</a> instead of System.Net.Mail, since it allows me to do this properly (like most other SMTP libraries). With aspNetEmail, this is accomplished using the EmailMessage.ReversePath property.</p>
| [
{
"answer_id": 51846,
"author": "George Mauer",
"author_id": 5056,
"author_profile": "https://Stackoverflow.com/users/5056",
"pm_score": 1,
"selected": false,
"text": "//create the mail message\n MailMessage mail = new MailMessage();\n\n //set the addresses\n mail.From = new MailAddress(... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] |
51,827 | <p>I want to ask how other programmers are producing Dynamic SQL strings for execution as the CommandText of a SQLCommand object.</p>
<p>I am producing parameterized queries containing user-generated WHERE clauses and SELECT fields. Sometimes the queries are complex and I need a lot of control over how the different parts are built. </p>
<p>Currently, I am using many loops and switch statements to produce the necessary SQL code fragments and to create the SQL parameters objects needed. This method is difficult to follow and it makes maintenance a real chore. </p>
<p>Is there a cleaner, more stable way of doing this?</p>
<p>Any Suggestions?</p>
<p>EDIT:
To add detail to my previous post:</p>
<ol>
<li>I cannot really template my query due to the requirements. It just changes too much.</li>
<li>I have to allow for aggregate functions, like Count(). This has consequences for the Group By/Having clause. It also causes nested SELECT statements. This, in turn, effects the column name used by </li>
<li>Some Contact data is stored in an XML column. Users can query this data AS WELL AS and the other relational columns together. Consequences are that xmlcolumns cannot appear in Group By clauses[sql syntax].</li>
<li>I am using an efficient paging technique that uses Row_Number() SQL Function. Consequences are that I have to use a Temp table and then get the @@rowcount, before selecting my subset, to avoid a second query.</li>
</ol>
<p>I will show some code (the horror!) so that you guys have an idea of what I'm dealing with.</p>
<pre><code>sqlCmd.CommandText = "DECLARE @t Table(ContactId int, ROWRANK int" + declare
+ ")INSERT INTO @t(ContactId, ROWRANK" + insertFields + ")"//Insert as few cols a possible
+ "Select ContactID, ROW_NUMBER() OVER (ORDER BY " + sortExpression + " "
+ sortDirection + ") as ROWRANK" // generates a rowrank for each row
+ outerFields
+ " FROM ( SELECT c.id AS ContactID"
+ coreFields
+ from // sometimes different tables are required
+ where + ") T " // user input goes here.
+ groupBy+ " "
+ havingClause //can be empty
+ ";"
+ "select @@rowcount as rCount;" // return 2 recordsets, avoids second query
+ " SELECT " + fields + ",field1,field2" // join onto the other cols n the table
+" FROM @t t INNER JOIN contacts c on t.ContactID = c.id"
+" WHERE ROWRANK BETWEEN " + ((pageIndex * pageSize) + 1) + " AND "
+ ( (pageIndex + 1) * pageSize); // here I select the pages I want
</code></pre>
<p>In this example, I am querying XML data. For purely relational data, the query is much more simple. Each of the section variables are StringBuilders. Where clauses are built like so:</p>
<pre><code>// Add Parameter to SQL Command
AddParamToSQLCmd(sqlCmd, "@p" + z.ToString(), SqlDbType.VarChar, 50, ParameterDirection.Input, qc.FieldValue);
// Create SQL code Fragment
where.AppendFormat(" {0} {1} {2} @p{3}", qc.BooleanOperator, qc.FieldName, qc.ComparisonOperator, z);
</code></pre>
| [
{
"answer_id": 51938,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "string query= \"SELECT {0} FROM .... WHERE {1}\"\nStringBuilder selectclause = new StringBuilder();\nStringBuilder wher... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5197/"
] |
51,837 | <p>I have up to 4 files based on this structure (note the prefixes are dates)</p>
<ul>
<li>0830filename.txt</li>
<li>0907filename.txt</li>
<li>0914filename.txt</li>
<li>0921filename.txt</li>
</ul>
<p>I want to open the the most recent one (0921filename.txt). how can i do this in a batch file?</p>
<p>Thanks.</p>
| [
{
"answer_id": 51868,
"author": "seanyboy",
"author_id": 1726,
"author_profile": "https://Stackoverflow.com/users/1726",
"pm_score": 1,
"selected": false,
"text": "dir *.txt /b /od > systext.bak \nFOR /F %%i in (systext.bak) do set sysRunCommand=%%i \ncall %sysRunCommand%\ndel systext.ba... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] |
51,884 | <p>I recently discussed editors with a co-worker. He uses one of the less popular editors and I use another (I won't say which ones since it's not relevant and I want to avoid an editor flame war). I was saying that I didn't like his editor as much because it doesn't let you do find/replace with regular expressions.</p>
<p>He said he's never wanted to do that, which was surprising since it's something I find myself doing all the time. However, off the top of my head I wasn't able to come up with more than one or two examples. Can anyone here offer some examples of times when they've found regex find/replace useful in their editor? Here's what I've been able to come up with since then as examples of things that I've actually had to do:</p>
<ol>
<li><p>Strip the beginning of a line off of every line in a file that looks like:<br>
<code>Line 25634 :</code><br>
<code>Line 632157 :</code></p></li>
<li><p>Taking a few dozen files with a standard header which is slightly different for each file and stripping the first 19 lines from all of them all at once.</p></li>
<li><p>Piping the result of a MySQL select statement into a text file, then removing all of the formatting junk and reformatting it as a Python dictionary for use in a simple script.</p></li>
<li><p>In a CSV file with no escaped commas, replace the first character of the 8th column of each row with a capital A.</p></li>
<li><p>Given a bunch of GDB stack traces with lines like<br>
<code>#3 0x080a6d61 in _mvl_set_req_done (req=0x82624a4, result=27158) at ../../mvl/src/mvl_serv.c:850</code><br>
strip out everything from each line except the function names.</p></li>
</ol>
<p>Does anyone else have any real-life examples? The next time this comes up, I'd like to be more prepared to list good examples of why this feature is useful.</p>
| [
{
"answer_id": 51911,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 2,
"selected": false,
"text": "(\\b\\w+\\b)\n"
},
{
"answer_id": 51918,
"author": "David Schmitt",
"author_id": 4918,
"author_profile... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] |
51,887 | <p>I am doing profiling of a C code in Microsoft VS 2005 on a Intel Core-2Duo platform.
I measure the time(secs:millisecs) counsumed by my function. But i have some doubts about the accuracy of this measurement as the operating system will not continuously run my application, but instead schedule others apps/services in between the execution of my code.(Although i have no major applications running while i do the profile run, still windows will have lot of code of its own which it will run by preempting my app.). Because of all this i believe the profiling number(time taken by my app to run) is not accurate. </p>
<p>So my question is there any way to find out the Operating system overheads, scheduling overhead on a typical windows system(I run Windows XP)e.g. if my applications says it ran for 60 milliseconds, out of that 60 msec, how much time really was used by my app. and how much time it was sitting idle, due to being pre-empted by some other task scheduled by the OS?</p>
<p>or </p>
<p>Atleast is there any ball-park number to get such OS overhead, based on your experience you came across while doing something similar?</p>
| [
{
"answer_id": 51936,
"author": "David Schlosnagle",
"author_id": 1750,
"author_profile": "https://Stackoverflow.com/users/1750",
"pm_score": 1,
"selected": false,
"text": "time"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/51887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759376/"
] |
51,898 | <p>In a C# Windows Forms application I want to detect if another instance of the application is already running.
If so, activate the main form of the running instance and exit this instance.</p>
<p>What is the best way to achieve this?</p>
| [
{
"answer_id": 51902,
"author": "Dean Hill",
"author_id": 3106,
"author_profile": "https://Stackoverflow.com/users/3106",
"pm_score": 3,
"selected": false,
"text": "// Sets the window to be foreground\n[DllImport(\"User32\")]\nprivate static extern int SetForegroundWindow(IntPtr hwnd);\n... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3106/"
] |
51,927 | <p>How do I figure out if an array contains an element?
I thought there might be something like <code>[1, 2, 3].includes(1)</code> which would evaluate as <code>true</code>.</p>
| [
{
"answer_id": 51951,
"author": "banderson623",
"author_id": 5419,
"author_profile": "https://Stackoverflow.com/users/5419",
"pm_score": 6,
"selected": false,
"text": "contains"
},
{
"answer_id": 62082,
"author": "dahernan",
"author_id": 6435,
"author_profile": "https... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5419/"
] |
51,931 | <p>I'm having a problem running a T4 template using TextTransform.exe on my build server. On my dev machine the template works perfectly. The error message is as follows.</p>
<blockquote>
<p>error : Running transformation: System.TypeLoadException: Could not instantiate type System.Xml.Linq.XDocument</p>
</blockquote>
<p>The build server has the windows 2008 SDK on it, my machine has VS 2008. I thought mayve it couldn't find System.Data.Xml so I ensure the dll was present in the same directory, but no luck. Any ideas?</p>
| [
{
"answer_id": 51951,
"author": "banderson623",
"author_id": 5419,
"author_profile": "https://Stackoverflow.com/users/5419",
"pm_score": 6,
"selected": false,
"text": "contains"
},
{
"answer_id": 62082,
"author": "dahernan",
"author_id": 6435,
"author_profile": "https... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086/"
] |
51,941 | <p>I have created a database report generator in Excel. I am trying to create a dialog box that displays status information as the program runs.</p>
<p>When I generate the report, although the dialog box appears, I cannot refresh/update the information it displays. Most of the time, the dialog box only partially appears. I have tried using the .repaint method, but I still get the same results. I only see the complete dialog box, after the report is generated.</p>
| [
{
"answer_id": 51953,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 3,
"selected": false,
"text": "Sub StatusBarExample()\n Application.ScreenUpdating = False \n ' turns off screen updating\n Application.DisplaySt... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2665/"
] |
51,948 | <p>I'm building a C++/MFC program in a multilingual environment. I have one main (national) language and three international languages. Every time I add a feature to the program I have to keep the international languages up-to-date with the national one. The resource editor in Visual Studio is not very helpful because I frequently end up leaving a string, dialog box, etc., untranslated.</p>
<p>I wonder if you guys know of a program that can edit resource (.rc) files and</p>
<ul>
<li>Build a file that includes only the strings to be translated and their respective IDs and accepts the same (or similar) file in another language (this would be helpful since usually the translation is done by someone else), or</li>
<li>Handle the translations itself, allowing to view the same string in different languages at the same time.</li>
</ul>
| [
{
"answer_id": 65313,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "for i in $trfile\ndo\n key=`echo $i | sed 's/^\\(.*\\)=\\(.*\\)$/\\1/g'`\n value=`echo $i | sed 's/^\\(.*\\)=\\(.*\\)$/\\... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4880/"
] |
51,949 | <p>Given a string <code>"filename.conf"</code>, how to I verify the extension part?</p>
<p>I need a cross platform solution.</p>
| [
{
"answer_id": 51965,
"author": "Aardvark",
"author_id": 3655,
"author_profile": "https://Stackoverflow.com/users/3655",
"pm_score": 2,
"selected": false,
"text": "_splitpath, _wsplitpath, _splitpath_s, _wsplitpath_w\n"
},
{
"answer_id": 51992,
"author": "17 of 26",
"auth... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445087/"
] |
51,950 | <p>I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ?</p>
| [
{
"answer_id": 51958,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 8,
"selected": true,
"text": "[assembly:InternalsVisibleToAttribute(\"UnitTestAssemblyName\")]\n"
},
{
"answer_id": 51986,
"author": "Simon Keep",
... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4694/"
] |
51,964 | <p>In my base page I need to remove an item from the query string and redirect. I can't use<br/></p>
<pre><code>Request.QueryString.Remove("foo")
</code></pre>
<p>because the collection is read-only. Is there any way to get the query string (except for that one item) without iterating through the collection and re-building it?</p>
| [
{
"answer_id": 51981,
"author": "hollystyles",
"author_id": 2083160,
"author_profile": "https://Stackoverflow.com/users/2083160",
"pm_score": 2,
"selected": false,
"text": "Response.Redirect(String.Format(\"nextpage.aspx?{0}\", Request.QueryString.ToString().Replace(\"foo\", \"mangledfoo... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2757/"
] |
51,969 | <p>In Microsoft SQL Server, is there a way to detect whether a database has had its isolation level set via the T-SQL command <code>ALTER DATABASE <database> SET READ_COMMITTED_SNAPSHOT ON;</code>?</p>
<p>I cannot find a simple way to detect this in either T-SQL or via the Management Studio's GUI.</p>
| [
{
"answer_id": 51977,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 9,
"selected": true,
"text": "SELECT is_read_committed_snapshot_on FROM sys.databases \nWHERE name= 'YourDatabase'\n"
},
{
"answer_id": 20942633,
... | 2008/09/09 | [
"https://Stackoverflow.com/questions/51969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5217/"
] |
52,002 | <p><strong>Definition:</strong></p>
<p><em>A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction</em></p>
<p>How to check if the given string is a palindrome?</p>
<p>This was one of the FAIQ [Frequently Asked Interview Question] a while ago but that mostly using C.</p>
<p>Looking for solutions in any and all languages possible.</p>
| [
{
"answer_id": 52013,
"author": "Ryan Ahearn",
"author_id": 75,
"author_profile": "https://Stackoverflow.com/users/75",
"pm_score": 2,
"selected": false,
"text": "boolean isPalindrome(String str1) {\n //first strip out punctuation and spaces\n String stripped = str1.replaceAll(\"[^a-zA... | 2008/09/09 | [
"https://Stackoverflow.com/questions/52002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123/"
] |
52,008 | <p>I need to design a small project for generating excel reports in .NET, which will be sent to users to use.</p>
<p>The excel reports will contain PivotTables.</p>
<p>I don't have much experience with them, but I can think of three implementation alternatives:</p>
<ol>
<li>Set a query for it, populate it, send it disconnected. This way the user will be able to group values and play a little, but he will not be able to refresh the data.</li>
<li>Generate a small access database and send it along with the excel file, connect to it.</li>
<li>Copy the data to the excel (perhaps in some other sheet) and connect to the data there. This will make the excel file very large I think.</li>
</ol>
<p>What would be the best alternative in regards to performance vs usability? Is there another alternative I don't know about?</p>
| [
{
"answer_id": 52013,
"author": "Ryan Ahearn",
"author_id": 75,
"author_profile": "https://Stackoverflow.com/users/75",
"pm_score": 2,
"selected": false,
"text": "boolean isPalindrome(String str1) {\n //first strip out punctuation and spaces\n String stripped = str1.replaceAll(\"[^a-zA... | 2008/09/09 | [
"https://Stackoverflow.com/questions/52008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
52,046 | <p>Since CS3 doesn't have a web service component, as previous versions had, is there a good, feature-complete, AS3-only (no Flex dependencies) library for accessing web services with AS3?</p>
| [
{
"answer_id": 430835,
"author": "typeoneerror",
"author_id": 53653,
"author_profile": "https://Stackoverflow.com/users/53653",
"pm_score": 0,
"selected": false,
"text": "urlRequest.requestHeaders.push(new URLRequestHeader(\"Content-Type\", \"application/soap+xml\"));"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/52046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5421/"
] |
52,066 | <p>Is there an existing solution to create a regular expressions dynamically out of a given date-time format pattern? The supported date-time format pattern does not matter (Joda <code>DateTimeFormat</code>, <code>java.text.SimpleDateTimeFormat</code> or others).</p>
<p>As a specific example, for a given date-time format like <code>dd/MM/yyyy hh:mm</code>, it should generate the corresponding regular expression to match the date-times within the specified formats.</p>
| [
{
"answer_id": 52149,
"author": "Jason Cohen",
"author_id": 4926,
"author_profile": "https://Stackoverflow.com/users/4926",
"pm_score": 0,
"selected": false,
"text": "SimpleDateFormat"
},
{
"answer_id": 179044,
"author": "Keng",
"author_id": 730,
"author_profile": "ht... | 2008/09/09 | [
"https://Stackoverflow.com/questions/52066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3993/"
] |
52,071 | <p>Does anyone know of any good library that abstracts the problem of path manipulation in a nice way? I'd like to be able to combine and parse paths with arbitrary separators ('/' or ':' for example) without reinventing the wheel.</p>
<p>It's a shame that <code>System.IO.Path</code> isn't more reusable.</p>
<p>Thanks</p>
| [
{
"answer_id": 1637777,
"author": "Bob",
"author_id": 45,
"author_profile": "https://Stackoverflow.com/users/45",
"pm_score": 0,
"selected": false,
"text": "System.IO.Path"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/52071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5380/"
] |
52,072 | <p>I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly.</p>
<p>Has anyone used an Ioc container in PHP? All I've been able to find is <a href="http://www.phpclasses.org/browse/package/3382.html" rel="nofollow noreferrer">PHP IOC on the ever-annoying phpclasses.org</a> and it seems to have almost no documentation and not much of a following.</p>
| [
{
"answer_id": 13340863,
"author": "Matthieu Napoli",
"author_id": 245552,
"author_profile": "https://Stackoverflow.com/users/245552",
"pm_score": 2,
"selected": false,
"text": "class Foo {\n /**\n * @Inject\n * @var Bar\n */\n private $bar;\n}\n"
}
] | 2008/09/09 | [
"https://Stackoverflow.com/questions/52072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] |
52,080 | <p>How can I build a loop in JavaScript?</p>
| [
{
"answer_id": 52083,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": -1,
"selected": false,
"text": "for (var = startvalue; var <= endvalue; var = var + increment) {\n // code to be executed\n}\n"
},
{
"answer_id":... | 2008/09/09 | [
"https://Stackoverflow.com/questions/52080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.